var Prototype={Version:"1.6.1",Browser:function(){var a=navigator.userAgent,b=Object.prototype.toString.call(window.opera)=="[object Opera]";return {IE:!!window.attachEvent&&!b,Opera:b,WebKit:a.indexOf("AppleWebKit/")>-1,Gecko:a.indexOf("Gecko")>-1&&a.indexOf("KHTML")===-1,MobileSafari:/Apple.*Mobile.*Safari/.test(a)}}(),BrowserFeatures:{XPath:!!document.evaluate,SelectorsAPI:!!document.querySelector,ElementExtensions:function(){var a=window.Element||window.HTMLElement;return !!(a&&a.prototype)}(),SpecificElementExtensions:function(){if(typeof window.HTMLDivElement!=="undefined")return true;var a=document.createElement("div"),c=document.createElement("form"),b=false;if(a["__proto__"]&&a["__proto__"]!==c["__proto__"])b=true;a=c=null;return b}()},ScriptFragment:"<script[^>]*>([\\S\\s]*?)</sc"+"ript>",JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(a){return a}};if(Prototype.Browser.MobileSafari)Prototype.BrowserFeatures.SpecificElementExtensions=false;var Abstract={},Try={these:function(){for(var b,a=0,d=arguments.length;a<d;a++){var c=arguments[a];try{b=c();break}catch(e){}}return b}},Class=function(){function a(){}function c(){var c=null,d=$A(arguments);if(Object.isFunction(d[0]))c=d.shift();function b(){this.initialize.apply(this,arguments)}Object.extend(b,Class.Methods);b.superclass=c;b.subclasses=[];if(c){a.prototype=c.prototype;b.prototype=new a;c.subclasses.push(b)}for(var e=0;e<d.length;e++)b.addMethods(d[e]);if(!b.prototype.initialize)b.prototype.initialize=Prototype.emptyFunction;b.prototype.constructor=b;return b}function b(d){var g=this.superclass&&this.superclass.prototype,c=Object.keys(d);if(!Object.keys({toString:true}).length){d.toString!=Object.prototype.toString&&c.push("toString");d.valueOf!=Object.prototype.valueOf&&c.push("valueOf")}for(var f=0,h=c.length;f<h;f++){var e=c[f],a=d[e];if(g&&Object.isFunction(a)&&a.argumentNames().first()=="$super"){var b=a;a=function(a){return function(){return g[a].apply(this,arguments)}}(e).wrap(b);a.valueOf=b.valueOf.bind(b);a.toString=b.toString.bind(b)}this.prototype[e]=a}return this}return {create:c,Methods:{addMethods:b}}}();(function(){var b=Object.prototype.toString;function c(a,c){for(var b in c)a[b]=c[b];return a}function j(b){try{if(a(b))return "undefined";if(b===null)return "null";return b.inspect?b.inspect():String(b)}catch(c){if(c instanceof RangeError)return "...";throw c}}function e(b){var h=typeof b;switch(h){case "undefined":case "function":case "unknown":return;case "boolean":return b.toString()}if(b===null)return "null";if(b.toJSON)return b.toJSON();if(d(b))return;var f=[];for(var c in b){var g=e(b[c]);!a(g)&&f.push(c.toJSON()+": "+g)}return "{"+f.join(", ")+"}"}function f(a){return $H(a).toQueryString()}function m(a){return a&&a.toHTML?a.toHTML():String.interpret(a)}function p(c){var a=[];for(var b in c)a.push(b);return a}function n(b){var a=[];for(var c in b)a.push(b[c]);return a}function o(a){return c({},a)}function d(a){return !!(a&&a.nodeType==1)}function k(a){return b.call(a)=="[object Array]"}function l(a){return a instanceof Hash}function g(a){return typeof a==="function"}function i(a){return b.call(a)=="[object String]"}function h(a){return b.call(a)=="[object Number]"}function a(a){return typeof a==="undefined"}c(Object,{extend:c,inspect:j,toJSON:e,toQueryString:f,toHTML:m,keys:p,values:n,clone:o,isElement:d,isArray:k,isHash:l,isFunction:g,isString:i,isNumber:h,isUndefined:a})})();Object.extend(Function.prototype,function(){var b=Array.prototype.slice;function a(b,c){var d=b.length,a=c.length;while(a--)b[d+a]=c[a];return b}function c(c,d){c=b.call(c,0);return a(c,d)}function e(){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 j(d){if(arguments.length<2&&Object.isUndefined(arguments[0]))return this;var a=this,e=b.call(arguments,1);return function(){var b=c(e,arguments);return a.apply(d,b)}}function d(d){var c=this,e=b.call(arguments,1);return function(b){var f=a([b||window.event],e);return c.apply(d,f)}}function g(){if(!arguments.length)return this;var a=this,d=b.call(arguments,0);return function(){var b=c(d,arguments);return a.apply(this,b)}}function i(a){var c=this,d=b.call(arguments,1);a=a*1e3;return window.setTimeout(function(){return c.apply(c,d)},a)}function h(){var b=a([.01],arguments);return this.delay.apply(this,b)}function k(c){var b=this;return function(){var d=a([b.bind(this)],arguments);return c.apply(this,d)}}function f(){if(this._methodized)return this._methodized;var b=this;return this._methodized=function(){var c=a([this],arguments);return b.apply(null,c)}}return {argumentNames:e,bind:j,bindAsEventListener:d,curry:g,delay:i,defer:h,wrap:k,methodize:f}}());Date.prototype.toJSON=function(){return '"'+this.getUTCFullYear()+"-"+(this.getUTCMonth()+1).toPaddedString(2)+"-"+this.getUTCDate().toPaddedString(2)+"T"+this.getUTCHours().toPaddedString(2)+":"+this.getUTCMinutes().toPaddedString(2)+":"+this.getUTCSeconds().toPaddedString(2)+'Z"'};RegExp.prototype.match=RegExp.prototype.test;RegExp.escape=function(a){return String(a).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")};var PeriodicalExecuter=Class.create({initialize:function(b,a){this.callback=b;this.frequency=a;this.currentlyExecuting=false;this.registerCallback()},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1e3)},execute:function(){this.callback(this)},stop:function(){if(!this.timer)return;clearInterval(this.timer);this.timer=null},onTimerEvent:function(){if(!this.currentlyExecuting)try{this.currentlyExecuting=true;this.execute();this.currentlyExecuting=false}catch(a){this.currentlyExecuting=false;throw a}}});Object.extend(String,{interpret:function(a){return a==null?"":String(a)},specialChar:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\\":"\\\\"}});Object.extend(String.prototype,function(){function prepareReplacement(a){if(Object.isFunction(a))return a;var b=new Template(a);return function(a){return b.evaluate(a)}}function gsub(c,a){var e="",b=this,d;a=prepareReplacement(a);if(Object.isString(c))c=RegExp.escape(c);if(!(c.length||c.source)){a=a("");return a+b.split("").join(a)+a}while(b.length>0)if(d=b.match(c)){e+=b.slice(0,d.index);e+=String.interpret(a(d));b=b.slice(d.index+d[0].length)}else e+=b,b="";return e}function sub(c,b,a){b=prepareReplacement(b);a=Object.isUndefined(a)?1:a;return this.gsub(c,function(c){if(--a<0)return c[0];return b(c)})}function scan(b,a){this.gsub(b,a);return String(this)}function truncate(b,a){b=b||30;a=Object.isUndefined(a)?"...":a;return this.length>b?this.slice(0,b-a.length)+a: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 a=new RegExp(Prototype.ScriptFragment,"img"),b=new RegExp(Prototype.ScriptFragment,"im");return (this.match(a)||[]).map(function(a){return (a.match(b)||["",""])[1]})}function 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(b){var a=this.strip().match(/([^?#]*)(#.*)?$/);if(!a)return {};return a[1].split(b||"&").inject({},function(a,b){if((b=b.split("="))[0]){var c=decodeURIComponent(b.shift()),d=b.length>1?b.join("="):b[0];if(d!=undefined)d=decodeURIComponent(d);if(c in a){if(!Object.isArray(a[c]))a[c]=[a[c]];a[c].push(d)}else a[c]=d}return a})}function toArray(){return this.split("")}function succ(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)}function times(a){return a<1?"":(new Array(a+1)).join(this)}function camelize(){var a=this.split("-"),d=a.length;if(d==1)return a[0];for(var c=this.charAt(0)=="-"?a[0].charAt(0).toUpperCase()+a[0].substring(1):a[0],b=1;b<d;b++)c+=a[b].charAt(0).toUpperCase()+a[b].substring(1);return c}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(b){var a=this.replace(/[\x00-\x1f\\]/g,function(a){if(a in String.specialChar)return String.specialChar[a];return "\\u00"+a.charCodeAt().toPaddedString(2,16)});if(b)return '"'+a.replace(/"/g,'\\"')+'"';return "'"+a.replace(/'/g,"\\'")+"'"}function toJSON(){return this.inspect(true)}function unfilterJSON(a){return this.replace(a||Prototype.JSONFilter,"$1")}function isJSON(){var a=this;if(a.blank())return false;a=this.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,"");return /^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/.test(a)}function evalJSON(sanitize){var json=this.unfilterJSON();try{if(!sanitize||json.isJSON())return eval("("+json+")")}catch(a){}throw new SyntaxError("Badly formed JSON string: "+this.inspect())}function include(a){return this.indexOf(a)>-1}function startsWith(a){return this.indexOf(a)===0}function endsWith(a){var b=this.length-a.length;return b>=0&&this.lastIndexOf(a)===b}function empty(){return this==""}function blank(){return /^\s*$/.test(this)}function interpolate(b,a){return (new Template(this,a)).evaluate(b)}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(a,b){this.template=a.toString();this.pattern=b||Template.Pattern},evaluate:function(a){if(a&&Object.isFunction(a.toTemplateReplacements))a=a.toTemplateReplacements();return this.template.gsub(this.pattern,function(b){if(a==null)return b[1]+"";var e=b[1]||"";if(e=="\\")return b[2];var d=a,c=b[3],f=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;b=f.exec(c);if(b==null)return e;while(b!=null){var g=b[1].startsWith("[")?b[2].replace(/\\\\]/g,"]"):b[1];d=d[g];if(null==d||""==b[3])break;c=c.substring("["==b[3]?b[1].length:b[0].length);b=f.exec(c)}return e+String.interpret(d)})}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;var $break={},Enumerable=function(){function q(a,b){var c=0;try{this._each(function(d){a.call(b,d,c++)})}catch(d){if(d!=$break)throw d}return this}function i(a,e,f){var c=-a,d=[],b=this.toArray();if(a<1)return b;while((c+=a)<b.length)d.push(b.slice(c,c+a));return d.collect(e,f)}function f(b,c){b=b||Prototype.K;var a=true;this.each(function(e,d){a=a&&!!b.call(c,e,d);if(!a)throw $break});return a}function g(a,c){a=a||Prototype.K;var b=false;this.each(function(e,d){if(b=!!a.call(c,e,d))throw $break});return b}function b(a,c){a=a||Prototype.K;var b=[];this.each(function(e,d){b.push(a.call(c,e,d))});return b}function e(b,c){var a;this.each(function(d,e){if(b.call(c,d,e)){a=d;throw $break}});return a}function a(b,c){var a=[];this.each(function(d,e){b.call(c,d,e)&&a.push(d)});return a}function r(a,b,d){b=b||Prototype.K;var c=[];if(Object.isString(a))a=new RegExp(RegExp.escape(a));this.each(function(e,f){a.match(e)&&c.push(b.call(d,e,f))});return c}function c(a){if(Object.isFunction(this.indexOf))if(this.indexOf(a)!=-1)return true;var b=false;this.each(function(c){if(c==a){b=true;throw $break}});return b}function h(b,a){a=Object.isUndefined(a)?null:a;return this.eachSlice(b,function(c){while(c.length<b)c.push(a);return c})}function l(a,b,c){this.each(function(e,d){a=b.call(c,a,e,d)});return a}function m(a){var b=$A(arguments).slice(1);return this.map(function(c){return c[a].apply(c,b)})}function t(b,c){b=b||Prototype.K;var a;this.each(function(d,e){d=b.call(c,d,e);if(a==null||d>=a)a=d});return a}function u(b,c){b=b||Prototype.K;var a;this.each(function(d,e){d=b.call(c,d,e);if(a==null||d<a)a=d});return a}function j(a,d){a=a||Prototype.K;var c=[],b=[];this.each(function(e,f){(a.call(d,e,f)?c:b).push(e)});return [c,b]}function p(b){var a=[];this.each(function(c){a.push(c[b])});return a}function n(b,c){var a=[];this.each(function(d,e){!b.call(c,d,e)&&a.push(d)});return a}function o(a,b){return this.map(function(c,d){return {value:c,criteria:a.call(b,c,d)}}).sort(function(d,c){var a=d.criteria,b=c.criteria;return a<b?-1:a>b?1:0}).pluck("value")}function d(){return this.map()}function v(){var b=Prototype.K,a=$A(arguments);if(Object.isFunction(a.last()))b=a.pop();var c=[this].concat(a).map($A);return this.map(function(d,a){return b(c.pluck(a))})}function s(){return this.toArray().length}function k(){return "#<Enumerable:"+this.toArray().inspect()+">"}return {each:q,eachSlice:i,all:f,every:f,any:g,some:g,collect:b,map:b,detect:e,findAll:a,select:a,filter:a,grep:r,include:c,member:c,inGroupsOf:h,inject:l,invoke:m,max:t,min:u,partition:j,pluck:p,reject:n,sortBy:o,toArray:d,entries:d,zip:v,size:s,inspect:k,find:e}}();function $A(a){if(!a)return [];if("toArray" in Object(a))return a.toArray();var b=a.length||0,c=new Array(b);while(b--)c[b]=a[b];return c}function $w(a){if(!Object.isString(a))return [];a=a.strip();return a?a.split(/\s+/):[]}Array.from=$A;(function(){var a=Array.prototype,b=a.slice,c=a.forEach;function r(b){for(var a=0,c=this.length;a<c;a++)b(this[a])}if(!c)c=r;function p(){this.length=0;return this}function q(){return this[0]}function s(){return this[this.length-1]}function h(){return this.select(function(a){return a!=null})}function i(){return this.inject([],function(a,b){if(Object.isArray(b))return a.concat(b.flatten());a.push(b);return a})}function m(){var a=b.call(arguments,0);return this.select(function(b){return !a.include(b)})}function l(a){return (a!==false?this:this.toArray())._reverse()}function u(a){return this.inject([],function(b,c,d){(0==d||(a?b.last()!=c:!b.include(c)))&&b.push(c);return b})}function g(a){return this.uniq().findAll(function(b){return a.detect(function(a){return b===a})})}function d(){return b.call(this,0)}function t(){return this.length}function k(){return "["+this.map(Object.inspect).join(", ")+"]"}function o(){var a=[];this.each(function(c){var b=Object.toJSON(c);!Object.isUndefined(b)&&a.push(b)});return "["+a.join(", ")+"]"}function j(c,a){a||(a=0);var b=this.length;if(a<0)a=b+a;for(;a<b;a++)if(this[a]===c)return a;return -1}function f(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 n(){for(var c=b.call(this,0),a,d=0,g=arguments.length;d<g;d++){a=arguments[d];if(Object.isArray(a)&&!("callee" in a))for(var e=0,f=a.length;e<f;e++)c.push(a[e]);else c.push(a)}return c}Object.extend(a,Enumerable);if(!a._reverse)a._reverse=a.reverse;Object.extend(a,{_each:c,clear:p,first:q,last:s,compact:h,flatten:i,without:m,reverse:l,uniq:u,intersect:g,clone:d,toArray:d,size:t,inspect:k,toJSON:o});var e=function(){return [].concat(arguments)[0][0]!==1}(1,2);if(e)a.concat=n;if(!a.indexOf)a.indexOf=j;if(!a.lastIndexOf)a.lastIndexOf=f})();function $H(a){return new Hash(a)}var Hash=Class.create(Enumerable,function(){function d(a){this._object=Object.isHash(a)?a.toObject():Object.clone(a)}function m(d){for(var b in this._object){var c=this._object[b],a=[b,c];a.key=b;a.value=c;d(a)}}function p(b,a){return this._object[b]=a}function o(a){if(this._object[a]!==Object.prototype[a])return this._object[a]}function l(a){var b=this._object[a];delete this._object[a];return b}function b(){return Object.clone(this._object)}function n(){return this.pluck("key")}function h(){return this.pluck("value")}function j(b){var a=this.detect(function(a){return a.value===b});return a&&a.key}function k(a){return this.clone().update(a)}function g(a){return (new Hash(a)).inject(this,function(a,b){a.set(b.key,b.value);return a})}function a(b,a){if(Object.isUndefined(a))return b;return b+"="+encodeURIComponent(String.interpret(a))}function c(){return this.inject([],function(c,d){var e=encodeURIComponent(d.key),b=d.value;if(b&&typeof b=="object"){if(Object.isArray(b))return c.concat(b.map(a.curry(e)))}else c.push(a(e,b));return c}).join("&")}function e(){return "#<Hash:{"+this.map(function(a){return a.map(Object.inspect).join(": ")}).join(", ")+"}>"}function f(){return Object.toJSON(this.toObject())}function i(){return new Hash(this)}return {initialize:d,_each:m,"set":p,"get":o,unset:l,toObject:b,toTemplateReplacements:b,keys:n,values:h,index:j,merge:k,update:g,toQueryString:c,inspect:e,toJSON:f,clone:i}}());Hash.from=$H;Object.extend(Number.prototype,function(){function b(){return this.toPaddedString(2,16)}function h(){return this+1}function f(a,b){$R(0,this,true).each(a,b);return this}function a(b,c){var a=this.toString(c||10);return "0".times(b-a.length)+a}function c(){return isFinite(this)?this.toString():"null"}function i(){return Math.abs(this)}function e(){return Math.round(this)}function g(){return Math.ceil(this)}function d(){return Math.floor(this)}return {toColorPart:b,succ:h,times:f,toPaddedString:a,toJSON:c,abs:i,round:e,ceil:g,floor:d}}());function $R(b,c,a){return new ObjectRange(b,c,a)}var ObjectRange=Class.create(Enumerable,function(){function a(b,c,a){this.start=b;this.end=c;this.exclusive=a}function c(b){var a=this.start;while(this.include(a)){b(a);a=a.succ()}}function b(a){if(a<this.start)return false;if(this.exclusive)return a<this.end;return a<=this.end}return {initialize:a,_each:c,include:b}}()),Ajax={getTransport:function(){return Try.these(function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")})||false},activeRequestCount:0};Ajax.Responders={responders:[],_each:function(a){this.responders._each(a)},register:function(a){!this.include(a)&&this.responders.push(a)},unregister:function(a){this.responders=this.responders.without(a)},dispatch:function(a,c,b,d){this.each(function(e){if(Object.isFunction(e[a]))try{e[a].apply(e,[c,b,d])}catch(f){}})}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++},onComplete:function(){Ajax.activeRequestCount--}});Ajax.Base=Class.create({initialize:function(a){this.options={method:"post",asynchronous:true,contentType:"application/x-www-form-urlencoded",encoding:"UTF-8",parameters:"",evalJSON:true,evalJS:true};Object.extend(this.options,a||{});this.options.method=this.options.method.toLowerCase();if(Object.isString(this.options.parameters))this.options.parameters=this.options.parameters.toQueryParams();else if(Object.isHash(this.options.parameters))this.options.parameters=this.options.parameters.toObject()}});Ajax.Request=Class.create(Ajax.Base,{_complete:false,initialize:function(b,c,a){b(a);this.transport=Ajax.getTransport();this.request(c)},request:function(c){this.url=c;this.method=this.options.method;var a=Object.clone(this.options.parameters);if(!["get","post"].include(this.method)){a["_method"]=this.method;this.method="post"}this.parameters=a;if(a=Object.toQueryString(a))if(this.method=="get")this.url+=(this.url.include("?")?"&":"?")+a;else if(/Konqueror|Safari|KHTML/.test(navigator.userAgent))a+="&_=";try{var b=new Ajax.Response(this);this.options.onCreate&&this.options.onCreate(b);Ajax.Responders.dispatch("onCreate",this,b);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);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||a:null;this.transport.send(this.body);!this.options.asynchronous&&this.transport.overrideMimeType&&this.onStateChange()}catch(d){this.dispatchException(d)}},onStateChange:function(){var a=this.transport.readyState;a>1&&!(a==4&&this._complete)&&this.respondToReadyState(this.transport.readyState)},setRequestHeaders:function(){var a={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,Accept:"text/javascript, text/html, application/xml, text/xml, */*"};if(this.method=="post"){a["Content-type"]=this.options.contentType+(this.options.encoding?"; charset="+this.options.encoding:"");if(this.transport.overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005)a["Connection"]="close"}if(typeof this.options.requestHeaders=="object"){var b=this.options.requestHeaders;if(Object.isFunction(b.push))for(var c=0,e=b.length;c<e;c+=2)a[b[c]]=b[c+1];else $H(b).each(function(b){a[b.key]=b.value})}for(var d in a)this.transport.setRequestHeader(d,a[d])},success:function(){var a=this.getStatus();return !a||a>=200&&a<300},getStatus:function(){try{return this.transport.status||0}catch(a){return 0}},respondToReadyState:function(d){var b=Ajax.Request.Events[d],a=new Ajax.Response(this);if(b=="Complete"){try{this._complete=true;(this.options["on"+a.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(a,a.headerJSON)}catch(e){this.dispatchException(e)}var c=a.getHeader("Content-type");(this.options.evalJS=="force"||this.options.evalJS&&this.isSameOrigin()&&c&&c.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))&&this.evalResponse()}try{(this.options["on"+b]||Prototype.emptyFunction)(a,a.headerJSON);Ajax.Responders.dispatch("on"+b,this,a,a.headerJSON)}catch(e){this.dispatchException(e)}if(b=="Complete")this.transport.onreadystatechange=Prototype.emptyFunction},isSameOrigin:function(){var a=this.url.match(/^\s*https?:\/\/[^\/]*/);return !a||a[0]=="#{protocol}//#{domain}#{port}".interpolate({protocol:location.protocol,domain:document.domain,port:location.port?":"+location.port:""})},getHeader:function(a){try{return this.transport.getResponseHeader(a)||null}catch(b){return null}},evalResponse:function(){try{return eval((this.transport.responseText||"").unfilterJSON())}catch(a){this.dispatchException(a)}},dispatchException:function(a){(this.options.onException||Prototype.emptyFunction)(this,a);Ajax.Responders.dispatch("onException",this,a)}});Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];Ajax.Response=Class.create({initialize:function(c){this.request=c;var b=this.transport=c.transport,a=this.readyState=b.readyState;if(a>2&&!Prototype.Browser.IE||a==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(b.responseText);this.headerJSON=this._getHeaderJSON()}if(a==4){var d=b.responseXML;this.responseXML=Object.isUndefined(d)?null:d;this.responseJSON=this._getResponseJSON()}},status:0,statusText:"",getStatus:Ajax.Request.prototype.getStatus,getStatusText:function(){try{return this.transport.statusText||""}catch(a){return ""}},getHeader:Ajax.Request.prototype.getHeader,getAllHeaders:function(){try{return this.getAllResponseHeaders()}catch(a){return null}},getResponseHeader:function(a){return this.transport.getResponseHeader(a)},getAllResponseHeaders:function(){return this.transport.getAllResponseHeaders()},_getHeaderJSON:function(){var a=this.getHeader("X-JSON");if(!a)return null;a=decodeURIComponent(escape(a));try{return a.evalJSON(this.request.options.sanitizeJSON||!this.request.isSameOrigin())}catch(b){this.request.dispatchException(b)}},_getResponseJSON:function(){var a=this.request.options;if(!a.evalJSON||a.evalJSON!="force"&&!(this.getHeader("Content-type")||"").include("application/json")||this.responseText.blank())return null;try{return this.responseText.evalJSON(a.sanitizeJSON||!this.request.isSameOrigin())}catch(b){this.request.dispatchException(b)}}});Ajax.Updater=Class.create(Ajax.Request,{initialize:function(d,a,e,b){this.container={success:a.success||a,failure:a.failure||(a.success?null:a)};b=Object.clone(b);var c=b.onComplete;b.onComplete=function(a,b){this.updateContent(a.responseText);Object.isFunction(c)&&c(a,b)}.bind(this);d(e,b)},updateContent:function(a){var b=this.container[this.success()?"success":"failure"],c=this.options;if(!c.evalScripts)a=a.stripScripts();if(b=$(b))if(c.insertion)if(Object.isString(c.insertion)){var d={};d[c.insertion]=a;b.insert(d)}else c.insertion(b,a);else b.update(a)}});Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function(c,a,d,b){c(b);this.onComplete=this.options.onComplete;this.frequency=this.options.frequency||2;this.decay=this.options.decay||1;this.updater={};this.container=a;this.url=d;this.start()},start:function(){this.options.onComplete=this.updateComplete.bind(this);this.onTimerEvent()},stop:function(){this.updater.options.onComplete=undefined;clearTimeout(this.timer);(this.onComplete||Prototype.emptyFunction).apply(this,arguments)},updateComplete:function(a){if(this.options.decay){this.decay=a.responseText==this.lastText?this.decay*this.options.decay:1;this.lastText=a.responseText}this.timer=this.onTimerEvent.bind(this).delay(this.decay*this.frequency)},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options)}});function $(a){if(arguments.length>1){for(var b=0,c=[],d=arguments.length;b<d;b++)c.push($(arguments[b]));return c}if(Object.isString(a))a=document.getElementById(a);return Element.extend(a)}if(Prototype.BrowserFeatures.XPath)document._getElementsByXPath=function(e,d){for(var b=[],c=document.evaluate(e,$(d)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null),a=0,f=c.snapshotLength;a<f;a++)b.push(Element.extend(c.snapshotItem(a)));return b};if(!window.Node)var Node={};!Node.ELEMENT_NODE&&Object.extend(Node,{ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12});(function(a){var c=function(){var a=document.createElement("form"),b=document.createElement("input"),c=document.documentElement;b.setAttribute("name","test");a.appendChild(b);c.appendChild(a);var d=a.elements?typeof a.elements.test=="undefined":null;c.removeChild(a);a=b=null;return d}(),b=a.Element;a.Element=function(a,b){b=b||{};a=a.toLowerCase();var d=Element.cache;if(c&&b.name){a="<"+a+' name="'+b.name+'">';delete b.name;return Element.writeAttribute(document.createElement(a),b)}if(!d[a])d[a]=Element.extend(document.createElement(a));return Element.writeAttribute(d[a].cloneNode(false),b)};Object.extend(a.Element,b||{});if(b)a.Element.prototype=b.prototype})(this);Element.cache={};Element.idCounter=1;Element.Methods={visible:function(a){return $(a).style.display!="none"},toggle:function(a){a=$(a);Element[Element.visible(a)?"hide":"show"](a);return a},hide:function(a){a=$(a);a.style.display="none";return a},show:function(a){a=$(a);a.style.display="";return a},remove:function(a){a=$(a);a.parentNode.removeChild(a);return a},update:function(){var b=function(){var a=document.createElement("select"),b=true;a.innerHTML='<option value="test">test</option>';if(a.options&&a.options[0])b=a.options[0].nodeName.toUpperCase()!=="OPTION";a=null;return b}(),c=function(){try{var a=document.createElement("table");if(a&&a.tBodies){a.innerHTML="<tbody><tr><td>test</td></tr></tbody>";var b=typeof a.tBodies[0]=="undefined";a=null;return b}}catch(c){return true}}(),a=function(){var a=document.createElement("script"),b=false;try{a.appendChild(document.createTextNode(""));b=!a.firstChild||a.firstChild&&a.firstChild.nodeType!==3}catch(c){b=true}a=null;return b}();function d(e,d){e=$(e);if(d&&d.toElement)d=d.toElement();if(Object.isElement(d))return e.update().insert(d);d=Object.toHTML(d);var f=e.tagName.toUpperCase();if(f==="SCRIPT"&&a){e.text=d;return e}if(b||c)if(f in Element._insertionTranslations.tags){while(e.firstChild)e.removeChild(e.firstChild);Element._getContentFromAnonymousElement(f,d.stripScripts()).each(function(a){e.appendChild(a)})}else e.innerHTML=d.stripScripts();else e.innerHTML=d.stripScripts();d.evalScripts.bind(d).defer();return e}return d}(),replace:function(b,a){b=$(b);if(a&&a.toElement)a=a.toElement();else if(!Object.isElement(a)){a=Object.toHTML(a);var c=b.ownerDocument.createRange();c.selectNode(b);a.evalScripts.bind(a).defer();a=c.createContextualFragment(a.stripScripts())}b.parentNode.replaceChild(a,b);return b},insert:function(d,b){d=$(d);if(Object.isString(b)||Object.isNumber(b)||Object.isElement(b)||b&&(b.toElement||b.toHTML))b={bottom:b};var a,f,g,e;for(var c in b){a=b[c];c=c.toLowerCase();f=Element._insertionTranslations[c];if(a&&a.toElement)a=a.toElement();if(Object.isElement(a)){f(d,a);continue}a=Object.toHTML(a);g=(c=="before"||c=="after"?d.parentNode:d).tagName.toUpperCase();e=Element._getContentFromAnonymousElement(g,a.stripScripts());(c=="top"||c=="after")&&e.reverse();e.each(f.curry(d));a.evalScripts.bind(a).defer()}return d},wrap:function(b,a,c){b=$(b);if(Object.isElement(a))$(a).writeAttribute(c||{});else if(Object.isString(a))a=new Element(a,c);else a=new Element("div",a);b.parentNode&&b.parentNode.replaceChild(a,b);a.appendChild(b);return a},inspect:function(a){a=$(a);var b="<"+a.tagName.toLowerCase();$H({id:"id",className:"class"}).each(function(d){var f=d.first(),e=d.last(),c=(a[f]||"").toString();if(c)b+=" "+e+"="+c.inspect(true)});return b+">"},recursivelyCollect:function(a,c){a=$(a);var b=[];while(a=a[c])a.nodeType==1&&b.push(Element.extend(a));return b},ancestors:function(a){return Element.recursivelyCollect(a,"parentNode")},descendants:function(a){return Element.select(a,"*")},firstDescendant:function(a){a=$(a).firstChild;while(a&&a.nodeType!=1)a=a.nextSibling;return $(a)},immediateDescendants:function(a){if(!(a=$(a).firstChild))return [];while(a&&a.nodeType!=1)a=a.nextSibling;if(a)return [a].concat($(a).nextSiblings());return []},previousSiblings:function(a){return Element.recursivelyCollect(a,"previousSibling")},nextSiblings:function(a){return Element.recursivelyCollect(a,"nextSibling")},siblings:function(a){a=$(a);return Element.previousSiblings(a).reverse().concat(Element.nextSiblings(a))},match:function(b,a){if(Object.isString(a))a=new Selector(a);return a.match($(b))},up:function(a,b,d){a=$(a);if(arguments.length==1)return $(a.parentNode);var c=Element.ancestors(a);return Object.isNumber(b)?c[b]:Selector.findElement(c,b,d)},down:function(a,b,c){a=$(a);if(arguments.length==1)return Element.firstDescendant(a);return Object.isNumber(b)?Element.descendants(a)[b]:Element.select(a,b)[c||0]},previous:function(a,b,d){a=$(a);if(arguments.length==1)return $(Selector.handlers.previousElementSibling(a));var c=Element.previousSiblings(a);return Object.isNumber(b)?c[b]:Selector.findElement(c,b,d)},next:function(a,b,d){a=$(a);if(arguments.length==1)return $(Selector.handlers.nextElementSibling(a));var c=Element.nextSiblings(a);return Object.isNumber(b)?c[b]:Selector.findElement(c,b,d)},select:function(a){var b=Array.prototype.slice.call(arguments,1);return Selector.findChildElements(a,b)},adjacent:function(a){var b=Array.prototype.slice.call(arguments,1);return Selector.findChildElements(a.parentNode,b).without(a)},identify:function(b){b=$(b);var a=Element.readAttribute(b,"id");if(a)return a;do a="anonymous_element_"+Element.idCounter++;while($(a));Element.writeAttribute(b,"id",a);return a},readAttribute:function(b,a){b=$(b);if(Prototype.Browser.IE){var c=Element._attributeTranslations.read;if(c.values[a])return c.values[a](b,a);if(c.names[a])a=c.names[a];if(a.include(":"))return !b.attributes||!b.attributes[a]?null:b.attributes[a].value}return b.getAttribute(a)},writeAttribute:function(c,a,b){c=$(c);var e={},f=Element._attributeTranslations.write;if(typeof a=="object")e=a;else e[a]=Object.isUndefined(b)?true:b;for(var d in e){a=f.names[d]||d;b=e[d];if(f.values[d])a=f.values[d](c,b);if(b===false||b===null)c.removeAttribute(a);else if(b===true)c.setAttribute(a,a);else c.setAttribute(a,b)}return c},getHeight:function(a){return Element.getDimensions(a).height},getWidth:function(a){return Element.getDimensions(a).width},classNames:function(a){return new Element.ClassNames(a)},hasClassName:function(b,c){if(!(b=$(b)))return;var a=b.className;return a.length>0&&(a==c||(new RegExp("(^|\\s)"+c+"(\\s|$)")).test(a))},addClassName:function(a,b){if(!(a=$(a)))return;if(!Element.hasClassName(a,b))a.className+=(a.className?" ":"")+b;return a},removeClassName:function(a,b){if(!(a=$(a)))return;a.className=a.className.replace(new RegExp("(^|\\s+)"+b+"(\\s+|$)")," ").strip();return a},toggleClassName:function(a,b){if(!(a=$(a)))return;return Element[Element.hasClassName(a,b)?"removeClassName":"addClassName"](a,b)},cleanWhitespace:function(b){b=$(b);var a=b.firstChild;while(a){var c=a.nextSibling;a.nodeType==3&&!/\S/.test(a.nodeValue)&&b.removeChild(a);a=c}return b},empty:function(a){return $(a).innerHTML.blank()},descendantOf:function(a,b){a=$(a),b=$(b);if(a.compareDocumentPosition)return (a.compareDocumentPosition(b)&8)===8;if(b.contains)return b.contains(a)&&b!==a;while(a=a.parentNode)if(a==b)return true;return false},scrollTo:function(a){a=$(a);var b=Element.cumulativeOffset(a);window.scrollTo(b[0],b[1]);return a},getStyle:function(c,b){c=$(c);b=b=="float"?"cssFloat":b.camelize();var a=c.style[b];if(!a||a=="auto"){var d=document.defaultView.getComputedStyle(c,null);a=d?d[b]:null}if(b=="opacity")return a?parseFloat(a):1;return a=="auto"?null:a},getOpacity:function(a){return $(a).getStyle("opacity")},setStyle:function(a,b){a=$(a);var d=a.style,e;if(Object.isString(b)){a.style.cssText+=";"+b;return b.include("opacity")?a.setOpacity(b.match(/opacity:\s*(\d?\.?\d*)/)[1]):a}for(var c in b)if(c=="opacity")a.setOpacity(b[c]);else d[c=="float"||c=="cssFloat"?Object.isUndefined(d.styleFloat)?"cssFloat":"styleFloat":c]=b[c];return a},setOpacity:function(a,b){a=$(a);a.style.opacity=b==1||b===""?"":b<1e-5?0:b;return a},getDimensions:function(b){b=$(b);var d=Element.getStyle(b,"display");if(d!="none"&&d!=null)return {width:b.offsetWidth,height:b.offsetHeight};var a=b.style,e=a.visibility,c=a.position,f=a.display;a.visibility="hidden";if(c!="fixed")a.position="absolute";a.display="block";var h=b.clientWidth,g=b.clientHeight;a.display=f;a.position=c;a.visibility=e;return {width:h,height:g}},makePositioned:function(a){a=$(a);var b=Element.getStyle(a,"position");if(b=="static"||!b){a._madePositioned=true;a.style.position="relative";if(Prototype.Browser.Opera){a.style.top=0;a.style.left=0}}return a},undoPositioned:function(a){a=$(a);if(a._madePositioned){a._madePositioned=undefined;a.style.position=a.style.top=a.style.left=a.style.bottom=a.style.right=""}return a},makeClipping:function(a){a=$(a);if(a._overflow)return a;a._overflow=Element.getStyle(a,"overflow")||"auto";if(a._overflow!=="hidden")a.style.overflow="hidden";return a},undoClipping:function(a){a=$(a);if(!a._overflow)return a;a.style.overflow=a._overflow=="auto"?"":a._overflow;a._overflow=null;return a},cumulativeOffset:function(a){var c=0,b=0;do{c+=a.offsetTop||0;b+=a.offsetLeft||0;a=a.offsetParent}while(a);return Element._returnOffset(b,c)},positionedOffset:function(a){var c=0,b=0;do{c+=a.offsetTop||0;b+=a.offsetLeft||0;a=a.offsetParent;if(a){if(a.tagName.toUpperCase()=="BODY")break;var d=Element.getStyle(a,"position");if(d!=="static")break}}while(a);return Element._returnOffset(b,c)},absolutize:function(a){a=$(a);if(Element.getStyle(a,"position")=="absolute")return a;var b=Element.positionedOffset(a),d=b[1],c=b[0],f=a.clientWidth,e=a.clientHeight;a._originalLeft=c-parseFloat(a.style.left||0);a._originalTop=d-parseFloat(a.style.top||0);a._originalWidth=a.style.width;a._originalHeight=a.style.height;a.style.position="absolute";a.style.top=d+"px";a.style.left=c+"px";a.style.width=f+"px";a.style.height=e+"px";return a},relativize:function(a){a=$(a);if(Element.getStyle(a,"position")=="relative")return a;a.style.position="relative";var c=parseFloat(a.style.top||0)-(a._originalTop||0),b=parseFloat(a.style.left||0)-(a._originalLeft||0);a.style.top=c+"px";a.style.left=b+"px";a.style.height=a._originalHeight;a.style.width=a._originalWidth;return a},cumulativeScrollOffset:function(a){var c=0,b=0;do{c+=a.scrollTop||0;b+=a.scrollLeft||0;a=a.parentNode}while(a);return Element._returnOffset(b,c)},getOffsetParent:function(a){if(a.offsetParent)return $(a.offsetParent);if(a==document.body)return $(a);while((a=a.parentNode)&&a!=document.body)if(Element.getStyle(a,"position")!="static")return $(a);return $(document.body)},viewportOffset:function(d){var c=0,b=0,a=d;do{c+=a.offsetTop||0;b+=a.offsetLeft||0;if(a.offsetParent==document.body&&Element.getStyle(a,"position")=="absolute")break}while(a=a.offsetParent);a=d;do if(!Prototype.Browser.Opera||a.tagName&&a.tagName.toUpperCase()=="BODY"){c-=a.scrollTop||0;b-=a.scrollLeft||0}while(a=a.parentNode);return Element._returnOffset(b,c)},clonePosition:function(a,c){var b=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});c=$(c);var f=Element.viewportOffset(c);a=$(a);var d=[0,0],e=null;if(Element.getStyle(a,"position")=="absolute"){e=Element.getOffsetParent(a);d=Element.viewportOffset(e)}if(e==document.body){d[0]-=document.body.offsetLeft;d[1]-=document.body.offsetTop}if(b.setLeft)a.style.left=f[0]-d[0]+b.offsetLeft+"px";if(b.setTop)a.style.top=f[1]-d[1]+b.offsetTop+"px";if(b.setWidth)a.style.width=c.offsetWidth+"px";if(b.setHeight)a.style.height=c.offsetHeight+"px";return a}};Object.extend(Element.Methods,{getElementsBySelector:Element.Methods.select,childElements:Element.Methods.immediateDescendants});Element._attributeTranslations={write:{names:{className:"class",htmlFor:"for"},values:{}}};if(Prototype.Browser.Opera){Element.Methods.getStyle=Element.Methods.getStyle.wrap(function(c,a,b){switch(b){case "left":case "top":case "right":case "bottom":if(c(a,"position")==="static")return null;case "height":case "width":if(!Element.visible(a))return null;var e=parseInt(c(a,b),10);if(e!==a["offset"+b.capitalize()])return e+"px";var d;if(b==="height")d=["border-top-width","padding-top","padding-bottom","border-bottom-width"];else d=["border-left-width","padding-left","padding-right","border-right-width"];return d.inject(e,function(b,e){var d=c(a,e);return d===null?b:b-parseInt(d,10)})+"px";default:return c(a,b)}});Element.Methods.readAttribute=Element.Methods.readAttribute.wrap(function(c,b,a){if(a==="title")return b.title;return c(b,a)})}else if(Prototype.Browser.IE){Element.Methods.getOffsetParent=Element.Methods.getOffsetParent.wrap(function(c,a){a=$(a);try{a.offsetParent}catch(e){return $(document.body)}var b=a.getStyle("position");if(b!=="static")return c(a);a.setStyle({position:"relative"});var d=c(a);a.setStyle({position:b});return d});$w("positionedOffset viewportOffset").each(function(a){Element.Methods[a]=Element.Methods[a].wrap(function(d,a){a=$(a);try{a.offsetParent}catch(f){return Element._returnOffset(0,0)}var c=a.getStyle("position");if(c!=="static")return d(a);var b=a.getOffsetParent();b&&b.getStyle("position")==="fixed"&&b.setStyle({zoom:1});a.setStyle({position:"relative"});var e=d(a);a.setStyle({position:c});return e})});Element.Methods.cumulativeOffset=Element.Methods.cumulativeOffset.wrap(function(b,a){try{a.offsetParent}catch(c){return Element._returnOffset(0,0)}return b(a)});Element.Methods.getStyle=function(b,a){b=$(b);a=a=="float"||a=="cssFloat"?"styleFloat":a.camelize();var c=b.style[a];if(!c&&b.currentStyle)c=b.currentStyle[a];if(a=="opacity"){if(c=(b.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/))if(c[1])return parseFloat(c[1])/100;return 1}if(c=="auto"){if((a=="width"||a=="height")&&b.getStyle("display")!="none")return b["offset"+a.capitalize()]+"px";return null}return c};Element.Methods.setOpacity=function(a,b){function f(a){return a.replace(/alpha\([^\)]*\)/gi,"")}a=$(a);var d=a.currentStyle;if(d&&!d.hasLayout||!d&&a.style.zoom=="normal")a.style.zoom=1;var c=a.getStyle("filter"),e=a.style;if(b==1||b===""){(c=f(c))?(e.filter=c):e.removeAttribute("filter");return a}else if(b<1e-5)b=0;e.filter=f(c)+"alpha(opacity="+b*100+")";return a};Element._attributeTranslations=function(){var b="className",c="for",a=document.createElement("div");a.setAttribute(b,"x");if(a.className!=="x"){a.setAttribute("class","x");if(a.className==="x")b="class"}a=null;a=document.createElement("label");a.setAttribute(c,"x");if(a.htmlFor!=="x"){a.setAttribute("htmlFor","x");if(a.htmlFor==="x")c="htmlFor"}a=null;return {read:{names:{"class":b,className:b,"for":c,htmlFor:c},values:{_getAttr:function(b,a){return b.getAttribute(a)},_getAttr2:function(b,a){return b.getAttribute(a,2)},_getAttrNode:function(c,b){var a=c.getAttributeNode(b);return a?a.value:""},_getEv:function(){var a=document.createElement("div");a.onclick=Prototype.emptyFunction;var c=a.getAttribute("onclick"),b;if(String(c).indexOf("{")>-1)b=function(b,a){a=b.getAttribute(a);if(!a)return null;a=a.toString();a=a.split("{")[1];a=a.split("}")[0];return a.strip()};else if(c==="")b=function(b,a){a=b.getAttribute(a);if(!a)return null;return a.strip()};a=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(a,b){a.checked=!!b},style:function(b,a){b.style.cssText=a?a:""}}};Element._attributeTranslations.has={};$w("colSpan rowSpan vAlign dateTime accessKey tabIndex encType maxLength readOnly longDesc frameBorder").each(function(a){Element._attributeTranslations.write.names[a.toLowerCase()]=a;Element._attributeTranslations.has[a.toLowerCase()]=a});(function(a){Object.extend(a,{href:a._getAttr2,src:a._getAttr2,type:a._getAttr,action:a._getAttrNode,disabled:a._flag,checked:a._flag,readonly:a._flag,multiple:a._flag,onload:a._getEv,onunload:a._getEv,onclick:a._getEv,ondblclick:a._getEv,onmousedown:a._getEv,onmouseup:a._getEv,onmouseover:a._getEv,onmousemove:a._getEv,onmouseout:a._getEv,onfocus:a._getEv,onblur:a._getEv,onkeypress:a._getEv,onkeydown:a._getEv,onkeyup:a._getEv,onsubmit:a._getEv,onreset:a._getEv,onselect:a._getEv,onchange:a._getEv})})(Element._attributeTranslations.read.values);Prototype.BrowserFeatures.ElementExtensions&&(function(){function a(d){for(var e=d.getElementsByTagName("*"),b=[],c=0,a;a=e[c];c++)a.tagName!=="!"&&b.push(a);return b}Element.Methods.down=function(b,c,d){b=$(b);if(arguments.length==1)return b.firstDescendant();return Object.isNumber(c)?a(b)[c]:Element.select(b,c)[d||0]}})()}else if(Prototype.Browser.Gecko&&/rv:1\.8\.0/.test(navigator.userAgent))Element.Methods.setOpacity=function(a,b){a=$(a);a.style.opacity=b==1?.999999:b===""?"":b<1e-5?0:b;return a};else if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(a,b){a=$(a);a.style.opacity=b==1||b===""?"":b<1e-5?0:b;if(b==1)if(a.tagName.toUpperCase()=="IMG"&&a.width){a.width++;a.width--}else try{var c=document.createTextNode(" ");a.appendChild(c);a.removeChild(c)}catch(d){}return a};Element.Methods.cumulativeOffset=function(a){var c=0,b=0;do{c+=a.offsetTop||0;b+=a.offsetLeft||0;if(a.offsetParent==document.body)if(Element.getStyle(a,"position")=="absolute")break;a=a.offsetParent}while(a);return Element._returnOffset(b,c)}}if("outerHTML" in document.documentElement)Element.Methods.replace=function(b,a){b=$(b);if(a&&a.toElement)a=a.toElement();if(Object.isElement(a)){b.parentNode.replaceChild(a,b);return b}a=Object.toHTML(a);var c=b.parentNode,f=c.tagName.toUpperCase();if(Element._insertionTranslations.tags[f]){var d=b.next(),e=Element._getContentFromAnonymousElement(f,a.stripScripts());c.removeChild(b);if(d)e.each(function(a){c.insertBefore(a,d)});else e.each(function(a){c.appendChild(a)})}else b.outerHTML=a.stripScripts();a.evalScripts.bind(a).defer();return b};Element._returnOffset=function(b,c){var a=[b,c];a.left=b;a.top=c;return a};Element._getContentFromAnonymousElement=function(d,c){var a=new Element("div"),b=Element._insertionTranslations.tags[d];if(b){a.innerHTML=b[0]+c+b[1];b[2].times(function(){a=a.firstChild})}else a.innerHTML=c;return $A(a.childNodes)};Element._insertionTranslations={before:function(a,b){a.parentNode.insertBefore(b,a)},top:function(a,b){a.insertBefore(b,a.firstChild)},bottom:function(a,b){a.appendChild(b)},after:function(a,b){a.parentNode.insertBefore(b,a.nextSibling)},tags:{TABLE:["<table>","</table>",1],TBODY:["<table><tbody>","</tbody></table>",2],TR:["<table><tbody><tr>","</tr></tbody></table>",3],TD:["<table><tbody><tr><td>","</td></tr></tbody></table>",4],SELECT:["<select>","</select>",1]}};(function(){var a=Element._insertionTranslations.tags;Object.extend(a,{THEAD:a.TBODY,TFOOT:a.TBODY,TH:a.TD})})();Element.Methods.Simulated={hasAttribute:function(c,a){a=Element._attributeTranslations.has[a]||a;var b=$(c).getAttributeNode(a);return !!(b&&b.specified)}};Element.Methods.ByTag={};Object.extend(Element,Element.Methods);(function(a){if(!Prototype.BrowserFeatures.ElementExtensions&&a["__proto__"]){window.HTMLElement={};window.HTMLElement.prototype=a["__proto__"];Prototype.BrowserFeatures.ElementExtensions=true}a=null})(document.createElement("div"));Element.extend=function(){function f(e){if(typeof window.Element!="undefined"){var a=window.Element.prototype;if(a){var b="_"+(Math.random()+"").slice(2),c=document.createElement(e);a[b]="x";var d=c[b]!=="x";delete a[b];c=null;return d}}return false}function a(b,c){for(var a in c){var d=c[a];if(Object.isFunction(d)&&!(a in b))b[a]=d.methodize()}}var e=f("object");if(Prototype.BrowserFeatures.SpecificElementExtensions){if(e)return function(b){if(b&&typeof b._extendedByPrototype=="undefined"){var c=b.tagName;if(c&&/^(?:object|applet|embed)$/i.test(c)){a(b,Element.Methods);a(b,Element.Methods.Simulated);a(b,Element.Methods.ByTag[c.toUpperCase()])}}return b};return Prototype.K}var b={},d=Element.Methods.ByTag,c=Object.extend(function(c){if(!c||typeof c._extendedByPrototype!="undefined"||c.nodeType!=1||c==window)return c;var e=Object.clone(b),f=c.tagName.toUpperCase();d[f]&&Object.extend(e,d[f]);a(c,e);c._extendedByPrototype=Prototype.emptyFunction;return c},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(b,Element.Methods);Object.extend(b,Element.Methods.Simulated)}}});c.refresh();return c}();Element.hasAttribute=function(a,b){if(a.hasAttribute)return a.hasAttribute(b);return Element.Methods.Simulated.hasAttribute(a,b)};Element.addMethods=function(a){var h=Prototype.BrowserFeatures,j=Element.Methods.ByTag;if(!a){Object.extend(Form,Form.Methods);Object.extend(Form.Element,Form.Element.Methods);Object.extend(Element.Methods.ByTag,{FORM:Object.clone(Form.Methods),INPUT:Object.clone(Form.Element.Methods),SELECT:Object.clone(Form.Element.Methods),TEXTAREA:Object.clone(Form.Element.Methods)})}if(arguments.length==2){var b=a;a=arguments[1]}if(!b)Object.extend(Element.Methods,a||{});else if(Object.isArray(b))b.each(e);else e(b);function e(b){b=b.toUpperCase();if(!Element.Methods.ByTag[b])Element.Methods.ByTag[b]={};Object.extend(Element.Methods.ByTag[b],a)}function c(d,c,a){a=a||false;for(var b in d){var e=d[b];if(!Object.isFunction(e))continue;if(!a||!(b in c))c[b]=e.methodize()}}function i(b){var a,d={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(d[b])a="HTML"+d[b]+"Element";if(window[a])return window[a];a="HTML"+b+"Element";if(window[a])return window[a];a="HTML"+b.capitalize()+"Element";if(window[a])return window[a];var c=document.createElement(b),e=c["__proto__"]||c.constructor.prototype;c=null;return e}var d=window.HTMLElement?HTMLElement.prototype:Element.prototype;if(h.ElementExtensions){c(Element.Methods,d);c(Element.Methods.Simulated,d,true)}if(h.SpecificElementExtensions)for(var g in Element.Methods.ByTag){var f=i(g);if(Object.isUndefined(f))continue;c(j[g],f.prototype)}Object.extend(Element,Element.Methods);delete Element.ByTag;Element.extend.refresh&&Element.extend.refresh();Element.cache={}};document.viewport={getDimensions:function(){return {width:this.getWidth(),height:this.getHeight()}},getScrollOffsets:function(){return Element._returnOffset(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop)}};(function(a){var e=Prototype.Browser,g=document,b,c={};function f(){if(e.WebKit&&!g.evaluate)return document;if(e.Opera&&window.parseFloat(window.opera.version())<9.5)return document.body;return document.documentElement}function d(d){if(!b)b=f();c[d]="client"+d;a["get"+d]=function(){return b[c[d]]};return a["get"+d]()}a.getWidth=d.curry("Width");a.getHeight=d.curry("Height")})(document.viewport);Element.Storage={UID:1};Element.addMethods({getStorage:function(a){if(!(a=$(a)))return;var b;if(a===window)b=0;else{if(typeof a._prototypeUID==="undefined")a._prototypeUID=[Element.Storage.UID++];b=a._prototypeUID[0]}if(!Element.Storage[b])Element.Storage[b]=$H();return Element.Storage[b]},store:function(a,b,c){if(!(a=$(a)))return;if(arguments.length===2)Element.getStorage(a).update(b);else Element.getStorage(a).set(b,c);return a},retrieve:function(a,e,c){if(!(a=$(a)))return;var d=Element.getStorage(a),b=d.get(e);if(Object.isUndefined(b)){d.set(e,c);b=c}return b},clone:function(a,d){if(!(a=$(a)))return;var b=a.cloneNode(d);b._prototypeUID=void 0;if(d){var c=Element.select(b,"*"),e=c.length;while(e--)c[e]._prototypeUID=void 0}return Element.extend(b)}});var Selector=Class.create({initialize:function(a){this.expression=a.strip();if(this.shouldUseSelectorsAPI())this.mode="selectorsAPI";else if(this.shouldUseXPath()){this.mode="xpath";this.compileXPathMatcher()}else{this.mode="normal";this.compileMatcher()}},shouldUseXPath:function(){var a=function(){var b=false;if(document.evaluate&&window.XPathResult){var a=document.createElement("div");a.innerHTML="<ul><li></li></ul><div><ul><li></li></ul></div>";var d=".//*[local-name()='ul' or local-name()='UL']//*[local-name()='li' or local-name()='LI']",c=document.evaluate(d,a,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);b=c.snapshotLength!==2;a=null}return b}();return function(){if(!Prototype.BrowserFeatures.XPath)return false;var b=this.expression;if(Prototype.Browser.WebKit&&(b.include("-of-type")||b.include(":empty")))return false;if(/(\[[\w-]*?:|:checked)/.test(b))return false;if(a)return false;return true}}(),shouldUseSelectorsAPI:function(){if(!Prototype.BrowserFeatures.SelectorsAPI)return false;if(Selector.CASE_INSENSITIVE_CLASS_NAMES)return false;if(!Selector._div)Selector._div=new Element("div");try{Selector._div.querySelector(this.expression)}catch(a){return false}return true},compileMatcher:function(){var e=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 a=this.expression,e=Selector.patterns,f=Selector.xpath,g,d,h=e.length,b;if(Selector._cache[a]){this.xpath=Selector._cache[a];return}this.matcher=[".//*"];while(a&&g!=a&&/\S/.test(a)){g=a;for(var c=0;c<h;c++){b=e[c].name;if(d=a.match(e[c].re)){this.matcher.push(Object.isFunction(f[b])?f[b](d):(new Template(f[b])).evaluate(d));a=a.replace(d[0],"");break}}}this.xpath=this.matcher.join("");Selector._cache[this.expression]=this.xpath},findElements:function(a){a=a||document;var c=this.expression,d;switch(this.mode){case "selectorsAPI":if(a!==document){var e=a.id,b=$(a).identify();b=b.replace(/([\.:])/g,"\\$1");c="#"+b+" "+c}d=$A(a.querySelectorAll(c)).map(Element.extend);a.id=e;return d;case "xpath":return document._getElementsByXPath(this.xpath,a);default:return this.matcher(a)}},match:function(g){this.tokens=[];var a=this.expression,e=Selector.patterns,m=Selector.assertions,j,k,f,l=e.length,c;while(a&&j!==a&&/\S/.test(a)){j=a;for(var b=0;b<l;b++){k=e[b].re;c=e[b].name;if(f=a.match(k))if(m[c]){this.tokens.push([c,Object.clone(f)]);a=a.replace(f[0],"")}else return this.findElements(document).include(g)}}for(var i=true,c,h,b=0,d;d=this.tokens[b];b++){c=d[0],h=d[1];if(!Selector.assertions[c](g,h)){i=false;break}}return i},toString:function(){return this.expression},inspect:function(){return "#<Selector:"+this.expression.inspect()+">"}});if(Prototype.BrowserFeatures.SelectorsAPI&&document.compatMode==="BackCompat")Selector.CASE_INSENSITIVE_CLASS_NAMES=function(){var a=document.createElement("div"),b=document.createElement("span");a.id="prototype_test_id";b.className="Test";a.appendChild(b);var c=a.querySelector("#prototype_test_id .test")!==null;a=b=null;return c}();Object.extend(Selector,{_cache:{},xpath:{descendant:"//*",child:"/*",adjacent:"/following-sibling::*[1]",laterSibling:"/following-sibling::*",tagName:function(a){if(a[1]=="*")return "";return "[local-name()='"+a[1].toLowerCase()+"' or local-name()='"+a[1].toUpperCase()+"']"},className:"[contains(concat(' ', @class, ' '), ' #{1} ')]",id:"[@id='#{1}']",attrPresence:function(a){a[1]=a[1].toLowerCase();return (new Template("[@#{1}]")).evaluate(a)},attr:function(a){a[1]=a[1].toLowerCase();a[3]=a[5]||a[6];return (new Template(Selector.xpath.operators[a[2]])).evaluate(a)},pseudo:function(a){var b=Selector.xpath.pseudos[a[1]];if(!b)return "";if(Object.isFunction(b))return b(a);return (new Template(Selector.xpath.pseudos[a[1]])).evaluate(a)},operators:{"=":"[@#{1}='#{3}']","!=":"[@#{1}!='#{3}']","^=":"[starts-with(@#{1}, '#{3}')]","$=":"[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']","*=":"[contains(@#{1}, '#{3}')]","~=":"[contains(concat(' ', @#{1}, ' '), ' #{3} ')]","|=":"[contains(concat('-', @#{1}, '-'), '-#{3}-')]"},pseudos:{"first-child":"[not(preceding-sibling::*)]","last-child":"[not(following-sibling::*)]","only-child":"[not(preceding-sibling::* or following-sibling::*)]",empty:"[count(*) = 0 and (count(text()) = 0)]",checked:"[@checked]",disabled:"[(@disabled) and (@type!='hidden')]",enabled:"[not(@disabled) and (@type!='hidden')]",not:function(b){var a=b[6],e=Selector.patterns,g=Selector.xpath,i,f,j=e.length,c,h=[];while(a&&i!=a&&/\S/.test(a)){i=a;for(var d=0;d<j;d++){c=e[d].name;if(b=a.match(e[d].re)){f=Object.isFunction(g[c])?g[c](b):(new Template(g[c])).evaluate(b);h.push("("+f.substring(1,f.length-1)+")");a=a.replace(b[0],"");break}}}return "[not("+h.join(" and ")+")]"},"nth-child":function(a){return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ",a)},"nth-last-child":function(a){return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ",a)},"nth-of-type":function(a){return Selector.xpath.pseudos.nth("position() ",a)},"nth-last-of-type":function(a){return Selector.xpath.pseudos.nth("(last() + 1 - position()) ",a)},"first-of-type":function(a){a[6]="1";return Selector.xpath.pseudos["nth-of-type"](a)},"last-of-type":function(a){a[6]="1";return Selector.xpath.pseudos["nth-last-of-type"](a)},"only-of-type":function(a){var b=Selector.xpath.pseudos;return b["first-of-type"](a)+b["last-of-type"](a)},nth:function(d,g){var a,b=g[6],c;if(b=="even")b="2n+0";if(b=="odd")b="2n+1";if(a=b.match(/^(\d+)$/))return "["+d+"= "+a[1]+"]";if(a=b.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(a[1]=="-")a[1]=-1;var e=a[1]?Number(a[1]):1,f=a[2]?Number(a[2]):0;c="[((#{fragment} - #{b}) mod #{a} = 0) and ((#{fragment} - #{b}) div #{a} >= 0)]";return (new Template(c)).evaluate({fragment:d,a:e,b:f})}}}},criteria:{tagName:'n = h.tagName(n, r, "#{1}", c);      c = false;',className:'n = h.className(n, r, "#{1}", c);    c = false;',id:'n = h.id(n, r, "#{1}", c);           c = false;',attrPresence:'n = h.attrPresence(n, r, "#{1}", c); c = false;',attr:function(a){a[3]=a[5]||a[6];return (new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;')).evaluate(a)},pseudo:function(a){if(a[6])a[6]=a[6].replace(/"/g,'\\"');return (new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;')).evaluate(a)},descendant:'c = "descendant";',child:'c = "child";',adjacent:'c = "adjacent";',laterSibling:'c = "laterSibling";'},patterns:[{name:"laterSibling",re:/^\s*~\s*/},{name:"child",re:/^\s*>\s*/},{name:"adjacent",re:/^\s*\+\s*/},{name:"descendant",re:/^\s/},{name:"tagName",re:/^\s*(\*|[\w\-]+)(\b|$)?/},{name:"id",re:/^#([\w\-\*]+)(\b|$)/},{name:"className",re:/^\.([\w\-\*]+)(\b|$)/},{name:"pseudo",re:/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/},{name:"attrPresence",re:/^\[((?:[\w-]+:)?[\w-]+)\]/},{name:"attr",re:/\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/}],assertions:{tagName:function(a,b){return b[1].toUpperCase()==a.tagName.toUpperCase()},className:function(a,b){return Element.hasClassName(a,b[1])},id:function(a,b){return a.id===b[1]},attrPresence:function(a,b){return Element.hasAttribute(a,b[1])},attr:function(c,a){var b=Element.readAttribute(c,a[1]);return b&&Selector.operators[a[2]](b,a[5]||a[6])}},handlers:{concat:function(b,d){for(var c=0,a;a=d[c];c++)b.push(a);return b},mark:function(a){for(var d=Prototype.emptyFunction,c=0,b;b=a[c];c++)b._countedByPrototype=d;return a},unmark:function(){var a=function(){var a=document.createElement("div"),c=false,b="_countedByPrototype",d="x";a[b]=d;c=a.getAttribute(b)===d;a=null;return c}();return a?function(a){for(var c=0,b;b=a[c];c++)b.removeAttribute("_countedByPrototype");return a}:function(a){for(var c=0,b;b=a[c];c++)b._countedByPrototype=void 0;return a}}(),index:function(c,g,e){c._countedByPrototype=Prototype.emptyFunction;if(g)for(var d=c.childNodes,b=d.length-1,f=1;b>=0;b--){var a=d[b];if(a.nodeType==1&&(!e||a._countedByPrototype))a.nodeIndex=f++}else for(var b=0,f=1,d=c.childNodes;a=d[b];b++)if(a.nodeType==1&&(!e||a._countedByPrototype))a.nodeIndex=f++},unique:function(a){if(a.length==0)return a;for(var d=[],c,b=0,e=a.length;b<e;b++)if(typeof (c=a[b])._countedByPrototype=="undefined"){c._countedByPrototype=Prototype.emptyFunction;d.push(Element.extend(c))}return Selector.handlers.unmark(d)},descendant:function(d){for(var e=Selector.handlers,c=0,a=[],b;b=d[c];c++)e.concat(a,b.getElementsByTagName("*"));return a},child:function(f){for(var g=Selector.handlers,d=0,b=[],c;c=f[d];d++)for(var e=0,a;a=c.childNodes[e];e++)a.nodeType==1&&a.tagName!="!"&&b.push(a);return b},adjacent:function(e){for(var d=0,a=[],c;c=e[d];d++){var b=this.nextElementSibling(c);b&&a.push(b)}return a},laterSibling:function(d){for(var e=Selector.handlers,c=0,a=[],b;b=d[c];c++)e.concat(a,Element.nextSiblings(b));return a},nextElementSibling:function(a){while(a=a.nextSibling)if(a.nodeType==1)return a;return null},previousElementSibling:function(a){while(a=a.previousSibling)if(a.nodeType==1)return a;return null},tagName:function(a,h,d,f){var g=d.toUpperCase(),c=[],i=Selector.handlers;if(a){if(f){if(f=="descendant"){for(var e=0,b;b=a[e];e++)i.concat(c,b.getElementsByTagName(d));return c}else a=this[f](a);if(d=="*")return a}for(var e=0,b;b=a[e];e++)b.tagName.toUpperCase()===g&&c.push(b);return c}else return h.getElementsByTagName(d)},id:function(c,f,g,e){var a=$(g),i=Selector.handlers;if(f==document){if(!a)return [];if(!c)return [a]}else if(!f.sourceIndex||f.sourceIndex<1)for(var c=f.getElementsByTagName("*"),h=0,b;b=c[h];h++)if(b.id===g)return [b];if(c){if(e)if(e=="child"){for(var d=0,b;b=c[d];d++)if(a.parentNode==b)return [a]}else if(e=="descendant"){for(var d=0,b;b=c[d];d++)if(Element.descendantOf(a,b))return [a]}else if(e=="adjacent"){for(var d=0,b;b=c[d];d++)if(Selector.handlers.previousElementSibling(a)==b)return [a]}else c=i[e](c);for(var d=0,b;b=c[d];d++)if(b==a)return [a];return []}return a&&Element.descendantOf(a,f)?[a]:[]},className:function(a,d,c,b){if(a&&b)a=this[b](a);return Selector.handlers.byClassName(a,d,c)},byClassName:function(b,h,d){if(!b)b=Selector.handlers.descendant([h]);for(var g=" "+d+" ",f=0,e=[],c,a;c=b[f];f++){a=c.className;if(a.length==0)continue;(a==d||(" "+a+" ").include(g))&&e.push(c)}return e},attrPresence:function(a,g,f,c){if(!a)a=g.getElementsByTagName("*");if(a&&c)a=this[c](a);for(var d=[],e=0,b;b=a[e];e++)Element.hasAttribute(b,f)&&d.push(b);return d},attr:function(a,k,j,i,g,c){if(!a)a=k.getElementsByTagName("*");if(a&&c)a=this[c](a);for(var h=Selector.operators[g],e=[],f=0,b;b=a[f];f++){var d=Element.readAttribute(b,j);if(d===null)continue;h(d,i)&&e.push(b)}return e},pseudo:function(a,e,d,c,b){if(a&&b)a=this[b](a);if(!a)a=c.getElementsByTagName("*");return Selector.pseudos[e](a,d,c)}},pseudos:{"first-child":function(d){for(var c=0,b=[],a;a=d[c];c++){if(Selector.handlers.previousElementSibling(a))continue;b.push(a)}return b},"last-child":function(d){for(var c=0,b=[],a;a=d[c];c++){if(Selector.handlers.nextElementSibling(a))continue;b.push(a)}return b},"only-child":function(e){for(var c=Selector.handlers,d=0,b=[],a;a=e[d];d++)!c.previousElementSibling(a)&&!c.nextElementSibling(a)&&b.push(a);return b},"nth-child":function(b,a,c){return Selector.pseudos.nth(b,a,c)},"nth-last-child":function(b,a,c){return Selector.pseudos.nth(b,a,c,true)},"nth-of-type":function(b,a,c){return Selector.pseudos.nth(b,a,c,false,true)},"nth-last-of-type":function(b,a,c){return Selector.pseudos.nth(b,a,c,true,true)},"first-of-type":function(a,c,b){return Selector.pseudos.nth(a,"1",b,false,true)},"last-of-type":function(a,c,b){return Selector.pseudos.nth(a,"1",b,true,true)},"only-of-type":function(d,a,b){var c=Selector.pseudos;return c["last-of-type"](c["first-of-type"](d,a,b),a,b)},getIndices:function(b,a,c){if(b==0)return a>0?[a]:[];return $R(1,c).inject([],function(d,c){0==(c-a)%b&&(c-a)/b>=0&&d.push(c);return d})},nth:function(c,b,p,k,l){if(c.length==0)return [];if(b=="even")b="2n+0";if(b=="odd")b="2n+1";var f=Selector.handlers,g=[],i=[],d;f.mark(c);for(var e=0,a;a=c[e];e++)if(!a.parentNode._countedByPrototype){f.index(a.parentNode,k,l);i.push(a.parentNode)}if(b.match(/^\d+$/)){b=Number(b);for(var e=0,a;a=c[e];e++)a.nodeIndex==b&&g.push(a)}else if(d=b.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(d[1]=="-")d[1]=-1;for(var m=d[1]?Number(d[1]):1,n=d[2]?Number(d[2]):0,j=Selector.pseudos.getIndices(m,n,c.length),e=0,a,o=j.length;a=c[e];e++)for(var h=0;h<o;h++)a.nodeIndex==j[h]&&g.push(a)}f.unmark(c);f.unmark(i);return g},empty:function(d){for(var c=0,b=[],a;a=d[c];c++){if(a.tagName=="!"||a.firstChild)continue;b.push(a)}return b},not:function(g,f,h){var d=Selector.handlers,i,j,b=(new Selector(f)).findElements(h);d.mark(b);for(var e=0,c=[],a;a=g[e];e++)!a._countedByPrototype&&c.push(a);d.unmark(b);return c},enabled:function(d){for(var c=0,b=[],a;a=d[c];c++)!a.disabled&&(!a.type||a.type!=="hidden")&&b.push(a);return b},disabled:function(d){for(var c=0,b=[],a;a=d[c];c++)a.disabled&&b.push(a);return b},checked:function(d){for(var c=0,b=[],a;a=d[c];c++)a.checked&&b.push(a);return b}},operators:{"=":function(a,b){return a==b},"!=":function(a,b){return a!=b},"^=":function(a,b){return a==b||a&&a.startsWith(b)},"$=":function(a,b){return a==b||a&&a.endsWith(b)},"*=":function(a,b){return a==b||a&&a.include(b)},"~=":function(a,b){return (" "+a+" ").include(" "+b+" ")},"|=":function(a,b){return ("-"+(a||"").toUpperCase()+"-").include("-"+(b||"").toUpperCase()+"-")}},split:function(b){var a=[];b.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(b){a.push(b[1].strip())});return a},matchElements:function(g,f){var b=$$(f),d=Selector.handlers;d.mark(b);for(var e=0,c=[],a;a=g[e];e++)a._countedByPrototype&&c.push(a);d.unmark(b);return c},findElement:function(c,a,b){if(Object.isNumber(a)){b=a;a=false}return Selector.matchElements(c,a||"*")[b||0]},findChildElements:function(g,a){a=Selector.split(a.join(","));for(var b=[],e=Selector.handlers,c=0,f=a.length,d;c<f;c++){d=new Selector(a[c].strip());e.concat(b,d.findElements(g))}return f>1?e.unique(b):b}});Prototype.Browser.IE&&Object.extend(Selector.handlers,{concat:function(b,d){for(var c=0,a;a=d[c];c++)a.tagName!=="!"&&b.push(a);return b}});function $$(){return Selector.findChildElements(document,$A(arguments))}var Form={reset:function(a){a=$(a);a.reset();return a},serializeElements:function(g,b){if(typeof b!="object")b={hash:!!b};else if(Object.isUndefined(b.hash))b.hash=true;var a,c,e=false,d=b.submit,f=g.inject({},function(b,f){if(!f.disabled&&f.name){a=f.name;c=$(f).getValue();if(c!=null&&f.type!="file"&&(f.type!="submit"||!e&&d!==false&&(!d||a==d)&&(e=true)))if(a in b){if(!Object.isArray(b[a]))b[a]=[b[a]];b[a].push(c)}else b[a]=c}return b});return b.hash?f:Object.toQueryString(f)}};Form.Methods={serialize:function(b,a){return Form.serializeElements(Form.getElements(b),a)},getElements:function(f){for(var e=$(f).getElementsByTagName("*"),a,b=[],d=Form.Element.Serializers,c=0;a=e[c];c++)b.push(a);return b.inject([],function(a,b){d[b.tagName.toLowerCase()]&&a.push(Element.extend(b));return a})},getInputs:function(d,a,e){d=$(d);var b=d.getElementsByTagName("input");if(!a&&!e)return $A(b).map(Element.extend);for(var f=0,g=[],h=b.length;f<h;f++){var c=b[f];if(a&&c.type!=a||e&&c.name!=e)continue;g.push(Element.extend(c))}return g},disable:function(a){a=$(a);Form.getElements(a).invoke("disable");return a},enable:function(a){a=$(a);Form.getElements(a).invoke("enable");return a},findFirstElement:function(c){var b=$(c).getElements().findAll(function(a){return "hidden"!=a.type&&!a.disabled}),a=b.findAll(function(a){return a.hasAttribute("tabIndex")&&a.tabIndex>=0}).sortBy(function(a){return a.tabIndex}).first();return a?a:b.find(function(a){return /^(?:input|select|textarea)$/i.test(a.tagName)})},focusFirstElement:function(a){a=$(a);a.findFirstElement().activate();return a},request:function(b,a){b=$(b),a=Object.clone(a||{});var c=a.parameters,d=b.readAttribute("action")||"";if(d.blank())d=window.location.href;a.parameters=b.serialize(true);if(c){if(Object.isString(c))c=c.toQueryParams();Object.extend(a.parameters,c)}if(b.hasAttribute("method")&&!a.method)a.method=b.method;return new Ajax.Request(d,a)}};Form.Element={focus:function(a){$(a).focus();return a},select:function(a){$(a).select();return a}};Form.Element.Methods={serialize:function(a){a=$(a);if(!a.disabled&&a.name){var b=a.getValue();if(b!=undefined){var c={};c[a.name]=b;return Object.toQueryString(c)}}return ""},getValue:function(a){a=$(a);var b=a.tagName.toLowerCase();return Form.Element.Serializers[b](a)},setValue:function(a,c){a=$(a);var b=a.tagName.toLowerCase();Form.Element.Serializers[b](a,c);return a},clear:function(a){$(a).value="";return a},present:function(a){return $(a).value!=""},activate:function(a){a=$(a);try{a.focus();a.select&&(a.tagName.toLowerCase()!="input"||!/^(?:button|reset|submit)$/i.test(a.type))&&a.select()}catch(b){}return a},disable:function(a){a=$(a);a.disabled=true;return a},enable:function(a){a=$(a);a.disabled=false;return a}};var Field=Form.Element,$F=Form.Element.Methods.getValue;Form.Element.Serializers={input:function(a,b){switch(a.type.toLowerCase()){case "checkbox":case "radio":return Form.Element.Serializers.inputSelector(a,b);default:return Form.Element.Serializers.textarea(a,b)}},inputSelector:function(a,b){if(Object.isUndefined(b))return a.checked?a.value:null;else a.checked=!!b},textarea:function(a,b){if(Object.isUndefined(b))return a.value;else a.value=b},select:function(a,b){if(Object.isUndefined(b))return this[a.type=="select-one"?"selectOne":"selectMany"](a);else for(var c,d,g=!Object.isArray(b),e=0,f=a.length;e<f;e++){c=a.options[e];d=this.optionValue(c);if(g){if(d==b){c.selected=true;return}}else c.selected=b.include(d)}},selectOne:function(a){var b=a.selectedIndex;return b>=0?this.optionValue(a.options[b]):null},selectMany:function(b){var d,c=b.length;if(!c)return null;for(var a=0,d=[];a<c;a++){var e=b.options[a];e.selected&&d.push(this.optionValue(e))}return d},optionValue:function(a){return Element.extend(a).hasAttribute("value")?a.value:a.text}};Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function(d,c,a,b){d(b,a);this.element=$(c);this.lastValue=this.getValue()},execute:function(){var a=this.getValue();if(Object.isString(this.lastValue)&&Object.isString(a)?this.lastValue!=a:String(this.lastValue)!=String(a)){this.callback(this.element,a);this.lastValue=a}}});Form.Element.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.serialize(this.element)}});Abstract.EventObserver=Class.create({initialize:function(b,a){this.element=$(b);this.callback=a;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase()=="form")this.registerFormCallbacks();else this.registerCallback(this.element)},onElementEvent:function(){var a=this.getValue();if(this.lastValue!=a){this.callback(this.element,a);this.lastValue=a}},registerFormCallbacks:function(){Form.getElements(this.element).each(this.registerCallback,this)},registerCallback:function(a){if(a.type)switch(a.type.toLowerCase()){case "checkbox":case "radio":Event.observe(a,"click",this.onElementEvent.bind(this));break;default:Event.observe(a,"change",this.onElementEvent.bind(this))}}});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:{}},l=document.documentElement,i="onmouseenter" in l&&"onmouseleave" in l,b;if(Prototype.Browser.IE){var t={0:1,1:4,2:2};b=function(a,b){return a.button===t[b]}}else if(Prototype.Browser.WebKit)b=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 b=function(a,b){return a.which?a.which===b+1:a.button===b};function s(a){return b(a,0)}function o(a){return b(a,1)}function q(a){return b(a,2)}function u(c){c=a.extend(c);var d=c.target,e=c.type,b=c.currentTarget;if(b&&b.tagName)if(e==="load"||e==="error"||e==="click"&&b.tagName.toLowerCase()==="input"&&b.type==="radio")d=b;if(d.nodeType==Node.TEXT_NODE)d=d.parentNode;return Element.extend(d)}function r(e,c){var b=a.element(e);if(!c)return b;var d=[b].concat(b.ancestors());return Selector.findElement(d,c,0)}function v(a){return {x:j(a),y:k(a)}}function j(b){var a=document.documentElement,c=document.body||{scrollLeft:0};return b.pageX||b.clientX+(a.scrollLeft||c.scrollLeft)-(a.clientLeft||0)}function k(b){var a=document.documentElement,c=document.body||{scrollTop:0};return b.pageY||b.clientY+(a.scrollTop||c.scrollTop)-(a.clientTop||0)}function w(b){a.extend(b);b.preventDefault();b.stopPropagation();b.stopped=true}a.Methods={isLeftClick:s,isMiddleClick:o,isRightClick:q,element:u,findElement:r,pointer:v,pointerX:j,pointerY:k,stop:w};var f=Object.keys(a.Methods).inject({},function(c,b){c[b]=a.Methods[b].methodize();return c});if(Prototype.Browser.IE){function n(b){var a;switch(b.type){case "mouseover":a=b.fromElement;break;case "mouseout":a=b.toElement;break;default:return null}return Element.extend(a)}Object.extend(f,{stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return "[object Event]"}});a.extend=function(b,d){if(!b)return false;if(b._extendedByPrototype)return b;b._extendedByPrototype=Prototype.emptyFunction;var c=a.pointer(b);Object.extend(b,{target:b.srcElement||d,relatedTarget:n(b),pageX:c.x,pageY:c.y});return Object.extend(b,f)}}else{a.prototype=window.Event.prototype||document.createEvent("HTMLEvents").__proto__;Object.extend(a.prototype,f);a.extend=Prototype.K}function m(b,d,g){var h=Element.retrieve(b,"prototype_event_registry");if(Object.isUndefined(h)){c.push(b);h=Element.retrieve(b,"prototype_event_registry",$H())}var f=h.get(d);if(Object.isUndefined(f)){f=[];h.set(d,f)}if(f.pluck("handler").include(g))return false;var e;if(d.include(":"))e=function(c){if(Object.isUndefined(c.eventName))return false;if(c.eventName!==d)return false;a.extend(c,b);g.call(b,c)};else if(!i&&(d==="mouseenter"||d==="mouseleave")){if(d==="mouseenter"||d==="mouseleave")e=function(d){a.extend(d,b);var c=d.relatedTarget;while(c&&c!==b)try{c=c.parentNode}catch(e){c=b}if(c===b)return;g.call(b,d)}}else e=function(c){a.extend(c,b);g.call(b,c)};e.handler=g;f.push(e);return e}function p(){for(var b=0,d=c.length;b<d;b++){a.stopObserving(c[b]);c[b]=null}}var c=[];Prototype.Browser.IE&&window.attachEvent("onunload",p);Prototype.Browser.WebKit&&window.addEventListener("unload",Prototype.emptyFunction,false);var d=Prototype.K;if(!i)d=function(a){var b={mouseenter:"mouseover",mouseleave:"mouseout"};return a in b?b[a]:a};function g(a,c,f){a=$(a);var b=m(a,c,f);if(!b)return a;if(c.include(":"))if(a.addEventListener)a.addEventListener("dataavailable",b,false);else{a.attachEvent("ondataavailable",b);a.attachEvent("onfilterchange",b)}else{var e=d(c);if(a.addEventListener)a.addEventListener(e,b,false);else a.attachEvent("on"+e,b)}return a}function e(a,b,h){a=$(a);var f=Element.retrieve(a,"prototype_event_registry");if(Object.isUndefined(f))return a;if(b&&!h){var e=f.get(b);if(Object.isUndefined(e))return a;e.each(function(c){Element.stopObserving(a,b,c.handler)});return a}else if(!b){f.each(function(b){var d=b.key,c=b.value;c.each(function(b){Element.stopObserving(a,d,b.handler)})});return a}var e=f.get(b);if(!e)return;var c=e.find(function(a){return a.handler===h});if(!c)return a;var g=d(b);if(b.include(":"))if(a.removeEventListener)a.removeEventListener("dataavailable",c,false);else{a.detachEvent("ondataavailable",c);a.detachEvent("onfilterchange",c)}else if(a.removeEventListener)a.removeEventListener(g,c,false);else a.detachEvent("on"+g,c);f.set(b,e.without(c));return a}function h(c,e,f,d){c=$(c);if(Object.isUndefined(d))d=true;if(c==document&&document.createEvent&&!c.dispatchEvent)c=document.documentElement;var b;if(document.createEvent){b=document.createEvent("HTMLEvents");b.initEvent("dataavailable",true,true)}else{b=document.createEventObject();b.eventType=d?"ondataavailable":"onfilterchange"}b.eventName=e;b.memo=f||{};if(document.createEvent)c.dispatchEvent(b);else c.fireEvent(b.eventType,b);return a.extend(b)}Object.extend(a,a.Methods);Object.extend(a,{fire:h,observe:g,stopObserving:e});Element.addMethods({fire:h,observe:g,stopObserving:e});Object.extend(document,{fire:h.methodize(),observe:g.methodize(),stopObserving:e.methodize(),loaded:false});if(window.Event)Object.extend(window.Event,a);else window.Event=a})();(function(){var b;function a(){if(document.loaded)return;b&&window.clearTimeout(b);document.loaded=true;document.fire("dom:loaded")}function c(){if(document.readyState==="complete"){document.stopObserving("readystatechange",c);a()}}function d(){try{document.documentElement.doScroll("left")}catch(c){b=d.defer();return}a()}if(document.addEventListener)document.addEventListener("DOMContentLoaded",a,false);else{document.observe("readystatechange",c);if(window==top)b=d.defer()}Event.observe(window,"load",a)})();Element.addMethods();Hash.toQueryString=Object.toQueryString;var Toggle={display:Element.toggle};Element.Methods.childOf=Element.Methods.descendantOf;var Insertion={Before:function(b,a){return Element.insert(b,{before:a})},Top:function(b,a){return Element.insert(b,{top:a})},Bottom:function(b,a){return Element.insert(b,{bottom:a})},After:function(b,a){return Element.insert(b,{after:a})}},$continue=new Error('"throw $continue" is deprecated, use "return" instead'),Position={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},within:function(a,b,c){if(this.includeScrollOffsets)return this.withinIncludingScrolloffsets(a,b,c);this.xcomp=b;this.ycomp=c;this.offset=Element.cumulativeOffset(a);return c>=this.offset[1]&&c<this.offset[1]+a.offsetHeight&&b>=this.offset[0]&&b<this.offset[0]+a.offsetWidth},withinIncludingScrolloffsets:function(a,c,d){var b=Element.cumulativeScrollOffset(a);this.xcomp=c+b[0]-this.deltaX;this.ycomp=d+b[1]-this.deltaY;this.offset=Element.cumulativeOffset(a);return this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+a.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+a.offsetWidth},overlap:function(b,a){if(!b)return 0;if(b=="vertical")return (this.offset[1]+a.offsetHeight-this.ycomp)/a.offsetHeight;if(b=="horizontal")return (this.offset[0]+a.offsetWidth-this.xcomp)/a.offsetWidth},cumulativeOffset:Element.Methods.cumulativeOffset,positionedOffset:Element.Methods.positionedOffset,absolutize:function(a){Position.prepare();return Element.absolutize(a)},relativize:function(a){Position.prepare();return Element.relativize(a)},realOffset:Element.Methods.cumulativeScrollOffset,offsetParent:Element.Methods.getOffsetParent,page:Element.Methods.viewportOffset,clone:function(b,c,a){a=a||{};return Element.clonePosition(c,b,a)}};if(!document.getElementsByClassName)document.getElementsByClassName=function(b){function a(a){return a.blank()?null:"[contains(concat(' ', @class, ' '), ' "+a+" ')]"}b.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(d,b){b=b.toString().strip();var c=/\s/.test(b)?$w(b).map(a).join(""):a(b);return c?document._getElementsByXPath(".//*"+c,d):[]}:function(g,a){a=a.toString().strip();var d=[],c=/\s/.test(a)?$w(a):null;if(!c&&!a)return d;var h=$(g).getElementsByTagName("*");a=" "+a+" ";for(var f=0,b,e;b=h[f];f++)b.className&&(e=" "+b.className+" ")&&(e.include(a)||c&&c.all(function(a){return !a.toString().blank()&&e.include(" "+a+" ")}))&&d.push(Element.extend(b));return d};return function(b,a){return $(a||document.body).getElementsByClassName(b)}}(Element.Methods);Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(a){this.element=$(a)},_each:function(a){this.element.className.split(/\s+/).select(function(a){return a.length>0})._each(a)},"set":function(a){this.element.className=a},add:function(a){if(this.include(a))return;this.set($A(this).concat(a).join(" "))},remove:function(a){if(!this.include(a))return;this.set($A(this).without(a).join(" "))},toString:function(){return $A(this).join(" ")}};Object.extend(Element.ClassNames.prototype,Enumerable);String.prototype.parseColor=function(){var b="#";if(this.slice(0,4)=="rgb("){var c=this.slice(4,this.length-1).split(","),a=0;do b+=parseInt(c[a]).toColorPart();while(++a<3)}else if(this.slice(0,1)=="#"){if(this.length==4)for(var a=1;a<4;a++)b+=(this.charAt(a)+this.charAt(a)).toLowerCase();if(this.length==7)b=this.toLowerCase()}return b.length==7?b:arguments[0]||this};Element.collectTextNodes=function(a){return $A($(a).childNodes).collect(function(a){return a.nodeType==3?a.nodeValue:a.hasChildNodes()?Element.collectTextNodes(a):""}).flatten().join("")};Element.collectTextNodesIgnoreClass=function(b,a){return $A($(b).childNodes).collect(function(b){return b.nodeType==3?b.nodeValue:b.hasChildNodes()&&!Element.hasClassName(b,a)?Element.collectTextNodesIgnoreClass(b,a):""}).flatten().join("")};Element.setContentZoom=function(a,b){a=$(a);a.setStyle({fontSize:b/100+"em"});Prototype.Browser.WebKit&&window.scrollBy(0,0);return a};Element.getInlineOpacity=function(a){return $(a).style.opacity||""};Element.forceRerendering=function(a){try{a=$(a);var b=document.createTextNode(" ");a.appendChild(b);a.removeChild(b)}catch(c){}};var Effect={_elementDoesNotExistError:{name:"ElementDoesNotExistError",message:"The specified DOM element does not exist, but is required for this effect to operate"},Transitions:{linear:Prototype.K,sinoidal:function(a){return -Math.cos(a*Math.PI)/2+.5},reverse:function(a){return 1-a},flicker:function(a){var a=-Math.cos(a*Math.PI)/4+.75+Math.random()/4;return a>1?1:a},wobble:function(a){return -Math.cos(a*Math.PI*(9*a))/2+.5},pulse:function(b,a){return -Math.cos(b*((a||5)-.5)*2*Math.PI)/2+.5},spring:function(a){return 1-Math.cos(a*4.5*Math.PI)*Math.exp(-a*6)},none:function(){return 0},full:function(){return 1}},DefaultOptions:{duration:1,fps:100,sync:false,from:0,to:1,delay:0,queue:"parallel"},tagifyText:function(a){var b="position:relative";if(Prototype.Browser.IE)b+=";zoom:1";a=$(a);$A(a.childNodes).each(function(c){if(c.nodeType==3){c.nodeValue.toArray().each(function(d){a.insertBefore((new Element("span",{style:b})).update(d==" "?String.fromCharCode(160):d),c)});Element.remove(c)}})},multiple:function(a,e){var b;if((typeof a=="object"||Object.isFunction(a))&&a.length)b=a;else b=$(a).childNodes;var c=Object.extend({speed:.1,delay:0},arguments[2]||{}),d=c.delay;$A(b).each(function(a,b){new e(a,Object.extend(c,{delay:b*c.speed+d}))})},PAIRS:{slide:["SlideDown","SlideUp"],blind:["BlindDown","BlindUp"],appear:["Appear","Fade"]},toggle:function(a,b,c){a=$(a);b=(b||"appear").toLowerCase();return Effect[Effect.PAIRS[b][a.visible()?1:0]](a,Object.extend({queue:{position:"end",scope:a.id||"global",limit:1}},c||{}))}};Effect.DefaultOptions.transition=Effect.Transitions.sinoidal;Effect.ScopedQueue=Class.create(Enumerable,{initialize:function(){this.effects=[];this.interval=null},_each:function(a){this.effects._each(a)},add:function(a){var b=(new Date).getTime(),c=Object.isString(a.options.queue)?a.options.queue:a.options.queue.position;switch(c){case "front":this.effects.findAll(function(a){return a.state=="idle"}).each(function(b){b.startOn+=a.finishOn;b.finishOn+=a.finishOn});break;case "with-last":b=this.effects.pluck("startOn").max()||b;break;case "end":b=this.effects.pluck("finishOn").max()||b}a.startOn+=b;a.finishOn+=b;(!a.options.queue.limit||this.effects.length<a.options.queue.limit)&&this.effects.push(a);if(!this.interval)this.interval=setInterval(this.loop.bind(this),15)},remove:function(a){this.effects=this.effects.reject(function(b){return b==a});if(this.effects.length==0){clearInterval(this.interval);this.interval=null}},loop:function(){for(var b=(new Date).getTime(),a=0,c=this.effects.length;a<c;a++)this.effects[a]&&this.effects[a].loop(b)}});Effect.Queues={instances:$H(),"get":function(a){if(!Object.isString(a))return a;return this.instances.get(a)||this.instances.set(a,new Effect.ScopedQueue)}};Effect.Queue=Effect.Queues.get("global");Effect.Base=Class.create({position:null,start:function(a){if(a&&a.transition===false)a.transition=Effect.Transitions.linear;this.options=Object.extend(Object.extend({},Effect.DefaultOptions),a||{});this.currentFrame=0;this.state="idle";this.startOn=this.options.delay*1e3;this.finishOn=this.startOn+this.options.duration*1e3;this.fromToDelta=this.options.to-this.options.from;this.totalTime=this.finishOn-this.startOn;this.totalFrames=this.options.fps*this.options.duration;this.render=function(){function a(a,b){a.options[b+"Internal"]&&a.options[b+"Internal"](a);a.options[b]&&a.options[b](a)}return function(b){if(this.state==="idle"){this.state="running";a(this,"beforeSetup");this.setup&&this.setup();a(this,"afterSetup")}if(this.state==="running"){b=this.options.transition(b)*this.fromToDelta+this.options.from;this.position=b;a(this,"beforeUpdate");this.update&&this.update(b);a(this,"afterUpdate")}}}();this.event("beforeStart");!this.options.sync&&Effect.Queues.get(Object.isString(this.options.queue)?"global":this.options.queue.scope).add(this)},loop:function(a){if(a>=this.startOn){if(a>=this.finishOn){this.render(1);this.cancel();this.event("beforeFinish");this.finish&&this.finish();this.event("afterFinish");return}var c=(a-this.startOn)/this.totalTime,b=(c*this.totalFrames).round();if(b>this.currentFrame){this.render(c);this.currentFrame=b}}},cancel:function(){!this.options.sync&&Effect.Queues.get(Object.isString(this.options.queue)?"global":this.options.queue.scope).remove(this);this.state="finished"},event:function(a){this.options[a+"Internal"]&&this.options[a+"Internal"](this);this.options[a]&&this.options[a](this)},inspect:function(){var a=$H();for(property in this)!Object.isFunction(this[property])&&a.set(property,this[property]);return "#<Effect:"+a.inspect()+",options:"+$H(this.options).inspect()+">"}});Effect.Parallel=Class.create(Effect.Base,{initialize:function(a){this.effects=a||[];this.start(arguments[1])},update:function(a){this.effects.invoke("render",a)},finish:function(a){this.effects.each(function(b){b.render(1);b.cancel();b.event("beforeFinish");b.finish&&b.finish(a);b.event("afterFinish")})}});Effect.Tween=Class.create(Effect.Base,{initialize:function(a,e,f){a=Object.isString(a)?$(a):a;var c=$A(arguments),b=c.last(),d=c.length==5?c[3]:null;this.method=Object.isFunction(b)?b.bind(a):Object.isFunction(a[b])?a[b].bind(a):function(c){a[b]=c};this.start(Object.extend({from:e,to:f},d||{}))},update:function(a){this.method(a)}});Effect.Event=Class.create(Effect.Base,{initialize:function(){this.start(Object.extend({duration:0},arguments[0]||{}))},update:Prototype.emptyFunction});Effect.Opacity=Class.create(Effect.Base,{initialize:function(a){this.element=$(a);if(!this.element)throw Effect._elementDoesNotExistError;Prototype.Browser.IE&&!this.element.currentStyle.hasLayout&&this.element.setStyle({zoom:1});var b=Object.extend({from:this.element.getOpacity()||0,to:1},arguments[1]||{});this.start(b)},update:function(a){this.element.setOpacity(a)}});Effect.Move=Class.create(Effect.Base,{initialize:function(a){this.element=$(a);if(!this.element)throw Effect._elementDoesNotExistError;var b=Object.extend({x:0,y:0,mode:"relative"},arguments[1]||{});this.start(b)},setup:function(){this.element.makePositioned();this.originalLeft=parseFloat(this.element.getStyle("left")||"0");this.originalTop=parseFloat(this.element.getStyle("top")||"0");if(this.options.mode=="absolute"){this.options.x=this.options.x-this.originalLeft;this.options.y=this.options.y-this.originalTop}},update:function(a){this.element.setStyle({left:(this.options.x*a+this.originalLeft).round()+"px",top:(this.options.y*a+this.originalTop).round()+"px"})}});Effect.MoveBy=function(a,c,b){return new Effect.Move(a,Object.extend({x:b,y:c},arguments[3]||{}))};Effect.Scale=Class.create(Effect.Base,{initialize:function(a,c){this.element=$(a);if(!this.element)throw Effect._elementDoesNotExistError;var b=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:"box",scaleFrom:100,scaleTo:c},arguments[2]||{});this.start(b)},setup:function(){this.restoreAfterFinish=this.options.restoreAfterFinish||false;this.elementPositioning=this.element.getStyle("position");this.originalStyle={};["top","left","width","height","fontSize"].each(function(a){this.originalStyle[a]=this.element.style[a]}.bind(this));this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;var a=this.element.getStyle("font-size")||"100%";["em","px","%","pt"].each(function(b){if(a.indexOf(b)>0){this.fontSize=parseFloat(a);this.fontSizeType=b}}.bind(this));this.factor=(this.options.scaleTo-this.options.scaleFrom)/100;this.dims=null;if(this.options.scaleMode=="box")this.dims=[this.element.offsetHeight,this.element.offsetWidth];if(/^content/.test(this.options.scaleMode))this.dims=[this.element.scrollHeight,this.element.scrollWidth];if(!this.dims)this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth]},update:function(b){var a=this.options.scaleFrom/100+this.factor*b;this.options.scaleContent&&this.fontSize&&this.element.setStyle({fontSize:this.fontSize*a+this.fontSizeType});this.setDimensions(this.dims[0]*a,this.dims[1]*a)},finish:function(){this.restoreAfterFinish&&this.element.setStyle(this.originalStyle)},setDimensions:function(b,d){var a={};if(this.options.scaleX)a.width=d.round()+"px";if(this.options.scaleY)a.height=b.round()+"px";if(this.options.scaleFromCenter){var e=(b-this.dims[0])/2,c=(d-this.dims[1])/2;if(this.elementPositioning=="absolute"){if(this.options.scaleY)a.top=this.originalTop-e+"px";if(this.options.scaleX)a.left=this.originalLeft-c+"px"}else{if(this.options.scaleY)a.top=-e+"px";if(this.options.scaleX)a.left=-c+"px"}}this.element.setStyle(a)}});Effect.Highlight=Class.create(Effect.Base,{initialize:function(a){this.element=$(a);if(!this.element)throw Effect._elementDoesNotExistError;var b=Object.extend({startcolor:"#ffff99"},arguments[1]||{});this.start(b)},setup:function(){if(this.element.getStyle("display")=="none"){this.cancel();return}this.oldStyle={};if(!this.options.keepBackgroundImage){this.oldStyle.backgroundImage=this.element.getStyle("background-image");this.element.setStyle({backgroundImage:"none"})}if(!this.options.endcolor)this.options.endcolor=this.element.getStyle("background-color").parseColor("#ffffff");if(!this.options.restorecolor)this.options.restorecolor=this.element.getStyle("background-color");this._base=$R(0,2).map(function(a){return parseInt(this.options.startcolor.slice(a*2+1,a*2+3),16)}.bind(this));this._delta=$R(0,2).map(function(a){return parseInt(this.options.endcolor.slice(a*2+1,a*2+3),16)-this._base[a]}.bind(this))},update:function(a){this.element.setStyle({backgroundColor:$R(0,2).inject("#",function(c,d,b){return c+(this._base[b]+this._delta[b]*a).round().toColorPart()}.bind(this))})},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}))}});Effect.ScrollTo=function(d){var a=arguments[1]||{},c=document.viewport.getScrollOffsets(),b=$(d).cumulativeOffset();if(a.offset)b[1]+=a.offset;return new Effect.Tween(null,c.top,b[1],a,function(a){scrollTo(c.left,a.round())})};Effect.Fade=function(a){a=$(a);var b=a.getInlineOpacity(),c=Object.extend({from:a.getOpacity()||1,to:0,afterFinishInternal:function(a){if(a.options.to!=0)return;a.element.hide().setStyle({opacity:b})}},arguments[1]||{});return new Effect.Opacity(a,c)};Effect.Appear=function(a){a=$(a);var b=Object.extend({from:a.getStyle("display")=="none"?0:a.getOpacity()||0,to:1,afterFinishInternal:function(a){a.element.forceRerendering()},beforeSetup:function(a){a.element.setOpacity(a.options.from).show()}},arguments[1]||{});return new Effect.Opacity(a,b)};Effect.Puff=function(a){a=$(a);var b={opacity:a.getInlineOpacity(),position:a.getStyle("position"),top:a.style.top,left:a.style.left,width:a.style.width,height:a.style.height};return new Effect.Parallel([new Effect.Scale(a,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(a,{sync:true,to:0})],Object.extend({duration:1,beforeSetupInternal:function(a){Position.absolutize(a.effects[0].element)},afterFinishInternal:function(a){a.effects[0].element.hide().setStyle(b)}},arguments[1]||{}))};Effect.BlindUp=function(a){a=$(a);a.makeClipping();return new Effect.Scale(a,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(a){a.element.hide().undoClipping()}},arguments[1]||{}))};Effect.BlindDown=function(a){a=$(a);var b=a.getDimensions();return new Effect.Scale(a,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:b.height,originalWidth:b.width},restoreAfterFinish:true,afterSetup:function(a){a.element.makeClipping().setStyle({height:"0px"}).show()},afterFinishInternal:function(a){a.element.undoClipping()}},arguments[1]||{}))};Effect.SwitchOff=function(a){a=$(a);var b=a.getInlineOpacity();return new Effect.Appear(a,Object.extend({duration:.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(a){new Effect.Scale(a.element,1,{duration:.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(a){a.element.makePositioned().makeClipping()},afterFinishInternal:function(a){a.element.hide().undoClipping().undoPositioned().setStyle({opacity:b})}})}},arguments[1]||{}))};Effect.DropOut=function(a){a=$(a);var b={top:a.getStyle("top"),left:a.getStyle("left"),opacity:a.getInlineOpacity()};return new Effect.Parallel([new Effect.Move(a,{x:0,y:100,sync:true}),new Effect.Opacity(a,{sync:true,to:0})],Object.extend({duration:.5,beforeSetup:function(a){a.effects[0].element.makePositioned()},afterFinishInternal:function(a){a.effects[0].element.hide().undoPositioned().setStyle(b)}},arguments[1]||{}))};Effect.Shake=function(c){c=$(c);var d=Object.extend({distance:20,duration:.5},arguments[1]||{}),a=parseFloat(d.distance),b=parseFloat(d.duration)/10,e={top:c.getStyle("top"),left:c.getStyle("left")};return new Effect.Move(c,{x:a,y:0,duration:b,afterFinishInternal:function(c){new Effect.Move(c.element,{x:-a*2,y:0,duration:b*2,afterFinishInternal:function(c){new Effect.Move(c.element,{x:a*2,y:0,duration:b*2,afterFinishInternal:function(c){new Effect.Move(c.element,{x:-a*2,y:0,duration:b*2,afterFinishInternal:function(c){new Effect.Move(c.element,{x:a*2,y:0,duration:b*2,afterFinishInternal:function(c){new Effect.Move(c.element,{x:-a,y:0,duration:b,afterFinishInternal:function(a){a.element.undoPositioned().setStyle(e)}})}})}})}})}})}})};Effect.SlideDown=function(a){a=$(a).cleanWhitespace();var c=a.down().getStyle("bottom"),b=a.getDimensions();return new Effect.Scale(a,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:b.height,originalWidth:b.width},restoreAfterFinish:true,afterSetup:function(a){a.element.makePositioned();a.element.down().makePositioned();window.opera&&a.element.setStyle({top:""});a.element.makeClipping().setStyle({height:"0px"}).show()},afterUpdateInternal:function(a){a.element.down().setStyle({bottom:a.dims[0]-a.element.clientHeight+"px"})},afterFinishInternal:function(a){a.element.undoClipping().undoPositioned();a.element.down().undoPositioned().setStyle({bottom:c})}},arguments[1]||{}))};Effect.SlideUp=function(a){a=$(a).cleanWhitespace();var c=a.down().getStyle("bottom"),b=a.getDimensions();return new Effect.Scale(a,window.opera?0:1,Object.extend({scaleContent:false,scaleX:false,scaleMode:"box",scaleFrom:100,scaleMode:{originalHeight:b.height,originalWidth:b.width},restoreAfterFinish:true,afterSetup:function(a){a.element.makePositioned();a.element.down().makePositioned();window.opera&&a.element.setStyle({top:""});a.element.makeClipping().show()},afterUpdateInternal:function(a){a.element.down().setStyle({bottom:a.dims[0]-a.element.clientHeight+"px"})},afterFinishInternal:function(a){a.element.hide().undoClipping().undoPositioned();a.element.down().undoPositioned().setStyle({bottom:c})}},arguments[1]||{}))};Effect.Squish=function(a){return new Effect.Scale(a,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(a){a.element.makeClipping()},afterFinishInternal:function(a){a.element.hide().undoClipping()}})};Effect.Grow=function(b){b=$(b);var g=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{}),h={top:b.style.top,left:b.style.left,height:b.style.height,width:b.style.width,opacity:b.getInlineOpacity()},a=b.getDimensions(),c,d,e,f;switch(g.direction){case "top-left":c=d=e=f=0;break;case "top-right":c=a.width;d=f=0;e=-a.width;break;case "bottom-left":c=e=0;d=a.height;f=-a.height;break;case "bottom-right":c=a.width;d=a.height;e=-a.width;f=-a.height;break;case "center":c=a.width/2;d=a.height/2;e=-a.width/2;f=-a.height/2}return new Effect.Move(b,{x:c,y:d,duration:.01,beforeSetup:function(a){a.element.hide().makeClipping().makePositioned()},afterFinishInternal:function(b){new Effect.Parallel([new Effect.Opacity(b.element,{sync:true,to:1,from:0,transition:g.opacityTransition}),new Effect.Move(b.element,{x:e,y:f,sync:true,transition:g.moveTransition}),new Effect.Scale(b.element,100,{scaleMode:{originalHeight:a.height,originalWidth:a.width},sync:true,scaleFrom:window.opera?1:0,transition:g.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(a){a.effects[0].element.setStyle({height:"0px"}).show()},afterFinishInternal:function(a){a.effects[0].element.undoClipping().undoPositioned().setStyle(h)}},g))}})};Effect.Shrink=function(a){a=$(a);var e=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{}),f={top:a.style.top,left:a.style.left,height:a.style.height,width:a.style.width,opacity:a.getInlineOpacity()},d=a.getDimensions(),b,c;switch(e.direction){case "top-left":b=c=0;break;case "top-right":b=d.width;c=0;break;case "bottom-left":b=0;c=d.height;break;case "bottom-right":b=d.width;c=d.height;break;case "center":b=d.width/2;c=d.height/2}return new Effect.Parallel([new Effect.Opacity(a,{sync:true,to:0,from:1,transition:e.opacityTransition}),new Effect.Scale(a,window.opera?1:0,{sync:true,transition:e.scaleTransition,restoreAfterFinish:true}),new Effect.Move(a,{x:b,y:c,sync:true,transition:e.moveTransition})],Object.extend({beforeStartInternal:function(a){a.effects[0].element.makePositioned().makeClipping()},afterFinishInternal:function(a){a.effects[0].element.hide().undoClipping().undoPositioned().setStyle(f)}},e))};Effect.Pulsate=function(a){a=$(a);var b=arguments[1]||{},c=a.getInlineOpacity(),d=b.transition||Effect.Transitions.linear,e=function(a){return 1-d(-Math.cos(a*(b.pulses||5)*2*Math.PI)/2+.5)};return new Effect.Opacity(a,Object.extend(Object.extend({duration:2,from:0,afterFinishInternal:function(a){a.element.setStyle({opacity:c})}},b),{transition:e}))};Effect.Fold=function(a){a=$(a);var b={top:a.style.top,left:a.style.left,width:a.style.width,height:a.style.height};a.makeClipping();return new Effect.Scale(a,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(){new Effect.Scale(a,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(a){a.element.hide().undoClipping().setStyle(b)}})}},arguments[1]||{}))};Effect.Morph=Class.create(Effect.Base,{initialize:function(b){this.element=$(b);if(!this.element)throw Effect._elementDoesNotExistError;var a=Object.extend({style:{}},arguments[1]||{});if(!Object.isString(a.style))this.style=$H(a.style);else if(a.style.include(":"))this.style=a.style.parseStyle();else{this.element.addClassName(a.style);this.style=$H(this.element.getStyles());this.element.removeClassName(a.style);var c=this.element.getStyles();this.style=this.style.reject(function(a){return a.value==c[a.key]});a.afterFinishInternal=function(a){a.element.addClassName(a.options.style);a.transforms.each(function(b){a.element.style[b.style]=""})}}this.start(a)},setup:function(){function a(a){if(!a||["rgba(0, 0, 0, 0)","transparent"].include(a))a="#ffffff";a=a.parseColor();return $R(0,2).map(function(b){return parseInt(a.slice(b*2+1,b*2+3),16)})}this.transforms=this.style.map(function(g){var e=g[0],b=g[1],c=null;if(b.parseColor("#zzzzzz")!="#zzzzzz"){b=b.parseColor();c="color"}else if(e=="opacity"){b=parseFloat(b);Prototype.Browser.IE&&!this.element.currentStyle.hasLayout&&this.element.setStyle({zoom:1})}else if(Element.CSS_LENGTH.test(b)){var d=b.match(/^([\+\-]?[0-9\.]+)(.*)$/);b=parseFloat(d[1]);c=d.length==3?d[2]:null}var f=this.element.getStyle(e);return {style:e.camelize(),originalValue:c=="color"?a(f):parseFloat(f||0),targetValue:c=="color"?a(b):b,unit:c}}.bind(this)).reject(function(a){return a.originalValue==a.targetValue||a.unit!="color"&&(isNaN(a.originalValue)||isNaN(a.targetValue))})},update:function(b){var c={},a,d=this.transforms.length;while(d--)c[(a=this.transforms[d]).style]=a.unit=="color"?"#"+Math.round(a.originalValue[0]+(a.targetValue[0]-a.originalValue[0])*b).toColorPart()+Math.round(a.originalValue[1]+(a.targetValue[1]-a.originalValue[1])*b).toColorPart()+Math.round(a.originalValue[2]+(a.targetValue[2]-a.originalValue[2])*b).toColorPart():(a.originalValue+(a.targetValue-a.originalValue)*b).toFixed(3)+(a.unit===null?"":a.unit);this.element.setStyle(c,true)}});Effect.Transform=Class.create({initialize:function(a){this.tracks=[];this.options=arguments[1]||{};this.addTracks(a)},addTracks:function(a){a.each(function(a){a=$H(a);var b=a.values().first();this.tracks.push($H({ids:a.keys().first(),effect:Effect.Morph,options:{style:b}}))}.bind(this));return this},play:function(){return new Effect.Parallel(this.tracks.map(function(a){var b=a.get("ids"),e=a.get("effect"),d=a.get("options"),c=[$(b)||$$(b)].flatten();return c.map(function(a){return new e(a,Object.extend({sync:true},d))})}).flatten(),this.options)}});Element.CSS_PROPERTIES=$w("backgroundColor backgroundPosition borderBottomColor borderBottomStyle borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth borderRightColor borderRightStyle borderRightWidth borderSpacing borderTopColor borderTopStyle borderTopWidth bottom clip color fontSize fontWeight height left letterSpacing lineHeight marginBottom marginLeft marginRight marginTop markerOffset maxHeight maxWidth minHeight minWidth opacity outlineColor outlineOffset outlineWidth paddingBottom paddingLeft paddingRight paddingTop right textIndent top width wordSpacing zIndex");Element.CSS_LENGTH=/^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;String.__parseStyleElement=document.createElement("div");String.prototype.parseStyle=function(){var a,b=$H();if(Prototype.Browser.WebKit)a=(new Element("div",{style:this})).style;else{String.__parseStyleElement.innerHTML='<div style="'+this+'"></div>';a=String.__parseStyleElement.childNodes[0].style}Element.CSS_PROPERTIES.each(function(c){a[c]&&b.set(c,a[c])});Prototype.Browser.IE&&this.include("opacity")&&b.set("opacity",this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]);return b};if(document.defaultView&&document.defaultView.getComputedStyle)Element.getStyles=function(a){var b=document.defaultView.getComputedStyle($(a),null);return Element.CSS_PROPERTIES.inject({},function(c,a){c[a]=b[a];return c})};else Element.getStyles=function(a){a=$(a);var c=a.currentStyle,b;b=Element.CSS_PROPERTIES.inject({},function(b,a){b[a]=c[a];return b});if(!b.opacity)b.opacity=a.getOpacity();return b};Effect.Methods={morph:function(a,b){a=$(a);new Effect.Morph(a,Object.extend({style:b},arguments[2]||{}));return a},visualEffect:function(a,d,c){a=$(a);var b=d.dasherize().camelize(),e=b.charAt(0).toUpperCase()+b.substring(1);new Effect[e](a,c);return a},highlight:function(a,b){a=$(a);new Effect.Highlight(a,b);return a}};$w("fade appear grow shrink fold blindUp blindDown slideUp slideDown pulsate shake puff squish switchOff dropOut").each(function(a){Effect.Methods[a]=function(b,c){b=$(b);Effect[a.charAt(0).toUpperCase()+a.substring(1)](b,c);return b}});$w("getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles").each(function(a){Effect.Methods[a]=Element[a]});Element.addMethods(Effect.Methods);if(typeof Effect=="undefined")throw"controls.js requires including script.aculo.us' effects.js library";var Autocompleter={};Autocompleter.Base=Class.create({baseInitialize:function(a,c,b){a=$(a);this.element=a;this.update=$(c);this.hasFocus=false;this.changed=false;this.active=false;this.index=0;this.entryCount=0;this.oldElementValue=this.element.value;if(this.setOptions)this.setOptions(b);else this.options=b||{};this.options.paramName=this.options.paramName||this.element.name;this.options.tokens=this.options.tokens||[];this.options.frequency=this.options.frequency||.4;this.options.minChars=this.options.minChars||1;this.options.onShow=this.options.onShow||function(b,a){if(!a.style.position||a.style.position=="absolute"){a.style.position="absolute";Position.clone(b,a,{setHeight:false,offsetTop:b.offsetHeight})}Effect.Appear(a,{duration:.15})};this.options.onHide=this.options.onHide||function(b,a){new Effect.Fade(a,{duration:.15})};if(typeof this.options.tokens=="string")this.options.tokens=new Array(this.options.tokens);!this.options.tokens.include("\n")&&this.options.tokens.push("\n");this.observer=null;this.element.setAttribute("autocomplete","off");Element.hide(this.update);Event.observe(this.element,"blur",this.onBlur.bindAsEventListener(this));Event.observe(this.element,"keydown",this.onKeyPress.bindAsEventListener(this))},show:function(){Element.getStyle(this.update,"display")=="none"&&this.options.onShow(this.element,this.update);if(!this.iefix&&Prototype.Browser.IE&&Element.getStyle(this.update,"position")=="absolute"){new Insertion.After(this.update,'<iframe id="'+this.update.id+'_iefix" style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" src="javascript:false;" frameborder="0" scrolling="no"></iframe>');this.iefix=$(this.update.id+"_iefix")}this.iefix&&setTimeout(this.fixIEOverlapping.bind(this),50)},fixIEOverlapping:function(){Position.clone(this.update,this.iefix,{setTop:!this.update.style.height});this.iefix.style.zIndex=1;this.update.style.zIndex=2;Element.show(this.iefix)},hide:function(){this.stopIndicator();Element.getStyle(this.update,"display")!="none"&&this.options.onHide(this.element,this.update);this.iefix&&Element.hide(this.iefix)},startIndicator:function(){this.options.indicator&&Element.show(this.options.indicator)},stopIndicator:function(){this.options.indicator&&Element.hide(this.options.indicator)},onKeyPress:function(a){if(this.active)switch(a.keyCode){case Event.KEY_TAB:case Event.KEY_RETURN:this.selectEntry();Event.stop(a);case Event.KEY_ESC:this.hide();this.active=false;Event.stop(a);return;case Event.KEY_LEFT:case Event.KEY_RIGHT:return;case Event.KEY_UP:this.markPrevious();this.render();Event.stop(a);return;case Event.KEY_DOWN:this.markNext();this.render();Event.stop(a);return}else if(a.keyCode==Event.KEY_TAB||a.keyCode==Event.KEY_RETURN||Prototype.Browser.WebKit>0&&a.keyCode==0)return;this.changed=true;this.hasFocus=true;this.observer&&clearTimeout(this.observer);this.observer=setTimeout(this.onObserverEvent.bind(this),this.options.frequency*1e3)},activate:function(){this.changed=false;this.hasFocus=true;this.getUpdatedChoices()},onHover:function(b){var a=Event.findElement(b,"LI");if(this.index!=a.autocompleteIndex){this.index=a.autocompleteIndex;this.render()}Event.stop(b)},onClick:function(b){var a=Event.findElement(b,"LI");this.index=a.autocompleteIndex;this.selectEntry();this.hide()},onBlur:function(){setTimeout(this.hide.bind(this),250);this.hasFocus=false;this.active=false},render:function(){if(this.entryCount>0){for(var a=0;a<this.entryCount;a++)this.index==a?Element.addClassName(this.getEntry(a),"selected"):Element.removeClassName(this.getEntry(a),"selected");if(this.hasFocus){this.show();this.active=true}}else{this.active=false;this.hide()}},markPrevious:function(){if(this.index>0)this.index--;else this.index=this.entryCount-1;this.getEntry(this.index).scrollIntoView(true)},markNext:function(){if(this.index<this.entryCount-1)this.index++;else this.index=0;this.getEntry(this.index).scrollIntoView(false)},getEntry:function(a){return this.update.firstChild.childNodes[a]},getCurrentEntry:function(){return this.getEntry(this.index)},selectEntry:function(){this.active=false;this.updateElement(this.getCurrentEntry())},updateElement:function(a){if(this.options.updateElement){this.options.updateElement(a);return}var c="";if(this.options.select){var f=$(a).select("."+this.options.select)||[];if(f.length>0)c=Element.collectTextNodes(f[0],this.options.select)}else c=Element.collectTextNodesIgnoreClass(a,"informal");var b=this.getTokenBounds();if(b[0]!=-1){var e=this.element.value.substr(0,b[0]),d=this.element.value.substr(b[0]).match(/^\s+/);if(d)e+=d[0];this.element.value=e+c+this.element.value.substr(b[1])}else this.element.value=c;this.oldElementValue=this.element.value;this.element.focus();this.options.afterUpdateElement&&this.options.afterUpdateElement(this.element,a)},updateChoices:function(c){if(!this.changed&&this.hasFocus){this.update.innerHTML=c;Element.cleanWhitespace(this.update);Element.cleanWhitespace(this.update.down());if(this.update.firstChild&&this.update.down().childNodes){this.entryCount=this.update.down().childNodes.length;for(var a=0;a<this.entryCount;a++){var b=this.getEntry(a);b.autocompleteIndex=a;this.addObservers(b)}}else this.entryCount=0;this.stopIndicator();this.index=0;if(this.entryCount==1&&this.options.autoSelect){this.selectEntry();this.hide()}else this.render()}},addObservers:function(a){Event.observe(a,"mouseover",this.onHover.bindAsEventListener(this));Event.observe(a,"click",this.onClick.bindAsEventListener(this))},onObserverEvent:function(){this.changed=false;this.tokenBounds=null;if(this.getToken().length>=this.options.minChars)this.getUpdatedChoices();else{this.active=false;this.hide()}this.oldElementValue=this.element.value},getToken:function(){var a=this.getTokenBounds();return this.element.value.substring(a[0],a[1]).strip()},getTokenBounds:function(){if(null!=this.tokenBounds)return this.tokenBounds;var b=this.element.value;if(b.strip().empty())return [-1,0];for(var f=arguments.callee.getFirstDifferencePos(b,this.oldElementValue),g=f==this.oldElementValue.length?1:0,e=-1,d=b.length,a,c=0,h=this.options.tokens.length;c<h;++c){a=b.lastIndexOf(this.options.tokens[c],f+g-1);if(a>e)e=a;a=b.indexOf(this.options.tokens[c],f+g);if(-1!=a&&a<d)d=a}return this.tokenBounds=[e+1,d]}});Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos=function(c,d){for(var b=Math.min(c.length,d.length),a=0;a<b;++a)if(c[a]!=d[a])return a;return b};Ajax.Autocompleter=Class.create(Autocompleter.Base,{initialize:function(a,c,d,b){this.baseInitialize(a,c,b);this.options.asynchronous=true;this.options.onComplete=this.onComplete.bind(this);this.options.defaultParams=this.options.parameters||null;this.url=d},getUpdatedChoices:function(){this.startIndicator();var a=encodeURIComponent(this.options.paramName)+"="+encodeURIComponent(this.getToken());this.options.parameters=this.options.callback?this.options.callback(this.element,a):a;if(this.options.defaultParams)this.options.parameters+="&"+this.options.defaultParams;new Ajax.Request(this.url,this.options)},onComplete:function(a){this.updateChoices(a.responseText)}});Autocompleter.Local=Class.create(Autocompleter.Base,{initialize:function(a,c,d,b){this.baseInitialize(a,c,b);this.options.array=d},getUpdatedChoices:function(){this.updateChoices(this.options.selector(this))},setOptions:function(a){this.options=Object.extend({choices:10,partialSearch:true,partialChars:2,ignoreCase:true,fullSearch:false,selector:function(c){for(var e=[],f=[],d=c.getToken(),h=0,g=0;g<c.options.array.length&&e.length<c.options.choices;g++){var a=c.options.array[g],b=c.options.ignoreCase?a.toLowerCase().indexOf(d.toLowerCase()):a.indexOf(d);while(b!=-1){if(b==0&&a.length!=d.length){e.push("<li><strong>"+a.substr(0,d.length)+"</strong>"+a.substr(d.length)+"</li>");break}else if(d.length>=c.options.partialChars&&c.options.partialSearch&&b!=-1)if(c.options.fullSearch||/\s/.test(a.substr(b-1,1))){f.push("<li>"+a.substr(0,b)+"<strong>"+a.substr(b,d.length)+"</strong>"+a.substr(b+d.length)+"</li>");break}b=c.options.ignoreCase?a.toLowerCase().indexOf(d.toLowerCase(),b+1):a.indexOf(d,b+1)}}if(f.length)e=e.concat(f.slice(0,c.options.choices-e.length));return "<ul>"+e.join("")+"</ul>"}},a||{})}});Field.scrollFreeActivate=function(a){setTimeout(function(){Field.activate(a)},1)};Ajax.InPlaceEditor=Class.create({initialize:function(a,c,b){this.url=c;this.element=a=$(a);this.prepareOptions();this._controls={};arguments.callee.dealWithDeprecatedOptions(b);Object.extend(this.options,b||{});if(!this.options.formId&&this.element.id){this.options.formId=this.element.id+"-inplaceeditor";if($(this.options.formId))this.options.formId=""}if(this.options.externalControl)this.options.externalControl=$(this.options.externalControl);if(!this.options.externalControl)this.options.externalControlOnly=false;this._originalBackground=this.element.getStyle("background-color")||"transparent";this.element.title=this.options.clickToEditText;this._boundCancelHandler=this.handleFormCancellation.bind(this);this._boundComplete=(this.options.onComplete||Prototype.emptyFunction).bind(this);this._boundFailureHandler=this.handleAJAXFailure.bind(this);this._boundSubmitHandler=this.handleFormSubmission.bind(this);this._boundWrapperHandler=this.wrapUp.bind(this);this.registerListeners()},checkForEscapeOrReturn:function(a){if(!this._editing||a.ctrlKey||a.altKey||a.shiftKey)return;if(Event.KEY_ESC==a.keyCode)this.handleFormCancellation(a);else Event.KEY_RETURN==a.keyCode&&this.handleFormSubmission(a)},createControl:function(a,g,d){var e=this.options[a+"Control"],f=this.options[a+"Text"];if("button"==e){var c=document.createElement("input");c.type="submit";c.value=f;c.className="editor_"+a+"_button";if("cancel"==a)c.onclick=this._boundCancelHandler;this._form.appendChild(c);this._controls[a]=c}else if("link"==e){var b=document.createElement("a");b.href="#";b.appendChild(document.createTextNode(f));b.onclick="cancel"==a?this._boundCancelHandler:this._boundSubmitHandler;b.className="editor_"+a+"_link";if(d)b.className+=" "+d;this._form.appendChild(b);this._controls[a]=b}},createEditField:function(){var c=this.options.loadTextURL?this.options.loadingText:this.getText(),a;if(1>=this.options.rows&&!/\r|\n/.test(this.getText())){a=document.createElement("input");a.type="text";var b=this.options.size||this.options.cols||0;if(0<b)a.size=b}else{a=document.createElement("textarea");a.rows=1>=this.options.rows?this.options.autoRows:this.options.rows;a.cols=this.options.cols||40}a.name=this.options.paramName;a.value=c;a.className="editor_field";if(this.options.submitOnBlur)a.onblur=this._boundSubmitHandler;this._controls.editor=a;this.options.loadTextURL&&this.loadExternalText();this._form.appendChild(this._controls.editor)},createForm:function(){var b=this;function a(d,c){var a=b.options["text"+d+"Controls"];if(!a||c===false)return;b._form.appendChild(document.createTextNode(a))}this._form=$(document.createElement("form"));this._form.id=this.options.formId;this._form.addClassName(this.options.formClassName);this._form.onsubmit=this._boundSubmitHandler;this.createEditField();"textarea"==this._controls.editor.tagName.toLowerCase()&&this._form.appendChild(document.createElement("br"));this.options.onFormCustomization&&this.options.onFormCustomization(this,this._form);a("Before",this.options.okControl||this.options.cancelControl);this.createControl("ok",this._boundSubmitHandler);a("Between",this.options.okControl&&this.options.cancelControl);this.createControl("cancel",this._boundCancelHandler,"editor_cancel");a("After",this.options.okControl||this.options.cancelControl)},destroy:function(){if(this._oldInnerHTML)this.element.innerHTML=this._oldInnerHTML;this.leaveEditMode();this.unregisterListeners()},enterEditMode:function(a){if(this._saving||this._editing)return;this._editing=true;this.triggerCallback("onEnterEditMode");this.options.externalControl&&this.options.externalControl.hide();this.element.hide();this.createForm();this.element.parentNode.insertBefore(this._form,this.element);!this.options.loadTextURL&&this.postProcessEditField();a&&Event.stop(a)},enterHover:function(){this.options.hoverClassName&&this.element.addClassName(this.options.hoverClassName);if(this._saving)return;this.triggerCallback("onEnterHover")},getText:function(){return this.element.innerHTML.unescapeHTML()},handleAJAXFailure:function(a){this.triggerCallback("onFailure",a);if(this._oldInnerHTML){this.element.innerHTML=this._oldInnerHTML;this._oldInnerHTML=null}},handleFormCancellation:function(a){this.wrapUp();a&&Event.stop(a)},handleFormSubmission:function(c){var e=this._form,d=$F(this._controls.editor);this.prepareSubmission();var a=this.options.callback(e,d)||"";if(Object.isString(a))a=a.toQueryParams();a.editorId=this.element.id;if(this.options.htmlResponse){var b=Object.extend({evalScripts:true},this.options.ajaxOptions);Object.extend(b,{parameters:a,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});new Ajax.Updater({success:this.element},this.url,b)}else{var b=Object.extend({method:"get"},this.options.ajaxOptions);Object.extend(b,{parameters:a,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});new Ajax.Request(this.url,b)}c&&Event.stop(c)},leaveEditMode:function(){this.element.removeClassName(this.options.savingClassName);this.removeForm();this.leaveHover();this.element.style.backgroundColor=this._originalBackground;this.element.show();this.options.externalControl&&this.options.externalControl.show();this._saving=false;this._editing=false;this._oldInnerHTML=null;this.triggerCallback("onLeaveEditMode")},leaveHover:function(){this.options.hoverClassName&&this.element.removeClassName(this.options.hoverClassName);if(this._saving)return;this.triggerCallback("onLeaveHover")},loadExternalText:function(){this._form.addClassName(this.options.loadingClassName);this._controls.editor.disabled=true;var a=Object.extend({method:"get"},this.options.ajaxOptions);Object.extend(a,{parameters:"editorId="+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(b){this._form.removeClassName(this.options.loadingClassName);var a=b.responseText;if(this.options.stripLoadedTextTags)a=a.stripTags();this._controls.editor.value=a;this._controls.editor.disabled=false;this.postProcessEditField()}.bind(this),onFailure:this._boundFailureHandler});new Ajax.Request(this.options.loadTextURL,a)},postProcessEditField:function(){var a=this.options.fieldPostCreation;a&&$(this._controls.editor)["focus"==a?"focus":"activate"]()},prepareOptions:function(){this.options=Object.clone(Ajax.InPlaceEditor.DefaultOptions);Object.extend(this.options,Ajax.InPlaceEditor.DefaultCallbacks);[this._extraDefaultOptions].flatten().compact().each(function(a){Object.extend(this.options,a)}.bind(this))},prepareSubmission:function(){this._saving=true;this.removeForm();this.leaveHover();this.showSaving()},registerListeners:function(){this._listeners={};var a;$H(Ajax.InPlaceEditor.Listeners).each(function(b){a=this[b.value].bind(this);this._listeners[b.key]=a;!this.options.externalControlOnly&&this.element.observe(b.key,a);this.options.externalControl&&this.options.externalControl.observe(b.key,a)}.bind(this))},removeForm:function(){if(!this._form)return;this._form.remove();this._form=null;this._controls={}},showSaving:function(){this._oldInnerHTML=this.element.innerHTML;this.element.innerHTML=this.options.savingText;this.element.addClassName(this.options.savingClassName);this.element.style.backgroundColor=this._originalBackground;this.element.show()},triggerCallback:function(a,b){"function"==typeof this.options[a]&&this.options[a](this,b)},unregisterListeners:function(){$H(this._listeners).each(function(a){!this.options.externalControlOnly&&this.element.stopObserving(a.key,a.value);this.options.externalControl&&this.options.externalControl.stopObserving(a.key,a.value)}.bind(this))},wrapUp:function(a){this.leaveEditMode();this._boundComplete(a,this.element)}});Object.extend(Ajax.InPlaceEditor.prototype,{dispose:Ajax.InPlaceEditor.prototype.destroy});Ajax.InPlaceCollectionEditor=Class.create(Ajax.InPlaceEditor,{initialize:function(c,a,d,b){this._extraDefaultOptions=Ajax.InPlaceCollectionEditor.DefaultOptions;c(a,d,b)},createEditField:function(){var a=document.createElement("select");a.name=this.options.paramName;a.size=1;this._controls.editor=a;this._collection=this.options.collection||[];if(this.options.loadCollectionURL)this.loadCollection();else this.checkForExternalText();this._form.appendChild(this._controls.editor)},loadCollection:function(){this._form.addClassName(this.options.loadingClassName);this.showLoadingText(this.options.loadingCollectionText);var options=Object.extend({method:"get"},this.options.ajaxOptions);Object.extend(options,{parameters:"editorId="+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(transport){var js=transport.responseText.strip();if(!/^\[.*\]$/.test(js))throw"Server returned an invalid collection representation.";this._collection=eval(js);this.checkForExternalText()}.bind(this),onFailure:this.onFailure});new Ajax.Request(this.options.loadCollectionURL,options)},showLoadingText:function(b){this._controls.editor.disabled=true;var a=this._controls.editor.firstChild;if(!a){a=document.createElement("option");a.value="";this._controls.editor.appendChild(a);a.selected=true}a.update((b||"").stripScripts().stripTags())},checkForExternalText:function(){this._text=this.getText();if(this.options.loadTextURL)this.loadExternalText();else this.buildOptionList()},loadExternalText:function(){this.showLoadingText(this.options.loadingText);var a=Object.extend({method:"get"},this.options.ajaxOptions);Object.extend(a,{parameters:"editorId="+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(a){this._text=a.responseText.strip();this.buildOptionList()}.bind(this),onFailure:this.onFailure});new Ajax.Request(this.options.loadTextURL,a)},buildOptionList:function(){this._form.removeClassName(this.options.loadingClassName);this._collection=this._collection.map(function(a){return 2===a.length?a:[a,a].flatten()});var b="value" in this.options?this.options.value:this._text,c=this._collection.any(function(a){return a[0]==b}.bind(this));this._controls.editor.update("");var a;this._collection.each(function(d,e){a=document.createElement("option");a.value=d[0];a.selected=c?d[0]==b:0==e;a.appendChild(document.createTextNode(d[1]));this._controls.editor.appendChild(a)}.bind(this));this._controls.editor.disabled=false;Field.scrollFreeActivate(this._controls.editor)}});Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions=function(a){if(!a)return;function b(c,b){if(c in a||b===undefined)return;a[c]=b}b("cancelControl",a.cancelLink?"link":a.cancelButton?"button":a.cancelLink==a.cancelButton==false?false:undefined);b("okControl",a.okLink?"link":a.okButton?"button":a.okLink==a.okButton==false?false:undefined);b("highlightColor",a.highlightcolor);b("highlightEndColor",a.highlightendcolor)};Object.extend(Ajax.InPlaceEditor,{DefaultOptions:{ajaxOptions:{},autoRows:3,cancelControl:"link",cancelText:"cancel",clickToEditText:"Click to edit",externalControl:null,externalControlOnly:false,fieldPostCreation:"activate",formClassName:"inplaceeditor-form",formId:null,highlightColor:"#ffff99",highlightEndColor:"#ffffff",hoverClassName:"",htmlResponse:true,loadingClassName:"inplaceeditor-loading",loadingText:"Loading...",okControl:"button",okText:"ok",paramName:"value",rows:1,savingClassName:"inplaceeditor-saving",savingText:"Saving...",size:0,stripLoadedTextTags:false,submitOnBlur:false,textAfterControls:"",textBeforeControls:"",textBetweenControls:""},DefaultCallbacks:{callback:function(a){return Form.serialize(a)},onComplete:function(b,a){new Effect.Highlight(a,{startcolor:this.options.highlightColor,keepBackgroundImage:true})},onEnterEditMode:null,onEnterHover:function(a){a.element.style.backgroundColor=a.options.highlightColor;a._effect&&a._effect.cancel()},onFailure:function(a){alert("Error communication with the server: "+a.responseText.stripTags())},onFormCustomization:null,onLeaveEditMode:null,onLeaveHover:function(a){a._effect=new Effect.Highlight(a.element,{startcolor:a.options.highlightColor,endcolor:a.options.highlightEndColor,restorecolor:a._originalBackground,keepBackgroundImage:true})}},Listeners:{click:"enterEditMode",keydown:"checkForEscapeOrReturn",mouseover:"enterHover",mouseout:"leaveHover"}});Ajax.InPlaceCollectionEditor.DefaultOptions={loadingCollectionText:"Loading options..."};Form.Element.DelayedObserver=Class.create({initialize:function(b,c,a){this.delay=c||.5;this.element=$(b);this.callback=a;this.timer=null;this.lastValue=$F(this.element);Event.observe(this.element,"keyup",this.delayedListener.bindAsEventListener(this))},delayedListener:function(){if(this.lastValue==$F(this.element))return;this.timer&&clearTimeout(this.timer);this.timer=setTimeout(this.onTimerEvent.bind(this),this.delay*1e3);this.lastValue=$F(this.element)},onTimerEvent:function(){this.timer=null;this.callback(this.element,$F(this.element))}});if(Object.isUndefined(Effect))throw"dragdrop.js requires including script.aculo.us' effects.js library";var Droppables={drops:[],remove:function(a){this.drops=this.drops.reject(function(b){return b.element==$(a)})},add:function(b){b=$(b);var a=Object.extend({greedy:true,hoverclass:null,tree:false},arguments[1]||{});if(a.containment){a._containers=[];var c=a.containment;if(Object.isArray(c))c.each(function(b){a._containers.push($(b))});else a._containers.push($(c))}if(a.accept)a.accept=[a.accept].flatten();Element.makePositioned(b);a.element=b;this.drops.push(a)},findDeepestChild:function(a){deepest=a[0];for(i=1;i<a.length;++i)if(Element.isParent(a[i].element,deepest.element))deepest=a[i];return deepest},isContained:function(b,c){var a;if(c.tree)a=b.treeNode;else a=b.parentNode;return c._containers.detect(function(b){return a==b})},isAffected:function(c,b,a){return a.element!=b&&(!a._containers||this.isContained(b,a))&&(!a.accept||Element.classNames(b).detect(function(b){return a.accept.include(b)}))&&Position.within(a.element,c[0],c[1])},deactivate:function(a){a.hoverclass&&Element.removeClassName(a.element,a.hoverclass);this.last_active=null},activate:function(a){a.hoverclass&&Element.addClassName(a.element,a.hoverclass);this.last_active=a},show:function(c,d){if(!this.drops.length)return;var a,b=[];this.drops.each(function(a){Droppables.isAffected(c,d,a)&&b.push(a)});if(b.length>0)a=Droppables.findDeepestChild(b);this.last_active&&this.last_active!=a&&this.deactivate(this.last_active);if(a){Position.within(a.element,c[0],c[1]);a.onHover&&a.onHover(d,a.element,Position.overlap(a.overlap,a.element));a!=this.last_active&&Droppables.activate(a)}},fire:function(a,b){if(!this.last_active)return;Position.prepare();if(this.isAffected([Event.pointerX(a),Event.pointerY(a)],b,this.last_active))if(this.last_active.onDrop){this.last_active.onDrop(b,this.last_active.element,a);return true}},reset:function(){this.last_active&&this.deactivate(this.last_active)}},Draggables={drags:[],observers:[],register:function(a){if(this.drags.length==0){this.eventMouseUp=this.endDrag.bindAsEventListener(this);this.eventMouseMove=this.updateDrag.bindAsEventListener(this);this.eventKeypress=this.keyPress.bindAsEventListener(this);Event.observe(document,"mouseup",this.eventMouseUp);Event.observe(document,"mousemove",this.eventMouseMove);Event.observe(document,"keypress",this.eventKeypress)}this.drags.push(a)},unregister:function(a){this.drags=this.drags.reject(function(b){return b==a});if(this.drags.length==0){Event.stopObserving(document,"mouseup",this.eventMouseUp);Event.stopObserving(document,"mousemove",this.eventMouseMove);Event.stopObserving(document,"keypress",this.eventKeypress)}},activate:function(a){if(a.options.delay)this._timeout=setTimeout(function(){Draggables._timeout=null;window.focus();Draggables.activeDraggable=a}.bind(this),a.options.delay);else{window.focus();this.activeDraggable=a}},deactivate:function(){this.activeDraggable=null},updateDrag:function(b){if(!this.activeDraggable)return;var a=[Event.pointerX(b),Event.pointerY(b)];if(this._lastPointer&&this._lastPointer.inspect()==a.inspect())return;this._lastPointer=a;this.activeDraggable.updateDrag(b,a)},endDrag:function(a){if(this._timeout){clearTimeout(this._timeout);this._timeout=null}if(!this.activeDraggable)return;this._lastPointer=null;this.activeDraggable.endDrag(a);this.activeDraggable=null},keyPress:function(a){this.activeDraggable&&this.activeDraggable.keyPress(a)},addObserver:function(a){this.observers.push(a);this._cacheObserverCallbacks()},removeObserver:function(a){this.observers=this.observers.reject(function(b){return b.element==a});this._cacheObserverCallbacks()},notify:function(a,b,c){this[a+"Count"]>0&&this.observers.each(function(d){d[a]&&d[a](a,b,c)});b.options[a]&&b.options[a](b,c)},_cacheObserverCallbacks:function(){["onStart","onEnd","onDrag"].each(function(a){Draggables[a+"Count"]=Draggables.observers.select(function(b){return b[a]}).length})}},Draggable=Class.create({initialize:function(c){var b={handle:false,reverteffect:function(c,b,a){var d=Math.sqrt(Math.abs(b^2)+Math.abs(a^2))*.02;new Effect.Move(c,{x:-a,y:-b,duration:d,queue:{scope:"_draggable",position:"end"}})},endeffect:function(a){var b=Object.isNumber(a._opacity)?a._opacity:1;new Effect.Opacity(a,{duration:.2,from:.7,to:b,queue:{scope:"_draggable",position:"end"},afterFinish:function(){Draggable._dragging[a]=false}})},zindex:1e3,revert:false,quiet:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,snap:false,delay:0};(!arguments[1]||Object.isUndefined(arguments[1].endeffect))&&Object.extend(b,{starteffect:function(a){a._opacity=Element.getOpacity(a);Draggable._dragging[a]=true;new Effect.Opacity(a,{duration:.2,from:a._opacity,to:.7})}});var a=Object.extend(b,arguments[1]||{});this.element=$(c);if(a.handle&&Object.isString(a.handle))this.handle=this.element.down("."+a.handle,0);if(!this.handle)this.handle=$(a.handle);if(!this.handle)this.handle=this.element;if(a.scroll&&!a.scroll.scrollTo&&!a.scroll.outerHTML){a.scroll=$(a.scroll);this._isScrollChild=Element.childOf(this.element,a.scroll)}Element.makePositioned(this.element);this.options=a;this.dragging=false;this.eventMouseDown=this.initDrag.bindAsEventListener(this);Event.observe(this.handle,"mousedown",this.eventMouseDown);Draggables.register(this)},destroy:function(){Event.stopObserving(this.handle,"mousedown",this.eventMouseDown);Draggables.unregister(this)},currentDelta:function(){return [parseInt(Element.getStyle(this.element,"left")||"0"),parseInt(Element.getStyle(this.element,"top")||"0")]},initDrag:function(a){if(!Object.isUndefined(Draggable._dragging[this.element])&&Draggable._dragging[this.element])return;if(Event.isLeftClick(a)){var d=Event.element(a);if((tag_name=d.tagName.toUpperCase())&&(tag_name=="INPUT"||tag_name=="SELECT"||tag_name=="OPTION"||tag_name=="BUTTON"||tag_name=="TEXTAREA"))return;var b=[Event.pointerX(a),Event.pointerY(a)],c=this.element.cumulativeOffset();this.offset=[0,1].map(function(a){return b[a]-c[a]});Draggables.activate(this);Event.stop(a)}},startDrag:function(b){this.dragging=true;if(!this.delta)this.delta=this.currentDelta();if(this.options.zindex){this.originalZ=parseInt(Element.getStyle(this.element,"z-index")||0);this.element.style.zIndex=this.options.zindex}if(this.options.ghosting){this._clone=this.element.cloneNode(true);this._originallyAbsolute=this.element.getStyle("position")=="absolute";!this._originallyAbsolute&&Position.absolutize(this.element);this.element.parentNode.insertBefore(this._clone,this.element)}if(this.options.scroll)if(this.options.scroll==window){var a=this._getWindowScroll(this.options.scroll);this.originalScrollLeft=a.left;this.originalScrollTop=a.top}else{this.originalScrollLeft=this.options.scroll.scrollLeft;this.originalScrollTop=this.options.scroll.scrollTop}Draggables.notify("onStart",this,b);this.options.starteffect&&this.options.starteffect(this.element)},updateDrag:function(event,pointer){!this.dragging&&this.startDrag(event);if(!this.options.quiet){Position.prepare();Droppables.show(pointer,this.element)}Draggables.notify("onDrag",this,event);this.draw(pointer);this.options.change&&this.options.change(this);if(this.options.scroll){this.stopScrolling();var p;if(this.options.scroll==window)with(this._getWindowScroll(this.options.scroll))p=[left,top,left+width,top+height];else{p=Position.page(this.options.scroll);p[0]+=this.options.scroll.scrollLeft+Position.deltaX;p[1]+=this.options.scroll.scrollTop+Position.deltaY;p.push(p[0]+this.options.scroll.offsetWidth);p.push(p[1]+this.options.scroll.offsetHeight)}var speed=[0,0];if(pointer[0]<p[0]+this.options.scrollSensitivity)speed[0]=pointer[0]-(p[0]+this.options.scrollSensitivity);if(pointer[1]<p[1]+this.options.scrollSensitivity)speed[1]=pointer[1]-(p[1]+this.options.scrollSensitivity);if(pointer[0]>p[2]-this.options.scrollSensitivity)speed[0]=pointer[0]-(p[2]-this.options.scrollSensitivity);if(pointer[1]>p[3]-this.options.scrollSensitivity)speed[1]=pointer[1]-(p[3]-this.options.scrollSensitivity);this.startScrolling(speed)}Prototype.Browser.WebKit&&window.scrollBy(0,0);Event.stop(event)},finishDrag:function(c,f){this.dragging=false;if(this.options.quiet){Position.prepare();var e=[Event.pointerX(c),Event.pointerY(c)];Droppables.show(e,this.element)}if(this.options.ghosting){!this._originallyAbsolute&&Position.relativize(this.element);delete this._originallyAbsolute;Element.remove(this._clone);this._clone=null}var b=false;if(f){b=Droppables.fire(c,this.element);if(!b)b=false}b&&this.options.onDropped&&this.options.onDropped(this.element);Draggables.notify("onEnd",this,c);var a=this.options.revert;if(a&&Object.isFunction(a))a=a(this.element);var d=this.currentDelta();if(a&&this.options.reverteffect)(b==0||a!="failure")&&this.options.reverteffect(this.element,d[1]-this.delta[1],d[0]-this.delta[0]);else this.delta=d;if(this.options.zindex)this.element.style.zIndex=this.originalZ;this.options.endeffect&&this.options.endeffect(this.element);Draggables.deactivate(this);Droppables.reset()},keyPress:function(a){if(a.keyCode!=Event.KEY_ESC)return;this.finishDrag(a,false);Event.stop(a)},endDrag:function(a){if(!this.dragging)return;this.stopScrolling();this.finishDrag(a,true);Event.stop(a)},draw:function(f){var b=this.element.cumulativeOffset();if(this.options.ghosting){var e=Position.realOffset(this.element);b[0]+=e[0]-Position.deltaX;b[1]+=e[1]-Position.deltaY}var d=this.currentDelta();b[0]-=d[0];b[1]-=d[1];if(this.options.scroll&&(this.options.scroll!=window&&this._isScrollChild)){b[0]-=this.options.scroll.scrollLeft-this.originalScrollLeft;b[1]-=this.options.scroll.scrollTop-this.originalScrollTop}var a=[0,1].map(function(a){return f[a]-b[a]-this.offset[a]}.bind(this));if(this.options.snap)if(Object.isFunction(this.options.snap))a=this.options.snap(a[0],a[1],this);else if(Object.isArray(this.options.snap))a=a.map(function(b,a){return (b/this.options.snap[a]).round()*this.options.snap[a]}.bind(this));else a=a.map(function(a){return (a/this.options.snap).round()*this.options.snap}.bind(this));var c=this.element.style;if(!this.options.constraint||this.options.constraint=="horizontal")c.left=a[0]+"px";if(!this.options.constraint||this.options.constraint=="vertical")c.top=a[1]+"px";if(c.visibility=="hidden")c.visibility=""},stopScrolling:function(){if(this.scrollInterval){clearInterval(this.scrollInterval);this.scrollInterval=null;Draggables._lastScrollPointer=null}},startScrolling:function(a){if(!(a[0]||a[1]))return;this.scrollSpeed=[a[0]*this.options.scrollSpeed,a[1]*this.options.scrollSpeed];this.lastScrolled=new Date;this.scrollInterval=setInterval(this.scroll.bind(this),10)},scroll:function(){var current=new Date,delta=current-this.lastScrolled;this.lastScrolled=current;if(this.options.scroll==window){with(this._getWindowScroll(this.options.scroll))if(this.scrollSpeed[0]||this.scrollSpeed[1]){var d=delta/1e3;this.options.scroll.scrollTo(left+d*this.scrollSpeed[0],top+d*this.scrollSpeed[1])}}else{this.options.scroll.scrollLeft+=this.scrollSpeed[0]*delta/1e3;this.options.scroll.scrollTop+=this.scrollSpeed[1]*delta/1e3}Position.prepare();Droppables.show(Draggables._lastPointer,this.element);Draggables.notify("onDrag",this);if(this._isScrollChild){Draggables._lastScrollPointer=Draggables._lastScrollPointer||$A(Draggables._lastPointer);Draggables._lastScrollPointer[0]+=this.scrollSpeed[0]*delta/1e3;Draggables._lastScrollPointer[1]+=this.scrollSpeed[1]*delta/1e3;if(Draggables._lastScrollPointer[0]<0)Draggables._lastScrollPointer[0]=0;if(Draggables._lastScrollPointer[1]<0)Draggables._lastScrollPointer[1]=0;this.draw(Draggables._lastScrollPointer)}this.options.change&&this.options.change(this)},_getWindowScroll:function(w){var T,L,W,H;with(w.document){if(w.document.documentElement&&documentElement.scrollTop){T=documentElement.scrollTop;L=documentElement.scrollLeft}else if(w.document.body){T=body.scrollTop;L=body.scrollLeft}if(w.innerWidth){W=w.innerWidth;H=w.innerHeight}else if(w.document.documentElement&&documentElement.clientWidth){W=documentElement.clientWidth;H=documentElement.clientHeight}else{W=body.offsetWidth;H=body.offsetHeight}}return {top:T,left:L,width:W,height:H}}});Draggable._dragging={};var SortableObserver=Class.create({initialize:function(b,a){this.element=$(b);this.observer=a;this.lastValue=Sortable.serialize(this.element)},onStart:function(){this.lastValue=Sortable.serialize(this.element)},onEnd:function(){Sortable.unmark();this.lastValue!=Sortable.serialize(this.element)&&this.observer(this.element)}}),Sortable={SERIALIZE_RULE:/^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/,sortables:{},_findRootElement:function(a){while(a.tagName.toUpperCase()!="BODY"){if(a.id&&Sortable.sortables[a.id])return a;a=a.parentNode}},options:function(a){a=Sortable._findRootElement($(a));if(!a)return;return Sortable.sortables[a.id]},destroy:function(b){b=$(b);var a=Sortable.sortables[b.id];if(a){Draggables.removeObserver(a.element);a.droppables.each(function(a){Droppables.remove(a)});a.draggables.invoke("destroy");delete Sortable.sortables[a.element.id]}},create:function(b){b=$(b);var a=Object.extend({element:b,tag:"li",dropOnEmpty:false,tree:false,treeTag:"ul",overlap:"vertical",constraint:"vertical",containment:b,handle:false,only:false,delay:0,hoverclass:null,ghosting:false,quiet:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,format:this.SERIALIZE_RULE,elements:false,handles:false,onChange:Prototype.emptyFunction,onUpdate:Prototype.emptyFunction},arguments[1]||{});this.destroy(b);var c={revert:true,quiet:a.quiet,scroll:a.scroll,scrollSpeed:a.scrollSpeed,scrollSensitivity:a.scrollSensitivity,delay:a.delay,ghosting:a.ghosting,constraint:a.constraint,handle:a.handle};if(a.starteffect)c.starteffect=a.starteffect;if(a.reverteffect)c.reverteffect=a.reverteffect;else if(a.ghosting)c.reverteffect=function(a){a.style.top=0;a.style.left=0};if(a.endeffect)c.endeffect=a.endeffect;if(a.zindex)c.zindex=a.zindex;var e={overlap:a.overlap,containment:a.containment,tree:a.tree,hoverclass:a.hoverclass,onHover:Sortable.onHover},d={onHover:Sortable.onEmptyHover,overlap:a.overlap,containment:a.containment,hoverclass:a.hoverclass};Element.cleanWhitespace(b);a.draggables=[];a.droppables=[];if(a.dropOnEmpty||a.tree){Droppables.add(b,d);a.droppables.push(b)}(a.elements||this.findElements(b,a)||[]).each(function(d,g){var f=a.handles?$(a.handles[g]):a.handle?$(d).select("."+a.handle)[0]:d;a.draggables.push(new Draggable(d,Object.extend(c,{handle:f})));Droppables.add(d,e);if(a.tree)d.treeNode=b;a.droppables.push(d)});a.tree&&(Sortable.findTreeElements(b,a)||[]).each(function(c){Droppables.add(c,d);c.treeNode=b;a.droppables.push(c)});this.sortables[b.identify()]=a;Draggables.addObserver(new SortableObserver(b,a.onUpdate))},findElements:function(b,a){return Element.findChildren(b,a.only,a.tree?true:false,a.tag)},findTreeElements:function(b,a){return Element.findChildren(b,a.only,a.tree?true:false,a.treeTag)},onHover:function(a,b,d){if(Element.isParent(b,a))return;if(d>.33&&d<.66&&Sortable.options(b).tree)return;else if(d>.5){Sortable.mark(b,"before");if(b.previousSibling!=a){var c=a.parentNode;a.style.visibility="hidden";b.parentNode.insertBefore(a,b);b.parentNode!=c&&Sortable.options(c).onChange(a);Sortable.options(b.parentNode).onChange(a)}}else{Sortable.mark(b,"after");var e=b.nextSibling||null;if(e!=a){var c=a.parentNode;a.style.visibility="hidden";b.parentNode.insertBefore(a,e);b.parentNode!=c&&Sortable.options(c).onChange(a);Sortable.options(b.parentNode).onChange(a)}}},onEmptyHover:function(d,e,i){var h=d.parentNode,c=Sortable.options(e);if(!Element.isParent(e,d)){var a,b=Sortable.findElements(e,{tag:c.tag,only:c.only}),g=null;if(b){var f=Element.offsetSize(e,c.overlap)*(1-i);for(a=0;a<b.length;a+=1)if(f-Element.offsetSize(b[a],c.overlap)>=0)f-=Element.offsetSize(b[a],c.overlap);else if(f-Element.offsetSize(b[a],c.overlap)/2>=0){g=a+1<b.length?b[a+1]:null;break}else{g=b[a];break}}e.insertBefore(d,g);Sortable.options(h).onChange(d);c.onChange(d)}},unmark:function(){Sortable._marker&&Sortable._marker.hide()},mark:function(b,d){var c=Sortable.options(b.parentNode);if(c&&!c.ghosting)return;if(!Sortable._marker){Sortable._marker=($("dropmarker")||Element.extend(document.createElement("DIV"))).hide().addClassName("dropmarker").setStyle({position:"absolute"});document.getElementsByTagName("body").item(0).appendChild(Sortable._marker)}var a=b.cumulativeOffset();Sortable._marker.setStyle({left:a[0]+"px",top:a[1]+"px"});if(d=="after")if(c.overlap=="horizontal")Sortable._marker.setStyle({left:a[0]+b.clientWidth+"px"});else Sortable._marker.setStyle({top:a[1]+b.clientHeight+"px"});Sortable._marker.show()},_tree:function(g,a,b){for(var e=Sortable.findElements(g,a)||[],d=0;d<e.length;++d){var f=e[d].id.match(a.format);if(!f)continue;var c={id:encodeURIComponent(f?f[1]:null),element:g,parent:b,children:[],position:b.children.length,container:$(e[d]).down(a.treeTag)};c.container&&this._tree(c.container,a,c);b.children.push(c)}return b},tree:function(a){a=$(a);var b=this.options(a),c=Object.extend({tag:b.tag,treeTag:b.treeTag,only:b.only,name:a.id,format:b.format},arguments[1]||{}),d={id:null,parent:null,children:[],container:a,position:0};return Sortable._tree(a,c,d)},_constructIndex:function(a){var b="";do if(a.id)b="["+a.position+"]"+b;while((a=a.parent)!=null);return b},sequence:function(a){a=$(a);var b=Object.extend(this.options(a),arguments[1]||{});return $(this.findElements(a,b)||[]).map(function(a){return a.id.match(b.format)?a.id.match(b.format)[1]:""})},setSequence:function(a,d){a=$(a);var c=Object.extend(this.options(a),arguments[2]||{}),b={};this.findElements(a,c).each(function(a){if(a.id.match(c.format))b[a.id.match(c.format)[1]]=[a,a.parentNode];a.parentNode.removeChild(a)});d.each(function(c){var a=b[c];if(a){a[1].appendChild(a[0]);delete b[c]}})},serialize:function(a){a=$(a);var c=Object.extend(Sortable.options(a),arguments[1]||{}),b=encodeURIComponent(arguments[1]&&arguments[1].name?arguments[1].name:a.id);if(c.tree)return Sortable.tree(a,arguments[1]).children.map(function(a){return [b+Sortable._constructIndex(a)+"[id]="+encodeURIComponent(a.id)].concat(a.children.map(arguments.callee))}).flatten().join("&");else return Sortable.sequence(a,arguments[1]).map(function(a){return b+"[]="+encodeURIComponent(a)}).join("&")}};Element.isParent=function(a,b){if(!a.parentNode||a==b)return false;if(a.parentNode==b)return true;return Element.isParent(a.parentNode,b)};Element.findChildren=function(e,a,d,c){if(!e.hasChildNodes())return null;c=c.toUpperCase();if(a)a=[a].flatten();var b=[];$A(e.childNodes).each(function(e){e.tagName&&e.tagName.toUpperCase()==c&&(!a||Element.classNames(e).detect(function(b){return a.include(b)}))&&b.push(e);if(d){var f=Element.findChildren(e,a,d,c);f&&b.push(f)}});return b.length>0?b.flatten():[]};Element.offsetSize=function(b,a){return b["offset"+(a=="vertical"||a=="height"?"Height":"Width")]};if(!Control)var Control={};Control.Slider=Class.create({initialize:function(b,d,c){var a=this;if(Object.isArray(b))this.handles=b.collect(function(a){return $(a)});else this.handles=[$(b)];this.track=$(d);this.options=c||{};this.axis=this.options.axis||"horizontal";this.increment=this.options.increment||1;this.step=parseInt(this.options.step||"1");this.range=this.options.range||$R(0,1);this.value=0;this.values=this.handles.map(function(){return 0});this.spans=this.options.spans?this.options.spans.map(function(a){return $(a)}):false;this.options.startSpan=$(this.options.startSpan||null);this.options.endSpan=$(this.options.endSpan||null);this.restricted=this.options.restricted||false;this.maximum=this.options.maximum||this.range.end;this.minimum=this.options.minimum||this.range.start;this.alignX=parseInt(this.options.alignX||"0");this.alignY=parseInt(this.options.alignY||"0");this.trackLength=this.maximumOffset()-this.minimumOffset();this.handleLength=this.isVertical()?this.handles[0].offsetHeight!=0?this.handles[0].offsetHeight:this.handles[0].style.height.replace(/px$/,""):this.handles[0].offsetWidth!=0?this.handles[0].offsetWidth:this.handles[0].style.width.replace(/px$/,"");this.active=false;this.dragging=false;this.disabled=false;this.options.disabled&&this.setDisabled();this.allowedValues=this.options.values?this.options.values.sortBy(Prototype.K):false;if(this.allowedValues){this.minimum=this.allowedValues.min();this.maximum=this.allowedValues.max()}this.eventMouseDown=this.startDrag.bindAsEventListener(this);this.eventMouseUp=this.endDrag.bindAsEventListener(this);this.eventMouseMove=this.update.bindAsEventListener(this);this.handles.each(function(c,b){b=a.handles.length-1-b;a.setValue(parseFloat((Object.isArray(a.options.sliderValue)?a.options.sliderValue[b]:a.options.sliderValue)||a.range.start),b);c.makePositioned().observe("mousedown",a.eventMouseDown)});this.track.observe("mousedown",this.eventMouseDown);document.observe("mouseup",this.eventMouseUp);document.observe("mousemove",this.eventMouseMove);this.initialized=true},dispose:function(){var a=this;Event.stopObserving(this.track,"mousedown",this.eventMouseDown);Event.stopObserving(document,"mouseup",this.eventMouseUp);Event.stopObserving(document,"mousemove",this.eventMouseMove);this.handles.each(function(b){Event.stopObserving(b,"mousedown",a.eventMouseDown)})},setDisabled:function(){this.disabled=true},setEnabled:function(){this.disabled=false},getNearestValue:function(a){if(this.allowedValues){if(a>=this.allowedValues.max())return this.allowedValues.max();if(a<=this.allowedValues.min())return this.allowedValues.min();var c=Math.abs(this.allowedValues[0]-a),b=this.allowedValues[0];this.allowedValues.each(function(e){var d=Math.abs(e-a);if(d<=c){b=e;c=d}});return b}if(a>this.range.end)return this.range.end;if(a<this.range.start)return this.range.start;return a},setValue:function(b,a){if(!this.active){this.activeHandleIdx=a||0;this.activeHandle=this.handles[this.activeHandleIdx];this.updateStyles()}a=a||this.activeHandleIdx||0;if(this.initialized&&this.restricted){if(a>0&&b<this.values[a-1])b=this.values[a-1];if(a<this.handles.length-1&&b>this.values[a+1])b=this.values[a+1]}b=this.getNearestValue(b);this.values[a]=b;this.value=this.values[0];this.handles[a].style[this.isVertical()?"top":"left"]=this.translateToPx(b);this.drawSpans();(!this.dragging||!this.event)&&this.updateFinished()},setValueBy:function(b,a){this.setValue(this.values[a||this.activeHandleIdx||0]+b,a||this.activeHandleIdx||0)},translateToPx:function(a){return Math.round((this.trackLength-this.handleLength)/(this.range.end-this.range.start)*(a-this.range.start))+"px"},translateToValue:function(a){return a/(this.trackLength-this.handleLength)*(this.range.end-this.range.start)+this.range.start},getRange:function(a){var b=this.values.sortBy(Prototype.K);a=a||0;return $R(b[a],b[a+1])},minimumOffset:function(){return this.isVertical()?this.alignY:this.alignX},maximumOffset:function(){return this.isVertical()?(this.track.offsetHeight!=0?this.track.offsetHeight:this.track.style.height.replace(/px$/,""))-this.alignY:(this.track.offsetWidth!=0?this.track.offsetWidth:this.track.style.width.replace(/px$/,""))-this.alignX},isVertical:function(){return this.axis=="vertical"},drawSpans:function(){var a=this;this.spans&&$R(0,this.spans.length-1).each(function(b){a.setSpan(a.spans[b],a.getRange(b))});this.options.startSpan&&this.setSpan(this.options.startSpan,$R(0,this.values.length>1?this.getRange(0).min():this.value));this.options.endSpan&&this.setSpan(this.options.endSpan,$R(this.values.length>1?this.getRange(this.spans.length-1).max():this.value,this.maximum))},setSpan:function(b,a){if(this.isVertical()){b.style.top=this.translateToPx(a.start);b.style.height=this.translateToPx(a.end-a.start+this.range.start)}else{b.style.left=this.translateToPx(a.start);b.style.width=this.translateToPx(a.end-a.start+this.range.start)}},updateStyles:function(){this.handles.each(function(a){Element.removeClassName(a,"selected")});Element.addClassName(this.activeHandle,"selected")},startDrag:function(d){if(Event.isLeftClick(d)){if(!this.disabled){this.active=true;var a=Event.element(d),c=[Event.pointerX(d),Event.pointerY(d)],e=a;if(e==this.track){var b=this.track.cumulativeOffset();this.event=d;this.setValue(this.translateToValue((this.isVertical()?c[1]-b[1]:c[0]-b[0])-this.handleLength/2));var b=this.activeHandle.cumulativeOffset();this.offsetX=c[0]-b[0];this.offsetY=c[1]-b[1]}else{while(this.handles.indexOf(a)==-1&&a.parentNode)a=a.parentNode;if(this.handles.indexOf(a)!=-1){this.activeHandle=a;this.activeHandleIdx=this.handles.indexOf(this.activeHandle);this.updateStyles();var b=this.activeHandle.cumulativeOffset();this.offsetX=c[0]-b[0];this.offsetY=c[1]-b[1]}}}Event.stop(d)}},update:function(a){if(this.active){if(!this.dragging)this.dragging=true;this.draw(a);Prototype.Browser.WebKit&&window.scrollBy(0,0);Event.stop(a)}},draw:function(b){var a=[Event.pointerX(b),Event.pointerY(b)],c=this.track.cumulativeOffset();a[0]-=this.offsetX+c[0];a[1]-=this.offsetY+c[1];this.event=b;this.setValue(this.translateToValue(this.isVertical()?a[1]:a[0]));this.initialized&&this.options.onSlide&&this.options.onSlide(this.values.length>1?this.values:this.value,this)},endDrag:function(a){if(this.active&&this.dragging){this.finishDrag(a,true);Event.stop(a)}this.active=false;this.dragging=false},finishDrag:function(){this.active=false;this.dragging=false;this.updateFinished()},updateFinished:function(){this.initialized&&this.options.onChange&&this.options.onChange(this.values.length>1?this.values:this.value,this);this.event=null}});var Resizables={instances:[],observers:[],register:function(a){if(this.instances.length==0){this.eventMouseUp=this.endResize.bindAsEventListener(this);this.eventMouseMove=this.updateResize.bindAsEventListener(this);Event.observe(document,"mouseup",this.eventMouseUp);Event.observe(document,"mousemove",this.eventMouseMove)}this.instances.push(a)},unregister:function(a){this.instances=this.instances.reject(function(b){return b==a});if(this.instances.length==0){Event.stopObserving(document,"mouseup",this.eventMouseUp);Event.stopObserving(document,"mousemove",this.eventMouseMove)}},activate:function(a){if(a.options.delay)this._timeout=setTimeout(function(){Resizables._timeout=null;Resizables.activeResizable=a}.bind(this),a.options.delay);else this.activeResizable=a},deactivate:function(){this.activeResizable=null},updateResize:function(b){if(!this.activeResizable)return;var a=[Event.pointerX(b),Event.pointerY(b)];if(this._lastPointer&&this._lastPointer.inspect()==a.inspect())return;this._lastPointer=a;this.activeResizable.updateResize(b,a)},endResize:function(a){if(this._timeout){clearTimeout(this._timeout);this._timeout=null}if(!this.activeResizable)return;this._lastPointer=null;this.activeResizable.endResize(a);this.activeResizable=null},addObserver:function(a){this.observers.push(a);this._cacheObserverCallbacks()},removeObserver:function(a){this.observers=this.observers.reject(function(b){return b.element==a});this._cacheObserverCallbacks()},notify:function(a,b,c){this[a+"Count"]>0&&this.observers.each(function(d){d[a]&&d[a](a,b,c)});b.options[a]&&b.options[a](b,c)},_cacheObserverCallbacks:function(){["onStart","onEnd","onResize"].each(function(a){Resizables[a+"Count"]=Resizables.observers.select(function(b){return b[a]}).length})}},Resizable=Class.create();Resizable._resizing={};Resizable.prototype={initialize:function(c){var b={handle:false,snap:false,delay:0,minHeight:false,minwidth:false,maxHeight:false,maxWidth:false};this.element=$(c);var a=Object.extend(b,arguments[1]||{});if(a.handle&&typeof a.handle=="string")this.handle=$(a.handle);else if(a.handle)this.handle=a.handle;if(!this.handle)this.handle=this.element;this.options=a;this.dragging=false;this.eventMouseDown=this.initResize.bindAsEventListener(this);Event.observe(this.handle,"mousedown",this.eventMouseDown);Resizables.register(this)},destroy:function(){Event.stopObserving(this.handle,"mousedown",this.eventMouseDown)},currentDelta:function(){return [parseInt(Element.getStyle(this.element,"width")||"0"),parseInt(Element.getStyle(this.element,"height")||"0")]},initResize:function(a){if(typeof Resizable._resizing[this.element]!="undefined"&&Resizable._resizing[this.element])return;if(Event.isLeftClick(a)){var b=Event.element(a);if((tag_name=b.tagName.toUpperCase())&&(tag_name=="INPUT"||tag_name=="SELECT"||tag_name=="OPTION"||tag_name=="BUTTON"||tag_name=="TEXTAREA"))return;this.pointer=[Event.pointerX(a),Event.pointerY(a)];this.size=[parseInt(this.element.getStyle("width"))||0,parseInt(this.element.getStyle("height"))||0];Resizables.activate(this);Event.stop(a)}},startResize:function(a){this.resizing=true;if(this.options.zindex){this.originalZ=parseInt(Element.getStyle(this.element,"z-index")||0);this.element.style.zIndex=this.options.zindex}Resizables.notify("onStart",this,a);Resizable._resizing[this.element]=true},updateResize:function(a,b){!this.resizing&&this.startResize(a);Resizables.notify("onResize",this,a);this.draw(b);this.options.change&&this.options.change(this);Prototype.Browser.WebKit&&window.scrollBy(0,0);Event.stop(a)},finishResize:function(a){this.resizing=false;Resizables.notify("onEnd",this,a);if(this.options.zindex)this.element.style.zIndex=this.originalZ;Resizable._resizing[this.element]=false;Resizables.deactivate(this)},endResize:function(a){if(!this.resizing)return;this.finishResize(a,true);Event.stop(a)},draw:function(g){var a=[0,1].map(function(a){return this.size[a]+g[a]-this.pointer[a]}.bind(this));if(this.options.snap)if(typeof this.options.snap=="function")a=this.options.snap(a[0],a[1],this);else if(this.options.snap instanceof Array)a=a.map(function(b,a){return Math.round(b/this.options.snap[a])*this.options.snap[a]}.bind(this));else a=a.map(function(a){return Math.round(a/this.options.snap)*this.options.snap}.bind(this));var f=typeof this.options.minWidth=="function"?this.options.minWidth(this.element):this.options.minWidth,e=typeof this.options.maxWidth=="function"?this.options.maxWidth(this.element):this.options.maxWidth,d=typeof this.options.minHeight=="function"?this.options.minHeight(this.element):this.options.minHeight,c=typeof this.options.maxHeight=="function"?this.options.maxHeight(this.element):this.options.maxHeight;if(f&&a[0]<=f)a[0]=f;if(e&&a[0]>=e)a[0]=e;if(d&&a[1]<=d)a[1]=d;if(c&&a[1]>=c)a[1]=c;var b=this.element.style;if(!this.options.constraint||this.options.constraint=="horizontal")b.width=a[0]+"px";if(!this.options.constraint||this.options.constraint=="vertical")b.height=a[1]+"px";if(b.visibility=="hidden")b.visibility=""}};if(typeof Control=="undefined")Control={};var $proc=function(a){return typeof a=="function"?a:function(){return a}},$value=function(a){return typeof a=="function"?a():a};Object.Event={extend:function(a){a._objectEventSetup=function(a){this._observers=this._observers||{};this._observers[a]=this._observers[a]||[]};a.observe=function(a,b){if(typeof a=="string"&&typeof b!="undefined"){this._objectEventSetup(a);!this._observers[a].include(b)&&this._observers[a].push(b)}else for(var c in a)this.observe(c,a[c])};a.stopObserving=function(a,b){this._objectEventSetup(a);if(a&&b)this._observers[a]=this._observers[a].without(b);else if(a)this._observers[a]=[];else this._observers={}};a.observeOnce=function(a,c){var b=function(){c.apply(this,arguments);this.stopObserving(a,b)}.bind(this);this._objectEventSetup(a);this._observers[a].push(b)};a.notify=function(a){this._objectEventSetup(a);var c=[],d=$A(arguments).slice(1);try{for(var b=0;b<this._observers[a].length;++b)c.push(this._observers[a][b].apply(this._observers[a][b],d)||null)}catch(e){if(e==$break)return false;else throw e}return c};if(a.prototype){a.prototype._objectEventSetup=a._objectEventSetup;a.prototype.observe=a.observe;a.prototype.stopObserving=a.stopObserving;a.prototype.observeOnce=a.observeOnce;a.prototype.notify=function(b){if(a.notify){var c=$A(arguments).slice(1);c.unshift(this);c.unshift(b);a.notify.apply(a,c)}this._objectEventSetup(b);var c=$A(arguments).slice(1),e=[];try{this.options&&this.options[b]&&typeof this.options[b]=="function"&&e.push(this.options[b].apply(this,c)||null);for(var d=0;d<this._observers[b].length;++d)e.push(this._observers[b][d].apply(this._observers[b][d],c)||null)}catch(f){if(f==$break)return false;else throw f}return e}}}};Element.addMethods({observeOnce:function(c,b,d){var a=function(){d.apply(this,arguments);Element.stopObserving(c,b,a)};Element.observe(c,b,a)}});(function(){function a(b){var c,a,d;if(b.wheelDelta)c=b.wheelDelta/120;else if(b.detail)c=-b.detail/3;if(!c)return;a=Event.extend(b).target;a=Element.extend(a.nodeType===Node.TEXT_NODE?a.parentNode:a);d=a.fire("mouse:wheel",{delta:c});if(d.stopped){Event.stop(b);return false}}document.observe("mousewheel",a);document.observe("DOMMouseScroll",a)})();var IframeShim=Class.create({initialize:function(){this.element=new Element("iframe",{style:"position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);display:none",src:"javascript:void(0);",frameborder:0});$(document.body).insert(this.element)},hide:function(){this.element.hide();return this},show:function(){this.element.show();return this},positionUnder:function(a){var a=$(a),c=a.cumulativeOffset(),b=a.getDimensions();this.element.setStyle({left:c[0]+"px",top:c[1]+"px",width:b.width+"px",height:b.height+"px",zIndex:a.getStyle("zIndex")-1}).show();return this},setBounds:function(a){for(prop in a)a[prop]+="px";this.element.setStyle(a);return this},destroy:function(){this.element&&this.element.remove();return this}});if(typeof Prototype=="undefined")throw"Control.ContextMenu requires Prototype to be loaded.";if(typeof Object.Event=="undefined")throw"Control.ContextMenu requires Object.Event to be loaded.";Control.ContextMenu=Class.create({initialize:function(a,b){Control.ContextMenu.load();this.options=Object.extend({leftClick:false,disableOnShiftKey:true,disableOnAltKey:true,selectedClassName:"selected",activatedClassName:"activated",animation:true,animationCycles:2,animationLength:300,delayCallback:true},b||{});this.activated=false;this.items=this.options.items||[];this.container=$(a);this.container.observe(this.options.leftClick?"click":Prototype.Browser.Opera?"click":"contextmenu",function(a){if(!Control.ContextMenu.enabled||Prototype.Browser.Opera&&!a.ctrlKey)return;this.open(a)}.bindAsEventListener(this))},open:function(a){if(Control.ContextMenu.current&&!Control.ContextMenu.current.close())return;if(this.notify("beforeOpen",a)===false)return false;this.buildMenu();if(this.items.length===0){this.close(a);return false}this.clicked=Event.element(a);Control.ContextMenu.current=this;Control.ContextMenu.positionContainer(a);Control.ContextMenu.container.show();if(this.notify("afterOpen",a)===false)return false;a.stop();return true},close:function(a){a&&a.stop();if(this.notify("beforeClose")===false)return false;Control.ContextMenu.current=false;this.activated=false;Control.ContextMenu.container.removeClassName(this.options.activatedClassName);Control.ContextMenu.container.select("li").invoke("stopObserving");Control.ContextMenu.container.hide();Control.ContextMenu.container.update("");if(this.notify("afterClose")===false)return false;return true},buildMenu:function(){var a=document.createElement("ul");Control.ContextMenu.container.appendChild(a);this.items.each(function(c){if(!(!c.condition||c.condition&&c.condition()!==false))return;var b=$(document.createElement("li"));b.update($value(c.label));a.appendChild(b);b[$value(c.enabled)?"removeClassName":"addClassName"]("disabled");b.observe("mousedown",function(b,a){if(!$value(a.enabled))return b.stop();this.activated=$value(a.label)}.bindAsEventListener(this,c));b.observe("click",this.selectMenuItem.bindAsEventListener(this,c,b));b.observe("contextmenu",this.selectMenuItem.bindAsEventListener(this,c,b))}.bind(this))},addItem:function(a){if(!("enabled" in a))a.enabled=true;this.items.push(a);return this},destroy:function(){this.container.stopObserving(Prototype.Browser.Opera||this.options.leftClick?"click":"contextmenu");this.items=[]},selectMenuItem:function(b,a,c){if(!$value(a.enabled))return b.stop();if(!this.activated||this.activated==$value(a.label))if(this.options.animation){Control.ContextMenu.container.addClassName(this.options.activatedClassName);$A($R(0,this.options.animationCycles*2)).each(function(a){window.setTimeout(function(){c.toggleClassName(this.options.selectedClassName)}.bind(this),a*parseInt(this.options.animationLength/(this.options.animationCycles*2),10))}.bind(this));window.setTimeout(function(){this.close()&&this.options.delayCallback&&a.callback(this.clicked)}.bind(this),this.options.animationLength);!this.options.delayCallback&&a.callback(this.clicked)}else this.close()&&a.callback(this.clicked);b.stop();return false}});Object.extend(Control.ContextMenu,{loaded:false,capture_all:false,menus:[],current:false,enabled:false,offset:4,load:function(a){if(Control.ContextMenu.loaded)return;Control.ContextMenu.loaded=true;if(typeof a=="undefined")a=false;Control.ContextMenu.capture_all=a;Control.ContextMenu.container=$(document.createElement("div"));Control.ContextMenu.container.id="control_contextmenu";Control.ContextMenu.container.style.position="absolute";Control.ContextMenu.container.style.zIndex=99999;Control.ContextMenu.container.hide();document.body.appendChild(Control.ContextMenu.container);Control.ContextMenu.enable()},enable:function(){Control.ContextMenu.enabled=true;Event.observe(document.body,"click",Control.ContextMenu.onClick);Control.ContextMenu.capture_all&&Event.observe(document.body,"contextmenu",Control.ContextMenu.onContextMenu)},disable:function(){Event.stopObserving(document.body,"click",Control.ContextMenu.onClick);Control.ContextMenu.capture_all&&Event.stopObserving(document.body,"contextmenu",Control.ContextMenu.onContextMenu)},onContextMenu:function(a){a.stop();return false},onClick:function(){Control.ContextMenu.current&&Control.ContextMenu.current.close()},positionContainer:function(g){var e=Control.ContextMenu.container.getDimensions(),d=Event.pointerY(g),c=Event.pointerX(g),f=e.height+d,h=e.width+c,b=document.viewport.getDimensions(),a=document.viewport.getScrollOffsets();if(f>b.height+a.top)d-=f-(b.height+a.top-Control.ContextMenu.offset);if(h>b.width+a.left)c-=h-(b.width+a.left-Control.ContextMenu.offset);Control.ContextMenu.container.setStyle({top:d+"px",left:c+"px"})}});Object.Event.extend(Control.ContextMenu);if(typeof Prototype=="undefined")throw"Cookie requires Prototype to be loaded.";if(typeof Object.Event=="undefined")throw"Cookie requires Object.Event to be loaded.";var Cookie={build:function(){return $A(arguments).compact().join("; ")},secondsFromNow:function(b){var a=new Date;a.setTime(a.getTime()+b*1e3);return a.toGMTString()},"set":function(c,b,a){Cookie.notify("set",c,b);var d=a?"expires="+Cookie.secondsFromNow(a):null;document.cookie=Cookie.build(c+"="+b,d,"path=/")},"get":function(b){Cookie.notify("get",b);var a=(new RegExp(b+"=([^;]+)")).exec(document.cookie);return a?a[1]:null},unset:function(a){Cookie.notify("unset",a);Cookie.set(a,"",-1)}};Object.Event.extend(Cookie);if(typeof Prototype=="undefined")throw"Event.Behavior requires Prototype to be loaded.";if(typeof Object.Event=="undefined")throw"Event.Behavior requires Object.Event to be loaded.";Event.Behavior={addVerbs:function(c){var b;for(var a in c)if(c.hasOwnProperty(a)){b=new Event.Behavior.Verb(c[a]);Event.Behavior.Verbs[a]=b;Event.Behavior[a.underscore()]=Event.Behavior[a]=b.getCallbackForStack.bind(b)}},addEvents:function(a){$H(a).each(function(a){Event.Behavior.Adjective.prototype[a.key.underscore()]=Event.Behavior.Adjective.prototype[a.key]=function(){this.nextConditionType="and";this.events.push(a.value);this.attachObserver(false);return this}})},invokeElementMethod:function(a,c,b){if(typeof a=="function")return $A(a()).each(function(a){if(typeof b[0]=="function")return $A(b[0]).each(function(b){return $(a)[c].apply($(a),b?[b]:[])});else return $(a)[c].apply($(a),b||[])});else return $(a)[c].apply($(a),b||[])}};Event.Behavior.Verbs=$H({});Event.Behavior.Verb=Class.create();Object.extend(Event.Behavior.Verb.prototype,{originalAction:false,execute:false,executeOpposite:false,target:false,initialize:function(a){this.originalAction=a;this.execute=function(b,c,a){return a?b(c,a):b(c)}.bind(this,a)},setOpposite:function(b){var a=b.originalAction;this.executeOpposite=function(a,c,b){return b?a(c,b):a(c)}.bind(this,a)},getCallbackForStack:function(a){return new Event.Behavior.Noun(this,a)}});Event.Behavior.addVerbs({call:function(a){a()},show:function(a){return Event.Behavior.invokeElementMethod(a,"show")},hide:function(a){return Event.Behavior.invokeElementMethod(a,"hide")},remove:function(a){return Event.Behavior.invokeElementMethod(a,"remove")},setStyle:function(b,a){return Event.Behavior.invokeElementMethod(b,"setStyle",[typeof a=="function"?a():a])},addClassName:function(b,a){return Event.Behavior.invokeElementMethod(b,"addClassName",[typeof a=="function"?a():a])},removeClassName:function(b,a){return Event.Behavior.invokeElementMethod(b,"removeClassName",[typeof a=="function"?a():a])},setClassName:function(b,a){var c=typeof a=="function"?a():a;if(typeof b=="function")return $A(b()).each(function(a){$(a).className=c});else{c=$(b).className;return c}},update:function(a,b){return Event.Behavior.invokeElementMethod(b,"update",[typeof a=="function"?a():a])},replace:function(a,b){return Event.Behavior.invokeElementMethod(b,"replace",[typeof a=="function"?a():a])}});Event.Behavior.Verbs.show.setOpposite(Event.Behavior.Verbs.hide);Event.Behavior.Verbs.hide.setOpposite(Event.Behavior.Verbs.show);Event.Behavior.Verbs.addClassName.setOpposite(Event.Behavior.Verbs.removeClassName);Event.Behavior.Verbs.removeClassName.setOpposite(Event.Behavior.Verbs.addClassName);Event.Behavior.Noun=Class.create();Object.extend(Event.Behavior.Noun.prototype,{verbs:false,verb:false,argument:false,subject:false,target:false,initialize:function(b,a){this.verb=b;this.argument=a},execute:function(){return this.target?this.verb.execute(this.target,this.argument):this.verb.execute(this.argument)},executeOpposite:function(){return this.target?this.verb.executeOpposite(this.target,this.argument):this.verb.executeOpposite(this.argument)},when:function(a){this.subject=a;return new Event.Behavior.Adjective(this)},getValue:function(){return Try.these(function(){return $(this.subject).getValue()}.bind(this),function(){return $(this.subject).options[$(this.subject).options.selectedIndex].value}.bind(this),function(){return $(this.subject).value}.bind(this),function(){return $(this.subject).innerHTML}.bind(this))},containsValue:function(a){var b=this.getValue();if(typeof a=="function")return $A(a()).include(b);else return b.match(a)},setTarget:function(a){this.target=a;return this},and:function(){}});Event.Behavior.Noun.prototype._with=Event.Behavior.Noun.prototype.setTarget;Event.Behavior.Noun.prototype.on=Event.Behavior.Noun.prototype.setTarget;Event.Behavior.Noun.prototype.of=Event.Behavior.Noun.prototype.setTarget;Event.Behavior.Noun.prototype.to=Event.Behavior.Noun.prototype.setTarget;Event.Behavior.Noun.prototype.from=Event.Behavior.Noun.prototype.setTarget;Event.Behavior.Adjective=Class.create();Object.extend(Event.Behavior.Adjective.prototype,{noun:false,lastConditionName:"",nextConditionType:"and",conditions:$A([]),events:$A([]),attached:false,initialize:function(a){this.conditions=$A([]);this.events=$A([]);this.noun=a},attachObserver:function(a){if(this.attached){a&&this.execute();return}this.attached=true;if(typeof this.noun.subject=="function")$A(this.noun.subject()).each(function(a){(this.events.length>0?this.events:$A(["change"])).each(function(b){(a.observe?a:$(a)).observe(b,function(){this.execute()}.bind(this))}.bind(this))}.bind(this));else(this.events.length>0?this.events:$A(["change"])).each(function(a){$(this.noun.subject).observe(a,function(){this.execute()}.bind(this))}.bind(this));a&&this.execute()},execute:function(){if(this.match())return this.noun.execute();else this.noun.verb.executeOpposite&&this.noun.executeOpposite()},attachCondition:function(a){this.conditions.push([this.nextConditionType,a.bind(this)])},match:function(){if(this.conditions.length===0)return true;else return this.conditions.inject(false,function(b,a){return a[0]==="or"?b&&a[1]():b||a[1]()})},is:function(a){this.lastConditionName="is";this.attachCondition(function(a){return (typeof a=="function"?a():a)==this.noun.getValue()}.bind(this,a));this.attachObserver(true);return this},isNot:function(a){this.lastConditionName="isNot";this.attachCondition(function(a){return (typeof a=="function"?a():a)!=this.noun.getValue()}.bind(this,a));this.attachObserver(true);return this},contains:function(a){this.lastConditionName="contains";this.attachCondition(function(a){return this.noun.containsValue(a)}.bind(this,a));this.attachObserver(true);return this},within:function(a){this.lastConditionName="within";this.attachCondition(function(){}.bind(this,a));this.attachObserver(true);return this},change:function(){this.nextConditionType="and";this.attachObserver(true);return this},and:function(a){this.attached=false;this.nextConditionType="and";a&&this[this.lastConditionName](a);return this},or:function(a){this.attached=false;this.nextConditionType="or";a&&this[this.lastConditionName](a);return this}});Event.Behavior.addEvents({losesFocus:"blur",gainsFocus:"focus",isClicked:"click",isDoubleClicked:"dblclick",keyPressed:"keypress"});Event.Behavior.Adjective.prototype.is_not=Event.Behavior.Adjective.prototype.isNot;Event.Behavior.Adjective.prototype.include=Event.Behavior.Adjective.prototype.contains;Event.Behavior.Adjective.prototype.includes=Event.Behavior.Adjective.prototype.contains;Event.Behavior.Adjective.prototype.are=Event.Behavior.Adjective.prototype.is;Event.Behavior.Adjective.prototype.areNot=Event.Behavior.Adjective.prototype.isNot;Event.Behavior.Adjective.prototype.are_not=Event.Behavior.Adjective.prototype.isNot;Event.Behavior.Adjective.prototype.changes=Event.Behavior.Adjective.prototype.change;if(typeof Prototype=="undefined")throw"HotKey requires Prototype to be loaded.";if(typeof Object.Event=="undefined")throw"HotKey requires Object.Event to be loaded.";var HotKey=Class.create({initialize:function(a,b,c){a=a.toUpperCase();HotKey.hotkeys.push(this);this.options=Object.extend({element:false,shiftKey:false,altKey:false,ctrlKey:true,bubbleEvent:true,fireOnce:false},c||{});this.letter=a;this.callback=function(a){!(this.options.fireOnce&&this.fired)&&Object.isFunction(b)&&b(a);!this.options.bubbleEvent&&a.stop();this.fired=true};this.element=$(this.options.element||document);this.handler=function(a){if(!a||(Event["KEY_"+this.letter]||this.letter.charCodeAt(0))==a.keyCode&&((!this.options.shiftKey||this.options.shiftKey&&a.shiftKey)&&(!this.options.altKey||this.options.altKey&&a.altKey)&&(!this.options.ctrlKey||this.options.ctrlKey&&a.ctrlKey))){if(this.notify("beforeCallback",a)===false)return;this.callback(a);this.notify("afterCallback",a)}}.bind(this);this.enable()},trigger:function(){this.handler()},enable:function(){this.element.observe("keydown",this.handler)},disable:function(){this.element.stopObserving("keydown",this.handler)},destroy:function(){this.disable();HotKey.hotkeys=HotKey.hotkeys.without(this)}});Object.extend(HotKey,{hotkeys:[]});Object.Event.extend(HotKey);if(typeof Control=="undefined")Control={};if(typeof Object.Event=="undefined")throw"Control.Pagination requires Object.Event to be loaded.";Control.Paginator=Class.create({initialize:function(b,a){this.items=b;this.options=Object.extend({size:10,onPageChange:Prototype.emptyFunction,onItemChange:Prototype.emptyFunction},a||{});this.setSize(this.options.size);this.page_index=1;this.item_index=0},setSize:function(a){this.options.size=a;this.number_of_pages=Math.ceil(this.items.length/this.options.size)},pageIndexFromItemIndex:function(a){return Math.floor((a||this.item_index)/this.options.size+1)},goToPage:function(a){this.page_index=a;this.triggerOnPageChange()},triggerOnPageChange:function(){this.notify("onPageChange",this.items.slice((this.page_index-1)*this.options.size,(this.page_index-1)*this.options.size+this.options.size),this.page_index)},goToItem:function(b){this.item_index=b;this.notify("onItemChange",this.items[this.item_index],this.item_index);var a=this.pageIndexFromItemIndex(this.item_index);a!=this.page_index&&this.goToPage(a)},hasNextItem:function(){return this.item_index<this.items.length-1},hasPreviousItem:function(){return this.item_index>=1},nextItem:function(){if(!this.hasNextItem())return false;this.goToItem(this.item_index+1);return true},previousItem:function(){if(!this.hasPreviousItem())return false;this.goToItem(this.item_index-1);return true},hasNextPage:function(){return this.page_index<this.number_of_pages},hasPreviousPage:function(){return this.page_index>=2},nextPage:function(){if(!this.hasNextPage())return false;this.goToPage(this.page_index+1);return true},previousPage:function(){if(!this.hasPreviousPage())return false;this.goToPage(this.page_index-1);return true}});Object.Event.extend(Control.Paginator);if(typeof Prototype=="undefined")throw"Control.ProgressBar requires Prototype to be loaded.";if(typeof Object.Event=="undefined")throw"Control.ProgressBar requires Object.Event to be loaded.";Control.ProgressBar=Class.create({initialize:function(a,b){this.progress=0;this.executer=false;this.active=false;this.poller=false;this.container=$(a);this.containerWidth=this.container.getDimensions().width-(parseInt(this.container.getStyle("border-right-width").replace(/px/,""),10)+parseInt(this.container.getStyle("border-left-width").replace(/px/,""),10));this.progressContainer=$(document.createElement("div"));this.progressContainer.setStyle({width:this.containerWidth+"px",height:"100%",position:"absolute",top:"0px",right:"0px"});this.container.appendChild(this.progressContainer);this.options={afterChange:Prototype.emptyFunction,interval:.25,step:1,classNames:{active:"progress_bar_active",inactive:"progress_bar_inactive"}};Object.extend(this.options,b||{});this.container.addClassName(this.options.classNames.inactive);this.active=false},setProgress:function(a){this.progress=a;this.draw();this.progress>=100&&this.stop(false);this.notify("afterChange",this.progress,this.active)},poll:function(d,b,a){a=a||{};var c=a.onSuccess||Prototype.emptyFunction;a.onSuccess=c.wrap(function(b,a){this.setProgress(parseInt(a.responseText,10));!this.active&&this.poller.stop();b(a)}).bind(this);this.active=true;this.poller=new PeriodicalExecuter(function(){var b=new Ajax.Request(d,a)}.bind(this),b||3)},start:function(){this.active=true;this.container.removeClassName(this.options.classNames.inactive);this.container.addClassName(this.options.classNames.active);this.executer=new PeriodicalExecuter(this.step.bind(this,this.options.step),this.options.interval)},stop:function(a){this.active=false;this.executer&&this.executer.stop();this.container.removeClassName(this.options.classNames.active);this.container.addClassName(this.options.classNames.inactive);(typeof a==="undefined"||a===true)&&this.reset()},step:function(a){this.active=true;this.setProgress(Math.min(100,this.progress+a))},reset:function(){this.active=false;this.setProgress(0)},draw:function(){this.progressContainer.setStyle({width:this.containerWidth-Math.floor(parseInt(this.progress,10)/100*this.containerWidth)+"px"})},notify:function(a){if(this.options[a])return [this.options[a].apply(this.options[a],$A(arguments).slice(1))]}});Object.Event.extend(Control.ProgressBar);if(typeof Prototype=="undefined")throw"Control.Rating requires Prototype to be loaded.";if(typeof Object.Event=="undefined")throw"Control.Rating requires Object.Event to be loaded.";Control.Rating=Class.create({initialize:function(b,c){Control.Rating.instances.push(this);this.value=false;this.links=[];this.container=$(b);this.container.update("");this.options={min:1,max:5,rated:false,input:false,reverse:false,capture:true,multiple:false,classNames:{off:"rating_off",half:"rating_half",on:"rating_on",selected:"rating_selected"},updateUrl:false,updateParameterName:"value",updateOptions:{},afterChange:Prototype.emptyFunction};Object.extend(this.options,c||{});if(this.options.value){this.value=this.options.value;delete this.options.value}if(this.options.input){this.options.input=$(this.options.input);this.options.input.observe("change",function(a){this.setValueFromInput(a)}.bind(this,this.options.input));this.setValueFromInput(this.options.input,true)}var a=$R(this.options.min,this.options.max);(this.options.reverse?$A(a).reverse():a).each(function(b){var a=this.buildLink(b);this.container.appendChild(a);this.links.push(a)}.bind(this));this.setValue(this.value||this.options.min-1,false,true)},buildLink:function(b){var a=$(document.createElement("a"));a.value=b;if(this.options.multiple||!this.options.rated&&!this.options.multiple){a.href="";a.onmouseover=this.mouseOver.bind(this,a);a.onmouseout=this.mouseOut.bind(this,a);a.onclick=this.click.bindAsEventListener(this,a)}else{a.style.cursor="default";a.observe("click",function(a){Event.stop(a);return false}.bindAsEventListener(this))}a.addClassName(this.options.classNames.off);return a},disable:function(){this.links.each(function(a){a.onmouseover=Prototype.emptyFunction;a.onmouseout=Prototype.emptyFunction;a.onclick=Prototype.emptyFunction;a.observe("click",function(a){Event.stop(a);return false}.bindAsEventListener(this));a.style.cursor="default"}.bind(this))},setValueFromInput:function(b,a){this.setValue($F(b),true,a)},setValue:function(d,c,b){this.value=d;if(this.options.input)if(this.options.input.options)$A(this.options.input.options).each(function(a,b){if(a.value==this.value){this.options.input.options.selectedIndex=b;throw $break}}.bind(this));else this.options.input.value=this.value;this.render(this.value,c);if(!b){if(this.options.updateUrl){var a={},e;a[this.options.updateParameterName]=this.value;e=new Ajax.Request(this.options.updateUrl,Object.extend(this.options.updateOptions,{parameters:a}))}this.notify("afterChange",this.value)}},render:function(a,b){(this.options.reverse?this.links.reverse():this.links).each(function(c){if(c.value<=Math.ceil(a)){c.className=this.options.classNames[c.value<=a?"on":"half"];(this.options.rated||b)&&c.addClassName(this.options.classNames.selected)}else c.className=this.options.classNames.off}.bind(this))},mouseOver:function(a){this.render(a.value,true)},mouseOut:function(){this.render(this.value)},click:function(b,a){this.options.rated=true;this.setValue(a.value?a.value:a,true);!this.options.multiple&&this.disable();if(this.options.capture){Event.stop(b);return false}}});Object.extend(Control.Rating,{instances:[],findByElementId:function(a){return Control.Rating.instances.find(function(b){return b.container.id&&b.container.id==a})}});Object.Event.extend(Control.Rating);if(typeof Prototype=="undefined")throw"Control.ScrollBar requires Prototype to be loaded.";if(typeof Control.Slider=="undefined")throw"Control.ScrollBar requires Control.Slider to be loaded.";if(typeof Object.Event=="undefined")throw"Control.ScrollBar requires Object.Event to be loaded.";Control.ScrollBar=Class.create({initialize:function(a,c,b){this.enabled=false;this.notificationTimeout=false;this.container=$(a);this.boundMouseWheelEvent=this.onMouseWheel.bindAsEventListener(this);this.boundResizeObserver=this.onWindowResize.bind(this);this.track=$(c);this.handle=this.track.firstDescendant();this.options=Object.extend({active_class_name:"scrolling",apply_active_class_name_to:this.container,notification_timeout_length:125,handle_minimum_height:25,scroll_to_smoothing:.01,scroll_to_steps:15,proportional:true,slider_options:{}},b||{});this.slider=new Control.Slider(this.handle,this.track,Object.extend({axis:"vertical",onSlide:this.onChange.bind(this),onChange:this.onChange.bind(this)},this.options.slider_options));this.recalculateLayout();Event.observe(window,"resize",this.boundResizeObserver);this.handle.observe("mousedown",function(){this.auto_sliding_executer&&this.auto_sliding_executer.stop()}.bind(this))},destroy:function(){Event.stopObserving(window,"resize",this.boundResizeObserver)},enable:function(){this.enabled=true;this.container.observe("mouse:wheel",this.boundMouseWheelEvent);this.slider.setEnabled();this.track.show();this.options.active_class_name&&$(this.options.apply_active_class_name_to).addClassName(this.options.active_class_name);this.notify("enabled")},disable:function(){this.enabled=false;this.container.stopObserving("mouse:wheel",this.boundMouseWheelEvent);this.slider.setDisabled();this.track.hide();this.options.active_class_name&&$(this.options.apply_active_class_name_to).removeClassName(this.options.active_class_name);this.notify("disabled");this.reset()},reset:function(){this.slider.setValue(0)},recalculateLayout:function(){if(this.container.scrollHeight<=this.container.offsetHeight)this.disable();else{this.enable();this.slider.trackLength=this.slider.maximumOffset()-this.slider.minimumOffset();if(this.options.proportional){this.handle.style.height=Math.max(this.container.offsetHeight*(this.container.offsetHeight/this.container.scrollHeight),this.options.handle_minimum_height)+"px";this.slider.handleLength=this.handle.style.height.replace(/px/,"")}}},onWindowResize:function(){this.recalculateLayout();this.scrollBy(0)},onMouseWheel:function(a){this.auto_sliding_executer&&this.auto_sliding_executer.stop();this.slider.setValueBy(-(a.memo.delta/20));a.stop();return false},onChange:function(a){this.container.scrollTop=Math.round(a/this.slider.maximum*(this.container.scrollHeight-this.container.offsetHeight));this.notification_timeout&&window.clearTimeout(this.notificationTimeout);this.notificationTimeout=window.setTimeout(function(){this.notify("change",a)}.bind(this),this.options.notification_timeout_length)},getCurrentMaximumDelta:function(){return this.slider.maximum*(this.container.scrollHeight-this.container.offsetHeight)},getDeltaToElement:function(a){return this.slider.maximum*(a.positionedOffset().top+a.getHeight()/2-this.container.getHeight()/2)},scrollTo:function(a,b){var c=this.getCurrentMaximumDelta();if(a=="top")a=0;else if(a=="bottom")a=c;else if(typeof a!="number")a=this.getDeltaToElement($(a));if(this.enabled){a=Math.max(0,Math.min(a,c));this.auto_sliding_executer&&this.auto_sliding_executer.stop();var d=a/c,f=this.slider.value,e=(d-f)*c;if(b)this.auto_sliding_executer=new PeriodicalExecuter(function(){if(Math.round(this.slider.value*100)/100<Math.round(d*100)/100||Math.round(this.slider.value*100)/100>Math.round(d*100)/100)this.scrollBy(e/this.options.scroll_to_steps);else{this.auto_sliding_executer.stop();this.auto_sliding_executer=null;typeof b=="function"&&b()}}.bind(this),this.options.scroll_to_smoothing);else this.scrollBy(e)}else typeof b=="function"&&b()},scrollBy:function(a){if(!this.enabled)return false;this.slider.setValueBy(a/this.getCurrentMaximumDelta())}});Object.Event.extend(Control.ScrollBar);if(typeof Prototype=="undefined")throw"Control.Selection requires Prototype to be loaded.";if(typeof Object.Event=="undefined")throw"Control.Selection requires Object.Event to be loaded.";Control.Selection={options:{resize_layout_timeout:125,selected:Prototype.emptyFunction,deselected:Prototype.emptyFunction,change:Prototype.emptyFunction,selection_id:"control_selection",selection_style:{zIndex:999,cursor:"default",border:"1px dotted #000"},filter:function(){return true},drag_proxy:false,drag_proxy_threshold:1,drag_proxy_options:{}},selectableElements:[],elements:[],selectableObjects:[],objects:[],active:false,container:false,resizeTimeout:false,load:function(b){Control.Selection.options=Object.extend(Control.Selection.options,b||{});Control.Selection.selection_div=$(document.createElement("div"));Control.Selection.selection_div.id=Control.Selection.options.selection_id;Control.Selection.selection_div.style.display="none";Control.Selection.selection_div.setStyle(Control.Selection.options.selection_style);Control.Selection.border_width=parseInt(Control.Selection.selection_div.getStyle("border-top-width"),10)*2;Control.Selection.container=Prototype.Browser.IE?window.container:window;$(document.body).insert(Control.Selection.selection_div);Control.Selection.enable();Control.Selection.options.drag_proxy&&typeof Draggable!="undefined"&&Control.Selection.DragProxy.load();Event.observe(window,"resize",function(){Control.Selection.resizeTimeout&&window.clearTimeout(Control.Selection.resizeTimeout);Control.Selection.resizeTimeout=window.setTimeout(Control.Selection.recalculateLayout,Control.Selection.options.resize_layout_timeout)});if(Prototype.Browser.IE){var a=$$("body").first();a.observe("mouseleave",Control.Selection.stop);a.observe("mouseup",Control.Selection.stop)}},enable:function(){if(Prototype.Browser.IE)document.onselectstart=function(){return false};Event.observe(Control.Selection.container,"mousedown",Control.Selection.start);Event.observe(Control.Selection.container,"mouseup",Control.Selection.stop)},disable:function(){if(Prototype.Browser.IE)document.onselectstart=function(){return true};Event.stopObserving(Control.Selection.container,"mousedown",Control.Selection.start);Event.stopObserving(Control.Selection.container,"mouseup",Control.Selection.stop)},recalculateLayout:function(){Control.Selection.selectableElements.each(function(a){var c=a.getDimensions(),d=a.cumulativeOffset(),b=a.cumulativeScrollOffset();if(!a._control_selection)a._control_selection={};a._control_selection.top=d[1]-b[1];a._control_selection.left=d[0]-b[0];a._control_selection.width=c.width;a._control_selection.height=c.height})},addSelectable:function(a,f,b,c){a=$(a);if(b)b=b.each?b:[b];var d=a.getDimensions(),e=Element.cumulativeOffset(a);a._control_selection={activation_targets:b,is_selected:false,top:e[1],left:e[0],width:d.width,height:d.height,activationTargetMouseMove:function(){Control.Selection.notify("activationTargetMouseMove",a);b&&b.each(function(b){b.stopObserving("mousemove",a._control_selection.activationTargetMouseMove)});Control.Selection.DragProxy.container.stopObserving("mousemove",a._control_selection.activationTargetMouseMove)},activationTargetMouseDown:function(c){!Control.Selection.elements.include(a)&&Control.Selection.select(a);Control.Selection.DragProxy.start(c);Control.Selection.DragProxy.container.hide();b&&b.each(function(b){b.observe("mousemove",a._control_selection.activationTargetMouseMove)});Control.Selection.DragProxy.container.observe("mousemove",a._control_selection.activationTargetMouseMove)},activationTargetClick:function(){Control.Selection.select(a);typeof c=="function"&&c();b&&b.each(function(b){b.stopObserving("mousemove",a._control_selection.activationTargetMouseMove)});Control.Selection.DragProxy.container.stopObserving("mousemove",a._control_selection.activationTargetMouseMove)}};a.onselectstart=function(){return false};a.unselectable="on";a.style.MozUserSelect="none";b&&b.each(function(b){b.observe("mousedown",a._control_selection.activationTargetMouseDown);b.observe("click",a._control_selection.activationTargetClick)});Control.Selection.selectableElements.push(a);Control.Selection.selectableObjects.push(f)},removeSelectable:function(a){a=$(a);if(a._control_selection.activation_targets){a._control_selection.activation_targets.each(function(b){b.stopObserving("mousedown",a._control_selection.activationTargetMouseDown)});a._control_selection.activation_targets.each(function(b){b.stopObserving("click",a._control_selection.activationTargetClick)})}a._control_selection=null;a.onselectstart=function(){return true};a.unselectable="off";a.style.MozUserSelect="";var b=0;Control.Selection.selectableElements.each(function(c,d){if(c==a){b=d;throw $break}});Control.Selection.selectableElements=Control.Selection.selectableElements.without(a);Control.Selection.selectableObjects=Control.Selection.selectableObjects.slice(0,b).concat(Control.Selection.selectableObjects.slice(b+1))},select:function(a){if(typeof a=="undefined"||!a)a=[];if(!a.each&&!a._each)a=[a];var c=!(Control.Selection.elements.length==a.length&&Control.Selection.elements.all(function(b,c){return a[c]==b}));if(!c)return;var b={},d=a.collect(function(a){var c=Control.Selection.selectableObjects[Control.Selection.selectableElements.indexOf(a)];b[a]=c;return c});if(Control.Selection.elements.length===0&&a.length!==0)a.each(function(a){Control.Selection.notify("selected",a,b[a])});else{Control.Selection.elements.each(function(c){!a.include(c)&&Control.Selection.notify("deselected",c,b[c])});a.each(function(a){!Control.Selection.elements.include(a)&&Control.Selection.notify("selected",a,b[a])})}Control.Selection.elements=a;Control.Selection.objects=d;Control.Selection.notify("change",Control.Selection.elements,Control.Selection.objects)},deselect:function(){if(Control.Selection.notify("deselect")===false)return false;Control.Selection.elements.each(function(a){Control.Selection.notify("deselected",a,Control.Selection.selectableObjects[Control.Selection.selectableElements.indexOf(a)])});Control.Selection.objects=[];Control.Selection.elements=[];Control.Selection.notify("change",Control.Selection.objects,Control.Selection.elements);return true},start:function(a){if(!a.isLeftClick()||Control.Selection.notify("start",a)===false)return false;!a.shiftKey&&!a.altKey&&Control.Selection.deselect();Event.observe(Control.Selection.container,"mousemove",Control.Selection.onMouseMove);Event.stop(a);return false},stop:function(){Event.stopObserving(Control.Selection.container,"mousemove",Control.Selection.onMouseMove);Control.Selection.active=false;Control.Selection.selection_div.setStyle({display:"none",top:null,left:null,width:null,height:null});Control.Selection.start_mouse_coordinates={};Control.Selection.current_mouse_coordinates={}},mouseCoordinatesFromEvent:function(a){return {x:Event.pointerX(a),y:Event.pointerY(a)}},onClick:function(c,b,d){var a=[];if(c.shiftKey){a=Control.Selection.elements.clone();!a.include(b)&&a.push(b)}else if(c.altKey){a=Control.Selection.elements.clone();if(a.include(b))a=a.without(b)}else a=[b];Control.Selection.select(a);d=="click"&&Event.stop(c)},onMouseMove:function(a){if(!Control.Selection.active){Control.Selection.active=true;Control.Selection.start_mouse_coordinates=Control.Selection.mouseCoordinatesFromEvent(a)}else{Control.Selection.current_mouse_coordinates=Control.Selection.mouseCoordinatesFromEvent(a);Control.Selection.drawSelectionDiv();var b=Control.Selection.selectableElements.findAll(function(a){return Control.Selection.options.filter(a)&&Control.Selection.elementWithinSelection(a)});if(a.shiftKey&&!a.altKey)Control.Selection.elements.each(function(a){!b.include(a)&&b.push(a)});else if(a.altKey&&!a.shiftKey)b=Control.Selection.elements.findAll(function(a){return !b.include(a)});Control.Selection.select(b)}},drawSelectionDiv:function(){if(Control.Selection.start_mouse_coordinates==Control.Selection.current_mouse_coordinates)Control.Selection.selection_div.style.display="none";else{Control.Selection.viewport=document.viewport.getDimensions();Control.Selection.selection_div.style.position="absolute";Control.Selection.current_direction=(Control.Selection.start_mouse_coordinates.y>Control.Selection.current_mouse_coordinates.y?"N":"S")+(Control.Selection.start_mouse_coordinates.x<Control.Selection.current_mouse_coordinates.x?"E":"W");Control.Selection.selection_div.setStyle(Control.Selection["dimensionsFor"+Control.Selection.current_direction]());Control.Selection.selection_div.style.display="block"}},dimensionsForNW:function(){return {top:Control.Selection.start_mouse_coordinates.y-(Control.Selection.start_mouse_coordinates.y-Control.Selection.current_mouse_coordinates.y)+"px",left:Control.Selection.start_mouse_coordinates.x-(Control.Selection.start_mouse_coordinates.x-Control.Selection.current_mouse_coordinates.x)+"px",width:Control.Selection.start_mouse_coordinates.x-Control.Selection.current_mouse_coordinates.x+"px",height:Control.Selection.start_mouse_coordinates.y-Control.Selection.current_mouse_coordinates.y+"px"}},dimensionsForNE:function(){return {top:Control.Selection.start_mouse_coordinates.y-(Control.Selection.start_mouse_coordinates.y-Control.Selection.current_mouse_coordinates.y)+"px",left:Control.Selection.start_mouse_coordinates.x+"px",width:Math.min(Control.Selection.viewport.width-Control.Selection.start_mouse_coordinates.x-Control.Selection.border_width,Control.Selection.current_mouse_coordinates.x-Control.Selection.start_mouse_coordinates.x)+"px",height:Control.Selection.start_mouse_coordinates.y-Control.Selection.current_mouse_coordinates.y+"px"}},dimensionsForSE:function(){return {top:Control.Selection.start_mouse_coordinates.y+"px",left:Control.Selection.start_mouse_coordinates.x+"px",width:Math.min(Control.Selection.viewport.width-Control.Selection.start_mouse_coordinates.x-Control.Selection.border_width,Control.Selection.current_mouse_coordinates.x-Control.Selection.start_mouse_coordinates.x)+"px",height:Math.min(Control.Selection.viewport.height-Control.Selection.start_mouse_coordinates.y-Control.Selection.border_width,Control.Selection.current_mouse_coordinates.y-Control.Selection.start_mouse_coordinates.y)+"px"}},dimensionsForSW:function(){return {top:Control.Selection.start_mouse_coordinates.y+"px",left:Control.Selection.start_mouse_coordinates.x-(Control.Selection.start_mouse_coordinates.x-Control.Selection.current_mouse_coordinates.x)+"px",width:Control.Selection.start_mouse_coordinates.x-Control.Selection.current_mouse_coordinates.x+"px",height:Math.min(Control.Selection.viewport.height-Control.Selection.start_mouse_coordinates.y-Control.Selection.border_width,Control.Selection.current_mouse_coordinates.y-Control.Selection.start_mouse_coordinates.y)+"px"}},inBoundsForNW:function(b,a){return (b.left>a.left||b.right>a.left)&&a.right>b.left&&((b.top>a.top||b.bottom>a.top)&&a.bottom>b.top)},inBoundsForNE:function(b,a){return (b.left<a.right||b.left<a.right)&&a.left<b.right&&((b.top>a.top||b.bottom>a.top)&&a.bottom>b.top)},inBoundsForSE:function(b,a){return (b.left<a.right||b.left<a.right)&&a.left<b.right&&((b.bottom<a.bottom||b.top<a.bottom)&&a.top<b.bottom)},inBoundsForSW:function(b,a){return (b.left>a.left||b.right>a.left)&&a.right>b.left&&((b.bottom<a.bottom||b.top<a.bottom)&&a.top<b.bottom)},elementWithinSelection:function(a){if(Control.Selection["inBoundsFor"+Control.Selection.current_direction]({top:a._control_selection.top,left:a._control_selection.left,bottom:a._control_selection.top+a._control_selection.height,right:a._control_selection.left+a._control_selection.width},{top:parseInt(Control.Selection.selection_div.style.top,10),left:parseInt(Control.Selection.selection_div.style.left,10),bottom:parseInt(Control.Selection.selection_div.style.top,10)+parseInt(Control.Selection.selection_div.style.height,10),right:parseInt(Control.Selection.selection_div.style.left,10)+parseInt(Control.Selection.selection_div.style.width,10)})){a._control_selection.is_selected=true;return true}else{a._control_selection.is_selected=false;return false}},DragProxy:{active:false,xorigin:0,yorigin:0,load:function(){Control.Selection.DragProxy.container=$(document.createElement("div"));Control.Selection.DragProxy.container.id="control_selection_drag_proxy";Control.Selection.DragProxy.container.setStyle({position:"absolute",top:"1px",left:"1px",zIndex:99999});Control.Selection.DragProxy.container.hide();document.body.appendChild(Control.Selection.DragProxy.container);Control.Selection.observe("selected",Control.Selection.DragProxy.selected);Control.Selection.observe("deselected",Control.Selection.DragProxy.deselected)},start:function(a){if(a.isRightClick()){Control.Selection.DragProxy.container.hide();return}if(Control.Selection.DragProxy.xorigin==Event.pointerX(a)&&Control.Selection.DragProxy.yorigin==Event.pointerY(a))return;Control.Selection.DragProxy.active=true;Control.Selection.DragProxy.container.setStyle({position:"absolute",top:Event.pointerY(a)+"px",left:Event.pointerX(a)+"px"});Control.Selection.DragProxy.container.observe("mouseup",Control.Selection.DragProxy.onMouseUp);Control.Selection.DragProxy.container.show();Control.Selection.DragProxy.container._draggable=new Draggable(Control.Selection.DragProxy.container,Object.extend({onEnd:Control.Selection.DragProxy.stop},Control.Selection.options.drag_proxy_options));Control.Selection.DragProxy.container._draggable.eventMouseDown(a);Control.Selection.DragProxy.notify("start",Control.Selection.DragProxy.container,Control.Selection.elements)},stop:function(){window.setTimeout(function(){Control.Selection.DragProxy.active=false;Control.Selection.DragProxy.container.hide();if(Control.Selection.DragProxy.container._draggable){Control.Selection.DragProxy.container._draggable.destroy();Control.Selection.DragProxy.container._draggable=null}Control.Selection.DragProxy.notify("stop")},1)},onClick:function(a){Control.Selection.DragProxy.xorigin=Event.pointerX(a);Control.Selection.DragProxy.yorigin=Event.pointerY(a);a.isRightClick()&&Control.Selection.DragProxy.container.hide();if(Control.Selection.elements.length>=Control.Selection.options.drag_proxy_threshold&&!(a.shiftKey||a.altKey)&&(Control.Selection.DragProxy.xorigin!=Event.pointerX(a)||Control.Selection.DragProxy.yorigin!=Event.pointerY(a))){Control.Selection.DragProxy.start(a);Event.stop(a)}},onMouseUp:function(){Control.Selection.DragProxy.stop();Control.Selection.DragProxy.container.stopObserving("mouseup",Control.Selection.DragProxy.onMouseUp)},selected:function(a){a.observe("mousedown",Control.Selection.DragProxy.onClick)},deselected:function(a){a.stopObserving("mousedown",Control.Selection.DragProxy.onClick)}}};Object.Event.extend(Control.Selection);Object.Event.extend(Control.Selection.DragProxy);if(typeof Prototype=="undefined")throw"Control.SelectMultiple requires Prototype to be loaded.";if(typeof Object.Event=="undefined")throw"Control.SelectMultiple requires Object.Event to be loaded.";Control.SelectMultiple=Class.create({select:false,container:false,numberOfCheckedBoxes:0,checkboxes:[],hasExtraOption:false,initialize:function(d,b,c){this.options={checkboxSelector:"input[type=checkbox]",nameSelector:"span.name",labelSeparator:", ",valueSeparator:",",afterChange:Prototype.emptyFunction,overflowString:function(a){return a.truncate()},overflowLength:30};Object.extend(this.options,c||{});this.select=$(d);this.container=$(b);this.checkboxes=typeof this.options.checkboxSelector=="function"?this.options.checkboxSelector.bind(this)():this.container.getElementsBySelector(this.options.checkboxSelector);var a=false;if(this.options.value){a=true;this.setValue(this.options.value);delete this.options.value}this.hasExtraOption=false;this.checkboxes.each(function(a){a.observe("click",this.checkboxOnClick.bind(this,a))}.bind(this));this.select.observe("change",this.selectOnChange.bind(this));this.countAndCheckCheckBoxes();!a&&this.scanCheckBoxes();this.notify("afterChange",this.select.options[this.select.options.selectedIndex].value)},countAndCheckCheckBoxes:function(){this.numberOfCheckedBoxes=this.checkboxes.inject(0,function(d,a){a.checked=this.select.options[this.select.options.selectedIndex].value==a.value;var b=this.select.options[this.select.options.selectedIndex].value,e=$A(b.split?b.split(this.options.valueSeparator):b),c=e.any(function(b){if(!c&&a.value==b)return true}.bind(this));a.checked=c;if(a.checked)++d;return d}.bind(this))},setValue:function(a){this.numberOfCheckedBoxes=0;var b=$A(a.split?a.split(this.options.valueSeparator):a);this.checkboxes.each(function(a){a.checked=false;b.each(function(b){if(a.value==b){++this.numberOfCheckedBoxes;a.checked=true}}.bind(this))}.bind(this));this.scanCheckBoxes()},selectOnChange:function(){this.removeExtraOption();this.countAndCheckCheckBoxes();this.notify("afterChange",this.select.options[this.select.options.selectedIndex].value)},checkboxOnClick:function(){this.numberOfCheckedBoxes=this.checkboxes.findAll(function(a){return a.checked}).length;this.scanCheckBoxes();this.notify("afterChange",this.numberOfCheckedBoxes===0?"":this.select.options[this.select.options.selectedIndex].value)},scanCheckBoxes:function(){switch(this.numberOfCheckedBoxes){case 1:this.checkboxes.each(function(a){if(a.checked){$A(this.select.options).each(function(b,c){if(b.value==a.value){this.select.options.selectedIndex=c;throw $break}}.bind(this));throw $break}}.bind(this));break;case 0:this.removeExtraOption();break;default:this.addExtraOption()}},getLabelForExtraOption:function(){var a=(typeof this.options.nameSelector=="function"?this.options.nameSelector.bind(this)():this.container.getElementsBySelector(this.options.nameSelector).inject([],function(a,b,c){this.checkboxes[c].checked&&a.push(b.innerHTML);return a}.bind(this))).join(this.options.labelSeparator);return a.length>=this.options.overflowLength&&this.options.overflowLength>0?typeof this.options.overflowString=="function"?this.options.overflowString(a):this.options.overflowString:a},getValueForExtraOption:function(){return this.checkboxes.inject([],function(b,a){a.checked&&b.push(a.value);return b}).join(this.options.valueSeparator)},addExtraOption:function(){this.removeExtraOption();this.hasExtraOption=true;this.select.options[this.select.options.length]=new Option(this.getLabelForExtraOption(),this.getValueForExtraOption());this.select.options.selectedIndex=this.select.options.length-1},removeExtraOption:function(){if(this.hasExtraOption){this.select.remove(this.select.options.length-1);this.hasExtraOption=false}}});Object.Event.extend(Control.SelectMultiple);if(typeof Prototype=="undefined")throw"Control.Tabs requires Prototype to be loaded.";if(typeof Object.Event=="undefined")throw"Control.Tabs requires Object.Event to be loaded.";Control.Tabs=Class.create({initialize:function(a,c){if(!$(a))throw"Control.Tabs could not find the element: "+a;this.activeContainer=false;this.activeLink=false;this.containers=$H({});this.links=[];Control.Tabs.instances.push(this);this.options={beforeChange:Prototype.emptyFunction,afterChange:Prototype.emptyFunction,hover:false,linkSelector:"li a",setClassOnContainer:false,activeClassName:"active",defaultTab:"first",autoLinkExternal:true,targetRegExp:/#(.+)$/,showFunction:Element.show,hideFunction:Element.hide};Object.extend(this.options,c||{});(typeof(this.options.linkSelector=="string")?$(a).select(this.options.linkSelector):this.options.linkSelector($(a))).findAll(function(a){return /^#/.exec((Prototype.Browser.WebKit?decodeURIComponent(a.href):a.href).replace(window.location.href.split("#")[0],""))}).each(function(a){this.addTab(a)}.bind(this));this.containers.values().each(Element.hide);if(this.options.defaultTab=="first")this.setActiveTab(this.links.first());else if(this.options.defaultTab=="last")this.setActiveTab(this.links.last());else this.setActiveTab(this.options.defaultTab);var b=this.options.targetRegExp.exec(window.location);b&&b[1]&&b[1].split(",").each(function(a){this.setActiveTab(this.links.find(function(b){return b.key==a}))}.bind(this));this.options.autoLinkExternal&&$A(document.getElementsByTagName("a")).each(function(b){if(!this.links.include(b)){var a=b.href.replace(window.location.href.split("#")[0],"");if(a.substring(0,1)=="#")this.containers.keys().include(a.substring(1))&&$(b).observe("click",function(b,a){this.setActiveTab(a.substring(1))}.bindAsEventListener(this,a))}}.bind(this))},addTab:function(a){this.links.push(a);a.key=a.getAttribute("href").replace(window.location.href.split("#")[0],"").split("#").last().replace(/#/,"");var b=$(a.key);if(!b)throw"Control.Tabs: #"+a.key+" was not found on the page.";this.containers.set(a.key,b);a[this.options.hover?"onmouseover":"onclick"]=function(a){window.event&&Event.stop(window.event);this.setActiveTab(a);return false}.bind(this,a)},setActiveTab:function(a){if(!a&&typeof a=="undefined")return;if(typeof a=="string")this.setActiveTab(this.links.find(function(b){return b.key==a}));else if(typeof a=="number")this.setActiveTab(this.links[a]);else{if(this.notify("beforeChange",this.activeContainer,this.containers.get(a.key))===false)return;this.activeContainer&&this.options.hideFunction(this.activeContainer);this.links.each(function(a){(this.options.setClassOnContainer?$(a.parentNode):a).removeClassName(this.options.activeClassName)}.bind(this));(this.options.setClassOnContainer?$(a.parentNode):a).addClassName(this.options.activeClassName);this.activeContainer=this.containers.get(a.key);this.activeLink=a;this.options.showFunction(this.containers.get(a.key));this.notify("afterChange",this.containers.get(a.key))}},next:function(){this.links.each(function(b,a){if(this.activeLink==b&&this.links[a+1]){this.setActiveTab(this.links[a+1]);throw $break}}.bind(this))},previous:function(){this.links.each(function(b,a){if(this.activeLink==b&&this.links[a-1]){this.setActiveTab(this.links[a-1]);throw $break}}.bind(this))},first:function(){this.setActiveTab(this.links.first())},last:function(){this.setActiveTab(this.links.last())}});Object.extend(Control.Tabs,{instances:[],findByTabId:function(a){return Control.Tabs.instances.find(function(b){return b.links.find(function(b){return b.key==a})})}});Object.Event.extend(Control.Tabs);if(typeof Prototype=="undefined")throw"Control.TextArea requires Prototype to be loaded.";if(typeof Object.Event=="undefined")throw"Control.TextArea requires Object.Event to be loaded.";Control.TextArea=Class.create({initialize:function(a){this.onChangeTimeout=false;this.element=$(a);$(this.element).observe("keyup",this.doOnChange.bindAsEventListener(this));$(this.element).observe("paste",this.doOnChange.bindAsEventListener(this));$(this.element).observe("input",this.doOnChange.bindAsEventListener(this));if(!!document.selection){$(this.element).observe("mouseup",this.saveRange.bindAsEventListener(this));$(this.element).observe("keyup",this.saveRange.bindAsEventListener(this))}},doOnChange:function(){this.onChangeTimeout&&window.clearTimeout(this.onChangeTimeout);this.onChangeTimeout=window.setTimeout(function(){this.notify("change",this.getValue())}.bind(this),Control.TextArea.onChangeTimeoutLength)},saveRange:function(){this.range=document.selection.createRange()},getValue:function(){return this.element.value},getSelection:function(){if(!!document.selection)return document.selection.createRange().text;else if(!!this.element.setSelectionRange)return this.element.value.substring(this.element.selectionStart,this.element.selectionEnd);else return false},replaceSelection:function(a){var d=this.element.scrollTop;if(!!document.selection){this.element.focus();var c=this.range?this.range:document.selection.createRange();c.text=a;c.select()}else if(!!this.element.setSelectionRange){var b=this.element.selectionStart;this.element.value=this.element.value.substring(0,b)+a+this.element.value.substring(this.element.selectionEnd);this.element.setSelectionRange(b+a.length,b+a.length)}this.doOnChange();this.element.focus();this.element.scrollTop=d},wrapSelection:function(c,b){var a=this.getSelection();if(a.indexOf(c)===0&&a.lastIndexOf(b)===a.length-b.length)this.replaceSelection(a.substring(c.length,a.length-b.length));else this.replaceSelection(c+a+b)},insertBeforeSelection:function(a){this.replaceSelection(a+this.getSelection())},insertAfterSelection:function(a){this.replaceSelection(this.getSelection()+a)},collectFromEachSelectedLine:function(a,b,c){this.replaceSelection((b||"")+$A(this.getSelection().split("\n")).collect(a).join("\n")+(c||""))},insertBeforeEachSelectedLine:function(c,a,b){this.collectFromEachSelectedLine(function(){},a,b)}});Object.extend(Control.TextArea,{onChangeTimeoutLength:500});Object.Event.extend(Control.TextArea);Control.TextArea.ToolBar=Class.create({initialize:function(b,a){this.textarea=b;if(a)this.container=$(a);else{this.container=$(document.createElement("ul"));this.textarea.element.parentNode.insertBefore(this.container,this.textarea.element)}},attachButton:function(a,b){a.onclick=function(){return false};$(a).observe("click",b.bindAsEventListener(this.textarea))},addButton:function(b,e,f){var d=document.createElement("li"),a=document.createElement("a");a.href="#";this.attachButton(a,e);d.appendChild(a);Object.extend(a,f||{});if(b){var c=document.createElement("span");c.innerHTML=b;a.appendChild(c)}this.container.appendChild(d)}});if(typeof Draggable!="undefined")Draggable.prototype.draw=function(k){var c=Position.cumulativeOffset(this.element);if(this.options.ghosting){var j=Position.realOffset(this.element);c[0]+=j[0]-Position.deltaX;c[1]+=j[1]-Position.deltaY}var i=this.currentDelta();c[0]-=i[0];c[1]-=i[1];if(this.options.scroll&&(this.options.scroll!=window&&this._isScrollChild)){c[0]-=this.options.scroll.scrollLeft-this.originalScrollLeft;c[1]-=this.options.scroll.scrollTop-this.originalScrollTop}var a=[0,1].map(function(a){return k[a]-c[a]-this.offset[a]}.bind(this));if(this.options.snap)if(typeof this.options.snap=="function")a=this.options.snap(a[0],a[1],this);else if(this.options.snap instanceof Array)a=a.map(function(b,a){return Math.round(b/this.options.snap[a])*this.options.snap[a]}.bind(this));else a=a.map(function(a){return Math.round(a/this.options.snap)*this.options.snap}.bind(this));if(this.options.onDraw)this.options.onDraw.bind(this)(a);else{var d=this.element.style;if(this.options.constrainToViewport){var f=document.viewport.getDimensions(),e=this.element.getDimensions(),h=parseInt(this.element.getStyle("margin-top")),g=parseInt(this.element.getStyle("margin-left")),b=[[0-g,0-h],[f.width-e.width-g,f.height-e.height-h]];if(!this.options.constraint||this.options.constraint=="horizontal")if(a[0]>=b[0][0]&&a[0]<=b[1][0])this.element.style.left=a[0]+"px";else this.element.style.left=(a[0]<b[0][0]?b[0][0]:b[1][0])+"px";if(!this.options.constraint||this.options.constraint=="vertical")if(a[1]>=b[0][1]&&a[1]<=b[1][1])this.element.style.top=a[1]+"px";else this.element.style.top=(a[1]<=b[0][1]?b[0][1]:b[1][1])+"px"}else{if(!this.options.constraint||this.options.constraint=="horizontal")d.left=a[0]+"px";if(!this.options.constraint||this.options.constraint=="vertical")d.top=a[1]+"px"}if(d.visibility=="hidden")d.visibility=""}};if(typeof Prototype=="undefined")throw"Control.Window requires Prototype to be loaded.";if(typeof IframeShim=="undefined")throw"Control.Window requires IframeShim to be loaded.";if(typeof Object.Event=="undefined")throw"Control.Window requires Object.Event to be loaded.";Control.Window=Class.create({initialize:function(a,d){Control.Window.windows.push(this);this.container=false;this.isOpen=false;this.href=false;this.sourceContainer=false;this.ajaxRequest=false;this.remoteContentLoaded=false;this.numberInSequence=Control.Window.windows.length+1;this.indicator=false;this.effects={fade:false,appear:false};this.indicatorEffects={fade:false,appear:false};this.options=Object.extend({beforeOpen:Prototype.emptyFunction,afterOpen:Prototype.emptyFunction,beforeClose:Prototype.emptyFunction,afterClose:Prototype.emptyFunction,height:null,width:null,className:false,position:"center",offsetLeft:0,offsetTop:0,iframe:false,hover:false,indicator:false,closeOnClick:false,iframeshim:true,fade:false,fadeDuration:.75,draggable:false,onDrag:Prototype.emptyFunction,resizable:false,minHeight:false,minWidth:false,maxHeight:false,maxWidth:false,onResize:Prototype.emptyFunction,constrainToViewport:false,method:"post",parameters:{},onComplete:Prototype.emptyFunction,onSuccess:Prototype.emptyFunction,onFailure:Prototype.emptyFunction,onException:Prototype.emptyFunction,onRemoteContentLoaded:Prototype.emptyFunction,insertRemoteContentAt:false},d||{});this.indicator=this.options.indicator?$(this.options.indicator):false;if(a)if(typeof a=="string"&&a.match(Control.Window.uriRegex))this.href=a;else{this.container=$(a);this.createDefaultContainer(a);if(this.container&&(this.container.readAttribute("href")&&this.container.readAttribute("href")!=""||this.options.hover&&this.options.hover!==true)){if(this.options.hover&&this.options.hover!==true)this.sourceContainer=$(this.options.hover);else{this.sourceContainer=this.container;this.href=this.container.readAttribute("href");var c=this.href.match(/^#(.+)$/);if(c&&c[1]){this.container=$(c[1]);this.href=false}else this.container=false}this.sourceContainerOpenHandler=function(a){this.open(a);a.stop();return false}.bindAsEventListener(this);this.sourceContainerCloseHandler=function(a){this.close(a)}.bindAsEventListener(this);this.sourceContainerMouseMoveHandler=function(a){this.position(a)}.bindAsEventListener(this);if(this.options.hover){this.sourceContainer.observe("mouseenter",this.sourceContainerOpenHandler);this.sourceContainer.observe("mouseleave",this.sourceContainerCloseHandler);this.options.position=="mouse"&&this.sourceContainer.observe("mousemove",this.sourceContainerMouseMoveHandler)}else this.sourceContainer.observe("click",this.sourceContainerOpenHandler)}}this.createDefaultContainer(a);if(this.options.insertRemoteContentAt===false)this.options.insertRemoteContentAt=this.container;var b={margin:0,position:"absolute",zIndex:Control.Window.initialZIndexForWindow()};if(this.options.width)b.width=$value(this.options.width)+"px";if(this.options.height)b.height=$value(this.options.height)+"px";this.container.setStyle(b);this.options.className&&this.container.addClassName(this.options.className);this.positionHandler=this.position.bindAsEventListener(this);this.outOfBoundsPositionHandler=this.ensureInBounds.bindAsEventListener(this);this.bringToFrontHandler=this.bringToFront.bindAsEventListener(this);this.container.observe("mousedown",this.bringToFrontHandler);this.container.hide();this.closeHandler=this.close.bindAsEventListener(this);if(this.options.iframeshim){this.iFrameShim=new IframeShim;this.iFrameShim.hide()}this.applyResizable();this.applyDraggable();Event.observe(window,"resize",this.outOfBoundsPositionHandler);this.notify("afterInitialize")},open:function(c){if(this.isOpen){this.bringToFront();return false}if(this.notify("beforeOpen")===false)return false;if(this.options.closeOnClick){if(this.options.closeOnClick===true)this.closeOnClickContainer=$(document.body);else if(this.options.closeOnClick=="container")this.closeOnClickContainer=this.container;else if(this.options.closeOnClick=="overlay"){Control.Overlay.load();this.closeOnClickContainer=Control.Overlay.container}else this.closeOnClickContainer=$(this.options.closeOnClick);this.closeOnClickContainer.observe("click",this.closeHandler)}if(this.href&&!this.options.iframe&&!this.remoteContentLoaded){this.remoteContentLoaded=true;if(this.href.match(/\.(jpe?g|gif|png|tiff?)$/i)){var a=new Element("img");a.observe("load",function(a){this.getRemoteContentInsertionTarget().insert(a);this.position();if(this.notify("onRemoteContentLoaded")!==false){this.options.indicator&&this.hideIndicator();this.finishOpen()}}.bind(this,a));a.writeAttribute("src",this.href)}else if(!this.ajaxRequest){this.options.indicator&&this.showIndicator();this.ajaxRequest=new Ajax.Request(this.href,{method:this.options.method,parameters:this.options.parameters,onComplete:function(a){this.notify("onComplete",a);this.ajaxRequest=false}.bind(this),onSuccess:function(a){this.getRemoteContentInsertionTarget().insert(a.responseText);this.notify("onSuccess",a);if(this.notify("onRemoteContentLoaded")!==false){this.options.indicator&&this.hideIndicator();this.finishOpen()}}.bind(this),onFailure:function(a){this.notify("onFailure",a);this.options.indicator&&this.hideIndicator()}.bind(this),onException:function(a,b){this.notify("onException",a,b);this.options.indicator&&this.hideIndicator()}.bind(this)})}return true}else if(this.options.iframe&&!this.remoteContentLoaded){this.remoteContentLoaded=true;this.options.indicator&&this.showIndicator();this.getRemoteContentInsertionTarget().insert(Control.Window.iframeTemplate.evaluate({href:this.href}));var b=this.container.down("iframe");b.onload=function(){this.notify("onRemoteContentLoaded");this.options.indicator&&this.hideIndicator();b.onload=null}.bind(this)}this.finishOpen(c);return true},close:function(a){if(!this.isOpen||this.notify("beforeClose",a)===false)return false;this.options.closeOnClick&&this.closeOnClickContainer.stopObserving("click",this.closeHandler);if(this.options.fade)this.effects.fade=new Effect.Fade(this.container,{queue:{position:"front",scope:"Control.Window"+this.numberInSequence},from:1,to:0,duration:this.options.fadeDuration/2,afterFinish:function(){this.iFrameShim&&this.iFrameShim.hide();this.isOpen=false;this.notify("afterClose")}.bind(this)});else{this.container.hide();this.iFrameShim&&this.iFrameShim.hide()}this.ajaxRequest&&this.ajaxRequest.transport.abort();!(this.options.draggable||this.options.resizable)&&this.options.position=="center"&&Event.stopObserving(window,"resize",this.positionHandler);!this.options.draggable&&this.options.position=="center"&&Event.stopObserving(window,"scroll",this.positionHandler);this.options.indicator&&this.hideIndicator();if(!this.options.fade){this.isOpen=false;this.notify("afterClose")}return true},position:function(h){if(this.options.position=="mouse"){var e=[Event.pointerX(h),Event.pointerY(h)];this.container.setStyle({top:e[1]+$value(this.options.offsetTop)+"px",left:e[0]+$value(this.options.offsetLeft)+"px"});return}var a=this.container.getDimensions(),b=document.viewport.getDimensions();Position.prepare();var f=Position.deltaX+Math.floor((b.width-a.width)/2),g=Position.deltaY+(b.height>a.height?Math.floor((b.height-a.height)/2):0);if(this.options.position=="center")this.container.setStyle({top:a.height<=b.height?(g!=null&&g>0?g:0)+"px":0,left:a.width<=b.width?(f!=null&&f>0?f:0)+"px":0});else if(this.options.position=="relative"){var e=this.sourceContainer.cumulativeOffset(),d=e[1]+$value(this.options.offsetTop),c=e[0]+$value(this.options.offsetLeft);this.container.setStyle({top:a.height<=b.height?(this.options.constrainToViewport?Math.max(0,Math.min(b.height-a.height,d)):d)+"px":0,left:a.width<=b.width?(this.options.constrainToViewport?Math.max(0,Math.min(b.width-a.width,c)):c)+"px":0})}else if(this.options.position.length){var d=$value(this.options.position[1])+$value(this.options.offsetTop),c=$value(this.options.position[0])+$value(this.options.offsetLeft);this.container.setStyle({top:a.height<=b.height?(this.options.constrainToViewport?Math.max(0,Math.min(b.height-a.height,d)):d)+"px":0,left:a.width<=b.width?(this.options.constrainToViewport?Math.max(0,Math.min(b.width-a.width,c)):c)+"px":0})}this.iFrameShim&&this.updateIFrameShimZIndex()},ensureInBounds:function(){if(!this.isOpen)return;var b=document.viewport.getDimensions(),c=this.container.cumulativeOffset(),a=this.container.getDimensions();c.left+a.width>b.width&&this.container.setStyle({left:Math.max(0,b.width-a.width)+"px"});c.top+a.height>b.height&&this.container.setStyle({top:Math.max(0,b.height-a.height)+"px"})},bringToFront:function(){Control.Window.bringToFront(this);this.notify("bringToFront")},destroy:function(){this.container.stopObserving("mousedown",this.bringToFrontHandler);if(this.draggable){Draggables.removeObserver(this.container);this.draggable.handle.stopObserving("mousedown",this.bringToFrontHandler);this.draggable.destroy()}if(this.resizable){Resizables.removeObserver(this.container);this.resizable.handle.stopObserving("mousedown",this.bringToFrontHandler);this.resizable.destroy()}this.container&&!this.sourceContainer&&this.container.remove();if(this.sourceContainer)if(this.options.hover){this.sourceContainer.stopObserving("mouseenter",this.sourceContainerOpenHandler);this.sourceContainer.stopObserving("mouseleave",this.sourceContainerCloseHandler);this.options.position=="mouse"&&this.sourceContainer.stopObserving("mousemove",this.sourceContainerMouseMoveHandler)}else this.sourceContainer.stopObserving("click",this.sourceContainerOpenHandler);this.iFrameShim&&this.iFrameShim.destroy();Event.stopObserving(window,"resize",this.outOfBoundsPositionHandler);Control.Window.windows=Control.Window.windows.without(this);this.notify("afterDestroy")},applyResizable:function(){if(this.options.resizable){if(typeof Resizable=="undefined")throw"Control.Window requires resizable.js to be loaded.";var a=null;if(this.options.resizable===true){a=new Element("div",{className:"resizable_handle"});this.container.insert(a)}else a=$(this.options.resziable);this.resizable=new Resizable(this.container,{handle:a,minHeight:this.options.minHeight,minWidth:this.options.minWidth,maxHeight:this.options.constrainToViewport?function(a){return document.viewport.getDimensions().height-parseInt(a.style.top||0)-(a.getHeight()-parseInt(a.style.height||0))}:this.options.maxHeight,maxWidth:this.options.constrainToViewport?function(a){return document.viewport.getDimensions().width-parseInt(a.style.left||0)-(a.getWidth()-parseInt(a.style.width||0))}:this.options.maxWidth});this.resizable.handle.observe("mousedown",this.bringToFrontHandler);Resizables.addObserver(new Control.Window.LayoutUpdateObserver(this,function(){this.iFrameShim&&this.updateIFrameShimZIndex();this.notify("onResize")}.bind(this)))}},applyDraggable:function(){if(this.options.draggable){if(typeof Draggables=="undefined")throw"Control.Window requires dragdrop.js to be loaded.";var a=null;if(this.options.draggable===true){a=new Element("div",{className:"draggable_handle"});this.container.insert(a)}else a=$(this.options.draggable);this.draggable=new Draggable(this.container,{handle:a,constrainToViewport:this.options.constrainToViewport,zindex:this.container.getStyle("z-index"),starteffect:function(){if(Prototype.Browser.IE){this.old_onselectstart=document.onselectstart;document.onselectstart=function(){return false}}}.bind(this),endeffect:function(){document.onselectstart=this.old_onselectstart}.bind(this)});this.draggable.handle.observe("mousedown",this.bringToFrontHandler);Draggables.addObserver(new Control.Window.LayoutUpdateObserver(this,function(){this.iFrameShim&&this.updateIFrameShimZIndex();this.notify("onDrag")}.bind(this)))}},createDefaultContainer:function(a){if(!this.container){this.container=new Element("div",{id:"control_window_"+this.numberInSequence});$(document.body).insert(this.container);typeof a=="string"&&$(a)==null&&!a.match(/^#(.+)$/)&&!a.match(Control.Window.uriRegex)&&this.container.update(a)}},finishOpen:function(a){this.bringToFront();if(this.options.fade){if(typeof Effect=="undefined")throw"Control.Window requires effects.js to be loaded.";this.effects.fade&&this.effects.fade.cancel();this.effects.appear=new Effect.Appear(this.container,{queue:{position:"end",scope:"Control.Window."+this.numberInSequence},from:0,to:1,duration:this.options.fadeDuration/2,afterFinish:function(){this.iFrameShim&&this.updateIFrameShimZIndex();this.isOpen=true;this.notify("afterOpen")}.bind(this)})}else this.container.show();this.position(a);!(this.options.draggable||this.options.resizable)&&this.options.position=="center"&&Event.observe(window,"resize",this.positionHandler,false);!this.options.draggable&&this.options.position=="center"&&Event.observe(window,"scroll",this.positionHandler,false);if(!this.options.fade){this.isOpen=true;this.notify("afterOpen")}return true},showIndicator:function(){this.showIndicatorTimeout=window.setTimeout(function(){if(this.options.fade)this.indicatorEffects.appear=new Effect.Appear(this.indicator,{queue:{position:"front",scope:"Control.Window.indicator."+this.numberInSequence},from:0,to:1,duration:this.options.fadeDuration/2});else this.indicator.show()}.bind(this),Control.Window.indicatorTimeout)},hideIndicator:function(){this.showIndicatorTimeout&&window.clearTimeout(this.showIndicatorTimeout);this.indicator.hide()},getRemoteContentInsertionTarget:function(){return typeof this.options.insertRemoteContentAt=="string"?this.container.down(this.options.insertRemoteContentAt):$(this.options.insertRemoteContentAt)},updateIFrameShimZIndex:function(){this.iFrameShim&&this.iFrameShim.positionUnder(this.container)}});Object.extend(Control.Window,{windows:[],baseZIndex:9999,indicatorTimeout:250,iframeTemplate:new Template('<iframe src="#{href}" width="100%" height="100%" frameborder="0"></iframe>'),uriRegex:/^(\/|\#|https?\:\/\/|[\w]+\/)/,bringToFront:function(a){Control.Window.windows=Control.Window.windows.without(a);Control.Window.windows.push(a);Control.Window.windows.each(function(a,c){var b=Control.Window.baseZIndex+c;a.container.setStyle({zIndex:b});if(a.isOpen)a.iFrameShim&&a.updateIFrameShimZIndex();if(a.options.draggable)a.draggable.options.zindex=b})},open:function(b,c){var a=new Control.Window(b,c);a.open();return a},initialZIndexForWindow:function(){return Control.Window.baseZIndex+(Control.Window.windows.length-1)}});Object.Event.extend(Control.Window);Control.Window.LayoutUpdateObserver=Class.create({initialize:function(a,b){this.w=a;this.element=$(a.container);this.observer=b},onStart:Prototype.emptyFunction,onEnd:function(b,a){a.element==this.element&&this.iFrameShim&&this.w.updateIFrameShimZIndex()},onResize:function(b,a){a.element==this.element&&this.observer(this.element)},onDrag:function(b,a){a.element==this.element&&this.observer(this.element)}});Control.Overlay={id:"control_overlay",loaded:false,container:false,lastOpacity:0,styles:{position:"fixed",top:0,left:0,width:"100%",height:"100%",zIndex:9998},ieStyles:{position:"absolute",top:0,left:0,zIndex:9998},effects:{fade:false,appear:false},load:function(){if(Control.Overlay.loaded)return false;Control.Overlay.loaded=true;Control.Overlay.container=new Element("div",{id:Control.Overlay.id});$(document.body).insert(Control.Overlay.container);if(Prototype.Browser.IE){Control.Overlay.container.setStyle(Control.Overlay.ieStyles);Event.observe(window,"scroll",Control.Overlay.positionOverlay);Event.observe(window,"resize",Control.Overlay.positionOverlay);Control.Overlay.observe("beforeShow",Control.Overlay.positionOverlay)}else Control.Overlay.container.setStyle(Control.Overlay.styles);Control.Overlay.iFrameShim=new IframeShim;Control.Overlay.iFrameShim.hide();Event.observe(window,"resize",Control.Overlay.positionIFrameShim);Control.Overlay.container.hide();return true},unload:function(){if(!Control.Overlay.loaded)return false;Event.stopObserving(window,"resize",Control.Overlay.positionOverlay);Control.Overlay.stopObserving("beforeShow",Control.Overlay.positionOverlay);Event.stopObserving(window,"resize",Control.Overlay.positionIFrameShim);Control.Overlay.iFrameShim.destroy();Control.Overlay.container.remove();Control.Overlay.loaded=false;return true},show:function(b,a){if(Control.Overlay.notify("beforeShow")===false)return false;Control.Overlay.lastOpacity=b;Control.Overlay.positionIFrameShim();Control.Overlay.iFrameShim.show();if(a){if(typeof Effect=="undefined")throw"Control.Window requires effects.js to be loaded.";Control.Overlay.effects.fade&&Control.Overlay.effects.fade.cancel();Control.Overlay.effects.appear=new Effect.Appear(Control.Overlay.container,{queue:{position:"end",scope:"Control.Overlay"},afterFinish:function(){Control.Overlay.notify("afterShow")},from:0,to:Control.Overlay.lastOpacity,duration:(a===true?.75:a)/2})}else{Control.Overlay.container.setStyle({opacity:b||1});Control.Overlay.container.show();Control.Overlay.notify("afterShow")}return true},hide:function(a){if(Control.Overlay.notify("beforeHide")===false)return false;Control.Overlay.effects.appear&&Control.Overlay.effects.appear.cancel();Control.Overlay.iFrameShim.hide();if(a)Control.Overlay.effects.fade=new Effect.Fade(Control.Overlay.container,{queue:{position:"front",scope:"Control.Overlay"},afterFinish:function(){Control.Overlay.notify("afterHide")},from:Control.Overlay.lastOpacity,to:0,duration:(a===true?.75:a)/2});else{Control.Overlay.container.hide();Control.Overlay.notify("afterHide")}return true},positionIFrameShim:function(){Control.Overlay.container.visible()&&Control.Overlay.iFrameShim.positionUnder(Control.Overlay.container)},positionOverlay:function(){Control.Overlay.container.setStyle({width:document.body.clientWidth+"px",height:document.body.clientHeight+"px"})}};Object.Event.extend(Control.Overlay);Control.ToolTip=Class.create(Control.Window,{initialize:function(d,a,c,b){d(c,Object.extend(Object.extend(Object.clone(Control.ToolTip.defaultOptions),b||{}),{position:"mouse",hover:a}))}});Object.extend(Control.ToolTip,{defaultOptions:{offsetLeft:10}});Control.Modal=Class.create(Control.Window,{initialize:function(c,a,b){Control.Modal.InstanceMethods.beforeInitialize.bind(this)();c(a,Object.extend(Object.clone(Control.Modal.defaultOptions),b||{}))}});Object.extend(Control.Modal,{defaultOptions:{overlayOpacity:.5,closeOnClick:"overlay"},current:false,open:function(b,c){var a=new Control.Modal(b,c);a.open();return a},close:function(){Control.Modal.current&&Control.Modal.current.close()},InstanceMethods:{beforeInitialize:function(){Control.Overlay.load();this.overlayFinishedOpening=false;this.observe("beforeOpen",Control.Modal.Observers.beforeOpen.bind(this));this.observe("afterOpen",Control.Modal.Observers.afterOpen.bind(this));this.observe("afterClose",Control.Modal.Observers.afterClose.bind(this))}},Observers:{beforeOpen:function(){if(!this.overlayFinishedOpening){Control.Overlay.observeOnce("afterShow",function(){this.overlayFinishedOpening=true;this.open()}.bind(this));Control.Overlay.show(this.options.overlayOpacity,this.options.fade?this.options.fadeDuration:false);throw $break}else Control.Window.windows.without(this).invoke("close")},afterOpen:function(){Control.Modal.current=this},afterClose:function(){Control.Overlay.hide(this.options.fade?this.options.fadeDuration:false);Control.Modal.current=false;this.overlayFinishedOpening=false}}});Control.LightBox=Class.create(Control.Window,{initialize:function(c,b,a){this.allImagesLoaded=false;if(a.modal){var a=Object.extend(Object.clone(Control.LightBox.defaultOptions),a||{});a=Object.extend(Object.clone(Control.Modal.defaultOptions),a);a=Control.Modal.InstanceMethods.beforeInitialize.bind(this)(a);c(b,a)}else c(b,Object.extend(Object.clone(Control.LightBox.defaultOptions),a||{}));this.hasRemoteContent=this.href&&!this.options.iframe;if(this.hasRemoteContent)this.observe("onRemoteContentLoaded",Control.LightBox.Observers.onRemoteContentLoaded.bind(this));else this.applyImageObservers();this.observe("beforeOpen",Control.LightBox.Observers.beforeOpen.bind(this))},applyImageObservers:function(){var a=this.getImages();this.numberImagesToLoad=a.length;this.numberofImagesLoaded=0;a.each(function(a){a.observe("load",function(){++this.numberofImagesLoaded;if(this.numberImagesToLoad==this.numberofImagesLoaded){this.allImagesLoaded=true;this.onAllImagesLoaded()}}.bind(this,a));a.hide()}.bind(this))},onAllImagesLoaded:function(){this.getImages().each(function(a){this.showImage(a)}.bind(this));if(this.hasRemoteContent){this.options.indicator&&this.hideIndicator();this.finishOpen()}else this.open()},getImages:function(){return this.container.select(Control.LightBox.imageSelector)},showImage:function(a){a.show()}});Object.extend(Control.LightBox,{imageSelector:"img",defaultOptions:{},Observers:{beforeOpen:function(){if(!this.hasRemoteContent&&!this.allImagesLoaded)throw $break},onRemoteContentLoaded:function(){this.applyImageObservers();if(!this.allImagesLoaded)throw $break}}});var dp={sh:{Toolbar:{},Utils:{},RegexLib:{},Brushes:{},Strings:{AboutDialog:'<html><head><title>About...</title></head><body class="dp-about"><table cellspacing="0"><tr><td class="copy"><p class="title">dp.SyntaxHighlighter</div><div class="para">Version: {V}</p><p><a href="http://www.dreamprojections.com/syntaxhighlighter/?ref=about" target="_blank">http://www.dreamprojections.com/syntaxhighlighter</a></p>&copy;2004-2007 Alex Gorbatchev.</td></tr><tr><td class="footer"><input type="button" class="close" value="OK" onClick="window.close()"/></td></tr></table></body></html>'},ClipboardSwf:null,Version:"1.5"}};dp.SyntaxHighlighter=dp.sh;dp.sh.Toolbar.Commands={ExpandSource:{label:"+ expand source",check:function(a){return a.collapse},func:function(b,a){b.parentNode.removeChild(b);a.div.className=a.div.className.replace("collapsed","")}},ViewSource:{label:"view plain",func:function(d,b){var c=b.originalCode.replace(/</g,"&lt;"),a=window.open("","_blank","width=750, height=400, location=0, resizable=1, menubar=0, scrollbars=0");a.document.write('<textarea style="width:99%;height:99%">'+c+"</textarea>");a.document.close()}},CopyToClipboard:{label:"copy to clipboard",check:function(){return window.clipboardData!=null||dp.sh.ClipboardSwf!=null},func:function(d,b){var c=b.originalCode;if(window.clipboardData)window.clipboardData.setData("text",c);else if(dp.sh.ClipboardSwf!=null){var a=b.flashCopier;if(a==null){a=document.createElement("div");b.flashCopier=a;b.div.appendChild(a)}a.innerHTML='<embed src="'+dp.sh.ClipboardSwf+'" FlashVars="clipboard='+encodeURIComponent(c)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>'}alert("The code is in your clipboard now")}},PrintSource:{label:"print",func:function(d,c){var a=document.createElement("IFRAME"),b=null;a.style.cssText="position:absolute;width:0px;height:0px;left:-500px;top:-500px;";document.body.appendChild(a);b=a.contentWindow.document;dp.sh.Utils.CopyStyles(b,window.document);b.write('<div class="'+c.div.className.replace("collapsed","")+' printing">'+c.div.innerHTML+"</div>");b.close();a.contentWindow.focus();a.contentWindow.print();alert("Printing...");document.body.removeChild(a)}},About:{label:"?",func:function(){var b=window.open("","_blank","dialog,width=300,height=150,scrollbars=0"),a=b.document;dp.sh.Utils.CopyStyles(a,window.document);a.write(dp.sh.Strings.AboutDialog.replace("{V}",dp.sh.Version));a.close();b.focus()}}};dp.sh.Toolbar.Create=function(d){var b=document.createElement("DIV");b.className="tools";for(var c in dp.sh.Toolbar.Commands){var a=dp.sh.Toolbar.Commands[c];if(a.check!=null&&!a.check(d))continue;b.innerHTML+='<a href="#" onclick="dp.sh.Toolbar.Command(\''+c+"',this);return false;\">"+a.label+"</a>"}return b};dp.sh.Toolbar.Command=function(c,b){var a=b;while(a!=null&&a.className.indexOf("dp-highlighter")==-1)a=a.parentNode;a!=null&&dp.sh.Toolbar.Commands[c].func(b,a.highlighter)};dp.sh.Utils.CopyStyles=function(d,c){for(var b=c.getElementsByTagName("link"),a=0;a<b.length;a++)b[a].rel.toLowerCase()=="stylesheet"&&d.write('<link type="text/css" rel="stylesheet" href="'+b[a].href+'"></link>')};dp.sh.RegexLib={MultiLineCComments:new RegExp("/\\*[\\s\\S]*?\\*/","gm"),SingleLineCComments:new RegExp("//.*$","gm"),SingleLinePerlComments:new RegExp("#.*$","gm"),DoubleQuotedString:new RegExp('"(?:\\.|(\\\\\\")|[^\\""])*"',"g"),SingleQuotedString:new RegExp("'(?:\\.|(\\\\\\')|[^\\''])*'","g")};dp.sh.Match=function(a,b,c){this.value=a;this.index=b;this.length=a.length;this.css=c};dp.sh.Highlighter=function(){this.noGutter=false;this.addControls=true;this.collapse=false;this.tabsToSpaces=true;this.wrapColumn=80;this.showColumns=true};dp.sh.Highlighter.SortCallback=function(a,b){if(a.index<b.index)return -1;else if(a.index>b.index)return 1;else if(a.length<b.length)return -1;else if(a.length>b.length)return 1;return 0};dp.sh.Highlighter.prototype.CreateElement=function(b){var a=document.createElement(b);a.highlighter=this;return a};dp.sh.Highlighter.prototype.GetMatches=function(b,c){var d=0,a=null;while((a=b.exec(this.code))!=null)this.matches[this.matches.length]=new dp.sh.Match(a[0],a.index,c)};dp.sh.Highlighter.prototype.AddBit=function(a,e){if(a==null||a.length==0)return;var b=this.CreateElement("SPAN");a=a.replace(/ /g,"&nbsp;");a=a.replace(/</g,"&lt;");a=a.replace(/\n/gm,"&nbsp;<br>");if(e!=null)if(/br/gi.test(a))for(var d=a.split("&nbsp;<br>"),c=0;c<d.length;c++){b=this.CreateElement("SPAN");b.className=e;b.innerHTML=d[c];this.div.appendChild(b);c+1<d.length&&this.div.appendChild(this.CreateElement("BR"))}else{b.className=e;b.innerHTML=a;this.div.appendChild(b)}else{b.innerHTML=a;this.div.appendChild(b)}};dp.sh.Highlighter.prototype.IsInside=function(a){if(a==null||a.length==0)return false;for(var c=0;c<this.matches.length;c++){var b=this.matches[c];if(b==null)continue;if(a.index>b.index&&a.index<b.index+b.length)return true}return false};dp.sh.Highlighter.prototype.ProcessRegexList=function(){for(var a=0;a<this.regexList.length;a++)this.GetMatches(this.regexList[a].regex,this.regexList[a].css)};dp.sh.Highlighter.prototype.ProcessSmartTabs=function(h){var c=h.split("\n"),b="",g=4,d="\t";function e(a,c,e){for(var g=a.substr(0,c),f=a.substr(c+1,a.length),b="",d=0;d<e;d++)b+=" ";return g+b+f}function f(a,c){if(a.indexOf(d)==-1)return a;var b=0;while((b=a.indexOf(d))!=-1){var f=c-b%c;a=e(a,b,f)}return a}for(var a=0;a<c.length;a++)b+=f(c[a],g)+"\n";return b};dp.sh.Highlighter.prototype.SwitchToList=function(){var i=this.div.innerHTML.replace(/<(br)\/?>/gi,"\n"),e=i.split("\n");this.addControls==true&&this.bar.appendChild(dp.sh.Toolbar.Create(this));if(this.showColumns){var c=this.CreateElement("div"),b=this.CreateElement("div"),h=10,a=1;while(a<=150)if(a%h==0){c.innerHTML+=a;a+=(a+"").length}else{c.innerHTML+="&middot;";a++}b.className="columns";b.appendChild(c);this.bar.appendChild(b)}for(var a=0,g=this.firstLine;a<e.length-1;a++,g++){var d=this.CreateElement("LI"),f=this.CreateElement("SPAN");d.className=a%2==0?"alt":"";f.innerHTML=e[a]+"&nbsp;";d.appendChild(f);this.ol.appendChild(d)}this.div.innerHTML=""};dp.sh.Highlighter.prototype.Highlight=function(c){function h(a){return a.replace(/^\s*(.*?)[\s\n]*$/g,"$1")}function f(a){return a.replace(/\n*$/,"").replace(/^\n*/,"")}function e(f){for(var b=f.split("\n"),g=[],e=new RegExp("^\\s*","g"),c=1e3,a=0;a<b.length&&c>0;a++){if(h(b[a]).length==0)continue;var d=e.exec(b[a]);if(d!=null&&d.length>0)c=Math.min(d[0].length,c)}if(c>0)for(var a=0;a<b.length;a++)b[a]=b[a].substr(c);return b.join("\n")}function g(b,a,c){return b.substr(a,c-a)}var d=0;if(c==null)c="";this.originalCode=c;this.code=f(e(c));this.div=this.CreateElement("DIV");this.bar=this.CreateElement("DIV");this.ol=this.CreateElement("OL");this.matches=[];this.div.className="dp-highlighter";this.div.highlighter=this;this.bar.className="bar";this.ol.start=this.firstLine;if(this.CssClass!=null)this.ol.className=this.CssClass;if(this.collapse)this.div.className+=" collapsed";if(this.noGutter)this.div.className+=" nogutter";if(this.tabsToSpaces==true)this.code=this.ProcessSmartTabs(this.code);this.ProcessRegexList();if(this.matches.length==0){this.AddBit(this.code,null);this.SwitchToList();this.div.appendChild(this.ol);return}this.matches=this.matches.sort(dp.sh.Highlighter.SortCallback);for(var b=0;b<this.matches.length;b++)if(this.IsInside(this.matches[b]))this.matches[b]=null;for(var b=0;b<this.matches.length;b++){var a=this.matches[b];if(a==null||a.length==0)continue;this.AddBit(g(this.code,d,a.index),null);this.AddBit(a.value,a.css);d=a.index+a.length}this.AddBit(this.code.substr(d),null);this.SwitchToList();this.div.appendChild(this.bar);this.div.appendChild(this.ol)};dp.sh.Highlighter.prototype.GetKeywords=function(a){return "\\b"+a.replace(/ /g,"\\b|\\b")+"\\b"};dp.sh.HighlightAll=function(t,m,j,k,n,l){function s(){for(var b=arguments,a=0;a<b.length;a++){if(b[a]==null)continue;if(typeof b[a]=="string"&&b[a]!="")return b[a]+"";if(typeof b[a]=="object"&&b[a].value!="")return b[a].value+""}return null}function e(c,b){for(var a=0;a<b.length;a++)if(b[a]==c)return true;return false}function q(f,c,d){for(var e=new RegExp("^"+f+"\\[(\\w+)\\]$","gi"),b=null,a=0;a<c.length;a++)if((b=e.exec(c[a]))!=null)return b[1];return d}function p(d,e,c){for(var b=document.getElementsByTagName(c),a=0;a<b.length;a++)b[a].getAttribute("class")==e&&d.push(b[a])}var f=[],a=null,g={},r="innerHTML";p(f,t,"code");if(f.length==0)return;for(var o in dp.sh.Brushes){var i=dp.sh.Brushes[o].Aliases;if(i==null)continue;for(var d=0;d<i.length;d++)g[i[d]]=o}for(var d=0;d<f.length;d++){var b=f[d],c=s(b.attributes["class"],b.className,b.attributes["language"],b.language),h="";if(c==null)continue;c=c.split(":");h=c[0].toLowerCase();if(g[h]==null)continue;a=new dp.sh.Brushes[g[h]]();b.style.display="none";a.noGutter=m==null?e("nogutter",c):!m;a.addControls=j==null?!e("nocontrols",c):j;a.collapse=k==null?e("collapse",c):k;a.showColumns=l==null?e("showcolumns",c):l;a.firstLine=n==null?parseInt(q("firstline",c,1)):n;a.Highlight(b[r]);a.source=b;b.parentNode.insertBefore(a.div,b)}};dp.sh.Brushes.JScript=function(){var b="\\$ abstract boolean break byte case catch char class const continue debugger default delete do double else enum export extends final finally float for function goto if implements import in instanceof int interface long native new package private protected public return short static super switch synchronized throw throws transient try typeof var void volatile while with",a="true false null TRUE FALSE NULL [0-9]+",c="window document event Object Function Math Array Hash String Date RegExp";this.regexList=[{regex:dp.sh.RegexLib.SingleLineCComments,css:"comment"},{regex:dp.sh.RegexLib.MultiLineCComments,css:"comment"},{regex:dp.sh.RegexLib.DoubleQuotedString,css:"string"},{regex:dp.sh.RegexLib.SingleQuotedString,css:"string"},{regex:new RegExp("^\\s*#.*","gm"),css:"preprocessor"},{regex:new RegExp(this.GetKeywords(b),"gm"),css:"keyword"},{regex:new RegExp(this.GetKeywords(c),"gm"),css:"builtin"},{regex:new RegExp(this.GetKeywords(a),"g"),css:"constants"},{regex:new RegExp("this(?=(\\.|\\,|\\)))","g"),css:"_this"},{regex:new RegExp("(\\s|\\{|\\,)[a-zA-Z0-9_]+(?=\\s?:\\s?function)","gm"),css:"func_dec"},{regex:new RegExp("on(R(ow(s(inserted|delete)|e(nter|xit))|e(s(ize(start|end)?|et)|adystatechange))|Mouse(o(ut|ver)|down|up|move)|B(efore(cut|deactivate|u(nload|pdate)|p(aste|rint)|editfocus|activate)|lur)|S(croll|top|ubmit|elect(start|ionchange)?)|H(over|elp)|C(hange|ont(extmenu|rolselect)|ut|ellchange|l(ick|ose))|D(eactivate|ata(setc(hanged|omplete)|available)|r(op|ag(start|over|drop|en(ter|d)|leave)?)|blclick)|Unload|P(aste|ropertychange)|Error(update)?|Key(down|up|press)|Focus|Load|A(ctivate|fter(update|print)|bort))","g"),css:"support_property"},{regex:new RegExp("(s(h(ift|ow(Mod(elessDialog|alDialog)|Help))|croll(X|By(Pages|Lines)?|Y|To)?|t(op|rike)|i(n|zeToContent|debar|gnText)|ort|u(p|b(str(ing)?)?)|pli(ce|t)|e(nd|t(Re(sizable|questHeader)|M(i(nutes|lliseconds)|onth)|Seconds|Ho(tKeys|urs)|Year|Cursor|Time(out)?|Interval|ZOptions|Date|UTC(M(i(nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(ome|andleEvent)|navigate|c(har(CodeAt|At)|o(s|n(cat|textual|firm)|mpile)|eil|lear(Timeout|Interval)?|a(ptureEvents|ll)|reate(StyleSheet|Popup|EventObject))|t(o(GMTString|S(tring|ource)|U(TCString|pperCase)|Lo(caleString|werCase))|est|a(n|int(Enabled)?))|i(s(NaN|Finite)|ndexOf|talics)|d(isableExternalCapture|ump|etachEvent)|u(n(shift|taint|escape|watch)|pdateCommands)|j(oin|avaEnabled)|p(o(p|w)|ush|lugins.refresh|a(ddings|rse(Int|Float)?)|r(int|ompt|eference))|e(scape|nableExternalCapture|val|lementFromPoint|x(p|ec(Script|Command)?))|valueOf|UTC|queryCommand(State|Indeterm|Enabled|Value)|f(i(nd|le(ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(nt(size|color)|rward)|loor|romCharCode)|watch|l(ink|o(ad|g)|astIndexOf)|a(sin|nchor|cos|t(tachEvent|ob|an(2)?)|pply|lert|b(s|ort))|r(ou(nd|teEvents)|e(size(By|To)|calc|turnValue|place|verse|l(oad|ease(Capture|Events)))|andom)|g(o|et(ResponseHeader|M(i(nutes|lliseconds)|onth)|Se(conds|lection)|Hours|Year|Time(zoneOffset)?|Da(y|te)|UTC(M(i(nutes|lliseconds)|onth)|Seconds|Hours|Da(y|te)|FullYear)|FullYear|A(ttention|llResponseHeaders)))|m(in|ove(B(y|elow)|To(Absolute)?|Above)|ergeAttributes|a(tch|rgins|x))|b(toa|ig|o(ld|rderWidths)|link|ack))(?=\\()","g"),css:"support_method"},{regex:new RegExp("(s(ub(stringData|mit)|plitText|e(t(NamedItem|Attribute(Node)?)|lect))|has(ChildNodes|Feature)|namedItem|c(l(ick|o(se|neNode))|reate(C(omment|DATASection|aption)|T(Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(ntityReference|lement)|Attribute))|tabIndex|i(nsert(Row|Before|Cell|Data)|tem)|open|delete(Row|C(ell|aption)|T(Head|Foot)|Data)|focus|write(ln)?|a(dd|ppend(Child|Data))|re(set|place(Child|Data)|move(NamedItem|Child|Attribute(Node)?)?)|get(NamedItem|Element(sBy(Name|TagName)|ById)|Attribute(Node)?)|blur)(?=\\()","g"),css:"support_method"},{regex:new RegExp("on(R(ow(s(inserted|delete)|e(nter|xit))|e(s(ize(start|end)?|et)|adystatechange))|Mouse(o(ut|ver)|down|up|move)|B(efore(cut|deactivate|u(nload|pdate)|p(aste|rint)|editfocus|activate)|lur)|S(croll|top|ubmit|elect(start|ionchange)?)|H(over|elp)|C(hange|ont(extmenu|rolselect)|ut|ellchange|l(ick|ose))|D(eactivate|ata(setc(hanged|omplete)|available)|r(op|ag(start|over|drop|en(ter|d)|leave)?)|blclick)|Unload|P(aste|ropertychange)|Error(update)?|Key(down|up|press)|Focus|Load|A(ctivate|fter(update|print)|bort))","g"),css:"support_property"},{regex:new RegExp("\\.(s(ystemLanguage|cr(ipts|ollbars|een(X|Y|Top|Left))|t(yle(Sheets)?|atus(Text|bar)?)|ibling(Below|Above)|ource|uffixes|e(curity(Policy)?|l(ection|f)))|h(istory|ost(name)?|as(h|Focus))|y|X(MLDocument|SLDocument)|n(ext|ame(space(s|URI)|Prop))|M(IN_VALUE|AX_VALUE)|c(haracterSet|o(n(structor|trollers)|okieEnabled|lorDepth|mp(onents|lete))|urrent|puClass|l(i(p(boardData)?|entInformation)|osed|asses)|alle(e|r)|rypto)|t(o(olbar|p)|ext(Transform|Indent|Decoration|Align)|ags)|SQRT(1_2|2)|i(n(ner(Height|Width)|put)|ds|gnoreCase)|zIndex|o(scpu|n(readystatechange|Line)|uter(Height|Width)|p(sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(i(splay|alog(Height|Top|Width|Left|Arguments)|rectories)|e(scription|fault(Status|Ch(ecked|arset)|View)))|u(ser(Profile|Language|Agent)|n(iqueID|defined)|pdateInterval)|_content|p(ixelDepth|ort|ersonalbar|kcs11|l(ugins|atform)|a(thname|dding(Right|Bottom|Top|Left)|rent(Window|Layer)?|ge(X(Offset)?|Y(Offset)?))|r(o(to(col|type)|duct(Sub)?|mpter)|e(vious|fix)))|e(n(coding|abledPlugin)|x(ternal|pando)|mbeds)|v(isibility|endor(Sub)?|Linkcolor)|URLUnencoded|P(I|OSITIVE_INFINITY)|f(ilename|o(nt(Size|Family|Weight)|rmName)|rame(s|Element)|gColor)|E|whiteSpace|l(i(stStyleType|n(eHeight|kColor))|o(ca(tion(bar)?|lName)|wsrc)|e(ngth|ft(Context)?)|a(st(M(odified|atch)|Index|Paren)|yer(s|X)|nguage))|a(pp(MinorVersion|Name|Co(deName|re)|Version)|vail(Height|Top|Width|Left)|ll|r(ity|guments)|Linkcolor|bove)|r(ight(Context)?|e(sponse(XML|Text)|adyState))|global|x|m(imeTypes|ultiline|enubar|argin(Right|Bottom|Top|Left))|L(N(10|2)|OG(10E|2E))|b(o(ttom|rder(RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(Color|Image)))","g"),css:"support_property"}];this.CssClass="javascript"};dp.sh.Brushes.JScript.prototype=new dp.sh.Highlighter;dp.sh.Brushes.JScript.Aliases=["js","jscript","javascript"];dp.sh.Brushes.CSS=function(){var a="ascent azimuth background-attachment background-color background-image background-position background-repeat background baseline bbox border-collapse border-color border-spacing border-style border-top border-right border-bottom border-left border-top-color border-right-color border-bottom-color border-left-color border-top-style border-right-style border-bottom-style border-left-style border-top-width border-right-width border-bottom-width border-left-width border-width border bottom cap-height caption-side centerline clear clip color content counter-increment counter-reset cue-after cue-before cue cursor definition-src descent direction display elevation empty-cells float font-size-adjust font-family font-size font-stretch font-style font-variant font-weight font height letter-spacing line-height list-style-image list-style-position list-style-type list-style margin-top margin-right margin-bottom margin-left margin marker-offset marks mathline max-height max-width min-height min-width orphans outline-color outline-style outline-width outline overflow padding-top padding-right padding-bottom padding-left padding page page-break-after page-break-before page-break-inside pause pause-after pause-before pitch pitch-range play-during position quotes richness right size slope src speak-header speak-numeral speak-punctuation speak speech-rate stemh stemv stress table-layout text-align text-decoration text-indent text-shadow text-transform unicode-bidi unicode-range units-per-em vertical-align visibility voice-family volume white-space widows width widths word-spacing x-height z-index important",b="above absolute all always aqua armenian attr aural auto avoid baseline behind below bidi-override black blink block blue bold bolder both bottom braille capitalize caption center center-left center-right circle close-quote code collapse compact condensed continuous counter counters crop cross crosshair cursive dashed decimal decimal-leading-zero default digits disc dotted double embed embossed e-resize expanded extra-condensed extra-expanded fantasy far-left far-right fast faster fixed format fuchsia gray green groove hand handheld hebrew help hidden hide high higher icon inline-table inline inset inside invert italic justify landscape large larger left-side left leftwards level lighter lime line-through list-item local loud lower-alpha lowercase lower-greek lower-latin lower-roman lower low ltr marker maroon medium message-box middle mix move narrower navy ne-resize no-close-quote none no-open-quote no-repeat normal nowrap n-resize nw-resize oblique olive once open-quote outset outside overline pointer portrait pre print projection purple red relative repeat repeat-x repeat-y rgb ridge right right-side rightwards rtl run-in screen scroll semi-condensed semi-expanded separate se-resize show silent silver slower slow small small-caps small-caption smaller soft solid speech spell-out square s-resize static status-bar sub super sw-resize table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group teal text-bottom text-top thick thin top transparent tty tv ultra-condensed ultra-expanded underline upper-alpha uppercase upper-latin upper-roman url visible wait white wider w-resize x-fast x-high x-large x-loud x-low x-slow x-small x-soft xx-large xx-small yellow",c="[mM]onospace [tT]ahoma [vV]erdana [aA]rial [hH]elvetica [sS]ans-serif [sS]erif";this.regexList=[{regex:dp.sh.RegexLib.MultiLineCComments,css:"comment"},{regex:dp.sh.RegexLib.DoubleQuotedString,css:"string"},{regex:dp.sh.RegexLib.SingleQuotedString,css:"string"},{regex:new RegExp("\\#[a-fA-F0-9]{3,6}","g"),css:"color"},{regex:new RegExp("-?(\\d+)(px|pt|:|\\s)?","g"),css:"size"},{regex:new RegExp(this.GetKeywords(a),"gm"),css:"keyword"},{regex:new RegExp(this.GetKeywords(b),"g"),css:"value"},{regex:new RegExp(this.GetKeywords(c),"g"),css:"fonts"},{regex:new RegExp("(^|\x0a)[\\s\\#\\._\\-a-zA-Z0-9\\:\\,\\*]+[\\s\\n]*(?=\\{)","gm"),css:"rule"}];this.CssClass="css"};dp.sh.Brushes.CSS.prototype=new dp.sh.Highlighter;dp.sh.Brushes.CSS.Aliases=["css"];dp.sh.Brushes.Xml=function(){this.CssClass="xml"};dp.sh.Brushes.Xml.prototype=new dp.sh.Highlighter;dp.sh.Brushes.Xml.Aliases=["xml","xhtml","xslt","html","xhtml"];dp.sh.Brushes.Xml.prototype.ProcessRegexList=function(){function c(a,b){a[a.length]=b}var d=0,a=null,b=null;this.GetMatches(new RegExp("(&lt;|<)\\!\\[[\\w\\s]*?\\[(.|\\s)*?\\]\\](&gt;|>)","gm"),"cdata");this.GetMatches(new RegExp("(&lt;|<)!--\\s*.*?\\s*--(&gt;|>)","gm"),"comments");b=new RegExp("([:\\w-.]+)\\s*=\\s*(\".*?\"|'.*?'|\\w+)*|(\\w+)","gm");while((a=b.exec(this.code))!=null){if(a[1]==null)continue;c(this.matches,new dp.sh.Match(a[1],a.index,"attribute"));a[2]!=undefined&&c(this.matches,new dp.sh.Match(a[2],a.index+a[0].indexOf(a[2]),"attribute-value"))}this.GetMatches(new RegExp("(&lt;|<)/*\\?*(?!\\!)|/*\\?*(&gt;|>)","gm"),"tag");b=new RegExp("(?:&lt;|<)/*\\?*\\s*([:\\w-.]+)","gm");while((a=b.exec(this.code))!=null)c(this.matches,new dp.sh.Match(a[1],a.index+a[0].indexOf(a[1]),"tag-name"))};Event.observe(window,"load",function(){dp.sh.HighlightAll("javascript",false,false,false,true,false);dp.sh.HighlightAll("css",false,false,false,true,false);dp.sh.HighlightAll("xml",false,false,false,true,false)});var Showdown={};Showdown.converter=function(){var d,c,g,l=0;this.makeHtml=function(a){d=[];c=[];g=[];a=a.replace(/~/g,"~T");a=a.replace(/\$/g,"~D");a=a.replace(/\r\n/g,"\n");a=a.replace(/\r/g,"\n");a="\n\n"+a+"\n\n";a=t(a);a=a.replace(/^[ \t]+$/mg,"");a=p(a);a=w(a);a=k(a);a=n(a);a=a.replace(/~D/g,"$$");a=a.replace(/~T/g,"~");return a};var w=function(a){var a=a.replace(/^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*<?(\S+?)>?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|\Z)/gm,function(g,a,f,e,b){a=a.toLowerCase();d[a]=o(f);if(e)return e+b;else if(b)c[a]=b.replace(/"/g,"&quot;");return ""});return a},p=function(a){a=a.replace(/\n/g,"\n\n");var b="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del",c="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math";a=a.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del)\b[^\r]*?\n<\/\2>[ \t]*(?=\n+))/gm,f);a=a.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math)\b[^\r]*?.*<\/\2>[ \t]*(?=\n+)\n)/gm,f);a=a.replace(/(\n[ ]{0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,f);a=a.replace(/(\n\n[ ]{0,3}<!(--[^\r]*?--\s*)+>[ \t]*(?=\n{2,}))/g,f);a=a.replace(/(?:\n\n)([ ]{0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,f);a=a.replace(/\n\n/g,"\n");return a},f=function(c,b){var a=b;a=a.replace(/\n\n/g,"\n");a=a.replace(/^\n/,"");a=a.replace(/\n+$/g,"");a="\n\n~K"+(g.push(a)-1)+"K\n\n";return a},k=function(a){a=F(a);var c=b("<hr />");a=a.replace(/^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$/gm,c);a=a.replace(/^[ ]{0,2}([ ]?\-[ ]?){3,}[ \t]*$/gm,c);a=a.replace(/^[ ]{0,2}([ ]?\_[ ]?){3,}[ \t]*$/gm,c);a=s(a);a=B(a);a=A(a);a=p(a);a=z(a);return a},e=function(a){a=D(a);a=u(a);a=v(a);a=G(a);a=E(a);a=C(a);a=o(a);a=y(a);a=a.replace(/  +\n/g," <br />\n");return a},u=function(b){var c=/(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|<!(--.*?--\s*)+>)/gi;b=b.replace(c,function(c){var b=c.replace(/(.)<\/?code>(?=.)/g,"$1`");b=a(b,"\\`*_");return b});return b},E=function(a){a=a.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,j);a=a.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()<?(.*?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,j);a=a.replace(/(\[([^\[\]]+)\])()()()()()/g,j);return a},j=function(o,k,l,m,n,p,q,h){if(h==undefined)h="";var i=k,j=l,b=m.toLowerCase(),f=n,e=h;if(f==""){if(b=="")b=j.toLowerCase().replace(/ ?\n/g," ");f="#"+b;if(d[b]!=undefined){f=d[b];if(c[b]!=undefined)e=c[b]}else if(i.search(/\(\s*\)$/m)>-1)f="";else return i}f=a(f,"*_");var g='<a href="'+f+'"';if(e!=""){e=e.replace(/"/g,"&quot;");e=a(e,"*_");g+=' title="'+e+'"'}g+=">"+j+"</a>";return g},G=function(a){a=a.replace(/(!\[(.*?)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,q);a=a.replace(/(!\[(.*?)\]\s?\([ \t]*()<?(\S+?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,q);return a},q=function(o,j,k,l,m,p,q,n){var i=j,g=k,e=l.toLowerCase(),f=m,b=n;if(!b)b="";if(f==""){if(e=="")e=g.toLowerCase().replace(/ ?\n/g," ");f="#"+e;if(d[e]!=undefined){f=d[e];if(c[e]!=undefined)b=c[e]}else return i}g=g.replace(/"/g,"&quot;");f=a(f,"*_");var h='<img src="'+f+'" alt="'+g+'"';b=b.replace(/"/g,"&quot;");b=a(b,"*_");h+=' title="'+b+'"';h+=" />";return h},F=function(a){a=a.replace(/^(.+)[ \t]*\n=+[ \t]*\n+/gm,function(c,a){return b("<h1>"+e(a)+"</h1>")});a=a.replace(/^(.+)[ \t]*\n-+[ \t]*\n+/gm,function(c,a){return b("<h2>"+e(a)+"</h2>")});a=a.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm,function(f,c,d){var a=c.length;return b("<h"+a+">"+e(d)+"</h"+a+">")});return a},i,s=function(a){a+="~0";var b=/^(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm;if(l)a=a.replace(b,function(f,d,e){var b=d,c=e.search(/[*+-]/g)>-1?"ul":"ol";b=b.replace(/\n{2,}/g,"\n\n\n");var a=i(b);a=a.replace(/\s+$/,"");a="<"+c+">"+a+"</"+c+">\n";return a});else{b=/(\n\n|^\n?)(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/g;a=a.replace(b,function(h,e,f,g){var d=e,c=f,b=g.search(/[*+-]/g)>-1?"ul":"ol",c=c.replace(/\n{2,}/g,"\n\n\n"),a=i(c);a=d+"<"+b+">\n"+a+"</"+b+">\n";return a})}a=a.replace(/~0/,"");return a};i=function(a){l++;a=a.replace(/\n{2,}$/,"\n");a+="~0";a=a.replace(/(\n)?(^[ \t]*)([*+-]|\d+[.])[ \t]+([^\r]+?(\n{1,2}))(?=\n*(~0|\2([*+-]|\d+[.])[ \t]+))/gm,function(h,c,d,i,f){var a=f,b=c,g=d;if(b||a.search(/\n{2,}/)>-1)a=k(m(a));else{a=s(m(a));a=a.replace(/\n$/,"");a=e(a)}return "<li>"+a+"</li>\n"});a=a.replace(/~0/g,"");l--;return a};var B=function(a){a+="~0";a=a.replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g,function(f,d,e){var a=d,c=e;a=r(m(a));a=t(a);a=a.replace(/^\n+/g,"");a=a.replace(/\n+$/g,"");a="<pre><code>"+a+"\n</code></pre>";return b(a)+c});a=a.replace(/~0/,"");return a},b=function(a){a=a.replace(/(^\n+|\n+$)/g,"");return "\n\n~K"+(g.push(a)-1)+"K\n\n"},D=function(a){a=a.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(d,b,e,c){var a=c;a=a.replace(/^([ \t]*)/g,"");a=a.replace(/[ \t]*$/g,"");a=r(a);return b+"<code>"+a+"</code>"});return a},r=function(b){b=b.replace(/&/g,"&amp;");b=b.replace(/</g,"&lt;");b=b.replace(/>/g,"&gt;");b=a(b,"*_{}[]\\",false);return b},y=function(a){a=a.replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g,"<strong>$2</strong>");a=a.replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g,"<em>$2</em>");return a},A=function(a){a=a.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm,function(d,c){var a=c;a=a.replace(/^[ \t]*>[ \t]?/gm,"~0");a=a.replace(/~0/g,"");a=a.replace(/^[ \t]+$/gm,"");a=k(a);a=a.replace(/(^|\n)/g,"$1  ");a=a.replace(/(\s*<pre>[^\r]+?<\/pre>)/gm,function(c,b){var a=b;a=a.replace(/^  /mg,"~0");a=a.replace(/~0/g,"");return a});return b("<blockquote>\n"+a+"\n</blockquote>")});return a},z=function(d){d=d.replace(/^\n+/g,"");d=d.replace(/\n+$/g,"");for(var i=d.split(/\n{2,}/g),c=[],h=i.length,b=0;b<h;b++){var a=i[b];if(a.search(/~K(\d+)K/g)>=0)c.push(a);else if(a.search(/\S/)>=0){a=e(a);a=a.replace(/^([ \t]*)/g,"<p>");a+="</p>";c.push(a)}}h=c.length;for(var b=0;b<h;b++)while(c[b].search(/~K(\d+)K/)>=0){var f=g[RegExp.$1];f=f.replace(/\$/g,"$$$$");c[b]=c[b].replace(/~K\d+K/,f)}return c.join("\n\n")},o=function(a){a=a.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g,"&amp;");a=a.replace(/<(?![a-z\/?\$!])/gi,"&lt;");return a},v=function(a){a=a.replace(/\\(\\)/g,h);a=a.replace(/\\([`*_{}\[\]()>#+-.!])/g,h);return a},C=function(a){a=a.replace(/<((https?|ftp|dict):[^'">\s]+)>/gi,'<a href="$1">$1</a>');a=a.replace(/<(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,function(b,a){return x(n(a))});return a},x=function(a){function c(c){var a="0123456789ABCDEF",b=c.charCodeAt(0);return a.charAt(b>>4)+a.charAt(b&15)}var b=[function(a){return "&#"+a.charCodeAt(0)+";"},function(a){return "&#x"+c(a)+";"},function(a){return a}];a="mailto:"+a;a=a.replace(/./g,function(a){if(a=="@")a=b[Math.floor(Math.random()*2)](a);else if(a!=":"){var c=Math.random();a=c>.9?b[2](a):c>.45?b[1](a):b[0](a)}return a});a='<a href="'+a+'">'+a+"</a>";a=a.replace(/">.+:/g,'">');return a},n=function(a){a=a.replace(/~E(\d+)E/g,function(c,b){var a=parseInt(b);return String.fromCharCode(a)});return a},m=function(a){a=a.replace(/^(\t|[ ]{1,4})/gm,"~0");a=a.replace(/~0/g,"");return a},t=function(a){a=a.replace(/\t(?=\t)/g,"    ");a=a.replace(/\t/g,"~A~B");a=a.replace(/~B(.+?)~A/g,function(e,d){for(var a=d,c=4-a.length%4,b=0;b<c;b++)a+=" ";return a});a=a.replace(/~A/g,"    ");a=a.replace(/~B/g,"");return a},a=function(b,d,c){var a="(["+d.replace(/([\[\]\\])/g,"\\$1")+"])";if(c)a="\\\\"+a;var e=new RegExp(a,"g");b=b.replace(e,h);return b},h=function(c,b){var a=b.charCodeAt(0);return "~E"+a+"E"}};
