var Prototype={Version:"1.5.1",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},BrowserFeatures:{XPath:!!document.evaluate,ElementExtensions:!!window.HTMLElement,SpecificElementExtensions:(document.createElement("div").__proto__!==document.createElement("form").__proto__)},ScriptFragment:"<script[^>]*>([\u0001-\uFFFF]*?)<\/script>",JSONFilter:/^\/\*-secure-\s*(.*)\s*\*\/\s*$/,emptyFunction:function(){},K:function(B){return B}};var Class={create:function(){return function(){this.initialize.apply(this,arguments)}}};var Abstract=new Object();Object.extend=function(D,E){for(var F in E){D[F]=E[F]}return D};Object.extend(Object,{inspect:function(C){try{if(C===undefined){return"undefined"}if(C===null){return"null"}return C.inspect?C.inspect():C.toString()}catch(D){if(D instanceof RangeError){return"..."}throw D}},toJSON:function(F){var I=typeof F;switch(I){case"undefined":case"function":case"unknown":return ;case"boolean":return F.toString()}if(F===null){return"null"}if(F.toJSON){return F.toJSON()}if(F.ownerDocument===document){return }var J=[];for(var G in F){var H=Object.toJSON(F[G]);if(H!==undefined){J.push(G.toJSON()+": "+H)}}return"{"+J.join(", ")+"}"},keys:function(D){var F=[];for(var E in D){F.push(E)}return F},values:function(F){var D=[];for(var E in F){D.push(F[E])}return D},clone:function(B){return Object.extend({},B)}});Function.prototype.bind=function(){var D=this,E=$A(arguments),F=E.shift();return function(){return D.apply(F,E.concat($A(arguments)))}};Function.prototype.bindAsEventListener=function(E){var D=this,F=$A(arguments),E=F.shift();return function(A){return D.apply(E,[A||window.event].concat(F))}};Object.extend(Number.prototype,{toColorPart:function(){return this.toPaddedString(2,16)},succ:function(){return this+1},times:function(B){$R(0,this,true).each(B);return this},toPaddedString:function(E,F){var D=this.toString(F||10);return"0".times(E-D.length)+D},toJSON:function(){return isFinite(this)?this.toString():"null"}});Date.prototype.toJSON=function(){return'"'+this.getFullYear()+"-"+(this.getMonth()+1).toPaddedString(2)+"-"+this.getDate().toPaddedString(2)+"T"+this.getHours().toPaddedString(2)+":"+this.getMinutes().toPaddedString(2)+":"+this.getSeconds().toPaddedString(2)+'"'};var Try={these:function(){var I;for(var J=0,H=arguments.length;J<H;J++){var F=arguments[J];try{I=F();break}catch(G){}}return I}};var PeriodicalExecuter=Class.create();PeriodicalExecuter.prototype={initialize:function(D,C){this.callback=D;this.frequency=C;this.currentlyExecuting=false;this.registerCallback()},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000)},stop:function(){if(!this.timer){return }clearInterval(this.timer);this.timer=null},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.callback(this)}finally{this.currentlyExecuting=false}}}};Object.extend(String,{interpret:function(B){return B==null?"":String(B)},specialChar:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\\":"\\\\"}});Object.extend(String.prototype,{gsub:function(G,I){var F="",H=this,J;I=arguments.callee.prepareReplacement(I);while(H.length>0){if(J=H.match(G)){F+=H.slice(0,J.index);F+=String.interpret(I(J));H=H.slice(J.index+J[0].length)}else{F+=H,H=""}}return F},sub:function(E,D,F){D=this.gsub.prepareReplacement(D);F=F===undefined?1:F;return this.gsub(E,function(A){if(--F<0){return A[0]}return D(A)})},scan:function(D,C){this.gsub(D,C);return this},truncate:function(D,C){D=D||30;C=C===undefined?"...":C;return this.length>D?this.slice(0,D-C.length)+C: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 D=new RegExp(Prototype.ScriptFragment,"img");var C=new RegExp(Prototype.ScriptFragment,"im");return(this.match(D)||[]).map(function(A){return(A.match(C)||["",""])[1]})},evalScripts:function(){return this.extractScripts().map(function(script){return eval(script)})},escapeHTML:function(){var B=arguments.callee;B.text.data=this;return B.div.innerHTML},unescapeHTML:function(){var B=document.createElement("div");B.innerHTML=this.stripTags();return B.childNodes[0]?(B.childNodes.length>1?$A(B.childNodes).inject("",function(D,A){return D+A.nodeValue}):B.childNodes[0].nodeValue):""},toQueryParams:function(D){var C=this.strip().match(/([^?#]*)(#.*)?$/);if(!C){return{}}return C[1].split(D||"&").inject({},function(B,A){if((A=A.split("="))[0]){var H=decodeURIComponent(A.shift());var G=A.length>1?A.join("="):A[0];if(G!=undefined){G=decodeURIComponent(G)}if(H in B){if(B[H].constructor!=Array){B[H]=[B[H]]}B[H].push(G)}else{B[H]=G}}return B})},toArray:function(){return this.split("")},succ:function(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)},times:function(E){var D="";for(var F=0;F<E;F++){D+=this}return D},camelize:function(){var F=this.split("-"),E=F.length;if(E==1){return F[0]}var G=this.charAt(0)=="-"?F[0].charAt(0).toUpperCase()+F[0].substring(1):F[0];for(var H=1;H<E;H++){G+=F[H].charAt(0).toUpperCase()+F[H].substring(1)}return G},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(D){var C=this.gsub(/[\x00-\x1f\\]/,function(B){var A=String.specialChar[B[0]];return A?A:"\\u00"+B[0].charCodeAt().toPaddedString(2,16)});if(D){return'"'+C.replace(/"/g,'\\"')+'"'}return"'"+C.replace(/'/g,"\\'")+"'"},toJSON:function(){return this.inspect(true)},unfilterJSON:function(B){return this.sub(B||Prototype.JSONFilter,"#{1}")},evalJSON:function(sanitize){var json=this.unfilterJSON();try{if(!sanitize||(/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.test(json))){return eval("("+json+")")}}catch(e){}throw new SyntaxError("Badly formed JSON string: "+this.inspect())},include:function(B){return this.indexOf(B)>-1},startsWith:function(B){return this.indexOf(B)===0},endsWith:function(C){var D=this.length-C.length;return D>=0&&this.lastIndexOf(C)===D},empty:function(){return this==""},blank:function(){return/^\s*$/.test(this)}});String.prototype.gsub.prepareReplacement=function(D){if(typeof D=="function"){return D}var C=new Template(D);return function(A){return C.evaluate(A)}};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();Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;Template.prototype={initialize:function(C,D){this.template=C.toString();this.pattern=D||Template.Pattern},evaluate:function(B){return this.template.gsub(this.pattern,function(D){var A=D[1];if(A=="\\"){return D[2]}return A+String.interpret(B[D[3]])})}};var $break={},$continue=new Error('"throw $continue" is deprecated, use "return" instead');var Enumerable={each:function(F){var D=0;try{this._each(function(A){F(A,D++)})}catch(E){if(E!=$break){throw E}}return this},eachSlice:function(I,J){var F=-I,H=[],G=this.toArray();while((F+=I)<G.length){H.push(G.slice(F,F+I))}return H.map(J)},all:function(D){var C=true;this.each(function(A,B){C=C&&!!(D||Prototype.K)(A,B);if(!C){throw $break}});return C},any:function(D){var C=false;this.each(function(A,B){if(C=!!(D||Prototype.K)(A,B)){throw $break}});return C},collect:function(D){var C=[];this.each(function(A,B){C.push((D||Prototype.K)(A,B))});return C},detect:function(D){var C;this.each(function(A,B){if(D(A,B)){C=A;throw $break}});return C},findAll:function(D){var C=[];this.each(function(A,B){if(D(A,B)){C.push(A)}});return C},grep:function(E,F){var D=[];this.each(function(A,B){var C=A.toString();if(C.match(E)){D.push((F||Prototype.K)(A,B))}});return D},include:function(C){var D=false;this.each(function(A){if(A==C){D=true;throw $break}});return D},inGroupsOf:function(D,C){C=C===undefined?null:C;return this.eachSlice(D,function(A){while(A.length<D){A.push(C)}return A})},inject:function(C,D){this.each(function(A,B){C=D(C,A,B)});return C},invoke:function(D){var C=$A(arguments).slice(1);return this.map(function(A){return A[D].apply(A,C)})},max:function(D){var C;this.each(function(A,B){A=(D||Prototype.K)(A,B);if(C==undefined||A>=C){C=A}});return C},min:function(D){var C;this.each(function(A,B){A=(D||Prototype.K)(A,B);if(C==undefined||A<C){C=A}});return C},partition:function(E){var F=[],D=[];this.each(function(A,B){((E||Prototype.K)(A,B)?F:D).push(A)});return[F,D]},pluck:function(D){var C=[];this.each(function(A,B){C.push(A[D])});return C},reject:function(D){var C=[];this.each(function(A,B){if(!D(A,B)){C.push(A)}});return C},sortBy:function(B){return this.map(function(A,D){return{value:A,criteria:B(A,D)}}).sort(function(A,F){var G=A.criteria,H=F.criteria;return G<H?-1:G>H?1:0}).pluck("value")},toArray:function(){return this.map()},zip:function(){var F=Prototype.K,D=$A(arguments);if(typeof D.last()=="function"){F=D.pop()}var E=[this].concat(D).map($A);return this.map(function(A,B){return F(E.pluck(B))})},size:function(){return this.toArray().length},inspect:function(){return"#<Enumerable:"+this.toArray().inspect()+">"}};Object.extend(Enumerable,{map:Enumerable.collect,find:Enumerable.detect,select:Enumerable.findAll,member:Enumerable.include,entries:Enumerable.toArray});var $A=Array.from=function(F){if(!F){return[]}if(F.toArray){return F.toArray()}else{var H=[];for(var E=0,G=F.length;E<G;E++){H.push(F[E])}return H}};if(Prototype.Browser.WebKit){$A=Array.from=function(F){if(!F){return[]}if(!(typeof F=="function"&&F=="[object NodeList]")&&F.toArray){return F.toArray()}else{var H=[];for(var E=0,G=F.length;E<G;E++){H.push(F[E])}return H}}}Object.extend(Array.prototype,Enumerable);if(!Array.prototype._reverse){Array.prototype._reverse=Array.prototype.reverse}Object.extend(Array.prototype,{_each:function(F){for(var D=0,E=this.length;D<E;D++){F(this[D])}},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(B){return B!=null})},flatten:function(){return this.inject([],function(D,C){return D.concat(C&&C.constructor==Array?C.flatten():[C])})},without:function(){var B=$A(arguments);return this.select(function(A){return !B.include(A)})},indexOf:function(D){for(var F=0,E=this.length;F<E;F++){if(this[F]==D){return F}}return -1},reverse:function(B){return(B!==false?this:this.toArray())._reverse()},reduce:function(){return this.length>1?this:this[0]},uniq:function(B){return this.inject([],function(A,E,F){if(0==F||(B?A.last()!=E:!A.include(E))){A.push(E)}return A})},clone:function(){return[].concat(this)},size:function(){return this.length},inspect:function(){return"["+this.map(Object.inspect).join(", ")+"]"},toJSON:function(){var B=[];this.each(function(D){var A=Object.toJSON(D);if(A!==undefined){B.push(A)}});return"["+B.join(", ")+"]"}});Array.prototype.toArray=Array.prototype.clone;function $w(B){B=B.strip();return B?B.split(/\s+/):[]}if(Prototype.Browser.Opera){Array.prototype.concat=function(){var G=[];for(var J=0,I=this.length;J<I;J++){G.push(this[J])}for(var J=0,I=arguments.length;J<I;J++){if(arguments[J].constructor==Array){for(var F=0,H=arguments[J].length;F<H;F++){G.push(arguments[J][F])}}else{G.push(arguments[J])}}return G}}var Hash=function(B){if(B instanceof Hash){this.merge(B)}else{Object.extend(this,B||{})}};Object.extend(Hash,{toQueryString:function(D){var C=[];C.add=arguments.callee.addPair;this.prototype._each.call(D,function(A){if(!A.key){return }var B=A.value;if(B&&typeof B=="object"){if(B.constructor==Array){B.each(function(F){C.add(A.key,F)})}return }C.add(A.key,B)});return C.join("&")},toJSON:function(C){var D=[];this.prototype._each.call(C,function(A){var B=Object.toJSON(A.value);if(B!==undefined){D.push(A.key.toJSON()+": "+B)}});return"{"+D.join(", ")+"}"}});Hash.toQueryString.addPair=function(D,E,F){D=encodeURIComponent(D);if(E===undefined){this.push(D)}else{this.push(D+"="+(E==null?"":encodeURIComponent(E)))}};Object.extend(Hash.prototype,Enumerable);Object.extend(Hash.prototype,{_each:function(H){for(var E in this){var G=this[E];if(G&&G==Hash.prototype[E]){continue}var F=[E,G];F.key=E;F.value=G;H(F)}},keys:function(){return this.pluck("key")},values:function(){return this.pluck("value")},merge:function(B){return $H(B).inject(this,function(D,A){D[A.key]=A.value;return D})},remove:function(){var E;for(var H=0,G=arguments.length;H<G;H++){var F=this[arguments[H]];if(F!==undefined){if(E===undefined){E=F}else{if(E.constructor!=Array){E=[E]}E.push(F)}}delete this[arguments[H]]}return E},toQueryString:function(){return Hash.toQueryString(this)},inspect:function(){return"#<Hash:{"+this.map(function(B){return B.map(Object.inspect).join(": ")}).join(", ")+"}>"},toJSON:function(){return Hash.toJSON(this)}});function $H(B){if(B instanceof Hash){return B}return new Hash(B)}if(function(){var D=0,E=function(A){this.key=A};E.prototype.key="foo";for(var F in new E("bar")){D++}return D>1}()){Hash.prototype._each=function(I){var F=[];for(var J in this){var H=this[J];if((H&&H==Hash.prototype[J])||F.include(J)){continue}F.push(J);var G=[J,H];G.key=J;G.value=H;I(G)}}}ObjectRange=Class.create();Object.extend(ObjectRange.prototype,Enumerable);Object.extend(ObjectRange.prototype,{initialize:function(E,D,F){this.start=E;this.end=D;this.exclusive=F},_each:function(C){var D=this.start;while(this.include(D)){C(D);D=D.succ()}},include:function(B){if(B<this.start){return false}if(this.exclusive){return B<this.end}return B<=this.end}});var $R=function(E,D,F){return new ObjectRange(E,D,F)};var Ajax={getTransport:function(){return Try.these(function(){return new XMLHttpRequest()},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")})||false},activeRequestCount:0};Ajax.Responders={responders:[],_each:function(B){this.responders._each(B)},register:function(B){if(!this.include(B)){this.responders.push(B)}},unregister:function(B){this.responders=this.responders.without(B)},dispatch:function(F,H,G,E){this.each(function(B){if(typeof B[F]=="function"){try{B[F].apply(B,[H,G,E])}catch(A){}}})}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++},onComplete:function(){Ajax.activeRequestCount--}});Ajax.Base=function(){};Ajax.Base.prototype={setOptions:function(B){this.options={method:"post",asynchronous:true,contentType:"application/x-www-form-urlencoded",encoding:"UTF-8",parameters:""};Object.extend(this.options,B||{});this.options.method=this.options.method.toLowerCase();if(typeof this.options.parameters=="string"){this.options.parameters=this.options.parameters.toQueryParams()}}};Ajax.Request=Class.create();Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];Ajax.Request.prototype=Object.extend(new Ajax.Base(),{_complete:false,initialize:function(D,C){this.transport=Ajax.getTransport();this.setOptions(C);this.request(D)},request:function(D){this.url=D;this.method=this.options.method;var E=Object.clone(this.options.parameters);if(!["get","post"].include(this.method)){E._method=this.method;this.method="post"}this.parameters=E;if(E=Hash.toQueryString(E)){if(this.method=="get"){this.url+=(this.url.include("?")?"&":"?")+E}else{if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){E+="&_="}}}try{if(this.options.onCreate){this.options.onCreate(this.transport)}Ajax.Responders.dispatch("onCreate",this,this.transport);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);if(this.options.asynchronous){setTimeout(function(){this.respondToReadyState(1)}.bind(this),10)}this.transport.onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();this.body=this.method=="post"?(this.options.postBody||E):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType){this.onStateChange()}}catch(F){this.dispatchException(F)}},onStateChange:function(){var B=this.transport.readyState;if(B>1&&!((B==4)&&this._complete)){this.respondToReadyState(this.transport.readyState)}},setRequestHeaders:function(){var G={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,Accept:"text/javascript, text/html, application/xml, text/xml, */*"};if(this.method=="post"){G["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){G.Connection="close"}}if(typeof this.options.requestHeaders=="object"){var I=this.options.requestHeaders;if(typeof I.push=="function"){for(var J=0,H=I.length;J<H;J+=2){G[I[J]]=I[J+1]}}else{$H(I).each(function(A){G[A.key]=A.value})}}for(var F in G){this.transport.setRequestHeader(F,G[F])}},success:function(){return !this.transport.status||(this.transport.status>=200&&this.transport.status<300)},respondToReadyState:function(G){var K=Ajax.Request.Events[G];var H=this.transport,L=this.evalJSON();if(K=="Complete"){try{this._complete=true;(this.options["on"+this.transport.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(H,L)}catch(J){this.dispatchException(J)}var I=this.getHeader("Content-type");if(I&&I.strip().match(/^(text|application)\/(x-)?(java|ecma)script(;.*)?$/i)){this.evalResponse()}}try{(this.options["on"+K]||Prototype.emptyFunction)(H,L);Ajax.Responders.dispatch("on"+K,this,H,L)}catch(J){this.dispatchException(J)}if(K=="Complete"){this.transport.onreadystatechange=Prototype.emptyFunction}},getHeader:function(C){try{return this.transport.getResponseHeader(C)}catch(D){return null}},evalJSON:function(){try{var C=this.getHeader("X-JSON");return C?C.evalJSON():null}catch(D){return null}},evalResponse:function(){try{return eval((this.transport.responseText||"").unfilterJSON())}catch(e){this.dispatchException(e)}},dispatchException:function(B){(this.options.onException||Prototype.emptyFunction)(this,B);Ajax.Responders.dispatch("onException",this,B)}});Ajax.Updater=Class.create();Object.extend(Object.extend(Ajax.Updater.prototype,Ajax.Request.prototype),{initialize:function(E,G,H){this.container={success:(E.success||E),failure:(E.failure||(E.success?null:E))};this.transport=Ajax.getTransport();this.setOptions(H);var F=this.options.onComplete||Prototype.emptyFunction;this.options.onComplete=(function(A,B){this.updateContent();F(A,B)}).bind(this);this.request(G)},updateContent:function(){var D=this.container[this.success()?"success":"failure"];var C=this.transport.responseText;if(!this.options.evalScripts){C=C.stripScripts()}if(D=$(D)){if(this.options.insertion){new this.options.insertion(D,C)}else{D.update(C)}}if(this.success()){if(this.onComplete){setTimeout(this.onComplete.bind(this),10)}}}});Ajax.PeriodicalUpdater=Class.create();Ajax.PeriodicalUpdater.prototype=Object.extend(new Ajax.Base(),{initialize:function(D,E,F){this.setOptions(F);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=D;this.url=E;this.start()},start:function(){this.options.onComplete=this.updateComplete.bind(this);this.onTimerEvent()},stop:function(){this.updater.options.onComplete=undefined;clearTimeout(this.timer);(this.onComplete||Prototype.emptyFunction).apply(this,arguments)},updateComplete:function(B){if(this.options.decay){this.decay=(B.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=B.responseText}this.timer=setTimeout(this.onTimerEvent.bind(this),this.decay*this.frequency*1000)},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options)}});function $(H){if(arguments.length>1){for(var E=0,F=[],G=arguments.length;E<G;E++){F.push($(arguments[E]))}return F}if(typeof H=="string"){H=document.getElementById(H)}return Element.extend(H)}if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(H,G){var K=[];var I=document.evaluate(H,$(G)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var L=0,J=I.snapshotLength;L<J;L++){K.push(I.snapshotItem(L))}return K};document.getElementsByClassName=function(F,D){var E=".//*[contains(concat(' ', @class, ' '), ' "+F+" ')]";return document._getElementsByXPath(E,D)}}else{document.getElementsByClassName=function(L,H){var M=($(H)||document.body).getElementsByTagName("*");var J=[],I;for(var N=0,K=M.length;N<K;N++){I=M[N];if(Element.hasClassName(I,L)){J.push(Element.extend(I))}}return J}}if(!window.Element){var Element={}}Element.extend=function(M){var L=Prototype.BrowserFeatures;if(!M||!M.tagName||M.nodeType==3||M._extended||L.SpecificElementExtensions||M==window){return M}var P={},N=M.tagName,F=Element.extend.cache,O=Element.Methods.ByTag;if(!L.ElementExtensions){Object.extend(P,Element.Methods),Object.extend(P,Element.Methods.Simulated)}if(O[N]){Object.extend(P,O[N])}for(var J in P){var K=P[J];if(typeof K=="function"&&!(J in M)){M[J]=F.findOrStore(K)}}M._extended=Prototype.emptyFunction;return M};Element.extend.cache={findOrStore:function(B){return this[B]=this[B]||function(){return B.apply(null,[this].concat($A(arguments)))}}};Element.Methods={visible:function(B){return $(B).style.display!="none"},toggle:function(B){B=$(B);Element[Element.visible(B)?"hide":"show"](B);return B},hide:function(B){$(B).style.display="none";return B},show:function(B){$(B).style.display="";return B},remove:function(B){B=$(B);B.parentNode.removeChild(B);return B},update:function(D,C){C=typeof C=="undefined"?"":C.toString();$(D).innerHTML=C.stripScripts();setTimeout(function(){C.evalScripts()},10);return D},replace:function(E,F){E=$(E);F=typeof F=="undefined"?"":F.toString();if(E.outerHTML){E.outerHTML=F.stripScripts()}else{var D=E.ownerDocument.createRange();D.selectNodeContents(E);E.parentNode.replaceChild(D.createContextualFragment(F.stripScripts()),E)}setTimeout(function(){F.evalScripts()},10);return E},inspect:function(D){D=$(D);var C="<"+D.tagName.toLowerCase();$H({id:"id",className:"class"}).each(function(A){var B=A.first(),H=A.last();var G=(D[B]||"").toString();if(G){C+=" "+H+"="+G.inspect(true)}});return C+">"},recursivelyCollect:function(D,E){D=$(D);var F=[];while(D=D[E]){if(D.nodeType==1){F.push(Element.extend(D))}}return F},ancestors:function(B){return $(B).recursivelyCollect("parentNode")},descendants:function(B){return $A($(B).getElementsByTagName("*")).each(Element.extend)},firstDescendant:function(B){B=$(B).firstChild;while(B&&B.nodeType!=1){B=B.nextSibling}return $(B)},immediateDescendants:function(B){if(!(B=$(B).firstChild)){return[]}while(B&&B.nodeType!=1){B=B.nextSibling}if(B){return[B].concat($(B).nextSiblings())}return[]},previousSiblings:function(B){return $(B).recursivelyCollect("previousSibling")},nextSiblings:function(B){return $(B).recursivelyCollect("nextSibling")},siblings:function(B){B=$(B);return B.previousSiblings().reverse().concat(B.nextSiblings())},match:function(D,C){if(typeof C=="string"){C=new Selector(C)}return C.match($(D))},up:function(H,F,E){H=$(H);if(arguments.length==1){return $(H.parentNode)}var G=H.ancestors();return F?Selector.findElement(G,F,E):G[E||0]},down:function(H,G,E){H=$(H);if(arguments.length==1){return H.firstDescendant()}var F=H.descendants();return G?Selector.findElement(F,G,E):F[E||0]},previous:function(H,F,E){H=$(H);if(arguments.length==1){return $(Selector.handlers.previousElementSibling(H))}var G=H.previousSiblings();return F?Selector.findElement(G,F,E):G[E||0]},next:function(G,F,H){G=$(G);if(arguments.length==1){return $(Selector.handlers.nextElementSibling(G))}var E=G.nextSiblings();return F?Selector.findElement(E,F,H):E[H||0]},getElementsBySelector:function(){var C=$A(arguments),D=$(C.shift());return Selector.findChildElements(D,C)},getElementsByClassName:function(C,D){return document.getElementsByClassName(D,C)},readAttribute:function(G,E){G=$(G);if(Prototype.Browser.IE){if(!G.attributes){return null}var H=Element._attributeTranslations;if(H.values[E]){return H.values[E](G,E)}if(H.names[E]){E=H.names[E]}var F=G.attributes[E];return F?F.nodeValue:null}return G.getAttribute(E)},getHeight:function(B){return $(B).getDimensions().height},getWidth:function(B){return $(B).getDimensions().width},classNames:function(B){return new Element.ClassNames(B)},hasClassName:function(D,F){if(!(D=$(D))){return }var E=D.className;if(E.length==0){return false}if(E==F||E.match(new RegExp("(^|\\s)"+F+"(\\s|$)"))){return true}return false},addClassName:function(C,D){if(!(C=$(C))){return }Element.classNames(C).add(D);return C},removeClassName:function(C,D){if(!(C=$(C))){return }Element.classNames(C).remove(D);return C},toggleClassName:function(C,D){if(!(C=$(C))){return }Element.classNames(C)[C.hasClassName(D)?"remove":"add"](D);return C},observe:function(){Event.observe.apply(Event,arguments);return $A(arguments).first()},stopObserving:function(){Event.stopObserving.apply(Event,arguments);return $A(arguments).first()},cleanWhitespace:function(F){F=$(F);var E=F.firstChild;while(E){var D=E.nextSibling;if(E.nodeType==3&&!/\S/.test(E.nodeValue)){F.removeChild(E)}E=D}return F},empty:function(B){return $(B).innerHTML.blank()},descendantOf:function(D,C){D=$(D),C=$(C);while(D=D.parentNode){if(D==C){return true}}return false},scrollTo:function(C){C=$(C);var D=Position.cumulativeOffset(C);window.scrollTo(D[0],D[1]);return C},getStyle:function(H,G){H=$(H);G=G=="float"?"cssFloat":G.camelize();var F=H.style[G];if(!F){var E=document.defaultView.getComputedStyle(H,null);F=E?E[G]:null}if(G=="opacity"){return F?parseFloat(F):1}return F=="auto"?null:F},getOpacity:function(B){return $(B).getStyle("opacity")},setStyle:function(F,I,J){F=$(F);var G=F.style;for(var H in I){if(H=="opacity"){F.setOpacity(I[H])}else{G[(H=="float"||H=="cssFloat")?(G.styleFloat===undefined?"cssFloat":"styleFloat"):(J?H:H.camelize())]=I[H]}}return F},setOpacity:function(C,D){C=$(C);C.style.opacity=(D==1||D==="")?"":(D<0.00001)?0:D;return C},getDimensions:function(O){O=$(O);var K=$(O).getStyle("display");if(K!="none"&&K!=null){return{width:O.offsetWidth,height:O.offsetHeight}}var P=O.style;var L=P.visibility;var N=P.position;var I=P.display;P.visibility="hidden";P.position="absolute";P.display="block";var J=O.clientWidth;var M=O.clientHeight;P.display=I;P.position=N;P.visibility=L;return{width:J,height:M}},makePositioned:function(C){C=$(C);var D=Element.getStyle(C,"position");if(D=="static"||!D){C._madePositioned=true;C.style.position="relative";if(window.opera){C.style.top=0;C.style.left=0}}return C},undoPositioned:function(B){B=$(B);if(B._madePositioned){B._madePositioned=undefined;B.style.position=B.style.top=B.style.left=B.style.bottom=B.style.right=""}return B},makeClipping:function(B){B=$(B);if(B._overflow){return B}B._overflow=B.style.overflow||"auto";if((Element.getStyle(B,"overflow")||"visible")!="hidden"){B.style.overflow="hidden"}return B},undoClipping:function(B){B=$(B);if(!B._overflow){return B}B.style.overflow=B._overflow=="auto"?"":B._overflow;B._overflow=null;return B}};Object.extend(Element.Methods,{childOf:Element.Methods.descendantOf,childElements:Element.Methods.immediateDescendants});if(Prototype.Browser.Opera){Element.Methods._getStyle=Element.Methods.getStyle;Element.Methods.getStyle=function(C,D){switch(D){case"left":case"top":case"right":case"bottom":if(Element._getStyle(C,"position")=="static"){return null}default:return Element._getStyle(C,D)}}}else{if(Prototype.Browser.IE){Element.Methods.getStyle=function(D,F){D=$(D);F=(F=="float"||F=="cssFloat")?"styleFloat":F.camelize();var E=D.style[F];if(!E&&D.currentStyle){E=D.currentStyle[F]}if(F=="opacity"){if(E=(D.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/)){if(E[1]){return parseFloat(E[1])/100}}return 1}if(E=="auto"){if((F=="width"||F=="height")&&(D.getStyle("display")!="none")){return D["offset"+F.capitalize()]+"px"}return null}return E};Element.Methods.setOpacity=function(E,F){E=$(E);var G=E.getStyle("filter"),H=E.style;if(F==1||F===""){H.filter=G.replace(/alpha\([^\)]*\)/gi,"");return E}else{if(F<0.00001){F=0}}H.filter=G.replace(/alpha\([^\)]*\)/gi,"")+"alpha(opacity="+(F*100)+")";return E};Element.Methods.update=function(G,H){G=$(G);H=typeof H=="undefined"?"":H.toString();var E=G.tagName.toUpperCase();if(["THEAD","TBODY","TR","TD"].include(E)){var F=document.createElement("div");switch(E){case"THEAD":case"TBODY":F.innerHTML="<table><tbody>"+H.stripScripts()+"</tbody></table>";depth=2;break;case"TR":F.innerHTML="<table><tbody><tr>"+H.stripScripts()+"</tr></tbody></table>";depth=3;break;case"TD":F.innerHTML="<table><tbody><tr><td>"+H.stripScripts()+"</td></tr></tbody></table>";depth=4}$A(G.childNodes).each(function(A){G.removeChild(A)});depth.times(function(){F=F.firstChild});$A(F.childNodes).each(function(A){G.appendChild(A)})}else{G.innerHTML=H.stripScripts()}setTimeout(function(){H.evalScripts()},10);return G}}else{if(Prototype.Browser.Gecko){Element.Methods.setOpacity=function(C,D){C=$(C);C.style.opacity=(D==1)?0.999999:(D==="")?"":(D<0.00001)?0:D;return C}}}}Element._attributeTranslations={names:{colspan:"colSpan",rowspan:"rowSpan",valign:"vAlign",datetime:"dateTime",accesskey:"accessKey",tabindex:"tabIndex",enctype:"encType",maxlength:"maxLength",readonly:"readOnly",longdesc:"longDesc"},values:{_getAttr:function(C,D){return C.getAttribute(D,2)},_flag:function(C,D){return $(C).hasAttribute(D)?D:null},style:function(B){return B.style.cssText.toLowerCase()},title:function(C){var D=C.getAttributeNode("title");return D.specified?D.nodeValue:null}}};(function(){Object.extend(this,{href:this._getAttr,src:this._getAttr,type:this._getAttr,disabled:this._flag,checked:this._flag,readonly:this._flag,multiple:this._flag})}).call(Element._attributeTranslations.values);Element.Methods.Simulated={hasAttribute:function(H,F){var E=Element._attributeTranslations,G;F=E.names[F]||F;G=$(H).getAttributeNode(F);return G&&G.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.hasAttribute=function(C,D){if(C.hasAttribute){return C.hasAttribute(D)}return Element.Methods.Simulated.hasAttribute(C,D)};Element.addMethods=function(K){var O=Prototype.BrowserFeatures,F=Element.Methods.ByTag;if(!K){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 L=K;K=arguments[1]}if(!L){Object.extend(Element.Methods,K||{})}else{if(L.constructor==Array){L.each(P)}else{P(L)}}function P(A){A=A.toUpperCase();if(!Element.Methods.ByTag[A]){Element.Methods.ByTag[A]={}}Object.extend(Element.Methods.ByTag[A],K)}function M(G,B,C){C=C||false;var A=Element.extend.cache;for(var D in G){var E=G[D];if(!C||!(D in B)){B[D]=A.findOrStore(E)}}}function R(A){var C;var B={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(B[A]){C="HTML"+B[A]+"Element"}if(window[C]){return window[C]}C="HTML"+A+"Element";if(window[C]){return window[C]}C="HTML"+A.capitalize()+"Element";if(window[C]){return window[C]}window[C]={};window[C].prototype=document.createElement(A).__proto__;return window[C]}if(O.ElementExtensions){M(Element.Methods,HTMLElement.prototype);M(Element.Methods.Simulated,HTMLElement.prototype,true)}if(O.SpecificElementExtensions){for(var N in Element.Methods.ByTag){var Q=R(N);if(typeof Q=="undefined"){continue}M(F[N],Q.prototype)}}Object.extend(Element,Element.Methods);delete Element.ByTag};var Toggle={display:Element.toggle};Abstract.Insertion=function(B){this.adjacency=B};Abstract.Insertion.prototype={initialize:function(H,G){this.element=$(H);this.content=G.stripScripts();if(this.adjacency&&this.element.insertAdjacentHTML){try{this.element.insertAdjacentHTML(this.adjacency,this.content)}catch(F){var E=this.element.tagName.toUpperCase();if(["TBODY","TR"].include(E)){this.insertContent(this.contentFromAnonymousTable())}else{throw F}}}else{this.range=this.element.ownerDocument.createRange();if(this.initializeRange){this.initializeRange()}this.insertContent([this.range.createContextualFragment(this.content)])}setTimeout(function(){G.evalScripts()},10)},contentFromAnonymousTable:function(){var B=document.createElement("div");B.innerHTML="<table><tbody>"+this.content+"</tbody></table>";return $A(B.childNodes[0].childNodes[0].childNodes)}};var Insertion=new Object();Insertion.Before=Class.create();Insertion.Before.prototype=Object.extend(new Abstract.Insertion("beforeBegin"),{initializeRange:function(){this.range.setStartBefore(this.element)},insertContent:function(B){B.each((function(A){this.element.parentNode.insertBefore(A,this.element)}).bind(this))}});Insertion.Top=Class.create();Insertion.Top.prototype=Object.extend(new Abstract.Insertion("afterBegin"),{initializeRange:function(){this.range.selectNodeContents(this.element);this.range.collapse(true)},insertContent:function(B){B.reverse(false).each((function(A){this.element.insertBefore(A,this.element.firstChild)}).bind(this))}});Insertion.Bottom=Class.create();Insertion.Bottom.prototype=Object.extend(new Abstract.Insertion("beforeEnd"),{initializeRange:function(){this.range.selectNodeContents(this.element);this.range.collapse(this.element)},insertContent:function(B){B.each((function(A){this.element.appendChild(A)}).bind(this))}});Insertion.After=Class.create();Insertion.After.prototype=Object.extend(new Abstract.Insertion("afterEnd"),{initializeRange:function(){this.range.setStartAfter(this.element)},insertContent:function(B){B.each((function(A){this.element.parentNode.insertBefore(A,this.element.nextSibling)}).bind(this))}});Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(B){this.element=$(B)},_each:function(B){this.element.className.split(/\s+/).select(function(A){return A.length>0})._each(B)},set:function(B){this.element.className=B},add:function(B){if(this.include(B)){return }this.set($A(this).concat(B).join(" "))},remove:function(B){if(!this.include(B)){return }this.set($A(this).without(B).join(" "))},toString:function(){return $A(this).join(" ")}};Object.extend(Element.ClassNames.prototype,Enumerable);var Selector=Class.create();Selector.prototype={initialize:function(B){this.expression=B.strip();this.compileMatcher()},compileMatcher:function(){if(Prototype.BrowserFeatures.XPath&&!(/\[[\w-]*?:/).test(this.expression)){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(typeof c[i]=="function"?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 I=this.expression,H=Selector.patterns,L=Selector.xpath,J,G;if(Selector._cache[I]){this.xpath=Selector._cache[I];return }this.matcher=[".//*"];while(I&&J!=I&&(/\S/).test(I)){J=I;for(var K in H){if(G=I.match(H[K])){this.matcher.push(typeof L[K]=="function"?L[K](G):new Template(L[K]).evaluate(G));I=I.replace(G[0],"");break}}}this.xpath=this.matcher.join("");Selector._cache[this.expression]=this.xpath},findElements:function(B){B=B||document;if(this.xpath){return document._getElementsByXPath(this.xpath,B)}return this.matcher(B)},match:function(B){return this.findElements(document).include(B)},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(B){if(B[1]=="*"){return""}return"[local-name()='"+B[1].toLowerCase()+"' or local-name()='"+B[1].toUpperCase()+"']"},className:"[contains(concat(' ', @class, ' '), ' #{1} ')]",id:"[@id='#{1}']",attrPresence:"[@#{1}]",attr:function(B){B[3]=B[5]||B[6];return new Template(Selector.xpath.operators[B[2]]).evaluate(B)},pseudo:function(C){var D=Selector.xpath.pseudos[C[1]];if(!D){return""}if(typeof D==="function"){return D(C)}return new Template(Selector.xpath.pseudos[C[1]]).evaluate(C)},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(P){var J=P[6],K=Selector.patterns,I=Selector.xpath,M,P,O;var L=[];while(J&&M!=J&&(/\S/).test(J)){M=J;for(var N in K){if(P=J.match(K[N])){O=typeof I[N]=="function"?I[N](P):new Template(I[N]).evaluate(P);L.push("("+O.substring(1,O.length-1)+")");J=J.replace(P[0],"");break}}}return"[not("+L.join(" and ")+")]"},"nth-child":function(B){return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ",B)},"nth-last-child":function(B){return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ",B)},"nth-of-type":function(B){return Selector.xpath.pseudos.nth("position() ",B)},"nth-last-of-type":function(B){return Selector.xpath.pseudos.nth("(last() + 1 - position()) ",B)},"first-of-type":function(B){B[6]="1";return Selector.xpath.pseudos["nth-of-type"](B)},"last-of-type":function(B){B[6]="1";return Selector.xpath.pseudos["nth-last-of-type"](B)},"only-of-type":function(C){var D=Selector.xpath.pseudos;return D["first-of-type"](C)+D["last-of-type"](C)},nth:function(K,M){var J,I=M[6],N;if(I=="even"){I="2n+0"}if(I=="odd"){I="2n+1"}if(J=I.match(/^(\d+)$/)){return"["+K+"= "+J[1]+"]"}if(J=I.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(J[1]=="-"){J[1]=-1}var L=J[1]?Number(J[1]):1;var H=J[2]?Number(J[2]):0;N="[((#{fragment} - #{b}) mod #{a} = 0) and ((#{fragment} - #{b}) div #{a} >= 0)]";return new Template(N).evaluate({fragment:K,a:L,b:H})}}}},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 = false;',attr:function(B){B[3]=(B[5]||B[6]);return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}"); c = false;').evaluate(B)},pseudo:function(B){if(B[6]){B[6]=B[6].replace(/"/g,'\\"')}return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(B)},descendant:'c = "descendant";',child:'c = "child";',adjacent:'c = "adjacent";',laterSibling:'c = "laterSibling";'},patterns:{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|([^'"][^\]]*?)))?\]/},handlers:{concat:function(H,E){for(var G=0,F;F=E[G];G++){H.push(F)}return H},mark:function(D){for(var F=0,E;E=D[F];F++){E._counted=true}return D},unmark:function(D){for(var F=0,E;E=D[F];F++){E._counted=undefined}return D},index:function(G,J,H){G._counted=true;if(J){for(var L=G.childNodes,I=L.length-1,K=1;I>=0;I--){node=L[I];if(node.nodeType==1&&(!H||node._counted)){node.nodeIndex=K++}}}else{for(var I=0,K=1,L=G.childNodes;node=L[I];I++){if(node.nodeType==1&&(!H||node._counted)){node.nodeIndex=K++}}}},unique:function(J){if(J.length==0){return J}var H=[],G;for(var I=0,F=J.length;I<F;I++){if(!(G=J[I])._counted){G._counted=true;H.push(Element.extend(G))}}return Selector.handlers.unmark(H)},descendant:function(F){var H=Selector.handlers;for(var I=0,J=[],G;G=F[I];I++){H.concat(J,G.getElementsByTagName("*"))}return J},child:function(I){var L=Selector.handlers;for(var M=0,N=[],K;K=I[M];M++){for(var P=0,O=[],J;J=K.childNodes[P];P++){if(J.nodeType==1&&J.tagName!="!"){N.push(J)}}}return N},adjacent:function(F){for(var I=0,J=[],G;G=F[I];I++){var H=this.nextElementSibling(G);if(H){J.push(H)}}return J},laterSibling:function(F){var H=Selector.handlers;for(var I=0,J=[],G;G=F[I];I++){H.concat(J,Element.nextSiblings(G))}return J},nextElementSibling:function(B){while(B=B.nextSibling){if(B.nodeType==1){return B}}return null},previousElementSibling:function(B){while(B=B.previousSibling){if(B.nodeType==1){return B}}return null},tagName:function(P,I,M,J){M=M.toUpperCase();var N=[],L=Selector.handlers;if(P){if(J){if(J=="descendant"){for(var O=0,K;K=P[O];O++){L.concat(N,K.getElementsByTagName(M))}return N}else{P=this[J](P)}if(M=="*"){return P}}for(var O=0,K;K=P[O];O++){if(K.tagName.toUpperCase()==M){N.push(K)}}return N}else{return I.getElementsByTagName(M)}},id:function(P,I,J,L){var K=$(J),N=Selector.handlers;if(!P&&I==document){return K?[K]:[]}if(P){if(L){if(L=="child"){for(var O=0,M;M=P[O];O++){if(K.parentNode==M){return[K]}}}else{if(L=="descendant"){for(var O=0,M;M=P[O];O++){if(Element.descendantOf(K,M)){return[K]}}}else{if(L=="adjacent"){for(var O=0,M;M=P[O];O++){if(Selector.handlers.previousElementSibling(K)==M){return[K]}}}else{P=N[L](P)}}}}for(var O=0,M;M=P[O];O++){if(M==K){return[K]}}return[]}return(K&&Element.descendantOf(K,I))?[K]:[]},className:function(H,E,G,F){if(H&&F){H=this[F](H)}return Selector.handlers.byClassName(H,E,G)},byClassName:function(O,P,L){if(!O){O=Selector.handlers.descendant([P])}var J=" "+L+" ";for(var M=0,N=[],K,I;K=O[M];M++){I=K.className;if(I.length==0){continue}if(I==L||(" "+I+" ").include(J)){N.push(K)}}return N},attrPresence:function(K,L,G){var I=[];for(var J=0,H;H=K[J];J++){if(Element.hasAttribute(H,G)){I.push(H)}}return I},attr:function(N,Q,R,P,M){if(!N){N=Q.getElementsByTagName("*")}var O=Selector.operators[M],K=[];for(var T=0,L;L=N[T];T++){var S=Element.readAttribute(L,R);if(S===null){continue}if(O(S,P)){K.push(L)}}return K},pseudo:function(J,I,G,F,H){if(J&&H){J=this[H](J)}if(!J){J=F.getElementsByTagName("*")}return Selector.pseudos[I](J,G,F)}},pseudos:{"first-child":function(L,H,G){for(var J=0,K=[],I;I=L[J];J++){if(Selector.handlers.previousElementSibling(I)){continue}K.push(I)}return K},"last-child":function(L,H,G){for(var J=0,K=[],I;I=L[J];J++){if(Selector.handlers.nextElementSibling(I)){continue}K.push(I)}return K},"only-child":function(N,I,H){var K=Selector.handlers;for(var L=0,M=[],J;J=N[L];L++){if(!K.previousElementSibling(J)&&!K.nextElementSibling(J)){M.push(J)}}return M},"nth-child":function(F,E,D){return Selector.pseudos.nth(F,E,D)},"nth-last-child":function(F,E,D){return Selector.pseudos.nth(F,E,D,true)},"nth-of-type":function(F,E,D){return Selector.pseudos.nth(F,E,D,false,true)},"nth-last-of-type":function(F,E,D){return Selector.pseudos.nth(F,E,D,true,true)},"first-of-type":function(F,E,D){return Selector.pseudos.nth(F,"1",D,false,true)},"last-of-type":function(F,E,D){return Selector.pseudos.nth(F,"1",D,true,true)},"only-of-type":function(H,F,E){var G=Selector.pseudos;return G["last-of-type"](G["first-of-type"](H,F,E),F,E)},getIndices:function(F,D,E){if(F==0){return D>0?[D]:[]}return $R(1,E).inject([],function(B,A){if(0==(A-D)%F&&(A-D)/F>=0){B.push(A)}return B})},nth:function(T,Y,W,Z,R){if(T.length==0){return[]}if(Y=="even"){Y="2n+0"}if(Y=="odd"){Y="2n+1"}var a=Selector.handlers,b=[],S=[],j;a.mark(T);for(var e=0,Q;Q=T[e];e++){if(!Q.parentNode._counted){a.index(Q.parentNode,Z,R);S.push(Q.parentNode)}}if(Y.match(/^\d+$/)){Y=Number(Y);for(var e=0,Q;Q=T[e];e++){if(Q.nodeIndex==Y){b.push(Q)}}}else{if(j=Y.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(j[1]=="-"){j[1]=-1}var V=j[1]?Number(j[1]):1;var X=j[2]?Number(j[2]):0;var U=Selector.pseudos.getIndices(V,X,T.length);for(var e=0,Q,h=U.length;Q=T[e];e++){for(var g=0;g<h;g++){if(Q.nodeIndex==U[g]){b.push(Q)}}}}}a.unmark(T);a.unmark(S);return b},empty:function(L,H,G){for(var J=0,K=[],I;I=L[J];J++){if(I.tagName=="!"||(I.firstChild&&!I.innerHTML.match(/^\s*$/))){continue}K.push(I)}return K},not:function(N,K,P){var R=Selector.handlers,O,L;var Q=new Selector(K).findElements(P);R.mark(Q);for(var S=0,T=[],M;M=N[S];S++){if(!M._counted){T.push(M)}}R.unmark(Q);return T},enabled:function(L,H,G){for(var J=0,K=[],I;I=L[J];J++){if(!I.disabled){K.push(I)}}return K},disabled:function(L,H,G){for(var J=0,K=[],I;I=L[J];J++){if(I.disabled){K.push(I)}}return K},checked:function(L,H,G){for(var J=0,K=[],I;I=L[J];J++){if(I.checked){K.push(I)}}return K}},operators:{"=":function(D,C){return D==C},"!=":function(D,C){return D!=C},"^=":function(D,C){return D.startsWith(C)},"$=":function(D,C){return D.endsWith(C)},"*=":function(D,C){return D.include(C)},"~=":function(D,C){return(" "+D+" ").include(" "+C+" ")},"|=":function(D,C){return("-"+D.toUpperCase()+"-").include("-"+C.toUpperCase()+"-")}},matchElements:function(J,I){var K=new Selector(I).findElements(),L=Selector.handlers;L.mark(K);for(var M=0,N=[],H;H=J[M];M++){if(H._counted){N.push(H)}}L.unmark(K);return N},findElement:function(F,E,D){if(typeof E=="number"){D=E;E=false}return Selector.matchElements(F,E||"*")[D||0]},findChildElements:function(M,K){var J=K.join(","),K=[];J.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(A){K.push(A[1].strip())});var N=[],L=Selector.handlers;for(var O=0,P=K.length,I;O<P;O++){I=new Selector(K[O].strip());L.concat(N,I.findElements(M))}return(P>1)?L.unique(N):N}});function $$(){return Selector.findChildElements(document,$A(arguments))}var Form={reset:function(B){$(B).reset();return B},serializeElements:function(E,D){var F=E.inject({},function(H,B){if(!B.disabled&&B.name){var C=B.name,A=$(B).getValue();if(A!=null){if(C in H){if(H[C].constructor!=Array){H[C]=[H[C]]}H[C].push(A)}else{H[C]=A}}}return H});return D?F:Hash.toQueryString(F)}};Form.Methods={serialize:function(D,C){return Form.serializeElements(Form.getElements(D),C)},getElements:function(B){return $A($(B).getElementsByTagName("*")).inject([],function(D,A){if(Form.Element.Serializers[A.tagName.toLowerCase()]){D.push(Element.extend(A))}return D})},getInputs:function(K,O,N){K=$(K);var I=K.getElementsByTagName("input");if(!O&&!N){return $A(I).map(Element.extend)}for(var M=0,J=[],L=I.length;M<L;M++){var P=I[M];if((O&&P.type!=O)||(N&&P.name!=N)){continue}J.push(Element.extend(P))}return J},disable:function(B){B=$(B);Form.getElements(B).invoke("disable");return B},enable:function(B){B=$(B);Form.getElements(B).invoke("enable");return B},findFirstElement:function(B){return $(B).getElements().find(function(A){return A.type!="hidden"&&!A.disabled&&["input","select","textarea"].include(A.tagName.toLowerCase())})},focusFirstElement:function(B){B=$(B);B.findFirstElement().activate();return B},request:function(F,D){F=$(F),D=Object.clone(D||{});var E=D.parameters;D.parameters=F.serialize(true);if(E){if(typeof E=="string"){E=E.toQueryParams()}Object.extend(D.parameters,E)}if(F.hasAttribute("method")&&!D.method){D.method=F.method}return new Ajax.Request(F.readAttribute("action"),D)}};Form.Element={focus:function(B){$(B).focus();return B},select:function(B){$(B).select();return B}};Form.Element.Methods={serialize:function(D){D=$(D);if(!D.disabled&&D.name){var F=D.getValue();if(F!=undefined){var E={};E[D.name]=F;return Hash.toQueryString(E)}}return""},getValue:function(C){C=$(C);var D=C.tagName.toLowerCase();return Form.Element.Serializers[D](C)},clear:function(B){$(B).value="";return B},present:function(B){return $(B).value!=""},activate:function(C){C=$(C);try{C.focus();if(C.select&&(C.tagName.toLowerCase()!="input"||!["button","reset","submit"].include(C.type))){C.select()}}catch(D){}return C},disable:function(B){B=$(B);B.blur();B.disabled=true;return B},enable:function(B){B=$(B);B.disabled=false;return B}};var Field=Form.Element;var $F=Form.Element.Methods.getValue;Form.Element.Serializers={input:function(B){switch(B.type.toLowerCase()){case"checkbox":case"radio":return Form.Element.Serializers.inputSelector(B);default:return Form.Element.Serializers.textarea(B)}},inputSelector:function(B){return B.checked?B.value:null},textarea:function(B){return B.value},select:function(B){return this[B.type=="select-one"?"selectOne":"selectMany"](B)},selectOne:function(D){var C=D.selectedIndex;return C>=0?this.optionValue(D.options[C]):null},selectMany:function(H){var F,G=H.length;if(!G){return null}for(var I=0,F=[];I<G;I++){var J=H.options[I];if(J.selected){F.push(this.optionValue(J))}}return F},optionValue:function(B){return Element.extend(B).hasAttribute("value")?B.value:B.text}};Abstract.TimedObserver=function(){};Abstract.TimedObserver.prototype={initialize:function(D,F,E){this.frequency=F;this.element=$(D);this.callback=E;this.lastValue=this.getValue();this.registerCallback()},registerCallback:function(){setInterval(this.onTimerEvent.bind(this),this.frequency*1000)},onTimerEvent:function(){var C=this.getValue();var D=("string"==typeof this.lastValue&&"string"==typeof C?this.lastValue!=C:String(this.lastValue)!=String(C));if(D){this.callback(this.element,C);this.lastValue=C}}};Form.Element.Observer=Class.create();Form.Element.Observer.prototype=Object.extend(new Abstract.TimedObserver(),{getValue:function(){return Form.Element.getValue(this.element)}});Form.Observer=Class.create();Form.Observer.prototype=Object.extend(new Abstract.TimedObserver(),{getValue:function(){return Form.serialize(this.element)}});Abstract.EventObserver=function(){};Abstract.EventObserver.prototype={initialize:function(C,D){this.element=$(C);this.callback=D;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase()=="form"){this.registerFormCallbacks()}else{this.registerCallback(this.element)}},onElementEvent:function(){var B=this.getValue();if(this.lastValue!=B){this.callback(this.element,B);this.lastValue=B}},registerFormCallbacks:function(){Form.getElements(this.element).each(this.registerCallback.bind(this))},registerCallback:function(B){if(B.type){switch(B.type.toLowerCase()){case"checkbox":case"radio":Event.observe(B,"click",this.onElementEvent.bind(this));break;default:Event.observe(B,"change",this.onElementEvent.bind(this));break}}}};Form.Element.EventObserver=Class.create();Form.Element.EventObserver.prototype=Object.extend(new Abstract.EventObserver(),{getValue:function(){return Form.Element.getValue(this.element)}});Form.EventObserver=Class.create();Form.EventObserver.prototype=Object.extend(new Abstract.EventObserver(),{getValue:function(){return Form.serialize(this.element)}});if(!window.Event){var Event=new Object()}Object.extend(Event,{KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34,element:function(B){return $(B.target||B.srcElement)},isLeftClick:function(B){return(((B.which)&&(B.which==1))||((B.button)&&(B.button==1)))},pointerX:function(B){return B.pageX||(B.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft))},pointerY:function(B){return B.pageY||(B.clientY+(document.documentElement.scrollTop||document.body.scrollTop))},stop:function(B){if(B.preventDefault){B.preventDefault();B.stopPropagation()}else{B.returnValue=false;B.cancelBubble=true}},findElement:function(E,F){var D=Event.element(E);while(D.parentNode&&(!D.tagName||(D.tagName.toUpperCase()!=F.toUpperCase()))){D=D.parentNode}return D},observers:false,_observeAndCache:function(F,G,H,E){if(!this.observers){this.observers=[]}if(F.addEventListener){this.observers.push([F,G,H,E]);F.addEventListener(G,H,E)}else{if(F.attachEvent){this.observers.push([F,G,H,E]);F.attachEvent("on"+G,H)}}},unloadCache:function(){if(!Event.observers){return }for(var C=0,D=Event.observers.length;C<D;C++){Event.stopObserving.apply(this,Event.observers[C]);Event.observers[C][0]=null}Event.observers=false},observe:function(F,G,H,E){F=$(F);E=E||false;if(G=="keypress"&&(Prototype.Browser.WebKit||F.attachEvent)){G="keydown"}Event._observeAndCache(F,G,H,E)},stopObserving:function(H,I,J,F){H=$(H);F=F||false;if(I=="keypress"&&(Prototype.Browser.WebKit||H.attachEvent)){I="keydown"}if(H.removeEventListener){H.removeEventListener(I,J,F)}else{if(H.detachEvent){try{H.detachEvent("on"+I,J)}catch(G){}}}}});if(Prototype.Browser.IE){Event.observe(window,"unload",Event.unloadCache,false)}var Position={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},realOffset:function(F){var D=0,E=0;do{D+=F.scrollTop||0;E+=F.scrollLeft||0;F=F.parentNode}while(F);return[E,D]},cumulativeOffset:function(F){var D=0,E=0;do{D+=F.offsetTop||0;E+=F.offsetLeft||0;F=F.offsetParent}while(F);return[E,D]},positionedOffset:function(H){var E=0,F=0;do{E+=H.offsetTop||0;F+=H.offsetLeft||0;H=H.offsetParent;if(H){if(H.tagName=="BODY"){break}var G=Element.getStyle(H,"position");if(G=="relative"||G=="absolute"){break}}}while(H);return[F,E]},offsetParent:function(B){if(B.offsetParent){return B.offsetParent}if(B==document.body){return B}while((B=B.parentNode)&&B!=document.body){if(Element.getStyle(B,"position")!="static"){return B}}return document.body},within:function(F,D,E){if(this.includeScrollOffsets){return this.withinIncludingScrolloffsets(F,D,E)}this.xcomp=D;this.ycomp=E;this.offset=this.cumulativeOffset(F);return(E>=this.offset[1]&&E<this.offset[1]+F.offsetHeight&&D>=this.offset[0]&&D<this.offset[0]+F.offsetWidth)},withinIncludingScrolloffsets:function(H,E,F){var G=this.realOffset(H);this.xcomp=E+G[0]-this.deltaX;this.ycomp=F+G[1]-this.deltaY;this.offset=this.cumulativeOffset(H);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+H.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+H.offsetWidth)},overlap:function(D,C){if(!D){return 0}if(D=="vertical"){return((this.offset[1]+C.offsetHeight)-this.ycomp)/C.offsetHeight}if(D=="horizontal"){return((this.offset[0]+C.offsetWidth)-this.xcomp)/C.offsetWidth}},page:function(F){var E=0,G=0;var H=F;do{E+=H.offsetTop||0;G+=H.offsetLeft||0;if(H.offsetParent==document.body){if(Element.getStyle(H,"position")=="absolute"){break}}}while(H=H.offsetParent);H=F;do{if(!window.opera||H.tagName=="BODY"){E-=H.scrollTop||0;G-=H.scrollLeft||0}}while(H=H.parentNode);return[G,E]},clone:function(K,I){var G=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});K=$(K);var J=Position.page(K);I=$(I);var H=[0,0];var L=null;if(Element.getStyle(I,"position")=="absolute"){L=Position.offsetParent(I);H=Position.page(L)}if(L==document.body){H[0]-=document.body.offsetLeft;H[1]-=document.body.offsetTop}if(G.setLeft){I.style.left=(J[0]-H[0]+G.offsetLeft)+"px"}if(G.setTop){I.style.top=(J[1]-H[1]+G.offsetTop)+"px"}if(G.setWidth){I.style.width=K.offsetWidth+"px"}if(G.setHeight){I.style.height=K.offsetHeight+"px"}},absolutize:function(L){L=$(L);if(L.style.position=="absolute"){return }Position.prepare();var J=Position.positionedOffset(L);var H=J[1];var I=J[0];var K=L.clientWidth;var G=L.clientHeight;L._originalLeft=I-parseFloat(L.style.left||0);L._originalTop=H-parseFloat(L.style.top||0);L._originalWidth=L.style.width;L._originalHeight=L.style.height;L.style.position="absolute";L.style.top=H+"px";L.style.left=I+"px";L.style.width=K+"px";L.style.height=G+"px"},relativize:function(D){D=$(D);if(D.style.position=="relative"){return }Position.prepare();D.style.position="relative";var E=parseFloat(D.style.top||0)-(D._originalTop||0);var F=parseFloat(D.style.left||0)-(D._originalLeft||0);D.style.top=E+"px";D.style.left=F+"px";D.style.height=D._originalHeight;D.style.width=D._originalWidth}};if(Prototype.Browser.WebKit){Position.cumulativeOffset=function(F){var D=0,E=0;do{D+=F.offsetTop||0;E+=F.offsetLeft||0;if(F.offsetParent==document.body){if(Element.getStyle(F,"position")=="absolute"){break}}F=F.offsetParent}while(F);return[E,D]}}Element.addMethods();Protoload={timeUntilShow:10,opacity:0.4,startWaiting:function(F,J,G){if(typeof F=="string"){F=document.getElementById(F)}if(J==undefined){J="waiting"}if(G==undefined){G=Protoload.timeUntilShow}F._waiting=true;if(!F._loading){var I=document.createElement("div");document.body.appendChild(F._loading=I);I.style.position="absolute";try{I.style.opacity=Protoload.opacity}catch(I){}try{I.style.MozOpacity=Protoload.opacity}catch(I){}try{I.style.filter="alpha(opacity="+Math.round(Protoload.opacity*100)+")"}catch(I){}try{I.style.KhtmlOpacity=Protoload.opacity}catch(I){}var H=F.getZindex();H++;if($(I)){I.setStyle({"z-index":H})}}F._loading.className=J;window.setTimeout((function(){if(this._waiting){var P=Position.cumulativeOffset(this);var A=P[0],B=P[1],E=this.offsetWidth,O=this.offsetHeight,N=this._loading;try{var D=Position.cumulativeOffset(this)}catch(C){return }B=D[1];N.style.left=A+"px";N.style.top=B+"px";N.style.width=E+"px";N.style.height=O+"px";N.style.display="inline"}}).bind(F),G)},stopWaiting:function(B){if(B&&B._waiting){B._waiting=false;if(B._loading&&B._loading.parentNode){B._loading.parentNode.removeChild(B._loading)}B._loading=null}}};if(Prototype){Element.addMethods(Protoload);Object.extend(Element,Protoload)}var Scriptaculous={Version:"1.7.1_beta1"};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(G){G=G.toUpperCase();var H=this.NODEMAP[G]||"div";var L=document.createElement(H);try{L.innerHTML="<"+G+"></"+G+">"}catch(I){}var J=L.firstChild||null;if(J&&(J.tagName.toUpperCase()!=G)){J=J.getElementsByTagName(G)[0]}if(!J){J=document.createElement(G)}if(!J){return }if(arguments[1]){if(this._isStringOrNumber(arguments[1])||(arguments[1] instanceof Array)||arguments[1].tagName){this._children(J,arguments[1])}else{var K=this._attributes(arguments[1]);if(K.length){try{L.innerHTML="<"+G+" "+K+"></"+G+">"}catch(I){}J=L.firstChild||null;if(!J){J=document.createElement(G);for(attr in arguments[1]){J[attr=="class"?"className":attr]=arguments[1][attr]}}if(J.tagName.toUpperCase()!=G){J=L.getElementsByTagName(G)[0]}}}}if(arguments[2]){this._children(J,arguments[2])}return J},_text:function(B){return document.createTextNode(B)},ATTR_MAP:{className:"class",htmlFor:"for"},_attributes:function(C){var D=[];for(attribute in C){D.push((attribute in this.ATTR_MAP?this.ATTR_MAP[attribute]:attribute)+'="'+C[attribute].toString().escapeHTML().gsub(/"/,"&quot;")+'"')}return D.join(" ")},_children:function(D,C){if(C.tagName){D.appendChild(C);return }if(typeof C=="object"){C.flatten().each(function(A){if(typeof A=="object"){D.appendChild(A)}else{if(Builder._isStringOrNumber(A)){D.appendChild(Builder._text(A))}}})}else{if(Builder._isStringOrNumber(C)){D.appendChild(Builder._text(C))}}},_isStringOrNumber:function(B){return(typeof B=="string"||typeof B=="number")},build:function(D){var C=this.node("div");$(C).update(D.strip());return C.down()},dump:function(D){if(typeof D!="object"&&typeof D!="function"){D=window}var C=("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+/);C.each(function(A){D[A]=function(){return Builder.node.apply(Builder,[A].concat($A(arguments)))}})}};String.prototype.parseColor=function(){var D="#";if(this.slice(0,4)=="rgb("){var E=this.slice(4,this.length-1).split(",");var F=0;do{D+=parseInt(E[F]).toColorPart()}while(++F<3)}else{if(this.slice(0,1)=="#"){if(this.length==4){for(var F=1;F<4;F++){D+=(this.charAt(F)+this.charAt(F)).toLowerCase()}}if(this.length==7){D=this.toLowerCase()}}}return(D.length==7?D:(arguments[0]||this))};Element.collectTextNodes=function(B){return $A($(B).childNodes).collect(function(A){return(A.nodeType==3?A.nodeValue:(A.hasChildNodes()?Element.collectTextNodes(A):""))}).flatten().join("")};Element.collectTextNodesIgnoreClass=function(C,D){return $A($(C).childNodes).collect(function(A){return(A.nodeType==3?A.nodeValue:((A.hasChildNodes()&&!Element.hasClassName(A,D))?Element.collectTextNodesIgnoreClass(A,D):""))}).flatten().join("")};Element.setContentZoom=function(C,D){C=$(C);C.setStyle({fontSize:(D/100)+"em"});if(Prototype.Browser.WebKit){window.scrollBy(0,0)}return C};Element.getInlineOpacity=function(B){return $(B).style.opacity||""};Element.forceRerendering=function(D){try{D=$(D);var E=document.createTextNode(" ");D.appendChild(E);D.removeChild(E)}catch(F){}};Array.prototype.call=function(){var B=arguments;this.each(function(A){A.apply(this,B)})};var Effect={_elementDoesNotExistError:{name:"ElementDoesNotExistError",message:"The specified DOM element does not exist, but is required for this effect to operate"},tagifyText:function(C){if(typeof Builder=="undefined"){throw ("Effect.tagifyText requires including script.aculo.us' builder.js library")}var D="position:relative";if(Prototype.Browser.IE){D+=";zoom:1"}C=$(C);$A(C.childNodes).each(function(A){if(A.nodeType==3){A.nodeValue.toArray().each(function(B){C.insertBefore(Builder.node("span",{style:D},B==" "?String.fromCharCode(160):B),A)});Element.remove(A)}})},multiple:function(J,I){var G;if(((typeof J=="object")||(typeof J=="function"))&&(J.length)){G=J}else{G=$(J).childNodes}var F=Object.extend({speed:0.1,delay:0},arguments[2]||{});var H=F.delay;$A(G).each(function(A,B){new I(A,Object.extend(F,{delay:B*F.speed+H}))})},PAIRS:{slide:["SlideDown","SlideUp"],blind:["BlindDown","BlindUp"],appear:["Appear","Fade"]},toggle:function(F,E){F=$(F);E=(E||"appear").toLowerCase();var D=Object.extend({queue:{position:"end",scope:(F.id||"global"),limit:1}},arguments[2]||{});Effect[F.visible()?Effect.PAIRS[E][1]:Effect.PAIRS[E][0]](F,D)}};var Effect2=Effect;Effect.Transitions={linear:Prototype.K,sinoidal:function(B){return(-Math.cos(B*Math.PI)/2)+0.5},reverse:function(B){return 1-B},flicker:function(B){var B=((-Math.cos(B*Math.PI)/4)+0.75)+Math.random()/4;return(B>1?1:B)},wobble:function(B){return(-Math.cos(B*Math.PI*(9*B))/2)+0.5},pulse:function(D,C){C=C||5;return(Math.round((D%(1/C))*C)==0?((D*C*2)-Math.floor(D*C*2)):1-((D*C*2)-Math.floor(D*C*2)))},none:function(B){return 0},full:function(B){return 1}};Effect.ScopedQueue=Class.create();Object.extend(Object.extend(Effect.ScopedQueue.prototype,Enumerable),{initialize:function(){this.effects=[];this.interval=null},_each:function(B){this.effects._each(B)},add:function(F){var E=new Date().getTime();var D=(typeof F.options.queue=="string")?F.options.queue:F.options.queue.position;switch(D){case"front":this.effects.findAll(function(A){return A.state=="idle"}).each(function(A){A.startOn+=F.finishOn;A.finishOn+=F.finishOn});break;case"with-last":E=this.effects.pluck("startOn").max()||E;break;case"end":E=this.effects.pluck("finishOn").max()||E;break}F.startOn+=E;F.finishOn+=E;if(!F.options.queue.limit||(this.effects.length<F.options.queue.limit)){this.effects.push(F)}if(!this.interval){this.interval=setInterval(this.loop.bind(this),15)}},remove:function(B){this.effects=this.effects.reject(function(A){return A==B});if(this.effects.length==0){clearInterval(this.interval);this.interval=null}},loop:function(){var E=new Date().getTime();for(var F=0,D=this.effects.length;F<D;F++){this.effects[F]&&this.effects[F].loop(E)}}});Effect.Queues={instances:$H(),get:function(B){if(typeof B!="string"){return B}if(!this.instances[B]){this.instances[B]=new Effect.ScopedQueue()}return this.instances[B]}};Effect.Queue=Effect.Queues.get("global");Effect.DefaultOptions={transition:Effect.Transitions.sinoidal,duration:1,fps:100,sync:false,from:0,to:1,delay:0,queue:"parallel"};Effect.Base=function(){};Effect.Base.prototype={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.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(options,"beforeSetup")+(this.setup?"this.setup();":"")+codeForEvent(options,"afterSetup")+'};if(this.state=="running"){pos=this.options.transition(pos)*'+this.fromToDelta+"+"+this.options.from+";this.position=pos;"+codeForEvent(options,"beforeUpdate")+(this.update?"this.update(pos);":"")+codeForEvent(options,"afterUpdate")+"}}");this.event("beforeStart");if(!this.options.sync){Effect.Queues.get(typeof this.options.queue=="string"?"global":this.options.queue.scope).add(this)}},loop:function(E){if(E>=this.startOn){if(E>=this.finishOn){this.render(1);this.cancel();this.event("beforeFinish");if(this.finish){this.finish()}this.event("afterFinish");return }var F=(E-this.startOn)/this.totalTime,D=Math.round(F*this.totalFrames);if(D>this.currentFrame){this.render(F);this.currentFrame=D}}},cancel:function(){if(!this.options.sync){Effect.Queues.get(typeof this.options.queue=="string"?"global":this.options.queue.scope).remove(this)}this.state="finished"},event:function(B){if(this.options[B+"Internal"]){this.options[B+"Internal"](this)}if(this.options[B]){this.options[B](this)}},inspect:function(){var B=$H();for(property in this){if(typeof this[property]!="function"){B[property]=this[property]}}return"#<Effect:"+B.inspect()+",options:"+$H(this.options).inspect()+">"}};Effect.Parallel=Class.create();Object.extend(Object.extend(Effect.Parallel.prototype,Effect.Base.prototype),{initialize:function(B){this.effects=B||[];this.start(arguments[1])},update:function(B){this.effects.invoke("render",B)},finish:function(B){this.effects.each(function(A){A.render(1);A.cancel();A.event("beforeFinish");if(A.finish){A.finish(B)}A.event("afterFinish")})}});Effect.Event=Class.create();Object.extend(Object.extend(Effect.Event.prototype,Effect.Base.prototype),{initialize:function(){var B=Object.extend({duration:0},arguments[0]||{});this.start(B)},update:Prototype.emptyFunction});Effect.Opacity=Class.create();Object.extend(Object.extend(Effect.Opacity.prototype,Effect.Base.prototype),{initialize:function(D){this.element=$(D);if(!this.element){throw (Effect._elementDoesNotExistError)}if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1})}var C=Object.extend({from:this.element.getOpacity()||0,to:1},arguments[1]||{});this.start(C)},update:function(B){this.element.setOpacity(B)}});Effect.Move=Class.create();Object.extend(Object.extend(Effect.Move.prototype,Effect.Base.prototype),{initialize:function(D){this.element=$(D);if(!this.element){throw (Effect._elementDoesNotExistError)}var C=Object.extend({x:0,y:0,mode:"relative"},arguments[1]||{});this.start(C)},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(B){this.element.setStyle({left:Math.round(this.options.x*B+this.originalLeft)+"px",top:Math.round(this.options.y*B+this.originalTop)+"px"})}});Effect.MoveBy=function(F,D,E){return new Effect.Move(F,Object.extend({x:E,y:D},arguments[3]||{}))};Effect.Scale=Class.create();Object.extend(Object.extend(Effect.Scale.prototype,Effect.Base.prototype),{initialize:function(F,E){this.element=$(F);if(!this.element){throw (Effect._elementDoesNotExistError)}var D=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:"box",scaleFrom:100,scaleTo:E},arguments[2]||{});this.start(D)},setup:function(){this.restoreAfterFinish=this.options.restoreAfterFinish||false;this.elementPositioning=this.element.getStyle("position");this.originalStyle={};["top","left","width","height","fontSize"].each(function(A){this.originalStyle[A]=this.element.style[A]}.bind(this));this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;var B=this.element.getStyle("font-size")||"100%";["em","px","%","pt"].each(function(A){if(B.indexOf(A)>0){this.fontSize=parseFloat(B);this.fontSizeType=A}}.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(C){var D=(this.options.scaleFrom/100)+(this.factor*C);if(this.options.scaleContent&&this.fontSize){this.element.setStyle({fontSize:this.fontSize*D+this.fontSizeType})}this.setDimensions(this.dims[0]*D,this.dims[1]*D)},finish:function(B){if(this.restoreAfterFinish){this.element.setStyle(this.originalStyle)}},setDimensions:function(F,H){var G={};if(this.options.scaleX){G.width=Math.round(H)+"px"}if(this.options.scaleY){G.height=Math.round(F)+"px"}if(this.options.scaleFromCenter){var I=(F-this.dims[0])/2;var J=(H-this.dims[1])/2;if(this.elementPositioning=="absolute"){if(this.options.scaleY){G.top=this.originalTop-I+"px"}if(this.options.scaleX){G.left=this.originalLeft-J+"px"}}else{if(this.options.scaleY){G.top=-I+"px"}if(this.options.scaleX){G.left=-J+"px"}}}this.element.setStyle(G)}});Effect.Highlight=Class.create();Object.extend(Object.extend(Effect.Highlight.prototype,Effect.Base.prototype),{initialize:function(D){this.element=$(D);if(!this.element){throw (Effect._elementDoesNotExistError)}var C=Object.extend({startcolor:"#ffff99"},arguments[1]||{});this.start(C)},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(B){return parseInt(this.options.startcolor.slice(B*2+1,B*2+3),16)}.bind(this));this._delta=$R(0,2).map(function(B){return parseInt(this.options.endcolor.slice(B*2+1,B*2+3),16)-this._base[B]}.bind(this))},update:function(B){this.element.setStyle({backgroundColor:$R(0,2).inject("#",function(F,E,A){return F+(Math.round(this._base[A]+(this._delta[A]*B)).toColorPart())}.bind(this))})},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}))}});Effect.ScrollTo=Class.create();Object.extend(Object.extend(Effect.ScrollTo.prototype,Effect.Base.prototype),{initialize:function(B){this.element=$(B);this.start(arguments[1]||{})},setup:function(){Position.prepare();var D=Position.cumulativeOffset(this.element);if(this.options.offset){D[1]+=this.options.offset}var C=window.innerHeight?window.height-window.innerHeight:document.body.scrollHeight-(document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight);this.scrollStart=Position.deltaY;this.delta=(D[1]>C?C:D[1])-this.scrollStart},update:function(B){Position.prepare();window.scrollTo(Position.deltaX,this.scrollStart+(B*this.delta))}});Effect.Fade=function(E){E=$(E);var D=E.getInlineOpacity();var F=Object.extend({from:E.getOpacity()||1,to:0,afterFinishInternal:function(A){if(A.options.to!=0){return }A.element.hide().setStyle({opacity:D})}},arguments[1]||{});return new Effect.Opacity(E,F)};Effect.Appear=function(D){D=$(D);var C=Object.extend({from:(D.getStyle("display")=="none"?0:D.getOpacity()||0),to:1,afterFinishInternal:function(A){A.element.forceRerendering()},beforeSetup:function(A){A.element.setOpacity(A.options.from).show()}},arguments[1]||{});return new Effect.Opacity(D,C)};Effect.Puff=function(D){D=$(D);var C={opacity:D.getInlineOpacity(),position:D.getStyle("position"),top:D.style.top,left:D.style.left,width:D.style.width,height:D.style.height};return new Effect.Parallel([new Effect.Scale(D,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(D,{sync:true,to:0})],Object.extend({duration:1,beforeSetupInternal:function(A){Position.absolutize(A.effects[0].element)},afterFinishInternal:function(A){A.effects[0].element.hide().setStyle(C)}},arguments[1]||{}))};Effect.BlindUp=function(B){B=$(B);B.makeClipping();return new Effect.Scale(B,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(A){A.element.hide().undoClipping()}},arguments[1]||{}))};Effect.BlindDown=function(D){D=$(D);var C=D.getDimensions();return new Effect.Scale(D,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:C.height,originalWidth:C.width},restoreAfterFinish:true,afterSetup:function(A){A.element.makeClipping().setStyle({height:"0px"}).show()},afterFinishInternal:function(A){A.element.undoClipping()}},arguments[1]||{}))};Effect.SwitchOff=function(D){D=$(D);var C=D.getInlineOpacity();return new Effect.Appear(D,Object.extend({duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(A){new Effect.Scale(A.element,1,{duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(B){B.element.makePositioned().makeClipping()},afterFinishInternal:function(B){B.element.hide().undoClipping().undoPositioned().setStyle({opacity:C})}})}},arguments[1]||{}))};Effect.DropOut=function(D){D=$(D);var C={top:D.getStyle("top"),left:D.getStyle("left"),opacity:D.getInlineOpacity()};return new Effect.Parallel([new Effect.Move(D,{x:0,y:100,sync:true}),new Effect.Opacity(D,{sync:true,to:0})],Object.extend({duration:0.5,beforeSetup:function(A){A.effects[0].element.makePositioned()},afterFinishInternal:function(A){A.effects[0].element.hide().undoPositioned().setStyle(C)}},arguments[1]||{}))};Effect.Shake=function(D){D=$(D);var C={top:D.getStyle("top"),left:D.getStyle("left")};return new Effect.Move(D,{x:20,y:0,duration:0.05,afterFinishInternal:function(A){new Effect.Move(A.element,{x:-40,y:0,duration:0.1,afterFinishInternal:function(B){new Effect.Move(B.element,{x:40,y:0,duration:0.1,afterFinishInternal:function(F){new Effect.Move(F.element,{x:-40,y:0,duration:0.1,afterFinishInternal:function(E){new Effect.Move(E.element,{x:40,y:0,duration:0.1,afterFinishInternal:function(H){new Effect.Move(H.element,{x:-20,y:0,duration:0.05,afterFinishInternal:function(G){G.element.undoPositioned().setStyle(C)}})}})}})}})}})}})};Effect.SlideDown=function(E){E=$(E).cleanWhitespace();var D=E.down().getStyle("bottom");var F=E.getDimensions();return new Effect.Scale(E,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:F.height,originalWidth:F.width},restoreAfterFinish:true,afterSetup:function(A){A.element.makePositioned();A.element.down().makePositioned();if(window.opera){A.element.setStyle({top:""})}A.element.makeClipping().setStyle({height:"0px"}).show()},afterUpdateInternal:function(A){A.element.down().setStyle({bottom:(A.dims[0]-A.element.clientHeight)+"px"})},afterFinishInternal:function(A){A.element.undoClipping().undoPositioned();A.element.down().undoPositioned().setStyle({bottom:D})}},arguments[1]||{}))};Effect.SlideUp=function(D){D=$(D).cleanWhitespace();var C=D.down().getStyle("bottom");return new Effect.Scale(D,window.opera?0:1,Object.extend({scaleContent:false,scaleX:false,scaleMode:"box",scaleFrom:100,restoreAfterFinish:true,beforeStartInternal:function(A){A.element.makePositioned();A.element.down().makePositioned();if(window.opera){A.element.setStyle({top:""})}A.element.makeClipping().show()},afterUpdateInternal:function(A){A.element.down().setStyle({bottom:(A.dims[0]-A.element.clientHeight)+"px"})},afterFinishInternal:function(A){A.element.hide().undoClipping().undoPositioned().setStyle({bottom:C});A.element.down().undoPositioned()}},arguments[1]||{}))};Effect.Squish=function(B){return new Effect.Scale(B,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(A){A.element.makeClipping()},afterFinishInternal:function(A){A.element.hide().undoClipping()}})};Effect.Grow=function(O){O=$(O);var P=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{});var I={top:O.style.top,left:O.style.left,height:O.style.height,width:O.style.width,opacity:O.getInlineOpacity()};var K=O.getDimensions();var J,L;var M,N;switch(P.direction){case"top-left":J=L=M=N=0;break;case"top-right":J=K.width;L=N=0;M=-K.width;break;case"bottom-left":J=M=0;L=K.height;N=-K.height;break;case"bottom-right":J=K.width;L=K.height;M=-K.width;N=-K.height;break;case"center":J=K.width/2;L=K.height/2;M=-K.width/2;N=-K.height/2;break}return new Effect.Move(O,{x:J,y:L,duration:0.01,beforeSetup:function(A){A.element.hide().makeClipping().makePositioned()},afterFinishInternal:function(A){new Effect.Parallel([new Effect.Opacity(A.element,{sync:true,to:1,from:0,transition:P.opacityTransition}),new Effect.Move(A.element,{x:M,y:N,sync:true,transition:P.moveTransition}),new Effect.Scale(A.element,100,{scaleMode:{originalHeight:K.height,originalWidth:K.width},sync:true,scaleFrom:window.opera?1:0,transition:P.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(B){B.effects[0].element.setStyle({height:"0px"}).show()},afterFinishInternal:function(B){B.effects[0].element.undoClipping().undoPositioned().setStyle(I)}},P))}})};Effect.Shrink=function(K){K=$(K);var L=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{});var G={top:K.style.top,left:K.style.left,height:K.style.height,width:K.style.width,opacity:K.getInlineOpacity()};var H=K.getDimensions();var I,J;switch(L.direction){case"top-left":I=J=0;break;case"top-right":I=H.width;J=0;break;case"bottom-left":I=0;J=H.height;break;case"bottom-right":I=H.width;J=H.height;break;case"center":I=H.width/2;J=H.height/2;break}return new Effect.Parallel([new Effect.Opacity(K,{sync:true,to:0,from:1,transition:L.opacityTransition}),new Effect.Scale(K,window.opera?1:0,{sync:true,transition:L.scaleTransition,restoreAfterFinish:true}),new Effect.Move(K,{x:I,y:J,sync:true,transition:L.moveTransition})],Object.extend({beforeStartInternal:function(A){A.effects[0].element.makePositioned().makeClipping()},afterFinishInternal:function(A){A.effects[0].element.hide().undoClipping().undoPositioned().setStyle(G)}},L))};Effect.Pulsate=function(I){I=$(I);var J=arguments[1]||{};var F=I.getInlineOpacity();var G=J.transition||Effect.Transitions.sinoidal;var H=function(A){return G(1-Effect.Transitions.pulse(A,J.pulses))};H.bind(G);return new Effect.Opacity(I,Object.extend(Object.extend({duration:2,from:0,afterFinishInternal:function(A){A.element.setStyle({opacity:F})}},J),{transition:H}))};Effect.Fold=function(D){D=$(D);var C={top:D.style.top,left:D.style.left,width:D.style.width,height:D.style.height};D.makeClipping();return new Effect.Scale(D,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(A){new Effect.Scale(D,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(B){B.element.hide().undoClipping().setStyle(C)}})}},arguments[1]||{}))};Effect.Morph=Class.create();Object.extend(Object.extend(Effect.Morph.prototype,Effect.Base.prototype),{initialize:function(G){this.element=$(G);if(!this.element){throw (Effect._elementDoesNotExistError)}var H=Object.extend({style:{}},arguments[1]||{});if(typeof H.style=="string"){if(H.style.indexOf(":")==-1){var F="",E="."+H.style;$A(document.styleSheets).reverse().each(function(A){if(A.cssRules){cssRules=A.cssRules}else{if(A.rules){cssRules=A.rules}}$A(cssRules).reverse().each(function(B){if(E==B.selectorText){F=B.style.cssText;throw $break}});if(F){throw $break}});this.style=F.parseStyle();H.afterFinishInternal=function(A){A.element.addClassName(A.options.style);A.transforms.each(function(B){if(B.style!="opacity"){A.element.style[B.style]=""}})}}else{this.style=H.style.parseStyle()}}else{this.style=$H(H.style)}this.start(H)},setup:function(){function B(A){if(!A||["rgba(0, 0, 0, 0)","transparent"].include(A)){A="#ffffff"}A=A.parseColor();return $R(0,2).map(function(D){return parseInt(A.slice(D*2+1,D*2+3),16)})}this.transforms=this.style.map(function(A){var H=A[0],I=A[1],J=null;if(I.parseColor("#zzzzzz")!="#zzzzzz"){I=I.parseColor();J="color"}else{if(H=="opacity"){I=parseFloat(I);if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1})}}else{if(Element.CSS_LENGTH.test(I)){var K=I.match(/^([\+\-]?[0-9\.]+)(.*)$/);I=parseFloat(K[1]);J=(K.length==3)?K[2]:null}}}var L=this.element.getStyle(H);return{style:H.camelize(),originalValue:J=="color"?B(L):parseFloat(L||0),targetValue:J=="color"?B(I):I,unit:J}}.bind(this)).reject(function(A){return((A.originalValue==A.targetValue)||(A.unit!="color"&&(isNaN(A.originalValue)||isNaN(A.targetValue))))})},update:function(E){var F={},H,G=this.transforms.length;while(G--){F[(H=this.transforms[G]).style]=H.unit=="color"?"#"+(Math.round(H.originalValue[0]+(H.targetValue[0]-H.originalValue[0])*E)).toColorPart()+(Math.round(H.originalValue[1]+(H.targetValue[1]-H.originalValue[1])*E)).toColorPart()+(Math.round(H.originalValue[2]+(H.targetValue[2]-H.originalValue[2])*E)).toColorPart():H.originalValue+Math.round(((H.targetValue-H.originalValue)*E)*1000)/1000+H.unit}this.element.setStyle(F,true)}});Effect.Transform=Class.create();Object.extend(Effect.Transform.prototype,{initialize:function(B){this.tracks=[];this.options=arguments[1]||{};this.addTracks(B)},addTracks:function(B){B.each(function(D){var A=$H(D).values().first();this.tracks.push($H({ids:$H(D).keys().first(),effect:Effect.Morph,options:{style:A}}))}.bind(this));return this},play:function(){return new Effect.Parallel(this.tracks.map(function(C){var D=[$(C.ids)||$$(C.ids)].flatten();return D.map(function(A){return new C.effect(A,Object.extend({sync:true},C.options))})}).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.prototype.parseStyle=function(){var F=document.createElement("div");F.innerHTML='<div style="'+this+'"></div>';var E=F.childNodes[0].style,D=$H();Element.CSS_PROPERTIES.each(function(A){if(E[A]){D[A]=E[A]}});if(Prototype.Browser.IE&&this.indexOf("opacity")>-1){D.opacity=this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]}return D};Element.morph=function(C,D){new Effect.Morph(C,Object.extend({style:D},arguments[2]||{}));return C};["getInlineOpacity","forceRerendering","setContentZoom","collectTextNodes","collectTextNodesIgnoreClass","morph"].each(function(B){Element.Methods[B]=Element[B]});Element.Methods.visualEffect=function(F,E,D){s=E.dasherize().camelize();effect_class=s.charAt(0).toUpperCase()+s.substring(1);new Effect[effect_class](F,D);return $(F)};Element.addMethods();if(typeof Effect=="undefined"){throw ("dragdrop.js requires including script.aculo.us' effects.js library")}var Droppables={drops:[],remove:function(B){this.drops=this.drops.reject(function(A){return A.element==$(B)})},add:function(F){F=$(F);var D=Object.extend({greedy:true,hoverclass:null,tree:false},arguments[1]||{});if(D.containment){D._containers=[];var E=D.containment;if((typeof E=="object")&&(E.constructor==Array)){E.each(function(A){D._containers.push($(A))})}else{D._containers.push($(E))}}if(D.accept){D.accept=[D.accept].flatten()}Element.makePositioned(F);D.element=F;this.drops.push(D)},findDeepestChild:function(B){deepest=B[0];for(i=1;i<B.length;++i){if(Element.isParent(B[i].element,deepest.element)){deepest=B[i]}}return deepest},isContained:function(F,D){var E;if(D.tree){E=F.treeNode}else{E=F.parentNode}return D._containers.detect(function(A){return E==A})},isAffected:function(D,E,F){return((F.element!=E)&&((!F._containers)||this.isContained(E,F))&&((!F.accept)||(Element.classNames(E).detect(function(A){return F.accept.include(A)})))&&Position.within(F.element,D[0],D[1]))},deactivate:function(B){if(B.hoverclass){Element.removeClassName(B.element,B.hoverclass)}this.last_active=null},activate:function(B){if(B.hoverclass){Element.addClassName(B.element,B.hoverclass)}this.last_active=B},show:function(D,F){if(!this.drops.length){return }var E=[];if(this.last_active){this.deactivate(this.last_active)}this.drops.each(function(A){if(Droppables.isAffected(D,F,A)){E.push(A)}});if(E.length>0){drop=Droppables.findDeepestChild(E);Position.within(drop.element,D[0],D[1]);if(drop.onHover){drop.onHover(F,drop.element,Position.overlap(drop.overlap,drop.element))}Droppables.activate(drop)}},fire:function(D,C){if(!this.last_active){return }Position.prepare();if(this.isAffected([Event.pointerX(D),Event.pointerY(D)],C,this.last_active)){if(this.last_active.onDrop){this.last_active.onDrop(C,this.last_active.element,D);return true}}},reset:function(){if(this.last_active){this.deactivate(this.last_active)}}};var Draggables={drags:[],observers:[],register:function(B){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(B)},unregister:function(B){this.drags=this.drags.reject(function(A){return A==B});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(B){if(B.options.delay){this._timeout=setTimeout(function(){Draggables._timeout=null;window.focus();Draggables.activeDraggable=B}.bind(this),B.options.delay)}else{window.focus();this.activeDraggable=B}},deactivate:function(){this.activeDraggable=null},updateDrag:function(C){if(!this.activeDraggable){return }var D=[Event.pointerX(C),Event.pointerY(C)];if(this._lastPointer&&(this._lastPointer.inspect()==D.inspect())){return }this._lastPointer=D;this.activeDraggable.updateDrag(C,D)},endDrag:function(B){if(this._timeout){clearTimeout(this._timeout);this._timeout=null}if(!this.activeDraggable){return }this._lastPointer=null;this.activeDraggable.endDrag(B);this.activeDraggable=null},keyPress:function(B){if(this.activeDraggable){this.activeDraggable.keyPress(B)}},addObserver:function(B){this.observers.push(B);this._cacheObserverCallbacks()},removeObserver:function(B){this.observers=this.observers.reject(function(A){return A.element==B});this._cacheObserverCallbacks()},notify:function(F,D,E){if(this[F+"Count"]>0){this.observers.each(function(A){if(A[F]){A[F](F,D,E)}})}if(D.options[F]){D.options[F](D,E)}},_cacheObserverCallbacks:function(){["onStart","onEnd","onDrag"].each(function(B){Draggables[B+"Count"]=Draggables.observers.select(function(A){return A[B]}).length})}};var Draggable=Class.create();Draggable._dragging={};Draggable.prototype={initialize:function(F){var E={handle:false,reverteffect:function(B,C,H){var A=Math.sqrt(Math.abs(C^2)+Math.abs(H^2))*0.02;new Effect.Move(B,{x:-H,y:-C,duration:A,queue:{scope:"_draggable",position:"end"}})},endeffect:function(A){var B=typeof A._opacity=="number"?A._opacity:1;new Effect.Opacity(A,{duration:0.2,from:0.7,to:B,queue:{scope:"_draggable",position:"end"},afterFinish:function(){Draggable._dragging[A]=false}})},zindex:1000,revert:false,quiet:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,snap:false,delay:0};if(!arguments[1]||typeof arguments[1].endeffect=="undefined"){Object.extend(E,{starteffect:function(A){A._opacity=Element.getOpacity(A);Draggable._dragging[A]=true;new Effect.Opacity(A,{duration:0.2,from:A._opacity,to:0.7})}})}var D=Object.extend(E,arguments[1]||{});this.element=$(F);if(D.handle&&(typeof D.handle=="string")){this.handle=this.element.down("."+D.handle,0)}if(!this.handle){this.handle=$(D.handle)}if(!this.handle){this.handle=this.element}if(D.scroll&&!D.scroll.scrollTo&&!D.scroll.outerHTML){D.scroll=$(D.scroll);this._isScrollChild=Element.childOf(this.element,D.scroll)}Element.makePositioned(this.element);this.delta=this.currentDelta();this.options=D;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(E){if(typeof Draggable._dragging[this.element]!="undefined"&&Draggable._dragging[this.element]){return }if(Event.isLeftClick(E)){var G=Event.element(E);if((tag_name=G.tagName.toUpperCase())&&(tag_name=="INPUT"||tag_name=="SELECT"||tag_name=="OPTION"||tag_name=="BUTTON"||tag_name=="TEXTAREA")){return }var H=[Event.pointerX(E),Event.pointerY(E)];var F=Position.cumulativeOffset(this.element);this.offset=[0,1].map(function(A){return(H[A]-F[A])});Draggables.activate(this);Event.stop(E)}},startDrag:function(D){this.dragging=true;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);Position.absolutize(this.element);this.element.parentNode.insertBefore(this._clone,this.element)}if(this.options.scroll){if(this.options.scroll==window){var C=this._getWindowScroll(this.options.scroll);this.originalScrollLeft=C.left;this.originalScrollTop=C.top}else{this.originalScrollLeft=this.options.scroll.scrollLeft;this.originalScrollTop=this.options.scroll.scrollTop}}Draggables.notify("onStart",this,D);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(L,I){this.dragging=false;if(this.options.quiet){Position.prepare();var J=[Event.pointerX(L),Event.pointerY(L)];Droppables.show(J,this.element)}if(this.options.ghosting){Position.relativize(this.element);Element.remove(this._clone);this._clone=null}var H=false;if(I){H=Droppables.fire(L,this.element);if(!H){H=false}}if(H&&this.options.onDropped){this.options.onDropped(this.element)}Draggables.notify("onEnd",this,L);var G=this.options.revert;if(G&&typeof G=="function"){G=G(this.element)}var K=this.currentDelta();if(G&&this.options.reverteffect){if(H==0||G!="failure"){this.options.reverteffect(this.element,K[1]-this.delta[1],K[0]-this.delta[0])}}else{this.delta=K}if(this.options.zindex){this.element.style.zIndex=this.originalZ}if(this.options.endeffect){this.options.endeffect(this.element)}Draggables.deactivate(this);Droppables.reset()},keyPress:function(B){if(B.keyCode!=Event.KEY_ESC){return }this.finishDrag(B,false);Event.stop(B)},endDrag:function(B){if(!this.dragging){return }this.stopScrolling();this.finishDrag(B,true);Event.stop(B)},draw:function(G){var H=Position.cumulativeOffset(this.element);if(this.options.ghosting){var K=Position.realOffset(this.element);H[0]+=K[0]-Position.deltaX;H[1]+=K[1]-Position.deltaY}var I=this.currentDelta();H[0]-=I[0];H[1]-=I[1];if(this.options.scroll&&(this.options.scroll!=window&&this._isScrollChild)){H[0]-=this.options.scroll.scrollLeft-this.originalScrollLeft;H[1]-=this.options.scroll.scrollTop-this.originalScrollTop}var J=[0,1].map(function(A){return(G[A]-H[A]-this.offset[A])}.bind(this));if(this.options.snap){if(typeof this.options.snap=="function"){J=this.options.snap(J[0],J[1],this)}else{if(this.options.snap instanceof Array){J=J.map(function(B,A){return Math.round(B/this.options.snap[A])*this.options.snap[A]}.bind(this))}else{J=J.map(function(A){return Math.round(A/this.options.snap)*this.options.snap}.bind(this))}}}var L=this.element.style;if((!this.options.constraint)||(this.options.constraint=="horizontal")){L.left=J[0]+"px"}if((!this.options.constraint)||(this.options.constraint=="vertical")){L.top=J[1]+"px"}if(L.visibility=="hidden"){L.visibility=""}},stopScrolling:function(){if(this.scrollInterval){clearInterval(this.scrollInterval);this.scrollInterval=null;Draggables._lastScrollPointer=null}},startScrolling:function(B){if(!(B[0]||B[1])){return }this.scrollSpeed=[B[0]*this.options.scrollSpeed,B[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}}};var SortableObserver=Class.create();SortableObserver.prototype={initialize:function(D,C){this.element=$(D);this.observer=C;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(B){while(B.tagName.toUpperCase()!="BODY"){if(B.id&&Sortable.sortables[B.id]){return B}B=B.parentNode}},options:function(B){B=Sortable._findRootElement($(B));if(!B){return }return Sortable.sortables[B.id]},destroy:function(C){var D=Sortable.options(C);if(D){Draggables.removeObserver(D.element);D.droppables.each(function(A){Droppables.remove(A)});D.draggables.invoke("destroy");delete Sortable.sortables[D.element.id]}},create:function(I){I=$(I);var J=Object.extend({element:I,tag:"li",dropOnEmpty:false,tree:false,treeTag:"ul",overlap:"vertical",constraint:"vertical",containment:I,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(I);var F={revert:true,quiet:J.quiet,scroll:J.scroll,scrollSpeed:J.scrollSpeed,scrollSensitivity:J.scrollSensitivity,delay:J.delay,ghosting:J.ghosting,constraint:J.constraint,handle:J.handle};if(J.starteffect){F.starteffect=J.starteffect}if(J.reverteffect){F.reverteffect=J.reverteffect}else{if(J.ghosting){F.reverteffect=function(A){A.style.top=0;A.style.left=0}}}if(J.endeffect){F.endeffect=J.endeffect}if(J.zindex){F.zindex=J.zindex}var H={overlap:J.overlap,containment:J.containment,tree:J.tree,hoverclass:J.hoverclass,onHover:Sortable.onHover};var G={onHover:Sortable.onEmptyHover,overlap:J.overlap,containment:J.containment,hoverclass:J.hoverclass};Element.cleanWhitespace(I);J.draggables=[];J.droppables=[];if(J.dropOnEmpty||J.tree){Droppables.add(I,G);J.droppables.push(I)}(J.elements||this.findElements(I,J)||[]).each(function(A,C){var B=J.handles?$(J.handles[C]):(J.handle?$(A).getElementsByClassName(J.handle)[0]:A);J.draggables.push(new Draggable(A,Object.extend(F,{handle:B})));Droppables.add(A,H);if(J.tree){A.treeNode=I}J.droppables.push(A)});if(J.tree){(Sortable.findTreeElements(I,J)||[]).each(function(A){Droppables.add(A,G);A.treeNode=I;J.droppables.push(A)})}this.sortables[I.id]=J;Draggables.addObserver(new SortableObserver(I,J.onUpdate))},findElements:function(D,C){return Element.findChildren(D,C.only,C.tree?true:false,C.tag)},findTreeElements:function(D,C){return Element.findChildren(D,C.only,C.tree?true:false,C.treeTag)},onHover:function(G,H,F){if(Element.isParent(H,G)){return }if(F>0.33&&F<0.66&&Sortable.options(H).tree){return }else{if(F>0.5){Sortable.mark(H,"before");if(H.previousSibling!=G){var J=G.parentNode;G.style.visibility="hidden";H.parentNode.insertBefore(G,H);if(H.parentNode!=J){Sortable.options(J).onChange(G)}Sortable.options(H.parentNode).onChange(G)}}else{Sortable.mark(H,"after");var I=H.nextSibling||null;if(I!=G){var J=G.parentNode;G.style.visibility="hidden";H.parentNode.insertBefore(G,I);if(H.parentNode!=J){Sortable.options(J).onChange(G)}Sortable.options(H.parentNode).onChange(G)}}}},onEmptyHover:function(R,P,O){var N=R.parentNode;var M=Sortable.options(P);if(!Element.isParent(P,R)){var Q;var K=Sortable.findElements(P,{tag:M.tag,only:M.only});var L=null;if(K){var J=Element.offsetSize(P,M.overlap)*(1-O);for(Q=0;Q<K.length;Q+=1){if(J-Element.offsetSize(K[Q],M.overlap)>=0){J-=Element.offsetSize(K[Q],M.overlap)}else{if(J-(Element.offsetSize(K[Q],M.overlap)/2)>=0){L=Q+1<K.length?K[Q+1]:null;break}else{L=K[Q];break}}}}P.insertBefore(R,L);Sortable.options(N).onChange(R);M.onChange(R)}},unmark:function(){if(Sortable._marker){Sortable._marker.hide()}},mark:function(H,E){var F=Sortable.options(H.parentNode);if(F&&!F.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 G=Position.cumulativeOffset(H);Sortable._marker.setStyle({left:G[0]+"px",top:G[1]+"px"});if(E=="after"){if(F.overlap=="horizontal"){Sortable._marker.setStyle({left:(G[0]+H.clientWidth)+"px"})}else{Sortable._marker.setStyle({top:(G[1]+H.clientHeight)+"px"})}}Sortable._marker.show()},_tree:function(K,N,J){var L=Sortable.findElements(K,N)||[];for(var M=0;M<L.length;++M){var H=L[M].id.match(N.format);if(!H){continue}var I={id:encodeURIComponent(H?H[1]:null),element:K,parent:J,children:[],position:J.children.length,container:$(L[M]).down(N.treeTag)};if(I.container){this._tree(I.container,N,I)}J.children.push(I)}return J},tree:function(F){F=$(F);var G=this.options(F);var H=Object.extend({tag:G.tag,treeTag:G.treeTag,only:G.only,name:F.id,format:G.format},arguments[1]||{});var E={id:null,parent:null,children:[],container:F,position:0};return Sortable._tree(F,H,E)},_constructIndex:function(D){var C="";do{if(D.id){C="["+D.position+"]"+C}}while((D=D.parent)!=null);return C},sequence:function(D){D=$(D);var C=Object.extend(this.options(D),arguments[1]||{});return $(this.findElements(D,C)||[]).map(function(A){return A.id.match(C.format)?A.id.match(C.format)[1]:""})},setSequence:function(H,G){H=$(H);var E=Object.extend(this.options(H),arguments[2]||{});var F={};this.findElements(H,E).each(function(A){if(A.id.match(E.format)){F[A.id.match(E.format)[1]]=[A,A.parentNode]}A.parentNode.removeChild(A)});G.each(function(B){var A=F[B];if(A){A[1].appendChild(A[0]);delete F[B]}})},serialize:function(E){E=$(E);var F=Object.extend(Sortable.options(E),arguments[1]||{});var D=encodeURIComponent((arguments[1]&&arguments[1].name)?arguments[1].name:E.id);if(F.tree){return Sortable.tree(E,arguments[1]).children.map(function(A){return[D+Sortable._constructIndex(A)+"[id]="+encodeURIComponent(A.id)].concat(A.children.map(arguments.callee))}).flatten().join("&")}else{return Sortable.sequence(E,arguments[1]).map(function(A){return D+"[]="+encodeURIComponent(A)}).join("&")}}};Element.isParent=function(D,C){if(!D.parentNode||D==C){return false}if(D.parentNode==C){return true}return Element.isParent(D.parentNode,C)};Element.findChildren=function(H,J,F,I){if(!H.hasChildNodes()){return null}I=I.toUpperCase();if(J){J=[J].flatten()}var G=[];$A(H.childNodes).each(function(A){if(A.tagName&&A.tagName.toUpperCase()==I&&(!J||(Element.classNames(A).detect(function(C){return J.include(C)})))){G.push(A)}if(F){var B=Element.findChildren(A,J,F,I);if(B){G.push(B)}}});return(G.length>0?G.flatten():[])};Element.offsetSize=function(C,D){return C["offset"+((D=="vertical"||D=="height")?"Height":"Width")]};if(typeof Effect=="undefined"){throw ("controls.js requires including script.aculo.us' effects.js library")}var Autocompleter={};Autocompleter.Base=function(){};Autocompleter.Base.prototype={baseInitialize:function(F,E,D){F=$(F);this.element=F;this.update=$(E);this.hasFocus=false;this.changed=false;this.active=false;this.index=0;this.entryCount=0;if(this.setOptions){this.setOptions(D)}else{this.options=D||{}}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(B,A){if(!A.style.position||A.style.position=="absolute"){A.style.position="absolute";Position.clone(B,A,{setHeight:false,offsetTop:B.offsetHeight})}Effect.Appear(A,{duration:0.15})};this.options.onHide=this.options.onHide||function(B,A){new Effect.Fade(A,{duration:0.15})};if(typeof (this.options.tokens)=="string"){this.options.tokens=new Array(this.options.tokens)}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));Event.observe(window,"beforeunload",function(){F.setAttribute("autocomplete","on")})},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(B){if(this.active){switch(B.keyCode){case Event.KEY_TAB:case Event.KEY_RETURN:this.selectEntry();Event.stop(B);case Event.KEY_ESC:this.hide();this.active=false;Event.stop(B);return ;case Event.KEY_LEFT:case Event.KEY_RIGHT:return ;case Event.KEY_UP:this.markPrevious();this.render();if(Prototype.Browser.WebKit){Event.stop(B)}return ;case Event.KEY_DOWN:this.markNext();this.render();if(Prototype.Browser.WebKit){Event.stop(B)}return }}else{if(B.keyCode==Event.KEY_TAB||B.keyCode==Event.KEY_RETURN||(Prototype.Browser.WebKit>0&&B.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(D){var C=Event.findElement(D,"LI");if(this.index!=C.autocompleteIndex){this.index=C.autocompleteIndex;this.render()}Event.stop(D)},onClick:function(D){var C=Event.findElement(D,"LI");this.index=C.autocompleteIndex;this.selectEntry();this.hide()},onBlur:function(B){setTimeout(this.hide.bind(this),250);this.hasFocus=false;this.active=false},render:function(){if(this.entryCount>0){for(var B=0;B<this.entryCount;B++){this.index==B?Element.addClassName(this.getEntry(B),"selected"):Element.removeClassName(this.getEntry(B),"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(B){return this.update.firstChild.childNodes[B]},getCurrentEntry:function(){return this.getEntry(this.index)},selectEntry:function(){this.active=false;this.updateElement(this.getCurrentEntry())},updateElement:function(H){if(this.options.updateElement){this.options.updateElement(H);return }var K="";if(this.options.select){var G=document.getElementsByClassName(this.options.select,H)||[];if(G.length>0){K=Element.collectTextNodes(G[0],this.options.select)}}else{K=Element.collectTextNodesIgnoreClass(H,"informal")}var I=this.findLastToken();if(I!=-1){var J=this.element.value.substr(0,I+1);var L=this.element.value.substr(I+1).match(/^\s+/);if(L){J+=L[0]}this.element.value=J+K}else{this.element.value=K}this.element.focus();if(this.options.afterUpdateElement){this.options.afterUpdateElement(this.element,H)}},updateChoices:function(E){if(!this.changed&&this.hasFocus){this.update.innerHTML=E;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 D=0;D<this.entryCount;D++){var F=this.getEntry(D);F.autocompleteIndex=D;this.addObservers(F)}}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(B){Event.observe(B,"mouseover",this.onHover.bindAsEventListener(this));Event.observe(B,"click",this.onClick.bindAsEventListener(this))},onObserverEvent:function(){this.changed=false;if(this.getToken().length>=this.options.minChars){this.getUpdatedChoices()}else{this.active=false;this.hide()}},getToken:function(){var D=this.findLastToken();if(D!=-1){var C=this.element.value.substr(D+1).replace(/^\s+/,"").replace(/\s+$/,"")}else{var C=this.element.value}return/\n/.test(C)?"":C},findLastToken:function(){var E=-1;for(var F=0;F<this.options.tokens.length;F++){var D=this.element.value.lastIndexOf(this.options.tokens[F]);if(D>E){E=D}}return E}};Ajax.Autocompleter=Class.create();Object.extend(Object.extend(Ajax.Autocompleter.prototype,Autocompleter.Base.prototype),{initialize:function(G,F,H,E){this.baseInitialize(G,F,E);this.options.asynchronous=true;this.options.onComplete=this.onComplete.bind(this);this.options.defaultParams=this.options.parameters||null;this.url=H},getUpdatedChoices:function(){this.startIndicator();var B=encodeURIComponent(this.options.paramName)+"="+encodeURIComponent(this.getToken());this.options.parameters=this.options.callback?this.options.callback(this.element,B):B;if(this.options.defaultParams){this.options.parameters+="&"+this.options.defaultParams}new Ajax.Request(this.url,this.options)},onComplete:function(B){this.updateChoices(B.responseText)}});Autocompleter.Local=Class.create();Autocompleter.Local.prototype=Object.extend(new Autocompleter.Base(),{initialize:function(H,F,G,E){this.baseInitialize(H,F,E);this.options.array=G},getUpdatedChoices:function(){this.updateChoices(this.options.selector(this))},setOptions:function(B){this.options=Object.extend({choices:10,partialSearch:true,partialChars:2,ignoreCase:true,fullSearch:false,selector:function(P){var N=[];var O=[];var J=P.getToken();var K=0;for(var M=0;M<P.options.array.length&&N.length<P.options.choices;M++){var L=P.options.array[M];var A=P.options.ignoreCase?L.toLowerCase().indexOf(J.toLowerCase()):L.indexOf(J);while(A!=-1){if(A==0&&L.length!=J.length){N.push("<li><strong>"+L.substr(0,J.length)+"</strong>"+L.substr(J.length)+"</li>");break}else{if(J.length>=P.options.partialChars&&P.options.partialSearch&&A!=-1){if(P.options.fullSearch||/\s/.test(L.substr(A-1,1))){O.push("<li>"+L.substr(0,A)+"<strong>"+L.substr(A,J.length)+"</strong>"+L.substr(A+J.length)+"</li>");break}}}A=P.options.ignoreCase?L.toLowerCase().indexOf(J.toLowerCase(),A+1):L.indexOf(J,A+1)}}if(O.length){N=N.concat(O.slice(0,P.options.choices-N.length))}return"<ul>"+N.join("")+"</ul>"}},B||{})}});Field.scrollFreeActivate=function(B){setTimeout(function(){Field.activate(B)},1)};Ajax.InPlaceEditor=Class.create();Ajax.InPlaceEditor.defaultHighlightColor="#FFFF99";Ajax.InPlaceEditor.prototype={initialize:function(E,F,D){this.url=F;this.element=$(E);this.options=Object.extend({paramName:"value",okButton:true,okLink:false,okText:"ok",cancelButton:false,cancelLink:true,cancelText:"cancel",textBeforeControls:"",textBetweenControls:"",textAfterControls:"",savingText:"Saving...",clickToEditText:"Click to edit",okText:"ok",rows:1,onComplete:function(A,B){new Effect.Highlight(B,{startcolor:this.options.highlightcolor})},onFailure:function(A){alert("Error communicating with the server: "+A.responseText.stripTags())},callback:function(A){return Form.serialize(A)},handleLineBreaks:true,loadingText:"Loading...",savingClassName:"inplaceeditor-saving",loadingClassName:"inplaceeditor-loading",formClassName:"inplaceeditor-form",highlightcolor:Ajax.InPlaceEditor.defaultHighlightColor,highlightendcolor:"#FFFFFF",externalControl:null,submitOnBlur:false,ajaxOptions:{},evalScripts:false},D||{});if(!this.options.formId&&this.element.id){this.options.formId=this.element.id+"-inplaceeditor";if($(this.options.formId)){this.options.formId=null}}if(this.options.externalControl){this.options.externalControl=$(this.options.externalControl)}this.originalBackground=Element.getStyle(this.element,"background-color");if(!this.originalBackground){this.originalBackground="transparent"}this.element.title=this.options.clickToEditText;this.onclickListener=this.enterEditMode.bindAsEventListener(this);this.mouseoverListener=this.enterHover.bindAsEventListener(this);this.mouseoutListener=this.leaveHover.bindAsEventListener(this);Event.observe(this.element,"click",this.onclickListener);Event.observe(this.element,"mouseover",this.mouseoverListener);Event.observe(this.element,"mouseout",this.mouseoutListener);if(this.options.externalControl){Event.observe(this.options.externalControl,"click",this.onclickListener);Event.observe(this.options.externalControl,"mouseover",this.mouseoverListener);Event.observe(this.options.externalControl,"mouseout",this.mouseoutListener)}},enterEditMode:function(B){if(this.saving){return }if(this.editing){return }this.editing=true;this.onEnterEditMode();if(this.options.externalControl){Element.hide(this.options.externalControl)}Element.hide(this.element);this.createForm();this.element.parentNode.insertBefore(this.form,this.element);if(!this.options.loadTextURL){Field.scrollFreeActivate(this.editField)}if(B){Event.stop(B)}return false},createForm:function(){this.form=document.createElement("form");this.form.id=this.options.formId;Element.addClassName(this.form,this.options.formClassName);this.form.onsubmit=this.onSubmit.bind(this);this.createEditField();if(this.options.textarea){var J=document.createElement("br");this.form.appendChild(J)}if(this.options.textBeforeControls){this.form.appendChild(document.createTextNode(this.options.textBeforeControls))}if(this.options.okButton){var G=document.createElement("input");G.type="submit";G.value=this.options.okText;G.className="editor_ok_button";this.form.appendChild(G)}if(this.options.okLink){var I=document.createElement("a");I.href="#";I.appendChild(document.createTextNode(this.options.okText));I.onclick=this.onSubmit.bind(this);I.className="editor_ok_link";this.form.appendChild(I)}if(this.options.textBetweenControls&&(this.options.okLink||this.options.okButton)&&(this.options.cancelLink||this.options.cancelButton)){this.form.appendChild(document.createTextNode(this.options.textBetweenControls))}if(this.options.cancelButton){var H=document.createElement("input");H.type="submit";H.value=this.options.cancelText;H.onclick=this.onclickCancel.bind(this);H.className="editor_cancel_button";this.form.appendChild(H)}if(this.options.cancelLink){var F=document.createElement("a");F.href="#";F.appendChild(document.createTextNode(this.options.cancelText));F.onclick=this.onclickCancel.bind(this);F.className="editor_cancel editor_cancel_link";this.form.appendChild(F)}if(this.options.textAfterControls){this.form.appendChild(document.createTextNode(this.options.textAfterControls))}},hasHTMLLineBreaks:function(B){if(!this.options.handleLineBreaks){return false}return B.match(/<br/i)||B.match(/<p>/i)},convertHTMLLineBreaks:function(B){return B.replace(/<br>/gi,"\n").replace(/<br\/>/gi,"\n").replace(/<\/p>/gi,"\n").replace(/<p>/gi,"")},createEditField:function(){var G;if(this.options.loadTextURL){G=this.options.loadingText}else{G=this.getText()}var I=this;if(this.options.rows==1&&!this.hasHTMLLineBreaks(G)){this.options.textarea=false;var F=document.createElement("input");F.obj=this;F.type="text";F.name=this.options.paramName;F.value=G;F.style.backgroundColor=this.options.highlightcolor;F.className="editor_field";var J=this.options.size||this.options.cols||0;if(J!=0){F.size=J}if(this.options.submitOnBlur){F.onblur=this.onSubmit.bind(this)}this.editField=F}else{this.options.textarea=true;var H=document.createElement("textarea");H.obj=this;H.name=this.options.paramName;H.value=this.convertHTMLLineBreaks(G);H.rows=this.options.rows;H.cols=this.options.cols||40;H.className="editor_field";if(this.options.submitOnBlur){H.onblur=this.onSubmit.bind(this)}this.editField=H}if(this.options.loadTextURL){this.loadExternalText()}this.form.appendChild(this.editField)},getText:function(){return this.element.innerHTML},loadExternalText:function(){Element.addClassName(this.form,this.options.loadingClassName);this.editField.disabled=true;new Ajax.Request(this.options.loadTextURL,Object.extend({asynchronous:true,onComplete:this.onLoadedExternalText.bind(this)},this.options.ajaxOptions))},onLoadedExternalText:function(B){Element.removeClassName(this.form,this.options.loadingClassName);this.editField.disabled=false;this.editField.value=B.responseText.stripTags();Field.scrollFreeActivate(this.editField)},onclickCancel:function(){this.onComplete();this.leaveEditMode();return false},onFailure:function(B){this.options.onFailure(B);if(this.oldInnerHTML){this.element.innerHTML=this.oldInnerHTML;this.oldInnerHTML=null}return false},onSubmit:function(){var C=this.form;var D=this.editField.value;this.onLoading();if(this.options.evalScripts){new Ajax.Request(this.url,Object.extend({parameters:this.options.callback(C,D),onComplete:this.onComplete.bind(this),onFailure:this.onFailure.bind(this),asynchronous:true,evalScripts:true},this.options.ajaxOptions))}else{new Ajax.Updater({success:this.element,failure:null},this.url,Object.extend({parameters:this.options.callback(C,D),onComplete:this.onComplete.bind(this),onFailure:this.onFailure.bind(this)},this.options.ajaxOptions))}if(arguments.length>1){Event.stop(arguments[0])}return false},onLoading:function(){this.saving=true;this.removeForm();this.leaveHover();this.showSaving()},showSaving:function(){this.oldInnerHTML=this.element.innerHTML;this.element.innerHTML=this.options.savingText;Element.addClassName(this.element,this.options.savingClassName);this.element.style.backgroundColor=this.originalBackground;Element.show(this.element)},removeForm:function(){if(this.form){if(this.form.parentNode){Element.remove(this.form)}this.form=null}},enterHover:function(){if(this.saving){return }this.element.style.backgroundColor=this.options.highlightcolor;if(this.effect){this.effect.cancel()}Element.addClassName(this.element,this.options.hoverClassName)},leaveHover:function(){if(this.options.backgroundColor){this.element.style.backgroundColor=this.oldBackground}Element.removeClassName(this.element,this.options.hoverClassName);if(this.saving){return }this.effect=new Effect.Highlight(this.element,{startcolor:this.options.highlightcolor,endcolor:this.options.highlightendcolor,restorecolor:this.originalBackground})},leaveEditMode:function(){Element.removeClassName(this.element,this.options.savingClassName);this.removeForm();this.leaveHover();this.element.style.backgroundColor=this.originalBackground;Element.show(this.element);if(this.options.externalControl){Element.show(this.options.externalControl)}this.editing=false;this.saving=false;this.oldInnerHTML=null;this.onLeaveEditMode()},onComplete:function(B){this.leaveEditMode();this.options.onComplete.bind(this)(B,this.element)},onEnterEditMode:function(){},onLeaveEditMode:function(){},dispose:function(){if(this.oldInnerHTML){this.element.innerHTML=this.oldInnerHTML}this.leaveEditMode();Event.stopObserving(this.element,"click",this.onclickListener);Event.stopObserving(this.element,"mouseover",this.mouseoverListener);Event.stopObserving(this.element,"mouseout",this.mouseoutListener);if(this.options.externalControl){Event.stopObserving(this.options.externalControl,"click",this.onclickListener);Event.stopObserving(this.options.externalControl,"mouseover",this.mouseoverListener);Event.stopObserving(this.options.externalControl,"mouseout",this.mouseoutListener)}}};Ajax.InPlaceCollectionEditor=Class.create();Object.extend(Ajax.InPlaceCollectionEditor.prototype,Ajax.InPlaceEditor.prototype);Object.extend(Ajax.InPlaceCollectionEditor.prototype,{createEditField:function(){if(!this.cached_selectTag){var D=document.createElement("select");var E=this.options.collection||[];var F;E.each(function(A,B){F=document.createElement("option");F.value=(A instanceof Array)?A[0]:A;if((typeof this.options.value=="undefined")&&((A instanceof Array)?this.element.innerHTML==A[1]:A==F.value)){F.selected=true}if(this.options.value==F.value){F.selected=true}F.appendChild(document.createTextNode((A instanceof Array)?A[1]:A));D.appendChild(F)}.bind(this));this.cached_selectTag=D}this.editField=this.cached_selectTag;if(this.options.loadTextURL){this.loadExternalText()}this.form.appendChild(this.editField);this.options.callback=function(B,A){return"value="+encodeURIComponent(A)}}});Form.Element.DelayedObserver=Class.create();Form.Element.DelayedObserver.prototype={initialize:function(F,D,E){this.delay=D||0.5;this.element=$(F);this.callback=E;this.timer=null;this.lastValue=$F(this.element);Event.observe(this.element,"keyup",this.delayedListener.bindAsEventListener(this))},delayedListener:function(B){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))}};if(!Control){var Control={}}Control.Slider=Class.create();Control.Slider.prototype={initialize:function(F,E,H){var G=this;if(F instanceof Array){this.handles=F.collect(function(A){return $(A)})}else{this.handles=[$(F)]}this.initialValue=H.initialValue||0;this.dimensions=H.dimensions||{width:200,height:16};this.track=$(E);this.options=H||{};this.axis=this.options.axis||"horizontal";this.increment=this.options.increment||1;this.step=parseInt(this.options.step||"1",10);this.range=this.options.range||$R(0,1);this.value=0;if(this.handles.length==1){this.values=[this.initialValue]}else{this.values=this.handles.map(function(){return 0})}this.spans=this.options.spans?this.options.spans.map(function(A){return $(A)}):false;this.options.startSpan=$(this.options.startSpan||null);this.options.endSpan=$(this.options.endSpan||null);this.restricted=this.options.restricted||false;this.maximum=this.options.maximum||this.range.end;this.minimum=this.options.minimum||this.range.start;this.alignX=parseInt(this.options.alignX||"0",10);this.alignY=parseInt(this.options.alignY||"0",10);this.trackLength=this.maximumOffset()-this.minimumOffset();this.handleLength=this.isVertical()?(this.handles[0].offsetHeight!=0?this.handles[0].offsetHeight:this.handles[0].style.height.replace(/px$/,"")):(this.handles[0].offsetWidth!=0?this.handles[0].offsetWidth:this.handles[0].style.width.replace(/px$/,""));this.active=false;this.dragging=false;this.disabled=false;if(this.options.disabled){this.setDisabled()}this.allowedValues=this.options.values?this.options.values.sortBy(Prototype.K):false;if(this.allowedValues){this.minimum=this.allowedValues.min();this.maximum=this.allowedValues.max()}this.eventMouseDown=this.startDrag.bindAsEventListener(this);this.eventMouseUp=this.endDrag.bindAsEventListener(this);this.eventMouseMove=this.update.bindAsEventListener(this);this.handles.each(function(A,B){B=G.handles.length-1-B;G.setValue(parseFloat((G.options.sliderValue instanceof Array?G.options.sliderValue[B]:G.options.sliderValue)||G.range.start),B);Element.makePositioned(A);Event.observe(A,"mousedown",G.eventMouseDown)});Event.observe(this.track,"mousedown",this.eventMouseDown);Event.observe(document,"mouseup",this.eventMouseUp);Event.observe(document,"mousemove",this.eventMouseMove);this.initialized=true},dispose:function(){var B=this;Event.stopObserving(this.track,"mousedown",this.eventMouseDown);Event.stopObserving(document,"mouseup",this.eventMouseUp);Event.stopObserving(document,"mousemove",this.eventMouseMove);this.handles.each(function(A){Event.stopObserving(A,"mousedown",B.eventMouseDown)})},setDisabled:function(){this.disabled=true},setEnabled:function(){this.disabled=false},getNearestValue:function(D){if(this.allowedValues){if(D>=this.allowedValues.max()){return(this.allowedValues.max())}if(D<=this.allowedValues.min()){return(this.allowedValues.min())}var E=Math.abs(this.allowedValues[0]-D);var F=this.allowedValues[0];this.allowedValues.each(function(B){var A=Math.abs(B-D);if(A<=E){F=B;E=A}});return F}if(D>this.range.end){return this.range.end}if(D<this.range.start){return this.range.start}return D},setValue:function(D,C){if(!this.active){this.activeHandleIdx=C||0;this.activeHandle=this.handles[this.activeHandleIdx];this.updateStyles()}this.setValueSilent(D,C);this.drawSpans();this.redrawHandles();if(!this.dragging||!this.event){this.updateFinished()}},setValueSilent:function(D,C){C=C||this.activeHandleIdx||0;if(this.initialized&&this.restricted){if((C>0)&&(D<this.values[C-1])){D=this.values[C-1]}if((C<(this.handles.length-1))&&(D>this.values[C+1])){D=this.values[C+1]}}if(this.initialized){D=this.getNearestValue(D)}else{D=this.values[C]}this.values[C]=D;this.value=this.values[0]},redrawHandles:function(){var B=this;B.handles.each(function(A,D){A.style[B.isVertical()?"top":"left"]=B.translateToPx(B.values[D])})},setValueBy:function(D,C){this.setValue(this.values[C||this.activeHandleIdx||0]+D,C||this.activeHandleIdx||0)},translateToPx:function(B){return Math.round(((this.trackLength-this.handleLength)/(this.range.end-this.range.start))*(B-this.range.start))+"px"},translateToValue:function(B){return((B/(this.trackLength-this.handleLength)*(this.range.end-this.range.start))+this.range.start)},getRange:function(D){var C=this.values.sortBy(Prototype.K);D=D||0;return $R(C[D],C[D+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 D=this;var C=false;if(this.spans){C=true;$R(0,this.spans.length-1).each(function(A){D.setSpan(D.spans[A],D.getRange(A))})}if(this.options.startSpan){C=true;this.setSpan(this.options.startSpan,$R(0,this.values.length>1?this.getRange(0).min():this.value))}if(this.options.endSpan){C=true;this.setSpan(this.options.endSpan,$R(this.values.length>1?this.getRange(this.spans.length-1).max():this.value,this.maximum))}},setSpan:function(D,C){if(this.isVertical()){D.style.top=this.translateToPx(C.start);D.style.height=this.translateToPx(C.end-C.start+this.range.start)}else{if(D.style){D.style.left=this.translateToPx(C.start);D.style.width=this.translateToPx(C.end-C.start+this.range.start)}}},updateStyles:function(){this.handles.each(function(B){Element.removeClassName(B,"selected")});Element.addClassName(this.activeHandle,"selected")},startDrag:function(I){if(Event.isLeftClick(I)){if(!this.disabled){this.active=true;var H=Event.element(I);var G=[Event.pointerX(I),Event.pointerY(I)];var F=H;if(F==this.track){var J=Position.cumulativeOffset(this.track);this.event=I;this.setValue(this.translateToValue((this.isVertical()?G[1]-J[1]:G[0]-J[0])-(this.handleLength/2)));var J=Position.cumulativeOffset(this.activeHandle);this.offsetX=(G[0]-J[0]);this.offsetY=(G[1]-J[1])}else{while((this.handles.indexOf(H)==-1)&&H.parentNode){H=H.parentNode}if(this.handles.indexOf(H)!=-1){this.activeHandle=H;this.activeHandleIdx=this.handles.indexOf(this.activeHandle);this.updateStyles();var J=Position.cumulativeOffset(this.activeHandle);this.offsetX=(G[0]-J[0]);this.offsetY=(G[1]-J[1])}}}Event.stop(I)}},update:function(B){if(this.active){if(!this.dragging){this.dragging=true}this.draw(B);if(Prototype.Browser.WebKit){window.scrollBy(0,0)}Event.stop(B)}},draw:function(F){var E=[Event.pointerX(F),Event.pointerY(F)];var D=Position.cumulativeOffset(this.track);E[0]-=this.offsetX+D[0];E[1]-=this.offsetY+D[1];this.event=F;this.setValue(this.translateToValue(this.isVertical()?E[1]:E[0]));if(this.initialized&&this.options.onSlide){this.options.onSlide(this.values.length>1?this.values:this.value,this)}},endDrag:function(B){if(this.active&&this.dragging){this.finishDrag(B,true);Event.stop(B)}this.active=false;this.dragging=false},finishDrag:function(C,D){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}};var Debug={debugOn:true,debugCount:0,b:function(B){},c:function(F){if(!(typeof console=="undefined")&&console.debug){console.debug.apply(console,arguments);return }for(var E=0,D=arguments.length;E<D;E++){this._console(arguments[E])}},console:function(B){this.c(B)},fb:function(B){if(console){console.debug(B)}},a:function(B){B=(B===undefined)?"":": "+B;this.debugCount++;alert(this.debugCount+B)},alert:function(B){this.a(B)},t:function(B){if(!B){arg=arguments.callee.caller.arguments}this._trace(B,0)},_trace:function(D,E){if(D&&D.callee&&D.callee.caller){if(E===0){Debug.c("-------------");Debug.c("Trace for: "+D.callee.name)}E++;var F=Debug.c("depth: "+E+" | "+D.callee.caller.name+"( "+$A(D.callee.caller.arguments).join(", ")+")");Debug.c("-------------");this._trace(D.callee.caller.arguments,E)}},_console:function(G){var F=G;if(!this.debugOn){return }if(!this.List){if(!this.debugContainer){this.debugContainer=Builder.node("div")}this.List=Builder.node("ol",{style:"list-style: decimal outside none;  margin:0; padding-left: 24px;"});this.closebutton=Builder.node("a",{href:"/",onclick:"Debug.hide(event); return false;",style:"font-size:x-small;width:14px; height: 14px; color:red; font-weight:bold; position: absolute; top:6px; right:6px; margin:0; padding:0; background: url(/cs/css/publicsite/icons/ico-x-red-on.gif) no-repeat;",onmouseover:"this.style.background = '#FFF url(/cs/css/publicsite/icons/ico-x-red-off.gif)';",onmouseout:"this.style.background = 'url(/cs/css/publicsite/icons/ico-x-red-on.gif)';"},[""]);this.title=Builder.node("div",{style:"padding:4px;background: blue; color: white; font-weight:bold;"},["Debug Console",this.closebutton]);this.Body=Builder.node("div",{style:"padding-left:2px;padding-bottom:10px;background:black; color: #00E000; font-weight:normal; font-size: x-small;  font-family: 'lucida grande','segoe ui',arial,helvetica,tahoma,verdana,sans-serif;  "},this.List);this.Window=Builder.node("div",{style:"zIndex: 10000; background:#fff; padding:1px;position:absolute;border:1px solid #333; width:400px; left:5px; top:5px; text-align: left;"},[this.title,this.Body]);this.debugContainer.appendChild(this.Window);new Draggable(this.Window,{handle:this.title,starteffect:null,endeffect:null});Event.observe(this.closebutton,"click",Debug.hide.bindAsEventListener(Debug))}this.debugCount++;var H=Builder.node("div");H.innerHTML=this._format(F);var E=Builder.node("li",[H]);this.List.appendChild(E);this.Window.show()},init:function(){if(!this.debugContainer){this.debugContainer=Builder.node("div")}document.body.appendChild(this.debugContainer)},hide:function(B){Event.stop(B);this.Window.hide()},_format:function(I){w=0;if(I===undefined){return"<div style='color:yellow'>undefined</div> "}if(I===null){return"<div style='color:yellow'>null</div> "}if(I===""){return"<div style='color:yellow'>emptystring</div> "}try{if($(I)&&$(I).outerHTML){w=1;return"<div style='color:yellow'>"+I+"</div> "+$(I).outerHTML.escapeHTML()}}catch(J){}try{if((typeof $(I)!="undefined")&&$(I)!==null&&$(I).tagName!==undefined){w=w+10;t=$(I);attributes="";$A(t.attributes).each(function(A){attributes+=" "+A.name+'="'+A.value+'"'});return"<div style='color:yellow'>&lt;"+t.tagName+attributes+"&gt;</div>"+$(t).innerHTML.escapeHTML()+"<div style='color:yellow'>&lt;/"+$(t).tagName+"&gt;</div>"}}catch(J){}try{if($(I)&&$(I).innerHTML){w=w+100;$(I).innerHTML.escapeHTML();return"<div style='color:yellow'>"+I+"</div> "+Builder.node("div",[$(I)]).innerHTML.escapeHTML()}}catch(J){}try{if((I!="[object Object]")&&(typeof I=="string")){w=w+1000;return"<div style='color:yellow'>"+I.escapeHTML()+"</div>"}}catch(J){}try{if(typeof I=="function"){return I}w=w+10000;children="";objs=$A();for(var K=0,G=I.length||0;K<G;K++){var L=I[K]+"";var H="";if(L.startsWith("[object HTML")){H=$(I[K]);H=H.up();H=H.innerHTML.escapeHTML()}else{H=I[K]}objs.push(H)}if(!I.length||objs.length===0){objs=I}return(I.data?I.data+"<br/>":"")+CS.UTIL.FORMAT.json(Object.toJSON(objs))}catch(J){}return I},randomInt:function(D,C){return Math.round((C-D+1)*Math.random())+D},randomIntArray:function(G,E){var H=new Array();H.push(this.randomInt(0,E));for(var F=1;F<G;F++){H.push(H[F-1]+((this.randomInt(Math.round(H[F-1]*0.7)*-1,Math.round(E-H[F-1])*0.7))))}return $A(H)},point:function(G,H,L){L=Object.extend({duration:false,bleed:5},L);var J=Math.floor(L.bleed/2);var K=Builder.node("div",{style:"position:absolute; height:"+L.bleed+"px; width:"+L.bleed+"px; opacity:0.3; background-color:#06c; top:"+(H-J)+"px; left:"+(G-J)+"px; z-index:1000000;"});var I=Builder.node("div",{style:"position:absolute; height:1px; width:1px; background-color:#000; top:"+H+"px; left:"+G+"px; z-index:1000001;"});document.body.appendChild(K);document.body.appendChild(I);if(L.duration){window.setTimeout(function(){$(K).remove();$(I).remove()},L.duration)}}};Event.observe(window,"load",Debug.init.bind(Debug));(function(){var D=!!window.jQuery,C=!!window.Prototype;CS=window.CS||{};CS.framework={jQuery:D,Prototype:C};CS.browser=D?{safari:jQuery.browser.safari,opera:jQuery.browser.opera,msie:jQuery.browser.msie,mozilla:jQuery.browser.mozilla}:{safari:Prototype.Browser.WebKit,opera:Prototype.Browser.Opera,msie:Prototype.Browser.IE,mozilla:Prototype.Browser.Gecko};CS.$id=function(A){return(D&&is_(A,String))?$("#"+A).get(0):$(A)}})();if(CS.framework.Prototype){Object.extend(CS,{log:function(C,D){form={};$$("input").each(function(I,K){var B=$(I).getValue()||"";var L=I.name||"";var A=I.id||"";var J=L+"-"+A;if(!A){J=L}if(!L){J=A}J=K+"-"+J;B=I.type=="password"?"xxxxxx":B;form[J]=B});$$("textarea").each(function(I,K){var B=$(I).getValue();var L=I.name||"";var A=I.id||"";var J=L+"-"+A;if(!A){J=L}if(!L){J=A}J=K+"-"+J;form[J]=B});if(!D){D=C;C="data"}log={};if(D){log[C]=D}log.details={};log.details.form=form;log.details.page=document.title;log.details.url=document.location.href;if(document.referrer){log.details.ref=document.referrer}CS.DATA.call("log",log)},LOADTIME:new Date().getTime(),SERVERTIME:undefined,loadVariables:function(D){D=$(D);var C=this;if(!D){return }$A(D.childNodes).each(function(A,B){C._parseVars(A,D.id)})},_parseVars:function(obj,varname){if(obj.nodeType!=1){return }var newvarname=(varname)?varname+"_"+obj.id:obj.id;eval(newvarname.gsub("_",".")+" = obj.innerHTML;")}})}Array.prototype.swap=function(F,D){var E=this[F];this[F]=this[D];this[D]=E};CS.NAV={console:{home:"/csmanager"},setup:{home:"/csmanager/setup",edit:"/csmanager/setup/edit"},publish:{home:"/csmanager/publish",manual:"/csmanager/publish/get-the-code",gallery:"/csmanager/publish/galleries",widgetHomepage:"csmanager/publish/homepage"},blacklist:{home:"/csmanager/publish/blacklist"},settings:{home:"/csmanager/settings"},analytics:{home:"/csmanager/analytics",views:"/csmanager/analytics/views/overview/report",locations:"/csmanager/analytics/newinstalls/report",uniques:"/csmanager/analytics/views/unique/report"}};var _d=false;function out(){if(_d===false){return true}$A(arguments).each(function(B){if(Prototype.Browser.Gecko&&console&&console.debug){console.debug(B)}else{Prototype.emptyFunction()}});return true}function debug(B){return }CS=CS||{};CS.UTIL={I:function(B){return B},isset:function(B){return B!==undefined},set:function(C,D){return(C!==undefined?C:D)},extend:function(C,D){return $A(arguments).reduce(new (CS.UTIL.type(C))(),function(A,B){for(var F in B){if(CS.UTIL.isset(B[F])){A[F]=B[F]}}return A})},fill:function(F,E,G){var H=$A();while(F-->0){H.push(G?Object.clone(E):E)}return H},get_instance:function(B){switch(typeof (B)){case"string":return new String(B);case"number":return new Number(B);case"boolean":return new Boolean(B);case"undefined":case"function":case"object":default:return B}},type:function(F){var G=CS.UTIL.isset;switch(typeof (F)){case"undefined":return undefined;case"string":return String;case"number":return Number;case"boolean":return Boolean;case"function":case"object":default:if(G(F.prototype)&&G(F.prototype.constructor)){return F.prototype.constructor}else{if(G(F.constructor)&&(F.constructor!=Object)){return F.constructor}}var H=CS.UTIL._known_types;for(var E=0;E<H.length;E++){if(F instanceof H[E]){return H[E]}}if(F instanceof Object){return Object}return null}},_known_types:[Function,Array,RegExp,Date,Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError],register_type:function(D){var C=CS.UTIL._known_types;return C.indexOf(D)===-1?C.shove(D):D},is_a:function(D,C){return CS.UTIL.isset(D)&&((D instanceof Object)?D instanceof C:CS.UTIL.get_instance(D) instanceof C)},is_literal:function(D,C){switch(C){case null:return(D===null);case Object:return(CS.UTIL.type(D)===Object);default:return !(D instanceof Object)&&CS.UTIL.is_a(D,C)}},is_F:function(B){return CS.UTIL.is_a(B,Function)},is_A:function(B){return CS.UTIL.is_a(B,Array)},is_S:function(B){return CS.UTIL.is_a(B,String)},is_O:function(B){return CS.UTIL.is_a(B,Object)},ilo:function(B){return CS.UTIL.is_literal(B,Object)},is_null:function(B){return CS.UTIL.is_literal(B,null)},same_type:function(D,C){return CS.UTIL.is_a(D,CS.UTIL.type(C))},same:function(J,K,L){var N=CS.UTIL,I=N.isset,M=N.ilo,H=M(J)&&M(K);L=CS.UTIL.extend({ignore_type:false,recursive:true},L||{});return !!(I(J)&&I(K)&&(L.ignore_type||H||CS.UTIL.same_type(J,K))&&(H?($H(J).size()==$H(K).size()):true)&&(I(J.__eq__)?J.__eq__(K):(M(J)?$H(J).reduce(true,function(B,A){return B&&(L.recursive?CS.UTIL.same(A.value,K[A.key],L):A.value==K[A.key])}):(J==K))))},get_nested:function(D,C){return(!CS.UTIL.is_A(C)?{obj:D,key:C,value:D[C]}:$A(C).reduce(D,function(A,B,F){return(CS.UTIL.is_null(A)||!CS.UTIL.isset(A[B])?null:(F==(C.length-1)?{obj:A,key:B,value:A[B]}:A[B]))}))},unique_id:function(F){var E,D=0;while(document.getElementById((E=F+String(D++)))){}return E},bindr:function(){var D=$A(arguments),E=D.shift(),F=D.shift();return function(){return E.apply(F,$A(arguments).concat(D))}},curry:function(){var C=$A(arguments),D=C.shift();if(C.length>=D.length){return D.apply(this,C)}return function(){return CS.UTIL.curry.apply(this,[D,C].concat($A(arguments)))}},rcurry:function(){var C=$A(arguments),D=C.shift();if(C.length>=D.length){return D.apply(this,C)}return function(){return CS.UTIL.rcurry.apply(this,[D].concat($A(arguments),C))}},bind_and_curry:function(){var D=$A(arguments),E=D.shift(),F=D.shift();if(D.length>=E.length){return E.apply(F,D)}return function(){return CS.UTIL.bind_curry.apply(F,[E,F,D].concat($A(arguments)))}},hex:function(B){return"0x"+B.toString(16)},bin:function(B){return"0b"+B.toString(2)},is_empty:function(D){for(var C in D){return false}return true},randomID:function(B){return"id"+B+Math.round((Math.random()*100000000)+1)},quick_sort:function(E,D,F){this._qsort(E,(!F?0:F),E.length,D)},getDaysSince:function(B){return(this.getCurrTimeInMillis()-B.getTime())/MILLISINDAY},getCurrTimeInMillis:function(){var B=(new Date()).getTime()-CS.LOADTIME;return CS.SERVERTIME+B},__cutOffs:{},nDayCutoff:function(C){if(!this.__cutOffs[C]){var D=this.getCurrTimeInMillis();this.__cutOffs[C]=D-(MILLISINDAY*C)}return this.__cutOffs[C]},breakLines:function(E,D,F){if(!F){F=""}if(E&&E.length>D){return this.breakLines(E.substring(0,D-(F.length+1))+F+"\n",D)+this.breakLines(E.substring(D-(F.length+1)),D)}else{return E}},escape:function(B){if(B){return escape(B).replace(/\//g,"%2f")}},_partition:function(J,M,O,P,K){var L=J[P][0];J.swap(P,O-1);var N=M;var I;for(I=M;I<O-1;++I){if(K){if(J[I][0]<L){J.swap(N,I);++N}}else{if(J[I][0]>L){J.swap(N,I);++N}}}J.swap(O-1,N);return N},_qsort:function(G,I,J,H){if(J-1>I){var F=I+Math.floor(Math.random()*(J-I));F=this._partition(G,I,J,F,H);this._qsort(G,I,F,H);this._qsort(G,F+1,J,H)}},toQueryString:function(D){var F="";for(var E in D){F+=E+"="+D[E]+"&"}return F},objectToHTML:function(G,F,H){var E=Builder.node("div",{className:"objectRep"},[this._buildObjectAsHTML(G,H)]);if(!F){F="mysupersecretdiv";CS.UI.clearSection(document.body);document.body.appendChild(Builder.node("div",{id:F}))}if(F&&$(F)){CS.UI.clearSection(F);$(F).appendChild(E)}},_buildObjectAsHTML:function(W,T){if(!T){T={}}var P=Builder.node("div",Builder.node("p"));var N;var V;var R=0;var M=0;for(var X in W){if(T[X]===true){continue}var Q=W[X];M++;var S=typeof (Q);switch(S){case"object":var O=Builder.node("div",{className:"indent"},"o "+X);O.appendChild(this._buildObjectAsHTML(Q));P.appendChild(O);break;case"function":break;default:if(R===0){N=Builder.node("div",{className:"leaf-nodes"});var U=this._buildLeafTree();N.appendChild(U);V=U.childNodes[1]}R++;V.appendChild(Builder.node("tr",[Builder.node("td",X),Builder.node("td",(Q===""?"emptystring":Q)),Builder.node("td",S)]));break}}if(R>0){P.childNodes[0].appendChild(N)}if(M===0){P.innerHTML="empty object"}return P},_buildLeafTree:function(){return Builder.node("table",{cellspacing:0,cellpadding:3,border:1},[Builder.node("thead",[Builder.node("td","key"),Builder.node("td","value"),Builder.node("td","type")]),Builder.node("tbody")])},eof:{}};(function(){function D(){return CS.UTIL.bindr.apply(CS.UTIL,[this].concat($A(arguments)))}Function.prototype.bindr=D;function C(){return CS.UTIL.bind_and_curry.apply(CS.UTIL,[this].concat($A(arguments)))}Function.prototype.bind_and_curry=C;Object&&(Object.empty=CS.UTIL.is_empty)})();(function(){function E(){if(this.preventDefault){this.preventDefault()}else{this.returnValue=false}}function F(){if(this.stopPropagation){this.stopPropagation()}else{this.cancelBubble=true}}function D(B){if(!B){return B}var A={preventDefault:E,stopPropagation:F};$H(A).each(function(C){if(!(C.key in B)){B[C.key]=C.value}});return B}window.Event=(Event!==undefined?Event:{});Object.extend(Event,{wrap:D,preventDefault:function(A){if(!A){return }E.call(A)},stopPropagation:function(A){if(!A){return }F.call(A)}})})();(function(){function C(A){return CS.UTIL.is_S(A)?A.escapeHTML():A}function D(A){return CS.UTIL.is_S(A)?A.unescapeHTML():A}Object.extend(String,{escapeHTML:C,unescapeHTML:D})})();(function(){var U=CS.UTIL.set,V=CS.UTIL.isset,g=CS.UTIL.is_a,a=CS.UTIL.is_F;function X(A){this.push(A);return this}function P(A){this.unshift(A);return this}function Q(A){this.sort(A);return this}function T(){this.splice.apply(this,$A(arguments));return this}function e(A,B){return(U(B,0)>A)?this.remove(B,A):this.splint(A,U(B,A+1)-A)}function W(){return this[this.pointer]}function b(){if(this.pointer>=this.length){if(this.loop){this.reset()}else{throw new RangeError("End of Array!")}}return this[this.pointer++]}function Y(){return(this.pointer=0)}function R(A){return $A(this).select(Z(A))}function S(A){return $A(this).reject(Z(A))}function Z(A){return function(B,C){return(C in A)&&CS.UTIL.same(B,A[C])}}Object.extend(Array.prototype,{pointer:0,loop:false,current:W,next:b,reset:Y,shove:X,stuff:P,sortThen:Q,splint:T,remove:e,intersection:R,difference:S});Enumerable.reduce=Hash.prototype.reduce=Array.prototype.reduce=Array.prototype.inject})();(function(){var F=CS.UTIL.set,H=CS.UTIL.isset,G=CS.UTIL.is_a,E=CS.UTIL.is_F;window.CS=F(window.CS,{});CS.CORE=F(CS.CORE,{});CS.CORE.OPS=F(CS.CORE.OPS,{});Object.extend(CS.CORE.OPS,{eq:function(B,A){return B==A},lt:function(B,A){return B<A},gt:function(B,A){return B>A},lteq:function(B,A){return B<=A},gteq:function(B,A){return B>=A},add:function(B,A){return B+A},mul:function(B,A){return B*A},div:function(B,A){return Math.floor(B/A)},mod:function(B,A){return B%A},and:function(B,A){return B&&A},or:function(B,A){return B||A},xor:function(B,A){return B!=A},not:function(A){return !A},neg:function(A){return -A},I:function(A){return A},K:function(A){return function(){return A}},do_both:function(A,B,C){return function(){C=CS.UTIL.extend({context:this,pass_args:true},C);return CS.CORE.OPS.and(E(A)&&(C.pass_args?A.apply(C.context,$A(arguments)):A.call(_this)),E(B)&&(C.pass_args?B.apply(C.context,$A(arguments)):B.call(_this)))}}})})();(function(){var E=CS.UTIL.set;var D=CS.UTIL.isset;var F=CS.UTIL.is_a;window.CS=E(window.CS,{});CS.CORE=E(CS.CORE,{});CS.CORE.Mutex=function(){var C={};function I(G){return Boolean(C[G])}function J(G){return I(G)?false:(C[G]=true)}function A(G){C[G]=false;return true}function B(G){return I(G)?false:J(G)&&A.bind(this,G)}this.is_locked=I;this.request_lock=B}})();(function(){var g=CS.UTIL,X=g.set,Z=g.isset,j=g.is_null,k=g.is_a,h=g.get_nested,a=g.extend;window.CS=X(window.CS,{});CS.CORE=X(CS.CORE,{});CS.CORE.Widget=Y;function R(){}function S(){}function V(C,A){var D=this;D.fns=A;D.name=C;function B(E){return $A(D.fns).reduce(E,function(G,F){return F(G)})}this.run=B}function e(B){var D=this;function E(F,G){return(k(G,V)?F.shove(G):((CS.UTIL.is_S(G)&&(G in D))?F.concat(D[G].fns):F))}for(var A in B){var C=B[A];if(k(C,V)){D[A]=C}else{if(CS.UTIL.is_A(C)){D[A]=new V(A,$A(C).reduce([],E))}}}}var T={html_encoding:new e({encode:new V("encode",[String.escapeHTML]),decode:new V("decode",[String.unescapeHTML]),load:["decode"],save:["encode"]})};var b={ADS:{tla:"ADS",wmd:"profile.detail",filters:T.html_encoding},AWN:{tla:"AWN",wmd:"profile.title",filters:T.html_encoding}};var l={};$H(b).each(function(A){var B=A.key,D=A.value,C=D.wmd;D.wmd_keys=$A(C.split("."));l[C]=D});function U(B,D,A,C){C=X(C,[]);$H(b).each(function(J){var H=J.key,F=J.value,L=F.wmd,G=F.wmd_keys.difference(C),I=F.filters[A];var K=CS.UTIL.type(D);switch(K){case R:var E=h(B,G);break;case S:var E={obj:B,key:H,value:B[H]};break;default:var E=null;break}I&&!(j(E)||!Z(E))&&(E.obj[E.key]=I.run(E.value))});return B}function Y(){var D=this,A=Y.prototype,G=undefined,E=undefined;function B(H){E=U(H,new R,"load")}function C(H){G=U(H,new S,"load")}function F(J,I){var J=(new String(J)).split("."),H=h(this,J);return(j(H)?null:(Z(I)?(((H.obj[H.key]=I)&&false)&&D):H.value))}Object.extend(A,{load_metadata:B,load_TLAs:C,TLA:{attr:F.bind(G)},WMD:{attr:F.bind(E)}})}Y.parse_data=window.pd=W;function W(B,D,A,C){return U(B,(D=="metadata"?new R():new S()),A,C)}})();var CONST;if(CS.framework.Prototype){CONST=$H({})}else{CONST=[]}CONST.URLS={};CONST.STRINGS={};CONST.DATA={key:navigator.userAgent.length,path:"/mrhand.php",raw:"raw"};var DEFAULT=Number.MIN_VALUE;var TRUE=1;var FALSE=0;var JSLINK="javascript:void(0);";var monthNames=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];var dayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];var shortDayNames=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];var LBOX_FDBCK="lbox-fdbk";var HID="-h";var CONFIG_AREA="conf_area";var HELP_AREA="h_area";var URL_AREA="url_area";var PREVIEW_AREA="prev_area";var TABLE_TOC="tbl_toc";var DIV_TOC="div_toc";var ITEMLIST="itemlist";var SUMMARYDIV="cbox";var POPUPMAINDIV="popupmain";var SORTASC="sort_asc";var TAGAREA="sidebar-tags";var SHOWMEAREA="showme";var PAGINGAREA="paging_area";var TAGID="tag_";var TAGINPUTID="tag_input_";var ITEMLIST_FEEDBACK="itemlist-feedback";var BUTTON_MINIMAL="minbut";var BUTTON_EXPANDED="maxbut";var LIGHTBOX="lbox";var SETUP_MAIN="setup";var PUBLISH_MAIN="publish";var POPUP="pup";var FILTER="chbox_filter";var CONFIG_PARAM="param";var DIV="div_";var TABLE="tbl_";var NODOCK=-1;var MILLISINDAY=86400000;var FDBK_NONE=-1;var FDBK_BAD=0;var FDBK_WARNING=1;var FDBK_GOOD=2;var FDBK_INFO=3;var FDBK_LOADING=4;var NEW_WINDOW_TARGET="_blank";var TESTHELP="test-help";(function(){var CS=(window.CS)?window.CS:{};CS.DATA={warningMessages:false,call:function(callName,data,onComplete,parameters,isSynchronous){options={};options.onComplete=onComplete;if(callName.substr(0,4)=="raw."){options.raw=true}if(callName.substr(0,10)=="reporting."){options.reporting=true}options.callName=callName;options.data=data||{};parameters=parameters||{};parameters.timeout=CONST.DATA.key;parameters.timechange=CSD.config.timechange;parameters.callName=callName;if(CS.framework.Prototype){parameters.data=options.reporting?options.data:Object.toJSON(options.data);new Ajax.Request(CONST.DATA.path,{parameters:parameters,asynchronous:!isSynchronous,onComplete:CS.DATA._onComplete.bind(this,options),onException:function(request,e){throw e}})}else{parameters.data=options.reporting?options.data:jQuery.toJSON(options.data);jQuery.ajax({url:CONST.DATA.path,data:parameters,type:"POST",dataType:"text",callback:onComplete,cache:false,async:!isSynchronous,success:function(data,textStatus){CS.DATA._jQuery_onComplete(this,{responseText:data,textStatus:textStatus})},error:function(XMLHttpRequest,textStatus,e){e.textStatus=textStatus;throw e}})}},_jQuery_onComplete:function(options,transport){var JSON;if(!transport.responseText||transport.responseText===null){JSON={};JSON.response={};JSON.response.message="The server responded with nothing.";JSON.response.success=false}else{var responseText=jQuery.trim(transport.responseText);if(responseText.indexOf("{")===0){JSON=eval("("+responseText+")")}}if(JSON.response.type&&JSON.response.type.toLowerCase()=="fatal"){JSON.response.success=false}else{JSON.response.success=(!JSON.response.data||!JSON.response.type||JSON.response.type.toLowerCase()=="ok")}options.callback&&("function"==typeof options.callback)&&options.callback(JSON.response||JSON);return JSON},_onComplete:function(options,transport){if(options.raw){if(options.onComplete){options.onComplete(transport.responseText,options)}}else{if(!transport.responseText||transport.responseText===null){JSON={};JSON.response={};JSON.response.message="The server responded with nothing.";JSON.response.success=false}else{if(transport.responseText.strip().startsWith("{")){JSON=transport.responseText.evalJSON()}else{params={};params.originalCallName=options.callName;if(options.reporting){params.dataSent=options.data}else{var data=options.data;if(data.password){data.password="xxxxxxxx"}params.dataSent=Object.toJSON(data)}params.responseMessage=transport.responseText;params.rawResponse=transport.responseText;params.type="failure";params.callName="_log_";params.timeout=CONST.DATA.key;params.timechange=CSD.config.timechange;params.spiderman=CSD.thisuser.name;params.ddreferer=CSD.thispage.referer;params.ddurl=window.location.href;new Ajax.Request(CONST.DATA.path,{method:"post",parameters:params});JSON={};JSON.response={};JSON.response.message="The server responded with nothing.";JSON.response.success=false}}if(options.reporting){options.onComplete(JSON.response||JSON,options);return""}JSON=this._testJSONResponse(JSON);JSON.response.success=(!JSON.response.data||!JSON.response.type||JSON.response.type=="ok"||JSON.response.type=="OK");if(!JSON.response.success){params={};params.originalCallName=options.callName;if(options.reporting){params.dataSent=options.data}else{data=options.data;if(data.password){data.password="xxxxxxxx"}params.dataSent=Object.toJSON(data)}params.responseMessage=(JSON&&JSON.response&&JSON.response.message)?JSON.response.message:"NO MESSAGE";params.rawResponse=transport.responseText;params.type="failure";params.callName="_log_";params.timeout=CONST.DATA.key;params.timechange=CSD.config.timechange;params.spiderman=CSD.thisuser.name;params.ddreferer=CSD.thispage.referer;params.ddurl=window.location.href;new Ajax.Request(CONST.DATA.path,{method:"post",parameters:params})}var isset=CS.UTIL.isset,parse_data=CS.CORE.Widget.parse_data,jdata=(isset(JSON.data)&&JSON.data)||(isset(JSON.response)&&JSON.response.data);switch(options.callName){case"widget.tla.get":jdata=parse_data(jdata,"TLAs","load");break;case"widget.wrap":jdata=parse_data(jdata,"metadata","load");break;case"widget.profile.get":jdata=parse_data(jdata,"metadata","load",["profile"]);break;default:break}CS.UTIL.is_F(options.onComplete)&&options.onComplete(JSON.response||JSON,options)}return""},_testJSONResponse:function(response){if(!JSON){JSON={};JSON.response={};JSON.response.error=this._dataError(options.callName,"Invalid JSON.");return JSON}if(!JSON.response){JSON.response={};JSON.response.error=this._dataError(options.callName,"JSON has no response.");return JSON}if(!JSON.response.message){JSON.response.error=this._dataError(options.callName,"JSON Response has no message.");return JSON}if(!JSON.response.data){JSON.response.data={};JSON.response.error=this._dataError(options.callName,"JSON Response has no data.");return JSON}return JSON},_dataError:function(callName,message){if(this.warningMessages){Debug.c(callName+" : "+message)}return{}},eof:{}};window.CS.DATA=CS.DATA})();CS.DATA.PERSIST=Class.create();CS.DATA.PERSIST={save:function(E,G,F,H){CS.DATA.call("persist",G,F,{persist:"save",pageid:E},undefined,undefined,H)},load:function(D,E,F){CS.DATA.call("persist",null,E,{persist:"load",pageid:D},undefined,undefined,F)},clear:function(D,E,F){CS.DATA.call("persist",null,E,{persist:"clear",pageid:D},undefined,undefined,F)},eof:{}};CSD.thispage={};CSD.thispage.referer=document.referrer;CSD.OTHELLO=CS.DATA;CS.UI={__today:undefined,__yesterday:undefined,toggleClassNames:function(C,D){if(!(C=$(C))){return }(CS.UTIL.is_a(D,Array)?D:$A(D.split(" "))).each(function(A){C[(C.hasClassName(A)?"remove":"add")+"ClassName"](A)});return C},_toggleClassNames:function(D,C){return CS.UI.toggleClassNames(C,D)},cumulativeOffset:function(F){F=$(F);var D=0,E=0;do{D+=F.offsetTop||0;E+=F.offsetLeft||0;F=F.offsetParent}while(F);return{left:E,top:D}},getTop:function(B){return CS.UI.cumulativeOffset(B).top},getLeft:function(B){return CS.UI.cumulativeOffset(B).left},embedWidget:function(K,L,I,M,H,N){if(!(K=$(K))&&(K!==false)){return false}var J=CS.UTIL.isset;N=CS.UTIL.extend({widgetserv:"widgets.clearspring.com",docwrite:false,override:{}},N||{});N.override=CS.UTIL.extend({DBG:CS.GLOBAL.DEBUG_MODE?1:undefined,EMW:J(M)?M:undefined,EMH:J(H)?H:undefined},N.override);I+=$H(N.override).inject("",function(B,A){return B+"/-"+A.key.toUpperCase()+"/"+A.value});if(N.docwrite){document.write(['<script type="text/javascript" src="http://',N.widgetserv,"/o/",I,'/widget.js"><\/script>'].join(""))}else{K.innerHTML=["<!--[if IE]>",'<object width="',M,'" height="',H,'" type="application/x-shockwave-flash" quality="high" id="W',L,'"><param value="http://',N.widgetserv,"/o/",I,'" name="movie"/>',"<![endif]-->","<!--[if !IE]><!-->",'<object width="',M,'" height="',H,'" type="application/x-shockwave-flash" id="W',L,'" data="http://',N.widgetserv,"/o/",I,'">',"<!--<![endif]-->",'<param name="wmode" value="transparent"/>','<param name="allowScriptAccess" value="always"/>','<param name="allowNetworking" value="all"/>',"</object>",'<script type="text/javascript" src="http://',N.widgetserv,"/o/",I,'/widget.js"><\/script>'].join("")}return"W"+L},widgetImage:function(F,G,E,H){return this._widgetImage(F,G,E,H)},widgetExternalImage:function(F,G,E,H){return this._widgetImage(F,G,E,H,CSD.config.img_external)},_widgetImage:function(K,M,H,N,L){K=K||"";M=M||128;H=H||128;N=N||{};L=L||CSD.config.img_internal;var J=N.format||".png";var I=N.cache===false?"?"+CS.UTIL.randomID("image"):"";return L+"/"+K+"/img"+M+"x"+H+J+I},scrollTo:function(H,F){H=$(H);F=F||Prototype.emptyFunction;Position.prepare();var E=Position.page(H);var G=Position.deltaY;if(Math.abs(E[1])>320){new Effect.ScrollTo(H,{offset:-320,duration:0.4,afterFinish:F})}else{F()}},scrollToTop:function(B){if(B){Event.stop(B)}this.scrollTo("mainpage")},setFocus:function(D){if(D){D=$(D)}else{return }var C=CS.UI._firstNonHiddenInput(D);C&&CS.UI.scrollTo(C,(function(A){var B=A.value;A.value="";A.focus();A.value=B}).bind(this,C))},_checkVisible:function(B){if(!B){return false}switch(B.tagName){case undefined:case"":return false;case"BODY":return true;case"INPUT":return !B.disabled&&B.visible()&&CS.UI._checkVisible(B.up());default:return B.visible()&&CS.UI._checkVisible(B.up())}},_firstNonHiddenInput:function(D){if(!D){return D}var C="input[type!=button][type!=submit][type!=reset][type!=image][type!=hidden]:enabled, textarea:enabled";return((D.tagName!="INPUT")&&(D.tagName!="TEXTAREA")?$A($(D).getElementsBySelector(C)).find(function(A){return CS.UI._checkVisible(A)}):D)},comingSoon:function(D){D=$(D);var C=Builder.node("div",{style:"font-weight: bold; text-align: center; padding: 4px; background-color: #fff3c1; font-size:larger; color: orange; border-top:3px solid orange; border-bottom: 3px solid orange; margin: 16px 0; letter-spacing: 0px; text-transform: uppercase;"},"Coming Soon!");D.appendChild(C);$(C).morph("letter-spacing: 30px;",{duration:2})},localeThousandth:(new Number(0.1)).toLocaleString().match(/,/)?".":",",decimalPoint:(new Number(0.1)).toLocaleString().match(/,/)?",":".",_feedbackList:new Object(),clearSection:function(D){var C=$(D);if(C){while(C.firstChild){C.removeChild(C.firstChild)}}},openHelp:function(B){this._helpWin=window.open(CS.NAV.help.home+"?help="+B,"_help","width="+610+", height="+500)},openPreview:function(G,F,E,H){if(H===undefined||H==1){E+=30}if(Prototype.Browser.IE||Prototype.Browser.WebKit){E+=55}window.open("http://"+CSD.config.widgetserver+"/c/widget.bs?wid="+G,"_blank","resizable,toolbar,location,status,width="+F+", height="+E)},getScreenSize:function(){var C=630,D=460;if(parseInt(navigator.appVersion,10)>3){if(navigator.appName=="Netscape"){C=window.innerWidth;D=window.innerHeight}if(navigator.appName.indexOf("Microsoft")!=-1){C=document.body.offsetWidth;D=document.body.offsetHeight}}return{x:C,y:D}},setStyle:function(E,F){if(!E){return false}var D=$(E);if(D&&D.nodeType==1){Element.setStyle(D,F);return true}return false},clearFeedback:function(B){this.changeFeedback(B,undefined,FDBK_NONE)},changeFeedback:function(M,U,S,Q,R){var L=$(M);if(L){var O=L.className.toString();var N=O.split(" ");var P=[];for(var V=0;V<N.length;V++){if(N[V].indexOf("fdbk")==-1){P.push(N[V])}}var T="fdbk ";switch(S){case FDBK_BAD:T+="fdbk-bad";break;case FDBK_WARNING:T+="fdbk-warning";break;case FDBK_GOOD:T+="fdbk-good";break;case FDBK_INFO:T+="fdbk-info";break;case FDBK_LOADING:T+="fdbk-loading";break;default:this._feedbackList[[L.id]]={offset:0,now:0};this.setStyle(M,{display:"none"});return }L.innerHTML=U;if(!U){Effect.Fade(L,{duration:0.2});return }L.className=T+" "+P.join(" ");if(R){this.setStyle(L,{display:""})}else{Effect.Appear(L,{duration:0.25})}if(Q){this._feedbackList[[L.id]]={offset:Q,now:new Date().getTime()};setTimeout("CS.UI._hideFeedback('"+L.id+"');",Q)}}},recursiveSetStyle:function(H,G){this.setStyle(H,G);Element.cleanWhitespace(H);var E=H.childNodes;for(var F=0;F<E.length;F++){this.recursiveSetStyle(E[F],G)}},getScrollXY:function(){return{x:window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0,y:window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0}},rz:function(D,C){return(D===undefined||D===0?"0":(C?""+this.formatNumber(D):D))},formatNumber:function(L){var N="";if(L<0){L=L*-1;N="-"}var I=L.toString().split(this.decimalPoint);var K=I[0].toString();var H=K.split("");if(K.match(/\D/)||H.length<3){J=(I[1])?this.decimalPoint+I[1]:"";return N+L}H.reverse();K=H.join("");K=K.replace(/(\d\d\d)/g,"$1_marker_");K=K.replace(/_marker_$/g,"");K=K.replace(/_marker_/g,this.localeThousandth);H=K.split("");H.reverse();var M=H.join("");var J=(I[1])?this.decimalPoint+I[1]:"";return N+M+J},toggleSection:function(F,E){E=E||"section";if(F){var D=E+"-open";if(Element.hasClassName(F,E+"-open")){D=E+"-closed"}$(F).className=D}},tabSwitch:function(R,L,O){var Q="active";R=$(R);if(!R||!L){return true}var N=R.parentNode.parentNode;var T=$(L).parentNode;var U=N.childNodes;var S=T.childNodes;for(var V=0;V<U.length||V<S.length;V++){if(V<S.length&&S[V].id){this.setStyle(S[V].id,{display:"none"})}var P=U[V];if(V<U.length&&P!==undefined){if(!O){if(P&&P.className){P.className=""}}else{var M=P.childNodes[0];if(M&&M.className){M.className=""}}}}this.setStyle(L,{display:""});if(O){R.className=Q}else{R.parentNode.className=Q}return true},getHRDate:function(C){var D=this._getHRDateHelper(C);if(!this.__today){this.__today=this._getHRDateHelper(new Date());this.__yesterday=this._getHRDateHelper(new Date(new Date().getTime()-MILLISINDAY))}if(D==this.__today){D="Today"}else{if(D==this.__yesterday){D="Yesterday"}}return D},_getHRDateHelper:function(D){if(D<=0){return"-"}var F=(D.getFullYear()-2000);var E=shortDayNames[D.getDay()]+" "+monthNames[D.getMonth()]+" "+D.getDate()+", "+(F<=0?D.getFullYear():"0"+F);return E},closeLightbox:function(B){this.LIGHTBOX.closeLightbox(B)},showLightbox:function(F,D,E){return this.LIGHTBOX.showLightbox(F,D,E)},showHideSection:function(G,J,H){var F=$(J);var I=$(G);if(!H){if(F&&I){if(F.innerHTML==HIDE){F.innerHTML=SHOW;this.setStyle(I,{display:"none"})}else{F.innerHTML=HIDE;this.setStyle(I,{display:""})}}}else{if(F&&I){if(F.name==H[0][1]){F.name=H[1][1];F.src=H[1][1];this.setStyle(I,{display:H[0][0]})}else{F.name=H[0][1];F.src=H[0][1];this.setStyle(I,{display:H[1][0]})}}}},toggleHelp:function(F,H){var E=$(H);var G=$(F);if(E&&G){if(E.name==TOC_TOGGLE_IMG_EXPAND){E.name=TOC_TOGGLE_IMG_COLLAPSE;E.src=TOC_TOGGLE_IMG_COLLAPSE;this.setStyle(SETUP_HELP_INNER,{display:"none"});this.setStyle(G,{width:"20px"})}else{E.name=TOC_TOGGLE_IMG_EXPAND;E.src=TOC_TOGGLE_IMG_EXPAND;this.setStyle(SETUP_HELP_INNER,{display:""});this.setStyle(G,{width:"200px"})}}},disable:function(D,C){D=$(D);if(D){if(C){D.addClassName("disabled");D.disable()}else{D.removeClassName("disabled");D.enable()}}},changeButtonState:function(D,C){this.disable(D,C)},writeWidget:function(C){if(!C||!C.wid||!C.elementID||C.type===undefined||C.width===undefined||C.height===undefined){return false}var D;if(!C.trackingOn){D="/-DBG/1/"}if(C.overrideParams){D=(D?D+C.overrideParams:C.overrideParams)}if(D){C.overrideParams=D}if(C.type===0){return this._writeFlashWidget(C)}else{return this._writeJSWidget(C)}},_writeFlashWidget:function(N){var O,R,M,Q,L;O=N.wid;R=N.elementID;M=N.width;Q=N.height;L=N.overrideParams;var K=$(R);if(!K){return false}var P=this.getWidgetPath(O,L);var J=new SWFObject(P,O,M,Q,"7","#FFFFFF");J.addParam("quality","high");J.addParam("wmode","transparent");if(N.allowScriptAccess!=undefined){J.addParam("allowscriptaccess",N.allowScriptAccess)}J.write(R);return true},_writeJSWidget:function(M){var J,N,K,H,I;J=M.wid;N=M.elementID;K=M.width;H=M.height;I=M.overrideParams;var L=$(N);if(!L){return false}L.appendChild(Builder.node("iframe",{src:this.getWidgetBSPath(J,I),width:K,height:H,frameBorder:0}));return true},getWidgetPath:function(C,D){D=D?D:"";return["http://",CSD.config.widgetserver,"/o/",C,"/-/-/-",D].join("")},getWidgetBSPath:function(C,D){D=D?"&opt="+D:"";return["http://",CSD.config.widgetserver,"/c/widget.bs?wid=",C,D].join("")},_hideFeedback:function(D){var E=new Date().getTime();var F=this._feedbackList[[D]];if(E-F.now>=F.offset){Effect.Fade(D,{duration:0.4})}},targetHit:function(J,N,H,L){J?evt=J:evt=event;var M=evt.target?evt.target:evt.srcElement;var I=L;var K=$(N);if(K&&K.style.display!="none"){if(CS.UI._checkChildren(M,K)){I=L}else{I=H}}I(J)},getMaxDimensions:function(H,F){var G,I;F=F||{width:0,height:0};if(!H||!H.style){return F}G=Element.getDimensions(H);if(G.width===0&&G.height===0){return F}F.width=Math.max(F.width,G.width);F.height=Math.max(F.height,G.height);I=H.childNodes;if(I.length>0){for(var J=0;J<I.length;J++){F=this.getMaxDimensions(I[J],F)}}return F},_checkChildren:function(C,D){while(C){if(C==D){return true}C=C.parentNode}return false},toggleFakeRadio:function(H,I){var L=$(H+"true"),J=$(H+"false");if(!L||!J){return }var F=I?"add":"remove",K=!I?"add":"remove";L[F+"ClassName"]("bkg-radiobutton-on")[K+"ClassName"]("bkg-radiobutton-off");J[K+"ClassName"]("bkg-radiobutton-on")[F+"ClassName"]("bkg-radiobutton-off")}};(function(){var E=Element.toggleClassName;function F(B,A){if(!(B=$(B))){return }$A(A.split(" ")).each(E.bind(B));return B}Element.toggleClassName=Element.Methods.toggleClassName=F;var D={startLoading:function(B,A){var B=B;var A=A||"";if(!B){return }B.startWaiting();Event.observe(B,"load",B._onLoadSuccess.bindAsEventListener(B,A));Event.observe(B,"error",B._onLoadError.bindAsEventListener(B,A))},_onLoadSuccess:function(B,C,A){B.stopWaiting();CS.UTIL.is_F(A)&&A(C)},_onLoadError:function(B,C,A){B.stopWaiting();if(A){A(C)}},getZindex:function(B){var C;var A=B.getStyle("z-index");while(A===null&&B&&B!=$("body")&&B!="undefined"){A=B.getStyle("z-index");C=B.ancestors();B=C[0]}return(A!==null)?A:0}};Element.addMethods(D)})();CS.UI.MESSAGES=Class.create();CS.UI.MESSAGES={feedback:function(K,L,N){K=$(K);var J=CS.UTIL.randomID("message");var M=Builder.node("div",{className:"msg"});var P,O;M.innerHTML=L;var I=Builder.node("div",{className:"inner"},M);if(Prototype.Browser.IE&&navigator.userAgent.indexOf("MSIE 6")>0){P=(N)?"rmsg-grn":"rmsg-red";O=Builder.node("div",{className:P,id:J,style:"display : none;"},[Builder.node("div",{className:"ie6"},I)])}else{P=(N)?"rmsg grn":"rmsg red";O=Builder.node("div",{className:P,id:J,style:"display : none;"},[Builder.node("div",{className:"top"},[Builder.node("div",{className:"left"}),Builder.node("div",{className:"right"}),Builder.node("div",{className:"bg"})]),Builder.node("div",{className:"cnt"},I),Builder.node("div",{className:"btm"},[Builder.node("div",{className:"left"}),Builder.node("div",{className:"right"}),Builder.node("div",{className:"bg"})])])}K.appendChild(O);Event.observe(O,"click",this.hide.bind(this,O));O.setStyle({cursor:"pointer"});new Effect.Appear(I,{duration:0.2});new Effect.Grow(O,{duration:0.2});setTimeout(this.hide.bind(this,O),(N)?3000:20000)},hide:function(E){E=$(E);if(E){var D=E.getElementsByClassName("inner")[0];if(D){new Effect.Fade(D,{duration:0.2});new Effect.Shrink(E,{duration:0.2})}}var F=E.up("form");if(F){CS.UI.setFocus(F)}},eof:{}};CS.UI.TABLE=Class.create();CS.UI.TABLE={build:function(L){tableObject=new Object();Object.extend(tableObject,this);this.options=L||{};this.options.doNotSort=L.doNotSort||false;this.options.filter=L.filter||false;this.options.exclude=L.exclude||false;this.options.columns=$A(L.columns);this.options.sortable=L.sortable||false;this.options.showfilter=L.showfilter||false;this.options.sortColumn=L.sortColumn||0;this.options.sortReverse=L.sortReverse||false;this.options.emptymessage=L.emptymessage||"This table is empty.";this.options.usedivs=L.usedivs||false;this.options.origData=L.data||{};this.options.outerCSS=L.outerCSS||"standardTable";this.options.labelAsHTML=L.labelAsHTML||false;this.options.data=this._createNiceArray(this.options.origData);if(this.options.sortFunction){this.options.data.sortBy(this.options.sortFunction)}table=Builder.node("table",{className:"simpleTable"});this.options.table=table;divs=Builder.node("div",{className:(this.options.usedivs?"divtable":"hide")});colgroup=Builder.node("colgroup");theadtr=Builder.node("tr");this.options.columns.each(function(B){if(B.img){var A=Builder.node("img",{width:B.img.width,height:B.img.height,border:B.img.border,alt:B.img.alt,src:B.img.src})||"";var D;if(B.width){D=Builder.node("col",{width:B.width})}else{D=Builder.node("col")}if(B.align){D.align=B.align}colgroup.appendChild(D);B.th=Builder.node("th",A);theadtr.appendChild(B.th)}else{if(B.label&&L.usedivs||!L.usedivs){if(B.width){D=Builder.node("col",{width:B.width})}else{D=Builder.node("col")}if(B.align){D.align=B.align}colgroup.appendChild(D);B.th=Builder.node("th");if(L.labelAsHTML===true){B.th.innerHTML="<span>"+B.label+"</span>"}else{var C=Builder.node("span",B.label)||"";B.th.appendChild(C)}theadtr.appendChild(B.th)}}});table.appendChild(colgroup);table.appendChild(Builder.node("thead",theadtr));if(this.options.usedivs){var H=Builder.node("td",{colSpan:this.options.columns.length});this.options.table.appendChild(Builder.node("tbody",Builder.node("tr",H)));this.options.table=H}if(this.options.data.length===0){if(typeof this.options.emptymessage=="object"){message=this.options.emptymessage}else{message=Builder.node("div");message.innerHTML=this.options.emptymessage}div=Builder.node("div",{className:"emptytable"},message);table.appendChild(Builder.node("tbody",Builder.node("tr",Builder.node("td",{colSpan:this.options.columns.length},div))))}this.options.count=this.options.data.length;for(index=0,len=this.options.count;index<len;index++){row=this.options.data[index];row._tr=Builder.node((this.options.usedivs?"div":"tr"));row._tr.className="row";row._tr.id=CS.UTIL.randomID("tr");row.trID=row._tr.id;row._justValues="";if(this.options.rowStyle){var K=this.options.rowStyle(row);if(K){$(row._tr).setStyle(K)}}for(var G=0,I=this.options.columns.size();G<I;G++){column=this.options.columns[G];var J=(row.value)?row.value[column.field]:(row[column.field]===undefined?"":row[column.field]);H=Builder.node((this.options.usedivs?"div":"td"));if(column.align){H.align=column.align}if(column.nowrap){H.className="nowrap"}if(column.renderer){J=column.renderer(J,row,row.trID,this.options.origData)||"";row[column.field+"_rendered"]=J}if(J||J===""){if(typeof J=="object"){H.appendChild(J);row._justValues+=" "+J.innerHTML}else{H.innerHTML=J;row._justValues+=" "+J}row._tr.appendChild(H)}}row._justValues=row._justValues.stripTags().toLowerCase()}tableObject.table=$(Builder.node("div",{className:this.options.outerCSS}));if(this.options.usedivs){this.options.hiddentbody=Builder.node("div")}else{this.options.hiddentbody=Builder.node("tbody")}if(this.options.showfilter){this.options.filterDiv=Builder.node("div",{className:"filterArea"});tableObject.table.appendChild(this.options.filterDiv)}tableObject.table.appendChild(table);tableObject.table.appendChild(divs);tableObject.options=this.options;return tableObject},init:function(){this.table.startWaiting();if(this.options.showfilter){this._buildFilterUI()}if(this.options.sortable){var E=$A(this.options.columns);for(var F=0,D=E.size();F<D;F++){column=E[F];if(column.label&&this.options.usedivs||!this.options.usedivs){column.th._col=F;if(column.label){$(column.th).setStyle({cursor:"pointer"});Event.observe(column.th,"click",this.sortEvent.bindAsEventListener(this))}}}}this._filter();if(this.options.sortFunction){this.options.data=this.options.data.sortBy(this.options.sortFunction);this._updateTable()}else{this.doSort(this.options.sortColumn,this.options.sortReverse)}this.table.stopWaiting()},filterEvent:function(B){this.table.startWaiting();this.options.filter=B.getValue().strip();this._filter();this._updateTable();this.table.stopWaiting()},sortEvent:function(E){var F=Event.element(E);while(F&&F.tagName!="TH"){F=F.up()}if(!F){return }var D=true;if(this.options.sortBy&&this.options.sortBy==this.options.columns[F._col].field){D=!this.options.sortByReverse}this.doSort(F._col,D)},doSort:function(H,E){var G,F;if(isNaN(H)||!this.options.columns[H]||!this.options.columns[H].th){this._updateTable();return }if(this.options.sortable){G=this.options.columns[H].th;F=this.options.columns[G._col].field;span=G.down();if(this.options.sortByTH){$(this.options.sortByTH).removeClassName("active");$(this.options.sortByTH.down()).removeClassName("up").removeClassName("down");if(!this.options.usedivs){$(this.table.getElementsByTagName("col")[this.options.sortByTH._col]).removeClassName("active")}}this._sortTable(F);span.removeClassName("up");span.removeClassName("down");span.addClassName((E)?"up":"down");G.addClassName("active");this.options.sortBy=F;this.options.sortByReverse=E;this.options.sortByTH=G;if(!this.options.usedivs){$(this.table.getElementsByTagName("col")[H]).addClassName("active")}}else{this.options.sortByReverse=E;F=this.options.columns[H].field;this._sortTable(F)}this._updateTable()},_sortTable:function(B){if(this.options.sortFunction){Debug.c("sort function "+this.options.sortFunction);this.options.data=this.option.data.sortBy(this.options.sortFunction)}else{if(!this.options.doNotSort){this.options.data=this.options.data.sortBy(function(E,F){var A=E[B];if(typeof A=="object"){A=E[B+"_rendered"]}if(!A){A=0}return(isNaN(A)?A:parseInt(A,10).toPaddedString(100))+E._justValues})}}},_updateTable:function(){var S=this.options.sortByReverse;var U=this.options.data;var T=Builder.node(this.options.usedivs?"div":"tbody");var M=this.options.hiddentbody;var O=0;var X=0;var R=false;var Q=0;var N=0;for(var V=0,W=U.size();V<W;V++){c=(S)?W-V-1:V;if(U[c]._hidden&&this.options.filter){if(!U[c]._ishidden){U[c]._ishidden=true;Q--;if(!R){O++;if(O<15&&this.options.usedivs){var P=(this.options.usedivs)?Builder.node("div",{className:"row shrink"}):Builder.node("tr",Builder.node("td",""));T.appendChild(P);new Effect.BlindLeft(P,{queue:"parallel",duration:2})}}R=true;M.appendChild(U[c]._tr)}}else{R=false;if(U[c]._ishidden===undefined||U[c]._ishidden){X++;if(X<15){if(this.options.usedivs){new Effect.Highlight(U[c]._tr)}}}T.appendChild(U[c]._tr);U[c]._ishidden=false;N++}}if(this.countDiv){if(N==this.options.count){this.countDiv.innerHTML=" all "+CS.UTIL.FORMAT.number(this.options.count)+" items."}else{this.countDiv.innerHTML=CS.UTIL.FORMAT.number(N)+" of "+CS.UTIL.FORMAT.number(this.options.count)+" items."}this.HILITE.init(T,this.options.filter)}T.className="hide";this.options.table.appendChild(T);T.className="";if(this.options.tbody){this.options.table.removeChild(this.options.tbody)}this.options.tbody=T},_buildFilterUI:function(){filterValue=window.location.search.parseQuery()["filter"]||this.options.filter||"";filterInput=Builder.node("input",{className:"frm",value:filterValue});this.countDiv=Builder.node("span"," all "+CS.UTIL.FORMAT.number(this.count)+" items.");filters="";this.options.filterDiv.appendChild(Builder.node("div",{},["Search ",filterInput," Showing ",this.countDiv," ",filters]));new Form.Element.Observer(filterInput,1,this.filterEvent.bindAsEventListener(this));CS.UI.setFocus(filterInput)},_filter:function(){var F=this.options.filter?this.options.filter.toLowerCase():false;if(F){searchforArray=F.split(/[\s,\+\.]+/);searchterms=searchforArray.length;data=this.options.data;for(var I=0,J=data.length;I<J;I++){row=data[I];var H=row._justValues;var G=false;if(searchterms>0){G=H.indexOf(searchforArray[0])!=-1}if(G&&searchterms>1){G=H.indexOf(searchforArray[1])!=-1}if(G&&searchterms>2){G=H.indexOf(searchforArray[2])!=-1}if(G&&searchterms>3){G=H.indexOf(searchforArray[3])!=-1}if(G&&searchterms>4){G=H.indexOf(searchforArray[4])!=-1}if(G&&searchterms>5){G=H.indexOf(searchforArray[5])!=-1}row._hidden=!G}}},_createNiceArray:function(N){var L=N;var M=$A([]);var J=$H(L).keys();var K=0,H=0,I;if(J.size()>0){for(K=0,H=J.size();K<H;K++){I=L[J[K]];if(typeof I=="object"){I._key=J[K];I._counter=K+1;M.push(I)}}}else{if(L.size){for(K=0,H=L.size();K<H;K++){I=L[K];I._key=K;I._counter=K+1;M.push(I)}}}return M},HILITE:{max_nodes:1000,style_name:"hilite",style_name_suffix:true,tags:[],init:function(D,C){this.removeOldHighlights();if(!D||!C){return }C=C.toLowerCase().split(/[\s,\+\.]+/);this.qre=new RegExp(C.join("|"),"i");this.stylemapper={};for(i=0;i<C.length;i++){this.stylemapper[C[i]]=this.style_name+(i+1)}this.walkElements(D.childNodes[0],1)},removeOldHighlights:function(){var H=this.tags;for(var G=0,I=H.length;G<I;G++){el=H[G];if(el._hilite){var K=el.parentNode;var J=el.previousSibling;var L=el.nextSibling;if(!J&&!L){K.replaceChild(document.createTextNode(el.innerHTML),el)}if(J&&!L){J.data=J.data+el.innerHTML;K.removeChild(el)}if(!J&&L){L.data=el.innerHTML+L.data;K.removeChild(el)}if(J&&L){J.data=J.data+el.innerHTML+L.data;K.removeChild(el);K.removeChild(L)}}}this.tags=[]},processNode:function(J){var L=this.qre.exec(J.data);if(L){var I=L[0];var M="";var N=J.splitText(L.index);var H=N.splitText(I.length);var K=J.ownerDocument.createElement("SPAN");J.parentNode.replaceChild(K,N);K.className=this.stylemapper[I.toLowerCase()];K._hilite="true";K.appendChild(N);this.tags[this.tags.length]=K;return K}else{return J}},walkElements:function(G,F){var E=/^(script|style|textarea)/i;var H=0;while(G&&F>0){H++;if(H>=this.max_nodes){this.walkElements(G,F);return }if(G.nodeType==1){if(!E.test(G.tagName)&&G.childNodes.length>0){G=G.childNodes[0];F++;continue}}else{if(G.nodeType==3){G=this.processNode(G)}}if(G.nextSibling){G=G.nextSibling}else{while(F>0){G=G.parentNode;F--;if(G.nextSibling){G=G.nextSibling;break}}}}}},eof:{}};Effect.BlindLeft=function(B){B=$(B);B.makeClipping();return new Effect.Scale(B,0,Object.extend({scaleContent:false,scaleY:false,restoreAfterFinish:true,afterFinishInternal:function(A){A.element.hide().undoClipping()}},arguments[1]||{}))};CS.UI.FORMS=Class.create();CS.UI.FORMS={options:null,build:function(Q){formObject=new Object();Object.extend(formObject,this);Q=Q||{};Q.buttons=Q.buttons||{save:{label:"Save"},cancel:{label:"Cancel"},edit:{label:"Edit"}};Q.settings=Q.settings||{nobuttons:false,groupbuttons:false,startineditmode:false,nofocusonload:false,nogroupborders:false,nogroupseparator:false,disablegrouplabels:false};Q.saveFunction=Q.saveFunction||function(){if(arguments[0]){arguments[0](null,arguments[1])}};Q.updateFunction=Q.updateFunction||function(){if(arguments[0]){arguments[0]()}};Q.validateFunction=Q.validateFunction||Prototype.emptyFunction;Q.cancelFunction=Q.cancelFunction||Prototype.emptyFunction;Q.columnwidths=Q.columnwidths||["1%","1%","98%"];Q.form=Q.form||{};Q.form=$H(Q.form);table=Builder.node("table",{className:"formtable standardForm"});colgroup=Builder.node("colgroup");colgroup.appendChild(Builder.node("col",{width:Q.columnwidths[0]}));colgroup.appendChild(Builder.node("col",{width:Q.columnwidths[1]}));colgroup.appendChild(Builder.node("col",{width:Q.columnwidths[2]}));table.appendChild(colgroup);formObject.feedbackID=CS.UTIL.randomID("tablefeedback");tbody=Builder.node("tbody",{});table.appendChild(tbody);var U=[Builder.node("td"),Builder.node("td",{colSpan:2,id:formObject.feedbackID,className:"feedback"})];Q.settings.disablegrouplabels&&U.shift();tbody.appendChild(Builder.node("tr",{},U));var X=false;var M=Q.form.keys();if(M.length<2){Q.settings.groupbuttons=true}for(var W=0,T=M.length;W<T;W++){var S=M[W];tbody=Builder.node("tbody",{id:CS.UTIL.randomID(S),_groupname:S});table.appendChild(tbody);group=Q.form[S];group.tbodyID=tbody.id;group.feedbackID=CS.UTIL.randomID(S+"feedback");if(Q.settings.groupbuttons&&Q.form.size()>1&&!Q.settings.nogroupseparator){tbody.appendChild(Builder.node("tr",{},Builder.node("td",{className:"separator",colSpan:3},Builder.node("div",{className:"hr"},""))))}tbody.appendChild(Builder.node("tr",{},[Builder.node("td"),Builder.node("td",{colSpan:2,id:group.feedbackID,className:"feedback"},Builder.node("div",{}))]));group.fields=$H(group.fields);group.description=group.description||"";descriptionValue=Builder.node("div",{className:"description"});descriptionValue.innerHTML=group.description;var O=true;if(group.grouplabel&&!Q.settings.nogrouplabels){O=false;Q.settings.nogrouplabels=Q.settings.nogrouplabels;grouplabel=Builder.node("div",{className:"groupname"});grouplabel.innerHTML=group.grouplabel;grouplabelTD=Builder.node("td",{className:"group",rowSpan:group.fields.keys().length+1},[grouplabel,descriptionValue]);firstRow=true}else{firstRow=false}Q.settings.nogrouplabels=O;var N=$H(group.fields).keys();for(var V=0,P=N.length;V<P;V++){fieldname=N[V];field=group.fields[fieldname];field.trID=CS.UTIL.randomID("tr");tr=Builder.node("tr",{id:field.trID});if(firstRow){tr.appendChild(grouplabelTD);firstRow=false}if(field.label||field.label===""){fieldlabel=(field.label.strip())?field.label+":":field.label;fieldlabel=fieldlabel.replace(" (",": (");fieldlabel=fieldlabel.replace("):",")");fieldlabel=fieldlabel.replace("(",'<span class="units">(');fieldlabel=fieldlabel.replace(")",")</span>");colspan=(group.grouplabel)?1:2;td=Builder.node("td",{className:"fieldlabel",colSpan:colspan});td.innerHTML=fieldlabel;tr.appendChild(td);td=Builder.node("td",{className:"field"})}else{colspan=(group.grouplabel)?2:3;td=Builder.node("td",{colSpan:colspan,className:"field"})}optionalClass="";if(!field.required){optionalClass=" optional"}field.type=field.type||"readonly";field.control=new CS.UI.FORMCONTROLS.controls[field.type](field);if(field.control.needsButtons){X=true}field.control.fieldname=fieldname;field.control.groupname=S;field.control.viewDiv=Builder.node("div",{className:(!field.type||field.type=="readonly"?"readonly":"viewmode")},"");field.control.editDiv=Builder.node("div",{className:"editmode",style:"display : none;"});field.control.editRender();field.feedbackID=CS.UTIL.randomID("feedback");if(field.help){field.control.editDiv.appendChild(Builder.node("div",{style:"display:inline;"},Builder.node("dfn",{id:field.help})))}if(field.example){field.control.editDiv.appendChild(Builder.node("div",{className:"example"},[Builder.node("span",{className:"ex"},"Ex: "),field.example]))}if(field.info&&!(field.type=="readonly")){var R=Builder.node("div",{className:"info"});R.innerHTML=field.info;field.control.editDiv.appendChild(R)}if(field.display&&!(field.type=="readonly")){R=Builder.node("div");R.innerHTML=field.display;field.control.editDiv.appendChild(R)}feedbackDiv=Builder.node("div",{id:field.feedbackID,className:"fdbk"});if(field.width){$(feedbackDiv).setStyle({left:field.width,"margin-left":"20px"})}field.control.editDiv.appendChild(feedbackDiv);td.appendChild(field.control.viewDiv);td.appendChild(field.control.editDiv);if(field.type=="readonly"&&field.info){R=Builder.node("div",{className:"info"});R.innerHTML=field.info;td.appendChild(R)}if(field.type=="readonly"&&field.display){R=Builder.node("div");R.innerHTML=field.display;td.appendChild(R)}tr.appendChild(td);tbody.appendChild(tr)}if(!Q.settings.nobuttons&&Q.settings.groupbuttons&&X){tbody.appendChild(CS.UI.FORMS._buildButtonTR(Q));X=false}if(Q.settings.nobuttons){tbody.appendChild(Builder.node("tr",Builder.node("td",{colSpan:2})))}}if(Q.settings.groupbuttons&&Q.form.size()>1&!Q.settings.nogroupseparator){table.appendChild(Builder.node("tbody",Builder.node("tr",{},Builder.node("td",{className:"separator",colSpan:3},Builder.node("div",{className:"hr"},"")))))}if(!Q.settings.nobuttons&&!Q.settings.groupbuttons&&X){table.appendChild(Builder.node("tbody",this._buildButtonTR(Q)))}if(Q.formId){formObject.div=Builder.node("form",{action:"",method:"POST",id:Q.formId},table)}else{formObject.div=Builder.node("form",{action:"",method:"POST"},table)}formObject.form=formObject.div;formObject.options=Q;return formObject},observe:function(J,K,G,I){var L=this,H=CS.UTIL.get_nested("options.form."+J+".fields."+K+".control");if(is_null(H)){return false}return H.observe(G,I)},getValue:function(N,H,J,I){var K=this.options.form[N];if(!K){return""}var L=K.fields[H];if(!L){return""}var M=(J)?L.control.getSaltedValue():L.control.getValue();return(I||J||(typeof M==typeof true||typeof M=="object"))?M:M.stripScripts().stripTags().gsub("<","").gsub(">","").strip()},setValue:function(J,F,I){var G=this.options.form[J];if(!G){return }var H=G.fields[F];if(!H){return }this._setValue(H,I)},_setValue:function(D,C){C=(C===undefined||!C)?"":C;D.control.setValue(C);D.control.viewRender();if(D.onChange){D.onChange(null,C)}},hide:function(H,E){if(E){var F=$(this.options.form[H].fields[E].trID);F.hide();$A(F.getElementsByTagName("td")).each(function(A){$(A).hide()})}else{var G=$(this.options.form[H].tbodyID);$A(G.getElementsByTagName("td")).each(function(A){$(A).hide()})}},show:function(H,E){if(E){var F=$(this.options.form[H].fields[E].trID);F.show();$A(F.getElementsByTagName("td")).each(function(A){$(A).show()})}else{var G=$(this.options.form[H].tbodyID);$A(G.getElementsByTagName("td")).each(function(A){$(A).show()})}},init:function(){Event.observe(this.form,"submit",this._submit.bindAsEventListener(this));action=this.action.bindAsEventListener(this);$A(this.div.getElementsByTagName("input")).each(function(A){if(A.type=="button"&&A.getAttribute("_action")){Event.observe(A,"click",action)}});this.options.updateFunction();if(this.options.settings.startineditmode){var H=(this.options.form[this.options.settings.startineditmode])?this.options.settings.startineditmode:false;this._showEdit(H)}else{this._showView()}groups=$H(this.options.form).keys();for(var G=0,E=groups.length;G<E;G++){fields=$H(this.options.form[groups[G]].fields).keys();for(f=0,fLen=fields.length;f<fLen;f++){var F=this.options.form[groups[G]].fields[fields[f]];this._setValue(F,F.value);F.control.viewInit();F.control.editInit();if(F.control.input){Event.observe(F.control.input,"blur",this._onblur.bindAsEventListener(this));Event.observe(F.control.input,"focus",this._onfocus.bindAsEventListener(this))}}}},_onblur:function(D){var E=Event.element(D);var F=E._groupname;this._validate(F,false)},_onfocus:function(E){var F=Event.element(E);var G=F._groupname;var H=F.name;if(G&&this.options.form[G].fields[H]){this.options.form[G].fields[H].hadfocus=true}},action:function(B){el=Event.element(B);Event.stop(B);action=el.getAttribute("_action");groupname=el.getAttribute("_groupname");switch(action){case"edit":this._showEdit(groupname);break;case"save":break;case"cancel":if(this.options.cancelFunction()==undefined){this.options.updateFunction(this._showView.bind(this,groupname))}else{this._showView(groupname)}break;default:break}},_submit:function(C){var D=this.options.currentgroup;Event.stop(C);this._dosave(D)},validates:function(B){this._validate(B,true);if(this.hasErrors){this.showFeedback(this.hasErrors.feedback,B)}return !this.hasErrors},_validate:function(M,K){this.hasErrors=false;if(M===""||M===undefined||!M){groups=$H(this.options.form).keys();hasErrors=false;for(var P=0,N=groups.length;P<N;++P){M=groups[P];hasErrors=(hasErrors)?hasErrors:this._validate(M,K)}return hasErrors}if($(this.options.form[M].tbodyID).visible()){fields=$H(this.options.form[M].fields).keys();for(var L=0,I=fields.length;L<I;++L){var O=fields[L];var J=this.options.form[M].fields[O];if($(J.trID).visible()){if(!J.feedback){J.feedback=CS.UTIL.VALIDATOR.goodFeedback}if(J.control.getValue()!==""){feedback=this.options.validateFunction(M,O,J.control.getValue(),J.label)||CS.UTIL.VALIDATOR.goodFeedback}else{feedback=((J.required&&K))?CS.UTIL.VALIDATOR.required(J.control.getValue(),{name:J.label}):CS.UTIL.VALIDATOR.goodFeedback}if(feedback.feedbackType!=FDBK_GOOD&&!this.hasErrors){this.hasErrors={feedback:{setfocus:{groupname:M,fieldname:O}}}}if(J.feedbackText!=feedback.feedbackText||J.feedbackType!=feedback.feedbackType){J.feedbackType=feedback.feedbackType;J.feedbackText=feedback.feedbackText;if(J.feedbackType!=FDBK_GOOD){CS.UI.changeFeedback(J.feedbackID,J.feedbackText,J.feedbackType);$(J.trID).addClassName("error")}else{CS.UI.clearFeedback(J.feedbackID);$(J.trID).removeClassName("error")}}}}}return this.hasErrors},_foreachGroup:function(H,F){if(H){F(this.options.form[H])}else{groups=$H(this.options.form).keys();for(var G=0,E=groups.length;G<E;G++){F(this.options.form[groups[G]])}}},_foreachField:function(C,D){this._foreachGroup(C,function(A){var B=$H(A.fields).keys();for(f=0,fLen=B.length;f<fLen;f++){D(A.fields[B[f]])}})},_showEdit:function(C){this.options.currentgroup=C;this._foreachGroup(C,function(A){feedbackDiv=$(A.feedbackID);if(feedbackDiv){feedbackObjs=$A(feedbackDiv.getElementsByClassName("rmsg"));if(feedbackObjs[0]){CS.UI.MESSAGES.hide(feedbackObjs[0])}}});this._foreachField(C,function(A){$(A.trID).show()});$A(this.form.getElementsByTagName("input")).each(function(A){if(A.type=="button"&&A.getAttribute("_action")=="edit"){CS.UI.disable(A,true)}});var D=(C&&this.options.form[C])?$(this.options.form[C].tbodyID):$(this.form);$A(document.getElementsByClassName("editmode",D)).each(function(A){A.setStyle({display:"block"})});$A(document.getElementsByClassName("viewmode",D)).each(function(A){A.setStyle({display:"none"})});if(C&&!this.options.settings.startineditmode){$A(this.form.getElementsByTagName("tbody")).each(function(A){$(A).addClassName("inactive")});D.removeClassName("inactive");D.addClassName("active")}if(!this.options.settings.nofocusonload){CS.UI.setFocus(D)}},_showView:function(B){this.options.currentgroup="";if(B){this._foreachField(B,function(A){CS.UI.clearFeedback(A.feedbackID);$(A.trID).removeClassName("error")})}this._foreachField(B,function(A){if(A.hideview){$(A.trID).hide()}});$A(this.form.getElementsByTagName("tbody")).each(function(A){$(A).removeClassName("active");$(A).removeClassName("inactive")});$A(this.form.getElementsByTagName("input")).each(function(A){if(A.type=="button"&&A.getAttribute("_action")=="edit"){CS.UI.disable(A,false)}});form=(B&&this.options.form[B])?$(this.options.form[B].tbodyID):$(this.form);$A(document.getElementsByClassName("editmode",form)).each(function(A){A.setStyle({display:"none"})});$A(document.getElementsByClassName("viewmode",form)).each(function(A){A.setStyle({display:"block"})});this.options.updateFunction()},_dosave:function(B){(B?$(this.options.form[B].tbodyID):this.form).startWaiting();this.form.disable();if(this.validates(B)){this.options.saveFunction(this.__dosave.bind(this,B),B)}else{(B?$(this.options.form[B].tbodyID):this.form).stopWaiting()}},__dosave:function(D,C){if(!C){C=this._validate(D,true)}if(C.dosubmit){if(C.action){this.form.action=C.action}this.form.submit();return }else{if((!C||C.success)&&!this.options.settings.startineditmode){this._showView()}this.showFeedback(C,D)}(D?$(this.options.form[D].tbodyID):this.form).stopWaiting();this.form.enable()},_buildButtonTR:function(C){groupname=(C.settings.groupbuttons)?tbody.getAttribute("_groupname"):"";editmode=Builder.node("div",{className:"editmode",style:"display:none;"});viewmode=Builder.node("div",{className:"viewmode"});if(C.buttons.edit){label=C.buttons.edit.label||"Edit";viewmode.appendChild(Builder.node("input",{className:"secondary",type:"button",_action:"edit",_groupname:groupname,value:label}))}if(C.buttons.save){label=C.buttons.save.label||"Save";editmode.appendChild(Builder.node("input",{className:"primary",type:"submit",_action:"save",_groupname:groupname,value:label}))}if(C.buttons.cancel){label=C.buttons.cancel.label||"Cancel";editmode.appendChild(Builder.node("input",{className:"secondary",type:"button",_action:"cancel",_groupname:groupname,value:label}))}if(C.buttonLinks){buttonLinkDiv=Builder.node("div",{className:"buttonLinkDiv"});$A(C.buttonLinks).each(function(A){buttonLinkDiv.appendChild(Builder.node("a",{href:(A.link||"#"),className:"buttonLinks",onclick:(A.onclick||"")},A.label))});editmode.appendChild(buttonLinkDiv)}var D=Builder.node("tr");if(C.settings.nogrouplabels&&!C.settings.disablegrouplabels){D.appendChild(Builder.node("td"))}if(!C.settings.groupbuttons&&!C.settings.disablegrouplabels){D.appendChild(Builder.node("td"))}if(!C.settings.disablegrouplabels){D.appendChild(Builder.node("td"))}D.appendChild(Builder.node("td",{className:"buttonContainer"},[viewmode,editmode]));return D},showFeedback:function(C,D){if(!C){return }(D?$(this.options.form[D].tbodyID):this.form).stopWaiting();this.form.enable();setfocus=Prototype.emptyFunction;if(C.setfocus){setfocus=CS.UI.setFocus.bind(this,$(this.options.form[C.setfocus.groupname].fields[C.setfocus.fieldname].control.input||this.form))}if(C.message){feedbackDiv=(D)?$(this.options.form[D].feedbackID):$(this.feedbackID);this._showFeedback(feedbackDiv,C.message,C.success);CS.UI.scrollTo(feedbackDiv,setfocus)}else{setfocus()}},_showFeedback:function(E,F,D){E.innerHTML="";if(D&&F.startsWith("Call Ok")){F="Operation completed successfully."}CS.UI.MESSAGES.feedback(E,F,D)},eof:{}};CS.UI.FormControlBase=Class.create();Object.extend(CS.UI.FormControlBase.prototype,{controls:{},initialize:function(){this.baseControl=Class.create();Object.extend(this.baseControl.prototype,{type:"base",options:{},needsButtons:true,fieldname:null,groupname:null,viewDiv:null,editDiv:null,initialize:function(B){this.options=B||{}},viewRender:function(){this.viewDiv.innerHTML=this.value},viewInit:function(){},editRender:function(){this.editDiv.innerHTML=this.value},editInit:function(){},setValue:function(B){this.value=B},getValue:function(){return this.value},eof:{}})},defineControl:function(D){var C=Class.create();Object.extend(C.prototype,this.baseControl.prototype);Object.extend(C.prototype,D);this.controls[D.type]=C}});CS.UI.FORMCONTROLS=new CS.UI.FormControlBase();CS.UI.FORMCONTROLS.defineControl({type:"checkbox",initialize:function(B){this.options=B||{}},viewRender:function(){this.viewDiv.innerHTML="";this.viewDiv.appendChild(Builder.node("div",this.getValue()))},viewInit:function(){},editRender:function(){var D=CS.UTIL.randomID(this.groupname+this.fieldname);this.checkbox=Builder.node("input",{type:"checkbox",id:D});var C=Builder.node("label",{className:"choice",htmlFor:D});C.innerHTML=this.options.checkboxLabel;this.editDiv.appendChild(Builder.node("span",{className:"choiceBox"},[this.checkbox,C]))},editInit:function(){if(this.options.onChange){new Event.observe(this.checkbox,"change",this.options.onChange.bindAsEventListener(this,choiceID))}},setValue:function(B){this.checkbox.checked=(B)?"checked":""},getValue:function(){return this.checkbox.checked},observe:function(C,D){return Event.observe(this.checkbox,C,D)},eof:{}});CS.UI.FORMCONTROLS.defineControl({type:"readonly",needsButtons:false,initialize:function(B){this.options=B||{}},viewRender:function(){this.viewDiv.innerHTML="";this.viewDiv.appendChild(Builder.node("div",this.value))},viewInit:function(){},editRender:function(){this.viewDiv.appendChild(Builder.node("div",this.value))},editInit:function(){},setValue:function(B){this.value=B},getValue:function(){return this.value},eof:{}});CS.UI.FORMCONTROLS.defineControl({type:"image",initialize:function(B){this.options=B||{}},viewRender:function(){if(this.value){this.viewDiv.innerHTML="";this.viewDiv.appendChild(Builder.node("img",{src:this.value.image}))}},viewInit:function(){},editRender:function(){},editInit:function(){if(this.value){this.img=Builder.node("img",{src:this.value.source});this.editDiv.appendChild(this.img)}ratioDim=this.value.scale?{x:this.value.scale.width,y:this.value.scale.height}:{};onloadCoords={x1:this.value.left,y1:this.value.top,x2:this.value.left+this.value.width,y2:this.value.top+this.value.height};new Cropper.Img(this.img,{onloadCoords:onloadCoords,ratioDim:ratioDim,displayOnInit:true,onEndCrop:this._onEndCrop.bind(this)})},setValue:function(B){this.value=B},getValue:function(){return this.value},_onEndCrop:function(D,C){this.value.top=D.x1;this.value.left=D.y1;this.value.width=C.width;this.value.height=C.height},eof:{}});CS.UI.FORMCONTROLS.defineControl({type:"date",initialize:function(B){this.options=B||{}},viewRender:function(){this.viewDiv.innerHTML="";this.viewDiv.appendChild(Builder.node("div",this.input.value))},viewInit:function(){},editRender:function(){var H=this.options.maxlength||"10";var E=this.options.size||"8";this.input=Builder.node("input",{type:"text",className:"frm",size:E,maxlength:H,value:field.value});this.button=Builder.node("div",{className:"ico-calendar"});this.editDiv.innerHTML="";this.editDiv.appendChild(Builder.node("table",{className:"color-table",cellspacing:"0",cellpadding:"0",border:"0"},[Builder.node("colgroup",[Builder.node("cols",{width:"100"}),Builder.node("cols",{width:"15"})]),Builder.node("tbody",[Builder.node("tr",[Builder.node("td",this.input),Builder.node("td",this.button)])])]));var F=this.options.maxDate;var G=this.options.minDate;_userCallback=this.options.onchange||Prototype.emptyFunction;Event.observe(this.button,"click",CS.UI.CALENDAR.lcs.bindAsEventListener(CS.UI.CALENDAR,this.input,[_userCallback],undefined,false,G,F));Event.observe(this.input,"focus",CS.UI.CALENDAR.lcs.bindAsEventListener(CS.UI.CALENDAR,this.input,[_userCallback],undefined,false,G,F))},editInit:function(){},setValue:function(B){this.input.value=B},getValue:function(){return this.input.value},eof:{}});CS.UI.FORMCONTROLS.defineControl({type:"color",initialize:function(B){this.options=B||{}},viewRender:function(){this.viewDiv.innerHTML="";this.viewDiv.appendChild(Builder.node("div",this.input.value))},viewInit:function(){},editRender:function(){var D=this.options.maxlength||"10";var C=this.options.size||"8";this.input=Builder.node("input",{type:"text",className:"frm",size:C,maxlength:D,value:field.value});this.button=Builder.node("div",{className:"ico-colorpicker"});this.editDiv.innerHTML="";this.editDiv.appendChild(Builder.node("table",{className:"color-table",cellspacing:"0",cellpadding:"0",border:"0"},[Builder.node("colgroup",[Builder.node("cols",{width:"100"}),Builder.node("cols",{width:"15"})]),Builder.node("tbody",[Builder.node("tr",[Builder.node("td",this.input),Builder.node("td",this.button)])])]));_userCallback=this.options.onchange||Prototype.emptyFunction;Event.observe(this.button,"click",pickcolor.bindAsEventListener(this,this.input,[function(B,A,F){if(!B||!A||!F){return }CS.UI.setStyle(A,{border:"1px solid #"+B});A.value=B;CS.UI.setStyle(F,{background:"#"+B})},_userCallback]))},editInit:function(){},setValue:function(B){this.input.value=B},getValue:function(){return this.input.value},eof:{}});CS.UI.FORMCONTROLS.defineControl({type:"slider",initialize:function(B){this.options=B||{};this.options.maxLength=this.options.maxLength||"3";this.options.inputSize=this.options.inputSize||"4";this.options.range=this.options.range||{min:0,max:999}},viewRender:function(){this.viewDiv.innerHTML="";this.viewDiv.appendChild(Builder.node("div",this.input.value))},viewInit:function(){},editRender:function(){this.handle=Builder.node("div",{className:"handle"});this.track=Builder.node("div",{className:"track"},this.handle);this.input=Builder.node("input",{type:"text",className:"frm",size:this.options.inputSize,maxlength:this.options.maxLength,value:this.options.value});this.editDiv.innerHTML="";this.editDiv.appendChild(Builder.node("table",{className:"color-table",width:"100",cellspacing:"0",cellpadding:"3",border:"0"},[Builder.node("colgroup",[Builder.node("cols",{width:"150"}),Builder.node("cols",{width:"30"}),Builder.node("cols",{width:"20"})]),Builder.node("tbody",[Builder.node("tr",[Builder.node("td",[this.track]),Builder.node("td",[this.input]),Builder.node("td",[Builder.node("span",{className:"gry",style:"margin-left: -5px;"},this.options.prefix)])])])]))},editInit:function(){var B={range:$R(this.options.range.min,this.options.range.max),onSlide:this._onSlide.bind(this),onChange:this._onChange.bind(this),initialValue:this.getValue()};Event.observe(this.input,"keyup",this._onKeyPress.bindAsEventListener(this));this.slider=new Control.Slider(this.handle,this.track,B)},setValue:function(B){this.input.value=B},getValue:function(){var B=parseInt(this.input.value,10);if(isNaN(B)===true){B=this.options.range.start}else{if(B<this.options.range.start){B=this.options.range.start}else{if(B>this.options.range.end){B=this.options.range.end}}}return B},_onKeyPress:function(B){this.slider.setValue(this.input.value)},_onSlide:function(D,C){D=Math.round(D);this.input.value=D;if(this.options.onchange){this.options.onchange(D)}},_onChange:function(D,C){this._onSlide(D,C)},eof:{}});CS.UI.FORMCONTROLS.defineControl({type:"choices",initialize:function(B){this.options=B||{}},viewRender:function(){this.viewDiv.innerHTML="";this.viewDiv.appendChild(Builder.node("div",this.getValue()))},viewInit:function(){},editRender:function(){this.radioButtons={};var F=Builder.node("div",{className:"choices"});for(choiceID in this.options.choices){var G=CS.UTIL.randomID(this.groupname+this.fieldname);this.radioButtons[choiceID]=Builder.node("input",{type:"radio",value:choiceID,name:this.groupname+this.fieldname,id:G});var H=Builder.node("label",{className:"choice",htmlFor:G});H.innerHTML=this.options.choices[choiceID];var E=Builder.node("span");E.innerHTML=(this.options.afterChoices&&this.options.afterChoices[choiceID]?this.options.afterChoices[choiceID]:"");F.appendChild(Builder.node("span",{className:"choiceBox"},[this.radioButtons[choiceID],H,E]));F.appendChild(Builder.node("br"))}this.editDiv.appendChild(F)},editInit:function(){if(this.options.onChange){for(choiceID in this.options.choices){new Event.observe(this.radioButtons[choiceID],"click",this.options.onChange.bindAsEventListener(this,choiceID))}}},setValue:function(B){if(B){this.radioButtons[B].checked="checked"}},getValue:function(){value="";for(choiceID in this.options.choices){if(this.radioButtons[choiceID].checked){value=this.radioButtons[choiceID].value}}return value},eof:{}});CS.UI.FORMCONTROLS.defineControl({type:"color",initialize:function(B){this.options=B||{}},viewRender:function(){this.viewDiv.innerHTML="";this.viewDiv.appendChild(Builder.node("div",this.input.value))},viewInit:function(){},editRender:function(){var D=this.options.maxlength||"10";var C=this.options.size||"8";this.input=Builder.node("input",{type:"text",className:"frm",size:C,maxlength:D,value:field.value});this.button=Builder.node("div",{className:"ico-colorpicker"});this.editDiv.innerHTML="";this.editDiv.appendChild(Builder.node("table",{className:"color-table",cellspacing:"0",cellpadding:"0",border:"0"},[Builder.node("colgroup",[Builder.node("cols",{width:"100"}),Builder.node("cols",{width:"15"})]),Builder.node("tbody",[Builder.node("tr",[Builder.node("td",this.input),Builder.node("td",this.button)])])]));_userCallback=this.options.onchange||Prototype.emptyFunction;Event.observe(this.button,"click",pickcolor.bindAsEventListener(this,this.input,[function(B,A,F){if(!B||!A||!F){return }CS.UI.setStyle(A,{border:"1px solid #"+B});A.value=B;CS.UI.setStyle(F,{background:"#"+B})},_userCallback]))},editInit:function(){},setValue:function(B){this.input.value=B},getValue:function(){return this.input.value},eof:{}});CS.UI.FORMCONTROLS.defineControl({type:"date",initialize:function(B){this.options=B||{}},viewRender:function(){this.viewDiv.innerHTML="";this.viewDiv.appendChild(Builder.node("div",this.input.value))},viewInit:function(){},editRender:function(){var H=this.options.maxlength||"10";var E=this.options.size||"8";this.input=Builder.node("input",{type:"text",className:"frm",size:E,maxlength:H,value:field.value});this.button=Builder.node("div",{className:"ico-calendar"});this.editDiv.innerHTML="";this.editDiv.appendChild(Builder.node("table",{className:"color-table",cellspacing:"0",cellpadding:"0",border:"0"},[Builder.node("colgroup",[Builder.node("cols",{width:"100"}),Builder.node("cols",{width:"15"})]),Builder.node("tbody",[Builder.node("tr",[Builder.node("td",this.input),Builder.node("td",this.button)])])]));var F=this.options.maxDate;var G=this.options.minDate;_userCallback=this.options.onchange||Prototype.emptyFunction;Event.observe(this.button,"click",CS.UI.CALENDAR.lcs.bindAsEventListener(CS.UI.CALENDAR,this.input,[_userCallback],undefined,false,G,F));Event.observe(this.input,"click",CS.UI.CALENDAR.lcs.bindAsEventListener(CS.UI.CALENDAR,this.input,[_userCallback],undefined,false,G,F));Event.observe(this.input,"focus",CS.UI.CALENDAR.lcs.bindAsEventListener(CS.UI.CALENDAR,this.input,[_userCallback],undefined,false,G,F))},editInit:function(){},setValue:function(B){this.input.value=B},getValue:function(){return this.input.value},eof:{}});CS.UI.FORMCONTROLS.defineControl({type:"image",initialize:function(B){this.options=B||{}},viewRender:function(){if(this.value){this.viewDiv.innerHTML="";this.viewDiv.appendChild(Builder.node("img",{src:this.value.preview}))}},viewInit:function(){},editRender:function(){},editInit:function(){if(this.value&&this.value.source&&this.value.preview){this.img=Builder.node("img",{width:this.value.source.width,height:this.value.source.height});var F=Builder.node("div",{className:"pic",style:"position:absolute; top:30px; width: "+this.value.source.width+"px; height: "+this.value.source.height+"px;"},this.img);this.previewImg=Builder.node("img",{style:"position:absolute; width: "+this.value.resize.width+"px; height: "+this.value.resize.height+"px;"});this.preview=Builder.node("div",{className:"pic",style:"position:absolute; top: 30px; left : "+(this.value.source.width+25)+"px; width: "+this.value.resize.width+"px; height: "+this.value.resize.height+"px;"},[this.previewImg]);var I=Builder.node("strong",{style:"position: absolute;"},"Select the area of the image to use");var H=Builder.node("span",{style:"font-size: smaller; padding-left:5px;"});H.innerHTML=this.value.resize.width+"&times;"+this.value.resize.height;var J=Builder.node("div",{style:"position: absolute; left: "+(this.value.source.width+25)+"px;"},[Builder.node("strong","Preview"),H]);var G=Builder.node("div",{});this.editDiv.appendChild(Builder.node("div",{style:"position:relative; width: "+(this.value.source.width+this.value.resize.width+80)+"px; height: "+(this.value.source.height+30)+"px;"},[I,J,F,this.preview]))}else{this.img=Builder.node("img",{src:this.value.preview+"?cachebuster="+CS.UTIL.randomID("")});this.editDiv.appendChild(this.img)}$(this.img).startWaiting();$(this.previewImg).startWaiting();Event.observe(this.img,"load",this._onImageLoad.bindAsEventListener(this,this.img));Event.observe(this.previewImg,"load",this._onPreviewLoad.bindAsEventListener(this,this.previewImg));this.img.src=this.value.source.url+"?cachebuster="+CS.UTIL.randomID("");this.previewImg.src=this.value.saved;this._onEndCrop({x1:this.value.crop.left,y1:this.value.crop.top},{width:this.value.crop.width,height:this.value.crop.height},true)},setValue:function(B){this.value=this.value||{};this.value=Object.extend(this.value,B)},getValue:function(){return this.value},_onPreviewLoad:function(C,D){D.stopWaiting()},_onImageLoad:function(H,G){G.stopWaiting();var E=this.value.resize?{x:this.value.resize.width,y:this.value.resize.height}:{};var F={x1:this.value.crop.left,y1:this.value.crop.top,x2:this.value.crop.left+this.value.crop.width,y2:this.value.crop.top+this.value.crop.height};new Cropper.Img(this.img,{minWidth:this.value.minWidth||32,minHeight:this.value.minHeight||32,width:this.value.source.width,height:this.value.source.height,style:"width: "+this.value.source.width+"px;, height: "+this.value.source.height+"px;",onloadCoords:F,ratioDim:E,displayOnInit:true,onEndCrop:this._onEndCrop.bind(this),captureKeys:false})},_onEndCrop:function(F,D,E){F=F||{};D=D||{};if(this.value.crop.left!=F.x1||this.value.crop.top!=F.y1||this.value.crop.width!=D.width||this.value.crop.height!=D.height||this.value.updatePreview||E){this.value.crop.left=F.x1||0;this.value.crop.top=F.y1||0;this.value.crop.width=D.width||this.value.source.width;this.value.crop.height=D.height||this.value.source.height;if(this.options.updatePreviewFunction){this.previewImg.startWaiting();this.options.updatePreviewFunction(this.value.source,this.value.resize,this.value.crop,this.__onEndCrop.bind(this))}this.value.updatePreview=false}},__onEndCrop:function(C){C=C||{};var D=C.preview||this.value.preview;this.value.modified=true;this.previewImg.src=D},eof:{}});CS.UI.FORMCONTROLS.defineControl({type:"password",initialize:function(B){this.options=B||{}},viewRender:function(){this.viewDiv.innerHTML="";this.viewDiv.appendChild(Builder.node("div","******"))},viewInit:function(){},editRender:function(){this.input=Builder.node("input",{type:"password",name:this.fieldname,fieldname:this.fieldname,className:"frm",style:"width: 300px;"});this.editDiv.appendChild(this.input)},editInit:function(){},setValue:function(B){this.input.value=B?CS.UTIL.SALT.decode(B):""},getValue:function(){return this.input.value},getSaltedValue:function(){return this.input.value?CS.UTIL.SALT.encode(this.input.value):""},eof:{}});CS.UI.FORMCONTROLS.defineControl({type:"readonly",needsButtons:false,initialize:function(B){this.options=B||{}},viewRender:function(){this.viewDiv.innerHTML="";var B=Builder.node("div");B.innerHTML=this.value;this.viewDiv.appendChild(B)},viewInit:function(){},editRender:function(){this.viewDiv.appendChild(Builder.node("div",this.value))},editInit:function(){},setValue:function(B){this.value=B},getValue:function(){return this.value},eof:{}});CS.UI.FORMCONTROLS.defineControl({type:"slider",initialize:function(B){this.options=B||{};this.options.maxLength=this.options.maxLength||"3";this.options.inputSize=this.options.inputSize||"4";this.options.range=this.options.range||{min:0,max:999}},viewRender:function(){this.viewDiv.innerHTML="";this.viewDiv.appendChild(Builder.node("div",this.input.value))},viewInit:function(){},editRender:function(){this.handle=Builder.node("div",{className:"handle"});this.track=Builder.node("div",{className:"track"},this.handle);this.input=Builder.node("input",{type:"text",className:"frm",size:this.options.inputSize,maxlength:this.options.maxLength,value:this.options.value});this.editDiv.innerHTML="";this.editDiv.appendChild(Builder.node("table",{className:"color-table",width:"100",cellspacing:"0",cellpadding:"3",border:"0"},[Builder.node("colgroup",[Builder.node("cols",{width:"150"}),Builder.node("cols",{width:"30"}),Builder.node("cols",{width:"20"})]),Builder.node("tbody",[Builder.node("tr",[Builder.node("td",[this.track]),Builder.node("td",[this.input]),Builder.node("td",[Builder.node("span",{className:"gry",style:"margin-left: -5px;"},this.options.prefix)])])])]))},editInit:function(){var B={range:$R(this.options.range.min,this.options.range.max),onSlide:this._onSlide.bind(this),onChange:this._onChange.bind(this),initialValue:this.getValue()};Event.observe(this.input,"keyup",this._onKeyPress.bindAsEventListener(this));this.slider=new Control.Slider(this.handle,this.track,B)},setValue:function(B){this.input.value=B},getValue:function(){var B=parseInt(this.input.value,10);if(isNaN(B)===true){B=this.options.range.start}else{if(B<this.options.range.start){B=this.options.range.start}else{if(B>this.options.range.end){B=this.options.range.end}}}return B},_onKeyPress:function(B){this.slider.setValue(this.input.value)},_onSlide:function(D,C){D=Math.round(D);this.input.value=D;if(this.options.onchange){this.options.onchange(D)}},_onChange:function(D,C){this._onSlide(D,C)},eof:{}});CS.UI.FORMCONTROLS.defineControl({type:"select",initialize:function(B){this.options=B||{}},viewRender:function(){this.viewDiv.innerHTML="";var F=this.getValue();for(var D=0;D<=this.selectOptions.length-1;D++){if(this.selectOptions[D].value==F){var E=this.selectOptions[D].text;this.viewDiv.appendChild(Builder.node("div",E));continue}}},viewInit:function(){},editRender:function(){var B=CS.UTIL.randomID(this.groupname+this.fieldname);this.selectOptions=new Array();i=0;if(this.options.includeBlank){this.selectOptions[0]=Builder.node("option",{value:""},this.options.blankLabel?this.options.blankLabel:"");i=1}for(choiceID in this.options.selectOptions){this.selectOptions[i]=Builder.node("option",{value:choiceID},this.options.selectOptions[choiceID]);i=i+1}this.input=Builder.node("select",{className:"frm",id:B,name:this.options.control.fieldname},this.selectOptions);this.editDiv.appendChild(this.input)},editInit:function(){},setValue:function(D){if(D){for(var C=0;C<=this.selectOptions.length-1;C++){if(this.selectOptions[C].value==D){this.input.selectedIndex=C;continue}}}this.input.selectedIndex=0},getValue:function(){value="";if(CS.UTIL.isset(this.input.selectedIndex)){value=this.selectOptions[this.input.selectedIndex].value}return value},_eof:function(){}});CS.UI.FORMCONTROLS.defineControl({type:"text",initialize:function(B){this.options=B||{}},viewRender:function(){var B=this.getValue();if(this.options.viewTransform){B=this.options.viewTransform(B)}this.viewDiv.innerHTML="";this.viewDiv.appendChild(Builder.node("div",B))},viewInit:function(){},editRender:function(){this.input=Builder.node("input",{type:"text",name:this.fieldname,className:"frm",style:"width: 300px;"});this.editDiv.appendChild(this.input)},editInit:function(){if(this.options.onChange){new Event.observe(this.input,"keypress",this.options.onChange.bindAsEventListener(this))}},setValue:function(B){this.input.value=B},getValue:function(B){return this.input.value},_eof:function(){}});CS.UI.FORMCONTROLS.defineControl({type:"textarea",initialize:function(B){this.options=B||{}},viewRender:function(){var I=this.input.value;if(this.options.viewTransform){I=this.options.viewTransform(I)}this.viewDiv.innerHTML="";if(this.options.useFrame){var K="border-style:solid;border-width:1px;";if(this.options.height){K+="height:"+this.options.height+";"}if(this.options.width){K+="width:"+this.options.width}var H=Builder.node("iframe",{style:K});this.viewDiv.appendChild(H);var J=H.contentWindow||H.contentDocument;if(J.document){J=J.document}J.write(I);J.close()}else{if(this.options.useTextarea){var L="";if(this.options.height){L+="height:"+this.options.height+";"}if(this.options.width){L+="width:"+this.options.width}var G=$(Builder.node("textarea",{readonly:"readonly",style:L},I));this.viewDiv.appendChild(G)}else{this.viewDiv.appendChild(Builder.node("div",I))}}},viewInit:function(){},editRender:function(){this.input=Builder.node("textarea",{className:"frm",name:this.fieldname});if(this.options.height){$(this.input).setStyle({height:field.height})}if(this.options.width){$(this.input).setStyle({width:field.width})}this.editDiv.appendChild(this.input)},editInit:function(){},setValue:function(B){this.input.value=B},getValue:function(B){return this.input.value},eof:{}});CS.UI.LIGHTBOX={closeLightbox:function(G){this._toggleAllActive(true);CS.UI.setStyle(SUMMARYDIV,{display:"none"});CS.UI.setStyle(LIGHTBOX,{display:"none"});if(Prototype.Browser.IE){try{document.getElementsByTagName("html")[0].style.overflowX=(this._bodyoverflowx?this._bodyoverflowx:"")}catch(H){}}else{var J=document.getElementsByTagName("html")[0];J.setAttribute("style","overflow-x:auto;")}if(G){G()}var I=CS.UI.LIGHTBOX.__registered;for(var F=0;F<I.length;F++){I[F]("close")}},showLightbox:function(V,R,U){this._toggleAllActive(false);var e=$(SUMMARYDIV);if(!$(LIGHTBOX)){document.body.appendChild(Builder.node("div",{id:LIGHTBOX,onclick:"CS.UI.closeLightbox();"}))}if(e){e.parentNode.removeChild(e)}window.scrollTo(0,0);var a=document.getElementsByTagName("html")[0];if(Prototype.Browser.IE){try{this._bodyoverflowx=a.style.overflowX;a.style.overflowX="hidden"}catch(Y){}}else{a.setAttribute("style","overflow-x:hidden;")}document.body.appendChild(Builder.node("div",{id:SUMMARYDIV,style:"width: 600px; display: none;"}));e=$(SUMMARYDIV);CS.UI.clearSection(e);e.appendChild(Builder.node("div",{id:"cbox_titlebar"},[Builder.node("div",{id:"cbox_close",onclick:"CS.UI.closeLightbox();",title:"close"},[""]),V]));e.appendChild(Builder.node("div",{id:"cbox_content"},[Builder.node("div",{id:"cbox_content_inner"},[R])]));var Z=CS.UI.getMaxDimensions(e);var g=Z.width;g+=25;var b=g&&g>600?g:600;if(U&&U.width){b=U.width}else{U=U||{};U.width=b+"px"}var T=CS.UI.getScreenSize();var W=CS.UI.getScrollXY();var P=(T.x-b)/2;P=P>0?P:10;var Q={top:(50+W.y)+"px",left:P+"px",display:"block"};if(U){for(var X in U){Q[X]=U[X]}}var S=function(B){var F={width:0,height:0};var E=0,D=0;var G=$(document.body).getDimensions();for(var A in F){var C=A.capitalize();F[A]=self["inner"+C]||(document.documentElement["client"+C]||document.body["client"+C]);if(G[A]>F[A]){if(A=="width"&&Prototype.Browser.Gecko){D=-15}else{if(A=="height"&&Prototype.Browser.Gecko){E=-15}}F[A]=G[A]}}CS.UI.setStyle(LIGHTBOX,{height:(F.height+D)+"px",width:(F.width+E)+"px"})};Event.observe(window,"resize",S);S();CS.UI.setStyle(LIGHTBOX,{display:"block","z-index":"100"});CS.UI.setStyle(e,Q);return e},buildBody:function(Y,Q,V,W){var X=W?Y:Builder.node("span",{className:"bigtext bold"},Y);var g=Builder.node("div",[Q]);var T=Builder.node("div",{className:"hr"});var a=Builder.node("div",{className:"cbox-buttons"});var b;for(b=0;b<V.length;b++){var R=V[b];var S=(R.onclick?R.onclick:"CS.UI.closeLightbox();");var U=(R.className?R.className:"secondary");var e={value:R.name,type:"button",onclick:S,className:U};if(R.id){e.id=R.id}var Z=Builder.node("input",e);a.appendChild(Z)}var P=Builder.node("div",[X,W?"":Builder.node("br"),g,Builder.node("div",{className:"pad10",style:"margin-top: 10px; display: none;",id:LBOX_FDBCK}),T,a]);return P},__disable:["embed","iframe","object","select"],_toggleAllActive:function(I){var K=this.__disable;var J,L,G,H;if(I){H="visible"}else{H="hidden"}for(J=0;J<K.length;J++){G=document.getElementsByTagName(K[J]);for(L=0;L<G.length;L++){if($(G[L]).hasClassName("_cs_nohide")){continue}if(G[L].style.display!="none"){Element.setStyle(G[L],{visibility:H})}}}},__registered:new Array(),registerCallback:function(B){if(!B){return }if(!CS.UI.LIGHTBOX._fnRegistered(B)){CS.UI.LIGHTBOX.__registered.push(B)}},_fnRegistered:function(E,D){for(var F=0;F<this.__registered.length;F++){if(CS.UI.LIGHTBOX.__registered[F]==E){if(D){delete CS.UI.LIGHTBOX.__registered[F]}return true}}return false},unRegisterCallback:function(B){CS.UI.LIGHTBOX._fnRegistered(B,true)}};CS.UI.WIZARD=Class.create();CS.UI.WIZARD={options:null,build:function(B){wizardObject=new Object();Object.extend(wizardObject,this);B=B||{};B.saveFunction=B.saveFunction||Prototype.K;B.buttons.cancel.button=Builder.node("input",{type:"button",className:"secondary",value:"Cancel"});B.buttons.previous.button=Builder.node("input",{type:"button",className:"secondary",value:"Back"});B.buttons.next.button=Builder.node("input",{type:"button",className:"primary",value:"Next"});B.buttons.done.button=Builder.node("input",{type:"button",className:"primary",value:B.buttons.done.label||"Done!"});wizardObject.wizard=Builder.node("div",{className:"standardWizard"},[Builder.node("div",{className:"rightalign"},[B.buttons.next.button,B.buttons.done.button]),Builder.node("div",{className:"leftalign"},[B.buttons.cancel.button,B.buttons.previous.button])]);wizardObject.options=B;return wizardObject},init:function(){Event.observe(this.options.buttons.cancel.button,"click",this.cancel.bind(this));Event.observe(this.options.buttons.previous.button,"click",this.previous.bind(this));Event.observe(this.options.buttons.next.button,"click",this.next.bind(this));Event.observe(this.options.buttons.done.button,"click",this.done.bind(this));CS.UI.disable(this.options.buttons.cancel.button,this.options.buttons.cancel.disabled);CS.UI.disable(this.options.buttons.previous.button,this.options.buttons.previous.disabled);CS.UI.disable(this.options.buttons.next.button,this.options.buttons.next.disabled);CS.UI.disable(this.options.buttons.done.button,this.options.buttons.done.disabled)},cancel:function(){this.gotoPage(this.options.buttons.cancel.url)},previous:function(){this.gotoPage(this.options.buttons.previous.url)},next:function(){if(this._checkForm()){this.disableButtons();this.options.saveFunction(this.gotoPage.bind(this,this.options.buttons.next.url))}},done:function(){if(this._checkForm()){this.disableButtons();this.options.saveFunction(this.gotoPage.bind(this,this.options.buttons.done.url))}},_checkForm:function(){return(this.options.formObj&&this.options.formObj.validates()&&this.options.formObj.form.disable())||!this.options.formObj},disableButtons:function(){this.options.buttons.cancel.button.disable();this.options.buttons.previous.button.disable();this.options.buttons.next.button.disable();this.options.buttons.done.button.disable()},gotoPage:function(B){URL=new CS.UTIL.URL(window.location);window.location=URL.protocol+"://"+URL.host+((!URL.port||URL.port=="80")?"":":"+URL.port)+B},eof:{}};CS.UI.TOOLTIP=Class.create();CS.UI.TOOLTIP.prototype={initialize:function(E,F){this.el=$(E);try{if(!this.el){throw ("ToolTip node does not exist.")}}catch(D){return }this.initialized=false;this.setOptions(F);this.showEvent=this.show.bindAsEventListener(this);this.hideEvent=this.hide.bindAsEventListener(this);this.updateEvent=this.update.bindAsEventListener(this);Event.observe(this.el,"mouseover",this.showEvent);Event.observe(this.el,"mouseout",this.hideEvent);this.content=this.el.title.gsub("\n","<br/>");this.el.title="";this.el.descendants().each(function(A){if(Element.readAttribute(A,"alt")){A.alt=""}})},setOptions:function(B){this.options={backgroundColor:"#333",borderColor:"#333",textColor:"#FFF",textShadowColor:"#000",maxWidth:250,align:"left",delay:10,mouseFollow:false,opacity:1,appearDuration:0.15,hideDuration:0.45,offCorner:false,offsetPosition:{x:0,y:0}};Object.extend(this.options,B||{})},__offsetMap:[[0,0],[0,0],[1,0],[0,1],[1,1]],show:function(G){if(this.options.offCorner){var J=this.options.offCorner;var I=Event.element(G);var H=Element.getDimensions(I);var F=Position.cumulativeOffset(I);this.xCord=F[0]+(this.__offsetMap[J][0]*H.width+this.options.offsetPosition.x);this.yCord=F[1]+(this.__offsetMap[J][1]*H.height+this.options.offsetPosition.y)}else{this.xCord=Event.pointerX(G);this.yCord=Event.pointerY(G)}if(!this.initialized){this.timeout=window.setTimeout(this.appear.bind(this),this.options.delay)}},hide:function(B){if(this.initialized){this.appearingFX.cancel();if(this.options.mouseFollow){Event.stopObserving(this.el,"mousemove",this.updateEvent)}new Effect.Fade(this.tooltip,{duration:this.options.hideDuration,afterFinish:function(){if(this.tooltip&&this.tooltip.parentNode){this.tooltip.parentNode.removeChild(this.tooltip)}}.bind(this)})}this._clearTimeout(this.timeout);this.initialized=false},update:function(B){this.xCord=Event.pointerX(B);this.yCord=Event.pointerY(B);this.setup()},appear:function(){var B=Builder.node("div",{className:"xboxcontent",style:"background-color:"+this.options.backgroundColor+"; border-color:"+this.options.borderColor+((this.options.textColor!=="")?"; color:"+this.options.textColor:"")+((this.options.textShadowColor!=="")?"; text-shadow:2px 2px 0"+this.options.textShadowColor+";":"")});B.innerHTML=this.content;this.tooltip=Builder.node("div",{className:"tooltip",style:"display: none;"},[Builder.node("div",{className:"xtop"},[Builder.node("div",{className:"xb1",style:"background-color:"+this.options.borderColor+";"}),Builder.node("div",{className:"xb2",style:"background-color:"+this.options.backgroundColor+"; border-color:"+this.options.borderColor+";"}),Builder.node("div",{className:"xb3",style:"background-color:"+this.options.backgroundColor+"; border-color:"+this.options.borderColor+";"}),Builder.node("div",{className:"xb4",style:"background-color:"+this.options.backgroundColor+"; border-color:"+this.options.borderColor+";"})]),B,Builder.node("div",{className:"xbottom"},[Builder.node("div",{className:"xb4",style:"background-color:"+this.options.backgroundColor+"; border-color:"+this.options.borderColor+";"}),Builder.node("div",{className:"xb3",style:"background-color:"+this.options.backgroundColor+"; border-color:"+this.options.borderColor+";"}),Builder.node("div",{className:"xb2",style:"background-color:"+this.options.backgroundColor+"; border-color:"+this.options.borderColor+";"}),Builder.node("div",{className:"xb1",style:"background-color:"+this.options.borderColor+";"})])]);document.body.insertBefore(this.tooltip,document.body.childNodes[0]);Element.extend(this.tooltip);this.options.width=this.tooltip.getWidth();this.tooltip.style.width=this.options.width+"px";this.setup();if(this.options.mouseFollow){Event.observe(this.el,"mousemove",this.updateEvent)}this.initialized=true;this.appearingFX=new Effect.Appear(this.tooltip,{duration:this.options.appearDuration,to:this.options.opacity})},setup:function(){if(this.options.width>this.options.maxWidth){this.options.width=this.options.maxWidth;this.tooltip.style.width=this.options.width+"px"}if(this.xCord+this.options.width>=Element.getWidth(document.body)){this.options.align="right";this.xCord=this.xCord-this.options.width+20}this.tooltip.style.left=this.xCord-7+"px";this.tooltip.style.top=this.yCord+12+"px"},_clearTimeout:function(B){clearTimeout(B);clearInterval(B);return null}};CS.UTIL.URL=Class.create();CS.UTIL.URL.prototype={_regExp:/^((\w+):\/\/)?((\w+):?(\w+)?@)?([^\/\?:]+):?(\d+)?(\/?[^\?#]+)?\??([^#]+)?#?(\w*)/,isvalid:true,username:null,password:null,port:null,protocol:null,host:null,pathname:null,url:null,querystring:{},fragment:null,initialize:function(B){if(B){return this.parse(B)}return undefined},_getVal:function(D,C){if(!D){return null}return(typeof (D[C])=="undefined"?null:D[C])},parse:function(D){var C=this._regExp.exec(D);if(!C){this.isvalid=false;return C}this.url=this._getVal(C,0);this.protocol=this._getVal(C,2);this.username=this._getVal(C,4);this.password=this._getVal(C,5);this.host=this._getVal(C,6);this.port=this._getVal(C,7);this.pathname=this._getVal(C,8);this.querystring=new CS.UTIL.URL.QueryString(this._getVal(C,9));this.fragment=this._getVal(C,10);return C}};CS.UTIL.URL.QueryString=Class.create();CS.UTIL.URL.QueryString.prototype={rawQueryString:"",length:0,initialize:function(E){if(!E){this.rawQueryString="";this.length=0;return }this.rawQueryString=E;var H=E.split("&");this.length=H.length;for(var G=0;G<H.length;G++){var F=H[G].split("=");this[unescape(F[0])]=((F.length==2)?unescape(F[1]):F[0])}},toString:function(){return this.rawQueryString}};CS.UTIL.VALIDATOR={goodFeedback:{feedbackText:"ok",feedbackType:FDBK_GOOD},_urlNoHTTPReg:new RegExp("(([a-zA-Z0-9][a-zA-Z0-9_-]*)(.[a-zA-Z0-9][a-zA-Z0-9_-]+)+)(:(\d+))?"),_urlReg:/^http:\/\/([a-z0-9][a-zA-Z0-9.-]*\.[a-zA-Z]{2,7}|[0-9]{1,3}(\.[0-9]{1,3}){3})(:[0-9]{1,5})?((\/(%[0-9a-fA-F]{2}|[-a-zA-Z0-9_.!~*\'():@\&=+$,;])*)*\/?)?(\?([^#]*))?(\#((%[0-9a-fA-F]{2}|[-a-zA-Z0-9_.!~*\'();\/?:@\&=+$,])*))?$/,_emailReg:new RegExp("^[a-zA-Z0-9\\.\\+\\-\\'_%]+@[a-zA-Z0-9\\.\\-]+\\.[a-zA-Z][a-zA-Z]+$"),_swfExtArr:new Array(),_failExtArr:new Array(),bad:function(B){CS.log("validation",B);return{feedbackText:B,feedbackType:FDBK_BAD}},isTrue:function(D,C){C=this._pullOptions(C,"entry",6);return(!D)?this.bad(C.name):this.goodFeedback},required:function(D,C){C=this._pullOptions(C,"entry",6);return(D==="")?this.bad("<strong>"+C.name+"</strong> is required."):this.goodFeedback},validateNumber:function(M,I){var K=M.value;var H="";var N="";try{N=parseInt(K,10)}catch(L){}var J=FDBK_NONE;if((""+N).length!=K.length&&K.length!==0){H="numbers only.";J=FDBK_BAD}if(isNaN(N)){N=""}CS.UI.changeFeedback(I,H,J,2000);M.value=N;return N},validateNoSpaces:function(H,F){var G=H.value;var E=G.length;G=G.strip();if(G.length<E){CS.UI.changeFeedback(F,"no spaces allowed.",FDBK_BAD,2000)}H.value=G},passwordPair:function(F,H,G){G=this._pullOptions(G,"Password",6);var E=G.minLength;if(!F||F.length<E){return this.bad("<strong>"+G.name+"</strong> must be at least "+E+" characters long")}if(!H||H.length<1){return this.goodFeedback}if(F!=H){return this.bad("Passwords don't match")}return this.goodFeedback},email:function(C,D){D=this._pullOptions(D,"email",undefined);if(!C){return this.bad("<strong>"+D.name+"</strong> is required. Please enter a valid email.")}if(C.indexOf("@")===-1){return this.bad("<strong>"+D.name+"</strong> is not valid. There is no '@'")}if(C.indexOf(".")===-1){return this.bad("<strong>"+D.name+"</strong> is not valid.  Please enter a valid email.")}if(!C.match(this._emailReg)){return this.bad("<strong>"+D.name+"</strong> is not valid.  Please enter a valid email.")}return this.goodFeedback},username:function(D,C){C=this._pullOptions(C,"username",undefined);if(!D.match(/^[a-zA-Z0-9]+$/)&&!D.match(/^nbcu_[a-zA-Z0-9]*$/)){return this.bad("<strong>"+C.name+"</strong> not correctly formatted.")}return this.goodFeedback},canvasurl:function(D,C){C=this._pullOptions(C,"canvas name",undefined);if(!D.match(/^[a-zA-Z_-]+$/)||D.length>20||D.length<7){return this.bad("<strong>"+C.name+"</strong> allows only letters, dashes, and underscores.  Length must be 7-20 characters.")}return this.goodFeedback},facebookApiKey:function(D,C){C=this._pullOptions(C,"api key",undefined);if(D.length!=32||!D.match(/^[a-z0-9]+$/)){return this.bad("<strong>"+C.name+"</strong> not valid. Please enter a valid API key.")}return this.goodFeedback},URL:function(F,G,I){F=F.toLowerCase();G=this._pullOptions(G,undefined,undefined);if(F.length===0||(!I&&F=="http://")){return{feedbackText:"Please enter a valid URL.",feedbackType:FDBK_INFO}}if(!I&&F.substring(0,8)=="http://"){return this.bad("Valid URL is required, e.g. <strong>http://</strong>www.your-domain.com")}if(!F||F.length<=(I?4:11)){return this.bad("Valid URL is required, e.g. <strong>http://</strong>www.your-domain.com")}var H=F.split(".");if(H.length<2){return this.bad("URL is not valid. Forget the .com?")}for(var J=0;J<H.length;J++){if(H[J]===""){return this.bad("URL is invalid. Consecutive dots are not valid in a URL.")}else{if(H[J].strip().length<H[J].length){return this.bad("URL is invalid. Spaces are not valid in a URL.")}}}if(F.length>H.join(".").length){return this.bad("URL is invalid.")}if(I){if(!F.match(this._urlNoHTTPReg)){return this.bad("The URL is invalid.")}return this.goodFeedback}else{if(!F.match(this._urlReg)){return this.bad("The URL is invalid.")}return this.goodFeedback}},validDomain:function(B){_regex=/(?:(?:[a-zA-Z0-9\/;\?&=:\-_\$\+!\*'\(\|\\~\[\]#%\.](?!www))+(?:\.[Cc]om|\.[Ee]du|\.[gG]ov|\.[Ii]nt|\.[Mm]il|\.[Nn]et|\.[Oo]rg|\.[Bb]iz|\.[Ii]nfo|\.[Nn]ame|\.[Pp]ro|\.[Aa]ero|\.[cC]oop|\.[mM]useum|\.[Cc]at|\.[Jj]obs|\.[Tt]ravel|\.[Aa]rpa|\.[Mm]obi|\.[Aa]c|\.[Aa]d|\.[aA]e|\.[aA]f|\.[aA]g|\.[aA]i|\.[aA]l|\.[aA]m|\.[aA]n|\.[aA]o|\.[aA]q|\.[aA]r|\.[aA]s|\.[aA]t|\.[aA]u|\.[aA]w|\.[aA]z|\.[aA]x|\.[bB]a|\.[bB]b|\.[bB]d|\.[bB]e|\.[bB]f|\.[bB]g|\.[bB]h|\.[bB]i|\.[bB]j|\.[bB]m|\.[bB]n|\.[bB]o|\.[bB]r|\.[bB]s|\.[bB]t|\.[bB]v|\.[bB]w|\.[bB]y|\.[bB]z|\.[cC]a|\.[cC]c|\.[cC]d|\.[cC]f|\.[cC]g|\.[cC]h|\.[cC]i|\.[cC]k|\.[cC]l|\.[cC]m|\.[cC]n|\.[cC]o|\.[cC]r|\.[cC]s|\.[cC]u|\.[cC]v|\.[cC]x|\.[cC]y|\.[cC]z|\.[dD]e|\.[dD]j|\.[dD]k|\.[dD]m|\.[dD]o|\.[dD]z|\.[eE]c|\.[eE]e|\.[eE]g|\.[eE]h|\.[eE]r|\.[eE]s|\.[eE]t|\.[eE]u|\.[fF]i|\.[fF]j|\.[fF]k|\.[fF]m|\.[fF]o|\.[fF]r|\.[gG]a|\.[gG]b|\.[gG]d|\.[gG]e|\.[gG]f|\.[gG]g|\.[gG]h|\.[gG]i|\.[gG]l|\.[gG]m|\.[gG]n|\.[gG]p|\.[gG]q|\.[gG]r|\.[gG]s|\.[gG]t|\.[gG]u|\.[gG]w|\.[gG]y|\.[hH]k|\.[hH]m|\.[hH]n|\.[hH]r|\.[hH]t|\.[hH]u|\.[iI]d|\.[iI]e|\.[iI]l|\.[iI]m|\.[iI]n|\.[iI]o|\.[iI]q|\.[iI]r|\.[iI]s|\.[iI]t|\.[jJ]e|\.[jJ]m|\.[jJ]o|\.[jJ]p|\.[kK]e|\.[kK]g|\.[kK]h|\.[kK]i|\.[kK]m|\.[kK]n|\.[kK]p|\.[kK]r|\.[kK]w|\.[kK]y|\.[kK]z|\.[lL]a|\.[lL]b|\.[lL]c|\.[lL]i|\.[lL]k|\.[lL]r|\.[lL]s|\.[lL]t|\.[lL]u|\.[lL]v|\.[lL]y|\.[mM]a|\.[mM]c|\.[mM]d|\.[mM]g|\.[mM]h|\.[mM]k|\.[mM]l|\.[mM]m|\.[mM]n|\.[mM]o|\.[mM]p|\.[mM]q|\.[mM]r|\.[mM]s|\.[mM]t|\.[mM]u|\.[mM]v|\.[mM]w|\.[mM]x|\.[mM]y|\.[mM]z|\.[nN]a|\.[nN]c|\.[nN]e|\.[nN]f|\.[nN]g|\.[nN]i|\.[nN]l|\.[nN]o|\.[nN]p|\.[nN]r|\.[nN]u|\.[nN]z|\.[oO]m|\.[pP]a|\.[pP]e|\.[pP]f|\.[pP]g|\.[pP]h|\.[pP]k|\.[pP]l|\.[pP]m|\.[pP]n|\.[pP]r|\.[pP]s|\.[pP]t|\.[pP]w|\.[pP]y|\.[qP]a|\.[rR]e|\.[rR]o|\.[rR]u|\.[rR]w|\.[sS]a|\.[sS]b|\.[sS]c|\.[sS]d|\.[sS]e|\.[sS]g|\.[sS]h|\.[Ss]i|\.[sS]j|\.[sS]k|\.[sS]l|\.[sS]m|\.[sS]n|\.[sS]o|\.[sS]r|\.[sS]t|\.[sS]v|\.[sS]y|\.[sS]z|\.[tT]c|\.[tT]d|\.[tT]f|\.[tT]g|\.[tT]h|\.[tT]j|\.[tT]k|\.[tT]l|\.[tT]m|\.[tT]n|\.[tT]o|\.[tT]p|\.[tT]r|\.[tT]t|\.[tT]v|\.[tT]w|\.[tT]z|\.[uU]a|\.[uU]g|\.[uU]k|\.[uU]m|\.[uU]s|\.[uU]y|\.[uU]z|\.[vV]a|\.[vV]c|\.[vV]e|\.[vV]g|\.[vV]i|\.[vV]n|\.[vV]u|\.[wW]f|\.[wW]s|\.[yY]e|\.[yY]t|\.[yY]u|\.[zZ]a|\.[zZ]m|\.[zZ]w))/;return _regex.exec(B)},domainList:function(F){domains=F.split(/\s*,\s*/);for(var E=0,D=domains.length;E<D;E++){domain=domains[E];if(domain!==""){d=new CS.UTIL.URL("http://"+domain.gsub("http://","").gsub("https://",""));if(!CS.UTIL.VALIDATOR.validDomain(d.host)){return this.bad("<strong>"+domain+"</strong> is not a valid domain name.")}}}return this.goodFeedback},strLength:function(D,C){C=this._pullOptions(C,"entry",6);if(!D){return this.bad("<strong>"+C.name+"</strong> is expected to be at least "+C.minLength+" characters.")}if(D.strip().length<C.minLength){return this.bad("<strong>"+C.name+"</strong> is expected to be at least "+C.minLength+" characters.")}return this.goodFeedback},maxStrLength:function(D,C){if(!C.name){C.name="This field"}if(!C.maxLength){C.maxLength=255}if(D.strip().length>C.maxLength){return this.bad("<strong>"+C.name+"</strong> is expected to be less than "+C.maxLength+" characters.")}return this.goodFeedback},alphaNumeric:function(D,C){if(!C.name){C.name="This field"}if(!D.match(/^[a-zA-Z0-9]+$/)){return this.bad("<strong>"+C.name+"</strong> is expected to be Alpha-Numeric characters only.")}else{return this.goodFeedback}},regex:function(D,C){if(!C.name){C.name="This field"}if(D.match()){return this.bad("<strong>"+C.name+"</strong> contains invalid characters.")}else{return this.goodFeedback}},isValidPossiblePhoneNumber:function(D,C){if(!C.name){C.name="This field"}if(!D.match(/^([a-zA-Z,#\/ \.\(\)\-\+\*]*[0-9]){7}[0-9a-zA-Z,#\/ \.\(\)\-\+\*]*$/)){return this.bad("<strong>"+C.name+"</strong> contains invalid characters.")}else{return this.goodFeedback}},isValidHumanName:function(D,C){if(!C.name){C.name="This field"}if(!D.match(/^[\w\.\-\,\ ]*$/)){return this.bad("<strong>"+C.name+"</strong> contains invalid characters.")}else{return this.goodFeedback}},isNormalText:function(D,C){if(!C.name){C.name="This field"}if(!D.match(/^[\w\.\-\ ]*$/)){return this.bad("<strong>"+C.name+"</strong> contains invalid characters.")}else{return this.goodFeedback}},_pullOptions:function(D,F,E){if(D){if(!D.name){D.name=F}if(!D.minLength){D.minLength=E}}else{return{name:F,minLength:E}}return D},_initExtLists:function(){if(this._swfExtArr.length===0){this._swfExtArr.swf=FDBK_GOOD_URL;this._swfExtArr.jpg=FDBK_GOOD_URL;this._swfExtArr.gif=FDBK_GOOD_URL;this._failExtArr.html=FDBK_WEBPAGE_URL;this._failExtArr.php=FDBK_WEBPAGE_URL}},_checkSWFExtArr:function(H){var G=this._swfExtArr;var E=H.split(".");if(E.length<3){return false}var F=E[E.length-1].toLowerCase().substring(0,3);return G[[F]]},_checkFailedExtArr:function(H){var F=this._failExtArr;var E=H.split(".");if(E.length<3){return FDBK_URL_DEFAULT}var G=F[[E[E.length-1].toLowerCase().substring(0,3)]];return G?G:FDBK_URL_DEFAULT}};CS.UTIL.FORMAT=Class.create();CS.UTIL.FORMAT={user:function(C,D){if(C==CSD.thisuser.id){return CSD.thisuser.name}if(CSD.users&&CSD.users[C]){return CSD.users[C].name}else{usernameDivID=CS.UTIL.randomID("username");return'<span id="'+usernameDivID+'">'+C.replace("/u/","")+"</span>"}},number:function(D){if(!D||D<100){return(D||0)}D+="";x=D.split(".");x1=x[0];x2=x.length>1?"."+x[1]:"";var C=/(\d+)(\d{3})/;while(C.test(x1)){x1=x1.replace(C,"$1,$2")}return x1+x2},bestRole:function(B){if(B){if(B.SuperUser){return"SuperUser"}if(B.Administrator){return"Administrator"}if(B.PremierAdministrator){return"Premier"}if(B.Developer){return"Developer"}}return""},dateMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dateTime:function(E,G){var F={};if(isNaN(E)){dArray=E.split(",");if(dArray.length<3){return""}F.year=dArray[0];F.month=parseInt(dArray[1],10);F.day=parseInt(dArray[2],10)}else{dObj=new Date(E);F.year=dObj.getFullYear();F.month=dObj.getMonth();F.day=dObj.getDate()}switch(G){case"short":case"stack":var H=this.dateMonths[F.month]+" "+F.day+", "+F.year;if(today.day==F.day&&today.month==F.month&&today.year==F.year){return'<strong style="white-space:nowrap">'+H+"</strong>"}else{return'<span style="white-space:nowrap">'+H+"</span>"}break;case"time":if(!E){return"Never"}else{return dObj.toLocaleString().gsub(/.*2007/,"").gsub(/:..\s/," ")}break;default:if(!E){return"Never"}else{return dObj.toLocaleString().gsub(/:.. /," ")}break}return""},regexDomain:/^((\n|.+:\/\/)|(.+@))*([^\/]*)/i,favicon:function(E,D){E=E||D;D=D||"";if(!E){return""}var F=this.regexDomain.exec(E);E=F[F.length-1];if(!E||E===""){return""}return"<span style=\"background: url('"+CSD.config.faviconservice+E+"') no-repeat;height:16px; "+((D==="")?"width:16px;":"padding-left:22px;")+' display: block;"/>'+D+"</span>"},apikey:function(B){B=B||"";return B.gsub("/a/","")},userId:function(B){B=B||"";return B.gsub("/u/","")},json:function(G,F){if(!G){return"undefined"}G=G.gsub(": ",":").gsub(", ",",");r=G.split("");F=(F!==undefined);if(F){space=" ";newline="\n";beforeString="";afterString=""}else{space="&nbsp;";newline="<br/>";afterString="</span>"}t="";inquote=false;indent=0;for(var H=0,E=r.length;H<E;++H){letter=r[H];switch(letter){case"{":t+="{";if(r[H+1]!="}"){indent+=4;t+=newline;t+=space.times(indent)}break;case"}":if(r[H-1]!="{"){indent-=4;t+=newline;t+=space.times(indent)}t+="}";break;case"[":t+="[";if(r[H+1]!="]"){indent+=4;t+=newline;t+=space.times(indent)}break;case"]":if(r[H-1]!="["){indent-=4;t+=newline;t+=space.times(indent)}t+="]";break;case":":if((r[H-1]=='"'||r[H-1]=="}"||r[H-1]=="]")&&(r[H+1]=='"'||r[H+1]=="{"||r[H+1]=="["||r[H+1]=="-")){t+=" : ";if((r[H+1]=="{"&&r[H+2]!="}")||(r[H+1]=="["&&r[H+2]!="]")){t+=newline;t+=space.times(indent)}}else{if(r[H+1]=="/"&&r[H+2]=="/"){t+=":"}else{t+=" : "}}break;case",":t+=",";t+=newline;t+=space.times(indent);break;case"\\":if(!F&&r[H+1]=="n"&&r[H+2]!="\\"&&r[H+3]!="n"){t+="<br>";t+=space.times(indent);H++}break;case'"':if(inquote){t+='"';t+=afterString}else{if(!F){colors=["yellow","orange","lightblue","tan","green","orange","tan","lightblue"];color=colors[indent/4-1];beforeString='<span style="color:'+color+'">'}t+=beforeString;t+='"'}inquote=!inquote;break;default:t+=letter;break}}return t},eof:{}};var _today=new Date();var today={};today.month=_today.getMonth();today.day=_today.getDate();today.year=_today.getFullYear();CS.UTIL.SALT=Class.create();CS.UTIL.SALT={reg64Chars:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",safe64Chars:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._=",encode64_array:function(X,M){var O=(M?this.safe64Chars:this.reg64Chars);var P="";var Q,S,U;var R,T,V,W;var N=0;do{Q=X[N];N++;S=X[N];N++;U=X[N];N++;R=Q>>2;T=((Q&3)<<4)|(S>>4);V=((S&15)<<2)|(U>>6);W=U&63;if(isNaN(S)){V=W=64}else{if(isNaN(U)){W=64}}P=P+O.charAt(R)+O.charAt(T)+O.charAt(V)+O.charAt(W)}while(N<X.length);return P},decode64:function(X,M){var O=(M?this.safe64Chars:this.reg64Chars);var P="";var Q,S,U;var R,T,V,W;var N=0;do{R=O.indexOf(X.charAt(N));N++;T=O.indexOf(X.charAt(N));N++;V=O.indexOf(X.charAt(N));N++;W=O.indexOf(X.charAt(N));N++;Q=(R<<2)|(T>>4);S=((T&15)<<4)|(V>>2);U=((V&3)<<6)|W;P=P+String.fromCharCode(Q);if(V!=64){P=P+String.fromCharCode(S)}if(W!=64){P=P+String.fromCharCode(U)}}while(N<X.length);return P},strToCodes:function(E){var D=new Array();for(var F=0;F<E.length;F++){D.push(E.charCodeAt(F))}return D},toCharRange:function(B){while(B<0){B+=255}return B%255},encode:function(E){if(!E||E===""){return""}var F=this._encode(E);var D=this.decode(F);if(D==E){return F}return this.encode(E)},_encode:function(G){if(!G||G===""){return""}var H=new Array(Math.floor(Math.random()*120+32),Math.floor(Math.random()*120+32));var F=this.strToCodes(G);for(var I=0;I<F.length;I++){F[I]^=this.toCharRange(H[I%H.length]+11)}var J=H.concat(F);return this.encode64_array(J,true)},decode:function(F){var G=this.strToCodes(this.decode64(F,true));var I=[G[0],G[1]];var H="";for(var J=0;J<G.length-I.length;J++){G[J+I.length]^=this.toCharRange(I[J%I.length]+11);H+=String.fromCharCode(G[J+I.length])}return H},eof:{}};CS.PAGES=Class.create();CS.PAGES={};if(CS.framework.Prototype){Event.observe(window,"load",function(C){var D=$("topwidgeticon");D&&CSD.thiswidget&&CSD.thiswidget.image32x32&&(D.src=CSD.thiswidget.image32x32)&&D.startLoading()})}sfHover=function(){var F=document.getElementById("header-submenu-nav");if(F){var E=F.getElementsByTagName("LI");for(var D=0;D<E.length;D++){E[D].onmouseover=function(){this.className+=" sfhover"};E[D].onmouseout=function(){this.className=this.className.replace(new RegExp(" sfhover\\b"),"")}}}};if(window.attachEvent){window.attachEvent("onload",sfHover)}(function(){if(document.location.pathname.indexOf("csmanager")!=1){return }var C=false;function D(){if(!C){CS.DATA.call("user.get",{},function(A){if(A.success){C=A.data}})}}window.Prototype&&(function(){function A(E){var F="\n\n----------------------\n\n";$H(E).keys().each(function(G){F+=G;F+="\n * "+E[G].join("\n * ");F+="\n\n----------------------\n\n"});return F}function K(){$A(document.getElementsByTagName("iframe")).each(function(E){E=$(E);var F={width:E.getWidth()+"px",height:E.getHeight()+"px"};E.setStyle({width:0,height:0});E.origSize=F})}function I(){$A(document.getElementsByTagName("iframe")).each(function(E){E.origSize&&$(E).setStyle(E.origSize)})}var J=Builder.node("a",{className:"feedbackbutton"},"Beta Feedback");var B=function(){$("mainpage").appendChild(J);var E=false;Event.observe(J,"click",function(){K();E&&$(E).remove();E=Builder.node("div",{className:"feedbackform"});document.body.appendChild(E);new Ajax.Updater(E,"/feedback/feedback",{onComplete:function(){Event.observe($$(".feedback .cancel").first(),"click",function(F){Event.stop(F);E.remove();E=false;I();return false});Event.observe($$(".feedback .submit").first(),"click",function(){var F=$$(".feedback .message").first().value.strip();if(!F){$$(".feedback .message").first().focus();return }$$(".feedback .submit").first().disable();var O="Height";var H=self["inner"+O]||(document.documentElement["client"+O]||document.body["client"+O]);O="Width";var G=self["inner"+O]||(document.documentElement["client"+O]||document.body["client"+O]);var P={"Web Page":[document.title,document.location,document.lastModified],User:[CSD.thisuser.name,Object.toJSON(CSD.thisuser.groups)],Widget:CSD.thiswidget?[CSD.thiswidget.wid,CSD.thiswidget.name,CSD.thiswidget.template,CSD.thiswidget.screenshot]:["No widget"],Browser:[navigator.userAgent,"Resolution: "+G+"x"+H],Fields:Form.serialize(document.body).replace(/=/gi,": ").split("&"),CSD:[Object.toJSON(CSD)]};CS.DATA.call("web.contact",{type:"feedback",subject:"Feedback",email:C?C.email:CSD.thisuser.name,name:CSD.thisuser.name||"Guest",message:F+A(P)},function(M){$$(".feedback .submit").first().enable();$$(".feedback FORM").first().hide();$$(".feedback .complete").first().removeClassName("hide").show();Event.observe($$(".feedback .morefeedback").first(),"click",function(){$$(".feedback .complete").first().hide();$$(".feedback FORM").first().show();$$(".feedback .message").first().value="";$$(".feedback .message").first().focus();return false});Event.observe($$(".feedback .finished").first(),"click",function(N){Event.stop(N);E.remove();E=false;I();return false})})});$$(".feedback .message").first().value="";$$(".feedback .message").first().focus();D()}});return false})};var L=function(){if($("mainpage")){B()}else{setTimeout(L,1000)}};L()})();window.jQuery&&jQuery().ready(function(){function A(E){var H="\n\n----------------------\n\n";$.each(E,function(J,G){H+=J;H+="\n * "+G.join("\n * ");H+="\n\n----------------------\n\n"});return H}var F=$('<a href="#" class="feedbackbutton">Beta Feedback</a>');$("#mainpage").append(F);var B=false;F.click(function(){B&&B.remove();B=$('<div class="feedbackform"></div>');$(document.body).append(B);B.load("/feedback/feedback",function(){$(".feedback .cancel").click(function(){B.remove();return false});$(".feedback .submit").click(function(){var H=$.trim($(".feedback .message").value());if(!H){$(".feedback .message").focus();return }$(this).attr("disabled","disabled");var E={"Web Page":[document.title,document.location,document.lastModified],User:[CSD.thisuser.name,$.toJSON(CSD.thisuser.groups)],Widget:CSD.thiswidget?[CSD.thiswidget.wid,CSD.thiswidget.name,CSD.thiswidget.template,CSD.thiswidget.screenshot]:["No widget"],Browser:[navigator.userAgent,"Resolution: "+$(document.body).width()+"x"+$(document.body).height()],Fields:$(":input").serialize().replace(/=/gi,": ").split("&"),CSD:[$.toJSON(CSD)]};CS.DATA.call("web.contact",{type:"feedback",subject:"Feedback",email:C?C.email:CSD.thisuser.name,name:CSD.thisuser.name||"Guest",message:H+A(E)},function(G){$(this).removeAttr("disabled");$(".feedback FORM").hide();$(".feedback .complete").show();$(".feedback .morefeedback").click(function(){$(".feedback .complete").hide();$(".feedback FORM").show();$(".feedback .message").val("").focus();return false});$(".feedback .finished").click(function(){B.remove();return false})})});$(".feedback .message").val("").focus();D()});return false})})})();