var Prototype={Version:"1.6.0.2",Browser:{IE:!!(window.attachEvent&&!window.opera),Opera:!!window.opera,WebKit:navigator.userAgent.indexOf("AppleWebKit/")>-1,Gecko:navigator.userAgent.indexOf("Gecko")>-1&&navigator.userAgent.indexOf("KHTML")==-1,MobileSafari:!!navigator.userAgent.match(/Apple.*Mobile.*Safari/)},BrowserFeatures:{XPath:!!document.evaluate,ElementExtensions:!!window.HTMLElement,SpecificElementExtensions:document.createElement("div").__proto__&&document.createElement("div").__proto__!==document.createElement("form").__proto__},ScriptFragment:"<script[^>]*>([\\S\\s]*?)</script>",JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(a){return a}};if(Prototype.Browser.MobileSafari){Prototype.BrowserFeatures.SpecificElementExtensions=false}var Class={create:function(){var e=null,b=$A(arguments);if(Object.isFunction(b[0])){e=b.shift()}function d(){this.initialize.apply(this,arguments)}Object.extend(d,Class.Methods);d.superclass=e;d.subclasses=[];if(e){var c=function(){};c.prototype=e.prototype;d.prototype=new c;e.subclasses.push(d)}for(var a=0;a<b.length;a++){d.addMethods(b[a])}if(!d.prototype.initialize){d.prototype.initialize=Prototype.emptyFunction}d.prototype.constructor=d;return d}};Class.Methods={addMethods:function(e){var h=this.superclass&&this.superclass.prototype;var f=Object.keys(e);if(!Object.keys({toString:true}).length){f.push("toString","valueOf")}for(var d=0,b=f.length;d<b;d++){var a=f[d],c=e[a];if(h&&Object.isFunction(c)&&c.argumentNames().first()=="$super"){var g=c,c=Object.extend((function(j){return function(){return h[j].apply(this,arguments)}})(a).wrap(g),{valueOf:function(){return g},toString:function(){return g.toString()}})}this.prototype[a]=c}return this}};var Abstract={};Object.extend=function(a,b){for(var c in b){a[c]=b[c]}return a};Object.extend(Object,{inspect:function(b){try{if(Object.isUndefined(b)){return"undefined"}if(b===null){return"null"}return b.inspect?b.inspect():String(b)}catch(a){if(a instanceof RangeError){return"..."}throw a}},toJSON:function(b){var a=typeof b;switch(a){case"undefined":case"function":case"unknown":return;case"boolean":return b.toString()}if(b===null){return"null"}if(b.toJSON){return b.toJSON()}if(Object.isElement(b)){return}var d=[];for(var c in b){var e=Object.toJSON(b[c]);if(!Object.isUndefined(e)){d.push(c.toJSON()+": "+e)}}return"{"+d.join(", ")+"}"},toQueryString:function(a){return $H(a).toQueryString()},toHTML:function(a){return a&&a.toHTML?a.toHTML():String.interpret(a)},keys:function(a){var c=[];for(var b in a){c.push(b)}return c},values:function(a){var c=[];for(var b in a){c.push(a[b])}return c},clone:function(a){return Object.extend({},a)},isElement:function(a){return a&&a.nodeType==1},isArray:function(a){return a!=null&&typeof a=="object"&&"splice" in a&&"join" in a},isHash:function(a){return a instanceof Hash},isFunction:function(a){return typeof a=="function"},isString:function(a){return typeof a=="string"},isNumber:function(a){return typeof a=="number"},isUndefined:function(a){return typeof a=="undefined"}});Object.extend(Function.prototype,{argumentNames:function(){var a=this.toString().match(/^[\s\(]*function[^(]*\((.*?)\)/)[1].split(",").invoke("strip");return a.length==1&&!a[0]?[]:a},bind:function(){if(arguments.length<2&&Object.isUndefined(arguments[0])){return this}var b=this,c=$A(arguments),a=c.shift();return function(){return b.apply(a,c.concat($A(arguments)))}},bindAsEventListener:function(){var b=this,c=$A(arguments),a=c.shift();return function(d){return b.apply(a,[d||window.event].concat(c))}},curry:function(){if(!arguments.length){return this}var a=this,b=$A(arguments);return function(){return a.apply(this,b.concat($A(arguments)))}},delay:function(){var b=this,c=$A(arguments),a=c.shift()*1000;return window.setTimeout(function(){return b.apply(b,c)},a)},wrap:function(a){var b=this;return function(){return a.apply(this,[b.bind(this)].concat($A(arguments)))}},methodize:function(){if(this._methodized){return this._methodized}var a=this;return this._methodized=function(){return a.apply(null,[this].concat($A(arguments)))}}});Function.prototype.defer=Function.prototype.delay.curry(0.01);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"'};var Try={these:function(){var a;for(var b=0,c=arguments.length;b<c;b++){var f=arguments[b];try{a=f();break}catch(d){}}return a}};RegExp.prototype.match=RegExp.prototype.test;RegExp.escape=function(a){return String(a).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")};var PeriodicalExecuter=Class.create({initialize:function(a,b){this.callback=a;this.frequency=b;this.currentlyExecuting=false;this.registerCallback()},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000)},execute:function(){this.callback(this)},stop:function(){if(!this.timer){return}clearInterval(this.timer);this.timer=null},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.execute()}finally{this.currentlyExecuting=false}}}});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,{gsub:function(d,e){var b="",c=this,a;e=arguments.callee.prepareReplacement(e);while(c.length>0){if(a=c.match(d)){b+=c.slice(0,a.index);b+=String.interpret(e(a));c=c.slice(a.index+a[0].length)}else{b+=c,c=""}}return b},sub:function(b,c,a){c=this.gsub.prepareReplacement(c);a=Object.isUndefined(a)?1:a;return this.gsub(b,function(d){if(--a<0){return d[0]}return c(d)})},scan:function(b,a){this.gsub(b,a);return String(this)},truncate:function(a,b){a=a||30;b=Object.isUndefined(b)?"...":b;return this.length>a?this.slice(0,a-b.length)+b:String(this)},strip:function(){return this.replace(/^\s+/,"").replace(/\s+$/,"")},stripTags:function(){return this.replace(/<\/?[^>]+>/gi,"")},stripScripts:function(){return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"")},extractScripts:function(){var b=new RegExp(Prototype.ScriptFragment,"img");var a=new RegExp(Prototype.ScriptFragment,"im");return(this.match(b)||[]).map(function(c){return(c.match(a)||["",""])[1]})},evalScripts:function(){return this.extractScripts().map(function(script){return eval(script)})},escapeHTML:function(){var a=arguments.callee;a.text.data=this;return a.div.innerHTML},unescapeHTML:function(){var a=new Element("div");a.innerHTML=this.stripTags();return a.childNodes[0]?(a.childNodes.length>1?$A(a.childNodes).inject("",function(b,c){return b+c.nodeValue}):a.childNodes[0].nodeValue):""},toQueryParams:function(b){var a=this.strip().match(/([^?#]*)(#.*)?$/);if(!a){return{}}return a[1].split(b||"&").inject({},function(e,d){if((d=d.split("="))[0]){var c=decodeURIComponent(d.shift());var f=d.length>1?d.join("="):d[0];if(f!=undefined){f=decodeURIComponent(f)}if(c in e){if(!Object.isArray(e[c])){e[c]=[e[c]]}e[c].push(f)}else{e[c]=f}}return e})},toArray:function(){return this.split("")},succ:function(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)},times:function(a){return a<1?"":new Array(a+1).join(this)},camelize:function(){var a=this.split("-"),d=a.length;if(d==1){return a[0]}var c=this.charAt(0)=="-"?a[0].charAt(0).toUpperCase()+a[0].substring(1):a[0];for(var b=1;b<d;b++){c+=a[b].charAt(0).toUpperCase()+a[b].substring(1)}return c},capitalize:function(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()},underscore:function(){return this.gsub(/::/,"/").gsub(/([A-Z]+)([A-Z][a-z])/,"#{1}_#{2}").gsub(/([a-z\d])([A-Z])/,"#{1}_#{2}").gsub(/-/,"_").toLowerCase()},dasherize:function(){return this.gsub(/_/,"-")},inspect:function(a){var b=this.gsub(/[\x00-\x1f\\]/,function(c){var d=String.specialChar[c[0]];return d?d:"\\u00"+c[0].charCodeAt().toPaddedString(2,16)});if(a){return'"'+b.replace(/"/g,'\\"')+'"'}return"'"+b.replace(/'/g,"\\'")+"'"},toJSON:function(){return this.inspect(true)},unfilterJSON:function(a){return this.sub(a||Prototype.JSONFilter,"#{1}")},isJSON:function(){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)},evalJSON:function(sanitize){var json=this.unfilterJSON();try{if(!sanitize||json.isJSON()){return eval("("+json+")")}}catch(e){}throw new SyntaxError("Badly formed JSON string: "+this.inspect())},include:function(a){return this.indexOf(a)>-1},startsWith:function(a){return this.indexOf(a)===0},endsWith:function(b){var a=this.length-b.length;return a>=0&&this.lastIndexOf(b)===a},empty:function(){return this==""},blank:function(){return/^\s*$/.test(this)},interpolate:function(a,b){return new Template(this,b).evaluate(a)}});if(Prototype.Browser.WebKit||Prototype.Browser.IE){Object.extend(String.prototype,{escapeHTML:function(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},unescapeHTML:function(){return this.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">")}})}String.prototype.gsub.prepareReplacement=function(b){if(Object.isFunction(b)){return b}var a=new Template(b);return function(c){return a.evaluate(c)}};String.prototype.parseQuery=String.prototype.toQueryParams;Object.extend(String.prototype.escapeHTML,{div:document.createElement("div"),text:document.createTextNode("")});with(String.prototype.escapeHTML){div.appendChild(text)}var Template=Class.create({initialize:function(a,b){this.template=a.toString();this.pattern=b||Template.Pattern},evaluate:function(a){if(Object.isFunction(a.toTemplateReplacements)){a=a.toTemplateReplacements()}return this.template.gsub(this.pattern,function(c){if(a==null){return""}var d=c[1]||"";if(d=="\\"){return c[2]}var f=a,b=c[3];var e=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;c=e.exec(b);if(c==null){return d}while(c!=null){var g=c[1].startsWith("[")?c[2].gsub("\\\\]","]"):c[1];f=f[g];if(null==f||""==c[3]){break}b=b.substring("["==c[3]?c[1].length:c[0].length);c=e.exec(b)}return d+String.interpret(f)})}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;var $break={};var Enumerable={each:function(b,a){var d=0;b=b.bind(a);try{this._each(function(e){b(e,d++)})}catch(c){if(c!=$break){throw c}}return this},eachSlice:function(f,b,a){b=b?b.bind(a):Prototype.K;var d=-f,c=[],e=this.toArray();while((d+=f)<e.length){c.push(e.slice(d,d+f))}return c.collect(b,a)},all:function(b,a){b=b?b.bind(a):Prototype.K;var c=true;this.each(function(e,d){c=c&&!!b(e,d);if(!c){throw $break}});return c},any:function(b,a){b=b?b.bind(a):Prototype.K;var c=false;this.each(function(e,d){if(c=!!b(e,d)){throw $break}});return c},collect:function(b,a){b=b?b.bind(a):Prototype.K;var c=[];this.each(function(e,d){c.push(b(e,d))});return c},detect:function(b,a){b=b.bind(a);var c;this.each(function(e,d){if(b(e,d)){c=e;throw $break}});return c},findAll:function(b,a){b=b.bind(a);var c=[];this.each(function(e,d){if(b(e,d)){c.push(e)}});return c},grep:function(c,b,a){b=b?b.bind(a):Prototype.K;var d=[];if(Object.isString(c)){c=new RegExp(c)}this.each(function(f,e){if(c.match(f)){d.push(b(f,e))}});return d},include:function(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},inGroupsOf:function(b,a){a=Object.isUndefined(a)?null:a;return this.eachSlice(b,function(c){while(c.length<b){c.push(a)}return c})},inject:function(c,b,a){b=b.bind(a);this.each(function(e,d){c=b(c,e,d)});return c},invoke:function(a){var b=$A(arguments).slice(1);return this.map(function(c){return c[a].apply(c,b)})},max:function(b,a){b=b?b.bind(a):Prototype.K;var c;this.each(function(e,d){e=b(e,d);if(c==null||e>=c){c=e}});return c},min:function(b,a){b=b?b.bind(a):Prototype.K;var c;this.each(function(e,d){e=b(e,d);if(c==null||e<c){c=e}});return c},partition:function(b,a){b=b?b.bind(a):Prototype.K;var c=[],d=[];this.each(function(f,e){(b(f,e)?c:d).push(f)});return[c,d]},pluck:function(a){var b=[];this.each(function(c){b.push(c[a])});return b},reject:function(b,a){b=b.bind(a);var c=[];this.each(function(e,d){if(!b(e,d)){c.push(e)}});return c},sortBy:function(b,a){b=b.bind(a);return this.map(function(d,c){return{value:d,criteria:b(d,c)}}).sort(function(d,c){var f=d.criteria,e=c.criteria;return f<e?-1:f>e?1:0}).pluck("value")},toArray:function(){return this.map()},zip:function(){var a=Prototype.K,c=$A(arguments);if(Object.isFunction(c.last())){a=c.pop()}var b=[this].concat(c).map($A);return this.map(function(e,d){return a(b.pluck(d))})},size:function(){return this.toArray().length},inspect:function(){return"#<Enumerable:"+this.toArray().inspect()+">"}};Object.extend(Enumerable,{map:Enumerable.collect,find:Enumerable.detect,select:Enumerable.findAll,filter:Enumerable.findAll,member:Enumerable.include,entries:Enumerable.toArray,every:Enumerable.all,some:Enumerable.any});function $A(c){if(!c){return[]}if(c.toArray){return c.toArray()}var a=c.length||0,b=new Array(a);while(a--){b[a]=c[a]}return b}if(Prototype.Browser.WebKit){$A=function(c){if(!c){return[]}if(!(Object.isFunction(c)&&c=="[object NodeList]")&&c.toArray){return c.toArray()}var a=c.length||0,b=new Array(a);while(a--){b[a]=c[a]}return b}}Array.from=$A;Object.extend(Array.prototype,Enumerable);if(!Array.prototype._reverse){Array.prototype._reverse=Array.prototype.reverse}Object.extend(Array.prototype,{_each:function(a){for(var b=0,c=this.length;b<c;b++){a(this[b])}},clear:function(){this.length=0;return this},first:function(){return this[0]},last:function(){return this[this.length-1]},compact:function(){return this.select(function(a){return a!=null})},flatten:function(){return this.inject([],function(a,b){return a.concat(Object.isArray(b)?b.flatten():[b])})},without:function(){var a=$A(arguments);return this.select(function(b){return !a.include(b)})},reverse:function(a){return(a!==false?this:this.toArray())._reverse()},reduce:function(){return this.length>1?this:this[0]},uniq:function(a){return this.inject([],function(b,d,c){if(0==c||(a?b.last()!=d:!b.include(d))){b.push(d)}return b})},intersect:function(a){return this.uniq().findAll(function(b){return a.detect(function(c){return b===c})})},clone:function(){return[].concat(this)},size:function(){return this.length},inspect:function(){return"["+this.map(Object.inspect).join(", ")+"]"},toJSON:function(){var a=[];this.each(function(b){var c=Object.toJSON(b);if(!Object.isUndefined(c)){a.push(c)}});return"["+a.join(", ")+"]"}});if(Object.isFunction(Array.prototype.forEach)){Array.prototype._each=Array.prototype.forEach}if(!Array.prototype.indexOf){Array.prototype.indexOf=function(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}}if(!Array.prototype.lastIndexOf){Array.prototype.lastIndexOf=function(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}}Array.prototype.toArray=Array.prototype.clone;function $w(a){if(!Object.isString(a)){return[]}a=a.strip();return a?a.split(/\s+/):[]}if(Prototype.Browser.Opera){Array.prototype.concat=function(){var b=[];for(var c=0,d=this.length;c<d;c++){b.push(this[c])}for(var c=0,d=arguments.length;c<d;c++){if(Object.isArray(arguments[c])){for(var e=0,a=arguments[c].length;e<a;e++){b.push(arguments[c][e])}}else{b.push(arguments[c])}}return b}}Object.extend(Number.prototype,{toColorPart:function(){return this.toPaddedString(2,16)},succ:function(){return this+1},times:function(a){$R(0,this,true).each(a);return this},toPaddedString:function(a,c){var b=this.toString(c||10);return"0".times(a-b.length)+b},toJSON:function(){return isFinite(this)?this.toString():"null"}});$w("abs round ceil floor").each(function(a){Number.prototype[a]=Math[a].methodize()});function $H(a){return new Hash(a)}var Hash=Class.create(Enumerable,(function(){function a(b,c){if(Object.isUndefined(c)){return b}return b+"="+encodeURIComponent(String.interpret(c))}return{initialize:function(b){this._object=Object.isHash(b)?b.toObject():Object.clone(b)},_each:function(c){for(var b in this._object){var d=this._object[b],e=[b,d];e.key=b;e.value=d;c(e)}},set:function(b,c){return this._object[b]=c},get:function(b){return this._object[b]},unset:function(b){var c=this._object[b];delete this._object[b];return c},toObject:function(){return Object.clone(this._object)},keys:function(){return this.pluck("key")},values:function(){return this.pluck("value")},index:function(c){var b=this.detect(function(d){return d.value===c});return b&&b.key},merge:function(b){return this.clone().update(b)},update:function(b){return new Hash(b).inject(this,function(d,c){d.set(c.key,c.value);return d})},toQueryString:function(){return this.map(function(c){var b=encodeURIComponent(c.key),d=c.value;if(d&&typeof d=="object"){if(Object.isArray(d)){return d.map(a.curry(b)).join("&")}}return a(b,d)}).join("&")},inspect:function(){return"#<Hash:{"+this.map(function(b){return b.map(Object.inspect).join(": ")}).join(", ")+"}>"},toJSON:function(){return Object.toJSON(this.toObject())},clone:function(){return new Hash(this)}}})());Hash.prototype.toTemplateReplacements=Hash.prototype.toObject;Hash.from=$H;var ObjectRange=Class.create(Enumerable,{initialize:function(c,b,a){this.start=c;this.end=b;this.exclusive=a},_each:function(a){var b=this.start;while(this.include(b)){a(b);b=b.succ()}},include:function(a){if(a<this.start){return false}if(this.exclusive){return a<this.end}return a<=this.end}});var $R=function(c,b,a){return new ObjectRange(c,b,a)};var Ajax={getTransport:function(){return Try.these(function(){return new XMLHttpRequest()},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")})||false},activeRequestCount:0};Ajax.Responders={responders:[],_each:function(a){this.responders._each(a)},register:function(a){if(!this.include(a)){this.responders.push(a)}},unregister:function(a){this.responders=this.responders.without(a)},dispatch:function(a,b,d,c){this.each(function(g){if(Object.isFunction(g[a])){try{g[a].apply(g,[b,d,c])}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($super,a,b){$super(b);this.transport=Ajax.getTransport();this.request(a)},request:function(a){this.url=a;this.method=this.options.method;var d=Object.clone(this.options.parameters);if(!["get","post"].include(this.method)){d._method=this.method;this.method="post"}this.parameters=d;if(d=Object.toQueryString(d)){if(this.method=="get"){this.url+=(this.url.include("?")?"&":"?")+d}else{if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){d+="&_="}}}try{var c=new Ajax.Response(this);if(this.options.onCreate){this.options.onCreate(c)}Ajax.Responders.dispatch("onCreate",this,c);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);if(this.options.asynchronous){this.respondToReadyState.bind(this).defer(1)}this.transport.onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();this.body=this.method=="post"?(this.options.postBody||d):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType){this.onStateChange()}}catch(b){this.dispatchException(b)}},onStateChange:function(){var a=this.transport.readyState;if(a>1&&!((a==4)&&this._complete)){this.respondToReadyState(this.transport.readyState)}},setRequestHeaders:function(){var a={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,Accept:"text/javascript, text/html, application/xml, text/xml, */*"};if(this.method=="post"){a["Content-type"]=this.options.contentType+(this.options.encoding?"; charset="+this.options.encoding:"");if(this.transport.overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005){a.Connection="close"}}if(typeof this.options.requestHeaders=="object"){var c=this.options.requestHeaders;if(Object.isFunction(c.push)){for(var b=0,d=c.length;b<d;b+=2){a[c[b]]=c[b+1]}}else{$H(c).each(function(f){a[f.key]=f.value})}}for(var e in a){this.transport.setRequestHeader(e,a[e])}},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(b){var f=Ajax.Request.Events[b],d=new Ajax.Response(this);if(f=="Complete"){try{this._complete=true;(this.options["on"+d.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(d,d.headerJSON)}catch(a){this.dispatchException(a)}var c=d.getHeader("Content-type");if(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"+f]||Prototype.emptyFunction)(d,d.headerJSON);Ajax.Responders.dispatch("on"+f,this,d,d.headerJSON)}catch(a){this.dispatchException(a)}if(f=="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(b){try{return this.transport.getResponseHeader(b)||null}catch(a){return null}},evalResponse:function(){try{return eval((this.transport.responseText||"").unfilterJSON())}catch(e){this.dispatchException(e)}},dispatchException:function(a){(this.options.onException||Prototype.emptyFunction)(this,a);Ajax.Responders.dispatch("onException",this,a)}});Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];Ajax.Response=Class.create({initialize:function(a){this.request=a;var d=this.transport=a.transport,b=this.readyState=d.readyState;if((b>2&&!Prototype.Browser.IE)||b==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(d.responseText);this.headerJSON=this._getHeaderJSON()}if(b==4){var c=d.responseXML;this.responseXML=Object.isUndefined(c)?null:c;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 b=this.getHeader("X-JSON");if(!b){return null}b=decodeURIComponent(escape(b));try{return b.evalJSON(this.request.options.sanitizeJSON||!this.request.isSameOrigin())}catch(a){this.request.dispatchException(a)}},_getResponseJSON:function(){var b=this.request.options;if(!b.evalJSON||(b.evalJSON!="force"&&!(this.getHeader("Content-type")||"").include("application/json"))||this.responseText.blank()){return null}try{return this.responseText.evalJSON(b.sanitizeJSON||!this.request.isSameOrigin())}catch(a){this.request.dispatchException(a)}}});Ajax.Updater=Class.create(Ajax.Request,{initialize:function($super,c,a,b){this.container={success:(c.success||c),failure:(c.failure||(c.success?null:c))};b=Object.clone(b);var d=b.onComplete;b.onComplete=(function(f,e){this.updateContent(f.responseText);if(Object.isFunction(d)){d(f,e)}}).bind(this);$super(a,b)},updateContent:function(d){var b=this.container[this.success()?"success":"failure"],c=this.options;if(!c.evalScripts){d=d.stripScripts()}if(b=$(b)){if(c.insertion){if(Object.isString(c.insertion)){var a={};a[c.insertion]=d;b.insert(a)}else{c.insertion(b,d)}}else{b.update(d)}}}});Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,c,a,b){$super(b);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=c;this.url=a;this.start()},start:function(){this.options.onComplete=this.updateComplete.bind(this);this.onTimerEvent()},stop:function(){this.updater.options.onComplete=undefined;clearTimeout(this.timer);(this.onComplete||Prototype.emptyFunction).apply(this,arguments)},updateComplete:function(a){if(this.options.decay){this.decay=(a.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=a.responseText}this.timer=this.onTimerEvent.bind(this).delay(this.decay*this.frequency)},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options)}});function $(d){if(arguments.length>1){for(var a=0,c=[],b=arguments.length;a<b;a++){c.push($(arguments[a]))}return c}if(Object.isString(d)){d=document.getElementById(d)}return Element.extend(d)}if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(f,d){var e=[];var a=document.evaluate(f,$(d)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var b=0,c=a.snapshotLength;b<c;b++){e.push(Element.extend(a.snapshotItem(b)))}return e}}if(!window.Node){var Node={}}if(!Node.ELEMENT_NODE){Object.extend(Node,{ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12})}(function(){var a=this.Element;this.Element=function(b,d){d=d||{};b=b.toLowerCase();var c=Element.cache;if(Prototype.Browser.IE&&d.name){b="<"+b+' name="'+d.name+'">';delete d.name;return Element.writeAttribute(document.createElement(b),d)}if(!c[b]){c[b]=Element.extend(document.createElement(b))}return Element.writeAttribute(c[b].cloneNode(false),d)};Object.extend(this.Element,a||{})}).call(window);Element.cache={};Element.Methods={visible:function(a){return $(a).style.display!="none"},toggle:function(a){a=$(a);Element[Element.visible(a)?"hide":"show"](a);return a},hide:function(a){$(a).style.display="none";return a},show:function(a){$(a).style.display="";return a},remove:function(a){a=$(a);a.parentNode.removeChild(a);return a},update:function(b,a){b=$(b);if(a&&a.toElement){a=a.toElement()}if(Object.isElement(a)){return b.update().insert(a)}a=Object.toHTML(a);b.innerHTML=a.stripScripts();a.evalScripts.bind(a).defer();return b},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(f,g){f=$(f);if(Object.isString(g)||Object.isNumber(g)||Object.isElement(g)||(g&&(g.toElement||g.toHTML))){g={bottom:g}}var c,d,a,b;for(var e in g){c=g[e];e=e.toLowerCase();d=Element._insertionTranslations[e];if(c&&c.toElement){c=c.toElement()}if(Object.isElement(c)){d(f,c);continue}c=Object.toHTML(c);a=((e=="before"||e=="after")?f.parentNode:f).tagName.toUpperCase();b=Element._getContentFromAnonymousElement(a,c.stripScripts());if(e=="top"||e=="after"){b.reverse()}b.each(d.curry(f));c.evalScripts.bind(c).defer()}return f},wrap:function(c,a,b){c=$(c);if(Object.isElement(a)){$(a).writeAttribute(b||{})}else{if(Object.isString(a)){a=new Element(a,b)}else{a=new Element("div",a)}}if(c.parentNode){c.parentNode.replaceChild(a,c)}a.appendChild(c);return a},inspect:function(b){b=$(b);var a="<"+b.tagName.toLowerCase();$H({id:"id",className:"class"}).each(function(c){var e=c.first(),d=c.last();var f=(b[e]||"").toString();if(f){a+=" "+d+"="+f.inspect(true)}});return a+">"},recursivelyCollect:function(c,b){c=$(c);var a=[];while(c=c[b]){if(c.nodeType==1){a.push(Element.extend(c))}}return a},ancestors:function(a){return $(a).recursivelyCollect("parentNode")},descendants:function(a){return $(a).select("*")},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 $(a).recursivelyCollect("previousSibling")},nextSiblings:function(a){return $(a).recursivelyCollect("nextSibling")},siblings:function(a){a=$(a);return a.previousSiblings().reverse().concat(a.nextSiblings())},match:function(b,a){if(Object.isString(a)){a=new Selector(a)}return a.match($(b))},up:function(c,d,b){c=$(c);if(arguments.length==1){return $(c.parentNode)}var a=c.ancestors();return Object.isNumber(d)?a[d]:Selector.findElement(a,d,b)},down:function(b,c,a){b=$(b);if(arguments.length==1){return b.firstDescendant()}return Object.isNumber(c)?b.descendants()[c]:b.select(c)[a||0]},previous:function(c,d,b){c=$(c);if(arguments.length==1){return $(Selector.handlers.previousElementSibling(c))}var a=c.previousSiblings();return Object.isNumber(d)?a[d]:Selector.findElement(a,d,b)},next:function(c,d,b){c=$(c);if(arguments.length==1){return $(Selector.handlers.nextElementSibling(c))}var a=c.nextSiblings();return Object.isNumber(d)?a[d]:Selector.findElement(a,d,b)},select:function(){var b=$A(arguments),a=$(b.shift());return Selector.findChildElements(a,b)},adjacent:function(){var b=$A(arguments),a=$(b.shift());return Selector.findChildElements(a.parentNode,b).without(a)},identify:function(b){b=$(b);var c=b.readAttribute("id"),a=arguments.callee;if(c){return c}do{c="anonymous_element_"+a.counter++}while($(c));b.writeAttribute("id",c);return c},readAttribute:function(c,a){c=$(c);if(Prototype.Browser.IE){var b=Element._attributeTranslations.read;if(b.values[a]){return b.values[a](c,a)}if(b.names[a]){a=b.names[a]}if(a.include(":")){return(!c.attributes||!c.attributes[a])?null:c.attributes[a].value}}return c.getAttribute(a)},writeAttribute:function(d,b,c){d=$(d);var a={},e=Element._attributeTranslations.write;if(typeof b=="object"){a=b}else{a[b]=Object.isUndefined(c)?true:c}for(var f in a){b=e.names[f]||f;c=a[f];if(e.values[f]){b=e.values[f](d,c)}if(c===false||c===null){d.removeAttribute(b)}else{if(c===true){d.setAttribute(b,b)}else{d.setAttribute(b,c)}}}return d},getHeight:function(a){return $(a).getDimensions().height},getWidth:function(a){return $(a).getDimensions().width},classNames:function(a){return new Element.ClassNames(a)},hasClassName:function(c,a){if(!(c=$(c))){return}var b=c.className;return(b.length>0&&(b==a||new RegExp("(^|\\s)"+a+"(\\s|$)").test(b)))},addClassName:function(b,a){if(!(b=$(b))){return}if(!b.hasClassName(a)){b.className+=(b.className?" ":"")+a}return b},removeClassName:function(b,a){if(!(b=$(b))){return}b.className=b.className.replace(new RegExp("(^|\\s+)"+a+"(\\s+|$)")," ").strip();return b},toggleClassName:function(b,a){if(!(b=$(b))){return}return b[b.hasClassName(a)?"removeClassName":"addClassName"](a)},cleanWhitespace:function(c){c=$(c);var b=c.firstChild;while(b){var a=b.nextSibling;if(b.nodeType==3&&!/\S/.test(b.nodeValue)){c.removeChild(b)}b=a}return c},empty:function(a){return $(a).innerHTML.blank()},descendantOf:function(g,f){g=$(g),f=$(f);var b=f;if(g.compareDocumentPosition){return(g.compareDocumentPosition(f)&8)===8}if(g.sourceIndex&&!Prototype.Browser.Opera){var d=g.sourceIndex,h=f.sourceIndex,c=f.nextSibling;if(!c){do{f=f.parentNode}while(!(c=f.nextSibling)&&f.parentNode)}if(c&&c.sourceIndex){return(d>h&&d<c.sourceIndex)}}while(g=g.parentNode){if(g==b){return true}}return false},scrollTo:function(b){b=$(b);var a=b.cumulativeOffset();window.scrollTo(a[0],a[1]);return b},getStyle:function(c,a){c=$(c);a=a=="float"?"cssFloat":a.camelize();var b=c.style[a];if(!b){var d=document.defaultView.getComputedStyle(c,null);b=d?d[a]:null}if(a=="opacity"){return b?parseFloat(b):1}return b=="auto"?null:b},getOpacity:function(a){return $(a).getStyle("opacity")},setStyle:function(e,d){e=$(e);var b=e.style,a;if(Object.isString(d)){e.style.cssText+=";"+d;return d.include("opacity")?e.setOpacity(d.match(/opacity:\s*(\d?\.?\d*)/)[1]):e}for(var c in d){if(c=="opacity"){e.setOpacity(d[c])}else{b[(c=="float"||c=="cssFloat")?(Object.isUndefined(b.styleFloat)?"cssFloat":"styleFloat"):c]=d[c]}}return e},setOpacity:function(b,a){b=$(b);b.style.opacity=(a==1||a==="")?"":(a<1e-05)?0:a;return b},getDimensions:function(b){b=$(b);var h=$(b).getStyle("display");if(h!="none"&&h!=null){return{width:b.offsetWidth,height:b.offsetHeight}}var f=b.style;var c=f.visibility;var d=f.position;var a=f.display;f.visibility="hidden";f.position="absolute";f.display="block";var e=b.clientWidth;var g=b.clientHeight;f.display=a;f.position=d;f.visibility=c;return{width:e,height:g}},makePositioned:function(b){b=$(b);var a=Element.getStyle(b,"position");if(a=="static"||!a){b._madePositioned=true;b.style.position="relative";if(window.opera){b.style.top=0;b.style.left=0}}return b},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(b){var a=0,c=0;do{a+=b.offsetTop||0;c+=b.offsetLeft||0;b=b.offsetParent}while(b);return Element._returnOffset(c,a)},positionedOffset:function(c){var b=0,d=0;do{b+=c.offsetTop||0;d+=c.offsetLeft||0;c=c.offsetParent;if(c){if(c.tagName=="BODY"){break}var a=Element.getStyle(c,"position");if(a!=="static"){break}}}while(c);return Element._returnOffset(d,b)},absolutize:function(e){e=$(e);if(e.getStyle("position")=="absolute"){return}var b=e.positionedOffset();var d=b[1];var c=b[0];var f=e.clientWidth;var a=e.clientHeight;e._originalLeft=c-parseFloat(e.style.left||0);e._originalTop=d-parseFloat(e.style.top||0);e._originalWidth=e.style.width;e._originalHeight=e.style.height;e.style.position="absolute";e.style.top=d+"px";e.style.left=c+"px";e.style.width=f+"px";e.style.height=a+"px";return e},relativize:function(c){c=$(c);if(c.getStyle("position")=="relative"){return}c.style.position="relative";var b=parseFloat(c.style.top||0)-(c._originalTop||0);var a=parseFloat(c.style.left||0)-(c._originalLeft||0);c.style.top=b+"px";c.style.left=a+"px";c.style.height=c._originalHeight;c.style.width=c._originalWidth;return c},cumulativeScrollOffset:function(b){var a=0,c=0;do{a+=b.scrollTop||0;c+=b.scrollLeft||0;b=b.parentNode}while(b);return Element._returnOffset(c,a)},getOffsetParent:function(a){if(a.offsetParent){return $(a.offsetParent)}if(a==document.body){return $(a)}while((a=a.parentNode)&&a!=document.body){if(Element.getStyle(a,"position")!="static"){return $(a)}}return $(document.body)},viewportOffset:function(a){var b=0,d=0;var c=a;do{b+=c.offsetTop||0;d+=c.offsetLeft||0;if(c.offsetParent==document.body&&Element.getStyle(c,"position")=="absolute"){break}}while(c=c.offsetParent);c=a;do{if(!Prototype.Browser.Opera||c.tagName=="BODY"){b-=c.scrollTop||0;d-=c.scrollLeft||0}}while(c=c.parentNode);return Element._returnOffset(d,b)},clonePosition:function(e,b){var d=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});b=$(b);var c=b.viewportOffset();e=$(e);var a=[0,0];var f=null;if(Element.getStyle(e,"position")=="absolute"){f=e.getOffsetParent();a=f.viewportOffset()}if(f==document.body){a[0]-=document.body.offsetLeft;a[1]-=document.body.offsetTop}if(d.setLeft){e.style.left=(c[0]-a[0]+d.offsetLeft)+"px"}if(d.setTop){e.style.top=(c[1]-a[1]+d.offsetTop)+"px"}if(d.setWidth){e.style.width=b.offsetWidth+"px"}if(d.setHeight){e.style.height=b.offsetHeight+"px"}return e}};Element.Methods.identify.counter=1;Object.extend(Element.Methods,{getElementsBySelector:Element.Methods.select,childElements:Element.Methods.immediateDescendants});Element._attributeTranslations={write:{names:{className:"class",htmlFor:"for"},values:{}}};if(Prototype.Browser.Opera){Element.Methods.getStyle=Element.Methods.getStyle.wrap(function(a,e,c){switch(c){case"left":case"top":case"right":case"bottom":if(a(e,"position")==="static"){return null}case"height":case"width":if(!Element.visible(e)){return null}var d=parseInt(a(e,c),10);if(d!==e["offset"+c.capitalize()]){return d+"px"}var b;if(c==="height"){b=["border-top-width","padding-top","padding-bottom","border-bottom-width"]}else{b=["border-left-width","padding-left","padding-right","border-right-width"]}return b.inject(d,function(f,g){var h=a(e,g);return h===null?f:f-parseInt(h,10)})+"px";default:return a(e,c)}});Element.Methods.readAttribute=Element.Methods.readAttribute.wrap(function(a,c,b){if(b==="title"){return c.title}return a(c,b)})}else{if(Prototype.Browser.IE){Element.Methods.getOffsetParent=Element.Methods.getOffsetParent.wrap(function(a,d){d=$(d);var b=d.getStyle("position");if(b!=="static"){return a(d)}d.setStyle({position:"relative"});var c=a(d);d.setStyle({position:b});return c});$w("positionedOffset viewportOffset").each(function(a){Element.Methods[a]=Element.Methods[a].wrap(function(c,f){f=$(f);var d=f.getStyle("position");if(d!=="static"){return c(f)}var e=f.getOffsetParent();if(e&&e.getStyle("position")==="fixed"){e.setStyle({zoom:1})}f.setStyle({position:"relative"});var b=c(f);f.setStyle({position:d});return b})});Element.Methods.getStyle=function(c,a){c=$(c);a=(a=="float"||a=="cssFloat")?"styleFloat":a.camelize();var b=c.style[a];if(!b&&c.currentStyle){b=c.currentStyle[a]}if(a=="opacity"){if(b=(c.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/)){if(b[1]){return parseFloat(b[1])/100}}return 1}if(b=="auto"){if((a=="width"||a=="height")&&(c.getStyle("display")!="none")){return c["offset"+a.capitalize()]+"px"}return null}return b};Element.Methods.setOpacity=function(f,e){function b(g){return g.replace(/alpha\([^\)]*\)/gi,"")}f=$(f);var a=f.currentStyle;if((a&&!a.hasLayout)||(!a&&f.style.zoom=="normal")){f.style.zoom=1}var d=f.getStyle("filter"),c=f.style;if(e==1||e===""){(d=b(d))?c.filter=d:c.removeAttribute("filter");return f}else{if(e<1e-05){e=0}}c.filter=b(d)+"alpha(opacity="+(e*100)+")";return f};Element._attributeTranslations={read:{names:{"class":"className","for":"htmlFor"},values:{_getAttr:function(b,a){return b.getAttribute(a,2)},_getAttrNode:function(c,a){var b=c.getAttributeNode(a);return b?b.value:""},_getEv:function(b,a){a=b.getAttribute(a);return a?a.toString().slice(23,-2):null},_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(b,a){b.checked=!!a},style:function(b,a){b.style.cssText=a?a:""}}};Element._attributeTranslations.has={};$w("colSpan rowSpan vAlign dateTime accessKey tabIndex encType maxLength readOnly longDesc").each(function(a){Element._attributeTranslations.write.names[a.toLowerCase()]=a;Element._attributeTranslations.has[a.toLowerCase()]=a});(function(a){Object.extend(a,{href:a._getAttr,src:a._getAttr,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)}else{if(Prototype.Browser.Gecko&&/rv:1\.8\.0/.test(navigator.userAgent)){Element.Methods.setOpacity=function(b,a){b=$(b);b.style.opacity=(a==1)?0.999999:(a==="")?"":(a<1e-05)?0:a;return b}}else{if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(d,c){d=$(d);d.style.opacity=(c==1||c==="")?"":(c<1e-05)?0:c;if(c==1){if(d.tagName=="IMG"&&d.width){d.width++;d.width--}else{try{var a=document.createTextNode(" ");d.appendChild(a);d.removeChild(a)}catch(b){}}}return d};Element.Methods.cumulativeOffset=function(b){var a=0,c=0;do{a+=b.offsetTop||0;c+=b.offsetLeft||0;if(b.offsetParent==document.body){if(Element.getStyle(b,"position")=="absolute"){break}}b=b.offsetParent}while(b);return Element._returnOffset(c,a)}}}}}if(Prototype.Browser.IE||Prototype.Browser.Opera){Element.Methods.update=function(c,b){c=$(c);if(b&&b.toElement){b=b.toElement()}if(Object.isElement(b)){return c.update().insert(b)}b=Object.toHTML(b);var a=c.tagName.toUpperCase();if(a in Element._insertionTranslations.tags){$A(c.childNodes).each(function(d){c.removeChild(d)});Element._getContentFromAnonymousElement(a,b.stripScripts()).each(function(d){c.appendChild(d)})}else{c.innerHTML=b.stripScripts()}b.evalScripts.bind(b).defer();return c}}if("outerHTML" in document.createElement("div")){Element.Methods.replace=function(d,c){d=$(d);if(c&&c.toElement){c=c.toElement()}if(Object.isElement(c)){d.parentNode.replaceChild(c,d);return d}c=Object.toHTML(c);var f=d.parentNode,a=f.tagName.toUpperCase();if(Element._insertionTranslations.tags[a]){var e=d.next();var b=Element._getContentFromAnonymousElement(a,c.stripScripts());f.removeChild(d);if(e){b.each(function(g){f.insertBefore(g,e)})}else{b.each(function(g){f.appendChild(g)})}}else{d.outerHTML=c.stripScripts()}c.evalScripts.bind(c).defer();return d}}Element._returnOffset=function(b,c){var a=[b,c];a.left=b;a.top=c;return a};Element._getContentFromAnonymousElement=function(a,b){var c=new Element("div"),d=Element._insertionTranslations.tags[a];if(d){c.innerHTML=d[0]+b+d[1];d[2].times(function(){c=c.firstChild})}else{c.innerHTML=b}return $A(c.childNodes)};Element._insertionTranslations={before:function(b,a){b.parentNode.insertBefore(a,b)},top:function(b,a){b.insertBefore(a,b.firstChild)},bottom:function(b,a){b.appendChild(a)},after:function(b,a){b.parentNode.insertBefore(a,b.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(){Object.extend(this.tags,{THEAD:this.tags.TBODY,TFOOT:this.tags.TBODY,TH:this.tags.TD})}).call(Element._insertionTranslations);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);if(!Prototype.BrowserFeatures.ElementExtensions&&document.createElement("div").__proto__){window.HTMLElement={};window.HTMLElement.prototype=document.createElement("div").__proto__;Prototype.BrowserFeatures.ElementExtensions=true}Element.extend=(function(){if(Prototype.BrowserFeatures.SpecificElementExtensions){return Prototype.K}var b={},a=Element.Methods.ByTag;var c=Object.extend(function(g){if(!g||g._extendedByPrototype||g.nodeType!=1||g==window){return g}var h=Object.clone(b),d=g.tagName,e,f;if(a[d]){Object.extend(h,a[d])}for(e in h){f=h[e];if(Object.isFunction(f)&&!(e in g)){g[e]=f.methodize()}}g._extendedByPrototype=Prototype.emptyFunction;return g},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(b,Element.Methods);Object.extend(b,Element.Methods.Simulated)}}});c.refresh();return c})();Element.hasAttribute=function(b,a){if(b.hasAttribute){return b.hasAttribute(a)}return Element.Methods.Simulated.hasAttribute(b,a)};Element.addMethods=function(a){var d=Prototype.BrowserFeatures,h=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 j=a;a=arguments[1]}if(!j){Object.extend(Element.Methods,a||{})}else{if(Object.isArray(j)){j.each(c)}else{c(j)}}function c(k){k=k.toUpperCase();if(!Element.Methods.ByTag[k]){Element.Methods.ByTag[k]={}}Object.extend(Element.Methods.ByTag[k],a)}function g(o,k,n){n=n||false;for(var l in o){var m=o[l];if(!Object.isFunction(m)){continue}if(!n||!(l in k)){k[l]=m.methodize()}}}function f(k){var m;var l={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(l[k]){m="HTML"+l[k]+"Element"}if(window[m]){return window[m]}m="HTML"+k+"Element";if(window[m]){return window[m]}m="HTML"+k.capitalize()+"Element";if(window[m]){return window[m]}window[m]={};window[m].prototype=document.createElement(k).__proto__;return window[m]}if(d.ElementExtensions){g(Element.Methods,HTMLElement.prototype);g(Element.Methods.Simulated,HTMLElement.prototype,true)}if(d.SpecificElementExtensions){for(var b in Element.Methods.ByTag){var e=f(b);if(Object.isUndefined(e)){continue}g(h[b],e.prototype)}}Object.extend(Element,Element.Methods);delete Element.ByTag;if(Element.extend.refresh){Element.extend.refresh()}Element.cache={}};document.viewport={getDimensions:function(){var a={};var b=Prototype.Browser;$w("width height").each(function(c){var e=c.capitalize();a[c]=(b.WebKit&&!document.evaluate)?self["inner"+e]:(b.Opera)?document.body["client"+e]:document.documentElement["client"+e]});return a},getWidth:function(){return this.getDimensions().width},getHeight:function(){return this.getDimensions().height},getScrollOffsets:function(){return Element._returnOffset(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop)}};var Selector=Class.create({initialize:function(a){this.expression=a.strip();this.compileMatcher()},shouldUseXPath:function(){if(!Prototype.BrowserFeatures.XPath){return false}var a=this.expression;if(Prototype.Browser.WebKit&&(a.include("-of-type")||a.include(":empty"))){return false}if((/(\[[\w-]*?:|:checked)/).test(this.expression)){return false}return true},compileMatcher:function(){if(this.shouldUseXPath()){return this.compileXPathMatcher()}var e=this.expression,ps=Selector.patterns,h=Selector.handlers,c=Selector.criteria,le,p,m;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 in ps){p=ps[i];if(m=e.match(p)){this.matcher.push(Object.isFunction(c[i])?c[i](m):new Template(c[i]).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 b=this.expression,c=Selector.patterns,g=Selector.xpath,d,f;if(Selector._cache[b]){this.xpath=Selector._cache[b];return}this.matcher=[".//*"];while(b&&d!=b&&(/\S/).test(b)){d=b;for(var a in c){if(f=b.match(c[a])){this.matcher.push(Object.isFunction(g[a])?g[a](f):new Template(g[a]).evaluate(f));b=b.replace(f[0],"");break}}}this.xpath=this.matcher.join("");Selector._cache[this.expression]=this.xpath},findElements:function(a){a=a||document;if(this.xpath){return document._getElementsByXPath(this.xpath,a)}return this.matcher(a)},match:function(b){this.tokens=[];var a=this.expression,h=Selector.patterns,d=Selector.assertions;var o,f,l;while(a&&o!==a&&(/\S/).test(a)){o=a;for(var j in h){f=h[j];if(l=a.match(f)){if(d[j]){this.tokens.push([j,Object.clone(l)]);a=a.replace(l[0],"")}else{return this.findElements(document).include(b)}}}}var n=true,c,k;for(var j=0,g;g=this.tokens[j];j++){c=g[0],k=g[1];if(!Selector.assertions[c](b,k)){n=false;break}}return n},toString:function(){return this.expression},inspect:function(){return"#<Selector:"+this.expression.inspect()+">"}});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(b){var a=Selector.xpath.pseudos[b[1]];if(!a){return""}if(Object.isFunction(a)){return a(b)}return new Template(Selector.xpath.pseudos[b[1]]).evaluate(b)},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 or translate(text(), ' \t\r\n', '') = '')]",checked:"[@checked]",disabled:"[@disabled]",enabled:"[not(@disabled)]",not:function(g){var a=g[6],b=Selector.patterns,h=Selector.xpath,j,c;var d=[];while(a&&j!=a&&(/\S/).test(a)){j=a;for(var f in b){if(g=a.match(b[f])){c=Object.isFunction(h[f])?h[f](g):new Template(h[f]).evaluate(g);d.push("("+c.substring(1,c.length-1)+")");a=a.replace(g[0],"");break}}}return"[not("+d.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(b){var a=Selector.xpath.pseudos;return a["first-of-type"](b)+a["last-of-type"](b)},nth:function(e,d){var f,j=d[6],c;if(j=="even"){j="2n+0"}if(j=="odd"){j="2n+1"}if(f=j.match(/^(\d+)$/)){return"["+e+"= "+f[1]+"]"}if(f=j.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(f[1]=="-"){f[1]=-1}var h=f[1]?Number(f[1]):1;var g=f[2]?Number(f[2]):0;c="[((#{fragment} - #{b}) mod #{a} = 0) and ((#{fragment} - #{b}) div #{a} >= 0)]";return new Template(c).evaluate({fragment:e,a:h,b:g})}}}},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:{laterSibling:/^\s*~\s*/,child:/^\s*>\s*/,adjacent:/^\s*\+\s*/,descendant:/^\s/,tagName:/^\s*(\*|[\w\-]+)(\b|$)?/,id:/^#([\w\-\*]+)(\b|$)/,className:/^\.([\w\-\*]+)(\b|$)/,pseudo:/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/,attrPresence:/^\[([\w]+)\]/,attr:/\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/},assertions:{tagName:function(b,a){return a[1].toUpperCase()==b.tagName.toUpperCase()},className:function(b,a){return Element.hasClassName(b,a[1])},id:function(b,a){return b.id===a[1]},attrPresence:function(b,a){return Element.hasAttribute(b,a[1])},attr:function(c,b){var a=Element.readAttribute(c,b[1]);return a&&Selector.operators[b[2]](a,b[5]||b[6])}},handlers:{concat:function(f,e){for(var c=0,d;d=e[c];c++){f.push(d)}return f},mark:function(d){var c=Prototype.emptyFunction;for(var a=0,b;b=d[a];a++){b._countedByPrototype=c}return d},unmark:function(c){for(var a=0,b;b=c[a];a++){b._countedByPrototype=undefined}return c},index:function(c,d,e){c._countedByPrototype=Prototype.emptyFunction;if(d){for(var f=c.childNodes,b=f.length-1,g=1;b>=0;b--){var a=f[b];if(a.nodeType==1&&(!e||a._countedByPrototype)){a.nodeIndex=g++}}}else{for(var b=0,g=1,f=c.childNodes;a=f[b];b++){if(a.nodeType==1&&(!e||a._countedByPrototype)){a.nodeIndex=g++}}}},unique:function(d){if(d.length==0){return d}var e=[],b;for(var a=0,c=d.length;a<c;a++){if(!(b=d[a])._countedByPrototype){b._countedByPrototype=Prototype.emptyFunction;e.push(Element.extend(b))}}return Selector.handlers.unmark(e)},descendant:function(d){var a=Selector.handlers;for(var b=0,e=[],c;c=d[b];b++){a.concat(e,c.getElementsByTagName("*"))}return e},child:function(e){var a=Selector.handlers;for(var b=0,f=[],d;d=e[b];b++){for(var g=0,c;c=d.childNodes[g];g++){if(c.nodeType==1&&c.tagName!="!"){f.push(c)}}}return f},adjacent:function(c){for(var a=0,d=[],b;b=c[a];a++){var e=this.nextElementSibling(b);if(e){d.push(e)}}return d},laterSibling:function(d){var a=Selector.handlers;for(var b=0,e=[],c;c=d[b];b++){a.concat(e,Element.nextSiblings(c))}return e},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(k,b,j,a){var f=j.toUpperCase();var e=[],c=Selector.handlers;if(k){if(a){if(a=="descendant"){for(var d=0,g;g=k[d];d++){c.concat(e,g.getElementsByTagName(j))}return e}else{k=this[a](k)}if(j=="*"){return k}}for(var d=0,g;g=k[d];d++){if(g.tagName.toUpperCase()===f){e.push(g)}}return e}else{return b.getElementsByTagName(j)}},id:function(j,b,g,a){var d=$(g),c=Selector.handlers;if(!d){return[]}if(!j&&b==document){return[d]}if(j){if(a){if(a=="child"){for(var f=0,e;e=j[f];f++){if(d.parentNode==e){return[d]}}}else{if(a=="descendant"){for(var f=0,e;e=j[f];f++){if(Element.descendantOf(d,e)){return[d]}}}else{if(a=="adjacent"){for(var f=0,e;e=j[f];f++){if(Selector.handlers.previousElementSibling(d)==e){return[d]}}}else{j=c[a](j)}}}}for(var f=0,e;e=j[f];f++){if(e==d){return[d]}}return[]}return(d&&Element.descendantOf(d,b))?[d]:[]},className:function(c,b,a,d){if(c&&d){c=this[d](c)}return Selector.handlers.byClassName(c,b,a)},byClassName:function(h,c,g){if(!h){h=Selector.handlers.descendant([c])}var b=" "+g+" ";for(var d=0,e=[],f,a;f=h[d];d++){a=f.className;if(a.length==0){continue}if(a==g||(" "+a+" ").include(b)){e.push(f)}}return e},attrPresence:function(d,b,g,f){if(!d){d=b.getElementsByTagName("*")}if(d&&f){d=this[f](d)}var e=[];for(var a=0,c;c=d[a];a++){if(Element.hasAttribute(c,g)){e.push(c)}}return e},attr:function(l,e,d,f,a,b){if(!l){l=e.getElementsByTagName("*")}if(l&&b){l=this[b](l)}var j=Selector.operators[a],h=[];for(var g=0,k;k=l[g];g++){var c=Element.readAttribute(k,d);if(c===null){continue}if(j(c,f)){h.push(k)}}return h},pseudo:function(c,b,d,a,e){if(c&&e){c=this[e](c)}if(!c){c=a.getElementsByTagName("*")}return Selector.pseudos[b](c,d,a)}},pseudos:{"first-child":function(d,e,b){for(var a=0,f=[],c;c=d[a];a++){if(Selector.handlers.previousElementSibling(c)){continue}f.push(c)}return f},"last-child":function(d,e,b){for(var a=0,f=[],c;c=d[a];a++){if(Selector.handlers.nextElementSibling(c)){continue}f.push(c)}return f},"only-child":function(e,f,c){var a=Selector.handlers;for(var b=0,g=[],d;d=e[b];b++){if(!a.previousElementSibling(d)&&!a.nextElementSibling(d)){g.push(d)}}return g},"nth-child":function(b,c,a){return Selector.pseudos.nth(b,c,a)},"nth-last-child":function(b,c,a){return Selector.pseudos.nth(b,c,a,true)},"nth-of-type":function(b,c,a){return Selector.pseudos.nth(b,c,a,false,true)},"nth-last-of-type":function(b,c,a){return Selector.pseudos.nth(b,c,a,true,true)},"first-of-type":function(b,c,a){return Selector.pseudos.nth(b,"1",a,false,true)},"last-of-type":function(b,c,a){return Selector.pseudos.nth(b,"1",a,true,true)},"only-of-type":function(c,d,a){var b=Selector.pseudos;return b["last-of-type"](b["first-of-type"](c,d,a),d,a)},getIndices:function(e,d,c){if(e==0){return d>0?[d]:[]}return $R(1,c).inject([],function(b,a){if(0==(a-d)%e&&(a-d)/e>=0){b.push(a)}return b})},nth:function(w,v,k,f,c){if(w.length==0){return[]}if(v=="even"){v="2n+0"}if(v=="odd"){v="2n+1"}var n=Selector.handlers,p=[],t=[],s;n.mark(w);for(var o=0,q;q=w[o];o++){if(!q.parentNode._countedByPrototype){n.index(q.parentNode,f,c);t.push(q.parentNode)}}if(v.match(/^\d+$/)){v=Number(v);for(var o=0,q;q=w[o];o++){if(q.nodeIndex==v){p.push(q)}}}else{if(s=v.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(s[1]=="-"){s[1]=-1}var e=s[1]?Number(s[1]):1;var d=s[2]?Number(s[2]):0;var g=Selector.pseudos.getIndices(e,d,w.length);for(var o=0,q,r=g.length;q=w[o];o++){for(var u=0;u<r;u++){if(q.nodeIndex==g[u]){p.push(q)}}}}}n.unmark(w);n.unmark(t);return p},empty:function(d,e,b){for(var a=0,f=[],c;c=d[a];a++){if(c.tagName=="!"||(c.firstChild&&!c.innerHTML.match(/^\s*$/))){continue}f.push(c)}return f},not:function(l,j,b){var c=Selector.handlers,k,g;var a=new Selector(j).findElements(b);c.mark(a);for(var d=0,e=[],f;f=l[d];d++){if(!f._countedByPrototype){e.push(f)}}c.unmark(a);return e},enabled:function(d,e,b){for(var a=0,f=[],c;c=d[a];a++){if(!c.disabled){f.push(c)}}return f},disabled:function(d,e,b){for(var a=0,f=[],c;c=d[a];a++){if(c.disabled){f.push(c)}}return f},checked:function(d,e,b){for(var a=0,f=[],c;c=d[a];a++){if(c.checked){f.push(c)}}return f}},operators:{"=":function(b,a){return b==a},"!=":function(b,a){return b!=a},"^=":function(b,a){return b.startsWith(a)},"$=":function(b,a){return b.endsWith(a)},"*=":function(b,a){return b.include(a)},"~=":function(b,a){return(" "+b+" ").include(" "+a+" ")},"|=":function(b,a){return("-"+b.toUpperCase()+"-").include("-"+a.toUpperCase()+"-")}},split:function(b){var a=[];b.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(c){a.push(c[1].strip())});return a},matchElements:function(d,g){var c=$$(g),a=Selector.handlers;a.mark(c);for(var b=0,e=[],f;f=d[b];b++){if(f._countedByPrototype){e.push(f)}}a.unmark(c);return e},findElement:function(a,c,b){if(Object.isNumber(c)){b=c;c=false}return Selector.matchElements(a,c||"*")[b||0]},findChildElements:function(f,c){c=Selector.split(c.join(","));var e=[],a=Selector.handlers;for(var b=0,d=c.length,g;b<d;b++){g=new Selector(c[b].strip());a.concat(e,g.findElements(f))}return(d>1)?a.unique(e):e}});if(Prototype.Browser.IE){Object.extend(Selector.handlers,{concat:function(f,e){for(var c=0,d;d=e[c];c++){if(d.tagName!=="!"){f.push(d)}}return f},unmark:function(c){for(var a=0,b;b=c[a];a++){b.removeAttribute("_countedByPrototype")}return c}})}function $$(){return Selector.findChildElements(document,$A(arguments))}var Form={reset:function(a){$(a).reset();return a},serializeElements:function(c,d){if(typeof d!="object"){d={hash:!!d}}else{if(Object.isUndefined(d.hash)){d.hash=true}}var b,e,f=false,g=d.submit;var a=c.inject({},function(h,j){if(!j.disabled&&j.name){b=j.name;e=$(j).getValue();if(e!=null&&(j.type!="submit"||(!f&&g!==false&&(!g||b==g)&&(f=true)))){if(b in h){if(!Object.isArray(h[b])){h[b]=[h[b]]}h[b].push(e)}else{h[b]=e}}}return h});return d.hash?a:Object.toQueryString(a)}};Form.Methods={serialize:function(a,b){return Form.serializeElements(Form.getElements(a),b)},getElements:function(a){return $A($(a).getElementsByTagName("*")).inject([],function(b,c){if(Form.Element.Serializers[c.tagName.toLowerCase()]){b.push(Element.extend(c))}return b})},getInputs:function(a,f,b){a=$(a);var e=a.getElementsByTagName("input");if(!f&&!b){return $A(e).map(Element.extend)}for(var d=0,h=[],c=e.length;d<c;d++){var g=e[d];if((f&&g.type!=f)||(b&&g.name!=b)){continue}h.push(Element.extend(g))}return h},disable:function(a){a=$(a);Form.getElements(a).invoke("disable");return a},enable:function(a){a=$(a);Form.getElements(a).invoke("enable");return a},findFirstElement:function(a){var b=$(a).getElements().findAll(function(d){return"hidden"!=d.type&&!d.disabled});var c=b.findAll(function(d){return d.hasAttribute("tabIndex")&&d.tabIndex>=0}).sortBy(function(d){return d.tabIndex}).first();return c?c:b.find(function(d){return["input","select","textarea"].include(d.tagName.toLowerCase())})},focusFirstElement:function(a){a=$(a);a.findFirstElement().activate();return a},request:function(b,c){b=$(b),c=Object.clone(c||{});var d=c.parameters,a=b.readAttribute("action")||"";if(a.blank()){a=window.location.href}c.parameters=b.serialize(true);if(d){if(Object.isString(d)){d=d.toQueryParams()}Object.extend(c.parameters,d)}if(b.hasAttribute("method")&&!c.method){c.method=b.method}return new Ajax.Request(a,c)}};Form.Element={focus:function(a){$(a).focus();return a},select:function(a){$(a).select();return a}};Form.Element.Methods={serialize:function(c){c=$(c);if(!c.disabled&&c.name){var b=c.getValue();if(b!=undefined){var a={};a[c.name]=b;return Object.toQueryString(a)}}return""},getValue:function(b){b=$(b);var a=b.tagName.toLowerCase();return Form.Element.Serializers[a](b)},setValue:function(c,b){c=$(c);var a=c.tagName.toLowerCase();Form.Element.Serializers[a](c,b);return c},clear:function(a){$(a).value="";return a},present:function(a){return $(a).value!=""},activate:function(b){b=$(b);try{b.focus();if(b.select&&(b.tagName.toLowerCase()!="input"||!["button","reset","submit"].include(b.type))){b.select()}}catch(a){}return b},disable:function(a){a=$(a);a.blur();a.disabled=true;return a},enable:function(a){a=$(a);a.disabled=false;return a}};var Field=Form.Element;var $F=Form.Element.Methods.getValue;Form.Element.Serializers={input:function(b,a){switch(b.type.toLowerCase()){case"checkbox":case"radio":return Form.Element.Serializers.inputSelector(b,a);default:return Form.Element.Serializers.textarea(b,a)}},inputSelector:function(b,a){if(Object.isUndefined(a)){return b.checked?b.value:null}else{b.checked=!!a}},textarea:function(b,a){if(Object.isUndefined(a)){return b.value}else{b.value=a}},select:function(g,f){if(Object.isUndefined(f)){return this[g.type=="select-one"?"selectOne":"selectMany"](g)}else{var c,a,e=!Object.isArray(f);for(var b=0,d=g.length;b<d;b++){c=g.options[b];a=this.optionValue(c);if(e){if(a==f){c.selected=true;return}}else{c.selected=f.include(a)}}}},selectOne:function(b){var a=b.selectedIndex;return a>=0?this.optionValue(b.options[a]):null},selectMany:function(d){var c,a=d.length;if(!a){return null}for(var b=0,c=[];b<a;b++){var e=d.options[b];if(e.selected){c.push(this.optionValue(e))}}return c},optionValue:function(a){return Element.extend(a).hasAttribute("value")?a.value:a.text}};Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,b,c,a){$super(a,c);this.element=$(b);this.lastValue=this.getValue()},execute:function(){var a=this.getValue();if(Object.isString(this.lastValue)&&Object.isString(a)?this.lastValue!=a:String(this.lastValue)!=String(a)){this.callback(this.element,a);this.lastValue=a}}});Form.Element.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.serialize(this.element)}});Abstract.EventObserver=Class.create({initialize:function(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));break}}}});Form.Element.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.serialize(this.element)}});if(!window.Event){var Event={}}Object.extend(Event,{KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34,KEY_INSERT:45,cache:{},relatedTarget:function(a){var b;switch(a.type){case"mouseover":b=a.fromElement;break;case"mouseout":b=a.toElement;break;default:return null}return Element.extend(b)}});Event.Methods=(function(){var b;if(Prototype.Browser.IE){var a={0:1,1:4,2:2};b=function(d,c){return d.button==a[c]}}else{if(Prototype.Browser.WebKit){b=function(d,c){switch(c){case 0:return d.which==1&&!d.metaKey;case 1:return d.which==1&&d.metaKey;default:return false}}}else{b=function(d,c){return d.which?(d.which===c+1):(d.button===c)}}}return{isLeftClick:function(c){return b(c,0)},isMiddleClick:function(c){return b(c,1)},isRightClick:function(c){return b(c,2)},element:function(d){var c=Event.extend(d).target;return Element.extend(c.nodeType==Node.TEXT_NODE?c.parentNode:c)},findElement:function(d,f){var e=Event.element(d);if(!f){return e}var c=[e].concat(e.ancestors());return Selector.findElement(c,f,0)},pointer:function(c){return{x:c.pageX||(c.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft)),y:c.pageY||(c.clientY+(document.documentElement.scrollTop||document.body.scrollTop))}},pointerX:function(c){return Event.pointer(c).x},pointerY:function(c){return Event.pointer(c).y},stop:function(c){Event.extend(c);c.preventDefault();c.stopPropagation();c.stopped=true}}})();Event.extend=(function(){var a=Object.keys(Event.Methods).inject({},function(b,c){b[c]=Event.Methods[c].methodize();return b});if(Prototype.Browser.IE){Object.extend(a,{stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return"[object Event]"}});return function(c){if(!c){return false}if(c._extendedByPrototype){return c}c._extendedByPrototype=Prototype.emptyFunction;var b=Event.pointer(c);Object.extend(c,{target:c.srcElement,relatedTarget:Event.relatedTarget(c),pageX:b.x,pageY:b.y});return Object.extend(c,a)}}else{Event.prototype=Event.prototype||document.createEvent("HTMLEvents").__proto__;Object.extend(Event.prototype,a);return Prototype.K}})();Object.extend(Event,(function(){var j=Event.cache;function a(k){if(k._prototypeEventID){return k._prototypeEventID[0]}arguments.callee.id=arguments.callee.id||1;return k._prototypeEventID=[++arguments.callee.id]}function g(k){if(k&&k.include(":")){return"dataavailable"}return k}function c(k){return j[k]=j[k]||{}}function h(m,k){var l=c(m);return l[k]=l[k]||[]}function f(o,m,l){var p=a(o);var n=h(p,m);if(n.pluck("handler").include(l)){return false}var k=function(q){if(!Event||!Event.extend||(q.eventName&&q.eventName!=m)){return false}Event.extend(q);l.call(o,q)};k.handler=l;n.push(k);return k}function b(n,l,k){var m=h(n,l);return m.find(function(o){return o.handler==k})}function e(n,l,k){var m=c(n);if(!m[l]){return false}m[l]=m[l].without(b(n,l,k))}function d(){for(var l in j){for(var k in j[l]){j[l][k]=null}}}if(window.attachEvent){window.attachEvent("onunload",d)}return{observe:function(o,m,l){o=$(o);var n=g(m);var k=f(o,m,l);if(!k){return o}if(o.addEventListener){o.addEventListener(n,k,false)}else{o.attachEvent("on"+n,k)}return o},stopObserving:function(o,m,l){o=$(o);var p=a(o),n=g(m);if(!l&&m){h(p,m).each(function(q){o.stopObserving(m,q.handler)});return o}else{if(!m){Object.keys(c(p)).each(function(q){o.stopObserving(q)});return o}}var k=b(p,m,l);if(!k){return o}if(o.removeEventListener){o.removeEventListener(n,k,false)}else{o.detachEvent("on"+n,k)}e(p,m,l);return o},fire:function(n,l,k){n=$(n);if(n==document&&document.createEvent&&!n.dispatchEvent){n=document.documentElement}var m;if(document.createEvent){m=document.createEvent("HTMLEvents");m.initEvent("dataavailable",true,true)}else{m=document.createEventObject();m.eventType="ondataavailable"}m.eventName=l;m.memo=k||{};if(document.createEvent){n.dispatchEvent(m)}else{n.fireEvent(m.eventType,m)}return Event.extend(m)}}})());Object.extend(Event,Event.Methods);Element.addMethods({fire:Event.fire,observe:Event.observe,stopObserving:Event.stopObserving});Object.extend(document,{fire:Element.Methods.fire.methodize(),observe:Element.Methods.observe.methodize(),stopObserving:Element.Methods.stopObserving.methodize(),loaded:false});(function(){var a;function b(){if(document.loaded){return}if(a){window.clearInterval(a)}document.fire("dom:loaded");document.loaded=true}if(document.addEventListener){if(Prototype.Browser.WebKit){a=window.setInterval(function(){if(/loaded|complete/.test(document.readyState)){b()}},0);Event.observe(window,"load",b)}else{document.addEventListener("DOMContentLoaded",b,false)}}else{document.write("<script id=__onDOMContentLoaded defer src=//:></script>");$("__onDOMContentLoaded").onreadystatechange=function(){if(this.readyState=="complete"){this.onreadystatechange=null;b()}}}})();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})}};var $continue=new Error('"throw $continue" is deprecated, use "return" instead');var Position={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},within:function(c,a,b){if(this.includeScrollOffsets){return this.withinIncludingScrolloffsets(c,a,b)}this.xcomp=a;this.ycomp=b;this.offset=Element.cumulativeOffset(c);return(b>=this.offset[1]&&b<this.offset[1]+c.offsetHeight&&a>=this.offset[0]&&a<this.offset[0]+c.offsetWidth)},withinIncludingScrolloffsets:function(d,b,c){var a=Element.cumulativeScrollOffset(d);this.xcomp=b+a[0]-this.deltaX;this.ycomp=c+a[1]-this.deltaY;this.offset=Element.cumulativeOffset(d);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+d.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+d.offsetWidth)},overlap:function(a,b){if(!a){return 0}if(a=="vertical"){return((this.offset[1]+b.offsetHeight)-this.ycomp)/b.offsetHeight}if(a=="horizontal"){return((this.offset[0]+b.offsetWidth)-this.xcomp)/b.offsetWidth}},cumulativeOffset:Element.Methods.cumulativeOffset,positionedOffset:Element.Methods.positionedOffset,absolutize:function(a){Position.prepare();return Element.absolutize(a)},relativize:function(a){Position.prepare();return Element.relativize(a)},realOffset:Element.Methods.cumulativeScrollOffset,offsetParent:Element.Methods.getOffsetParent,page:Element.Methods.viewportOffset,clone:function(a,c,b){b=b||{};return Element.clonePosition(c,a,b)}};if(!document.getElementsByClassName){document.getElementsByClassName=function(b){function a(c){return c.blank()?null:"[contains(concat(' ', @class, ' '), ' "+c+" ')]"}b.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(d,c){c=c.toString().strip();var e=/\s/.test(c)?$w(c).map(a).join(""):a(c);return e?document._getElementsByXPath(".//*"+e,d):[]}:function(c,j){j=j.toString().strip();var d=[],e=(/\s/.test(j)?$w(j):null);if(!e&&!j){return d}var k=$(c).getElementsByTagName("*");j=" "+j+" ";for(var f=0,h,g;h=k[f];f++){if(h.className&&(g=" "+h.className+" ")&&(g.include(j)||(e&&e.all(function(l){return !l.toString().blank()&&g.include(" "+l+" ")})))){d.push(Element.extend(h))}}return d};return function(c,d){return $(d||document.body).getElementsByClassName(c)}}(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(b){return b.length>0})._each(a)},set:function(a){this.element.className=a},add:function(a){if(this.include(a)){return}this.set($A(this).concat(a).join(" "))},remove:function(a){if(!this.include(a)){return}this.set($A(this).without(a).join(" "))},toString:function(){return $A(this).join(" ")}};Object.extend(Element.ClassNames.prototype,Enumerable);Element.addMethods();String.prototype.parseColor=function(){var c="#";if(this.slice(0,4)=="rgb("){var b=this.slice(4,this.length-1).split(",");var a=0;do{c+=parseInt(b[a]).toColorPart()}while(++a<3)}else{if(this.slice(0,1)=="#"){if(this.length==4){for(var a=1;a<4;a++){c+=(this.charAt(a)+this.charAt(a)).toLowerCase()}}if(this.length==7){c=this.toLowerCase()}}}return(c.length==7?c:(arguments[0]||this))};Element.collectTextNodes=function(a){return $A($(a).childNodes).collect(function(b){return(b.nodeType==3?b.nodeValue:(b.hasChildNodes()?Element.collectTextNodes(b):""))}).flatten().join("")};Element.collectTextNodesIgnoreClass=function(b,a){return $A($(b).childNodes).collect(function(c){return(c.nodeType==3?c.nodeValue:((c.hasChildNodes()&&!Element.hasClassName(c,a))?Element.collectTextNodesIgnoreClass(c,a):""))}).flatten().join("")};Element.setContentZoom=function(b,a){b=$(b);b.setStyle({fontSize:(a/100)+"em"});if(Prototype.Browser.WebKit){window.scrollBy(0,0)}return b};Element.getInlineOpacity=function(a){return $(a).style.opacity||""};Element.forceRerendering=function(c){try{c=$(c);var a=document.createTextNode(" ");c.appendChild(a);c.removeChild(a)}catch(b){}};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)+0.5},reverse:function(a){return 1-a},flicker:function(a){var a=((-Math.cos(a*Math.PI)/4)+0.75)+Math.random()/4;return a>1?1:a},wobble:function(a){return(-Math.cos(a*Math.PI*(9*a))/2)+0.5},pulse:function(a,b){b=b||5;return(((a%(1/b))*b).round()==0?((a*b*2)-(a*b*2).floor()):1-((a*b*2)-(a*b*2).floor()))},spring:function(a){return 1-(Math.cos(a*4.5*Math.PI)*Math.exp(-a*6))},none:function(a){return 0},full:function(a){return 1}},DefaultOptions:{duration:1,fps:100,sync:false,from:0,to:1,delay:0,queue:"parallel"},tagifyText:function(b){var a="position:relative";if(Prototype.Browser.IE){a+=";zoom:1"}b=$(b);$A(b.childNodes).each(function(c){if(c.nodeType==3){c.nodeValue.toArray().each(function(d){b.insertBefore(new Element("span",{style:a}).update(d==" "?String.fromCharCode(160):d),c)});Element.remove(c)}})},multiple:function(e,a){var c;if(((typeof e=="object")||Object.isFunction(e))&&(e.length)){c=e}else{c=$(e).childNodes}var d=Object.extend({speed:0.1,delay:0},arguments[2]||{});var b=d.delay;$A(c).each(function(g,f){new a(g,Object.extend(d,{delay:f*d.speed+b}))})},PAIRS:{slide:["SlideDown","SlideUp"],blind:["BlindDown","BlindUp"],appear:["Appear","Fade"]},toggle:function(c,a){c=$(c);a=(a||"appear").toLowerCase();var b=Object.extend({queue:{position:"end",scope:(c.id||"global"),limit:1}},arguments[2]||{});Effect[c.visible()?Effect.PAIRS[a][1]:Effect.PAIRS[a][0]](c,b)}};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 c=new Date().getTime();var b=Object.isString(a.options.queue)?a.options.queue:a.options.queue.position;switch(b){case"front":this.effects.findAll(function(d){return d.state=="idle"}).each(function(d){d.startOn+=a.finishOn;d.finishOn+=a.finishOn});break;case"with-last":c=this.effects.pluck("startOn").max()||c;break;case"end":c=this.effects.pluck("finishOn").max()||c;break}a.startOn+=c;a.finishOn+=c;if(!a.options.queue.limit||(this.effects.length<a.options.queue.limit)){this.effects.push(a)}if(!this.interval){this.interval=setInterval(this.loop.bind(this),15)}},remove:function(a){this.effects=this.effects.reject(function(b){return b==a});if(this.effects.length==0){clearInterval(this.interval);this.interval=null}},loop:function(){var b=new Date().getTime();for(var 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(options){function codeForEvent(options,eventName){return((options[eventName+"Internal"]?"this.options."+eventName+"Internal(this);":"")+(options[eventName]?"this.options."+eventName+"(this);":""))}if(options&&options.transition===false){options.transition=Effect.Transitions.linear}this.options=Object.extend(Object.extend({},Effect.DefaultOptions),options||{});this.currentFrame=0;this.state="idle";this.startOn=this.options.delay*1000;this.finishOn=this.startOn+(this.options.duration*1000);this.fromToDelta=this.options.to-this.options.from;this.totalTime=this.finishOn-this.startOn;this.totalFrames=this.options.fps*this.options.duration;eval('this.render = function(pos){ if (this.state=="idle"){this.state="running";'+codeForEvent(this.options,"beforeSetup")+(this.setup?"this.setup();":"")+codeForEvent(this.options,"afterSetup")+'};if (this.state=="running"){pos=this.options.transition(pos)*'+this.fromToDelta+"+"+this.options.from+";this.position=pos;"+codeForEvent(this.options,"beforeUpdate")+(this.update?"this.update(pos);":"")+codeForEvent(this.options,"afterUpdate")+"}}");this.event("beforeStart");if(!this.options.sync){Effect.Queues.get(Object.isString(this.options.queue)?"global":this.options.queue.scope).add(this)}},loop:function(a){if(a>=this.startOn){if(a>=this.finishOn){this.render(1);this.cancel();this.event("beforeFinish");if(this.finish){this.finish()}this.event("afterFinish");return}var b=(a-this.startOn)/this.totalTime,c=(b*this.totalFrames).round();if(c>this.currentFrame){this.render(b);this.currentFrame=c}}},cancel:function(){if(!this.options.sync){Effect.Queues.get(Object.isString(this.options.queue)?"global":this.options.queue.scope).remove(this)}this.state="finished"},event:function(a){if(this.options[a+"Internal"]){this.options[a+"Internal"](this)}if(this.options[a]){this.options[a](this)}},inspect:function(){var a=$H();for(property in this){if(!Object.isFunction(this[property])){a.set(property,this[property])}}return"#<Effect:"+a.inspect()+",options:"+$H(this.options).inspect()+">"}});Effect.Parallel=Class.create(Effect.Base,{initialize:function(a){this.effects=a||[];this.start(arguments[1])},update:function(a){this.effects.invoke("render",a)},finish:function(a){this.effects.each(function(b){b.render(1);b.cancel();b.event("beforeFinish");if(b.finish){b.finish(a)}b.event("afterFinish")})}});Effect.Tween=Class.create(Effect.Base,{initialize:function(c,a,b){c=Object.isString(c)?$(c):c;var f=$A(arguments),e=f.last(),d=f.length==5?f[3]:null;this.method=Object.isFunction(e)?e.bind(c):Object.isFunction(c[e])?c[e].bind(c):function(g){c[e]=g};this.start(Object.extend({from:a,to:b},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(b){this.element=$(b);if(!this.element){throw (Effect._elementDoesNotExistError)}if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1})}var a=Object.extend({from:this.element.getOpacity()||0,to:1},arguments[1]||{});this.start(a)},update:function(a){this.element.setOpacity(a)}});Effect.Move=Class.create(Effect.Base,{initialize:function(b){this.element=$(b);if(!this.element){throw (Effect._elementDoesNotExistError)}var a=Object.extend({x:0,y:0,mode:"relative"},arguments[1]||{});this.start(a)},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(c,a,b){return new Effect.Move(c,Object.extend({x:b,y:a},arguments[3]||{}))};Effect.Scale=Class.create(Effect.Base,{initialize:function(c,a){this.element=$(c);if(!this.element){throw (Effect._elementDoesNotExistError)}var b=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:"box",scaleFrom:100,scaleTo:a},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(b){this.originalStyle[b]=this.element.style[b]}.bind(this));this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;var a=this.element.getStyle("font-size")||"100%";["em","px","%","pt"].each(function(b){if(a.indexOf(b)>0){this.fontSize=parseFloat(a);this.fontSizeType=b}}.bind(this));this.factor=(this.options.scaleTo-this.options.scaleFrom)/100;this.dims=null;if(this.options.scaleMode=="box"){this.dims=[this.element.offsetHeight,this.element.offsetWidth]}if(/^content/.test(this.options.scaleMode)){this.dims=[this.element.scrollHeight,this.element.scrollWidth]}if(!this.dims){this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth]}},update:function(a){var b=(this.options.scaleFrom/100)+(this.factor*a);if(this.options.scaleContent&&this.fontSize){this.element.setStyle({fontSize:this.fontSize*b+this.fontSizeType})}this.setDimensions(this.dims[0]*b,this.dims[1]*b)},finish:function(a){if(this.restoreAfterFinish){this.element.setStyle(this.originalStyle)}},setDimensions:function(b,f){var c={};if(this.options.scaleX){c.width=f.round()+"px"}if(this.options.scaleY){c.height=b.round()+"px"}if(this.options.scaleFromCenter){var a=(b-this.dims[0])/2;var e=(f-this.dims[1])/2;if(this.elementPositioning=="absolute"){if(this.options.scaleY){c.top=this.originalTop-a+"px"}if(this.options.scaleX){c.left=this.originalLeft-e+"px"}}else{if(this.options.scaleY){c.top=-a+"px"}if(this.options.scaleX){c.left=-e+"px"}}}this.element.setStyle(c)}});Effect.Highlight=Class.create(Effect.Base,{initialize:function(b){this.element=$(b);if(!this.element){throw (Effect._elementDoesNotExistError)}var a=Object.extend({startcolor:"#ffff99"},arguments[1]||{});this.start(a)},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 b=arguments[1]||{},c=document.viewport.getScrollOffsets(),a=$(d).cumulativeOffset(),e=(window.height||document.body.scrollHeight)-document.viewport.getHeight();if(b.offset){a[1]+=b.offset}return new Effect.Tween(null,c.top,a[1]>e?e:a[1],b,function(f){scrollTo(c.left,f.round())})};Effect.Fade=function(c){c=$(c);var a=c.getInlineOpacity();var b=Object.extend({from:c.getOpacity()||1,to:0,afterFinishInternal:function(d){if(d.options.to!=0){return}d.element.hide().setStyle({opacity:a})}},arguments[1]||{});return new Effect.Opacity(c,b)};Effect.Appear=function(b){b=$(b);var a=Object.extend({from:(b.getStyle("display")=="none"?0:b.getOpacity()||0),to:1,afterFinishInternal:function(c){c.element.forceRerendering()},beforeSetup:function(c){c.element.setOpacity(c.options.from).show()}},arguments[1]||{});return new Effect.Opacity(b,a)};Effect.Puff=function(b){b=$(b);var a={opacity:b.getInlineOpacity(),position:b.getStyle("position"),top:b.style.top,left:b.style.left,width:b.style.width,height:b.style.height};return new Effect.Parallel([new Effect.Scale(b,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(b,{sync:true,to:0})],Object.extend({duration:1,beforeSetupInternal:function(c){Position.absolutize(c.effects[0].element)},afterFinishInternal:function(c){c.effects[0].element.hide().setStyle(a)}},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(b){b.element.hide().undoClipping()}},arguments[1]||{}))};Effect.BlindDown=function(b){b=$(b);var a=b.getDimensions();return new Effect.Scale(b,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:a.height,originalWidth:a.width},restoreAfterFinish:true,afterSetup:function(c){c.element.makeClipping().setStyle({height:"0px"}).show()},afterFinishInternal:function(c){c.element.undoClipping()}},arguments[1]||{}))};Effect.SwitchOff=function(b){b=$(b);var a=b.getInlineOpacity();return new Effect.Appear(b,Object.extend({duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(c){new Effect.Scale(c.element,1,{duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(d){d.element.makePositioned().makeClipping()},afterFinishInternal:function(d){d.element.hide().undoClipping().undoPositioned().setStyle({opacity:a})}})}},arguments[1]||{}))};Effect.DropOut=function(b){b=$(b);var a={top:b.getStyle("top"),left:b.getStyle("left"),opacity:b.getInlineOpacity()};return new Effect.Parallel([new Effect.Move(b,{x:0,y:100,sync:true}),new Effect.Opacity(b,{sync:true,to:0})],Object.extend({duration:0.5,beforeSetup:function(c){c.effects[0].element.makePositioned()},afterFinishInternal:function(c){c.effects[0].element.hide().undoPositioned().setStyle(a)}},arguments[1]||{}))};Effect.Shake=function(d){d=$(d);var c=Object.extend({distance:20,duration:0.5},arguments[1]||{});var e=parseFloat(c.distance);var a=parseFloat(c.duration)/10;var b={top:d.getStyle("top"),left:d.getStyle("left")};return new Effect.Move(d,{x:e,y:0,duration:a,afterFinishInternal:function(f){new Effect.Move(f.element,{x:-e*2,y:0,duration:a*2,afterFinishInternal:function(g){new Effect.Move(g.element,{x:e*2,y:0,duration:a*2,afterFinishInternal:function(h){new Effect.Move(h.element,{x:-e*2,y:0,duration:a*2,afterFinishInternal:function(j){new Effect.Move(j.element,{x:e*2,y:0,duration:a*2,afterFinishInternal:function(k){new Effect.Move(k.element,{x:-e,y:0,duration:a,afterFinishInternal:function(l){l.element.undoPositioned().setStyle(b)}})}})}})}})}})}})};Effect.SlideDown=function(c){c=$(c).cleanWhitespace();var a=c.down().getStyle("bottom");var b=c.getDimensions();return new Effect.Scale(c,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:b.height,originalWidth:b.width},restoreAfterFinish:true,afterSetup:function(d){d.element.makePositioned();d.element.down().makePositioned();if(window.opera){d.element.setStyle({top:""})}d.element.makeClipping().setStyle({height:"0px"}).show()},afterUpdateInternal:function(d){d.element.down().setStyle({bottom:(d.dims[0]-d.element.clientHeight)+"px"})},afterFinishInternal:function(d){d.element.undoClipping().undoPositioned();d.element.down().undoPositioned().setStyle({bottom:a})}},arguments[1]||{}))};Effect.SlideUp=function(c){c=$(c).cleanWhitespace();var a=c.down().getStyle("bottom");var b=c.getDimensions();return new Effect.Scale(c,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(d){d.element.makePositioned();d.element.down().makePositioned();if(window.opera){d.element.setStyle({top:""})}d.element.makeClipping().show()},afterUpdateInternal:function(d){d.element.down().setStyle({bottom:(d.dims[0]-d.element.clientHeight)+"px"})},afterFinishInternal:function(d){d.element.hide().undoClipping().undoPositioned();d.element.down().undoPositioned().setStyle({bottom:a})}},arguments[1]||{}))};Effect.Squish=function(a){return new Effect.Scale(a,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(b){b.element.makeClipping()},afterFinishInternal:function(b){b.element.hide().undoClipping()}})};Effect.Grow=function(a){a=$(a);var c=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{});var d={top:a.style.top,left:a.style.left,height:a.style.height,width:a.style.width,opacity:a.getInlineOpacity()};var b=a.getDimensions();var g,h;var f,e;switch(c.direction){case"top-left":g=h=f=e=0;break;case"top-right":g=b.width;h=e=0;f=-b.width;break;case"bottom-left":g=f=0;h=b.height;e=-b.height;break;case"bottom-right":g=b.width;h=b.height;f=-b.width;e=-b.height;break;case"center":g=b.width/2;h=b.height/2;f=-b.width/2;e=-b.height/2;break}return new Effect.Move(a,{x:g,y:h,duration:0.01,beforeSetup:function(j){j.element.hide().makeClipping().makePositioned()},afterFinishInternal:function(j){new Effect.Parallel([new Effect.Opacity(j.element,{sync:true,to:1,from:0,transition:c.opacityTransition}),new Effect.Move(j.element,{x:f,y:e,sync:true,transition:c.moveTransition}),new Effect.Scale(j.element,100,{scaleMode:{originalHeight:b.height,originalWidth:b.width},sync:true,scaleFrom:window.opera?1:0,transition:c.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(k){k.effects[0].element.setStyle({height:"0px"}).show()},afterFinishInternal:function(k){k.effects[0].element.undoClipping().undoPositioned().setStyle(d)}},c))}})};Effect.Shrink=function(e){e=$(e);var b=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{});var a={top:e.style.top,left:e.style.left,height:e.style.height,width:e.style.width,opacity:e.getInlineOpacity()};var f=e.getDimensions();var d,c;switch(b.direction){case"top-left":d=c=0;break;case"top-right":d=f.width;c=0;break;case"bottom-left":d=0;c=f.height;break;case"bottom-right":d=f.width;c=f.height;break;case"center":d=f.width/2;c=f.height/2;break}return new Effect.Parallel([new Effect.Opacity(e,{sync:true,to:0,from:1,transition:b.opacityTransition}),new Effect.Scale(e,window.opera?1:0,{sync:true,transition:b.scaleTransition,restoreAfterFinish:true}),new Effect.Move(e,{x:d,y:c,sync:true,transition:b.moveTransition})],Object.extend({beforeStartInternal:function(g){g.effects[0].element.makePositioned().makeClipping()},afterFinishInternal:function(g){g.effects[0].element.hide().undoClipping().undoPositioned().setStyle(a)}},b))};Effect.Pulsate=function(d){d=$(d);var c=arguments[1]||{};var b=d.getInlineOpacity();var e=c.transition||Effect.Transitions.sinoidal;var a=function(f){return e(1-Effect.Transitions.pulse(f,c.pulses))};a.bind(e);return new Effect.Opacity(d,Object.extend(Object.extend({duration:2,from:0,afterFinishInternal:function(f){f.element.setStyle({opacity:b})}},c),{transition:a}))};Effect.Fold=function(b){b=$(b);var a={top:b.style.top,left:b.style.left,width:b.style.width,height:b.style.height};b.makeClipping();return new Effect.Scale(b,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(c){new Effect.Scale(b,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(d){d.element.hide().undoClipping().setStyle(a)}})}},arguments[1]||{}))};Effect.Morph=Class.create(Effect.Base,{initialize:function(c){this.element=$(c);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 b=this.element.getStyles();this.style=this.style.reject(function(d){return d.value==b[d.key]});a.afterFinishInternal=function(d){d.element.addClassName(d.options.style);d.transforms.each(function(e){d.element.style[e.style]=""})}}}this.start(a)},setup:function(){function a(b){if(!b||["rgba(0, 0, 0, 0)","transparent"].include(b)){b="#ffffff"}b=b.parseColor();return $R(0,2).map(function(c){return parseInt(b.slice(c*2+1,c*2+3),16)})}this.transforms=this.style.map(function(b){var e=b[0],g=b[1],d=null;if(g.parseColor("#zzzzzz")!="#zzzzzz"){g=g.parseColor();d="color"}else{if(e=="opacity"){g=parseFloat(g);if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1})}}else{if(Element.CSS_LENGTH.test(g)){var f=g.match(/^([\+\-]?[0-9\.]+)(.*)$/);g=parseFloat(f[1]);d=(f.length==3)?f[2]:null}}}var c=this.element.getStyle(e);return{style:e.camelize(),originalValue:d=="color"?a(c):parseFloat(c||0),targetValue:d=="color"?a(g):g,unit:d}}.bind(this)).reject(function(b){return((b.originalValue==b.targetValue)||(b.unit!="color"&&(isNaN(b.originalValue)||isNaN(b.targetValue))))})},update:function(b){var c={},d,a=this.transforms.length;while(a--){c[(d=this.transforms[a]).style]=d.unit=="color"?"#"+(Math.round(d.originalValue[0]+(d.targetValue[0]-d.originalValue[0])*b)).toColorPart()+(Math.round(d.originalValue[1]+(d.targetValue[1]-d.originalValue[1])*b)).toColorPart()+(Math.round(d.originalValue[2]+(d.targetValue[2]-d.originalValue[2])*b)).toColorPart():(d.originalValue+(d.targetValue-d.originalValue)*b).toFixed(3)+(d.unit===null?"":d.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(b){b=$H(b);var c=b.values().first();this.tracks.push($H({ids:b.keys().first(),effect:Effect.Morph,options:{style:c}}))}.bind(this));return this},play:function(){return new Effect.Parallel(this.tracks.map(function(d){var e=d.get("ids"),a=d.get("effect"),c=d.get("options");var b=[$(e)||$$(e)].flatten();return b.map(function(f){return new a(f,Object.extend({sync:true},c))})}).flatten(),this.options)}});Element.CSS_PROPERTIES=$w("backgroundColor backgroundPosition borderBottomColor borderBottomStyle borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth borderRightColor borderRightStyle borderRightWidth borderSpacing borderTopColor borderTopStyle borderTopWidth bottom clip color fontSize fontWeight height left letterSpacing lineHeight marginBottom marginLeft marginRight marginTop markerOffset maxHeight maxWidth minHeight minWidth opacity outlineColor outlineOffset outlineWidth paddingBottom paddingLeft paddingRight paddingTop right textIndent top width wordSpacing zIndex");Element.CSS_LENGTH=/^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;String.__parseStyleElement=document.createElement("div");String.prototype.parseStyle=function(){var a,b=$H();if(Prototype.Browser.WebKit){a=new Element("div",{style:this}).style}else{String.__parseStyleElement.innerHTML='<div style="'+this+'"></div>';a=String.__parseStyleElement.childNodes[0].style}Element.CSS_PROPERTIES.each(function(c){if(a[c]){b.set(c,a[c])}});if(Prototype.Browser.IE&&this.include("opacity")){b.set("opacity",this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1])}return b};if(document.defaultView&&document.defaultView.getComputedStyle){Element.getStyles=function(b){var a=document.defaultView.getComputedStyle($(b),null);return Element.CSS_PROPERTIES.inject({},function(d,c){d[c]=a[c];return d})}}else{Element.getStyles=function(c){c=$(c);var a=c.currentStyle,b;b=Element.CSS_PROPERTIES.inject({},function(e,d){e.set(d,a[d]);return e});if(!b.opacity){b.set("opacity",c.getOpacity())}return b}}Effect.Methods={morph:function(b,a){b=$(b);new Effect.Morph(b,Object.extend({style:a},arguments[2]||{}));return b},visualEffect:function(e,a,c){e=$(e);var b=a.dasherize().camelize(),d=b.charAt(0).toUpperCase()+b.substring(1);new Effect[d](e,c);return e},highlight:function(b,a){b=$(b);new Effect.Highlight(b,a);return b}};$w("fade appear grow shrink fold blindUp blindDown slideUp slideDown pulsate shake puff squish switchOff dropOut").each(function(a){Effect.Methods[a]=function(c,b){c=$(c);Effect[a.charAt(0).toUpperCase()+a.substring(1)](c,b);return c}});$w("getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles").each(function(a){Effect.Methods[a]=Element[a]});Element.addMethods(Effect.Methods);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(c){c=$(c);var b=Object.extend({greedy:true,hoverclass:null,tree:false},arguments[1]||{});if(b.containment){b._containers=[];var a=b.containment;if(Object.isArray(a)){a.each(function(d){b._containers.push($(d))})}else{b._containers.push($(a))}}if(b.accept){b.accept=[b.accept].flatten()}Element.makePositioned(c);b.element=c;this.drops.push(b)},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(d){return a==d})},isAffected:function(a,b,c){return((c.element!=b)&&((!c._containers)||this.isContained(b,c))&&((!c.accept)||(Element.classNames(b).detect(function(d){return c.accept.include(d)})))&&Position.within(c.element,a[0],a[1]))},deactivate:function(a){if(a.hoverclass){Element.removeClassName(a.element,a.hoverclass)}this.last_active=null},activate:function(a){if(a.hoverclass){Element.addClassName(a.element,a.hoverclass)}this.last_active=a},show:function(b,c){if(!this.drops.length){return}var d,a=[];this.drops.each(function(e){if(Droppables.isAffected(b,c,e)){a.push(e)}});if(a.length>0){d=Droppables.findDeepestChild(a)}if(this.last_active&&this.last_active!=d){this.deactivate(this.last_active)}if(d){Position.within(d.element,b[0],b[1]);if(d.onHover){d.onHover(c,d.element,Position.overlap(d.overlap,d.element))}if(d!=this.last_active){Droppables.activate(d)}}},fire:function(a,b){if(!this.last_active){return}Position.prepare();if(this.isAffected([Event.pointerX(a),Event.pointerY(a)],b,this.last_active)){if(this.last_active.onDrop){this.last_active.onDrop(b,this.last_active.element,a);return true}}},reset:function(){if(this.last_active){this.deactivate(this.last_active)}}};var 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(d){if(this._timeout){clearTimeout(this._timeout);this._timeout=null}if(!this.activeDraggable){return}this._lastPointer=null;if(_currentPage=="copaso"){Position.prepare();var b=[Event.pointerX(d),Event.pointerY(d)];var c=Position.cumulativeOffset($(_currentActiveColorPanelID));var a=Element.getDimensions($(_currentActiveColorPanelID));a=[a.width+c[0],a.height+c[1]];var e=(d.target)?d.target:d.srcElement;if((b[0]>c[0])&&(b[0]<a[0])&&(b[1]>c[1])&&(b[1]<a[1])&&/color_([0-9]+)/.test(e.id)){addColorToScratchPane(_colorHexs[_currentColorID])}}this.activeDraggable.endDrag(d);this.activeDraggable=null},keyPress:function(a){if(this.activeDraggable){this.activeDraggable.keyPress(a)}},addObserver:function(a){this.observers.push(a);this._cacheObserverCallbacks()},removeObserver:function(a){this.observers=this.observers.reject(function(b){return b.element==a});this._cacheObserverCallbacks()},notify:function(b,a,c){if(this[b+"Count"]>0){this.observers.each(function(d){if(d[b]){d[b](b,a,c)}})}if(a.options[b]){a.options[b](a,c)}},_cacheObserverCallbacks:function(){["onStart","onEnd","onDrag"].each(function(a){Draggables[a+"Count"]=Draggables.observers.select(function(b){return b[a]}).length})}};var Draggable=Class.create({initialize:function(b){var c={handle:false,reverteffect:function(g,d,f){var e=Math.sqrt(Math.abs(d^2)+Math.abs(f^2))*0.02;new Effect.Move(g,{x:-f,y:-d,duration:e,queue:{scope:"_draggable",position:"end"}})},endeffect:function(e){var d=Object.isNumber(e._opacity)?e._opacity:1;new Effect.Opacity(e,{duration:0.2,from:0.7,to:d,queue:{scope:"_draggable",position:"end"},afterFinish:function(){Draggable._dragging[e]=false}})},zindex:1000,revert:false,quiet:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,snap:false,delay:0};if(!arguments[1]||Object.isUndefined(arguments[1].endeffect)){Object.extend(c,{starteffect:function(d){d._opacity=Element.getOpacity(d);Draggable._dragging[d]=true;new Effect.Opacity(d,{duration:0.2,from:d._opacity,to:0.7})}})}var a=Object.extend(c,arguments[1]||{});this.element=$(b);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(c){if(!Object.isUndefined(Draggable._dragging[this.element])&&Draggable._dragging[this.element]){return}if(Event.isLeftClick(c)){var d=Event.element(c);if((tag_name=d.tagName.toUpperCase())&&(tag_name=="INPUT"||tag_name=="SELECT"||tag_name=="OPTION"||tag_name=="BUTTON"||tag_name=="TEXTAREA")){return}var a=[Event.pointerX(c),Event.pointerY(c)];var b=Position.cumulativeOffset(this.element);this.offset=[0,1].map(function(e){return(a[e]-b[e])});Draggables.activate(this);Event.stop(c)}},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.element._originallyAbsolute=(this.element.getStyle("position")=="absolute");if(!this.element._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);if(this.options.starteffect){this.options.starteffect(this.element)}},updateDrag:function(event,pointer){if(!this.dragging){this.startDrag(event)}if(!this.options.quiet){Position.prepare();Droppables.show(pointer,this.element)}Draggables.notify("onDrag",this,event);this.draw(pointer);if(this.options.change){this.options.change(this)}if(this.options.scroll){this.stopScrolling();var p;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)}if(Prototype.Browser.WebKit){window.scrollBy(0,0)}Event.stop(event)},finishDrag:function(f,a){this.dragging=false;if(this.options.quiet){Position.prepare();var b=[Event.pointerX(f),Event.pointerY(f)];Droppables.show(b,this.element)}if(this.options.ghosting){if(!this.element._originallyAbsolute){Position.relativize(this.element)}delete this.element._originallyAbsolute;Element.remove(this._clone);this._clone=null}var c=false;if(a){c=Droppables.fire(f,this.element);if(!c){c=false}}if(c&&this.options.onDropped){this.options.onDropped(this.element)}var e=this.options.revert;if(e&&Object.isFunction(e)){e=e(this.element)}var g=this.currentDelta();if(e&&this.options.reverteffect){if(c==0||e!="failure"){this.options.reverteffect(this.element,g[1]-this.delta[1],g[0]-this.delta[0])}}else{this.delta=g}if(this.options.zindex){this.element.style.zIndex=this.originalZ}if(this.options.endeffect){this.options.endeffect(this.element)}Draggables.notify("onEnd",this,f);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(b){var c=Position.cumulativeOffset(this.element);if(this.options.ghosting){var a=Position.realOffset(this.element);c[0]+=a[0]-Position.deltaX;c[1]+=a[1]-Position.deltaY}var e=this.currentDelta();c[0]-=e[0];c[1]-=e[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 f=[0,1].map(function(d){return(b[d]-c[d]-this.offset[d])}.bind(this));if(this.options.snap){if(Object.isFunction(this.options.snap)){f=this.options.snap(f[0],f[1],this)}else{if(Object.isArray(this.options.snap)){f=f.map(function(h,d){return(h/this.options.snap[d]).round()*this.options.snap[d]}.bind(this))}else{f=f.map(function(d){return(d/this.options.snap).round()*this.options.snap}.bind(this))}}}var g=this.element.style;if((!this.options.constraint)||(this.options.constraint=="horizontal")){g.left=f[0]+"px"}if((!this.options.constraint)||(this.options.constraint=="vertical")){g.top=f[1]+"px"}if(g.visibility=="hidden"){g.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();var 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/1000;this.options.scroll.scrollTo(left+d*this.scrollSpeed[0],top+d*this.scrollSpeed[1])}}}else{this.options.scroll.scrollLeft+=this.scrollSpeed[0]*delta/1000;this.options.scroll.scrollTop+=this.scrollSpeed[1]*delta/1000}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/1000;Draggables._lastScrollPointer[1]+=this.scrollSpeed[1]*delta/1000;if(Draggables._lastScrollPointer[0]<0){Draggables._lastScrollPointer[0]=0}if(Draggables._lastScrollPointer[1]<0){Draggables._lastScrollPointer[1]=0}this.draw(Draggables._lastScrollPointer)}if(this.options.change){this.options.change(this)}},_getWindowScroll:function(w){var T,L,W,H;with(w.document){if(w.document.documentElement&&documentElement.scrollTop){T=documentElement.scrollTop;L=documentElement.scrollLeft}else{if(w.document.body){T=body.scrollTop;L=body.scrollLeft}}if(w.innerWidth){W=w.innerWidth;H=w.innerHeight}else{if(w.document.documentElement&&documentElement.clientWidth){W=documentElement.clientWidth;H=documentElement.clientHeight}else{W=body.offsetWidth;H=body.offsetHeight}}}return{top:T,left:L,width:W,height:H}}});Draggable._dragging={};var SortableObserver=Class.create({initialize:function(a,b){this.element=$(a);this.observer=b;this.lastValue=Sortable.serialize(this.element)},onStart:function(){this.lastValue=Sortable.serialize(this.element)},onEnd:function(){Sortable.unmark();if(this.lastValue!=Sortable.serialize(this.element)){this.observer(this.element)}}});var 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){var a=Sortable.options(b);if(a){Draggables.removeObserver(a.element);a.droppables.each(function(c){Droppables.remove(c)});a.draggables.invoke("destroy");delete Sortable.sortables[a.element.id]}},create:function(d){d=$(d);var b=Object.extend({element:d,tag:"li",dropOnEmpty:false,tree:false,treeTag:"ul",overlap:"vertical",constraint:"vertical",containment:d,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(d);var e={revert:true,quiet:b.quiet,scroll:b.scroll,scrollSpeed:b.scrollSpeed,scrollSensitivity:b.scrollSensitivity,delay:b.delay,ghosting:b.ghosting,constraint:b.constraint,handle:b.handle};if(b.starteffect){e.starteffect=b.starteffect}if(b.reverteffect){e.reverteffect=b.reverteffect}else{if(b.ghosting){e.reverteffect=function(f){f.style.top=0;f.style.left=0}}}if(b.endeffect){e.endeffect=b.endeffect}if(b.zindex){e.zindex=b.zindex}var a={overlap:b.overlap,containment:b.containment,tree:b.tree,hoverclass:b.hoverclass,onHover:Sortable.onHover};var c={onHover:Sortable.onEmptyHover,overlap:b.overlap,containment:b.containment,hoverclass:b.hoverclass};Element.cleanWhitespace(d);b.draggables=[];b.droppables=[];if(b.dropOnEmpty||b.tree){Droppables.add(d,c);b.droppables.push(d)}(b.elements||this.findElements(d,b)||[]).each(function(h,g){var f=b.handles?$(b.handles[g]):(b.handle?$(h).select("."+b.handle)[0]:h);b.draggables.push(new Draggable(h,Object.extend(e,{handle:f})));Droppables.add(h,a);if(b.tree){h.treeNode=d}b.droppables.push(h)});if(b.tree){(Sortable.findTreeElements(d,b)||[]).each(function(f){Droppables.add(f,c);f.treeNode=d;b.droppables.push(f)})}this.sortables[d.id]=b;Draggables.addObserver(new SortableObserver(d,b.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(d,b,c){if(Element.isParent(b,d)){return}if(c>0.33&&c<0.66&&Sortable.options(b).tree){return}else{if(c>0.5){Sortable.mark(b,"before");if(b.previousSibling!=d){var a=d.parentNode;d.style.visibility="hidden";b.parentNode.insertBefore(d,b);if(b.parentNode!=a){Sortable.options(a).onChange(d)}Sortable.options(b.parentNode).onChange(d)}}else{Sortable.mark(b,"after");var e=b.nextSibling||null;if(e!=d){var a=d.parentNode;d.style.visibility="hidden";b.parentNode.insertBefore(d,e);if(b.parentNode!=a){Sortable.options(a).onChange(d)}Sortable.options(b.parentNode).onChange(d)}}}},onEmptyHover:function(a,j,f){var e=a.parentNode;var h=Sortable.options(j);if(!Element.isParent(j,a)){var c;var d=Sortable.findElements(j,{tag:h.tag,only:h.only});var g=null;if(d){var b=Element.offsetSize(j,h.overlap)*(1-f);for(c=0;c<d.length;c+=1){if(b-Element.offsetSize(d[c],h.overlap)>=0){b-=Element.offsetSize(d[c],h.overlap)}else{if(b-(Element.offsetSize(d[c],h.overlap)/2)>=0){g=c+1<d.length?d[c+1]:null;break}else{g=d[c];break}}}}j.insertBefore(a,g);Sortable.options(e).onChange(a);h.onChange(a)}},unmark:function(){if(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=Position.cumulativeOffset(b);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(f,e,g){var a=Sortable.findElements(f,e)||[];for(var b=0;b<a.length;++b){var c=a[b].id.match(e.format);if(!c){continue}var d={id:encodeURIComponent(c?c[1]:null),element:f,parent:g,children:[],position:g.children.length,container:$(a[b]).down(e.treeTag)};if(d.container){this._tree(d.container,e,d)}g.children.push(d)}return g},tree:function(d){d=$(d);var c=this.options(d);var b=Object.extend({tag:c.tag,treeTag:c.treeTag,only:c.only,name:d.id,format:c.format},arguments[1]||{});var a={id:null,parent:null,children:[],container:d,position:0};return Sortable._tree(d,b,a)},_constructIndex:function(a){var b="";do{if(a.id){b="["+a.position+"]"+b}}while((a=a.parent)!=null);return b},sequence:function(b){b=$(b);var a=Object.extend(this.options(b),arguments[1]||{});return $(this.findElements(b,a)||[]).map(function(c){return c.id.match(a.format)?c.id.match(a.format)[1]:""})},setSequence:function(c,d){c=$(c);var a=Object.extend(this.options(c),arguments[2]||{});var b={};this.findElements(c,a).each(function(e){if(e.id.match(a.format)){b[e.id.match(a.format)[1]]=[e,e.parentNode]}e.parentNode.removeChild(e)});d.each(function(f){var e=b[f];if(e){e[1].appendChild(e[0]);delete b[f]}})},serialize:function(c){c=$(c);var a=Object.extend(Sortable.options(c),arguments[1]||{});var b=encodeURIComponent((arguments[1]&&arguments[1].name)?arguments[1].name:c.id);if(a.tree){return Sortable.tree(c,arguments[1]).children.map(function(d){return[b+Sortable._constructIndex(d)+"[id]="+encodeURIComponent(d.id)].concat(d.children.map(arguments.callee))}).flatten().join("&")}else{return Sortable.sequence(c,arguments[1]).map(function(d){return b+"[]="+encodeURIComponent(d)}).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,b){if(!e.hasChildNodes()){return null}b=b.toUpperCase();if(a){a=[a].flatten()}var c=[];$A(e.childNodes).each(function(f){if(f.tagName&&f.tagName.toUpperCase()==b&&(!a||(Element.classNames(f).detect(function(h){return a.include(h)})))){c.push(f)}if(d){var g=Element.findChildren(f,a,d,b);if(g){c.push(g)}}});return(c.length>0?c.flatten():[])};Element.offsetSize=function(b,a){return b["offset"+((a=="vertical"||a=="height")?"Height":"Width")]};if(typeof Effect=="undefined"){throw ("controls.js requires including script.aculo.us' effects.js library")}var Autocompleter={};Autocompleter.Base=Class.create({baseInitialize:function(c,a,b){c=$(c);this.element=c;this.update=$(a);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||0.4;this.options.minChars=this.options.minChars||1;this.options.onShow=this.options.onShow||function(e,d){if(!d.style.position||d.style.position=="absolute"){d.style.position="absolute";Position.clone(e,d,{setHeight:false,offsetTop:e.offsetHeight})}Effect.Appear(d,{duration:0.15})};this.options.onHide=this.options.onHide||function(e,d){new Effect.Fade(d,{duration:0.15})};if(typeof(this.options.tokens)=="string"){this.options.tokens=new Array(this.options.tokens)}if(!this.options.tokens.include("\n")){this.options.tokens.push("\n")}this.observer=null;this.element.setAttribute("autocomplete","off");Element.hide(this.update);Event.observe(this.element,"blur",this.onBlur.bindAsEventListener(this));Event.observe(this.element,"keypress",this.onKeyPress.bindAsEventListener(this))},show:function(){if(Element.getStyle(this.update,"display")=="none"){this.options.onShow(this.element,this.update)}if(!this.iefix&&(Prototype.Browser.IE)&&(Element.getStyle(this.update,"position")=="absolute")){new Insertion.After(this.update,'<iframe id="'+this.update.id+'_iefix" style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" src="javascript:false;" frameborder="0" scrolling="no"></iframe>');this.iefix=$(this.update.id+"_iefix")}if(this.iefix){setTimeout(this.fixIEOverlapping.bind(this),50)}},fixIEOverlapping:function(){Position.clone(this.update,this.iefix,{setTop:(!this.update.style.height)});this.iefix.style.zIndex=1;this.update.style.zIndex=2;Element.show(this.iefix)},hide:function(){this.stopIndicator();if(Element.getStyle(this.update,"display")!="none"){this.options.onHide(this.element,this.update)}if(this.iefix){Element.hide(this.iefix)}},startIndicator:function(){if(this.options.indicator){Element.show(this.options.indicator)}},stopIndicator:function(){if(this.options.indicator){Element.hide(this.options.indicator)}},onKeyPress:function(a){if(this.active){switch(a.keyCode){case Event.KEY_TAB:case Event.KEY_RETURN:this.selectEntry();Event.stop(a);case Event.KEY_ESC:this.hide();this.active=false;Event.stop(a);return;case Event.KEY_LEFT:case Event.KEY_RIGHT:return;case Event.KEY_UP:this.markPrevious();this.render();if(Prototype.Browser.WebKit){Event.stop(a)}return;case Event.KEY_DOWN:this.markNext();this.render();if(Prototype.Browser.WebKit){Event.stop(a)}return}}else{if(a.keyCode==Event.KEY_TAB||a.keyCode==Event.KEY_RETURN||(Prototype.Browser.WebKit>0&&a.keyCode==0)){return}}this.changed=true;this.hasFocus=true;if(this.observer){clearTimeout(this.observer)}this.observer=setTimeout(this.onObserverEvent.bind(this),this.options.frequency*1000)},activate:function(){this.changed=false;this.hasFocus=true;this.getUpdatedChoices()},onHover:function(a){var b=Event.findElement(a,"LI");if(this.index!=b.autocompleteIndex){this.index=b.autocompleteIndex;this.render()}Event.stop(a)},onClick:function(a){var b=Event.findElement(a,"LI");this.index=b.autocompleteIndex;this.selectEntry();this.hide()},onBlur:function(a){setTimeout(this.hide.bind(this),250);this.hasFocus=false;this.active=false},render:function(){if(this.entryCount>0){for(var a=0;a<this.entryCount;a++){this.index==a?Element.addClassName(this.getEntry(a),"selected"):Element.removeClassName(this.getEntry(a),"selected")}if(this.hasFocus){this.show();this.active=true}}else{this.active=false;this.hide()}},markPrevious:function(){if(this.index>0){this.index--}else{this.index=this.entryCount-1}this.getEntry(this.index).scrollIntoView(true)},markNext:function(){if(this.index<this.entryCount-1){this.index++}else{this.index=0}this.getEntry(this.index).scrollIntoView(false)},getEntry:function(a){return this.update.firstChild.childNodes[a]},getCurrentEntry:function(){return this.getEntry(this.index)},selectEntry:function(){this.active=false;this.updateElement(this.getCurrentEntry())},updateElement:function(a){if(this.options.updateElement){this.options.updateElement(a);return}var d="";if(this.options.select){var c=$(a).select("."+this.options.select)||[];if(c.length>0){d=Element.collectTextNodes(c[0],this.options.select)}}else{d=Element.collectTextNodesIgnoreClass(a,"informal")}var f=this.getTokenBounds();if(f[0]!=-1){var e=this.element.value.substr(0,f[0]);var b=this.element.value.substr(f[0]).match(/^\s+/);if(b){e+=b[0]}this.element.value=e+d+this.element.value.substr(f[1])}else{this.element.value=d}this.oldElementValue=this.element.value;this.element.focus();if(this.options.afterUpdateElement){this.options.afterUpdateElement(this.element,a)}},updateChoices:function(b){if(!this.changed&&this.hasFocus){this.update.innerHTML=b;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 c=this.getEntry(a);c.autocompleteIndex=a;this.addObservers(c)}}else{this.entryCount=0}this.stopIndicator();this.index=0;if(this.entryCount==1&&this.options.autoSelect){this.selectEntry();this.hide()}else{this.render()}}},addObservers:function(a){Event.observe(a,"mouseover",this.onHover.bindAsEventListener(this));Event.observe(a,"click",this.onClick.bindAsEventListener(this))},onObserverEvent:function(){this.changed=false;this.tokenBounds=null;if(this.getToken().length>=this.options.minChars){this.getUpdatedChoices()}else{this.active=false;this.hide()}this.oldElementValue=this.element.value},getToken:function(){var a=this.getTokenBounds();return this.element.value.substring(a[0],a[1]).strip()},getTokenBounds:function(){if(null!=this.tokenBounds){return this.tokenBounds}var d=this.element.value;if(d.strip().empty()){return[-1,0]}var c=arguments.callee.getFirstDifferencePos(d,this.oldElementValue);var a=(c==this.oldElementValue.length?1:0);var f=-1,b=d.length;var e;for(var g=0,h=this.options.tokens.length;g<h;++g){e=d.lastIndexOf(this.options.tokens[g],c+a-1);if(e>f){f=e}e=d.indexOf(this.options.tokens[g],c+a);if(-1!=e&&e<b){b=e}}return(this.tokenBounds=[f+1,b])}});Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos=function(a,c){var b=Math.min(a.length,c.length);for(var d=0;d<b;++d){if(a[d]!=c[d]){return d}}return b};Ajax.Autocompleter=Class.create(Autocompleter.Base,{initialize:function(c,a,d,b){this.baseInitialize(c,a,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(d,b,a,c){this.baseInitialize(d,b,c);this.options.array=a},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(e){var j=[];var h=[];var d=e.getToken();var c=0;for(var f=0;f<e.options.array.length&&j.length<e.options.choices;f++){var b=e.options.array[f];var g=e.options.ignoreCase?b.toLowerCase().indexOf(d.toLowerCase()):b.indexOf(d);while(g!=-1){if(g==0&&b.length!=d.length){j.push("<li><strong>"+b.substr(0,d.length)+"</strong>"+b.substr(d.length)+"</li>");break}else{if(d.length>=e.options.partialChars&&e.options.partialSearch&&g!=-1){if(e.options.fullSearch||/\s/.test(b.substr(g-1,1))){h.push("<li>"+b.substr(0,g)+"<strong>"+b.substr(g,d.length)+"</strong>"+b.substr(g+d.length)+"</li>");break}}}g=e.options.ignoreCase?b.toLowerCase().indexOf(d.toLowerCase(),g+1):b.indexOf(d,g+1)}}if(h.length){j=j.concat(h.slice(0,e.options.choices-j.length))}return"<ul>"+j.join("")+"</ul>"}},a||{})}});Field.scrollFreeActivate=function(a){setTimeout(function(){Field.activate(a)},1)};Ajax.InPlaceEditor=Class.create({initialize:function(c,a,b){this.url=a;this.element=c=$(c);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{if(Event.KEY_RETURN==a.keyCode){this.handleFormSubmission(a)}}},createControl:function(a,c,b){var g=this.options[a+"Control"];var d=this.options[a+"Text"];if("button"==g){var e=document.createElement("input");e.type="submit";e.value=d;e.className="editor_"+a+"_button";if("cancel"==a){e.onclick=this._boundCancelHandler}this._form.appendChild(e);this._controls[a]=e}else{if("link"==g){var f=document.createElement("a");f.href="#";f.appendChild(document.createTextNode(d));f.onclick="cancel"==a?this._boundCancelHandler:this._boundSubmitHandler;f.className="editor_"+a+"_link";if(b){f.className+=" "+b}this._form.appendChild(f);this._controls[a]=f}}},createEditField:function(){var c=(this.options.loadTextURL?this.options.loadingText:this.getText());var b;if(1>=this.options.rows&&!/\r|\n/.test(this.getText())){b=document.createElement("input");b.type="text";var a=this.options.size||this.options.cols||0;if(0<a){b.size=a}}else{b=document.createElement("textarea");b.rows=(1>=this.options.rows?this.options.autoRows:this.options.rows);b.cols=this.options.cols||40}b.name=this.options.paramName;b.value=c;b.className="editor_field";if(this.options.submitOnBlur){b.onblur=this._boundSubmitHandler}this._controls.editor=b;if(this.options.loadTextURL){this.loadExternalText()}this._form.appendChild(this._controls.editor)},createForm:function(){var b=this;function a(c,e){var d=b.options["text"+c+"Controls"];if(!d||e===false){return}b._form.appendChild(document.createTextNode(d))}this._form=$(document.createElement("form"));this._form.id=this.options.formId;this._form.addClassName(this.options.formClassName);this._form.onsubmit=this._boundSubmitHandler;this.createEditField();if("textarea"==this._controls.editor.tagName.toLowerCase()){this._form.appendChild(document.createElement("br"))}if(this.options.onFormCustomization){this.options.onFormCustomization(this,this._form)}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");if(this.options.externalControl){this.options.externalControl.hide()}this.element.hide();this.createForm();this.element.parentNode.insertBefore(this._form,this.element);if(!this.options.loadTextURL){this.postProcessEditField()}if(a){Event.stop(a)}},enterHover:function(a){if(this.options.hoverClassName){this.element.addClassName(this.options.hoverClassName)}if(this._saving){return}this.triggerCallback("onEnterHover")},getText:function(){return this.element.innerHTML},handleAJAXFailure:function(a){this.triggerCallback("onFailure",a);if(this._oldInnerHTML){this.element.innerHTML=this._oldInnerHTML;this._oldInnerHTML=null}},handleFormCancellation:function(a){this.wrapUp();if(a){Event.stop(a)}},handleFormSubmission:function(a){var b=this._form;var d=$F(this._controls.editor);this.prepareSubmission();var f=this.options.callback(b,d)||"";if(Object.isString(f)){f=f.toQueryParams()}f.editorId=this.element.id;if(this.options.htmlResponse){var c=Object.extend({evalScripts:true},this.options.ajaxOptions);Object.extend(c,{parameters:f,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});new Ajax.Updater({success:this.element},this.url,c)}else{var c=Object.extend({method:"get"},this.options.ajaxOptions);Object.extend(c,{parameters:f,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});new Ajax.Request(this.url,c)}if(a){Event.stop(a)}},leaveEditMode:function(){this.element.removeClassName(this.options.savingClassName);this.removeForm();this.leaveHover();this.element.style.backgroundColor=this._originalBackground;this.element.show();if(this.options.externalControl){this.options.externalControl.show()}this._saving=false;this._editing=false;this._oldInnerHTML=null;this.triggerCallback("onLeaveEditMode")},leaveHover:function(a){if(this.options.hoverClassName){this.element.removeClassName(this.options.hoverClassName)}if(this._saving){return}this.triggerCallback("onLeaveHover")},loadExternalText:function(){this._form.addClassName(this.options.loadingClassName);this._controls.editor.disabled=true;var a=Object.extend({method:"get"},this.options.ajaxOptions);Object.extend(a,{parameters:"editorId="+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(c){this._form.removeClassName(this.options.loadingClassName);var b=c.responseText;if(this.options.stripLoadedTextTags){b=b.stripTags()}this._controls.editor.value=b;this._controls.editor.disabled=false;this.postProcessEditField()}.bind(this),onFailure:this._boundFailureHandler});new Ajax.Request(this.options.loadTextURL,a)},postProcessEditField:function(){var a=this.options.fieldPostCreation;if(a){$(this._controls.editor)["focus"==a?"focus":"activate"]()}},prepareOptions:function(){this.options=Object.clone(Ajax.InPlaceEditor.DefaultOptions);Object.extend(this.options,Ajax.InPlaceEditor.DefaultCallbacks);[this._extraDefaultOptions].flatten().compact().each(function(a){Object.extend(this.options,a)}.bind(this))},prepareSubmission:function(){this._saving=true;this.removeForm();this.leaveHover();this.showSaving()},registerListeners:function(){this._listeners={};var a;$H(Ajax.InPlaceEditor.Listeners).each(function(b){a=this[b.value].bind(this);this._listeners[b.key]=a;if(!this.options.externalControlOnly){this.element.observe(b.key,a)}if(this.options.externalControl){this.options.externalControl.observe(b.key,a)}}.bind(this))},removeForm:function(){if(!this._form){return}this._form.remove();this._form=null;this._controls={}},showSaving:function(){this._oldInnerHTML=this.element.innerHTML;this.element.innerHTML=this.options.savingText;this.element.addClassName(this.options.savingClassName);this.element.style.backgroundColor=this._originalBackground;this.element.show()},triggerCallback:function(a,b){if("function"==typeof this.options[a]){this.options[a](this,b)}},unregisterListeners:function(){$H(this._listeners).each(function(a){if(!this.options.externalControlOnly){this.element.stopObserving(a.key,a.value)}if(this.options.externalControl){this.options.externalControl.stopObserving(a.key,a.value)}}.bind(this))},wrapUp:function(a){this.leaveEditMode();this._boundComplete(a,this.element)}});Object.extend(Ajax.InPlaceEditor.prototype,{dispose:Ajax.InPlaceEditor.prototype.destroy});Ajax.InPlaceCollectionEditor=Class.create(Ajax.InPlaceEditor,{initialize:function($super,c,a,b){this._extraDefaultOptions=Ajax.InPlaceCollectionEditor.DefaultOptions;$super(c,a,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(b){this._text=b.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(d){return 2===d.length?d:[d,d].flatten()});var b=("value" in this.options)?this.options.value:this._text;var c=this._collection.any(function(d){return d[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(b){if(!b){return}function a(d,c){if(d in b||c===undefined){return}b[d]=c}a("cancelControl",(b.cancelLink?"link":(b.cancelButton?"button":b.cancelLink==b.cancelButton==false?false:undefined)));a("okControl",(b.okLink?"link":(b.okButton?"button":b.okLink==b.okButton==false?false:undefined)));a("highlightColor",b.highlightcolor);a("highlightEndColor",b.highlightendcolor)};Object.extend(Ajax.InPlaceEditor,{DefaultOptions:{ajaxOptions:{},autoRows:3,cancelControl:"link",cancelText:"cancel",clickToEditText:"Click to edit",externalControl:null,externalControlOnly:false,fieldPostCreation:"activate",formClassName:"inplaceeditor-form",formId:null,highlightColor:"#ffff99",highlightEndColor:"#ffffff",hoverClassName:"",htmlResponse:true,loadingClassName:"inplaceeditor-loading",loadingText:"Loading...",okControl:"button",okText:"ok",paramName:"value",rows:1,savingClassName:"inplaceeditor-saving",savingText:"Saving...",size:0,stripLoadedTextTags:false,submitOnBlur:false,textAfterControls:"",textBeforeControls:"",textBetweenControls:""},DefaultCallbacks:{callback:function(a){return Form.serialize(a)},onComplete:function(a,b){new Effect.Highlight(b,{startcolor:this.options.highlightColor,keepBackgroundImage:true})},onEnterEditMode:null,onEnterHover:function(a){a.element.style.backgroundColor=a.options.highlightColor;if(a._effect){a._effect.cancel()}},onFailure:function(a,b){alert("Error communication with the server: "+a.responseText.stripTags())},onFormCustomization:null,onLeaveEditMode:null,onLeaveHover:function(a){a._effect=new Effect.Highlight(a.element,{startcolor:a.options.highlightColor,endcolor:a.options.highlightEndColor,restorecolor:a._originalBackground,keepBackgroundImage:true})}},Listeners:{click:"enterEditMode",keydown:"checkForEscapeOrReturn",mouseover:"enterHover",mouseout:"leaveHover"}});Ajax.InPlaceCollectionEditor.DefaultOptions={loadingCollectionText:"Loading options..."};Form.Element.DelayedObserver=Class.create({initialize:function(b,c,a){this.delay=c||0.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(a){if(this.lastValue==$F(this.element)){return}if(this.timer){clearTimeout(this.timer)}this.timer=setTimeout(this.onTimerEvent.bind(this),this.delay*1000);this.lastValue=$F(this.element)},onTimerEvent:function(){this.timer=null;this.callback(this.element,$F(this.element))}});var Builder={NODEMAP:{AREA:"map",CAPTION:"table",COL:"table",COLGROUP:"table",LEGEND:"fieldset",OPTGROUP:"select",OPTION:"select",PARAM:"object",TBODY:"table",TD:"table",TFOOT:"table",TH:"table",THEAD:"table",TR:"table"},node:function(b){b=b.toUpperCase();var c=this.NODEMAP[b]||"div";var d=document.createElement(c);try{d.innerHTML="<"+b+"></"+b+">"}catch(a){}var f=d.firstChild||null;if(f&&(f.tagName.toUpperCase()!=b)){f=f.getElementsByTagName(b)[0]}if(!f){f=document.createElement(b)}if(!f){return}if(arguments[1]){if(this._isStringOrNumber(arguments[1])||(arguments[1] instanceof Array)||arguments[1].tagName){this._children(f,arguments[1])}else{var g=this._attributes(arguments[1]);if(g.length){try{d.innerHTML="<"+b+" "+g+"></"+b+">"}catch(a){}f=d.firstChild||null;if(!f){f=document.createElement(b);for(attr in arguments[1]){f[attr=="class"?"className":attr]=arguments[1][attr]}}if(f.tagName.toUpperCase()!=b){f=d.getElementsByTagName(b)[0]}}}}if(arguments[2]){this._children(f,arguments[2])}return f},_text:function(a){return document.createTextNode(a)},ATTR_MAP:{className:"class",htmlFor:"for"},_attributes:function(a){var b=[];for(attribute in a){b.push((attribute in this.ATTR_MAP?this.ATTR_MAP[attribute]:attribute)+'="'+a[attribute].toString().escapeHTML().gsub(/"/,"&quot;")+'"')}return b.join(" ")},_children:function(a,b){if(b.tagName){a.appendChild(b);return}if(typeof b=="object"){b.flatten().each(function(c){if(typeof c=="object"){a.appendChild(c)}else{if(Builder._isStringOrNumber(c)){a.appendChild(Builder._text(c))}}})}else{if(Builder._isStringOrNumber(b)){a.appendChild(Builder._text(b))}}},_isStringOrNumber:function(a){return(typeof a=="string"||typeof a=="number")},build:function(a){var b=this.node("div");$(b).update(a.strip());return b.down()},dump:function(b){if(typeof b!="object"&&typeof b!="function"){b=window}var a=("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/);a.each(function(c){b[c]=function(){return Builder.node.apply(Builder,[c].concat($A(arguments)))}})}};if(!Control){var Control={}}Control.Slider=Class.create();Control.Slider.prototype={initialize:function(a,c,b){var d=this;if(a instanceof Array){this.handles=a.collect(function(f){return $(f)})}else{this.handles=[$(a)]}this.track=$(c);this.options=b||{};this.restrictedOffset=Math.abs(this.options.restrictedOffset||0);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(e){return $(e)}):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.dir=0;this.active=false;this.dragging=false;this.disabled=false;if(this.options.disabled){this.setDisabled()}this.allowedValues=this.options.values?this.options.values.sortBy(Prototype.K):false;if(this.allowedValues){this.minimum=this.allowedValues.min();this.maximum=this.allowedValues.max()}this.eventMouseDown=this.startDrag.bindAsEventListener(this);this.eventMouseUp=this.endDrag.bindAsEventListener(this);this.eventMouseMove=this.update.bindAsEventListener(this);this.handles.each(function(e,f){f=d.handles.length-1-f;d.setValue(parseFloat((d.options.sliderValue instanceof Array?d.options.sliderValue[f]:d.options.sliderValue)||d.range.start),f);Element.makePositioned(e);Event.observe(e,"mousedown",d.eventMouseDown)});Event.observe(document,"mouseup",this.eventMouseUp);Event.observe(document,"mousemove",this.eventMouseMove);this.initialized=true},dispose:function(){var a=this;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(b){if(this.allowedValues){if(b>=this.allowedValues.max()){return(this.allowedValues.max())}if(b<=this.allowedValues.min()){return(this.allowedValues.min())}var a=Math.abs(this.allowedValues[0]-b);var c=this.allowedValues[0];this.allowedValues.each(function(e){var d=Math.abs(e-b);if(d<=a){c=e;a=d}});return c}if(b>this.range.end){return this.range.end}if(b<this.range.start){return this.range.start}return b},setValue:function(b,a){if(!this.active){this.activeHandleIdx=a||0;this.activeHandle=this.handles[this.activeHandleIdx];this.updateStyles()}a=a||this.activeHandleIdx||0;this.dir=(this.getNearestValue(b)>this.values[a])?-1:1;if(this.initialized&&this.restricted){if((a>0)&&(b<(this.values[a-1]+(this.restrictedOffset*this.dir)))){b=this.values[a-1]+(this.restrictedOffset*this.dir)}if((a<(this.handles.length-1))&&(b>(this.values[a+1]+(this.restrictedOffset*this.dir)))){b=this.values[a+1]+(this.restrictedOffset*this.dir)}}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();if(!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){if(this.trackLength==this.range.end){return Math.round(a-(this.handleLength/2))+"px"}else{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(b){var a=this.values.sortBy(Prototype.K);b=b||0;return $R(a[b],a[b+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.alignY)},isVertical:function(){return(this.axis=="vertical")},drawSpans:function(){var a=this;if(this.spans){$R(0,this.spans.length-1).each(function(b){a.setSpan(a.spans[b],a.getRange(b))})}if(this.options.startSpan){this.setSpan(this.options.startSpan,$R(0,this.values.length>1?this.getRange(0).min():this.value))}if(this.options.endSpan){this.setSpan(this.options.endSpan,$R(this.values.length>1?this.getRange(this.spans.length-1).max():this.value,this.maximum))}},setSpan:function(a,b){if(this.isVertical()){a.style.top=this.translateToPx(b.start);a.style.height=this.translateToPx(b.end-b.start+this.range.start)}else{a.style.left=this.translateToPx(b.start);a.style.width=this.translateToPx(b.end-b.start+this.range.start)}},updateStyles:function(){this.handles.each(function(a){Element.removeClassName(a,"selected")});Element.addClassName(this.activeHandle,"selected")},startDrag:function(e){if(Event.isLeftClick(e)){if(!this.disabled){this.active=true;var a=Event.element(e);var b=[Event.pointerX(e),Event.pointerY(e)];var c=a;if(c==this.track){var d=Position.cumulativeOffset(this.track);this.event=e;this.setValue(this.translateToValue((this.isVertical()?b[1]-d[1]:b[0]-d[0])-(this.handleLength/2)));var d=Position.cumulativeOffset(this.activeHandle);this.offsetX=(b[0]-d[0]);this.offsetY=(b[1]-d[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 d=Position.cumulativeOffset(this.activeHandle);this.offsetX=(b[0]-d[0]);this.offsetY=(b[1]-d[1])}}}Event.stop(e)}},update:function(a){if(this.active){if(!this.dragging){this.dragging=true}this.draw(a);if(navigator.appVersion.indexOf("AppleWebKit")>0){window.scrollBy(0,0)}Event.stop(a)}},draw:function(c){var a=[Event.pointerX(c),Event.pointerY(c)];var b=Position.cumulativeOffset(this.track);a[0]-=this.offsetX+b[0];a[1]-=this.offsetY+b[1];this.event=c;this.setValue(this.translateToValue(this.isVertical()?a[1]:a[0]));if(this.initialized&&this.options.onSlide){this.options.onSlide(this.values.length>1?this.values:this.value,this)}},endDrag:function(a){if(this.active&&this.dragging){this.finishDrag(a,true);Event.stop(a)}this.active=false;this.dragging=false},finishDrag:function(b,a){this.active=false;this.dragging=false;this.updateFinished()},updateFinished:function(){if(this.initialized&&this.options.onChange){this.options.onChange(this.values.length>1?this.values:this.value,this)}this.event=null}};Sound={tracks:{},_enabled:true,template:new Template('<embed style="height:0" id="sound_#{track}_#{id}" src="#{url}" loop="false" autostart="true" hidden="true"/>'),enable:function(){Sound._enabled=true},disable:function(){Sound._enabled=false},play:function(a){if(!Sound._enabled){return}var b=Object.extend({track:"global",url:a,replace:false},arguments[1]||{});if(b.replace&&this.tracks[b.track]){$R(0,this.tracks[b.track].id).each(function(d){var c=$("sound_"+b.track+"_"+d);c.Stop&&c.Stop();c.remove()});this.tracks[b.track]=null}if(!this.tracks[b.track]){this.tracks[b.track]={id:0}}else{this.tracks[b.track].id++}b.id=this.tracks[b.track].id;$$("body")[0].insert(Prototype.Browser.IE?new Element("bgsound",{id:"sound_"+b.track+"_"+b.id,src:b.url,loop:1,autostart:true}):Sound.template.evaluate(b))}};if(Prototype.Browser.Gecko&&navigator.userAgent.indexOf("Win")>0){if(navigator.plugins&&$A(navigator.plugins).detect(function(a){return a.name.indexOf("QuickTime")!=-1})){Sound.template=new Template('<object id="sound_#{track}_#{id}" width="0" height="0" type="audio/mpeg" data="#{url}"/>')}else{Sound.play=function(){}}}Event.simulateMouse=function(d,c){var b=Object.extend({pointerX:0,pointerY:0,buttons:0,ctrlKey:false,altKey:false,shiftKey:false,metaKey:false},arguments[2]||{});var a=document.createEvent("MouseEvents");a.initMouseEvent(c,true,true,document.defaultView,b.buttons,b.pointerX,b.pointerY,b.pointerX,b.pointerY,b.ctrlKey,b.altKey,b.shiftKey,b.metaKey,0,$(d));if(this.mark){Element.remove(this.mark)}this.mark=document.createElement("div");this.mark.appendChild(document.createTextNode(" "));document.body.appendChild(this.mark);this.mark.style.position="absolute";this.mark.style.top=b.pointerY+"px";this.mark.style.left=b.pointerX+"px";this.mark.style.width="5px";this.mark.style.height="5px;";this.mark.style.borderTop="1px solid red;";this.mark.style.borderLeft="1px solid red;";if(this.step){alert("["+new Date().getTime().toString()+"] "+c+"/"+Test.Unit.inspect(b))}$(d).dispatchEvent(a)};Event.simulateKey=function(d,c){var b=Object.extend({ctrlKey:false,altKey:false,shiftKey:false,metaKey:false,keyCode:0,charCode:0},arguments[2]||{});var a=document.createEvent("KeyEvents");a.initKeyEvent(c,true,true,window,b.ctrlKey,b.altKey,b.shiftKey,b.metaKey,b.keyCode,b.charCode);$(d).dispatchEvent(a)};Event.simulateKeys=function(c,b){for(var a=0;a<b.length;a++){Event.simulateKey(c,"keypress",{charCode:b.charCodeAt(a)})}};var Test={};Test.Unit={};Test.Unit.inspect=Object.inspect;Test.Unit.Logger=Class.create();Test.Unit.Logger.prototype={initialize:function(a){this.log=$(a);if(this.log){this._createLogTable()}},start:function(a){if(!this.log){return}this.testName=a;this.lastLogLine=document.createElement("tr");this.statusCell=document.createElement("td");this.nameCell=document.createElement("td");this.nameCell.className="nameCell";this.nameCell.appendChild(document.createTextNode(a));this.messageCell=document.createElement("td");this.lastLogLine.appendChild(this.statusCell);this.lastLogLine.appendChild(this.nameCell);this.lastLogLine.appendChild(this.messageCell);this.loglines.appendChild(this.lastLogLine)},finish:function(b,a){if(!this.log){return}this.lastLogLine.className=b;this.statusCell.innerHTML=b;this.messageCell.innerHTML=this._toHTML(a);this.addLinksToResults()},message:function(a){if(!this.log){return}this.messageCell.innerHTML=this._toHTML(a)},summary:function(a){if(!this.log){return}this.logsummary.innerHTML=this._toHTML(a)},_createLogTable:function(){this.log.innerHTML='<div id="logsummary"></div><table id="logtable"><thead><tr><th>Status</th><th>Test</th><th>Message</th></tr></thead><tbody id="loglines"></tbody></table>';this.logsummary=$("logsummary");this.loglines=$("loglines")},_toHTML:function(a){return a.escapeHTML().replace(/\n/g,"<br/>")},addLinksToResults:function(){$$("tr.failed .nameCell").each(function(a){a.title="Run only this test";Event.observe(a,"click",function(){window.location.search="?tests="+a.innerHTML})});$$("tr.passed .nameCell").each(function(a){a.title="Run all tests";Event.observe(a,"click",function(){window.location.search=""})})}};Test.Unit.Runner=Class.create();Test.Unit.Runner.prototype={initialize:function(c){this.options=Object.extend({testLog:"testlog"},arguments[1]||{});this.options.resultsURL=this.parseResultsURLQueryParameter();this.options.tests=this.parseTestsQueryParameter();if(this.options.testLog){this.options.testLog=$(this.options.testLog)||null}if(this.options.tests){this.tests=[];for(var a=0;a<this.options.tests.length;a++){if(/^test/.test(this.options.tests[a])){this.tests.push(new Test.Unit.Testcase(this.options.tests[a],c[this.options.tests[a]],c.setup,c.teardown))}}}else{if(this.options.test){this.tests=[new Test.Unit.Testcase(this.options.test,c[this.options.test],c.setup,c.teardown)]}else{this.tests=[];for(var b in c){if(/^test/.test(b)){this.tests.push(new Test.Unit.Testcase(this.options.context?" -> "+this.options.titles[b]:b,c[b],c.setup,c.teardown))}}}}this.currentTest=0;this.logger=new Test.Unit.Logger(this.options.testLog);setTimeout(this.runTests.bind(this),1000)},parseResultsURLQueryParameter:function(){return window.location.search.parseQuery()["resultsURL"]},parseTestsQueryParameter:function(){if(window.location.search.parseQuery()["tests"]){return window.location.search.parseQuery()["tests"].split(",")}},getResult:function(){var b=false;for(var a=0;a<this.tests.length;a++){if(this.tests[a].errors>0){return"ERROR"}if(this.tests[a].failures>0){b=true}}if(b){return"FAILURE"}else{return"SUCCESS"}},postResults:function(){if(this.options.resultsURL){new Ajax.Request(this.options.resultsURL,{method:"get",parameters:"result="+this.getResult(),asynchronous:false})}},runTests:function(){var a=this.tests[this.currentTest];if(!a){this.postResults();this.logger.summary(this.summary());return}if(!a.isWaiting){this.logger.start(a.name)}a.run();if(a.isWaiting){this.logger.message("Waiting for "+a.timeToWait+"ms");setTimeout(this.runTests.bind(this),a.timeToWait||1000)}else{this.logger.finish(a.status(),a.summary());this.currentTest++;this.runTests()}},summary:function(){var d=0;var a=0;var e=0;var c=[];for(var b=0;b<this.tests.length;b++){d+=this.tests[b].assertions;a+=this.tests[b].failures;e+=this.tests[b].errors}return((this.options.context?this.options.context+": ":"")+this.tests.length+" tests, "+d+" assertions, "+a+" failures, "+e+" errors")}};Test.Unit.Assertions=Class.create();Test.Unit.Assertions.prototype={initialize:function(){this.assertions=0;this.failures=0;this.errors=0;this.messages=[]},summary:function(){return(this.assertions+" assertions, "+this.failures+" failures, "+this.errors+" errors\n"+this.messages.join("\n"))},pass:function(){this.assertions++},fail:function(a){this.failures++;this.messages.push("Failure: "+a)},info:function(a){this.messages.push("Info: "+a)},error:function(a){this.errors++;this.messages.push(a.name+": "+a.message+"("+Test.Unit.inspect(a)+")")},status:function(){if(this.failures>0){return"failed"}if(this.errors>0){return"error"}return"passed"},assert:function(c){var b=arguments[1]||'assert: got "'+Test.Unit.inspect(c)+'"';try{c?this.pass():this.fail(b)}catch(a){this.error(a)}},assertEqual:function(b,c){var d=arguments[2]||"assertEqual";try{(b==c)?this.pass():this.fail(d+': expected "'+Test.Unit.inspect(b)+'", actual "'+Test.Unit.inspect(c)+'"')}catch(a){this.error(a)}},assertInspect:function(b,c){var d=arguments[2]||"assertInspect";try{(b==c.inspect())?this.pass():this.fail(d+': expected "'+Test.Unit.inspect(b)+'", actual "'+Test.Unit.inspect(c)+'"')}catch(a){this.error(a)}},assertEnumEqual:function(b,c){var d=arguments[2]||"assertEnumEqual";try{$A(b).length==$A(c).length&&b.zip(c).all(function(e){return e[0]==e[1]})?this.pass():this.fail(d+": expected "+Test.Unit.inspect(b)+", actual "+Test.Unit.inspect(c))}catch(a){this.error(a)}},assertNotEqual:function(b,c){var d=arguments[2]||"assertNotEqual";try{(b!=c)?this.pass():this.fail(d+': got "'+Test.Unit.inspect(c)+'"')}catch(a){this.error(a)}},assertIdentical:function(b,c){var d=arguments[2]||"assertIdentical";try{(b===c)?this.pass():this.fail(d+': expected "'+Test.Unit.inspect(b)+'", actual "'+Test.Unit.inspect(c)+'"')}catch(a){this.error(a)}},assertNotIdentical:function(b,c){var d=arguments[2]||"assertNotIdentical";try{!(b===c)?this.pass():this.fail(d+': expected "'+Test.Unit.inspect(b)+'", actual "'+Test.Unit.inspect(c)+'"')}catch(a){this.error(a)}},assertNull:function(a){var c=arguments[1]||"assertNull";try{(a==null)?this.pass():this.fail(c+': got "'+Test.Unit.inspect(a)+'"')}catch(b){this.error(b)}},assertMatch:function(c,d){var f=arguments[2]||"assertMatch";var a=new RegExp(c);try{(a.exec(d))?this.pass():this.fail(f+' : regex: "'+Test.Unit.inspect(c)+" did not match: "+Test.Unit.inspect(d)+'"')}catch(b){this.error(b)}},assertHidden:function(a){var b=arguments[1]||"assertHidden";this.assertEqual("none",a.style.display,b)},assertNotNull:function(a){var b=arguments[1]||"assertNotNull";this.assert(a!=null,b)},assertType:function(b,c){var d=arguments[2]||"assertType";try{(c.constructor==b)?this.pass():this.fail(d+': expected "'+Test.Unit.inspect(b)+'", actual "'+(c.constructor)+'"')}catch(a){this.error(a)}},assertNotOfType:function(b,c){var d=arguments[2]||"assertNotOfType";try{(c.constructor!=b)?this.pass():this.fail(d+': expected "'+Test.Unit.inspect(b)+'", actual "'+(c.constructor)+'"')}catch(a){this.error(a)}},assertInstanceOf:function(b,c){var d=arguments[2]||"assertInstanceOf";try{(c instanceof b)?this.pass():this.fail(d+": object was not an instance of the expected type")}catch(a){this.error(a)}},assertNotInstanceOf:function(b,c){var d=arguments[2]||"assertNotInstanceOf";try{!(c instanceof b)?this.pass():this.fail(d+": object was an instance of the not expected type")}catch(a){this.error(a)}},assertRespondsTo:function(c,a){var d=arguments[2]||"assertRespondsTo";try{(a[c]&&typeof a[c]=="function")?this.pass():this.fail(d+": object doesn't respond to ["+c+"]")}catch(b){this.error(b)}},assertReturnsTrue:function(d,a){var f=arguments[2]||"assertReturnsTrue";try{var c=a[d];if(!c){c=a["is"+d.charAt(0).toUpperCase()+d.slice(1)]}c()?this.pass():this.fail(f+": method returned false")}catch(b){this.error(b)}},assertReturnsFalse:function(d,a){var f=arguments[2]||"assertReturnsFalse";try{var c=a[d];if(!c){c=a["is"+d.charAt(0).toUpperCase()+d.slice(1)]}!c()?this.pass():this.fail(f+": method returned true")}catch(b){this.error(b)}},assertRaise:function(d,c){var a=arguments[2]||"assertRaise";try{c();this.fail(a+": exception expected but none was raised")}catch(b){((d==null)||(b.name==d))?this.pass():this.error(b)}},assertElementsMatch:function(){var b=$A(arguments),a=$A(b.shift());if(a.length!=b.length){this.fail("assertElementsMatch: size mismatch: "+a.length+" elements, "+b.length+" expressions");return false}a.zip(b).all(function(c,d){var e=$(c.first()),f=c.last();if(e.match(f)){return true}this.fail("assertElementsMatch: (in index "+d+") expected "+f.inspect()+" but got "+e.inspect())}.bind(this))&&this.pass()},assertElementMatches:function(a,b){this.assertElementsMatch([a],b)},benchmark:function(c,d){var a=new Date();(d||1).times(c);var b=((new Date())-a);this.info((arguments[2]||"Operation")+" finished "+d+" iterations in "+(b/1000)+"s");return b},_isVisible:function(a){a=$(a);if(!a.parentNode){return true}this.assertNotNull(a);if(a.style&&Element.getStyle(a,"display")=="none"){return false}return this._isVisible(a.parentNode)},assertNotVisible:function(a){this.assert(!this._isVisible(a),Test.Unit.inspect(a)+" was not hidden and didn't have a hidden parent either. "+(""||arguments[1]))},assertVisible:function(a){this.assert(this._isVisible(a),Test.Unit.inspect(a)+" was not visible. "+(""||arguments[1]))},benchmark:function(c,d){var a=new Date();(d||1).times(c);var b=((new Date())-a);this.info((arguments[2]||"Operation")+" finished "+d+" iterations in "+(b/1000)+"s");return b}};Test.Unit.Testcase=Class.create();Object.extend(Object.extend(Test.Unit.Testcase.prototype,Test.Unit.Assertions.prototype),{initialize:function(name,test,setup,teardown){Test.Unit.Assertions.prototype.initialize.bind(this)();this.name=name;if(typeof test=="string"){test=test.gsub(/(\.should[^\(]+\()/,"#{0}this,");test=test.gsub(/(\.should[^\(]+)\(this,\)/,"#{1}(this)");this.test=function(){eval("with(this){"+test+"}")}}else{this.test=test||function(){}}this.setup=setup||function(){};this.teardown=teardown||function(){};this.isWaiting=false;this.timeToWait=1000},wait:function(b,a){this.isWaiting=true;this.test=a;this.timeToWait=b},run:function(){try{try{if(!this.isWaiting){this.setup.bind(this)()}this.isWaiting=false;this.test.bind(this)()}finally{if(!this.isWaiting){this.teardown.bind(this)()}}}catch(a){this.error(a)}}});Test.setupBDDExtensionMethods=function(){var b={shouldEqual:"assertEqual",shouldNotEqual:"assertNotEqual",shouldEqualEnum:"assertEnumEqual",shouldBeA:"assertType",shouldNotBeA:"assertNotOfType",shouldBeAn:"assertType",shouldNotBeAn:"assertNotOfType",shouldBeNull:"assertNull",shouldNotBeNull:"assertNotNull",shouldBe:"assertReturnsTrue",shouldNotBe:"assertReturnsFalse",shouldRespondTo:"assertRespondsTo"};var a=function(c,e,d){this[c].apply(this,(e||[]).concat([d]))};Test.BDDMethods={};$H(b).each(function(c){Test.BDDMethods[c.key]=function(){var e=$A(arguments);var d=e.shift();a.apply(d,[c.value,e,this])}});[Array.prototype,String.prototype,Number.prototype,Boolean.prototype].each(function(c){Object.extend(c,Test.BDDMethods)})};Test.context=function(c,e,d){Test.setupBDDExtensionMethods();var b={};var g={};for(specName in e){switch(specName){case"setup":case"teardown":b[specName]=e[specName];break;default:var a="test"+specName.gsub(/\s+/,"-").camelize();var f=e[specName].toString().split("\n").slice(1);if(/^\{/.test(f[0])){f=f.slice(1)}f.pop();f=f.map(function(h){return h.strip()});b[a]=f.join("\n");g[a]=specName}}new Test.Unit.Runner(b,{titles:g,testLog:d||"testlog",context:c})};var loadingImage="http://static.colourlovers.com/images/loadingLB.gif";var closeButton="http://static.colourlovers.com/images/close.gif";function getPageScroll(){var a;if(self.pageYOffset){a=self.pageYOffset}else{if(document.documentElement&&document.documentElement.scrollTop){a=document.documentElement.scrollTop}else{if(document.body){a=document.body.scrollTop}}}arrayPageScroll=new Array("",a);return arrayPageScroll}function getPageSize(){var b,a;if(window.innerHeight&&window.scrollMaxY){b=document.body.scrollWidth;a=window.innerHeight+window.scrollMaxY}else{if(document.body.scrollHeight>document.body.offsetHeight){b=document.body.scrollWidth;a=document.body.scrollHeight}else{b=document.body.offsetWidth;a=document.body.offsetHeight}}var d,c;if(self.innerHeight){d=self.innerWidth;c=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){d=document.documentElement.clientWidth;c=document.documentElement.clientHeight}else{if(document.body){d=document.body.clientWidth;c=document.body.clientHeight}}}if(a<c){pageHeight=c}else{pageHeight=a}if(b<d){pageWidth=d}else{pageWidth=b}arrayPageSize=new Array(pageWidth,pageHeight,d,c);return arrayPageSize}function pause(b){var c=new Date();var a=c.getTime()+b;while(true){c=new Date();if(c.getTime()>a){}return}}function getKey(a){if(a==null){keycode=event.keyCode}else{keycode=a.which}key=String.fromCharCode(keycode).toLowerCase();if(key=="x"){hideLightbox()}}function listenKey(){document.onkeypress=getKey}function showLightbox(j){var e=$("overlay");var g=$("lightbox");var d=$("lightboxCaption");var f=$("lightboxImage");var h=$("loadingImage");var b=$("lightboxDetails");var a=getPageSize();var c=getPageScroll();if(h){h.style.top=(c[1]+((a[3]-35-h.height)/2)+"px");h.style.left=(((a[0]-20-h.width)/2)+"px");h.style.display="block"}e.style.height=(a[1]+"px");e.style.display="block";imgPreload=new Image();imgPreload.onload=function(){f.src=j.href;var k=c[1]+((a[3]-35-imgPreload.height)/2);var l=((a[0]-20-imgPreload.width)/2);g.style.top=(k<0)?"0px":k+"px";g.style.left=(l<0)?"0px":l+"px";b.style.width=imgPreload.width+"px";if(j.getAttribute("title")){d.style.display="block";d.innerHTML=j.getAttribute("title")}else{d.style.display="none"}if(navigator.appVersion.indexOf("MSIE")!=-1){pause(250)}if(h){h.style.display="none"}selects=document.getElementsByTagName("select");for(i=0;i!=selects.length;i++){selects[i].style.visibility="hidden"}g.style.display="block";a=getPageSize();e.style.height=(a[1]+"px");listenKey();return false};imgPreload.src=j.href}function hideLightbox(){objOverlay=$("overlay");objLightbox=$("lightbox");objOverlay.style.display="none";objLightbox.style.display="none";selects=document.getElementsByTagName("select");for(i=0;i!=selects.length;i++){selects[i].style.visibility="visible"}document.onkeypress=""}function initLightbox(){if(!document.getElementsByTagName){return}var o=document.getElementsByTagName("a");for(var k=0;k<o.length;k++){var a=o[k];if(a.getAttribute("href")&&(a.getAttribute("rel")=="lightbox")){a.onclick=function(){showLightbox(this);return false}}}var c=document.getElementsByTagName("body").item(0);var j=document.createElement("div");j.setAttribute("id","overlay");j.onclick=function(){hideLightbox();return false};j.style.display="none";j.style.position="absolute";j.style.top="0";j.style.left="0";j.style.zIndex="90";j.style.width="100%";c.insertBefore(j,c.firstChild);var l=getPageSize();var e=getPageScroll();var m=new Image();m.onload=function(){var r=document.createElement("a");r.setAttribute("href","#");r.onclick=function(){hideLightbox();return false};j.appendChild(r);var q=document.createElement("img");q.src=loadingImage;q.setAttribute("id","loadingImage");q.style.position="absolute";q.style.zIndex="150";r.appendChild(q);m.onload=function(){};return false};m.src=loadingImage;var p=document.createElement("div");p.setAttribute("id","lightbox");p.style.display="none";p.style.position="absolute";p.style.zIndex="100";c.insertBefore(p,j.nextSibling);var b=document.createElement("a");b.setAttribute("href","#");b.setAttribute("title","Click to close");b.onclick=function(){hideLightbox();return false};p.appendChild(b);var n=new Image();n.onload=function(){var q=document.createElement("img");q.src=closeButton;q.setAttribute("id","closeButton");q.style.position="absolute";q.style.zIndex="200";b.appendChild(q);return false};n.src=closeButton;var d=document.createElement("img");d.setAttribute("id","lightboxImage");b.appendChild(d);var g=document.createElement("div");g.setAttribute("id","lightboxDetails");p.appendChild(g);var f=document.createElement("div");f.setAttribute("id","lightboxCaption");f.style.display="none";g.appendChild(f);var h=document.createElement("div");h.setAttribute("id","keyboardMsg");h.innerHTML='press <a href="#" onclick="hideLightbox(); return false;"><kbd>x</kbd></a> to close';g.appendChild(h)}storeCaret=function(a){if(typeof(a.createTextRange)!="undefined"){a._caretPos=document.selection.createRange().duplicate()}};fmtTxt=function(c,h,m,b){_input=$(c);_input.focus();var f;if((typeof _input._caretPos!="undefined")&&(_input.createTextRange)){var l=_input._caretPos;f=((b=="")||(typeof b=="undefined"))?l.text:b;var a=f.length;var j=0;if(f.charAt(f.length-1)==" "){l.text=(h+f.substring(0,(f.length-1))+m+" ");j=1}else{l.text=(h+f+m)}if(a==0){l.moveStart("character",(m.length*-1));l.moveEnd("character",(m.length*-1))}else{l.moveStart("character",((m.length+a)*-1));l.moveEnd("character",((m.length+j)*-1))}l.select()}else{if(typeof _input.selectionStart!="undefined"){var g=_input.value.substr(0,_input.selectionStart);if((b=="")||(typeof b=="undefined")){f=_input.value.substr(_input.selectionStart,(_input.selectionEnd-_input.selectionStart))}else{f=b}var k=_input.value.substr(_input.selectionEnd);var e=_input.selectionStart;var d=_input.scrollTop;if(f.charAt(f.length-1)==" "){f=f.substring(0,(f.length-1));m+=" "}_input.value=(g+h+f+m+k);if(_input.setSelectionRange){if(f.length==0){_input.setSelectionRange((e+h.length),(e+h.length))}else{_input.setSelectionRange((e+h.length),(e+h.length+f.length))}_input.focus()}_input.scrollTop=d}else{_input.value+=(h+m);_input.focus()}}};fmtTxtURL=function(a){var b=$(a);var c="";if((typeof(b._caretPos)!="undefined")&&(b.createTextRange)){c=b._caretPos.text}else{if(typeof(b.selectionStart)!="undefined"){c=b.value.substr(b.selectionStart,(b.selectionEnd-b.selectionStart))}}_url=prompt("Input the destination for this Link","http://");if((_url!=null)&&(_url!="")){_text=prompt("Input the Title of this Link",c);if((_url.indexOf("http://")!=0)&&(_url.indexOf("https://")!=0)){_url=("http://"+_url)}if(_text==""){_text=_url}if((_url!="http://")&&(_url!=null)&&(_url!="undefined")){fmtTxt(a,'<a href="'+_url+'" target="_blank">',"</a>",_text)}}else{b.focus()}};fmtTxtImage=function(a){var b=$(a);var c="";c=prompt("Input the link where the image is hosted:","http://");if((c!=null)&&(c!="")){if((c.indexOf("http://")!=0)&&(c.indexOf("https://")!=0)){c=("http://"+c)}if((c!="http://")&&(c!=null)&&(c!="undefined")){fmtTxt(a,'<img src="','" />',c)}}else{b.focus()}};fmtTxtUnderline=function(a){fmtTxt(a,'<span style="text-decoration: underline;">',"</span>")};