var Prototype={Version:"1.6.1",Browser:(function(){var c=navigator.userAgent;var d=Object.prototype.toString.call(window.opera)=="[object Opera]";return{IE:!!window.attachEvent&&!d,Opera:d,WebKit:c.indexOf("AppleWebKit/")>-1,Gecko:c.indexOf("Gecko")>-1&&c.indexOf("KHTML")===-1,MobileSafari:/Apple.*Mobile.*Safari/.test(c)}})(),BrowserFeatures:{XPath:!!document.evaluate,SelectorsAPI:!!document.querySelector,ElementExtensions:(function(){var b=window.Element||window.HTMLElement;return !!(b&&b.prototype)})(),SpecificElementExtensions:(function(){if(typeof window.HTMLDivElement!=="undefined"){return true}var f=document.createElement("div");var d=document.createElement("form");var e=false;if(f.__proto__&&(f.__proto__!==d.__proto__)){e=true}f=d=null;return e})()},ScriptFragment:"<script[^>]*>([\\S\\s]*?)<\/script>",JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(b){return b}};if(Prototype.Browser.MobileSafari){Prototype.BrowserFeatures.SpecificElementExtensions=false}var Abstract={};var Try={these:function(){var j;for(var e=0,i=arguments.length;e<i;e++){var g=arguments[e];try{j=g();break}catch(h){}}return j}};var Class=(function(){function e(){}function d(){var a=null,b=$A(arguments);if(Object.isFunction(b[0])){a=b.shift()}function h(){this.initialize.apply(this,arguments)}Object.extend(h,Class.Methods);h.superclass=a;h.subclasses=[];if(a){e.prototype=a.prototype;h.prototype=new e;a.subclasses.push(h)}for(var c=0;c<b.length;c++){h.addMethods(b[c])}if(!h.prototype.initialize){h.prototype.initialize=Prototype.emptyFunction}h.prototype.constructor=h;return h}function f(b){var o=this.superclass&&this.superclass.prototype;var p=Object.keys(b);if(!Object.keys({toString:true}).length){if(b.toString!=Object.prototype.toString){p.push("toString")}if(b.valueOf!=Object.prototype.valueOf){p.push("valueOf")}}for(var q=0,n=p.length;q<n;q++){var c=p[q],i=b[c];if(o&&Object.isFunction(i)&&i.argumentNames().first()=="$super"){var a=i;i=(function(g){return function(){return o[g].apply(this,arguments)}})(c).wrap(a);i.valueOf=a.valueOf.bind(a);i.toString=a.toString.bind(a)}this.prototype[c]=i}return this}return{create:d,Methods:{addMethods:f}}})();(function(){var E=Object.prototype.toString;function z(c,a){for(var b in a){c[b]=a[b]}return c}function w(b){try{if(D(b)){return"undefined"}if(b===null){return"null"}return b.inspect?b.inspect():String(b)}catch(a){if(a instanceof RangeError){return"..."}throw a}}function x(e){var c=typeof e;switch(c){case"undefined":case"function":case"unknown":return;case"boolean":return e.toString()}if(e===null){return"null"}if(e.toJSON){return e.toJSON()}if(A(e)){return}var d=[];for(var a in e){var b=x(e[a]);if(!D(b)){d.push(a.toJSON()+": "+b)}}return"{"+d.join(", ")+"}"}function F(a){return $H(a).toQueryString()}function C(a){return a&&a.toHTML?a.toHTML():String.interpret(a)}function s(c){var b=[];for(var a in c){b.push(a)}return b}function v(c){var b=[];for(var a in c){b.push(c[a])}return b}function y(a){return z({},a)}function A(a){return !!(a&&a.nodeType==1)}function B(a){return E.call(a)=="[object Array]"}function r(a){return a instanceof Hash}function G(a){return typeof a==="function"}function H(a){return E.call(a)=="[object String]"}function u(a){return E.call(a)=="[object Number]"}function D(a){return typeof a==="undefined"}z(Object,{extend:z,inspect:w,toJSON:x,toQueryString:F,toHTML:C,keys:s,values:v,clone:y,isElement:A,isArray:B,isHash:r,isFunction:G,isString:H,isNumber:u,isUndefined:D})})();Object.extend(Function.prototype,(function(){var m=Array.prototype.slice;function u(b,a){var c=b.length,d=a.length;while(d--){b[c+d]=a[d]}return b}function o(b,a){b=m.call(b,0);return u(b,a)}function q(){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 p(b){if(arguments.length<2&&Object.isUndefined(arguments[0])){return this}var a=this,c=m.call(arguments,1);return function(){var d=o(c,arguments);return a.apply(b,d)}}function r(b){var a=this,c=m.call(arguments,1);return function(d){var e=u([d||window.event],c);return a.apply(b,e)}}function n(){if(!arguments.length){return this}var a=this,b=m.call(arguments,0);return function(){var c=o(b,arguments);return a.apply(this,c)}}function s(b){var a=this,c=m.call(arguments,1);b=b*1000;return window.setTimeout(function(){return a.apply(a,c)},b)}function x(){var a=u([0.01],arguments);return this.delay.apply(this,a)}function v(b){var a=this;return function(){var c=u([a.bind(this)],arguments);return b.apply(this,c)}}function w(){if(this._methodized){return this._methodized}var a=this;return this._methodized=function(){var b=u([this],arguments);return a.apply(null,b)}}return{argumentNames:q,bind:p,bindAsEventListener:r,curry:n,delay:s,defer:x,wrap:v,methodize:w}})());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(b){return String(b).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")};var PeriodicalExecuter=Class.create({initialize:function(c,d){this.callback=c;this.frequency=d;this.currentlyExecuting=false;this.registerCallback()},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000)},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(b){this.currentlyExecuting=false;throw b}}}});Object.extend(String,{interpret:function(b){return b==null?"":String(b)},specialChar:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\\":"\\\\"}});Object.extend(String.prototype,(function(){function prepareReplacement(replacement){if(Object.isFunction(replacement)){return replacement}var template=new Template(replacement);return function(match){return template.evaluate(match)}}function gsub(pattern,replacement){var result="",source=this,match;replacement=prepareReplacement(replacement);if(Object.isString(pattern)){pattern=RegExp.escape(pattern)}if(!(pattern.length||pattern.source)){replacement=replacement("");return replacement+source.split("").join(replacement)+replacement}while(source.length>0){if(match=source.match(pattern)){result+=source.slice(0,match.index);result+=String.interpret(replacement(match));source=source.slice(match.index+match[0].length)}else{result+=source,source=""}}return result}function sub(pattern,replacement,count){replacement=prepareReplacement(replacement);count=Object.isUndefined(count)?1:count;return this.gsub(pattern,function(match){if(--count<0){return match[0]}return replacement(match)})}function scan(pattern,iterator){this.gsub(pattern,iterator);return String(this)}function truncate(length,truncation){length=length||30;truncation=Object.isUndefined(truncation)?"...":truncation;return this.length>length?this.slice(0,length-truncation.length)+truncation:String(this)}function strip(){return this.replace(/^\s+/,"").replace(/\s+$/,"")}function stripTags(){return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi,"")}function stripScripts(){return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"")}function extractScripts(){var matchAll=new RegExp(Prototype.ScriptFragment,"img");var matchOne=new RegExp(Prototype.ScriptFragment,"im");return(this.match(matchAll)||[]).map(function(scriptTag){return(scriptTag.match(matchOne)||["",""])[1]})}function evalScripts(){return this.extractScripts().map(function(script){return eval(script)})}function escapeHTML(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function unescapeHTML(){return this.stripTags().replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")}function toQueryParams(separator){var match=this.strip().match(/([^?#]*)(#.*)?$/);if(!match){return{}}return match[1].split(separator||"&").inject({},function(hash,pair){if((pair=pair.split("="))[0]){var key=decodeURIComponent(pair.shift());var value=pair.length>1?pair.join("="):pair[0];if(value!=undefined){value=decodeURIComponent(value)}if(key in hash){if(!Object.isArray(hash[key])){hash[key]=[hash[key]]}hash[key].push(value)}else{hash[key]=value}}return hash})}function toArray(){return this.split("")}function succ(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)}function times(count){return count<1?"":new Array(count+1).join(this)}function camelize(){var parts=this.split("-"),len=parts.length;if(len==1){return parts[0]}var camelized=this.charAt(0)=="-"?parts[0].charAt(0).toUpperCase()+parts[0].substring(1):parts[0];for(var i=1;i<len;i++){camelized+=parts[i].charAt(0).toUpperCase()+parts[i].substring(1)}return camelized}function capitalize(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()}function underscore(){return this.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/-/g,"_").toLowerCase()}function dasherize(){return this.replace(/_/g,"-")}function inspect(useDoubleQuotes){var escapedString=this.replace(/[\x00-\x1f\\]/g,function(character){if(character in String.specialChar){return String.specialChar[character]}return"\\u00"+character.charCodeAt().toPaddedString(2,16)});if(useDoubleQuotes){return'"'+escapedString.replace(/"/g,'\\"')+'"'}return"'"+escapedString.replace(/'/g,"\\'")+"'"}function toJSON(){return this.inspect(true)}function unfilterJSON(filter){return this.replace(filter||Prototype.JSONFilter,"$1")}function isJSON(){var str=this;if(str.blank()){return false}str=this.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,"");return(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str)}function evalJSON(sanitize){var json=this.unfilterJSON();try{if(!sanitize||json.isJSON()){return eval("("+json+")")}}catch(e){}throw new SyntaxError("Badly formed JSON string: "+this.inspect())}function include(pattern){return this.indexOf(pattern)>-1}function startsWith(pattern){return this.indexOf(pattern)===0}function endsWith(pattern){var d=this.length-pattern.length;return d>=0&&this.lastIndexOf(pattern)===d}function empty(){return this==""}function blank(){return/^\s*$/.test(this)}function interpolate(object,pattern){return new Template(this,pattern).evaluate(object)}return{gsub:gsub,sub:sub,scan:scan,truncate:truncate,strip:String.prototype.trim?String.prototype.trim:strip,stripTags:stripTags,stripScripts:stripScripts,extractScripts:extractScripts,evalScripts:evalScripts,escapeHTML:escapeHTML,unescapeHTML:unescapeHTML,toQueryParams:toQueryParams,parseQuery:toQueryParams,toArray:toArray,succ:succ,times:times,camelize:camelize,capitalize:capitalize,underscore:underscore,dasherize:dasherize,inspect:inspect,toJSON:toJSON,unfilterJSON:unfilterJSON,isJSON:isJSON,evalJSON:evalJSON,include:include,startsWith:startsWith,endsWith:endsWith,empty:empty,blank:blank,interpolate:interpolate}})());var Template=Class.create({initialize:function(d,c){this.template=d.toString();this.pattern=c||Template.Pattern},evaluate:function(b){if(b&&Object.isFunction(b.toTemplateReplacements)){b=b.toTemplateReplacements()}return this.template.gsub(this.pattern,function(l){if(b==null){return(l[1]+"")}var i=l[1]||"";if(i=="\\"){return l[2]}var a=b,h=l[3];var j=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;l=j.exec(h);if(l==null){return i}while(l!=null){var m=l[1].startsWith("[")?l[2].replace(/\\\\]/g,"]"):l[1];a=a[m];if(null==a||""==l[3]){break}h=h.substring("["==l[3]?l[1].length:l[0].length);l=j.exec(h)}return i+String.interpret(a)})}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;var $break={};var Enumerable=(function(){function R(a,b){var d=0;try{this._each(function(e){a.call(b,e,d++)})}catch(c){if(c!=$break){throw c}}return this}function C(f,a,d){var e=-f,c=[],b=this.toArray();if(f<1){return b}while((e+=f)<b.length){c.push(b.slice(e,e+f))}return c.collect(a,d)}function S(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 L(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 K(a,b){a=a||Prototype.K;var c=[];this.each(function(d,e){c.push(a.call(b,d,e))});return c}function A(a,b){var c;this.each(function(d,e){if(a.call(b,d,e)){c=d;throw $break}});return c}function M(a,b){var c=[];this.each(function(d,e){if(a.call(b,d,e)){c.push(d)}});return c}function N(d,a,b){a=a||Prototype.K;var c=[];if(Object.isString(d)){d=new RegExp(RegExp.escape(d))}this.each(function(e,f){if(d.match(e)){c.push(a.call(b,e,f))}});return c}function T(b){if(Object.isFunction(this.indexOf)){if(this.indexOf(b)!=-1){return true}}var a=false;this.each(function(c){if(c==b){a=true;throw $break}});return a}function D(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(c,a,b){this.each(function(d,e){c=a.call(b,c,d,e)});return c}function y(a){var b=$A(arguments).slice(1);return this.map(function(c){return c[a].apply(c,b)})}function E(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 G(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 P(d,b){d=d||Prototype.K;var a=[],c=[];this.each(function(e,f){(d.call(b,e,f)?a:c).push(e)});return[a,c]}function O(a){var b=[];this.each(function(c){b.push(c[a])});return b}function Q(a,b){var c=[];this.each(function(d,e){if(!a.call(b,d,e)){c.push(d)}});return c}function H(a,b){return this.map(function(d,c){return{value:d,criteria:a.call(b,d,c)}}).sort(function(d,e){var f=d.criteria,c=e.criteria;return f<c?-1:f>c?1:0}).pluck("value")}function F(){return this.map()}function B(){var b=Prototype.K,c=$A(arguments);if(Object.isFunction(c.last())){b=c.pop()}var a=[this].concat(c).map($A);return this.map(function(d,e){return b(a.pluck(e))})}function J(){return this.toArray().length}function z(){return"#<Enumerable:"+this.toArray().inspect()+">"}return{each:R,eachSlice:C,all:S,every:S,any:L,some:L,collect:K,map:K,detect:A,findAll:M,select:M,filter:M,grep:N,include:T,member:T,inGroupsOf:D,inject:I,invoke:y,max:E,min:G,partition:P,pluck:O,reject:Q,sortBy:H,toArray:F,entries:F,zip:B,size:J,inspect:z,find:A}})();function $A(f){if(!f){return[]}if("toArray" in Object(f)){return f.toArray()}var d=f.length||0,e=new Array(d);while(d--){e[d]=f[d]}return e}function $w(b){if(!Object.isString(b)){return[]}b=b.strip();return b?b.split(/\s+/):[]}Array.from=$A;(function(){var z=Array.prototype,F=z.slice,D=z.forEach;function Q(c){for(var a=0,b=this.length;a<b;a++){c(this[a])}}if(!D){D=Q}function G(){this.length=0;return this}function O(){return this[0]}function L(){return this[this.length-1]}function J(){return this.select(function(a){return a!=null})}function x(){return this.inject([],function(b,a){if(Object.isArray(a)){return b.concat(a.flatten())}b.push(a);return b})}function K(){var a=F.call(arguments,0);return this.select(function(b){return !a.include(b)})}function M(a){return(a!==false?this:this.toArray())._reverse()}function H(a){return this.inject([],function(b,c,d){if(0==d||(a?b.last()!=c:!b.include(c))){b.push(c)}return b})}function C(a){return this.uniq().findAll(function(b){return a.detect(function(c){return b===c})})}function B(){return F.call(this,0)}function I(){return this.length}function y(){return"["+this.map(Object.inspect).join(", ")+"]"}function A(){var a=[];this.each(function(c){var b=Object.toJSON(c);if(!Object.isUndefined(b)){a.push(b)}});return"["+a.join(", ")+"]"}function R(b,a){a||(a=0);var c=this.length;if(a<0){a=c+a}for(;a<c;a++){if(this[a]===b){return a}}return -1}function E(c,a){a=isNaN(a)?this.length:(a<0?this.length+a:a)+1;var b=this.slice(0,a).reverse().indexOf(c);return(b<0)?b:a-b-1}function P(){var d=F.call(this,0),b;for(var f=0,c=arguments.length;f<c;f++){b=arguments[f];if(Object.isArray(b)&&!("callee" in b)){for(var a=0,e=b.length;a<e;a++){d.push(b[a])}}else{d.push(b)}}return d}Object.extend(z,Enumerable);if(!z._reverse){z._reverse=z.reverse}Object.extend(z,{_each:D,clear:G,first:O,last:L,compact:J,flatten:x,without:K,reverse:M,uniq:H,intersect:C,clone:B,toArray:B,size:I,inspect:y,toJSON:A});var N=(function(){return[].concat(arguments)[0][0]!==1})(1,2);if(N){z.concat=P}if(!z.indexOf){z.indexOf=R}if(!z.lastIndexOf){z.lastIndexOf=E}})();function $H(b){return new Hash(b)}var Hash=Class.create(Enumerable,(function(){function D(a){this._object=Object.isHash(a)?a.toObject():Object.clone(a)}function C(c){for(var d in this._object){var b=this._object[d],a=[d,b];a.key=d;a.value=b;c(a)}}function x(b,a){return this._object[b]=a}function F(a){if(this._object[a]!==Object.prototype[a]){return this._object[a]}}function u(b){var a=this._object[b];delete this._object[b];return a}function r(){return Object.clone(this._object)}function s(){return this.pluck("key")}function v(){return this.pluck("value")}function B(a){var b=this.detect(function(c){return c.value===a});return b&&b.key}function z(a){return this.clone().update(a)}function E(a){return new Hash(a).inject(this,function(c,b){c.set(b.key,b.value);return c})}function G(b,a){if(Object.isUndefined(a)){return b}return b+"="+encodeURIComponent(String.interpret(a))}function H(){return this.inject([],function(b,a){var c=encodeURIComponent(a.key),d=a.value;if(d&&typeof d=="object"){if(Object.isArray(d)){return b.concat(d.map(G.curry(c)))}}else{b.push(G(c,d))}return b}).join("&")}function w(){return"#<Hash:{"+this.map(function(a){return a.map(Object.inspect).join(": ")}).join(", ")+"}>"}function y(){return Object.toJSON(this.toObject())}function A(){return new Hash(this)}return{initialize:D,_each:C,set:x,get:F,unset:u,toObject:r,toTemplateReplacements:r,keys:s,values:v,index:B,merge:z,update:E,toQueryString:H,inspect:w,toJSON:y,clone:A}})());Hash.from=$H;Object.extend(Number.prototype,(function(){function p(){return this.toPaddedString(2,16)}function o(){return this+1}function s(a,b){$R(0,this,true).each(a,b);return this}function r(a,b){var c=this.toString(b||10);return"0".times(a-c.length)+c}function n(){return isFinite(this)?this.toString():"null"}function j(){return Math.abs(this)}function l(){return Math.round(this)}function m(){return Math.ceil(this)}function q(){return Math.floor(this)}return{toColorPart:p,succ:o,times:s,toPaddedString:r,toJSON:n,abs:j,round:l,ceil:m,floor:q}})());function $R(f,e,d){return new ObjectRange(f,e,d)}var ObjectRange=Class.create(Enumerable,(function(){function d(a,c,b){this.start=a;this.end=c;this.exclusive=b}function f(b){var a=this.start;while(this.include(a)){b(a);a=a.succ()}}function e(a){if(a<this.start){return false}if(this.exclusive){return a<this.end}return a<=this.end}return{initialize:d,_each:f,include:e}})());var Ajax={getTransport:function(){return Try.these(function(){return new XMLHttpRequest()},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")})||false},activeRequestCount:0};Ajax.Responders={responders:[],_each:function(b){this.responders._each(b)},register:function(b){if(!this.include(b)){this.responders.push(b)}},unregister:function(b){this.responders=this.responders.without(b)},dispatch:function(g,e,h,f){this.each(function(b){if(Object.isFunction(b[g])){try{b[g].apply(b,[e,h,f])}catch(a){}}})}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++},onComplete:function(){Ajax.activeRequestCount--}});Ajax.Base=Class.create({initialize:function(b){this.options={method:"post",asynchronous:true,contentType:"application/x-www-form-urlencoded",encoding:"UTF-8",parameters:"",evalJSON:true,evalJS:true};Object.extend(this.options,b||{});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($super,c,d){$super(d);this.transport=Ajax.getTransport();this.request(c)},request:function(e){this.url=e;this.method=this.options.method;var g=Object.clone(this.options.parameters);if(!["get","post"].include(this.method)){g._method=this.method;this.method="post"}this.parameters=g;if(g=Object.toQueryString(g)){if(this.method=="get"){this.url+=(this.url.include("?")?"&":"?")+g}else{if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){g+="&_="}}}try{var f=new Ajax.Response(this);if(this.options.onCreate){this.options.onCreate(f)}Ajax.Responders.dispatch("onCreate",this,f);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||g):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType){this.onStateChange()}}catch(h){this.dispatchException(h)}},onStateChange:function(){var b=this.transport.readyState;if(b>1&&!((b==4)&&this._complete)){this.respondToReadyState(this.transport.readyState)}},setRequestHeaders:function(){var h={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,Accept:"text/javascript, text/html, application/xml, text/xml, */*"};if(this.method=="post"){h["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){h.Connection="close"}}if(typeof this.options.requestHeaders=="object"){var j=this.options.requestHeaders;if(Object.isFunction(j.push)){for(var f=0,i=j.length;f<i;f+=2){h[j[f]]=j[f+1]}}else{$H(j).each(function(a){h[a.key]=a.value})}}for(var g in h){this.transport.setRequestHeader(g,h[g])}},success:function(){var b=this.getStatus();return !b||(b>=200&&b<300)},getStatus:function(){try{return this.transport.status||0}catch(b){return 0}},respondToReadyState:function(g){var j=Ajax.Request.Events[g],e=new Ajax.Response(this);if(j=="Complete"){try{this._complete=true;(this.options["on"+e.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(e,e.headerJSON)}catch(i){this.dispatchException(i)}var h=e.getHeader("Content-type");if(this.options.evalJS=="force"||(this.options.evalJS&&this.isSameOrigin()&&h&&h.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))){this.evalResponse()}}try{(this.options["on"+j]||Prototype.emptyFunction)(e,e.headerJSON);Ajax.Responders.dispatch("on"+j,this,e,e.headerJSON)}catch(i){this.dispatchException(i)}if(j=="Complete"){this.transport.onreadystatechange=Prototype.emptyFunction}},isSameOrigin:function(){var b=this.url.match(/^\s*https?:\/\/[^\/]*/);return !b||(b[0]=="#{protocol}//#{domain}#{port}".interpolate({protocol:location.protocol,domain:document.domain,port:location.port?":"+location.port:""}))},getHeader:function(d){try{return this.transport.getResponseHeader(d)||null}catch(c){return null}},evalResponse:function(){try{return eval((this.transport.responseText||"").unfilterJSON())}catch(e){this.dispatchException(e)}},dispatchException:function(b){(this.options.onException||Prototype.emptyFunction)(this,b);Ajax.Responders.dispatch("onException",this,b)}});Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];Ajax.Response=Class.create({initialize:function(h){this.request=h;var g=this.transport=h.transport,f=this.readyState=g.readyState;if((f>2&&!Prototype.Browser.IE)||f==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(g.responseText);this.headerJSON=this._getHeaderJSON()}if(f==4){var e=g.responseXML;this.responseXML=Object.isUndefined(e)?null:e;this.responseJSON=this._getResponseJSON()}},status:0,statusText:"",getStatus:Ajax.Request.prototype.getStatus,getStatusText:function(){try{return this.transport.statusText||""}catch(b){return""}},getHeader:Ajax.Request.prototype.getHeader,getAllHeaders:function(){try{return this.getAllResponseHeaders()}catch(b){return null}},getResponseHeader:function(b){return this.transport.getResponseHeader(b)},getAllResponseHeaders:function(){return this.transport.getAllResponseHeaders()},_getHeaderJSON:function(){var d=this.getHeader("X-JSON");if(!d){return null}d=decodeURIComponent(escape(d));try{return d.evalJSON(this.request.options.sanitizeJSON||!this.request.isSameOrigin())}catch(c){this.request.dispatchException(c)}},_getResponseJSON:function(){var d=this.request.options;if(!d.evalJSON||(d.evalJSON!="force"&&!(this.getHeader("Content-type")||"").include("application/json"))||this.responseText.blank()){return null}try{return this.responseText.evalJSON(d.sanitizeJSON||!this.request.isSameOrigin())}catch(c){this.request.dispatchException(c)}}});Ajax.Updater=Class.create(Ajax.Request,{initialize:function($super,f,h,e){this.container={success:(f.success||f),failure:(f.failure||(f.success?null:f))};e=Object.clone(e);var g=e.onComplete;e.onComplete=(function(b,a){this.updateContent(b.responseText);if(Object.isFunction(g)){g(b,a)}}).bind(this);$super(h,e)},updateContent:function(g){var h=this.container[this.success()?"success":"failure"],f=this.options;if(!f.evalScripts){g=g.stripScripts()}if(h=$(h)){if(f.insertion){if(Object.isString(f.insertion)){var e={};e[f.insertion]=g;h.insert(e)}else{f.insertion(h,g)}}else{h.update(g)}}}});Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,e,f,d){$super(d);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=e;this.url=f;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(b){if(this.options.decay){this.decay=(b.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=b.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)}});function $(e){if(arguments.length>1){for(var f=0,g=[],h=arguments.length;f<h;f++){g.push($(arguments[f]))}return g}if(Object.isString(e)){e=document.getElementById(e)}return Element.extend(e)}if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(i,h){var m=[];var j=document.evaluate(i,$(h)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var g=0,l=j.snapshotLength;g<l;g++){m.push(Element.extend(j.snapshotItem(g)))}return m}}if(!window.Node){var 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(f){var d=(function(){var b=document.createElement("form");var c=document.createElement("input");var h=document.documentElement;c.setAttribute("name","test");b.appendChild(c);h.appendChild(b);var a=b.elements?(typeof b.elements.test=="undefined"):null;h.removeChild(b);b=c=null;return a})();var e=f.Element;f.Element=function(a,b){b=b||{};a=a.toLowerCase();var c=Element.cache;if(d&&b.name){a="<"+a+' name="'+b.name+'">';delete b.name;return Element.writeAttribute(document.createElement(a),b)}if(!c[a]){c[a]=Element.extend(document.createElement(a))}return Element.writeAttribute(c[a].cloneNode(false),b)};Object.extend(f.Element,e||{});if(e){f.Element.prototype=e.prototype}})(this);Element.cache={};Element.idCounter=1;Element.Methods={visible:function(b){return $(b).style.display!="none"},toggle:function(b){b=$(b);Element[Element.visible(b)?"hide":"show"](b);return b},hide:function(b){b=$(b);b.style.display="none";return b},show:function(b){b=$(b);b.style.display="";return b},remove:function(b){b=$(b);b.parentNode.removeChild(b);return b},update:(function(){var e=(function(){var b=document.createElement("select"),a=true;b.innerHTML='<option value="test">test</option>';if(b.options&&b.options[0]){a=b.options[0].nodeName.toUpperCase()!=="OPTION"}b=null;return a})();var f=(function(){try{var c=document.createElement("table");if(c&&c.tBodies){c.innerHTML="<tbody><tr><td>test</td></tr></tbody>";var a=typeof c.tBodies[0]=="undefined";c=null;return a}}catch(b){return true}})();var g=(function(){var c=document.createElement("script"),a=false;try{c.appendChild(document.createTextNode(""));a=!c.firstChild||c.firstChild&&c.firstChild.nodeType!==3}catch(b){a=true}c=null;return a})();function h(b,a){b=$(b);if(a&&a.toElement){a=a.toElement()}if(Object.isElement(a)){return b.update().insert(a)}a=Object.toHTML(a);var c=b.tagName.toUpperCase();if(c==="SCRIPT"&&g){b.text=a;return b}if(e||f){if(c in Element._insertionTranslations.tags){while(b.firstChild){b.removeChild(b.firstChild)}Element._getContentFromAnonymousElement(c,a.stripScripts()).each(function(d){b.appendChild(d)})}else{b.innerHTML=a.stripScripts()}}else{b.innerHTML=a.stripScripts()}a.evalScripts.bind(a).defer();return b}return h})(),replace:function(d,f){d=$(d);if(f&&f.toElement){f=f.toElement()}else{if(!Object.isElement(f)){f=Object.toHTML(f);var e=d.ownerDocument.createRange();e.selectNode(d);f.evalScripts.bind(f).defer();f=e.createContextualFragment(f.stripScripts())}}d.parentNode.replaceChild(f,d);return d},insert:function(o,m){o=$(o);if(Object.isString(m)||Object.isNumber(m)||Object.isElement(m)||(m&&(m.toElement||m.toHTML))){m={bottom:m}}var n,l,h,j;for(var i in m){n=m[i];i=i.toLowerCase();l=Element._insertionTranslations[i];if(n&&n.toElement){n=n.toElement()}if(Object.isElement(n)){l(o,n);continue}n=Object.toHTML(n);h=((i=="before"||i=="after")?o.parentNode:o).tagName.toUpperCase();j=Element._getContentFromAnonymousElement(h,n.stripScripts());if(i=="top"||i=="after"){j.reverse()}j.each(l.curry(o));n.evalScripts.bind(n).defer()}return o},wrap:function(d,f,e){d=$(d);if(Object.isElement(f)){$(f).writeAttribute(e||{})}else{if(Object.isString(f)){f=new Element(f,e)}else{f=new Element("div",f)}}if(d.parentNode){d.parentNode.replaceChild(f,d)}f.appendChild(d);return f},inspect:function(c){c=$(c);var d="<"+c.tagName.toLowerCase();$H({id:"id",className:"class"}).each(function(a){var b=a.first(),h=a.last();var g=(c[b]||"").toString();if(g){d+=" "+h+"="+g.inspect(true)}});return d+">"},recursivelyCollect:function(e,f){e=$(e);var d=[];while(e=e[f]){if(e.nodeType==1){d.push(Element.extend(e))}}return d},ancestors:function(b){return Element.recursivelyCollect(b,"parentNode")},descendants:function(b){return Element.select(b,"*")},firstDescendant:function(b){b=$(b).firstChild;while(b&&b.nodeType!=1){b=b.nextSibling}return $(b)},immediateDescendants:function(b){if(!(b=$(b).firstChild)){return[]}while(b&&b.nodeType!=1){b=b.nextSibling}if(b){return[b].concat($(b).nextSiblings())}return[]},previousSiblings:function(b){return Element.recursivelyCollect(b,"previousSibling")},nextSiblings:function(b){return Element.recursivelyCollect(b,"nextSibling")},siblings:function(b){b=$(b);return Element.previousSiblings(b).reverse().concat(Element.nextSiblings(b))},match:function(c,d){if(Object.isString(d)){d=new Selector(d)}return d.match($(c))},up:function(e,g,f){e=$(e);if(arguments.length==1){return $(e.parentNode)}var h=Element.ancestors(e);return Object.isNumber(g)?h[g]:Selector.findElement(h,g,f)},down:function(d,f,e){d=$(d);if(arguments.length==1){return Element.firstDescendant(d)}return Object.isNumber(f)?Element.descendants(d)[f]:Element.select(d,f)[e||0]},previous:function(e,g,f){e=$(e);if(arguments.length==1){return $(Selector.handlers.previousElementSibling(e))}var h=Element.previousSiblings(e);return Object.isNumber(g)?h[g]:Selector.findElement(h,g,f)},next:function(h,g,e){h=$(h);if(arguments.length==1){return $(Selector.handlers.nextElementSibling(h))}var f=Element.nextSiblings(h);return Object.isNumber(g)?f[g]:Selector.findElement(f,g,e)},select:function(c){var d=Array.prototype.slice.call(arguments,1);return Selector.findChildElements(c,d)},adjacent:function(c){var d=Array.prototype.slice.call(arguments,1);return Selector.findChildElements(c.parentNode,d).without(c)},identify:function(d){d=$(d);var c=Element.readAttribute(d,"id");if(c){return c}do{c="anonymous_element_"+Element.idCounter++}while($(c));Element.writeAttribute(d,"id",c);return c},readAttribute:function(f,e){f=$(f);if(Prototype.Browser.IE){var d=Element._attributeTranslations.read;if(d.values[e]){return d.values[e](f,e)}if(d.names[e]){e=d.names[e]}if(e.include(":")){return(!f.attributes||!f.attributes[e])?null:f.attributes[e].value}}return f.getAttribute(e)},writeAttribute:function(j,m,i){j=$(j);var g={},l=Element._attributeTranslations.write;if(typeof m=="object"){g=m}else{g[m]=Object.isUndefined(i)?true:i}for(var h in g){m=l.names[h]||h;i=g[h];if(l.values[h]){m=l.values[h](j,i)}if(i===false||i===null){j.removeAttribute(m)}else{if(i===true){j.setAttribute(m,m)}else{j.setAttribute(m,i)}}}return j},getHeight:function(b){return Element.getDimensions(b).height},getWidth:function(b){return Element.getDimensions(b).width},classNames:function(b){return new Element.ClassNames(b)},hasClassName:function(e,d){if(!(e=$(e))){return}var f=e.className;return(f.length>0&&(f==d||new RegExp("(^|\\s)"+d+"(\\s|$)").test(f)))},addClassName:function(d,c){if(!(d=$(d))){return}if(!Element.hasClassName(d,c)){d.className+=(d.className?" ":"")+c}return d},removeClassName:function(d,c){if(!(d=$(d))){return}d.className=d.className.replace(new RegExp("(^|\\s+)"+c+"(\\s+|$)")," ").strip();return d},toggleClassName:function(d,c){if(!(d=$(d))){return}return Element[Element.hasClassName(d,c)?"removeClassName":"addClassName"](d,c)},cleanWhitespace:function(d){d=$(d);var f=d.firstChild;while(f){var e=f.nextSibling;if(f.nodeType==3&&!/\S/.test(f.nodeValue)){d.removeChild(f)}f=e}return d},empty:function(b){return $(b).innerHTML.blank()},descendantOf:function(c,d){c=$(c),d=$(d);if(c.compareDocumentPosition){return(c.compareDocumentPosition(d)&8)===8}if(d.contains){return d.contains(c)&&d!==c}while(c=c.parentNode){if(c==d){return true}}return false},scrollTo:function(d){d=$(d);var c=Element.cumulativeOffset(d);window.scrollTo(c[0],c[1]);return d},getStyle:function(e,h){e=$(e);h=h=="float"?"cssFloat":h.camelize();var g=e.style[h];if(!g||g=="auto"){var f=document.defaultView.getComputedStyle(e,null);g=f?f[h]:null}if(h=="opacity"){return g?parseFloat(g):1}return g=="auto"?null:g},getOpacity:function(b){return $(b).getStyle("opacity")},setStyle:function(f,j){f=$(f);var h=f.style,g;if(Object.isString(j)){f.style.cssText+=";"+j;return j.include("opacity")?f.setOpacity(j.match(/opacity:\s*(\d?\.?\d*)/)[1]):f}for(var i in j){if(i=="opacity"){f.setOpacity(j[i])}else{h[(i=="float"||i=="cssFloat")?(Object.isUndefined(h.styleFloat)?"cssFloat":"styleFloat"):i]=j[i]}}return f},setOpacity:function(d,c){d=$(d);d.style.opacity=(c==1||c==="")?"":(c<0.00001)?0:c;return d},getDimensions:function(q){q=$(q);var m=Element.getStyle(q,"display");if(m!="none"&&m!=null){return{width:q.offsetWidth,height:q.offsetHeight}}var i=q.style;var n=i.visibility;var p=i.position;var j=i.display;i.visibility="hidden";if(p!="fixed"){i.position="absolute"}i.display="block";var l=q.clientWidth;var o=q.clientHeight;i.display=j;i.position=p;i.visibility=n;return{width:l,height:o}},makePositioned:function(d){d=$(d);var c=Element.getStyle(d,"position");if(c=="static"||!c){d._madePositioned=true;d.style.position="relative";if(Prototype.Browser.Opera){d.style.top=0;d.style.left=0}}return d},undoPositioned:function(b){b=$(b);if(b._madePositioned){b._madePositioned=undefined;b.style.position=b.style.top=b.style.left=b.style.bottom=b.style.right=""}return b},makeClipping:function(b){b=$(b);if(b._overflow){return b}b._overflow=Element.getStyle(b,"overflow")||"auto";if(b._overflow!=="hidden"){b.style.overflow="hidden"}return b},undoClipping:function(b){b=$(b);if(!b._overflow){return b}b.style.overflow=b._overflow=="auto"?"":b._overflow;b._overflow=null;return b},cumulativeOffset:function(d){var e=0,f=0;do{e+=d.offsetTop||0;f+=d.offsetLeft||0;d=d.offsetParent}while(d);return Element._returnOffset(f,e)},positionedOffset:function(e){var f=0,g=0;do{f+=e.offsetTop||0;g+=e.offsetLeft||0;e=e.offsetParent;if(e){if(e.tagName.toUpperCase()=="BODY"){break}var h=Element.getStyle(e,"position");if(h!=="static"){break}}}while(e);return Element._returnOffset(g,f)},absolutize:function(g){g=$(g);if(Element.getStyle(g,"position")=="absolute"){return g}var l=Element.positionedOffset(g);var i=l[1];var j=l[0];var m=g.clientWidth;var h=g.clientHeight;g._originalLeft=j-parseFloat(g.style.left||0);g._originalTop=i-parseFloat(g.style.top||0);g._originalWidth=g.style.width;g._originalHeight=g.style.height;g.style.position="absolute";g.style.top=i+"px";g.style.left=j+"px";g.style.width=m+"px";g.style.height=h+"px";return g},relativize:function(e){e=$(e);if(Element.getStyle(e,"position")=="relative"){return e}e.style.position="relative";var f=parseFloat(e.style.top||0)-(e._originalTop||0);var d=parseFloat(e.style.left||0)-(e._originalLeft||0);e.style.top=f+"px";e.style.left=d+"px";e.style.height=e._originalHeight;e.style.width=e._originalWidth;return e},cumulativeScrollOffset:function(d){var e=0,f=0;do{e+=d.scrollTop||0;f+=d.scrollLeft||0;d=d.parentNode}while(d);return Element._returnOffset(f,e)},getOffsetParent:function(b){if(b.offsetParent){return $(b.offsetParent)}if(b==document.body){return $(b)}while((b=b.parentNode)&&b!=document.body){if(Element.getStyle(b,"position")!="static"){return $(b)}}return $(document.body)},viewportOffset:function(g){var f=0,h=0;var e=g;do{f+=e.offsetTop||0;h+=e.offsetLeft||0;if(e.offsetParent==document.body&&Element.getStyle(e,"position")=="absolute"){break}}while(e=e.offsetParent);e=g;do{if(!Prototype.Browser.Opera||(e.tagName&&(e.tagName.toUpperCase()=="BODY"))){f-=e.scrollTop||0;h-=e.scrollLeft||0}}while(e=e.parentNode);return Element._returnOffset(h,f)},clonePosition:function(g,l){var h=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});l=$(l);var j=Element.viewportOffset(l);g=$(g);var i=[0,0];var m=null;if(Element.getStyle(g,"position")=="absolute"){m=Element.getOffsetParent(g);i=Element.viewportOffset(m)}if(m==document.body){i[0]-=document.body.offsetLeft;i[1]-=document.body.offsetTop}if(h.setLeft){g.style.left=(j[0]-i[0]+h.offsetLeft)+"px"}if(h.setTop){g.style.top=(j[1]-i[1]+h.offsetTop)+"px"}if(h.setWidth){g.style.width=l.offsetWidth+"px"}if(h.setHeight){g.style.height=l.offsetHeight+"px"}return g}};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(i,f,j){switch(j){case"left":case"top":case"right":case"bottom":if(i(f,"position")==="static"){return null}case"height":case"width":if(!Element.visible(f)){return null}var h=parseInt(i(f,j),10);if(h!==f["offset"+j.capitalize()]){return h+"px"}var g;if(j==="height"){g=["border-top-width","padding-top","padding-bottom","border-bottom-width"]}else{g=["border-left-width","padding-left","padding-right","border-right-width"]}return g.inject(h,function(c,b){var a=i(f,b);return a===null?c:c-parseInt(a,10)})+"px";default:return i(f,j)}});Element.Methods.readAttribute=Element.Methods.readAttribute.wrap(function(f,e,d){if(d==="title"){return e.title}return f(e,d)})}else{if(Prototype.Browser.IE){Element.Methods.getOffsetParent=Element.Methods.getOffsetParent.wrap(function(j,e){e=$(e);try{e.offsetParent}catch(h){return $(document.body)}var g=e.getStyle("position");if(g!=="static"){return j(e)}e.setStyle({position:"relative"});var i=j(e);e.setStyle({position:g});return i});$w("positionedOffset viewportOffset").each(function(b){Element.Methods[b]=Element.Methods[b].wrap(function(j,m){m=$(m);try{m.offsetParent}catch(e){return Element._returnOffset(0,0)}var a=m.getStyle("position");if(a!=="static"){return j(m)}var l=m.getOffsetParent();if(l&&l.getStyle("position")==="fixed"){l.setStyle({zoom:1})}m.setStyle({position:"relative"});var i=j(m);m.setStyle({position:a});return i})});Element.Methods.cumulativeOffset=Element.Methods.cumulativeOffset.wrap(function(d,e){try{e.offsetParent}catch(f){return Element._returnOffset(0,0)}return d(e)});Element.Methods.getStyle=function(e,d){e=$(e);d=(d=="float"||d=="cssFloat")?"styleFloat":d.camelize();var f=e.style[d];if(!f&&e.currentStyle){f=e.currentStyle[d]}if(d=="opacity"){if(f=(e.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/)){if(f[1]){return parseFloat(f[1])/100}}return 1}if(f=="auto"){if((d=="width"||d=="height")&&(e.getStyle("display")!="none")){return e["offset"+d.capitalize()]+"px"}return null}return f};Element.Methods.setOpacity=function(g,j){function i(a){return a.replace(/alpha\([^\)]*\)/gi,"")}g=$(g);var h=g.currentStyle;if((h&&!h.hasLayout)||(!h&&g.style.zoom=="normal")){g.style.zoom=1}var l=g.getStyle("filter"),m=g.style;if(j==1||j===""){(l=i(l))?m.filter=l:m.removeAttribute("filter");return g}else{if(j<0.00001){j=0}}m.filter=i(l)+"alpha(opacity="+(j*100)+")";return g};Element._attributeTranslations=(function(){var d="className";var e="for";var f=document.createElement("div");f.setAttribute(d,"x");if(f.className!=="x"){f.setAttribute("class","x");if(f.className==="x"){d="class"}}f=null;f=document.createElement("label");f.setAttribute(e,"x");if(f.htmlFor!=="x"){f.setAttribute("htmlFor","x");if(f.htmlFor==="x"){e="htmlFor"}}f=null;return{read:{names:{"class":d,className:d,"for":e,htmlFor:e},values:{_getAttr:function(b,a){return b.getAttribute(a)},_getAttr2:function(b,a){return b.getAttribute(a,2)},_getAttrNode:function(c,a){var b=c.getAttributeNode(a);return b?b.value:""},_getEv:(function(){var c=document.createElement("div");c.onclick=Prototype.emptyFunction;var a=c.getAttribute("onclick");var b;if(String(a).indexOf("{")>-1){b=function(i,g){g=i.getAttribute(g);if(!g){return null}g=g.toString();g=g.split("{")[1];g=g.split("}")[0];return g.strip()}}else{if(a===""){b=function(i,g){g=i.getAttribute(g);if(!g){return null}return g.strip()}}}c=null;return b})(),_flag:function(b,a){return $(b).hasAttribute(a)?a: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(d,c){d.checked=!!c},style:function(d,c){d.style.cssText=c?c:""}}};Element._attributeTranslations.has={};$w("colSpan rowSpan vAlign dateTime accessKey tabIndex encType maxLength readOnly longDesc frameBorder").each(function(b){Element._attributeTranslations.write.names[b.toLowerCase()]=b;Element._attributeTranslations.has[b.toLowerCase()]=b});(function(b){Object.extend(b,{href:b._getAttr2,src:b._getAttr2,type:b._getAttr,action:b._getAttrNode,disabled:b._flag,checked:b._flag,readonly:b._flag,multiple:b._flag,onload:b._getEv,onunload:b._getEv,onclick:b._getEv,ondblclick:b._getEv,onmousedown:b._getEv,onmouseup:b._getEv,onmouseover:b._getEv,onmousemove:b._getEv,onmouseout:b._getEv,onfocus:b._getEv,onblur:b._getEv,onkeypress:b._getEv,onkeydown:b._getEv,onkeyup:b._getEv,onsubmit:b._getEv,onreset:b._getEv,onselect:b._getEv,onchange:b._getEv})})(Element._attributeTranslations.read.values);if(Prototype.BrowserFeatures.ElementExtensions){(function(){function b(h){var a=h.getElementsByTagName("*"),i=[];for(var j=0,g;g=a[j];j++){if(g.tagName!=="!"){i.push(g)}}return i}Element.Methods.down=function(f,e,a){f=$(f);if(arguments.length==1){return f.firstDescendant()}return Object.isNumber(e)?b(f)[e]:Element.select(f,e)[a||0]}})()}}else{if(Prototype.Browser.Gecko&&/rv:1\.8\.0/.test(navigator.userAgent)){Element.Methods.setOpacity=function(d,c){d=$(d);d.style.opacity=(c==1)?0.999999:(c==="")?"":(c<0.00001)?0:c;return d}}else{if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(f,e){f=$(f);f.style.opacity=(e==1||e==="")?"":(e<0.00001)?0:e;if(e==1){if(f.tagName.toUpperCase()=="IMG"&&f.width){f.width++;f.width--}else{try{var g=document.createTextNode(" ");f.appendChild(g);f.removeChild(g)}catch(h){}}}return f};Element.Methods.cumulativeOffset=function(d){var e=0,f=0;do{e+=d.offsetTop||0;f+=d.offsetLeft||0;if(d.offsetParent==document.body){if(Element.getStyle(d,"position")=="absolute"){break}}d=d.offsetParent}while(d);return Element._returnOffset(f,e)}}}}}if("outerHTML" in document.documentElement){Element.Methods.replace=function(m,j){m=$(m);if(j&&j.toElement){j=j.toElement()}if(Object.isElement(j)){m.parentNode.replaceChild(j,m);return m}j=Object.toHTML(j);var l=m.parentNode,g=l.tagName.toUpperCase();if(Element._insertionTranslations.tags[g]){var i=m.next();var h=Element._getContentFromAnonymousElement(g,j.stripScripts());l.removeChild(m);if(i){h.each(function(a){l.insertBefore(a,i)})}else{h.each(function(a){l.appendChild(a)})}}else{m.outerHTML=j.stripScripts()}j.evalScripts.bind(j).defer();return m}}Element._returnOffset=function(d,f){var e=[d,f];e.left=d;e.top=f;return e};Element._getContentFromAnonymousElement=function(h,e){var g=new Element("div"),f=Element._insertionTranslations.tags[h];if(f){g.innerHTML=f[0]+e+f[1];f[2].times(function(){g=g.firstChild})}else{g.innerHTML=e}return $A(g.childNodes)};Element._insertionTranslations={before:function(d,c){d.parentNode.insertBefore(c,d)},top:function(d,c){d.insertBefore(c,d.firstChild)},bottom:function(d,c){d.appendChild(c)},after:function(d,c){d.parentNode.insertBefore(c,d.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 b=Element._insertionTranslations.tags;Object.extend(b,{THEAD:b.TBODY,TFOOT:b.TBODY,TH:b.TD})})();Element.Methods.Simulated={hasAttribute:function(e,f){f=Element._attributeTranslations.has[f]||f;var d=$(e).getAttributeNode(f);return !!(d&&d.specified)}};Element.Methods.ByTag={};Object.extend(Element,Element.Methods);(function(b){if(!Prototype.BrowserFeatures.ElementExtensions&&b.__proto__){window.HTMLElement={};window.HTMLElement.prototype=b.__proto__;Prototype.BrowserFeatures.ElementExtensions=true}b=null})(document.createElement("div"));Element.extend=(function(){function m(e){if(typeof window.Element!="undefined"){var c=window.Element.prototype;if(c){var a="_"+(Math.random()+"").slice(2);var d=document.createElement(e);c[a]="x";var b=(d[a]!=="x");delete c[a];d=null;return b}}return false}function g(c,d){for(var a in d){var b=d[a];if(Object.isFunction(b)&&!(a in c)){c[a]=b.methodize()}}}var l=m("object");if(Prototype.BrowserFeatures.SpecificElementExtensions){if(l){return function(a){if(a&&typeof a._extendedByPrototype=="undefined"){var b=a.tagName;if(b&&(/^(?:object|applet|embed)$/i.test(b))){g(a,Element.Methods);g(a,Element.Methods.Simulated);g(a,Element.Methods.ByTag[b.toUpperCase()])}}return a}}return Prototype.K}var h={},j=Element.Methods.ByTag;var i=Object.extend(function(a){if(!a||typeof a._extendedByPrototype!="undefined"||a.nodeType!=1||a==window){return a}var c=Object.clone(h),b=a.tagName.toUpperCase();if(j[b]){Object.extend(c,j[b])}g(a,c);a._extendedByPrototype=Prototype.emptyFunction;return a},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(h,Element.Methods);Object.extend(h,Element.Methods.Simulated)}}});i.refresh();return i})();Element.hasAttribute=function(d,c){if(d.hasAttribute){return d.hasAttribute(c)}return Element.Methods.Simulated.hasAttribute(d,c)};Element.addMethods=function(s){var m=Prototype.BrowserFeatures,r=Element.Methods.ByTag;if(!s){Object.extend(Form,Form.Methods);Object.extend(Form.Element,Form.Element.Methods);Object.extend(Element.Methods.ByTag,{FORM:Object.clone(Form.Methods),INPUT:Object.clone(Form.Element.Methods),SELECT:Object.clone(Form.Element.Methods),TEXTAREA:Object.clone(Form.Element.Methods)})}if(arguments.length==2){var u=s;s=arguments[1]}if(!u){Object.extend(Element.Methods,s||{})}else{if(Object.isArray(u)){u.each(o)}else{o(u)}}function o(a){a=a.toUpperCase();if(!Element.Methods.ByTag[a]){Element.Methods.ByTag[a]={}}Object.extend(Element.Methods.ByTag[a],s)}function v(e,a,b){b=b||false;for(var c in e){var d=e[c];if(!Object.isFunction(d)){continue}if(!b||!(c in a)){a[c]=d.methodize()}}}function q(d){var b;var e={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(e[d]){b="HTML"+e[d]+"Element"}if(window[b]){return window[b]}b="HTML"+d+"Element";if(window[b]){return window[b]}b="HTML"+d.capitalize()+"Element";if(window[b]){return window[b]}var a=document.createElement(d);var c=a.__proto__||a.constructor.prototype;a=null;return c}var n=window.HTMLElement?HTMLElement.prototype:Element.prototype;if(m.ElementExtensions){v(Element.Methods,n);v(Element.Methods.Simulated,n,true)}if(m.SpecificElementExtensions){for(var l in Element.Methods.ByTag){var p=q(l);if(Object.isUndefined(p)){continue}v(r[l],p.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(h){var j=Prototype.Browser,m=document,o,n={};function i(){if(j.WebKit&&!m.evaluate){return document}if(j.Opera&&window.parseFloat(window.opera.version())<9.5){return document.body}return document.documentElement}function l(a){if(!o){o=i()}n[a]="client"+a;h["get"+a]=function(){return o[n[a]]};return h["get"+a]()}h.getWidth=l.curry("Width");h.getHeight=l.curry("Height")})(document.viewport);Element.Storage={UID:1};Element.addMethods({getStorage:function(c){if(!(c=$(c))){return}var d;if(c===window){d=0}else{if(typeof c._prototypeUID==="undefined"){c._prototypeUID=[Element.Storage.UID++]}d=c._prototypeUID[0]}if(!Element.Storage[d]){Element.Storage[d]=$H()}return Element.Storage[d]},store:function(d,e,f){if(!(d=$(d))){return}if(arguments.length===2){Element.getStorage(d).update(e)}else{Element.getStorage(d).set(e,f)}return d},retrieve:function(j,f,g){if(!(j=$(j))){return}var h=Element.getStorage(j),i=h.get(f);if(Object.isUndefined(i)){h.set(f,g);i=g}return i},clone:function(j,g){if(!(j=$(j))){return}var h=j.cloneNode(g);h._prototypeUID=void 0;if(g){var i=Element.select(h,"*"),f=i.length;while(f--){i[f]._prototypeUID=void 0}}return Element.extend(h)}});var Selector=Class.create({initialize:function(b){this.expression=b.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 b=(function(){var f=false;if(document.evaluate&&window.XPathResult){var g=document.createElement("div");g.innerHTML="<ul><li></li></ul><div><ul><li></li></ul></div>";var h=".//*[local-name()='ul' or local-name()='UL']//*[local-name()='li' or local-name()='LI']";var a=document.evaluate(h,g,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);f=(a.snapshotLength!==2);g=null}return f})();return function(){if(!Prototype.BrowserFeatures.XPath){return false}var a=this.expression;if(Prototype.Browser.WebKit&&(a.include("-of-type")||a.include(":empty"))){return false}if((/(\[[\w-]*?:|:checked)/).test(a)){return false}if(b){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(b){return false}return true},compileMatcher:function(){var e=this.expression,ps=Selector.patterns,h=Selector.handlers,c=Selector.criteria,le,p,m,len=ps.length,name;if(Selector._cache[e]){this.matcher=Selector._cache[e];return}this.matcher=["this.matcher = function(root) {","var r = root, h = Selector.handlers, c = false, n;"];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i=0;i<len;i++){p=ps[i].re;name=ps[i].name;if(m=e.match(p)){this.matcher.push(Object.isFunction(c[name])?c[name](m):new Template(c[name]).evaluate(m));e=e.replace(m[0],"");break}}}this.matcher.push("return h.unique(n);\n}");eval(this.matcher.join("\n"));Selector._cache[this.expression]=this.matcher},compileXPathMatcher:function(){var m=this.expression,l=Selector.patterns,q=Selector.xpath,n,e,i=l.length,p;if(Selector._cache[m]){this.xpath=Selector._cache[m];return}this.matcher=[".//*"];while(m&&n!=m&&(/\S/).test(m)){n=m;for(var o=0;o<i;o++){p=l[o].name;if(e=m.match(l[o].re)){this.matcher.push(Object.isFunction(q[p])?q[p](e):new Template(q[p]).evaluate(e));m=m.replace(e[0],"");break}}}this.xpath=this.matcher.join("");Selector._cache[this.expression]=this.xpath},findElements:function(g){g=g||document;var j=this.expression,e;switch(this.mode){case"selectorsAPI":if(g!==document){var i=g.id,h=$(g).identify();h=h.replace(/([\.:])/g,"\\$1");j="#"+h+" "+j}e=$A(g.querySelectorAll(j)).map(Element.extend);g.id=i;return e;case"xpath":return document._getElementsByXPath(this.xpath,g);default:return this.matcher(g)}},match:function(s){this.tokens=[];var e=this.expression,B=Selector.patterns,x=Selector.assertions;var A,y,w,i=B.length,z;while(e&&A!==e&&(/\S/).test(e)){A=e;for(var u=0;u<i;u++){y=B[u].re;z=B[u].name;if(w=e.match(y)){if(x[z]){this.tokens.push([z,Object.clone(w)]);e=e.replace(w[0],"")}else{return this.findElements(document).include(s)}}}}var m=true,z,p;for(var u=0,v;v=this.tokens[u];u++){z=v[0],p=v[1];if(!Selector.assertions[z](s,p)){m=false;break}}return m},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 f=document.createElement("div"),e=document.createElement("span");f.id="prototype_test_id";e.className="Test";f.appendChild(e);var d=(f.querySelector("#prototype_test_id .test")!==null);f=e=null;return d})()}Object.extend(Selector,{_cache:{},xpath:{descendant:"//*",child:"/*",adjacent:"/following-sibling::*[1]",laterSibling:"/following-sibling::*",tagName:function(b){if(b[1]=="*"){return""}return"[local-name()='"+b[1].toLowerCase()+"' or local-name()='"+b[1].toUpperCase()+"']"},className:"[contains(concat(' ', @class, ' '), ' #{1} ')]",id:"[@id='#{1}']",attrPresence:function(b){b[1]=b[1].toLowerCase();return new Template("[@#{1}]").evaluate(b)},attr:function(b){b[1]=b[1].toLowerCase();b[3]=b[5]||b[6];return new Template(Selector.xpath.operators[b[2]]).evaluate(b)},pseudo:function(d){var c=Selector.xpath.pseudos[d[1]];if(!c){return""}if(Object.isFunction(c)){return c(d)}return new Template(Selector.xpath.pseudos[d[1]]).evaluate(d)},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(q){var m=q[6],s=Selector.patterns,i=Selector.xpath,v,e,o=s.length,u;var r=[];while(m&&v!=m&&(/\S/).test(m)){v=m;for(var p=0;p<o;p++){u=s[p].name;if(q=m.match(s[p].re)){e=Object.isFunction(i[u])?i[u](q):new Template(i[u]).evaluate(q);r.push("("+e.substring(1,e.length-1)+")");m=m.replace(q[0],"");break}}}return"[not("+r.join(" and ")+")]"},"nth-child":function(b){return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ",b)},"nth-last-child":function(b){return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ",b)},"nth-of-type":function(b){return Selector.xpath.pseudos.nth("position() ",b)},"nth-last-of-type":function(b){return Selector.xpath.pseudos.nth("(last() + 1 - position()) ",b)},"first-of-type":function(b){b[6]="1";return Selector.xpath.pseudos["nth-of-type"](b)},"last-of-type":function(b){b[6]="1";return Selector.xpath.pseudos["nth-last-of-type"](b)},"only-of-type":function(d){var c=Selector.xpath.pseudos;return c["first-of-type"](d)+c["last-of-type"](d)},nth:function(j,m){var b,a=m[6],n;if(a=="even"){a="2n+0"}if(a=="odd"){a="2n+1"}if(b=a.match(/^(\d+)$/)){return"["+j+"= "+b[1]+"]"}if(b=a.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(b[1]=="-"){b[1]=-1}var l=b[1]?Number(b[1]):1;var o=b[2]?Number(b[2]):0;n="[((#{fragment} - #{b}) mod #{a} = 0) and ((#{fragment} - #{b}) div #{a} >= 0)]";return new Template(n).evaluate({fragment:j,a:l,b:o})}}}},criteria:{tagName:'n = h.tagName(n, r, "#{1}", c);      c = false;',className:'n = h.className(n, r, "#{1}", c);    c = false;',id:'n = h.id(n, r, "#{1}", c);           c = false;',attrPresence:'n = h.attrPresence(n, r, "#{1}", c); c = false;',attr:function(b){b[3]=(b[5]||b[6]);return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(b)},pseudo:function(b){if(b[6]){b[6]=b[6].replace(/"/g,'\\"')}return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(b)},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(d,c){return c[1].toUpperCase()==d.tagName.toUpperCase()},className:function(d,c){return Element.hasClassName(d,c[1])},id:function(d,c){return d.id===c[1]},attrPresence:function(d,c){return Element.hasAttribute(d,c[1])},attr:function(d,f){var e=Element.readAttribute(d,f[1]);return e&&Selector.operators[f[2]](e,f[5]||f[6])}},handlers:{concat:function(g,h){for(var b=0,a;a=h[b];b++){g.push(a)}return g},mark:function(f){var g=Prototype.emptyFunction;for(var e=0,h;h=f[e];e++){h._countedByPrototype=g}return f},unmark:(function(){var b=(function(){var a=document.createElement("div"),f=false,g="_countedByPrototype",h="x";a[g]=h;f=(a.getAttribute(g)===h);a=null;return f})();return b?function(a){for(var f=0,e;e=a[f];f++){e.removeAttribute("_countedByPrototype")}return a}:function(a){for(var f=0,e;e=a[f];f++){e._countedByPrototype=void 0}return a}})(),index:function(i,n,j){i._countedByPrototype=Prototype.emptyFunction;if(n){for(var h=i.childNodes,m=h.length-1,o=1;m>=0;m--){var l=h[m];if(l.nodeType==1&&(!j||l._countedByPrototype)){l.nodeIndex=o++}}}else{for(var m=0,o=1,h=i.childNodes;l=h[m];m++){if(l.nodeType==1&&(!j||l._countedByPrototype)){l.nodeIndex=o++}}}},unique:function(f){if(f.length==0){return f}var i=[],h;for(var j=0,g=f.length;j<g;j++){if(typeof(h=f[j])._countedByPrototype=="undefined"){h._countedByPrototype=Prototype.emptyFunction;i.push(Element.extend(h))}}return Selector.handlers.unmark(i)},descendant:function(g){var i=Selector.handlers;for(var j=0,f=[],h;h=g[j];j++){i.concat(f,h.getElementsByTagName("*"))}return f},child:function(i){var m=Selector.handlers;for(var n=0,o=[],l;l=i[n];n++){for(var h=0,j;j=l.childNodes[h];h++){if(j.nodeType==1&&j.tagName!="!"){o.push(j)}}}return o},adjacent:function(g){for(var j=0,f=[],h;h=g[j];j++){var i=this.nextElementSibling(h);if(i){f.push(i)}}return f},laterSibling:function(g){var i=Selector.handlers;for(var j=0,f=[],h;h=g[j];j++){i.concat(f,Element.nextSiblings(h))}return f},nextElementSibling:function(b){while(b=b.nextSibling){if(b.nodeType==1){return b}}return null},previousElementSibling:function(b){while(b=b.previousSibling){if(b.nodeType==1){return b}}return null},tagName:function(s,i,q,r){var h=q.toUpperCase();var o=[],m=Selector.handlers;if(s){if(r){if(r=="descendant"){for(var n=0,p;p=s[n];n++){m.concat(o,p.getElementsByTagName(q))}return o}else{s=this[r](s)}if(q=="*"){return s}}for(var n=0,p;p=s[n];n++){if(p.tagName.toUpperCase()===h){o.push(p)}}return o}else{return i.getElementsByTagName(q)}},id:function(s,h,r,q){var i=$(r),j=Selector.handlers;if(h==document){if(!i){return[]}if(!s){return[i]}}else{if(!h.sourceIndex||h.sourceIndex<1){var s=h.getElementsByTagName("*");for(var o=0,p;p=s[o];o++){if(p.id===r){return[p]}}}}if(s){if(q){if(q=="child"){for(var n=0,p;p=s[n];n++){if(i.parentNode==p){return[i]}}}else{if(q=="descendant"){for(var n=0,p;p=s[n];n++){if(Element.descendantOf(i,p)){return[i]}}}else{if(q=="adjacent"){for(var n=0,p;p=s[n];n++){if(Selector.handlers.previousElementSibling(i)==p){return[i]}}}else{s=j[q](s)}}}}for(var n=0,p;p=s[n];n++){if(p==i){return[i]}}return[]}return(i&&Element.descendantOf(i,h))?[i]:[]},className:function(e,f,h,g){if(e&&g){e=this[g](e)}return Selector.handlers.byClassName(e,f,h)},byClassName:function(q,i,n){if(!q){q=Selector.handlers.descendant([i])}var l=" "+n+" ";for(var o=0,p=[],m,j;m=q[o];o++){j=m.className;if(j.length==0){continue}if(j==n||(" "+j+" ").include(l)){p.push(m)}}return p},attrPresence:function(o,h,i,j){if(!o){o=h.getElementsByTagName("*")}if(o&&j){o=this[j](o)}var m=[];for(var n=0,l;l=o[n];n++){if(Element.hasAttribute(l,i)){m.push(l)}}return m},attr:function(x,o,p,n,v,w){if(!x){x=o.getElementsByTagName("*")}if(x&&w){x=this[w](x)}var i=Selector.operators[v],r=[];for(var s=0,u;u=x[s];s++){var q=Element.readAttribute(u,p);if(q===null){continue}if(i(q,n)){r.push(u)}}return r},pseudo:function(f,j,h,g,i){if(f&&i){f=this[i](f)}if(!f){f=g.getElementsByTagName("*")}return Selector.pseudos[j](f,h,g)}},pseudos:{"first-child":function(g,i,h){for(var l=0,m=[],j;j=g[l];l++){if(Selector.handlers.previousElementSibling(j)){continue}m.push(j)}return m},"last-child":function(g,i,h){for(var l=0,m=[],j;j=g[l];l++){if(Selector.handlers.nextElementSibling(j)){continue}m.push(j)}return m},"only-child":function(h,j,i){var m=Selector.handlers;for(var n=0,o=[],l;l=h[n];n++){if(!m.previousElementSibling(l)&&!m.nextElementSibling(l)){o.push(l)}}return o},"nth-child":function(d,f,e){return Selector.pseudos.nth(d,f,e)},"nth-last-child":function(d,f,e){return Selector.pseudos.nth(d,f,e,true)},"nth-of-type":function(d,f,e){return Selector.pseudos.nth(d,f,e,false,true)},"nth-last-of-type":function(d,f,e){return Selector.pseudos.nth(d,f,e,true,true)},"first-of-type":function(d,f,e){return Selector.pseudos.nth(d,"1",e,false,true)},"last-of-type":function(d,f,e){return Selector.pseudos.nth(d,"1",e,true,true)},"only-of-type":function(e,g,f){var h=Selector.pseudos;return h["last-of-type"](h["first-of-type"](e,g,f),g,f)},getIndices:function(b,f,a){if(b==0){return f>0?[f]:[]}return $R(1,a).inject([],function(d,c){if(0==(c-f)%b&&(c-f)/b>=0){d.push(c)}return d})},nth:function(B,G,E,H,z){if(B.length==0){return[]}if(G=="even"){G="2n+0"}if(G=="odd"){G="2n+1"}var a=Selector.handlers,b=[],A=[],l;a.mark(B);for(var h=0,m;m=B[h];h++){if(!m.parentNode._countedByPrototype){a.index(m.parentNode,H,z);A.push(m.parentNode)}}if(G.match(/^\d+$/)){G=Number(G);for(var h=0,m;m=B[h];h++){if(m.nodeIndex==G){b.push(m)}}}else{if(l=G.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(l[1]=="-"){l[1]=-1}var D=l[1]?Number(l[1]):1;var F=l[2]?Number(l[2]):0;var C=Selector.pseudos.getIndices(D,F,B.length);for(var h=0,m,j=C.length;m=B[h];h++){for(var i=0;i<j;i++){if(m.nodeIndex==C[i]){b.push(m)}}}}}a.unmark(B);a.unmark(A);return b},empty:function(g,i,h){for(var l=0,m=[],j;j=g[l];l++){if(j.tagName=="!"||j.firstChild){continue}m.push(j)}return m},not:function(v,r,i){var o=Selector.handlers,h,s;var m=new Selector(r).findElements(i);o.mark(m);for(var p=0,q=[],u;u=v[p];p++){if(!u._countedByPrototype){q.push(u)}}o.unmark(m);return q},enabled:function(g,i,h){for(var l=0,m=[],j;j=g[l];l++){if(!j.disabled&&(!j.type||j.type!=="hidden")){m.push(j)}}return m},disabled:function(g,i,h){for(var l=0,m=[],j;j=g[l];l++){if(j.disabled){m.push(j)}}return m},checked:function(g,i,h){for(var l=0,m=[],j;j=g[l];l++){if(j.checked){m.push(j)}}return m}},operators:{"=":function(c,d){return c==d},"!=":function(c,d){return c!=d},"^=":function(c,d){return c==d||c&&c.startsWith(d)},"$=":function(c,d){return c==d||c&&c.endsWith(d)},"*=":function(c,d){return c==d||c&&c.include(d)},"~=":function(c,d){return(" "+c+" ").include(" "+d+" ")},"|=":function(c,d){return("-"+(c||"").toUpperCase()+"-").include("-"+(d||"").toUpperCase()+"-")}},split:function(c){var d=[];c.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(a){d.push(a[1].strip())});return d},matchElements:function(l,j){var m=$$(j),n=Selector.handlers;n.mark(m);for(var o=0,h=[],i;i=l[o];o++){if(i._countedByPrototype){h.push(i)}}n.unmark(m);return h},findElement:function(d,f,e){if(Object.isNumber(f)){e=f;f=false}return Selector.matchElements(d,f||"*")[e||0]},findChildElements:function(m,j){j=Selector.split(j.join(","));var n=[],l=Selector.handlers;for(var o=0,h=j.length,i;o<h;o++){i=new Selector(j[o].strip());l.concat(n,i.findElements(m))}return(h>1)?l.unique(n):n}});if(Prototype.Browser.IE){Object.extend(Selector.handlers,{concat:function(g,h){for(var b=0,a;a=h[b];b++){if(a.tagName!=="!"){g.push(a)}}return g}})}function $$(){return Selector.findChildElements(document,$A(arguments))}var Form={reset:function(b){b=$(b);b.reset();return b},serializeElements:function(j,h){if(typeof h!="object"){h={hash:!!h}}else{if(Object.isUndefined(h.hash)){h.hash=true}}var o,l,i=false,m=h.submit;var n=j.inject({},function(b,a){if(!a.disabled&&a.name){o=a.name;l=$(a).getValue();if(l!=null&&a.type!="file"&&(a.type!="submit"||(!i&&m!==false&&(!m||o==m)&&(i=true)))){if(o in b){if(!Object.isArray(b[o])){b[o]=[b[o]]}b[o].push(l)}else{b[o]=l}}}return b});return h.hash?n:Object.toQueryString(n)}};Form.Methods={serialize:function(c,d){return Form.serializeElements(Form.getElements(c),d)},getElements:function(j){var i=$(j).getElementsByTagName("*"),l,h=[],m=Form.Element.Serializers;for(var g=0;l=i[g];g++){h.push(l)}return h.inject([],function(b,a){if(m[a.tagName.toLowerCase()]){b.push(Element.extend(a))}return b})},getInputs:function(m,q,p){m=$(m);var j=m.getElementsByTagName("input");if(!q&&!p){return $A(j).map(Element.extend)}for(var o=0,l=[],n=j.length;o<n;o++){var i=j[o];if((q&&i.type!=q)||(p&&i.name!=p)){continue}l.push(Element.extend(i))}return l},disable:function(b){b=$(b);Form.getElements(b).invoke("disable");return b},enable:function(b){b=$(b);Form.getElements(b).invoke("enable");return b},findFirstElement:function(d){var f=$(d).getElements().findAll(function(a){return"hidden"!=a.type&&!a.disabled});var e=f.findAll(function(a){return a.hasAttribute("tabIndex")&&a.tabIndex>=0}).sortBy(function(a){return a.tabIndex}).first();return e?e:f.find(function(a){return/^(?:input|select|textarea)$/i.test(a.tagName)})},focusFirstElement:function(b){b=$(b);b.findFirstElement().activate();return b},request:function(e,f){e=$(e),f=Object.clone(f||{});var g=f.parameters,h=e.readAttribute("action")||"";if(h.blank()){h=window.location.href}f.parameters=e.serialize(true);if(g){if(Object.isString(g)){g=g.toQueryParams()}Object.extend(f.parameters,g)}if(e.hasAttribute("method")&&!f.method){f.method=e.method}return new Ajax.Request(h,f)}};Form.Element={focus:function(b){$(b).focus();return b},select:function(b){$(b).select();return b}};Form.Element.Methods={serialize:function(e){e=$(e);if(!e.disabled&&e.name){var d=e.getValue();if(d!=undefined){var f={};f[e.name]=d;return Object.toQueryString(f)}}return""},getValue:function(d){d=$(d);var c=d.tagName.toLowerCase();return Form.Element.Serializers[c](d)},setValue:function(e,d){e=$(e);var f=e.tagName.toLowerCase();Form.Element.Serializers[f](e,d);return e},clear:function(b){$(b).value="";return b},present:function(b){return $(b).value!=""},activate:function(d){d=$(d);try{d.focus();if(d.select&&(d.tagName.toLowerCase()!="input"||!(/^(?:button|reset|submit)$/i.test(d.type)))){d.select()}}catch(c){}return d},disable:function(b){b=$(b);b.disabled=true;return b},enable:function(b){b=$(b);b.disabled=false;return b}};var Field=Form.Element;var $F=Form.Element.Methods.getValue;Form.Element.Serializers={input:function(d,c){switch(d.type.toLowerCase()){case"checkbox":case"radio":return Form.Element.Serializers.inputSelector(d,c);default:return Form.Element.Serializers.textarea(d,c)}},inputSelector:function(d,c){if(Object.isUndefined(c)){return d.checked?d.value:null}else{d.checked=!!c}},textarea:function(d,c){if(Object.isUndefined(c)){return d.value}else{d.value=c}},select:function(o,l){if(Object.isUndefined(l)){return this[o.type=="select-one"?"selectOne":"selectMany"](o)}else{var h,n,j=!Object.isArray(l);for(var i=0,m=o.length;i<m;i++){h=o.options[i];n=this.optionValue(h);if(j){if(n==l){h.selected=true;return}}else{h.selected=l.include(n)}}}},selectOne:function(c){var d=c.selectedIndex;return d>=0?this.optionValue(c.options[d]):null},selectMany:function(i){var g,h=i.length;if(!h){return null}for(var j=0,g=[];j<h;j++){var f=i.options[j];if(f.selected){g.push(this.optionValue(f))}}return g},optionValue:function(b){return Element.extend(b).hasAttribute("value")?b.value:b.text}};Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,e,d,f){$super(f,d);this.element=$(e);this.lastValue=this.getValue()},execute:function(){var b=this.getValue();if(Object.isString(this.lastValue)&&Object.isString(b)?this.lastValue!=b:String(this.lastValue)!=String(b)){this.callback(this.element,b);this.lastValue=b}}});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(d,c){this.element=$(d);this.callback=c;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase()=="form"){this.registerFormCallbacks()}else{this.registerCallback(this.element)}},onElementEvent:function(){var b=this.getValue();if(this.lastValue!=b){this.callback(this.element,b);this.lastValue=b}},registerFormCallbacks:function(){Form.getElements(this.element).each(this.registerCallback,this)},registerCallback:function(b){if(b.type){switch(b.type.toLowerCase()){case"checkbox":case"radio":Event.observe(b,"click",this.onElementEvent.bind(this));break;default:Event.observe(b,"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(){var 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:{}};var R=document.documentElement;var z="onmouseenter" in R&&"onmouseleave" in R;var H;if(Prototype.Browser.IE){var O={0:1,1:4,2:2};H=function(a,b){return a.button===O[b]}}else{if(Prototype.Browser.WebKit){H=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{H=function(a,b){return a.which?(a.which===b+1):(a.button===b)}}}function E(a){return H(a,0)}function F(a){return H(a,1)}function L(a){return H(a,2)}function T(d){d=A.extend(d);var a=d.target,c=d.type,b=d.currentTarget;if(b&&b.tagName){if(c==="load"||c==="error"||(c==="click"&&b.tagName.toLowerCase()==="input"&&b.type==="radio")){a=b}}if(a.nodeType==Node.TEXT_NODE){a=a.parentNode}return Element.extend(a)}function J(a,c){var b=A.element(a);if(!c){return b}var d=[b].concat(b.ancestors());return Selector.findElement(d,c,0)}function G(a){return{x:U(a),y:V(a)}}function U(c){var a=document.documentElement,b=document.body||{scrollLeft:0};return c.pageX||(c.clientX+(a.scrollLeft||b.scrollLeft)-(a.clientLeft||0))}function V(c){var a=document.documentElement,b=document.body||{scrollTop:0};return c.pageY||(c.clientY+(a.scrollTop||b.scrollTop)-(a.clientTop||0))}function I(a){A.extend(a);a.preventDefault();a.stopPropagation();a.stopped=true}A.Methods={isLeftClick:E,isMiddleClick:F,isRightClick:L,element:T,findElement:J,pointer:G,pointerX:U,pointerY:V,stop:I};var C=Object.keys(A.Methods).inject({},function(b,a){b[a]=A.Methods[a].methodize();return b});if(Prototype.Browser.IE){function P(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(C,{stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return"[object Event]"}});A.extend=function(a,b){if(!a){return false}if(a._extendedByPrototype){return a}a._extendedByPrototype=Prototype.emptyFunction;var c=A.pointer(a);Object.extend(a,{target:a.srcElement||b,relatedTarget:P(a),pageX:c.x,pageY:c.y});return Object.extend(a,C)}}else{A.prototype=window.Event.prototype||document.createEvent("HTMLEvents").__proto__;Object.extend(A.prototype,C);A.extend=Prototype.K}function K(c,e,b){var f=Element.retrieve(c,"prototype_event_registry");if(Object.isUndefined(f)){S.push(c);f=Element.retrieve(c,"prototype_event_registry",$H())}var d=f.get(e);if(Object.isUndefined(d)){d=[];f.set(e,d)}if(d.pluck("handler").include(b)){return false}var a;if(e.include(":")){a=function(g){if(Object.isUndefined(g.eventName)){return false}if(g.eventName!==e){return false}A.extend(g,c);b.call(c,g)}}else{if(!z&&(e==="mouseenter"||e==="mouseleave")){if(e==="mouseenter"||e==="mouseleave"){a=function(h){A.extend(h,c);var i=h.relatedTarget;while(i&&i!==c){try{i=i.parentNode}catch(g){i=c}}if(i===c){return}b.call(c,h)}}}else{a=function(g){A.extend(g,c);b.call(c,g)}}}a.handler=b;d.push(a);return a}function Q(){for(var b=0,a=S.length;b<a;b++){A.stopObserving(S[b]);S[b]=null}}var S=[];if(Prototype.Browser.IE){window.attachEvent("onunload",Q)}if(Prototype.Browser.WebKit){window.addEventListener("unload",Prototype.emptyFunction,false)}var M=Prototype.K;if(!z){M=function(a){var b={mouseenter:"mouseover",mouseleave:"mouseout"};return a in b?b[a]:a}}function D(d,e,b){d=$(d);var a=K(d,e,b);if(!a){return d}if(e.include(":")){if(d.addEventListener){d.addEventListener("dataavailable",a,false)}else{d.attachEvent("ondataavailable",a);d.attachEvent("onfilterchange",a)}}else{var c=M(e);if(d.addEventListener){d.addEventListener(c,a,false)}else{d.attachEvent("on"+c,a)}}return d}function N(c,f,b){c=$(c);var g=Element.retrieve(c,"prototype_event_registry");if(Object.isUndefined(g)){return c}if(f&&!b){var d=g.get(f);if(Object.isUndefined(d)){return c}d.each(function(h){Element.stopObserving(c,f,h.handler)});return c}else{if(!f){g.each(function(h){var j=h.key,i=h.value;i.each(function(l){Element.stopObserving(c,j,l.handler)})});return c}}var d=g.get(f);if(!d){return}var a=d.find(function(h){return h.handler===b});if(!a){return c}var e=M(f);if(f.include(":")){if(c.removeEventListener){c.removeEventListener("dataavailable",a,false)}else{c.detachEvent("ondataavailable",a);c.detachEvent("onfilterchange",a)}}else{if(c.removeEventListener){c.removeEventListener(e,a,false)}else{c.detachEvent("on"+e,a)}}g.set(f,d.without(a));return c}function B(d,e,a,c){d=$(d);if(Object.isUndefined(c)){c=true}if(d==document&&document.createEvent&&!d.dispatchEvent){d=document.documentElement}var b;if(document.createEvent){b=document.createEvent("HTMLEvents");b.initEvent("dataavailable",true,true)}else{b=document.createEventObject();b.eventType=c?"ondataavailable":"onfilterchange"}b.eventName=e;b.memo=a||{};if(document.createEvent){d.dispatchEvent(b)}else{d.fireEvent(b.eventType,b)}return A.extend(b)}Object.extend(A,A.Methods);Object.extend(A,{fire:B,observe:D,stopObserving:N});Element.addMethods({fire:B,observe:D,stopObserving:N});Object.extend(document,{fire:B.methodize(),observe:D.methodize(),stopObserving:N.methodize(),loaded:false});if(window.Event){Object.extend(window.Event,A)}else{window.Event=A}})();(function(){var g;function f(){if(document.loaded){return}if(g){window.clearTimeout(g)}document.loaded=true;document.fire("dom:loaded")}function h(){if(document.readyState==="complete"){document.stopObserving("readystatechange",h);f()}}function e(){try{document.documentElement.doScroll("left")}catch(a){g=e.defer();return}f()}if(document.addEventListener){document.addEventListener("DOMContentLoaded",f,false)}else{document.observe("readystatechange",h);if(window==top){g=e.defer()}}Event.observe(window,"load",f)})();Element.addMethods();Hash.toQueryString=Object.toQueryString;var Toggle={display:Element.toggle};Element.Methods.childOf=Element.Methods.descendantOf;var Insertion={Before:function(d,c){return Element.insert(d,{before:c})},Top:function(d,c){return Element.insert(d,{top:c})},Bottom:function(d,c){return Element.insert(d,{bottom:c})},After:function(d,c){return Element.insert(d,{after:c})}};var $continue=new Error('"throw $continue" is deprecated, use "return" instead');var Position={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},within:function(d,e,f){if(this.includeScrollOffsets){return this.withinIncludingScrolloffsets(d,e,f)}this.xcomp=e;this.ycomp=f;this.offset=Element.cumulativeOffset(d);return(f>=this.offset[1]&&f<this.offset[1]+d.offsetHeight&&e>=this.offset[0]&&e<this.offset[0]+d.offsetWidth)},withinIncludingScrolloffsets:function(e,f,g){var h=Element.cumulativeScrollOffset(e);this.xcomp=f+h[0]-this.deltaX;this.ycomp=g+h[1]-this.deltaY;this.offset=Element.cumulativeOffset(e);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+e.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+e.offsetWidth)},overlap:function(c,d){if(!c){return 0}if(c=="vertical"){return((this.offset[1]+d.offsetHeight)-this.ycomp)/d.offsetHeight}if(c=="horizontal"){return((this.offset[0]+d.offsetWidth)-this.xcomp)/d.offsetWidth}},cumulativeOffset:Element.Methods.cumulativeOffset,positionedOffset:Element.Methods.positionedOffset,absolutize:function(b){Position.prepare();return Element.absolutize(b)},relativize:function(b){Position.prepare();return Element.relativize(b)},realOffset:Element.Methods.cumulativeScrollOffset,offsetParent:Element.Methods.getOffsetParent,page:Element.Methods.viewportOffset,clone:function(d,f,e){e=e||{};return Element.clonePosition(f,d,e)}};if(!document.getElementsByClassName){document.getElementsByClassName=function(c){function d(a){return a.blank()?null:"[contains(concat(' ', @class, ' '), ' "+a+" ')]"}c.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(f,a){a=a.toString().strip();var b=/\s/.test(a)?$w(a).map(d).join(""):d(a);return b?document._getElementsByXPath(".//*"+b,f):[]}:function(o,n){n=n.toString().strip();var m=[],i=(/\s/.test(n)?$w(n):null);if(!i&&!n){return m}var q=$(o).getElementsByTagName("*");n=" "+n+" ";for(var p=0,a,b;a=q[p];p++){if(a.className&&(b=" "+a.className+" ")&&(b.include(n)||(i&&i.all(function(e){return !e.toString().blank()&&b.include(" "+e+" ")})))){m.push(Element.extend(a))}}return m};return function(a,b){return $(b||document.body).getElementsByClassName(a)}}(Element.Methods)}Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(b){this.element=$(b)},_each:function(b){this.element.className.split(/\s+/).select(function(a){return a.length>0})._each(b)},set:function(b){this.element.className=b},add:function(b){if(this.include(b)){return}this.set($A(this).concat(b).join(" "))},remove:function(b){if(!this.include(b)){return}this.set($A(this).without(b).join(" "))},toString:function(){return $A(this).join(" ")}};Object.extend(Element.ClassNames.prototype,Enumerable);var S2={Version:"2.0.0_a6",Extensions:{}};Function.prototype.optionize=function(){var f=this,h=f.argumentNames(),e=this.length-1;var g=function(){var b=$A(arguments);var c=(typeof b.last()==="object")?b.pop():{};var a=[];if(e>0){a=((b.length>0?b:[null]).inGroupsOf(e).flatten()).concat(c)}return f.apply(this,a)};g.argumentNames=function(){return h};return g};Function.ABSTRACT=function(){throw"Abstract method. Implement in subclass."};Object.extend(Number.prototype,{constrain:function(h,i){var j=(h<i)?h:i;var g=(h<i)?i:h;var f=Number(this);if(f<j){f=j}if(f>g){f=g}return f},nearer:function(j,f){var g=Number(this);var h=Math.abs(g-j);var i=Math.abs(g-f);return(h<i)?j:f},tween:function(c,d){return this+(c-this)*d}});Object.propertize=function(c,d){return Object.isString(c)?d[c]:c};S2.CSS={PROPERTY_MAP:{backgroundColor:"color",borderBottomColor:"color",borderBottomWidth:"length",borderLeftColor:"color",borderLeftWidth:"length",borderRightColor:"color",borderRightWidth:"length",borderSpacing:"length",borderTopColor:"color",borderTopWidth:"length",bottom:"length",color:"color",fontSize:"length",fontWeight:"integer",height:"length",left:"length",letterSpacing:"length",lineHeight:"length",marginBottom:"length",marginLeft:"length",marginRight:"length",marginTop:"length",maxHeight:"length",maxWidth:"length",minHeight:"length",minWidth:"length",opacity:"number",outlineColor:"color",outlineOffset:"length",outlineWidth:"length",paddingBottom:"length",paddingLeft:"length",paddingRight:"length",paddingTop:"length",right:"length",textIndent:"length",top:"length",width:"length",wordSpacing:"length",zIndex:"integer",zoom:"number"},LENGTH:/^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/,NUMBER:/([\+-]*\d+\.?\d*)/,__parseStyleElement:document.createElement("div"),parseStyle:function(e){S2.CSS.__parseStyleElement.innerHTML='<div style="'+e+'"></div>';var f=S2.CSS.__parseStyleElement.childNodes[0].style,d={};S2.CSS.NUMERIC_PROPERTIES.each(function(a){if(f[a]){d[a]=f[a]}});S2.CSS.COLOR_PROPERTIES.each(function(a){if(f[a]){d[a]=S2.CSS.colorFromString(f[a])}});if(Prototype.Browser.IE&&e.include("opacity")){d.opacity=e.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]}return d},normalizeColor:function(b){if(!b||b=="rgba(0, 0, 0, 0)"||b=="transparent"){b="#ffffff"}b=S2.CSS.colorFromString(b);return[parseInt(b.slice(1,3),16),parseInt(b.slice(3,5),16),parseInt(b.slice(5,7),16)]},colorFromString:function(f){var h="#",g,e;if(f.slice(0,4)=="rgb("){g=f.slice(4,f.length-1).split(",");e=3;while(e--){h+=parseInt(g[2-e]).toColorPart()}}else{if(f.slice(0,1)=="#"){if(f.length==4){for(e=1;e<4;e++){h+=(f.charAt(e)+f.charAt(e)).toLowerCase()}}if(f.length==7){h=f.toLowerCase()}}else{h=f}}return(h.length==7?h:(arguments[1]||h))},interpolateColor:function(f,d,e){f=S2.CSS.normalizeColor(f);d=S2.CSS.normalizeColor(d);return"#"+[0,1,2].map(function(a){return Math.max(Math.min(f[a].tween(d[a],e).round(),255),0).toColorPart()}).join("")},interpolateNumber:function(f,d,e){return 1*((f||0).tween(d,e).toFixed(3))},interpolateLength:function(f,d,e){if(!f||parseFloat(f)===0){f="0"+d.gsub(S2.CSS.NUMBER,"")}d.scan(S2.CSS.NUMBER,function(a){d=1*(a[1])});return f.gsub(S2.CSS.NUMBER,function(a){return(1*(parseFloat(a[1]).tween(d,e).toFixed(3))).toString()})},interpolateInteger:function(f,d,e){return parseInt(f).tween(d,e).round()},interpolate:function(e,g,h,f){return S2.CSS["interpolate"+S2.CSS.PROPERTY_MAP[e.camelize()].capitalize()](g,h,f)},ElementMethods:{getStyles:function(c){var d=document.defaultView.getComputedStyle($(c),null);return S2.CSS.PROPERTIES.inject({},function(b,a){b[a]=d[a];return b})}}};S2.CSS.PROPERTIES=[];for(property in S2.CSS.PROPERTY_MAP){S2.CSS.PROPERTIES.push(property)}S2.CSS.NUMERIC_PROPERTIES=S2.CSS.PROPERTIES.findAll(function(b){return !b.endsWith("olor")});S2.CSS.COLOR_PROPERTIES=S2.CSS.PROPERTIES.findAll(function(b){return b.endsWith("olor")});if(!(document.defaultView&&document.defaultView.getComputedStyle)){S2.CSS.ElementMethods.getStyles=function(d){d=$(d);var e=d.currentStyle,f;f=S2.CSS.PROPERTIES.inject({},function(a,b){a[b]=e[b];return a});if(!f.opacity){f.opacity=d.getOpacity()}return f}}Element.addMethods(S2.CSS.ElementMethods);S2.FX=(function(){var o=[],j,l,m=0;function n(a){l[(m+=a)>0?"start":"stop"]()}function h(){o.invoke("render",l.getTimestamp())}function i(a){if(j){return}o.push(j=new S2.FX.Queue());S2.FX.DefaultOptions.queue=j;l=a||new S2.FX.Heartbeat();document.observe("effect:heartbeat",h).observe("effect:queued",n.curry(1)).observe("effect:dequeued",n.curry(-1))}return{initialize:i,getQueues:function(){return o},addQueue:function(a){o.push(a)},getHeartbeat:function(){return l},setHeartbeat:function(a){l=a}}})();Object.extend(S2.FX,{DefaultOptions:{transition:"sinusoidal",position:"parallel",fps:60,duration:0.2},elementDoesNotExistError:{name:"ElementDoesNotExistError",message:"The specified DOM element does not exist, but is required for this effect to operate"},parseOptions:function(b){if(Object.isNumber(b)){b={duration:b}}else{if(Object.isFunction(b)){b={after:b}}else{if(Object.isString(b)){b={duration:b=="slow"?1:b=="fast"?0.1:0.2}}}}return b||{}}});S2.FX.Base=Class.create({initialize:function(b){S2.FX.initialize();this.updateWithoutWrappers=this.update;if(b&&b.queue&&!S2.FX.getQueues().include(b.queue)){S2.FX.addQueue(b.queue)}this.setOptions(b);this.duration=this.options.duration*1000;this.state="idle";["after","before"].each(function(a){this[a]=function(d){d(this);return this}},this)},setOptions:function(b){b=S2.FX.parseOptions(b);if(!this.options){this.options=Object.extend(Object.extend({},S2.FX.DefaultOptions),b);if(b.tween){this.options.transition=b.tween}}if(this.options.beforeUpdate||this.options.afterUpdate){this.update=this.updateWithoutWrappers.wrap(function(d,a){if(this.options.beforeUpdate){this.options.beforeUpdate(this,a)}d(a);if(this.options.afterUpdate){this.options.afterUpdate(this,a)}}.bind(this))}if(this.options.transition===false){this.options.transition=S2.FX.Transitions.linear}this.options.transition=Object.propertize(this.options.transition,S2.FX.Transitions)},play:function(b){this.setOptions(b);this.frameCount=0;this.options.queue.add(this);this.maxFrames=this.options.fps*this.duration/1000;return this},render:function(c){if(c>=this.startsAt){if(this.state=="idle"){if(this.options.before){this.options.before(this)}if(this.setup){this.setup()}this.state="running";this.update(this.options.transition(0));this.frameCount++;return this}if(c>=this.endsAt&&!(this.state=="finished")){this.update(this.options.transition(1));if(this.teardown){this.teardown()}if(this.options.after){this.options.after(this)}this.state="finished"}else{if(this.state=="running"){var d=1-(this.endsAt-c)/this.duration;if((this.maxFrames*d).floor()>this.frameCount){this.update(this.options.transition(d));this.frameCount++}}}}return this},cancel:function(b){if(!this.state=="running"){return}if(this.teardown){this.teardown()}if(b&&this.options.after){this.options.after(this)}this.state="finished"},finish:function(b){if(!this.state=="running"){return}this.update(this.options.transition(1));this.cancel(true)},inspect:function(){return"#<S2.FX:"+[this.state,this.startsAt,this.endsAt].inspect()+">"},update:Prototype.emptyFunction});S2.FX.Element=Class.create(S2.FX.Base,{initialize:function($super,c,d){if(!(this.element=$(c))){throw (S2.FX.elementDoesNotExistError)}this.operators=[];return $super(d)},animate:function(){var c=$A(arguments),d=c.shift();d=d.charAt(0).toUpperCase()+d.substring(1);this.operators.push(new S2.FX.Operators[d](this,c[0],c[1]||{}))},play:function($super,c,d){if(c){this.element=$(c)}return $super(d)},update:function(b){this.operators.invoke("render",b)}});S2.FX.Heartbeat=Class.create({initialize:function(b){this.options=Object.extend({framerate:Prototype.Browser.MobileSafari?20:60},b);this.beat=this.beat.bind(this)},start:function(){if(this.heartbeatInterval){return}this.heartbeatInterval=setInterval(this.beat,1000/this.options.framerate);this.updateTimestamp()},stop:function(){if(!this.heartbeatInterval){return}clearInterval(this.heartbeatInterval);this.heartbeatInterval=null;this.timestamp=null},beat:function(){this.updateTimestamp();document.fire("effect:heartbeat")},getTimestamp:function(){return this.timestamp||this.generateTimestamp()},generateTimestamp:function(){return new Date().getTime()},updateTimestamp:function(){this.timestamp=this.generateTimestamp()}});S2.FX.Queue=(function(){return function(){var n=[];function m(){return n}function j(){return n.length>0}function l(a){h(a);n.push(a);document.fire("effect:queued",this);return this}function i(a){n=n.without(a);delete a;document.fire("effect:dequeued",this);return this}function o(a){n.invoke("render",a);n.select(function(b){return b.state=="finished"}).each(i);return this}function h(a){var c=a.options.position||"parallel",b=S2.FX.getHeartbeat().getTimestamp();if(c=="end"){b=n.without(a).pluck("endsAt").max()||b}a.startsAt=b+(a.options.delay||0)*1000;a.endsAt=a.startsAt+(a.options.duration||1)*1000}Object.extend(this,{getEffects:m,active:j,add:l,remove:i,render:o})}})();S2.FX.Attribute=Class.create(S2.FX.Base,{initialize:function($super,f,h,i,g,j){f=Object.isString(f)?$(f):f;this.method=Object.isFunction(j)?j.bind(f):Object.isFunction(f[j])?f[j].bind(f):function(a){f[j]=a};this.to=i;this.from=h;return $super(g)},update:function(b){this.method(this.from.tween(this.to,b))}});S2.FX.Style=Class.create(S2.FX.Element,{setup:function(){this.animate("style",this.element,{style:this.options.style})}});S2.FX.Operators={};S2.FX.Operators.Base=Class.create({initialize:function(f,d,e){this.effect=f;this.object=d;this.options=Object.extend({transition:Prototype.K},e)},inspect:function(){return"#<S2.FX.Operators.Base:"+this.lastValue+">"},setup:function(){},valueAt:function(b){},applyValue:function(b){},render:function(d){var c=this.valueAt(this.options.transition(d));this.applyValue(c);this.lastValue=c}});S2.FX.Operators.Style=Class.create(S2.FX.Operators.Base,{initialize:function($super,o,h,i){$super(o,h,i);this.element=$(this.object);this.style=Object.isString(this.options.style)?S2.CSS.parseStyle(this.options.style):this.options.style;this.tweens=[];for(var n in this.style){var m=n.underscore().dasherize(),j=this.element.getStyle(m),l=this.style[n];if(j!=l){this.tweens.push([m,S2.CSS.interpolate.curry(m,j,l),n in this.options.propertyTransitions?Object.propertize(this.options.propertyTransitions[n],S2.FX.Transitions):Prototype.K])}}},valueAt:function(b){return this.tweens.map(function(a){return a[0]+":"+a[1](a[2](b))}).join(";")},applyValue:function(b){if(this.currentStyle==b){return}this.element.setStyle(b);this.currentStyle=b}});S2.FX.Morph=Class.create(S2.FX.Element,{setup:function(){if(this.options.change){this.setupWrappers()}else{if(this.options.style){this.animate("style",this.destinationElement||this.element,{style:this.options.style,propertyTransitions:this.options.propertyTransitions||{}})}}},teardown:function(){if(this.options.change){this.teardownWrappers()}},setupWrappers:function(){var h=this.element.getStyle("float"),i,g,l,m,j;this.transitionElement=new Element("div").setStyle({position:"relative",overflow:"hidden","float":h});this.element.setStyle({"float":"none"}).insert({before:this.transitionElement});this.sourceElementWrapper=this.element.cloneWithoutIDs().wrap("div");this.destinationElementWrapper=this.element.wrap("div");this.transitionElement.insert(this.sourceElementWrapper).insert(this.destinationElementWrapper);i=this.sourceElementWrapper.getHeight();g=this.sourceElementWrapper.getWidth();this.options.change();l=this.destinationElementWrapper.getHeight();m=this.destinationElementWrapper.getWidth();this.outerWrapper=new Element("div");this.transitionElement.insert({before:this.outerWrapper});this.outerWrapper.setStyle({overflow:"hidden",height:i+"px",width:g+"px"}).appendChild(this.transitionElement);j=Math.max(l,i),maxWidth=Math.max(m,g);this.transitionElement.setStyle({height:i+"px",width:g+"px"});this.sourceElementWrapper.setStyle({position:"absolute",height:j+"px",width:maxWidth+"px",top:0,left:0});this.destinationElementWrapper.setStyle({position:"absolute",height:j+"px",width:maxWidth+"px",top:0,left:0,opacity:0,zIndex:2000});this.outerWrapper.insert({before:this.transitionElement}).remove();this.animate("style",this.transitionElement,{style:"height:"+l+"px; width:"+m+"px"});this.animate("style",this.destinationElementWrapper,{style:"opacity: 1.0"})},teardownWrappers:function(){var b=this.destinationElementWrapper.down();if(b){this.transitionElement.insert({before:b})}this.transitionElement.remove()}});S2.FX.Parallel=Class.create(S2.FX.Base,{initialize:function($super,c,d){this.effects=c||[];return $super(d||{})},setup:function(){this.effects.invoke("setup")},update:function(b){this.effects.invoke("update",b)}});S2.FX.Operators.Scroll=Class.create(S2.FX.Operators.Base,{initialize:function($super,f,d,e){$super(f,d,e);this.start=d.scrollTop;this.end=this.options.scrollTo},valueAt:function(b){return this.start+((this.end-this.start)*b)},applyValue:function(b){this.object.scrollTop=b.round()}});S2.FX.Scroll=Class.create(S2.FX.Element,{setup:function(){this.animate("scroll",this.element,{scrollTo:this.options.to})}});S2.FX.SlideDown=Class.create(S2.FX.Element,{setup:function(){var e=this.destinationElement||this.element;var f=e.getLayout();var d={height:f.get("height")+"px",paddingTop:f.get("padding-top")+"px",paddingBottom:f.get("padding-bottom")+"px"};e.setStyle({height:"0",paddingTop:"0",paddingBottom:"0",overflow:"hidden"}).show();this.animate("style",e,{style:d,propertyTransitions:{}})},teardown:function(){var b=this.destinationElement||this.element;b.setStyle({height:"",paddingTop:"",paddingBottom:"",overflow:"visible"})}});S2.FX.SlideUp=Class.create(S2.FX.Morph,{setup:function(){var e=this.destinationElement||this.element;var f=e.getLayout();var d={height:"0px",paddingTop:"0px",paddingBottom:"0px"};e.setStyle({overflow:"hidden"});this.animate("style",e,{style:d,propertyTransitions:{}})},teardown:function(){var b=this.destinationElement||this.element;b.setStyle({height:"",paddingTop:"",paddingBottom:"",overflow:"visible"}).hide()}});S2.FX.Transitions={linear:Prototype.K,sinusoidal:function(b){return(-Math.cos(b*Math.PI)/2)+0.5},reverse:function(b){return 1-b},mirror:function(c,d){d=d||S2.FX.Transitions.sinusoidal;if(c<0.5){return d(c*2)}else{return d(1-(c-0.5)*2)}},flicker:function(b){var b=b+(Math.random()-0.5)/5;return S2.FX.Transitions.sinusoidal(b<0?0:b>1?1:b)},wobble:function(b){return(-Math.cos(b*Math.PI*(9*b))/2)+0.5},pulse:function(c,d){return(-Math.cos((c*((d||5)-0.5)*2)*Math.PI)/2)+0.5},blink:function(c,d){return Math.round(c*(d||5))%2},spring:function(b){return 1-(Math.cos(b*4.5*Math.PI)*Math.exp(-b*6))},none:Prototype.K.curry(0),full:Prototype.K.curry(1)};(function(){function b(z,L,M,D,E,N){var A=0,a=0,J=0,C=0,x=0,K=0;function F(c){return((A*c+a)*c+J)*c}function G(c){return((C*c+x)*c+K)*c}function w(c){return(3*A*c+2*a)*c+J}function B(c){return 1/(200*c)}function H(c,d){return G(I(c,d))}function y(c){if(c>=0){return c}else{return 0-c}}function I(d,e){var f,h,c,j,i,g;for(c=d,g=0;g<8;g++){j=F(c)-d;if(y(j)<e){return c}i=w(c);if(y(i)<0.000001){break}c=c-j/i}f=0;h=1;c=d;if(c<f){return f}if(c>h){return h}while(f<h){j=F(c);if(y(j-d)<e){return c}if(d>j){f=c}else{h=c}c=(h-f)*0.5+f}return c}J=3*L;a=3*(D-L)-J;A=1-J-a;K=3*M;x=3*(E-M)-K;C=1-K-x;return H(z,B(N))}S2.FX.cubicBezierTransition=function(h,f,a,g){return(function(c){return b(c,h,f,a,g,1)})}})();S2.FX.Transitions.webkitCubic=S2.FX.cubicBezierTransition(0.25,0.1,0.25,1);S2.FX.Transitions.webkitEaseInOut=S2.FX.cubicBezierTransition(0.42,0,0.58,1);Object.extend(S2.FX.Transitions,{easeInQuad:function(b){return Math.pow(b,2)},easeOutQuad:function(b){return -(Math.pow((b-1),2)-1)},easeInOutQuad:function(b){if((b/=0.5)<1){return 0.5*Math.pow(b,2)}return -0.5*((b-=2)*b-2)},easeInCubic:function(b){return Math.pow(b,3)},easeOutCubic:function(b){return(Math.pow((b-1),3)+1)},easeInOutCubic:function(b){if((b/=0.5)<1){return 0.5*Math.pow(b,3)}return 0.5*(Math.pow((b-2),3)+2)},easeInQuart:function(b){return Math.pow(b,4)},easeOutQuart:function(b){return -(Math.pow((b-1),4)-1)},easeInOutQuart:function(b){if((b/=0.5)<1){return 0.5*Math.pow(b,4)}return -0.5*((b-=2)*Math.pow(b,3)-2)},easeInQuint:function(b){return Math.pow(b,5)},easeOutQuint:function(b){return(Math.pow((b-1),5)+1)},easeInOutQuint:function(b){if((b/=0.5)<1){return 0.5*Math.pow(b,5)}return 0.5*(Math.pow((b-2),5)+2)},easeInSine:function(b){return -Math.cos(b*(Math.PI/2))+1},easeOutSine:function(b){return Math.sin(b*(Math.PI/2))},easeInOutSine:function(b){return(-0.5*(Math.cos(Math.PI*b)-1))},easeInExpo:function(b){return(b==0)?0:Math.pow(2,10*(b-1))},easeOutExpo:function(b){return(b==1)?1:-Math.pow(2,-10*b)+1},easeInOutExpo:function(b){if(b==0){return 0}if(b==1){return 1}if((b/=0.5)<1){return 0.5*Math.pow(2,10*(b-1))}return 0.5*(-Math.pow(2,-10*--b)+2)},easeInCirc:function(b){return -(Math.sqrt(1-(b*b))-1)},easeOutCirc:function(b){return Math.sqrt(1-Math.pow((b-1),2))},easeInOutCirc:function(b){if((b/=0.5)<1){return -0.5*(Math.sqrt(1-b*b)-1)}return 0.5*(Math.sqrt(1-(b-=2)*b)+1)},easeOutBounce:function(b){if((b)<(1/2.75)){return(7.5625*b*b)}else{if(b<(2/2.75)){return(7.5625*(b-=(1.5/2.75))*b+0.75)}else{if(b<(2.5/2.75)){return(7.5625*(b-=(2.25/2.75))*b+0.9375)}else{return(7.5625*(b-=(2.625/2.75))*b+0.984375)}}}},easeInBack:function(c){var d=1.70158;return(c)*c*((d+1)*c-d)},easeOutBack:function(c){var d=1.70158;return(c=c-1)*c*((d+1)*c+d)+1},easeInOutBack:function(c){var d=1.70158;if((c/=0.5)<1){return 0.5*(c*c*(((d*=(1.525))+1)*c-d))}return 0.5*((c-=2)*c*(((d*=(1.525))+1)*c+d)+2)},elastic:function(b){return -1*Math.pow(4,-8*b)*Math.sin((b*6-1)*(2*Math.PI)/2)+1},swingFromTo:function(c){var d=1.70158;return((c/=0.5)<1)?0.5*(c*c*(((d*=(1.525))+1)*c-d)):0.5*((c-=2)*c*(((d*=(1.525))+1)*c+d)+2)},swingFrom:function(c){var d=1.70158;return c*c*((d+1)*c-d)},swingTo:function(c){var d=1.70158;return(c-=1)*c*((d+1)*c+d)+1},bounce:function(b){if(b<(1/2.75)){return(7.5625*b*b)}else{if(b<(2/2.75)){return(7.5625*(b-=(1.5/2.75))*b+0.75)}else{if(b<(2.5/2.75)){return(7.5625*(b-=(2.25/2.75))*b+0.9375)}else{return(7.5625*(b-=(2.625/2.75))*b+0.984375)}}}},bouncePast:function(b){if(b<(1/2.75)){return(7.5625*b*b)}else{if(b<(2/2.75)){return 2-(7.5625*(b-=(1.5/2.75))*b+0.75)}else{if(b<(2.5/2.75)){return 2-(7.5625*(b-=(2.25/2.75))*b+0.9375)}else{return 2-(7.5625*(b-=(2.625/2.75))*b+0.984375)}}}},easeFromTo:function(b){if((b/=0.5)<1){return 0.5*Math.pow(b,4)}return -0.5*((b-=2)*Math.pow(b,3)-2)},easeFrom:function(b){return Math.pow(b,4)},easeTo:function(b){return Math.pow(b,0.25)}});Prototype.BrowserFeatures.WebkitCSSTransitions=false;S2.Extensions.webkitCSSTransitions=false;(function(){try{document.createEvent("WebKitTransitionEvent")}catch(b){return}Prototype.BrowserFeatures.WebkitCSSTransitions=true;S2.Extensions.webkitCSSTransitions=true;if(Prototype.BrowserFeatures.WebkitCSSTransitions){$w("webkitBorderTopLeftRadius webkitBorderTopRightRadius webkitBorderBottomLeftRadius webkitBorderBottomRightRadius webkitBackgroundSize").each(function(a){S2.CSS.PROPERTIES.push(a)});S2.CSS.NUMERIC_PROPERTIES=S2.CSS.PROPERTIES.findAll(function(a){return !a.endsWith("olor")});S2.FX.Operators.WebkitCssTransition=Class.create(S2.FX.Operators.Base,{initialize:function($super,f,h,a){$super(f,h,a);this.element=$(this.object);if(!Object.isString(this.options.style)){this.style=$H(this.options.style)}else{if(this.options.style.include(":")){this.style=$H(S2.CSS.parseStyle(this.options.style))}else{this.element.addClassName(a.style);this.style=$H(this.element.getStyles());this.element.removeClassName(a.style);var g=this.element.getStyles();this.style=this.style.reject(function(c){return c.value==g[c.key]})}}this.properties=[];this.targetStyle="";this.style.each(function(c){var e=c[0].underscore().dasherize(),d=c[1],n="",m=this.element.getStyle(e),o="";if(e.startsWith("webkit")){e="-"+e}this.properties.push(e);this.targetStyle+=";"+e+":"+d},this)},render:function(){this.element.style.webkitTransitionProperty=this.properties.join(",");this.element.style.webkitTransitionDuration=(this.effect.duration/1000).toFixed(3)+"s";for(t in S2.FX.Operators.WebkitCssTransition.TIMING_MAP){if(S2.FX.Transitions[t]===this.effect.options.transition){this.element.style.webkitTransitionTimingFunction=S2.FX.Operators.WebkitCssTransition.TIMING_MAP[t]}}this.element.setStyle(this.targetStyle);this.render=Prototype.emptyFunction}});S2.FX.Operators.WebkitCssTransition.TIMING_MAP={linear:"linear",sinusoidal:"ease-in-out"};timingFunctionForTransition=function(d){var a=null;for(t in S2.FX.Operators.WebkitCssTransition.TIMING_MAP){if(S2.FX.Transitions[t]===d){a=S2.FX.Operators.WebkitCssTransition.TIMING_MAP[t]}}return a};isWebkitCSSTransitionCompatible=function(a){return(S2.Extensions.webkitCSSTransitions&&!((a.options.engine||"")=="javascript")&&(timingFunctionForTransition(a.options.transition))&&!(a.options.propertyTransitions))};S2.FX.Morph=Class.create(S2.FX.Morph,{setup:function(){if(this.options.change){this.setupWrappers()}else{if(this.options.style){this.engine=isWebkitCSSTransitionCompatible(this)?"webkit":"javascript";this.animate(this.engine=="webkit"?"webkitCssTransition":"style",this.destinationElement||this.element,{style:this.options.style,propertyTransitions:this.options.propertyTransitions||{}})}}},render:function($super,a){if(this.engine=="webkit"){if(this.options.before){this.element.beforeStartEffect=this.options.before}if(this.options.after){this.element.afterFinishEffect=this.options.after;delete this.options.after}this.element._effect=this}return $super(a)}});Element.addMethods({morph:function(f,e,a){if(Object.isNumber(a)){a={duration:a}}return f.effect("morph",Object.extend(a,{style:e}))}.optionize()});S2.FX.webkitTransitionStartEvent=document.observe("webkitTransitionStart",function(d){var a=d.element();if(!a||!a.beforeStartEffect){return}a.beforeStartEffect();a.beforeStartEffect=null});S2.FX.webkitTransitionEndEvent=document.observe("webkitTransitionEnd",function(d){var a=d.element();if(!a){return}(function(){a.style.webkitTransitionDuration=""}).defer();if(!a.afterFinishEffect){return}a.afterFinishEffect();a.afterFinishEffect=null})}})();(function(){function v(a){var b=a.match(/^(\d+)%?$/i);if(!b){return null}return(Number(b[1])/100)}function p(b,c){if(Object.isElement(b)){element=b;b=element.getStyle(c)}if(b===null){return null}if((/^\d+(px)?$/i).test(b)){return window.parseInt(b,10)}if(/\d/.test(b)&&element.runtimeStyle){var e=element.style.left,a=element.runtimeStyle.left;element.runtimeStyle.left=element.currentStyle.left;element.style.left=b||0;b=element.style.pixelLeft;element.style.left=e;element.runtimeStyle.left=a;return b}if(b.include("%")){var f=v(b);var d;if(c.include("left")||c.include("right")||c.include("width")){d=$(element.parentNode).measure("width")}else{if(c.include("top")||c.include("bottom")||c.include("height")){d=$(element.parentNode).measure("height")}}return d*f}return 0}function o(a){if(Object.isString(a)&&a.endsWith("px")){return a}return a+"px"}function w(b){var c=b;while(b&&b.parentNode){var a=b.getStyle("display");if(a==="none"){return false}b=$(b.parentNode)}return true}var s=Prototype.K;if("currentStyle" in document.documentElement){s=function(a){if(!a.currentStyle.hasLayout){a.style.zoom=1}return a}}Element.Layout=Class.create(Hash,{initialize:function($super,a,b){$super();this.element=$(a);if(b){this._preComputing=true;this._begin()}Element.Layout.PROPERTIES.each(function(c){if(b){this._compute(c)}else{this._set(c,null)}},this);if(b){this._end();this._preComputing=false}},_set:function(a,b){return Hash.prototype.set.call(this,a,b)},set:function(a,b){throw"Properties of Element.Layout are read-only."},get:function($super,a){var b=$super(a);return b===null?this._compute(a):b},_begin:function(){if(this._prepared){return}var e=this.element;if(w(e)){this._prepared=true;return}var f={position:e.style.position||"",width:e.style.width||"",visibility:e.style.visibility||"",display:e.style.display||""};e.store("prototype_original_styles",f);var h=e.getStyle("position"),c=e.getStyle("width");e.setStyle({position:"absolute",visibility:"hidden",display:"block"});var a=e.getStyle("width");var b;if(c&&(a===c)){b=window.parseInt(c,10)}else{if(c&&(h==="absolute"||h==="fixed")){b=window.parseInt(c,10)}else{var d=e.parentNode,g=$(d).getLayout();b=g.get("width")-this.get("margin-left")-this.get("border-left")-this.get("padding-left")-this.get("padding-right")-this.get("border-right")-this.get("margin-right")}}e.setStyle({width:b+"px"});this._prepared=true},_end:function(){var a=this.element;var b=a.retrieve("prototype_original_styles");a.store("prototype_original_styles",null);a.setStyle(b);this._prepared=false},_compute:function(a){var c=Element.Layout.COMPUTATIONS;if(!(a in c)){throw"Property not found."}var b=c[a].call(this,this.element);this._set(a,b);return b}});Object.extend(Element.Layout,{PROPERTIES:$w("height width top left right bottom border-left border-right border-top border-bottom padding-left padding-right padding-top padding-bottom margin-top margin-bottom margin-left margin-right padding-box-width padding-box-height border-box-width border-box-height margin-box-width margin-box-height"),COMPOSITE_PROPERTIES:$w("padding-box-width padding-box-height margin-box-width margin-box-height border-box-width border-box-height"),COMPUTATIONS:{height:function(d){if(!this._preComputing){this._begin()}var f=this.get("border-box-height");if(f<=0){return 0}var c=this.get("border-top"),e=this.get("border-bottom");var a=this.get("padding-top"),b=this.get("padding-bottom");if(!this._preComputing){this._end()}return f-c-e-a-b},width:function(d){if(!this._preComputing){this._begin()}var e=this.get("border-box-width");if(e<=0){return 0}var a=this.get("border-left"),f=this.get("border-right");var c=this.get("padding-left"),b=this.get("padding-right");if(!this._preComputing){this._end()}return e-a-f-c-b},"padding-box-height":function(c){var d=this.get("height"),a=this.get("padding-top"),b=this.get("padding-bottom");return d+a+b},"padding-box-width":function(d){var c=this.get("width"),b=this.get("padding-left"),a=this.get("padding-right");return c+b+a},"border-box-height":function(a){return a.offsetHeight},"border-box-width":function(a){return a.offsetWidth},"margin-box-height":function(c){var d=this.get("border-box-height"),b=this.get("margin-top"),a=this.get("margin-bottom");if(d<=0){return 0}return d+b+a},"margin-box-width":function(b){var c=this.get("border-box-width"),a=this.get("margin-left"),d=this.get("margin-right");if(c<=0){return 0}return c+a+d},top:function(b){var a=b.positionedOffset();return a.top},bottom:function(e){var b=e.positionedOffset(),d=e.getOffsetParent(),c=d.measure("height");var a=this.get("border-box-height");return c-a-b.top},left:function(b){var a=b.positionedOffset();return a.left},right:function(c){var a=c.positionedOffset(),b=c.getOffsetParent(),e=b.measure("width");var d=this.get("border-box-width");return e-d-a.left},"padding-top":function(a){return p(a,"paddingTop")},"padding-bottom":function(a){return p(a,"paddingBottom")},"padding-left":function(a){return p(a,"paddingLeft")},"padding-right":function(a){return p(a,"paddingRight")},"border-top":function(a){return Object.isNumber(a.clientTop)?a.clientTop:p(a,"borderTopWidth")},"border-bottom":function(a){return Object.isNumber(a.clientBottom)?a.clientBottom:p(a,"borderBottomWidth")},"border-left":function(a){return Object.isNumber(a.clientLeft)?a.clientLeft:p(a,"borderLeftWidth")},"border-right":function(a){return Object.isNumber(a.clientRight)?a.clientRight:p(a,"borderRightWidth")},"margin-top":function(a){return p(a,"marginTop")},"margin-bottom":function(a){return p(a,"marginBottom")},"margin-left":function(a){return p(a,"marginLeft")},"margin-right":function(a){return p(a,"marginRight")}}});if("getBoundingClientRect" in document.documentElement){Object.extend(Element.Layout.COMPUTATIONS,{right:function(c){var b=s(c.getOffsetParent());var a=c.getBoundingClientRect(),d=b.getBoundingClientRect();return(d.right-a.right).round()},bottom:function(c){var b=s(c.getOffsetParent());var a=c.getBoundingClientRect(),d=b.getBoundingClientRect();return(d.bottom-a.bottom).round()}})}Element.Offset=Class.create({initialize:function(a,b){this.left=a.round();this.top=b.round();this[0]=this.left;this[1]=this.top},relativeTo:function(a){return new Element.Offset(this.left-a.left,this.top-a.top)},inspect:function(){return"#<Element.Offset left: #{left} top: #{top}>".interpolate(this)},toString:function(){return"[#{left}, #{top}]".interpolate(this)},toArray:function(){return[this.left,this.top]}});function x(a){return new Element.Layout(a)}function y(b,a){return $(b).getLayout().get(a)}function u(b){var c=0,a=0;do{c+=b.offsetTop||0;a+=b.offsetLeft||0;b=b.offsetParent}while(b);return new Element.Offset(a,c)}function q(d){var c=d.getLayout();var e=0,a=0;do{e+=d.offsetTop||0;a+=d.offsetLeft||0;d=d.offsetParent;if(d){if(z(d)){break}var b=Element.getStyle(d,"position");if(b!=="static"){break}}}while(d);a-=c.get("margin-top");e-=c.get("margin-left");return new Element.Offset(a,e)}function r(b){var c=0,a=0;do{c+=b.scrollTop||0;a+=b.scrollLeft||0;b=b.parentNode}while(b);return new Element.Offset(a,c)}function n(a){var f=0,b=0;var d=a;do{f+=d.offsetTop||0;b+=d.offsetLeft||0;if(d.offsetParent==document.body&&Element.getStyle(d,"position")=="absolute"){break}}while(d=d.offsetParent);d=a;var e=d.tagName,c=Prototype.Browser.Opera;do{if(!c||e&&e.toUpperCase()==="BODY"){f-=d.scrollTop||0;b-=d.scrollLeft||0}}while(d=d.parentNode);return new Element.Offset(b,f)}Element.addMethods({getLayout:x,measure:y,cumulativeOffset:u,positionedOffset:q,cumulativeScrollOffset:r,viewportOffset:n});function z(a){return $w("BODY HTML").include(a.nodeName.toUpperCase())}if("getBoundingClientRect" in document.documentElement){Element.addMethods({viewportOffset:function(b){b=$(b);var a=b.getBoundingClientRect();return new Element.Offset(a.left,a.top)},cumulativeOffset:function(a){a=$(a);var c=$(document.documentElement).viewportOffset(),b=a.viewportOffset();return b.relativeTo(c)},positionedOffset:function(g){g=$(g);var e=g.getOffsetParent();if(e.nodeName.toUpperCase()==="HTML"){return q(g)}var c=g.viewportOffset(),f=z(e)?n(e):e.viewportOffset();var h=c.relativeTo(f);var d=g.getLayout();var a=h.top-d.get("margin-top");var b=h.left-d.get("margin-left");return new Element.Offset(b,a)}})}})();S2.UI={};Object.deepExtend=function(e,f){for(var d in f){if(f[d]&&f[d].constructor&&f[d].constructor===Object){e[d]=e[d]||{};arguments.callee(e[d],f[d])}else{e[d]=f[d]}}return e};S2.UI.Mixin={};S2.UI.Mixin.Configurable={setOptions:function(m){if(!this.options){this.options={};var i=this.constructor;if(i.superclass){var j=[],h=i;while(h=h.superclass){j.push(h)}j=j.reverse();for(var l=0,g=j.length;l<g;l++){Object.deepExtend(this.options,j[l].DEFAULT_OPTIONS||{})}}Object.deepExtend(this.options,i.DEFAULT_OPTIONS||{})}return Object.deepExtend(this.options,m||{})}};S2.UI.Mixin.Trackable={register:function(){var b=this.constructor;if(!b.instances){b.instances=[]}if(!b.instances.include(this)){b.instances.push(this)}if(Object.isFunction(b.onRegister)){b.onRegister.call(b,this)}},unregister:function(){var b=this.constructor;b.instances=b.instances.without(this);if(Object.isFunction(b.onRegister)){b.onUnregister.call(b,this)}}};S2.UI.Mixin.Shim={__SHIM_TEMPLATE:new Template("<iframe frameborder='0' tabindex='-1' src='javascript:false;' style='display:block;position:absolute;z-index:-1;overflow:hidden; filter:Alpha(Opacity=\"0\");top:expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+'px');left:expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+'px');width:expression(this.parentNode.offsetWidth+'px');height:expression(this.parentNode.offsetHeight+'px');' id='#{0}'></iframe>"),createShim:function(e){this.__shim_isie6=(Prototype.Browser.IE&&(/6.0/).test(navigator.userAgent));if(!this.__shim_isie6){return}e=$(e||this.element);if(!e){return}this.__shimmed=e;var f=e.identify()+"_iframeshim",d=$(f);if(d){d.remove()}e.insert({top:this.__SHIM_TEMPLATE.evaluate([f])});this.__shim_id=f},adjustShim:function(){if(!this.__shim_isie6){return}var c=this.__shimmed.down("iframe#"+this.__shim_id);var d=this.__shimmed;if(!c){return}c.setStyle({width:d.offsetWidth+"px",height:d.offsetHeight+"px"})},destroyShim:function(){if(!this.__shim_isie6){return}var b=this.__shimmed.down("iframe#"+this.__shim_id);if(b){b.remove()}this.__shimmed=null}};Object.extend(S2.UI,{addClassNames:function(j,i){if(Object.isElement(j)){j=[j]}if(Object.isString(i)){i=i.split(" ")}var h,l;for(var m=0,g;g=j[m];m++){for(h=0;l=i[h];h++){g.addClassName(l)}}return j},removeClassNames:function(j,i){if(Object.isElement(j)){j=[j]}if(Object.isString(i)){i=i.split(" ")}var h,l;for(var m=0,g;g=j[m];m++){for(h=0;l=i[h];h++){g.removeClassName(l)}}},FOCUSABLE_ELEMENTS:$w("input select textarea button object"),isFocusable:function(g){var h=g.nodeName.toLowerCase(),f=g.readAttribute("tabIndex"),e=false;if(S2.UI.FOCUSABLE_ELEMENTS.include(h)){e=!g.disabled}else{if($w("a area").include(h)){e=g.href||(f&&!isNaN(f))}else{e=f&&!isNaN(f)}}return !!e&&S2.UI.isVisible(g)},findFocusables:function(b){return $(b).descendants().select(S2.UI.isFocusable)},isVisible:function(h){h=$(h);var f=h;while(h&&h.parentNode){var g=h.getStyle("display"),e=h.getStyle("visibility");if(g==="none"||e==="hidden"){return false}h=$(h.parentNode)}return true},makeVisible:function(j,h){if(Object.isElement(j)){j=[j]}var i=h?"visible":"hidden";for(var f=0,g;g=j[f];f++){g.setStyle({visibility:i})}return j},modifierUsed:function(b){return b.metaKey||b.ctrlKey||b.altKey}});(function(){var d=[];function c(a){var g=Event.element(a);if(!g){return}for(var h=0,b;b=d[h];h++){if(g===b||g.descendantOf(b)){Event.stop(a);break}}}if(document.attachEvent){document.onselectstart=c.bindAsEventListener(window)}else{document.observe("mousedown",c)}Object.extend(S2.UI,{enableTextSelection:function(a){a.setStyle({"-moz-user-select":"","-webkit-user-select":""});d=d.without(a);return a},disableTextSelection:function(a){a.setStyle({"-moz-user-select":"none","-webkit-user-select":"none"});if(!d.include(a)){d.push(a)}return a}})})();S2.UI.Behavior=Class.create(S2.UI.Mixin.Configurable,{initialize:function(m,n){this.element=m;this.setOptions(n);Object.extend(this,n);this._observers={};function o(a){return a.startsWith("on")||a.include("/on")}var j,m,h,l;for(var i in this){if(!o(i)){continue}j=i.split("/");if(j.length===2){m=this[j.first()]||this.element}else{m=this.element}h=j.last();l=this._observers[h]=this[i].bind(this);m.observe(h.substring(2),l)}},destroy:function(){var d=this.options.proxy||this.element;var f;for(var e in this._observers){f=this._observers[e];d.stopObserving(e.substring(2),f)}}});Object.extend(S2.UI,{addBehavior:function(i,m,j){var l=arguments.callee;if(Object.isArray(i)){i.each(function(a){l(a,m,j)});return}if(Object.isArray(m)){m.each(function(a){l(i,a,j)});return}var g=new m(i,j||{});var h=$(i).retrieve("ui.behaviors",[]);h.push(g)},removeBehavior:function(m,h){var o=arguments.callee;if(Object.isArray(m)){m.each(function(a){o(a,h)});return}if(Object.isArray(h)){h.each(function(a){o(m,a)});return}var i=$(m).retrieve("ui.behaviors",[]);var j=[];for(var n=0,l;l=i[n];n++){if(!l instanceof h){continue}l.destroy();j.push(l)}$(m).store("ui.behaviors",i.without(j))},getBehavior:function(h,j){h=$(h);var m=h.retrieve("ui.behaviors",[]);for(var i=0,l=m.length,b;i<l;i++){b=m[i];if(b.constructor===j){return b}}return null}});S2.UI.Behavior.Drag=Class.create(S2.UI.Behavior,{initialize:function($super,c,d){this.__onmousemove=this._onmousemove.bind(this);$super(c,d);this.element.addClassName("ui-draggable")},destroy:function($super){this.element.removeClassName("ui-draggable");$super()},"handle/onmousedown":function(c){var d=this.element;this._startPointer=c.pointer();this._startPosition={left:window.parseInt(d.getStyle("left"),10),top:window.parseInt(d.getStyle("top"),10)};document.observe("mousemove",this.__onmousemove)},"handle/onmouseup":function(b){this._startPointer=null;this._startPosition=null;document.stopObserving("mousemove",this.__onmousemove)},_onmousemove:function(e){var h=e.pointer();if(!this._startPointer){return}var g={x:h.x-this._startPointer.x,y:h.y-this._startPointer.y};var f={left:(this._startPosition.left+g.x)+"px",top:(this._startPosition.top+g.y)+"px"};this.element.setStyle(f)}});S2.UI.Behavior.Focus=Class.create(S2.UI.Behavior,{onfocus:function(b){if(this.element.hasClassName("ui-state-disabled")){return}this.element.addClassName("ui-state-focus")},onblur:function(b){if(this.element.hasClassName("ui-state-disabled")){return}this.element.removeClassName("ui-state-focus")}});S2.UI.Behavior.Hover=Class.create(S2.UI.Behavior,{onmouseenter:function(b){if(this.element.hasClassName("ui-state-disabled")){return}this.element.addClassName("ui-state-hover")},onmouseleave:function(b){if(this.element.hasClassName("ui-state-disabled")){return}this.element.removeClassName("ui-state-hover")}});S2.UI.Behavior.Resize=Class.create(S2.UI.Behavior,{initialize:function(c,d){}});S2.UI.Behavior.Down=Class.create(S2.UI.Behavior,{onmousedown:function(b){this._down=true;if(this.element.hasClassName("ui-state-disabled")){return}this.element.addClassName("ui-state-down")},onmouseup:function(b){this._down=false;if(this.element.hasClassName("ui-state-disabled")){return}this.element.removeClassName("ui-state-down")},onmouseleave:function(b){return this.onmouseup(b)},onmouseenter:function(b){if(this._down){return this.onmousedown(b)}}});(function(b){b.Base=Class.create(b.Mixin.Configurable,{NAME:"S2.UI.Base",addObservers:Function.ABSTRACT,removeObservers:Function.ABSTRACT,destroy:function(){this.removeObservers()},toElement:function(){return this.element},inspect:function(){return"#<#{NAME}>".interpolate(this)}})})(S2.UI);Object.extend(Event,{KEY_SPACE:32});(function(b){b.Accordion=Class.create(b.Base,{NAME:"S2.UI.Accordion",initialize:function(g,i){this.element=$(g);var h=this.setOptions(i);b.addClassNames(this.element,"ui-accordion ui-widget ui-helper-reset");if(this.element.nodeName.toUpperCase()==="UL"){var j=this.element.childElements().grep(new Selector("li"));b.addClassNames(j,"ui-accordion-li-fix")}this.headers=this.element.select(h.headerSelector);if(!this.headers||this.headers.length===0){return}b.addClassNames(this.headers,"ui-accordion-header ui-helper-reset ui-state-default ui-corner-all");b.addBehavior(this.headers,[b.Behavior.Hover,b.Behavior.Focus]);this.content=this.headers.map(function(c){return c.next()});b.addClassNames(this.content,"ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");this.headers.each(function(c){var d=new Element("span");b.addClassNames(d,"ui-icon "+h.icons.header);c.insert({top:d})});this._markActive(h.active||this.headers.first(),false);this.element.writeAttribute({role:"tablist","aria-multiselectable":h.multiple.toString()});this.headers.invoke("writeAttribute","role","tab");this.content.invoke("writeAttribute","role","tabpanel");var a=this.headers.map(function(c){return c.down("a")});a.invoke("observe","click",function(c){c.preventDefault()});this.observers={click:this.click.bind(this),keypress:this.keypress.bind(this)};this.addObservers()},addObservers:function(){this.headers.invoke("observe","click",this.observers.click);if(Prototype.Browser.WebKit){this.headers.invoke("observe","keydown",this.observers.keypress)}else{this.headers.invoke("observe","keypress",this.observers.keypress)}},click:function(a){var d=a.findElement(this.options.headerSelector);if(!d||!this.headers.include(d)){return}this._toggleActive(d)},keypress:function(a){if(a.shiftKey||a.metaKey||a.altKey||a.ctrlKey){return}var e=a.findElement(this.options.headerSelector);var f=(a.keyCode===0)?a.charCode:a.keyCode;switch(f){case Event.KEY_SPACE:this._toggleActive(e);a.stop();return;case Event.KEY_DOWN:case Event.KEY_RIGHT:this._focusHeader(e,1);a.stop();return;case Event.KEY_UP:case Event.KEY_LEFT:this._focusHeader(e,-1);a.stop();return;case Event.KEY_HOME:this._focusHeader(this.headers.first());a.stop();return;case Event.KEY_END:this._focusHeader(this.headers.last());a.stop();return}},_focusHeader:function(e,f){if(Object.isNumber(f)){var a=this.headers.indexOf(e);a=a+f;if(a>(this.headers.length-1)){a=this.headers.length-1}else{if(a<0){a=0}}e=this.headers[a]}(function(){e.down("a").focus()}).defer()},_toggleActive:function(a){if(a.hasClassName("ui-state-active")){if(!this.options.multiple){return}this._removeActive(a);this._activatePanel(null,a.next(),true)}else{this._markActive(a)}},_removeActive:function(e){var a=this.options;b.removeClassNames(e,"ui-state-active ui-corner-top");b.addClassNames(e,"ui-state-default ui-corner-all");e.writeAttribute("aria-expanded","false");var f=e.down(".ui-icon");f.removeClassName(a.icons.headerSelected);f.addClassName(a.icons.header)},_markActive:function(h,j){if(Object.isUndefined(j)){j=true}var a=this.options;var g=null;if(!a.multiple){g=this.element.down(".ui-accordion-content-active");this.headers.each(this._removeActive.bind(this))}if(!h){return}b.removeClassNames(h,"ui-state-default ui-corner-all");b.addClassNames(h,"ui-state-active ui-corner-top");h.writeAttribute("aria-expanded","true");this._activatePanel(h.next(),g,j);var i=h.down(".ui-icon");i.removeClassName(a.icons.header);i.addClassName(a.icons.headerSelected);return h},_activatePanel:function(a,e,f){if(f){this.options.transition(a,e)}else{if(e){e.removeClassName("ui-accordion-content-active")}if(a){a.addClassName("ui-accordion-content-active")}}}});Object.extend(b.Accordion,{DEFAULT_OPTIONS:{multiple:false,headerSelector:"h3",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},transition:function(a,f){var g=[],h;if(f){h=new S2.FX.SlideUp(f,{duration:0.2,after:function(){f.removeClassName("ui-accordion-content-active")}});g.push(h)}if(a){h=new S2.FX.SlideDown(a,{duration:0.2,before:function(){a.addClassName("ui-accordion-content-active")}});g.push(h)}g.invoke("play")}}})})(S2.UI);(function(b){b.Button=Class.create(b.Base,{NAME:"S2.UI.Button",initialize:function(f,h){this.element=$(f);this.element.store("ui.button",this);var g=this.setOptions(h);b.addClassNames(this.element,"ui-state-default ui-corner-all");b.addBehavior(this.element,[b.Behavior.Hover,b.Behavior.Focus,b.Behavior.Down]);if(g.primary){this.element.addClassName("ui-priority-primary")}this.element.writeAttribute("role","button");this.enabled=true;var a=(this.element.disabled===true)||!this.element.hasClassName("ui-state-disabled");this.setEnabled(a)},setEnabled:function(a){if(this.enabled===a){return}this.enabled=a;if(a){this.element.removeClassName("ui-state-disabled")}else{this.element.addClassName("ui-state-disabled")}this.element.disabled=!a},toElement:function(){return this.element},toHTML:function(){return this.element.toHTML()},toString:function(){return this.element.toHTML()},inspect:function(){return this.element.inspect()}});Object.extend(b.Button,{DEFAULT_OPTIONS:{primary:false}})})(S2.UI);(function(b){b.Tabs=Class.create(b.Base,{NAME:"S2.UI.Tabs",initialize:function(i,l){this.element=$(i);b.addClassNames(this.element,"ui-widget ui-widget-content ui-tabs ui-corner-all");this.setOptions(l);var j=this.options;this.anchors=[];this.panels=[];this.list=this.element.down("ul");this.list.cleanWhitespace();this.nav=this.list;b.addClassNames(this.nav,"ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.tabs=this.list.select("li");b.addClassNames(this.tabs,"ui-state-default ui-corner-top");b.addBehavior(this.tabs,[b.Behavior.Hover,b.Behavior.Down]);this.element.writeAttribute({role:"tablist","aria-multiselectable":"false"});this.tabs.each(function(g){var d=g.down("a");if(!d){return}var e=d.readAttribute("href");if(!e.include("#")){return}var c=e.split("#").last(),f=$(c);g.writeAttribute("tabIndex","0");if(f){f.store("ui.tab",g);g.store("ui.panel",f);this.anchors.push(d);this.panels.push(f)}},this);this.anchors.invoke("writeAttribute","role","tab");this.panels.invoke("writeAttribute","role","tabpanel");this.tabs.first().addClassName("ui-position-first");this.tabs.last().addClassName("ui-position-last");b.addClassNames(this.panels,"ui-tabs-panel ui-tabs-hide ui-widget-content ui-corner-bottom");this.observers={onKeyPress:this.onKeyPress.bind(this),onTabClick:this.onTabClick.bind(this)};this.addObservers();var m;var a=window.location.hash.substring(1),h;if(!a.empty()){h=$(a)}if(h&&this.panels.include(h)){m=h.retrieve("ui.tab")}else{m=j.selectedTab?$(j.selectedTab):this.tabs.first()}this.setSelectedTab(m)},addObservers:function(){this.anchors.invoke("observe","click",this.observers.onTabClick);this.tabs.invoke("observe","keypress",this.observers.onKeyPress)},_setSelected:function(g){var a=$(g),j=a.retrieve("ui.tab");var h=this.list.down(".ui-tabs-selected");var i=h?h.retrieve("ui.panel"):null;b.removeClassNames(this.tabs,"ui-tabs-selected ui-state-active");b.addClassNames(this.tabs,"ui-state-default");j.removeClassName("ui-state-default").addClassName("ui-tabs-selected ui-state-active");this.element.fire("ui:tabs:change",{from:{tab:h,panel:i},to:{tab:j,panel:a}});this.options.panel.transition(i,a)},setSelectedTab:function(a){this.setSelectedPanel(a.retrieve("ui.panel"))},setSelectedPanel:function(a){this._setSelected(a.readAttribute("id"))},onTabClick:function(e){e.stop();var a=e.findElement("a"),f=e.findElement("li");this.setSelectedTab(f)},onKeyPress:function(f){if(b.modifierUsed(f)){return}var a=f.findElement("li");var e=f.keyCode||f.charCode;switch(e){case Event.KEY_SPACE:case Event.KEY_RETURN:this.setSelectedTab(a);f.stop();return;case Event.KEY_UP:case Event.KEY_LEFT:this._focusTab(a,-1);return;case Event.KEY_DOWN:case Event.KEY_RIGHT:this._focusTab(a,1);return}},_focusTab:function(f,e){if(Object.isNumber(e)){var a=this.tabs.indexOf(f);a=a+e;if(a>(this.tabs.length-1)){a=this.tabs.length-1}else{if(a<0){a=0}}f=this.tabs[a]}(function(){f.focus()}).defer()}});Object.extend(b.Tabs,{DEFAULT_OPTIONS:{panel:{transition:function(d,a){if(d){d.addClassName("ui-tabs-hide")}a.removeClassName("ui-tabs-hide")}}}})})(S2.UI);(function(b){b.Overlay=Class.create(b.Base,b.Mixin.Trackable,b.Mixin.Shim,{NAME:"S2.UI.Overlay",initialize:function(a){this.setOptions(a);this.element=new Element("div",{"class":"ui-widget-overlay"});this.register();this.createShim();this.adjustShim();this.constructor.onResize()},destroy:function(){this.element.remove();this.unregister()},toElement:function(){return this.element}});Object.extend(b.Overlay,{onRegister:function(){if(this.instances.length!==1){return}this._resizeObserver=this._resizeObserver||this.onResize.bind(this);Event.observe(window,"resize",this._resizeObserver);Event.observe(window,"scroll",this._resizeObserver)},onUnregister:function(){if(this.instances.length!==0){return}Event.stopObserving(window,"resize",this._resizeObserver);Event.stopObserving(window,"scroll",this._resizeObserver)},onResize:function(){var a=document.viewport.getDimensions();var d=document.viewport.getScrollOffsets();this.instances.each(function(f){var c=f.element;c.setStyle({width:a.width+"px",height:a.height+"px",left:d.left+"px",top:d.top+"px"})});(function(){this.instances.invoke("adjustShim")}).bind(this).defer()}})})(S2.UI);(function(b){b.Dialog=Class.create(b.Base,{NAME:"S2.UI.Dialog",initialize:function(g,a){if(!Object.isElement(g)){a=g;g=null}else{g=$(g)}var h=this.setOptions(a);this.element=g||new Element("div");b.addClassNames(this.element,"ui-dialog ui-widget ui-widget-content ui-corner-all");this.element.hide().setStyle({position:"absolute",overflow:"hidden",zIndex:h.zIndex,outline:"0"});this.element.writeAttribute({tabIndex:"-1",role:"dialog"});if(h.content){this.content=Object.isElement(h.content)?h.content:new Element("div").update(h.content)}else{this.content=new Element("div")}b.addClassNames(this.content,"ui-dialog-content ui-widget-content");this.element.insert(this.content);this.titleBar=this.options.titleBar||new Element("div");b.addClassNames(this.titleBar,"ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix");this.element.insert({top:this.titleBar});this.closeButton=new Element("a",{href:"#"});b.addClassNames(this.closeButton,"ui-dialog-titlebar-close ui-corner-all");new b.Button(this.closeButton);this.closeButton.observe("mousedown",Event.stop);this.closeButton.observe("click",function(c){c.stop();this.close(false)}.bind(this));this.titleBar.insert(this.closeButton);this.closeText=new Element("span");b.addClassNames(this.closeText,"ui-icon ui-icon-closethick");this.closeButton.insert(this.closeText);this.titleText=new Element("span",{"class":"ui-dialog-title"});this.titleText.update(this.options.title).identify();this.element.writeAttribute("aria-labelledby",this.titleText.readAttribute("id"));this.titleBar.insert({top:this.titleText});b.disableTextSelection(this.element);if(this.options.draggable){b.addBehavior(this.element,b.Behavior.Drag,{handle:this.titleBar})}var f=this.options.buttons;if(f&&f.length){this._createButtons()}this.observers={keypress:this.keypress.bind(this)}},toElement:function(){return this.element},_createButtons:function(){var a=this.options.buttons;if(this.buttonPane){this.buttonPane.remove()}this.buttonPane=new Element("div");b.addClassNames(this.buttonPane,"ui-dialog-buttonpane ui-widget-content ui-helper-clearfix");a.each(function(e){var f=new Element("button",{type:"button"});b.addClassNames(f,"ui-state-default ui-corner-all");if(e.primary){f.addClassName("ui-priority-primary")}if(e.secondary){f.addClassName("ui-priority-secondary")}f.update(e.label);new b.Button(f);f.observe("click",e.action.bind(this,this));this.buttonPane.insert(f)},this);this.element.insert(this.buttonPane)},_position:function(){var i=document.viewport.getDimensions();var j=this.element;var g={width:parseInt(j.getStyle("width"),10),height:parseInt(j.getStyle("height"),10)};var a={left:((i.width/2)-(g.width/2)).round(),top:((i.height/2)-(g.height/2)).round()};var h=document.viewport.getScrollOffsets();a.left+=h.left;a.top+=h.top;this.element.setStyle({left:a.left+"px",top:a.top+"px"})},open:function(){if(this._isOpen){return}var a=this.element.fire("ui:dialog:before:open",{dialog:this});if(a.stopped){return}var m=this.options;this.overlay=m.modal?new b.Overlay():null;$(document.body).insert(this.overlay);$(document.body).insert(this.element);this.element.show();this._position();this.focusables=b.findFocusables(this.element);if(!m.submitForms){var n=this.content.select("form");n.invoke("observe","submit",Event.stop)}var j=this.focusables.without(this.closeButton);var o=m.focus,f=false;if(o==="first"){j.first().focus();f=true}else{if(o==="last"){j.last().focus();f=true}else{if(Object.isElement(o)){o.focus();f=true}else{if(this.buttonPane){var l=this.buttonPane.down(".ui-priority-primary");if(l){l.focus();f=true}}}}}if(!f&&j.length>0){j.first().focus()}Event.observe(window,"keydown",this.observers.keypress);this._isOpen=true;this.element.fire("ui:dialog:after:open",{dialog:this});return this},close:function(f){f=!!f;var a=this.element.fire("ui:dialog:before:close",{dialog:this});if(a.stopped){return}if(this.overlay){this.overlay.destroy()}this.element.hide();this._isOpen=false;Event.stopObserving(window,"keydown",this.observers.keypress);var h={dialog:this,success:f};var g=this.content.down("form");if(g){Object.extend(h,{form:g.serialize({hash:true})})}this.element.fire("ui:dialog:after:close",h);b.enableTextSelection(this.element,true);return this},keypress:function(j){if(b.modifierUsed(j)){return}var i=this.focusables,m=this.options;if(j.keyCode===Event.KEY_ESC){if(m.closeOnEscape){this.close(false)}return}if(j.keyCode===Event.KEY_RETURN){this.close(true);return}if(j.keyCode===Event.KEY_TAB){if(!this.options.modal){return}if(!i){return}var l,f=j.findElement();var a=i.indexOf(f);if(a===-1){l=i.first()}else{if(j.shiftKey){l=a===0?i.last():i[a-1]}else{l=(a===(i.length-1))?i.first():i[a+1]}}if(l){j.stop();(function(){l.focus()}).defer()}}}});Object.extend(b.Dialog,{DEFAULT_OPTIONS:{zIndex:1000,title:"Dialog",content:null,modal:true,focus:"auto",submitForms:false,closeOnEscape:true,draggable:true,resizable:false,buttons:[{label:"OK",primary:true,action:function(a){a.close(true)}}]}})})(S2.UI);(function(b){b.Slider=Class.create(b.Base,{NAME:"S2.UI.Slider",initialize:function(j,m){this.element=$(j);var l=this.setOptions(m);b.addClassNames(this.element,"ui-slider ui-widget ui-widget-content ui-corner-all");this.orientation=l.orientation;this.element.addClassName("ui-slider-"+this.orientation);this._computeTrackLength();var i=l.value.initial;if(!Object.isArray(i)){i=[i]}this.values=i;this.handles=[];this.values.each(function(c,e){var d=new Element("a",{href:"#"});d.store("ui.slider.handle",e);this.handles.push(d);this.element.insert(d)},this);b.addClassNames(this.handles,"ui-slider-handle ui-state-default ui-corner-all");this.handles.invoke("writeAttribute","tabIndex","0");this.activeHandle=this.handles.first();this.handles.invoke("observe","click",Event.stop);b.addBehavior(this.handles,[b.Behavior.Hover,b.Behavior.Focus]);this.observers={focus:this.focus.bind(this),blur:this.blur.bind(this),keydown:this.keydown.bind(this),keyup:this.keyup.bind(this),mousedown:this.mousedown.bind(this),mouseup:this.mouseup.bind(this),mousemove:this.mousemove.bind(this),rangeMouseDown:this.rangeMouseDown.bind(this),rangeMouseMove:this.rangeMouseMove.bind(this),rangeMouseUp:this.rangeMouseUp.bind(this)};var a=l.value;if(a.step!==null){this._possibleValues=[];for(var h=a.min;h<a.max;h+=a.step){this._possibleValues.push(h)}this._possibleValues.push(a.max);this.keyboardStep=a.step}else{if(l.possibleValues){this._possibleValues=l.possibleValues.clone();this.keyboardStep=null}else{this.keyboardStep=(a.max-a.min)/100}}this.range=null;if(l.range&&this.values.length===2){this.restricted=true;this.range=new Element("div",{"class":"ui-slider-range"});this.element.insert(this.range);this.range.addClassName("ui-widget-header")}this._computeTrackLength();this._computeHandleLength();this.active=false;this.dragging=false;this.disabled=false;this.addObservers();this.values.each(this.setValue,this);this.initialized=true},addObservers:function(){this.element.observe("mousedown",this.observers.mousedown);if(this.range){this.range.observe("mousedown",this.observers.rangeMouseDown)}this.handles.invoke("observe","keydown",this.observers.keydown);this.handles.invoke("observe","keyup",this.observers.keyup)},_computeTrackLength:function(){var a,d;if(this.orientation==="vertical"){d=this.element.offsetHeight;a=(d!==0)?d:window.parseInt(this.element.getStyle("height"),10)}else{d=this.element.offsetWidth;a=(d!==0)?d:window.parseInt(this.element.getStyle("width"),10)}this._trackLength=a;return a},_computeHandleLength:function(){var f=this.handles.first(),a,e;if(!f){return}if(this.orientation==="vertical"){e=f.offsetHeight;a=(e!==0)?e:window.parseInt(f.getStyle("height"),10)}else{e=f.offsetWidth;a=(e!==0)?e:window.parseInt(f.getStyle("width"),10)}this._handleLength=a;return a},_nextValue:function(f,e){if(this.options.possibleValues){var a=this._possibleValues.indexOf(f);return this._possibleValues[a+e]}else{return f+(this.keyboardStep*e)}},keydown:function(v){if(this.options.disabled){return}var o=v.findElement();var n=o.retrieve("ui.slider.handle");var u=true,r=this.options;if(!Object.isNumber(n)){return}var a=[Event.KEY_HOME,Event.KEY_END,Event.KEY_UP,Event.KEY_DOWN,Event.KEY_LEFT,Event.KEY_RIGHT];if(!a.include(v.keyCode)){return}o.addClassName("ui-state-active");var m,s,p=this.keyboardStep;m=s=this.values[n];switch(v.keyCode){case Event.KEY_HOME:s=r.value.min;break;case Event.KEY_END:s=r.value.max;break;case Event.KEY_UP:case Event.KEY_RIGHT:if(m===r.value.max){return}s=this._nextValue(m,1);break;case Event.KEY_DOWN:case Event.KEY_LEFT:if(m===r.value.min){return}s=this._nextValue(m,-1);break}this.dragging=true;this.setValue(s,n);if(!Prototype.Browser.WebKit){var q=this._timer?0.1:1;this._timer=arguments.callee.bind(this).delay(q,v)}if(!u){v.stop()}},keyup:function(a){this.dragging=false;if(this._timer){window.clearTimeout(this._timer);this._timer=null}this._updateFinished();var d=a.findElement();d.removeClassName("ui-state-active")},setValue:function(h,f){if(!this.activeHandle){this.activeHandle=this.handles[f||0];this._updateStyles()}f=f||this.activeHandle.retrieve("ui.slider.handle")||0;if(this.initialized&&this.restricted){if(f>0&&h<this.values[f-1]){h=this.values[f-1]}if(f<(this.handles.length-1)&&(h>this.values[f+1])){h=this.values[f+1]}}h=this._getNearestValue(h);this.values[f]=h;var g=(this.orientation==="vertical")?"top":"left";var a={};a[g]=this._valueToPx(h)+"px";this.handles[f].setStyle(a);this._drawRange();if(!this.dragging&&!this.undoing&&!this.initialized){this._updateFinished()}if(this.initialized){this.element.fire("ui:slider:value:changing",{slider:this,values:this.values});this.options.onSlide(this.values,this)}return this},_getNearestValue:function(h){var a=this.options.value;if(h<a.min){h=a.min}if(h>a.max){h=a.max}if(this._possibleValues){var g,i;for(var j=0;j<this._possibleValues.length;j++){i=this._possibleValues[j];if(i===h){return h}if(i>h){break}}g=this._possibleValues[j-1];h=h.nearer(g,i)}return h},_valueToPx:function(f){var a=this.options.value;var e=(this._trackLength-(this._handleLength/2))/(a.max-a.min);e*=(f-a.min);if(this.orientation==="vertical"){e=(this._trackLength-e)-this._handleLength}else{}return Math.round(e)},mousedown:function(l){var m=this.options;if(!l.isLeftClick()||m.disabled){return}l.stop();this._oldValues=this.values.clone();this.active=true;var j=l.findElement();var i=l.pointer();if(j===this.element){var o=this.element.cumulativeOffset();var n={x:Math.round((i.x-o.left)+(this._handleLength/4)),y:Math.round((i.y-o.top)+(this._handleLength/4))};this.setValue(this._pxToValue(n));this.activeHandle=this.activeHandle||this.handles.first();handle=this.activeHandle;this._updateStyles()}else{handle=l.findElement(".ui-slider-handle");if(!handle){return}this.activeHandle=handle;this._updateStyles()}var a=handle.cumulativeOffset();this._offsets={x:i.x-a.left,y:i.y-a.top};document.observe("mousemove",this.observers.mousemove);document.observe("mouseup",this.observers.mouseup)},mouseup:function(a){if(this.active&&this.dragging){this._updateFinished();a.stop()}this.active=this.dragging=false;this.activeHandle=null;this._updateStyles();document.stopObserving("mousemove",this.observers.mousemove);document.stopObserving("mouseup",this.observers.mouseup)},mousemove:function(a){if(!this.active){return}a.stop();this.dragging=true;this._draw(a);if(Prototype.Browser.WebKit){window.scrollBy(0,0)}},rangeMouseDown:function(g){var f=g.pointer();var a=this.element.cumulativeOffset();var h={x:Math.round(f.x-a.left),y:Math.round(f.y-a.top)};this._rangeInitialValues=this.values.clone();this._rangePseudoValue=this._pxToValue(h);document.observe("mousemove",this.observers.rangeMouseMove);document.observe("mouseup",this.observers.rangeMouseUp)},rangeMouseMove:function(m){this.dragging=true;m.stop();var o=this.options;var j=m.pointer();var q=this.element.cumulativeOffset();var p={x:Math.round(j.x-q.left),y:Math.round(j.y-q.top)};var l=this._pxToValue(p);var n=l-this._rangePseudoValue;var a=this._rangeInitialValues.map(function(c){return c+n});if(a[0]<o.value.min){n=o.value.min-this._rangeInitialValues[0];a=this._rangeInitialValues.map(function(c){return c+n})}else{if(a[1]>o.value.max){n=o.value.max-this._rangeInitialValues[1];a=this._rangeInitialValues.map(function(c){return c+n})}}a.each(this.setValue,this)},rangeMouseUp:function(a){this.dragging=false;document.stopObserving("mousemove",this.observers.rangeMouseMove);document.stopObserving("mouseup",this.observers.rangeMouseUp);this._updateFinished()},_draw:function(g){var f=g.pointer();var a=this.element.cumulativeOffset();var h={x:Math.round((f.x-a.left)+(this._handleLength/4)),y:Math.round((f.y-a.top)+(this._handleLength/4))};f.x-=(this._offsets.x+a.left);f.y-=(this._offsets.y+a.top);this.setValue(this._pxToValue(f))},_pxToValue:function(h){var a=this.options;var f=(this.orientation==="horizontal")?h.x:h.y;var g=((f/(this._trackLength-this._handleLength)*(a.value.max-a.value.min))+a.value.min);if(this.orientation==="vertical"){g=a.value.max-(g-a.value.min)}return g},undo:function(){if(!this._oldValues){return}this.values=this._oldValues.clone();this.undoing=true;this._oldValues.each(this.setValue,this);this.undoing=false},_updateFinished:function(){var a=this.element.fire("ui:slider:value:changed",{slider:this,values:this.values});if(a.stopped){this.undo();return}this.activeHandle=null;this._updateStyles();this.options.onChange(this.values,this)},_updateStyles:function(){b.removeClassNames(this.handles,"ui-state-active");if(this.activeHandle){this.activeHandle.addClassName("ui-state-active")}},_drawRange:function(){if(!this.range){return}var a=this.values,d=a.map(this._valueToPx,this);if(this.orientation==="vertical"){this.range.setStyle({top:d[1]+"px",height:(d[0]-d[1])+"px"})}else{this.range.setStyle({left:d[0]+"px",width:(d[1]-d[0])+"px"})}},focus:function(a){if(this.options.disabled){return}var d=a.findElement();this.element.select(".ui-state-focus").invoke("removeClassName","ui-state-focus");d.addClassName("ui-state-focus")},blur:function(a){a.findElement().removeClassName("ui-state-focus")}});Object.extend(b.Slider,{DEFAULT_OPTIONS:{range:false,disabled:false,value:{min:0,max:100,initial:0,step:null},possibleValues:null,orientation:"horizontal",onSlide:Prototype.emptyFunction,onChange:Prototype.emptyFunction}})})(S2.UI);(function(b){b.ProgressBar=Class.create(b.Base,{NAME:"S2.UI.ProgressBar",initialize:function(e,a){this.element=$(e);var f=this.setOptions(a);b.addClassNames(this.element,"ui-progressbar ui-widget ui-widget-content ui-corner-all");this.element.writeAttribute({role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":0});this.valueElement=new Element("div",{"class":"ui-progressbar-value ui-widget-header ui-corner-left"});this.value=f.value.initial;this._refreshValue();this.element.insert(this.valueElement);this.element.store(this.NAME,this)},destroy:function(){b.removeClassNames(this.element,"ui-progressbar ui-widget ui-widget-content ui-corner-all");b.removeAttributes(this.element,"role aria-valuemin aria-valuemax aria-valuenow");this.element.getData().unset(this.NAME)},getValue:function(){var d=this.value,a=this.options.value;if(d<a.min){d=a.min}if(d>a.max){d=a.max}return d},setValue:function(a){this._oldValue=this.getValue();this.value=a;this._refreshValue();return this},undo:function(){this.undoing=true;this.setValue(this._oldValue);this.undoing=false;return this},_refreshValue:function(){var g=this.getValue();if(!this.undoing){var a=this.element.fire("ui:progressbar:value:changed",{progressBar:this,value:g});if(a.stopped){this.undo();return}}if(g===this.options.value.max){this.valueElement.addClassName("ui-corner-right")}else{this.valueElement.removeClassName("ui-corner-right")}var i=window.parseInt(this.element.getStyle("width"),10);var h=(i*g)/100;var j="width: #{0}px".interpolate([h]);b.makeVisible(this.valueElement,(g>this.options.value.min));this.valueElement.morph(j,{duration:0.7,transition:"linear"});this.element.writeAttribute("aria-valuenow",g)}});Object.extend(b.ProgressBar,{DEFAULT_OPTIONS:{value:{min:0,max:100,initial:0}}})})(S2.UI);(function(b){b.Menu=Class.create(b.Base,b.Mixin.Shim,{NAME:"S2.UI.Menu",initialize:function(e,a){this.element=$(e);if(!this.element){var a=e;this.element=new Element("ul",{"class":"ui-helper-hidden"})}this.activeId=this.element.identify()+"_active";var f=this.setOptions();b.addClassNames(this.element,"ui-widget ui-widget-content ui-menu ui-corner-"+f.corner);this.choices=this.element.select("li");this._highlightedIndex=-1;this.element.writeAttribute({role:"menu","aria-activedescendant":this.activeId});this.choices.invoke("writeAttribute","role","menuitem");this.observers={mouseover:this._mouseover.bind(this),click:this._click.bind(this)};this.addObservers();this._shown=false;this.createShim()},addObservers:function(){this.element.observe("mouseover",this.observers.mouseover);this.element.observe("mousedown",this.observers.click)},removeObservers:function(){this.element.stopObserving("mouseover",this.observers.mouseover);this.element.stopObserving("mousedown",this.observers.click)},clear:function(){this.element.select("li").invoke("remove");this.choices=[];return this},addChoice:function(d){var a;if(Object.isElement(d)){if(d.tagName.toUpperCase()==="LI"){a=d}else{a=new Element("li");a.insert(d)}}else{a=new Element("li");a.update(d)}a.addClassName("ui-menu-item");a.writeAttribute("role","menuitem");this.element.insert(a);this.choices=this.element.select("li");return a},_mouseover:function(d){var a=d.findElement("li");if(!a){return}this.highlightChoice(a)},_click:function(d){var a=d.findElement("li");if(!a){return}this.selectChoice(a)},moveHighlight:function(a){this._highlightedIndex=(this._highlightedIndex+a).constrain(-1,this.choices.length-1);this.highlightChoice();return this},highlightChoice:function(h){var f=this.choices,a;if(Object.isElement(h)){a=f.indexOf(h)}else{if(Object.isNumber(h)){a=h}else{a=this._highlightedIndex}}b.removeClassNames(this.choices,"ui-state-active");if(a===-1){return}this.choices[a].addClassName("ui-state-active");this._highlightedIndex=a;var g=this.element.down("#"+this.activeId);if(g){g.writeAttribute("id","")}this.choices[a].writeAttribute("id",this.activeId)},selectChoice:function(d){var d;if(Object.isNumber(d)){d=this.choices[d]}else{if(!d){d=this.choices[this._highlightedIndex]}}var a=this.element.fire("ui:menu:selected",{instance:this,element:d});if(!a.stopped){this.close()}return this},open:function(){var a=this.element.fire("ui:menu:opened",{instance:this});this.element.removeClassName("ui-helper-hidden");this._highlightedIndex=-1;if(Prototype.Browser.IE){this.adjustShim()}},close:function(){var a=this.element.fire("ui:menu:closed",{instance:this});this.element.addClassName("ui-helper-hidden");return this},isOpen:function(){return !this.element.hasClassName("ui-helper-hidden")}});Object.extend(b.Menu,{DEFAULT_OPTIONS:{corner:"all"}})})(S2.UI);(function(b){b.Autocompleter=Class.create(b.Base,{NAME:"S2.UI.Autocompleter",initialize:function(e,a){this.element=$(e);var f=this.setOptions(a);b.addClassNames(this.element,"ui-widget ui-autocompleter");this.input=this.element.down('input[type="text"]');if(!this.input){this.input=new Element("input",{type:"text"});this.element.insert(this.input)}this.input.insert({before:this.button});this.input.setAttribute("autocomplete","off");this.name=f.parameterName||this.input.readAttribute("name");if(f.choices){this.choices=f.choices.clone()}this.menu=new b.Menu();this.element.insert(this.menu.element);(function(){var c=this.input.getLayout();this.menu.element.setStyle({left:c.get("left")+"px",top:(c.get("top")+c.get("margin-box-height"))+"px"})}).bind(this).defer();this.observers={blur:this._blur.bind(this),keyup:this._keyup.bind(this),keydown:this._keydown.bind(this),selected:this._selected.bind(this)};this.addObservers()},addObservers:function(){this.input.observe("blur",this.observers.blur);this.input.observe("keyup",this.observers.keyup);this.input.observe("keydown",this.observers.keydown);this.menu.element.observe("ui:menu:selected",this.observers.selected)},_schedule:function(){this._unschedule();this._timeout=this._change.bind(this).delay(this.options.frequency)},_unschedule:function(){if(this._timeout){window.clearTimeout(this._timeout)}},_keyup:function(a){var d=this.input.getValue();if(d){if(d.blank()||d.length<this.options.minCharacters){this.menu.close();this._unschedule();return}if(d!==this._value){this._schedule()}}else{this.menu.close();this._unschedule()}this._value=d},_keydown:function(a){if(b.modifierUsed(a)){return}if(!this.menu.isOpen()){return}var d=a.keyCode||a.charCode;switch(a.keyCode){case Event.KEY_UP:this.menu.moveHighlight(-1);a.stop();break;case Event.KEY_DOWN:this.menu.moveHighlight(1);a.stop();break;case Event.KEY_TAB:this.menu.selectChoice();break;case Event.KEY_RETURN:this.menu.selectChoice();this.input.blur();a.stop();break;case Event.KEY_ESC:this.input.setValue("");this.input.blur();break}},_getInput:function(){return this.input.getValue()},_setInput:function(a){this.input.setValue(a)},_change:function(){this.findChoices()},findChoices:function(){var f=this._getInput();var e=this.choices||[];var a=e.inject([],function(c,d){if(d.toLowerCase().include(f.toLowerCase())){c.push(d)}return c});this.setChoices(a)},setChoices:function(a){this.results=a;this._updateMenu(a)},_updateMenu:function(l){var m=this.options;this.menu.clear();var j=new RegExp(RegExp.escape(this._value),"i");for(var n=0,o,a,i;o=l[n];n++){i=m.highlightSubstring?o.replace(j,"<b>$&</b>"):i;a=new Element("li").update(i);a.store("ui.autocompleter.value",o);this.menu.addChoice(a)}if(l.length===0){this.menu.close()}else{this.menu.open()}},_moveMenuChoice:function(d){var a=this.list.down("li");this._selectedIndex=(this._selectedIndex+d).constrain(-1,this.results.length-1);this._highlightMenuChoice()},_highlightMenuChoice:function(f){var e=this.list.select("li"),a;if(Object.isElement(f)){a=e.indexOf(f)}else{if(Object.isNumber(f)){a=f}else{a=this._selectedIndex}}b.removeClassNames(e,"ui-state-active");if(a===-1||a===null){return}e[a].addClassName("ui-state-active");this._selectedIndex=a},_selected:function(e){var f=e.memo,a=f.element;if(a){this._setInput(a.retrieve("ui.autocompleter.value"))}this.menu.close()},_blur:function(a){this._unschedule();this.menu.close()}});Object.extend(b.Autocompleter,{DEFAULT_OPTIONS:{tokens:[],frequency:0.4,minCharacters:1,highlightSubstring:true,onShow:Prototype.K,onHide:Prototype.K}})})(S2.UI);document.observe("dom:loaded",function(){if(!S2.enableMultitouchSupport){return}var n=$(document.body),m=0;function p(a){a._rotation=a._rotation||0;a._scale=a._scale||1;a._panX=a._panX||0;a._panY=a._panY||0;a._pans=[[0,0],[0,0],[0,0]];a._panidx=1}function r(g,c,f,d,a){g._rotation=c;g._scale=f;g._panX=d;g._panY=a}function e(a,c){a.fire("manipulate:update",Object.extend(c,{id:m}))}function o(){var g,j,i,d={},F=null,c=null,A=0,E,a,f,h,B,l;function C(v){var w=v.length;while(w--){d[v[w].identifier]=v[w]}var u=[];for(k in d){u.push(k)}u=u.sort();F=u.length>0?u[0]:null;g=F?d[F].target:null;if(g&&g.nodeType==3){g=g.parentNode}c=u.length>1?u[1]:null;if(A==0&&(F&&c)){f=(d[F].pageX-d[c].pageX).abs();h=(d[F].pageY-d[c].pageY).abs();if(g){p(g)}B=Math.sqrt(f*f+h*h);l=Math.atan2(d[c].pageY-d[F].pageY,d[c].pageX-d[F].pageX);A=1;return}if(A==1&&!(F&&c)){if(g){r(g,j,i)}A=0}}function D(){var u=0;for(k in d){u++}return u}n.observe("touchstart",function(w){var u=F,v;C(w.changedTouches);if(u==null&&F){v=g.viewportOffset();E=v.left+(d[F].pageX-v.left),a=v.top+(d[F].pageY-v.top)}w.stop()});n.observe("touchmove",function(y){C(y.changedTouches);if(F&&!c){e(g,{panX:(g._panX||0)+d[F].pageX-E,panY:(g._panY||0)+d[F].pageY-a,scale:g._scale,rotation:g._rotation});y.stop();return}if(!(F&&c)){return}var z=d[c].pageX-d[F].pageX,u=d[c].pageY-d[F].pageY,v=(g._panX||0)+d[c].pageX-z/2-E,x=(g._panY||0)+d[c].pageY-u/2-a,w=Math.sqrt(z*z+u*u);i=g._scale*w/B;j=g._rotation+Math.atan2(u,z)-l;e(g,{rotation:j,scale:i,panX:v,panY:x});y.stop()});["touchcancel","touchend"].each(function(u){n.observe(u,function(v){var w=v.changedTouches.length;while(w--){delete (d[v.changedTouches[w].identifier])}C([]);if(g){r(g,j,i)}})})}function b(){var h,c,f,d,a,g=false;n.observe("manipulatestart",function(i){i.stop();h=i.element();p(h);g=true});n.observe("manipulatemove",function(i){h=i.element();c=h._rotation+i.rotation;f=h._scale*i.scale;d=h._panX+i.panX;a=h._panY+i.panY;e(h,{rotation:c,scale:f,panX:d,panY:a,clientX:i.clientX,clientY:i.clientY});i.stop()},false);n.observe("manipulateend",function(j){h=j.element();if(h){r(h,c,f,d,a)}g=false;var i=Math.sqrt(j.panSpeedX*j.panSpeedX+j.panSpeedY*j.panSpeedY);if(i>25){h.fire("manipulate:flick",{speed:i,direction:Math.atan2(j.panSpeedY,j.panSpeedX)})}});n.observe("mousemove",function(i){i.stop()});n.observe("mousedown",function(i){i.stop()});n.observe("mouseup",function(i){i.stop()})}function s(){var h,i,f=false,d=true,c,F,D,B,E,a,j,g,A;function l(w){var v=c.viewportOffset(),x=(w.pageX-v.left)-h,u=(w.pageY-v.top)-i;A=Math.sqrt(x*x+u*u);g=c._scale*A/D;j=c._rotation+Math.atan2(u,x)-B;return{rotation:j,scale:g,panX:c._panX,panY:c._panY}}function C(u){return{rotation:c._rotation,scale:c._scale,panX:c._panX+u.pageX-E,panY:c._panY+u.pageY-a}}n.observe("mousedown",function(w){F=w.shiftKey?"scale":"pan";c=w.element();if(!(c&&c.fire)){return}m++;f=true;p(c);var v=c.viewportOffset();h=c.offsetWidth/2;i=c.offsetHeight/2;var x=w.pageX-v.left-h,u=w.pageY-v.top-i;D=Math.sqrt(x*x+u*u);B=Math.atan2(u,x);E=v.left+(w.pageX-v.left),a=v.top+(w.pageY-v.top);w.stop()});n.observe("mousemove",function(u){if(!f){return}e(c,F=="scale"?l(u):C(u))});n.observe("mouseup",function(u){if(!f){return}f=false;if(F=="scale"){var v=l(u);e(c,v);c._rotation=v.rotation;c._scale=v.scale}else{e(c,C(u));c._panX=c._panX+u.pageX-E;c._panY=c._panY+u.pageY-a}});n.observe("dragstart",function(u){u.stop()})}if(navigator.userAgent.match(/SLBrowser/)){return b()}if(navigator.userAgent.match(/QtLauncher/)){return b()}if(navigator.userAgent.match(/Starlight/)){return b()}try{document.createEvent("ManipulateEvent");return b()}catch(q){}try{document.createEvent("TouchEvent");return o()}catch(q){}return s()});Element.__scrollTo=Element.scrollTo;Element.addMethods({scrollTo:function(d,f,e){if(arguments.length==1){return Element.__scrollTo(d)}new S2.FX.Scroll(d,Object.extend(e||{},{to:f})).play();return d}});Element.addMethods({effect:function(d,f,e){if(Object.isFunction(f)){f=new f(d,e)}else{if(Object.isString(f)){f=new S2.FX[f.capitalize()](d,e)}}f.play(d,e);return d},morph:function(d,f,e){e=S2.FX.parseOptions(e);if(!e.queue){e.queue=d.retrieve("S2.FX.Queue");if(!e.queue){d.store("S2.FX.Queue",e.queue=new S2.FX.Queue())}}if(!e.position){e.position="end"}return d.effect("morph",Object.extend(e,{style:f}))}.optionize(),appear:function(c,d){return c.effect("morph",Object.extend({before:function(){c.show().setStyle({opacity:0})},style:"opacity:1"},d))},fade:function(c,d){return c.effect("morph",Object.extend({style:"opacity:0",after:c.hide.bind(c)},d))},cloneWithoutIDs:function(d){d=$(d);var c=d.cloneNode(true);c.id="";$(c).select("*[id]").each(function(a){a.id=""});return c}});(function(){var b;if(window.CSSMatrix){b=function(d,a){d.style.transform="scale("+(a.scale||1)+") rotate("+(a.rotation||0)+"rad)";return d}}else{if(window.WebKitCSSMatrix){b=function(d,a){d.style.webkitTransform="scale("+(a.scale||1)+") rotate("+(a.rotation||0)+"rad)";return d}}else{if(Prototype.Browser.Gecko){b=function(d,a){d.style.MozTransform="scale("+(a.scale||1)+") rotate("+(a.rotation||0)+"rad)";return d}}else{if(Prototype.Browser.IE){b=function(j,a){if(!j._oDims){j._oDims=[j.offsetWidth,j.offsetHeight]}var c=Math.cos(a.rotation||0)*1,h=Math.sin(a.rotation||0)*1,i="progid:DXImageTransform.Microsoft.Matrix(sizingMethod='auto expand',M11="+c+",M12="+(-h)+",M21="+h+",M22="+c+")";j.style.filter=i;j.style.marginLeft=(j._oDims[0]-j.offsetWidth)/2+"px";j.style.marginTop=(j._oDims[1]-j.offsetHeight)/2+"px";return j}}else{b=function(a){return a}}}}}Element.addMethods({transform:b})})();S2.viewportOverlay=function(){var d=document.viewport.getDimensions(),c=document.viewport.getScrollOffsets();return new Element("div").setStyle({position:"absolute",left:c.left+"px",top:c.top+"px",width:d.width+"px",height:d.height+"px"})};S2.FX.Helpers={fitIntoRectangle:function(h,l,i,f){var j=h/l,m=i/f;return j<m?[(i-(h*(f/l)))/2,0,h*(f/l),f]:[0,(f-(l*(i/h)))/2,i,l*(i/h)]}};S2.FX.Operators.Zoom=Class.create(S2.FX.Operators.Style,{initialize:function($super,n,o,f){var i=document.viewport.getDimensions(),m=document.viewport.getScrollOffsets(),j=o.getDimensions(),l=S2.FX.Helpers.fitIntoRectangle(j.width,j.height,i.width-(f.borderWidth||0)*2,i.height-(f.borderWidth||0)*2);Object.extend(f,{style:{left:l[0]+(f.borderWidth||0)+m.left+"px",top:l[1]+(f.borderWidth||0)+m.top+"px",width:l[2]+"px",height:l[3]+"px"}});$super(n,o,f)}});S2.FX.Zoom=Class.create(S2.FX.Element,{setup:function(){this.clone=this.element.cloneWithoutIDs();this.element.insert({before:this.clone});this.clone.absolutize().setStyle({zIndex:9999});this.overlay=S2.viewportOverlay();if(this.options.overlayClassName){this.overlay.addClassName(this.options.overlayClassName)}else{this.overlay.setStyle({backgroundColor:"#000",opacity:"0.9"})}$$("body")[0].insert(this.overlay);this.animate("zoom",this.clone,{borderWidth:this.options.borderWidth,propertyTransitions:this.options.propertyTransitions||{}})},teardown:function(){this.clone.observe("click",function(){this.overlay.remove();this.clone.morph("opacity:0",{duration:0.2,after:function(){this.clone.remove()}.bind(this)})}.bind(this))}});
