function executeCommand(D,F,C){function A(){if(E.readyState==4){if(E.status==200){if(B){if(C){B(E.responseXML)}else{B(E.responseText)}}else{}}else{alert("There was a problem retrieving the xml data:\n"+E.status+":\t"+E.statusText+"\n"+E.responseText)}}}var E=null;var B=F;if(window.XMLHttpRequest){E=new XMLHttpRequest();E.onreadystatechange=A;E.open("GET",D,true);E.send(null)}else{if(window.ActiveXObject){E=new ActiveXObject("Microsoft.XMLHTTP");if(E){E.onreadystatechange=A;E.open("GET",D,true);E.send()}else{alert("your browser does not support xmlhttprequest")}}else{alert("your browser does not support xmlhttprequest")}}}function setActiveStyleSheet(D){var C,B,A;for(C=0;(B=document.getElementsByTagName("link")[C]);C++){if(B.getAttribute("rel").indexOf("style")!=-1&&B.getAttribute("title")){B.disabled=true;if(B.getAttribute("title")==D){B.disabled=false}}}}function getActiveStyleSheet(){var B,A;for(B=0;(A=document.getElementsByTagName("link")[B]);B++){if(A.getAttribute("rel").indexOf("style")!=-1&&A.getAttribute("title")&&!A.disabled){return A.getAttribute("title")}}return null}function getPreferredStyleSheet(){var B,A;for(B=0;(A=document.getElementsByTagName("link")[B]);B++){if(A.getAttribute("rel").indexOf("style")!=-1&&A.getAttribute("rel").indexOf("alt")==-1&&A.getAttribute("title")){return A.getAttribute("title")}}return null}function createCookie(C,D,E){if(E){var B=new Date();B.setTime(B.getTime()+(E*24*60*60*1000));var A="; expires="+B.toGMTString()}else{A=""}document.cookie=C+"="+D+A+"; path=/"}function readCookie(B){var D=B+"=";var A=document.cookie.split(";");for(var C=0;C<A.length;C++){var E=A[C];while(E.charAt(0)==" "){E=E.substring(1,E.length)}if(E.indexOf(D)==0){return E.substring(D.length,E.length)}}return null}window.onload=function(B){var A=readCookie("style");var C=A?A:getPreferredStyleSheet();setActiveStyleSheet(C)};window.onunload=function(A){var B=getActiveStyleSheet();createCookie("style",B,365)};var cookie=readCookie("style");var title=cookie?cookie:getPreferredStyleSheet();setActiveStyleSheet(title);var XWiki={Version:"0.8_pre1",require:function(A){document.write('<script type="text/javascript" src="'+A+'"><\/script>')},addLibrary:function(B){JSfileName="skin.js";if(B=="scriptaculous"){libraries=["prototype.js","util.js","effects.js","dragdrop.js","controls.js"]}if(B=="rico"){libraries=["rico.js"]}var E=document.getElementsByTagName("script");for(var C=0;C<E.length;C++){if(E[C].src&&E[C].src.match(JSfileName)){var D="/bin/download/XWiki/MySkin/";for(var A=0;A<libraries.length;A++){this.require(D+libraries[A])}}}}};var XWikiAjax={requests:new Array(),start:function(A){this.status=$(A);ajaxEngine.registerRequest("setValue","SetValueResponse?xpage=rdf");ajaxEngine.registerAjaxElement(this.status.id)},addRequest:function(C,A,E,D){var B=Object.extend({type:"set"});B.className=A;B.document=C;B.field=E;B.value=D;this.requests.push(B)},end:function(){this.requests.reverse();var A=this.requests.pop();while(A){if(A.type=="set"){ajaxEngine.sendRequest("setValue","status="+this.status.id,"doc="+A.document,"typedoc="+A.className,"field="+A.field,"value="+A.value)}A=this.requests.pop()}this.status.innerHtml="updated"}};function checkAdvancedContent(A){result=false;data=document.forms.edit.content.value;myRE=new RegExp("</?(html|body|img|a|i|b|embed|script|form|input|textarea|object|font|li|ul|ol|table|center|hr|br|p) ?([^>]*)>","ig");results=data.match(myRE);if(results&&results.length>0){result=true}myRE2=new RegExp("(#set|#include|#if|#end|#for|## Advanced content|public class|/* Advanced content */)","ig");results=data.match(myRE2);if(results&&results.length>0){result=true}if(result==true){return confirm(A)}return true}var currentfield="";function show(A){if(currentfield!=""){document.getElementById(currentfield).style.display="none"}document.getElementById(A).style.display="block";currentfield=A}function addUser(B,C){var D=B[C+"newuser"].value;var A=B[C+"users"][0];if(D!=null&&D!=""){length=A.options.length;dusername=D;if(D.indexOf(".")==-1){xusername="XWiki."+D}else{if(D.indexOf(":")==-1){dusername=D.substring(D.lastIndexOf(".")+1)}xusername=D}A.options[length]=new Option(dusername,xusername,true)}}function addGroup(C,D){var B=C[D+"newgroup"].value;var A=C[D+"groups"][0];if(B!=null&&B!=""){length=A.options.length;dgroupname=B;if(B.indexOf(".")==-1){xgroupname="XWiki."+B}else{if(B.indexOf(":")==-1){dgroupname=B.substring(B.lastIndexOf(".")+1)}xgroupname=B}A.options[length]=new Option(dgroupname,xgroupname,true)}}var Prototype={Version:"1.4.0",ScriptFragment:"(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)",emptyFunction:function(){},K:function(A){return A}};var Class={create:function(){return function(){this.initialize.apply(this,arguments)}}};var Abstract=new Object();Object.extend=function(A,B){for(property in B){A[property]=B[property]}return A};Object.inspect=function(A){try{if(A==undefined){return"undefined"}if(A==null){return"null"}return A.inspect?A.inspect():A.toString()}catch(B){if(B instanceof RangeError){return"..."}throw B}};Function.prototype.bind=function(){var A=this,C=$A(arguments),B=C.shift();return function(){return A.apply(B,C.concat($A(arguments)))}};Function.prototype.bindAsEventListener=function(B){var A=this;return function(C){return A.call(B,C||window.event)}};Object.extend(Number.prototype,{toColorPart:function(){var A=this.toString(16);if(this<16){return"0"+A}return A},succ:function(){return this+1},times:function(A){$R(0,this,true).each(A);return this}});var Try={these:function(){var C;for(var B=0;B<arguments.length;B++){var A=arguments[B];try{C=A();break}catch(D){}}return C}};var PeriodicalExecuter=Class.create();PeriodicalExecuter.prototype={initialize:function(B,A){this.callback=B;this.frequency=A;this.currentlyExecuting=false;this.registerCallback()},registerCallback:function(){setInterval(this.onTimerEvent.bind(this),this.frequency*1000)},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.callback()}finally{this.currentlyExecuting=false}}}};function $(){var C=new Array();for(var B=0;B<arguments.length;B++){var A=arguments[B];if(typeof A=="string"){A=document.getElementById(A)}if(arguments.length==1){return A}C.push(A)}return C}Object.extend(String.prototype,{stripTags:function(){return this.replace(/<\/?[^>]+>/gi,"")},stripScripts:function(){return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"")},extractScripts:function(){var B=new RegExp(Prototype.ScriptFragment,"img");var A=new RegExp(Prototype.ScriptFragment,"im");return(this.match(B)||[]).map(function(C){return(C.match(A)||["",""])[1]})},evalScripts:function(){return this.extractScripts().map(eval)},escapeHTML:function(){var B=document.createElement("div");var A=document.createTextNode(this);B.appendChild(A);return B.innerHTML},unescapeHTML:function(){var A=document.createElement("div");A.innerHTML=this.stripTags();return A.childNodes[0]?A.childNodes[0].nodeValue:""},toQueryParams:function(){var A=this.match(/^\??(.*)$/)[1].split("&");return A.inject({},function(D,B){var C=B.split("=");D[C[0]]=C[1];return D})},toArray:function(){return this.split("")},camelize:function(){var D=this.split("-");if(D.length==1){return D[0]}var B=this.indexOf("-")==0?D[0].charAt(0).toUpperCase()+D[0].substring(1):D[0];for(var C=1,A=D.length;C<A;C++){var E=D[C];B+=E.charAt(0).toUpperCase()+E.substring(1)}return B},inspect:function(){return"'"+this.replace("\\","\\\\").replace("'","\\'")+"'"}});String.prototype.parseQuery=String.prototype.toQueryParams;var $break=new Object();var $continue=new Object();var Enumerable={each:function(B){var A=0;try{this._each(function(D){try{B(D,A++)}catch(E){if(E!=$continue){throw E}}})}catch(C){if(C!=$break){throw C}}},all:function(B){var A=true;this.each(function(D,C){A=A&&!!(B||Prototype.K)(D,C);if(!A){throw $break}});return A},any:function(B){var A=true;this.each(function(D,C){if(A=!!(B||Prototype.K)(D,C)){throw $break}});return A},collect:function(B){var A=[];this.each(function(D,C){A.push(B(D,C))});return A},detect:function(B){var A;this.each(function(D,C){if(B(D,C)){A=D;throw $break}});return A},findAll:function(B){var A=[];this.each(function(D,C){if(B(D,C)){A.push(D)}});return A},grep:function(C,B){var A=[];this.each(function(F,E){var D=F.toString();if(D.match(C)){A.push((B||Prototype.K)(F,E))}});return A},include:function(A){var B=false;this.each(function(C){if(C==A){B=true;throw $break}});return B},inject:function(A,B){this.each(function(D,C){A=B(A,D,C)});return A},invoke:function(B){var A=$A(arguments).slice(1);return this.collect(function(C){return C[B].apply(C,A)})},max:function(B){var A;this.each(function(D,C){D=(B||Prototype.K)(D,C);if(D>=(A||D)){A=D}});return A},min:function(B){var A;this.each(function(D,C){D=(B||Prototype.K)(D,C);if(D<=(A||D)){A=D}});return A},partition:function(C){var B=[],A=[];this.each(function(E,D){((C||Prototype.K)(E,D)?B:A).push(E)});return[B,A]},pluck:function(B){var A=[];this.each(function(D,C){A.push(D[B])});return A},reject:function(B){var A=[];this.each(function(D,C){if(!B(D,C)){A.push(D)}});return A},sortBy:function(A){return this.collect(function(C,B){return{value:C,criteria:A(C,B)}}).sort(function(E,D){var C=E.criteria,B=D.criteria;return C<B?-1:C>B?1:0}).pluck("value")},toArray:function(){return this.collect(Prototype.K)},zip:function(){var B=Prototype.K,A=$A(arguments);if(typeof A.last()=="function"){B=A.pop()}var C=[this].concat(A).map($A);return this.map(function(E,D){B(E=C.pluck(D));return E})},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(C){if(!C){return[]}if(C.toArray){return C.toArray()}else{var B=[];for(var A=0;A<C.length;A++){B.push(C[A])}return B}};Object.extend(Array.prototype,Enumerable);Array.prototype._reverse=Array.prototype.reverse;Object.extend(Array.prototype,{_each:function(B){for(var A=0;A<this.length;A++){B(this[A])}},clear:function(){this.length=0;return this},first:function(){return this[0]},last:function(){return this[this.length-1]},compact:function(){return this.select(function(A){return A!=undefined||A!=null})},flatten:function(){return this.inject([],function(B,A){return B.concat(A.constructor==Array?A.flatten():[A])})},without:function(){var A=$A(arguments);return this.select(function(B){return !A.include(B)})},indexOf:function(A){for(var B=0;B<this.length;B++){if(this[B]==A){return B}}return -1},reverse:function(A){return(A!==false?this:this.toArray())._reverse()},shift:function(){var A=this[0];for(var B=0;B<this.length-1;B++){this[B]=this[B+1]}this.length--;return A},inspect:function(){return"["+this.map(Object.inspect).join(", ")+"]"}});var Hash={_each:function(A){for(key in this){var B=this[key];if(typeof B=="function"){continue}var C=[key,B];C.key=key;C.value=B;A(C)}},keys:function(){return this.pluck("key")},values:function(){return this.pluck("value")},merge:function(A){return $H(A).inject($H(this),function(B,C){B[C.key]=C.value;return B})},toQueryString:function(){return this.map(function(A){return A.map(encodeURIComponent).join("=")}).join("&")},inspect:function(){return"#<Hash:{"+this.map(function(A){return A.map(Object.inspect).join(": ")}).join(", ")+"}>"}};function $H(A){var B=Object.extend({},A||{});Object.extend(B,Enumerable);Object.extend(B,Hash);return B}ObjectRange=Class.create();Object.extend(ObjectRange.prototype,Enumerable);Object.extend(ObjectRange.prototype,{initialize:function(C,A,B){this.start=C;this.end=A;this.exclusive=B},_each:function(A){var B=this.start;do{A(B);B=B.succ()}while(this.include(B))},include:function(A){if(A<this.start){return false}if(this.exclusive){return A<this.end}return A<=this.end}});var $R=function(C,A,B){return new ObjectRange(C,A,B)};var Ajax={getTransport:function(){return Try.these(function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")},function(){return new XMLHttpRequest()})||false},activeRequestCount:0};Ajax.Responders={responders:[],_each:function(A){this.responders._each(A)},register:function(A){if(!this.include(A)){this.responders.push(A)}},unregister:function(A){this.responders=this.responders.without(A)},dispatch:function(D,B,C,A){this.each(function(E){if(E[D]&&typeof E[D]=="function"){try{E[D].apply(E,[B,C,A])}catch(F){}}})}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++},onComplete:function(){Ajax.activeRequestCount--}});Ajax.Base=function(){};Ajax.Base.prototype={setOptions:function(A){this.options={method:"post",asynchronous:true,parameters:""};Object.extend(this.options,A||{})},responseIsSuccess:function(){return this.transport.status==undefined||this.transport.status==0||(this.transport.status>=200&&this.transport.status<300)},responseIsFailure:function(){return !this.responseIsSuccess()}};Ajax.Request=Class.create();Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];Ajax.Request.prototype=Object.extend(new Ajax.Base(),{initialize:function(B,A){this.transport=Ajax.getTransport();this.setOptions(A);this.request(B)},request:function(B){var C=this.options.parameters||"";if(C.length>0){C+="&_="}try{this.url=B;if(this.options.method=="get"&&C.length>0){this.url+=(this.url.match(/\?/)?"&":"?")+C}Ajax.Responders.dispatch("onCreate",this,this.transport);this.transport.open(this.options.method,this.url,this.options.asynchronous);if(this.options.asynchronous){this.transport.onreadystatechange=this.onStateChange.bind(this);setTimeout((function(){this.respondToReadyState(1)}).bind(this),10)}this.setRequestHeaders();var A=this.options.postBody?this.options.postBody:C;this.transport.send(this.options.method=="post"?A:null)}catch(D){this.dispatchException(D)}},setRequestHeaders:function(){var B=["X-Requested-With","XMLHttpRequest","X-Prototype-Version",Prototype.Version];if(this.options.method=="post"){B.push("Content-type","application/x-www-form-urlencoded");if(this.transport.overrideMimeType){B.push("Connection","close")}}if(this.options.requestHeaders){B.push.apply(B,this.options.requestHeaders)}for(var A=0;A<B.length;A+=2){this.transport.setRequestHeader(B[A],B[A+1])}},onStateChange:function(){var A=this.transport.readyState;if(A!=1){this.respondToReadyState(this.transport.readyState)}},header:function(A){try{return this.transport.getResponseHeader(A)}catch(B){}},evalJSON:function(){try{return eval(this.header("X-JSON"))}catch(e){}},evalResponse:function(){try{return eval(this.transport.responseText)}catch(e){this.dispatchException(e)}},respondToReadyState:function(A){var C=Ajax.Request.Events[A];var E=this.transport,B=this.evalJSON();if(C=="Complete"){try{(this.options["on"+this.transport.status]||this.options["on"+(this.responseIsSuccess()?"Success":"Failure")]||Prototype.emptyFunction)(E,B)}catch(D){this.dispatchException(D)}if((this.header("Content-type")||"").match(/^text\/javascript/i)){this.evalResponse()}}try{(this.options["on"+C]||Prototype.emptyFunction)(E,B);Ajax.Responders.dispatch("on"+C,this,E,B)}catch(D){this.dispatchException(D)}if(C=="Complete"){this.transport.onreadystatechange=Prototype.emptyFunction}},dispatchException:function(A){(this.options.onException||Prototype.emptyFunction)(this,A);Ajax.Responders.dispatch("onException",this,A)}});Ajax.Updater=Class.create();Object.extend(Object.extend(Ajax.Updater.prototype,Ajax.Request.prototype),{initialize:function(A,C,B){this.containers={success:A.success?$(A.success):$(A),failure:A.failure?$(A.failure):(A.success?null:$(A))};this.transport=Ajax.getTransport();this.setOptions(B);var D=this.options.onComplete||Prototype.emptyFunction;this.options.onComplete=(function(F,E){this.updateContent();D(F,E)}).bind(this);this.request(C)},updateContent:function(){var B=this.responseIsSuccess()?this.containers.success:this.containers.failure;var A=this.transport.responseText;if(!this.options.evalScripts){A=A.stripScripts()}if(B){if(this.options.insertion){new this.options.insertion(B,A)}else{Element.update(B,A)}}if(this.responseIsSuccess()){if(this.onComplete){setTimeout(this.onComplete.bind(this),10)}}}});Ajax.PeriodicalUpdater=Class.create();Ajax.PeriodicalUpdater.prototype=Object.extend(new Ajax.Base(),{initialize:function(A,C,B){this.setOptions(B);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=A;this.url=C;this.start()},start:function(){this.options.onComplete=this.updateComplete.bind(this);this.onTimerEvent()},stop:function(){this.updater.onComplete=undefined;clearTimeout(this.timer);(this.onComplete||Prototype.emptyFunction).apply(this,arguments)},updateComplete:function(A){if(this.options.decay){this.decay=(A.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=A.responseText}this.timer=setTimeout(this.onTimerEvent.bind(this),this.decay*this.frequency*1000)},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options)}});document.getElementsByClassName=function(C,A){var B=($(A)||document.body).getElementsByTagName("*");return $A(B).inject([],function(D,E){if(E.className.match(new RegExp("(^|\\s)"+C+"(\\s|$)"))){D.push(E)}return D})};if(!window.Element){var Element=new Object()}Object.extend(Element,{visible:function(A){return $(A).style.display!="none"},toggle:function(){for(var B=0;B<arguments.length;B++){var A=$(arguments[B]);Element[Element.visible(A)?"hide":"show"](A)}},hide:function(){for(var B=0;B<arguments.length;B++){var A=$(arguments[B]);A.style.display="none"}},show:function(){for(var B=0;B<arguments.length;B++){var A=$(arguments[B]);A.style.display=""}},remove:function(A){A=$(A);A.parentNode.removeChild(A)},update:function(B,A){$(B).innerHTML=A.stripScripts();setTimeout(function(){A.evalScripts()},10)},getHeight:function(A){A=$(A);return A.offsetHeight},classNames:function(A){return new Element.ClassNames(A)},hasClassName:function(A,B){if(!(A=$(A))){return }return Element.classNames(A).include(B)},addClassName:function(A,B){if(!(A=$(A))){return }return Element.classNames(A).add(B)},removeClassName:function(A,B){if(!(A=$(A))){return }return Element.classNames(A).remove(B)},cleanWhitespace:function(B){B=$(B);for(var A=0;A<B.childNodes.length;A++){var C=B.childNodes[A];if(C.nodeType==3&&!/\S/.test(C.nodeValue)){Element.remove(C)}}},empty:function(A){return $(A).innerHTML.match(/^\s*$/)},scrollTo:function(B){B=$(B);var A=B.x?B.x:B.offsetLeft,C=B.y?B.y:B.offsetTop;window.scrollTo(A,C)},getStyle:function(B,C){B=$(B);var D=B.style[C.camelize()];if(!D){if(document.defaultView&&document.defaultView.getComputedStyle){var A=document.defaultView.getComputedStyle(B,null);D=A?A.getPropertyValue(C):null}else{if(B.currentStyle){D=B.currentStyle[C.camelize()]}}}if(window.opera&&["left","top","right","bottom"].include(C)){if(Element.getStyle(B,"position")=="static"){D="auto"}}return D=="auto"?null:D},setStyle:function(A,B){A=$(A);for(name in B){A.style[name.camelize()]=B[name]}},getDimensions:function(B){B=$(B);if(Element.getStyle(B,"display")!="none"){return{width:B.offsetWidth,height:B.offsetHeight}}var A=B.style;var E=A.visibility;var C=A.position;A.visibility="hidden";A.position="absolute";A.display="";var F=B.clientWidth;var D=B.clientHeight;A.display="none";A.position=C;A.visibility=E;return{width:F,height:D}},makePositioned:function(A){A=$(A);var B=Element.getStyle(A,"position");if(B=="static"||!B){A._madePositioned=true;A.style.position="relative";if(window.opera){A.style.top=0;A.style.left=0}}},undoPositioned:function(A){A=$(A);if(A._madePositioned){A._madePositioned=undefined;A.style.position=A.style.top=A.style.left=A.style.bottom=A.style.right=""}},makeClipping:function(A){A=$(A);if(A._overflow){return }A._overflow=A.style.overflow;if((Element.getStyle(A,"overflow")||"visible")!="hidden"){A.style.overflow="hidden"}},undoClipping:function(A){A=$(A);if(A._overflow){return }A.style.overflow=A._overflow;A._overflow=undefined}});var Toggle=new Object();Toggle.display=Element.toggle;Abstract.Insertion=function(A){this.adjacency=A};Abstract.Insertion.prototype={initialize:function(A,B){this.element=$(A);this.content=B.stripScripts();if(this.adjacency&&this.element.insertAdjacentHTML){try{this.element.insertAdjacentHTML(this.adjacency,this.content)}catch(C){if(this.element.tagName.toLowerCase()=="tbody"){this.insertContent(this.contentFromAnonymousTable())}else{throw C}}}else{this.range=this.element.ownerDocument.createRange();if(this.initializeRange){this.initializeRange()}this.insertContent([this.range.createContextualFragment(this.content)])}setTimeout(function(){B.evalScripts()},10)},contentFromAnonymousTable:function(){var A=document.createElement("div");A.innerHTML="<table><tbody>"+this.content+"</tbody></table>";return $A(A.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(A){A.each((function(B){this.element.parentNode.insertBefore(B,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(A){A.reverse(false).each((function(B){this.element.insertBefore(B,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(A){A.each((function(B){this.element.appendChild(B)}).bind(this))}});Insertion.After=Class.create();Insertion.After.prototype=Object.extend(new Abstract.Insertion("afterEnd"),{initializeRange:function(){this.range.setStartAfter(this.element)},insertContent:function(A){A.each((function(B){this.element.parentNode.insertBefore(B,this.element.nextSibling)}).bind(this))}});Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(A){this.element=$(A)},_each:function(A){this.element.className.split(/\s+/).select(function(B){return B.length>0})._each(A)},set:function(A){this.element.className=A},add:function(A){if(this.include(A)){return }this.set(this.toArray().concat(A).join(" "))},remove:function(A){if(!this.include(A)){return }this.set(this.select(function(B){return B!=A}).join(" "))},toString:function(){return this.toArray().join(" ")}};Object.extend(Element.ClassNames.prototype,Enumerable);var Field={clear:function(){for(var A=0;A<arguments.length;A++){$(arguments[A]).value=""}},focus:function(A){$(A).focus()},present:function(){for(var A=0;A<arguments.length;A++){if($(arguments[A]).value==""){return false}}return true},select:function(A){$(A).select()},activate:function(A){A=$(A);A.focus();if(A.select){A.select()}}};var Form={serialize:function(D){var E=Form.getElements($(D));var C=new Array();for(var B=0;B<E.length;B++){var A=Form.Element.serialize(E[B]);if(A){C.push(A)}}return C.join("&")},getElements:function(B){B=$(B);var C=new Array();for(tagName in Form.Element.Serializers){var D=B.getElementsByTagName(tagName);for(var A=0;A<D.length;A++){C.push(D[A])}}return C},getInputs:function(F,C,D){F=$(F);var A=F.getElementsByTagName("input");if(!C&&!D){return A}var G=new Array();for(var E=0;E<A.length;E++){var B=A[E];if((C&&B.type!=C)||(D&&B.name!=D)){continue}G.push(B)}return G},disable:function(C){var D=Form.getElements(C);for(var B=0;B<D.length;B++){var A=D[B];A.blur();A.disabled="true"}},enable:function(C){var D=Form.getElements(C);for(var B=0;B<D.length;B++){var A=D[B];A.disabled=""}},findFirstElement:function(A){return Form.getElements(A).find(function(B){return B.type!="hidden"&&!B.disabled&&["input","select","textarea"].include(B.tagName.toLowerCase())})},focusFirstElement:function(A){Field.activate(Form.findFirstElement(A))},reset:function(A){$(A).reset()}};Form.Element={serialize:function(B){B=$(B);var D=B.tagName.toLowerCase();var C=Form.Element.Serializers[D](B);if(C){var A=encodeURIComponent(C[0]);if(A.length==0){return }if(C[1].constructor!=Array){C[1]=[C[1]]}return C[1].map(function(E){return A+"="+encodeURIComponent(E)}).join("&")}},getValue:function(A){A=$(A);var C=A.tagName.toLowerCase();var B=Form.Element.Serializers[C](A);if(B){return B[1]}}};Form.Element.Serializers={input:function(A){switch(A.type.toLowerCase()){case"submit":case"hidden":case"password":case"text":return Form.Element.Serializers.textarea(A);case"checkbox":case"radio":return Form.Element.Serializers.inputSelector(A)}return false},inputSelector:function(A){if(A.checked){return[A.name,A.value]}},textarea:function(A){return[A.name,A.value]},select:function(A){return Form.Element.Serializers[A.type=="select-one"?"selectOne":"selectMany"](A)},selectOne:function(C){var D="",B,A=C.selectedIndex;if(A>=0){B=C.options[A];D=B.value;if(!D&&!("value" in B)){D=B.text}}return[C.name,D]},selectMany:function(C){var D=new Array();for(var B=0;B<C.length;B++){var A=C.options[B];if(A.selected){var E=A.value;if(!E&&!("value" in A)){E=A.text}D.push(E)}}return[C.name,D]}};var $F=Form.Element.getValue;Abstract.TimedObserver=function(){};Abstract.TimedObserver.prototype={initialize:function(A,B,C){this.frequency=B;this.element=$(A);this.callback=C;this.lastValue=this.getValue();this.registerCallback()},registerCallback:function(){setInterval(this.onTimerEvent.bind(this),this.frequency*1000)},onTimerEvent:function(){var A=this.getValue();if(this.lastValue!=A){this.callback(this.element,A);this.lastValue=A}}};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(A,B){this.element=$(A);this.callback=B;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase()=="form"){this.registerFormCallbacks()}else{this.registerCallback(this.element)}},onElementEvent:function(){var A=this.getValue();if(this.lastValue!=A){this.callback(this.element,A);this.lastValue=A}},registerFormCallbacks:function(){var B=Form.getElements(this.element);for(var A=0;A<B.length;A++){this.registerCallback(B[A])}},registerCallback:function(A){if(A.type){switch(A.type.toLowerCase()){case"checkbox":case"radio":Event.observe(A,"click",this.onElementEvent.bind(this));break;case"password":case"text":case"textarea":case"select-one":case"select-multiple":Event.observe(A,"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,element:function(A){return A.target||A.srcElement},isLeftClick:function(A){return(((A.which)&&(A.which==1))||((A.button)&&(A.button==1)))},pointerX:function(A){return A.pageX||(A.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft))},pointerY:function(A){return A.pageY||(A.clientY+(document.documentElement.scrollTop||document.body.scrollTop))},stop:function(A){if(A.preventDefault){A.preventDefault();A.stopPropagation()}else{A.returnValue=false;A.cancelBubble=true}},findElement:function(C,B){var A=Event.element(C);while(A.parentNode&&(!A.tagName||(A.tagName.toUpperCase()!=B.toUpperCase()))){A=A.parentNode}return A},observers:false,_observeAndCache:function(D,C,B,A){if(!this.observers){this.observers=[]}if(D.addEventListener){this.observers.push([D,C,B,A]);D.addEventListener(C,B,A)}else{if(D.attachEvent){this.observers.push([D,C,B,A]);D.attachEvent("on"+C,B)}}},unloadCache:function(){if(!Event.observers){return }for(var A=0;A<Event.observers.length;A++){Event.stopObserving.apply(this,Event.observers[A]);Event.observers[A][0]=null}Event.observers=false},observe:function(D,C,B,A){var D=$(D);A=A||false;if(C=="keypress"&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||D.attachEvent)){C="keydown"}this._observeAndCache(D,C,B,A)},stopObserving:function(D,C,B,A){var D=$(D);A=A||false;if(C=="keypress"&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||D.detachEvent)){C="keydown"}if(D.removeEventListener){D.removeEventListener(C,B,A)}else{if(D.detachEvent){D.detachEvent("on"+C,B)}}}});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(B){var A=0,C=0;do{A+=B.scrollTop||0;C+=B.scrollLeft||0;B=B.parentNode}while(B);return[C,A]},cumulativeOffset:function(B){var A=0,C=0;do{A+=B.offsetTop||0;C+=B.offsetLeft||0;B=B.offsetParent}while(B);return[C,A]},positionedOffset:function(B){var A=0,C=0;do{A+=B.offsetTop||0;C+=B.offsetLeft||0;B=B.offsetParent;if(B){p=Element.getStyle(B,"position");if(p=="relative"||p=="absolute"){break}}}while(B);return[C,A]},offsetParent:function(A){if(A.offsetParent){return A.offsetParent}if(A==document.body){return A}while((A=A.parentNode)&&A!=document.body){if(Element.getStyle(A,"position")!="static"){return A}}return document.body},within:function(B,A,C){if(this.includeScrollOffsets){return this.withinIncludingScrolloffsets(B,A,C)}this.xcomp=A;this.ycomp=C;this.offset=this.cumulativeOffset(B);return(C>=this.offset[1]&&C<this.offset[1]+B.offsetHeight&&A>=this.offset[0]&&A<this.offset[0]+B.offsetWidth)},withinIncludingScrolloffsets:function(B,A,D){var C=this.realOffset(B);this.xcomp=A+C[0]-this.deltaX;this.ycomp=D+C[1]-this.deltaY;this.offset=this.cumulativeOffset(B);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+B.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+B.offsetWidth)},overlap:function(B,A){if(!B){return 0}if(B=="vertical"){return((this.offset[1]+A.offsetHeight)-this.ycomp)/A.offsetHeight}if(B=="horizontal"){return((this.offset[0]+A.offsetWidth)-this.xcomp)/A.offsetWidth}},clone:function(B,C){B=$(B);C=$(C);C.style.position="absolute";var A=this.cumulativeOffset(B);C.style.top=A[1]+"px";C.style.left=A[0]+"px";C.style.width=B.offsetWidth+"px";C.style.height=B.offsetHeight+"px"},page:function(D){var A=0,C=0;var B=D;do{A+=B.offsetTop||0;C+=B.offsetLeft||0;if(B.offsetParent==document.body){if(Element.getStyle(B,"position")=="absolute"){break}}}while(B=B.offsetParent);B=D;do{A-=B.scrollTop||0;C-=B.scrollLeft||0}while(B=B.parentNode);return[C,A]},clone:function(C,E){var A=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});C=$(C);var D=Position.page(C);E=$(E);var F=[0,0];var B=null;if(Element.getStyle(E,"position")=="absolute"){B=Position.offsetParent(E);F=Position.page(B)}if(B==document.body){F[0]-=document.body.offsetLeft;F[1]-=document.body.offsetTop}if(A.setLeft){E.style.left=(D[0]-F[0]+A.offsetLeft)+"px"}if(A.setTop){E.style.top=(D[1]-F[1]+A.offsetTop)+"px"}if(A.setWidth){E.style.width=C.offsetWidth+"px"}if(A.setHeight){E.style.height=C.offsetHeight+"px"}},absolutize:function(B){B=$(B);if(B.style.position=="absolute"){return }Position.prepare();var D=Position.positionedOffset(B);var F=D[1];var E=D[0];var C=B.clientWidth;var A=B.clientHeight;B._originalLeft=E-parseFloat(B.style.left||0);B._originalTop=F-parseFloat(B.style.top||0);B._originalWidth=B.style.width;B._originalHeight=B.style.height;B.style.position="absolute";B.style.top=F+"px";B.style.left=E+"px";B.style.width=C+"px";B.style.height=A+"px"},relativize:function(A){A=$(A);if(A.style.position=="relative"){return }Position.prepare();A.style.position="relative";var C=parseFloat(A.style.top||0)-(A._originalTop||0);var B=parseFloat(A.style.left||0)-(A._originalLeft||0);A.style.top=C+"px";A.style.left=B+"px";A.style.height=A._originalHeight;A.style.width=A._originalWidth}};if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){Position.cumulativeOffset=function(B){var A=0,C=0;do{A+=B.offsetTop||0;C+=B.offsetLeft||0;if(B.offsetParent==document.body){if(Element.getStyle(B,"position")=="absolute"){break}}B=B.offsetParent}while(B);return[C,A]}}var Rico={Version:"1.1.2",prototypeVersion:parseFloat(Prototype.Version.split(".")[0]+"."+Prototype.Version.split(".")[1])};if((typeof Prototype=="undefined")||Rico.prototypeVersion<1.3){throw ("Rico requires the Prototype JavaScript framework >= 1.3")}Rico.ArrayExtensions=new Array();if(Object.prototype.extend){Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Object.prototype.extend}else{Object.prototype.extend=function(A){return Object.extend.apply(this,[this,A])};Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Object.prototype.extend}if(Array.prototype.push){Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.push}if(!Array.prototype.remove){Array.prototype.remove=function(A){if(isNaN(A)||A>this.length){return false}for(var B=0,C=0;B<this.length;B++){if(B!=A){this[C++]=this[B]}}this.length-=1};Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.remove}if(!Array.prototype.removeItem){Array.prototype.removeItem=function(B){for(var A=0;A<this.length;A++){if(this[A]==B){this.remove(A);break}}};Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.removeItem}if(!Array.prototype.indices){Array.prototype.indices=function(){var A=new Array();for(index in this){var C=false;for(var B=0;B<Rico.ArrayExtensions.length;B++){if(this[index]==Rico.ArrayExtensions[B]){C=true;break}}if(!C){A[A.length]=index}}return A};Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.indices}if(window.DOMParser&&window.XMLSerializer&&window.Node&&Node.prototype&&Node.prototype.__defineGetter__){if(!Document.prototype.loadXML){Document.prototype.loadXML=function(B){var C=(new DOMParser()).parseFromString(B,"text/xml");while(this.hasChildNodes()){this.removeChild(this.lastChild)}for(var A=0;A<C.childNodes.length;A++){this.appendChild(this.importNode(C.childNodes[A],true))}}}Document.prototype.__defineGetter__("xml",function(){return(new XMLSerializer()).serializeToString(this)})}document.getElementsByTagAndClassName=function(D,E){if(D==null){D="*"}var C=document.getElementsByTagName(D)||document.all;var F=new Array();if(E==null){return C}for(var B=0;B<C.length;B++){var H=C[B];var G=H.className.split(" ");for(var A=0;A<G.length;A++){if(G[A]==E){F.push(H);break}}}return F};Rico.Accordion=Class.create();Rico.Accordion.prototype={initialize:function(A,C){this.container=$(A);this.lastExpandedTab=null;this.accordionTabs=new Array();this.setOptions(C);this._attachBehaviors();if(!A){return }this.container.style.borderBottom="1px solid "+this.options.borderColor;if(this.options.onLoadShowTab>=this.accordionTabs.length){this.options.onLoadShowTab=0}for(var E=0;E<this.accordionTabs.length;E++){if(E!=this.options.onLoadShowTab){this.accordionTabs[E].collapse();this.accordionTabs[E].content.style.display="none"}}this.lastExpandedTab=this.accordionTabs[this.options.onLoadShowTab];if(this.options.panelHeight=="auto"){var F=(this.options.onloadShowTab===0)?1:0;var B=parseInt(RicoUtil.getElementsComputedStyle(this.accordionTabs[F].titleBar,"height"));if(isNaN(B)){B=this.accordionTabs[F].titleBar.offsetHeight}var G=this.accordionTabs.length*B;var D=parseInt(RicoUtil.getElementsComputedStyle(this.container.parentNode,"height"));if(isNaN(D)){D=this.container.parentNode.offsetHeight}this.options.panelHeight=D-G-2}this.lastExpandedTab.content.style.height=this.options.panelHeight+"px";this.lastExpandedTab.showExpanded();this.lastExpandedTab.titleBar.style.fontWeight=this.options.expandedFontWeight},setOptions:function(A){this.options={expandedBg:"#63699c",hoverBg:"#63699c",collapsedBg:"#6b79a5",expandedTextColor:"#ffffff",expandedFontWeight:"bold",hoverTextColor:"#ffffff",collapsedTextColor:"#ced7ef",collapsedFontWeight:"normal",hoverTextColor:"#ffffff",borderColor:"#1f669b",panelHeight:200,onHideTab:null,onShowTab:null,onLoadShowTab:0};Object.extend(this.options,A||{})},showTabByIndex:function(C,B){var A=arguments.length==1?true:B;this.showTab(this.accordionTabs[C],A)},showTab:function(E,D){if(this.lastExpandedTab==E){return }var C=arguments.length==1?true:D;if(this.options.onHideTab){this.options.onHideTab(this.lastExpandedTab)}this.lastExpandedTab.showCollapsed();var B=this;var A=this.lastExpandedTab;this.lastExpandedTab.content.style.height=(this.options.panelHeight-1)+"px";E.content.style.display="";E.titleBar.style.fontWeight=this.options.expandedFontWeight;if(C){new Rico.Effect.AccordionSize(this.lastExpandedTab.content,E.content,1,this.options.panelHeight,100,10,{complete:function(){B.showTabDone(A)}});this.lastExpandedTab=E}else{this.lastExpandedTab.content.style.height="1px";E.content.style.height=this.options.panelHeight+"px";this.lastExpandedTab=E;this.showTabDone(A)}},showTabDone:function(A){A.content.style.display="none";this.lastExpandedTab.showExpanded();if(this.options.onShowTab){this.options.onShowTab(this.lastExpandedTab)}},_attachBehaviors:function(){var A=this._getDirectChildrenByTag(this.container,"DIV");for(var B=0;B<A.length;B++){var E=this._getDirectChildrenByTag(A[B],"DIV");if(E.length!=2){continue}var C=E[0];var D=E[1];this.accordionTabs.push(new Rico.Accordion.Tab(this,C,D))}},_getDirectChildrenByTag:function(E,D){var B=new Array();var A=E.childNodes;for(var C=0;C<A.length;C++){if(A[C]&&A[C].tagName&&A[C].tagName==D){B.push(A[C])}}return B}};Rico.Accordion.Tab=Class.create();Rico.Accordion.Tab.prototype={initialize:function(A,B,C){this.accordion=A;this.titleBar=B;this.content=C;this._attachBehaviors()},collapse:function(){this.showCollapsed();this.content.style.height="1px"},showCollapsed:function(){this.expanded=false;this.titleBar.style.backgroundColor=this.accordion.options.collapsedBg;this.titleBar.style.color=this.accordion.options.collapsedTextColor;this.titleBar.style.fontWeight=this.accordion.options.collapsedFontWeight;this.content.style.overflow="hidden"},showExpanded:function(){this.expanded=true;this.titleBar.style.backgroundColor=this.accordion.options.expandedBg;this.titleBar.style.color=this.accordion.options.expandedTextColor;this.content.style.overflow="auto"},titleBarClicked:function(A){if(this.accordion.lastExpandedTab==this){return }this.accordion.showTab(this)},hover:function(A){this.titleBar.style.backgroundColor=this.accordion.options.hoverBg;this.titleBar.style.color=this.accordion.options.hoverTextColor},unhover:function(A){if(this.expanded){this.titleBar.style.backgroundColor=this.accordion.options.expandedBg;this.titleBar.style.color=this.accordion.options.expandedTextColor}else{this.titleBar.style.backgroundColor=this.accordion.options.collapsedBg;this.titleBar.style.color=this.accordion.options.collapsedTextColor}},_attachBehaviors:function(){this.content.style.border="1px solid "+this.accordion.options.borderColor;this.content.style.borderTopWidth="0px";this.content.style.borderBottomWidth="0px";this.content.style.margin="0px";this.titleBar.onclick=this.titleBarClicked.bindAsEventListener(this);this.titleBar.onmouseover=this.hover.bindAsEventListener(this);this.titleBar.onmouseout=this.unhover.bindAsEventListener(this)}};Rico.AjaxEngine=Class.create();Rico.AjaxEngine.prototype={initialize:function(){this.ajaxElements=new Array();this.ajaxObjects=new Array();this.requestURLS=new Array();this.options={}},registerAjaxElement:function(B,A){if(!A){A=$(B)}this.ajaxElements[B]=A},registerAjaxObject:function(B,A){this.ajaxObjects[B]=A},registerRequest:function(A,B){this.requestURLS[A]=B},sendRequest:function(B,A){if(arguments.length>=2){if(typeof arguments[1]=="string"){A={parameters:this._createQueryString(arguments,1)}}}this.sendRequestWithData(B,null,A)},sendRequestWithData:function(D,C,A){var B=this.requestURLS[D];if(B==null){return }if(arguments.length>=3){if(typeof arguments[2]=="string"){A.parameters=this._createQueryString(arguments,2)}}new Ajax.Request(B,this._requestOptions(A,C))},sendRequestAndUpdate:function(C,A,B){if(arguments.length>=3){if(typeof arguments[2]=="string"){B.parameters=this._createQueryString(arguments,2)}}this.sendRequestWithDataAndUpdate(C,null,A,B)},sendRequestWithDataAndUpdate:function(F,E,A,B){var C=this.requestURLS[F];if(C==null){return }if(arguments.length>=4){if(typeof arguments[3]=="string"){B.parameters=this._createQueryString(arguments,3)}}var D=this._requestOptions(B,E);new Ajax.Updater(A,C,D)},_requestOptions:function(B,D){var C=["X-Rico-Version",Rico.Version];var A="post";if(D==null){if(Rico.prototypeVersion<1.4){C.push("Content-type","text/xml")}else{A="get"}}(!B)?B={}:"";if(!B._RicoOptionsProcessed){if(B.onComplete){B.onRicoComplete=B.onComplete}if(B.overrideOnComplete){B.onComplete=B.overrideOnComplete}else{B.onComplete=this._onRequestComplete.bind(this)}B._RicoOptionsProcessed=true}this.options={requestHeaders:C,parameters:B.parameters,postBody:D,method:A,onComplete:B.onComplete};Object.extend(this.options,B);return this.options},_createQueryString:function(E,F){var H="";for(var C=F;C<E.length;C++){if(C!=F){H+="&"}var D=E[C];if(D.name!=undefined&&D.value!=undefined){H+=D.name+"="+escape(D.value)}else{var B=D.indexOf("=");var G=D.substring(0,B);var A=D.substring(B+1);H+=G+"="+escape(A)}}return H},_onRequestComplete:function(B){if(!B){return }if(B.status!=200){return }var A=B.responseXML.getElementsByTagName("ajax-response");if(A==null||A.length!=1){return }this._processAjaxResponse(A[0].childNodes);var C=this.options.onRicoComplete;if(C!=null){C()}},_processAjaxResponse:function(D){for(var C=0;C<D.length;C++){var E=D[C];if(E.nodeType!=1){continue}var B=E.getAttribute("type");var A=E.getAttribute("id");if(B=="object"){this._processAjaxObjectUpdate(this.ajaxObjects[A],E)}else{if(B=="element"){this._processAjaxElementUpdate(this.ajaxElements[A],E)}else{alert("unrecognized AjaxResponse type : "+B)}}}},_processAjaxObjectUpdate:function(A,B){A.ajaxUpdate(B)},_processAjaxElementUpdate:function(A,B){A.innerHTML=RicoUtil.getContentAsString(B)}};var ajaxEngine=new Rico.AjaxEngine();Rico.Color=Class.create();Rico.Color.prototype={initialize:function(C,B,A){this.rgb={r:C,g:B,b:A}},setRed:function(A){this.rgb.r=A},setGreen:function(A){this.rgb.g=A},setBlue:function(A){this.rgb.b=A},setHue:function(B){var A=this.asHSB();A.h=B;this.rgb=Rico.Color.HSBtoRGB(A.h,A.s,A.b)},setSaturation:function(B){var A=this.asHSB();A.s=B;this.rgb=Rico.Color.HSBtoRGB(A.h,A.s,A.b)},setBrightness:function(A){var B=this.asHSB();B.b=A;this.rgb=Rico.Color.HSBtoRGB(B.h,B.s,B.b)},darken:function(B){var A=this.asHSB();this.rgb=Rico.Color.HSBtoRGB(A.h,A.s,Math.max(A.b-B,0))},brighten:function(B){var A=this.asHSB();this.rgb=Rico.Color.HSBtoRGB(A.h,A.s,Math.min(A.b+B,1))},blend:function(A){this.rgb.r=Math.floor((this.rgb.r+A.rgb.r)/2);this.rgb.g=Math.floor((this.rgb.g+A.rgb.g)/2);this.rgb.b=Math.floor((this.rgb.b+A.rgb.b)/2)},isBright:function(){var A=this.asHSB();return this.asHSB().b>0.5},isDark:function(){return !this.isBright()},asRGB:function(){return"rgb("+this.rgb.r+","+this.rgb.g+","+this.rgb.b+")"},asHex:function(){return"#"+this.rgb.r.toColorPart()+this.rgb.g.toColorPart()+this.rgb.b.toColorPart()},asHSB:function(){return Rico.Color.RGBtoHSB(this.rgb.r,this.rgb.g,this.rgb.b)},toString:function(){return this.asHex()}};Rico.Color.createFromHex=function(D){if(D.length==4){var B=D;var D="#";for(var C=1;C<4;C++){D+=(B.charAt(C)+B.charAt(C))}}if(D.indexOf("#")==0){D=D.substring(1)}var F=D.substring(0,2);var E=D.substring(2,4);var A=D.substring(4,6);return new Rico.Color(parseInt(F,16),parseInt(E,16),parseInt(A,16))};Rico.Color.createColorFromBackground=function(D){var B=RicoUtil.getElementsComputedStyle($(D),"backgroundColor","background-color");if(B=="transparent"&&D.parentNode){return Rico.Color.createColorFromBackground(D.parentNode)}if(B==null){return new Rico.Color(255,255,255)}if(B.indexOf("rgb(")==0){var A=B.substring(4,B.length-1);var C=A.split(",");return new Rico.Color(parseInt(C[0]),parseInt(C[1]),parseInt(C[2]))}else{if(B.indexOf("#")==0){return Rico.Color.createFromHex(B)}else{return new Rico.Color(255,255,255)}}};Rico.Color.HSBtoRGB=function(G,E,I){var C=0;var D=0;var J=0;if(E==0){C=parseInt(I*255+0.5);D=C;J=C}else{var F=(G-Math.floor(G))*6;var H=F-Math.floor(F);var B=I*(1-E);var A=I*(1-E*H);var K=I*(1-(E*(1-H)));switch(parseInt(F)){case 0:C=(I*255+0.5);D=(K*255+0.5);J=(B*255+0.5);break;case 1:C=(A*255+0.5);D=(I*255+0.5);J=(B*255+0.5);break;case 2:C=(B*255+0.5);D=(I*255+0.5);J=(K*255+0.5);break;case 3:C=(B*255+0.5);D=(A*255+0.5);J=(I*255+0.5);break;case 4:C=(K*255+0.5);D=(B*255+0.5);J=(I*255+0.5);break;case 5:C=(I*255+0.5);D=(B*255+0.5);J=(A*255+0.5);break}}return{r:parseInt(C),g:parseInt(D),b:parseInt(J)}};Rico.Color.RGBtoHSB=function(A,E,J){var F;var D;var I;var K=(A>E)?A:E;if(J>K){K=J}var G=(A<E)?A:E;if(J<G){G=J}I=K/255;if(K!=0){D=(K-G)/K}else{D=0}if(D==0){F=0}else{var B=(K-A)/(K-G);var H=(K-E)/(K-G);var C=(K-J)/(K-G);if(A==K){F=C-H}else{if(E==K){F=2+B-C}else{F=4+H-B}}F=F/6;if(F<0){F=F+1}}return{h:F,s:D,b:I}};Rico.Corner={round:function(D,B){var D=$(D);this._setOptions(B);var A=this.options.color;if(this.options.color=="fromElement"){A=this._background(D)}var C=this.options.bgColor;if(this.options.bgColor=="fromParent"){C=this._background(D.offsetParent)}this._roundCornersImpl(D,A,C)},_roundCornersImpl:function(C,A,B){if(this.options.border){this._renderBorder(C,B)}if(this._isTopRounded()){this._roundTopCorners(C,A,B)}if(this._isBottomRounded()){this._roundBottomCorners(C,A,B)}},_renderBorder:function(D,E){var B="1px solid "+this._borderColor(E);var A="border-left: "+B;var F="border-right: "+B;var C="style='"+A+";"+F+"'";D.innerHTML="<div "+C+">"+D.innerHTML+"</div>"},_roundTopCorners:function(C,A,E){var D=this._createCorner(E);for(var B=0;B<this.options.numSlices;B++){D.appendChild(this._createCornerSlice(A,E,B,"top"))}C.style.paddingTop=0;C.insertBefore(D,C.firstChild)},_roundBottomCorners:function(C,A,E){var D=this._createCorner(E);for(var B=(this.options.numSlices-1);B>=0;B--){D.appendChild(this._createCornerSlice(A,E,B,"bottom"))}C.style.paddingBottom=0;C.appendChild(D)},_createCorner:function(B){var A=document.createElement("div");A.style.backgroundColor=(this._isTransparent()?"transparent":B);return A},_createCornerSlice:function(C,D,G,A){var E=document.createElement("span");var B=E.style;B.backgroundColor=C;B.display="block";B.height="1px";B.overflow="hidden";B.fontSize="1px";var F=this._borderColor(C,D);if(this.options.border&&G==0){B.borderTopStyle="solid";B.borderTopWidth="1px";B.borderLeftWidth="0px";B.borderRightWidth="0px";B.borderBottomWidth="0px";B.height="0px";B.borderColor=F}else{if(F){B.borderColor=F;B.borderStyle="solid";B.borderWidth="0px 1px"}}if(!this.options.compact&&(G==(this.options.numSlices-1))){B.height="2px"}this._setMargin(E,G,A);this._setBorder(E,G,A);return E},_setOptions:function(A){this.options={corners:"all",color:"fromElement",bgColor:"fromParent",blend:true,border:false,compact:false};Object.extend(this.options,A||{});this.options.numSlices=this.options.compact?2:4;if(this._isTransparent()){this.options.blend=false}},_whichSideTop:function(){if(this._hasString(this.options.corners,"all","top")){return""}if(this.options.corners.indexOf("tl")>=0&&this.options.corners.indexOf("tr")>=0){return""}if(this.options.corners.indexOf("tl")>=0){return"left"}else{if(this.options.corners.indexOf("tr")>=0){return"right"}}return""},_whichSideBottom:function(){if(this._hasString(this.options.corners,"all","bottom")){return""}if(this.options.corners.indexOf("bl")>=0&&this.options.corners.indexOf("br")>=0){return""}if(this.options.corners.indexOf("bl")>=0){return"left"}else{if(this.options.corners.indexOf("br")>=0){return"right"}}return""},_borderColor:function(A,B){if(A=="transparent"){return B}else{if(this.options.border){return this.options.border}else{if(this.options.blend){return this._blend(B,A)}else{return""}}}},_setMargin:function(D,E,B){var C=this._marginSize(E);var A=B=="top"?this._whichSideTop():this._whichSideBottom();if(A=="left"){D.style.marginLeft=C+"px";D.style.marginRight="0px"}else{if(A=="right"){D.style.marginRight=C+"px";D.style.marginLeft="0px"}else{D.style.marginLeft=C+"px";D.style.marginRight=C+"px"}}},_setBorder:function(D,E,B){var C=this._borderSize(E);var A=B=="top"?this._whichSideTop():this._whichSideBottom();if(A=="left"){D.style.borderLeftWidth=C+"px";D.style.borderRightWidth="0px"}else{if(A=="right"){D.style.borderRightWidth=C+"px";D.style.borderLeftWidth="0px"}else{D.style.borderLeftWidth=C+"px";D.style.borderRightWidth=C+"px"}}if(this.options.border!=false){D.style.borderLeftWidth=C+"px"}D.style.borderRightWidth=C+"px"},_marginSize:function(E){if(this._isTransparent()){return 0}var D=[5,3,2,1];var A=[3,2,1,0];var C=[2,1];var B=[1,0];if(this.options.compact&&this.options.blend){return B[E]}else{if(this.options.compact){return C[E]}else{if(this.options.blend){return A[E]}else{return D[E]}}}},_borderSize:function(E){var D=[5,3,2,1];var B=[2,1,1,1];var A=[1,0];var C=[0,2,0,0];if(this.options.compact&&(this.options.blend||this._isTransparent())){return 1}else{if(this.options.compact){return A[E]}else{if(this.options.blend){return B[E]}else{if(this.options.border){return C[E]}else{if(this._isTransparent()){return D[E]}}}}}return 0},_hasString:function(B){for(var A=1;A<arguments.length;A++){if(B.indexOf(arguments[A])>=0){return true}}return false},_blend:function(C,A){var B=Rico.Color.createFromHex(C);B.blend(Rico.Color.createFromHex(A));return B},_background:function(A){try{return Rico.Color.createColorFromBackground(A).asHex()}catch(B){return"#ffffff"}},_isTransparent:function(){return this.options.color=="transparent"},_isTopRounded:function(){return this._hasString(this.options.corners,"all","top","tl","tr")},_isBottomRounded:function(){return this._hasString(this.options.corners,"all","bottom","bl","br")},_hasSingleTextChild:function(A){return A.childNodes.length==1&&A.childNodes[0].nodeType==3}};Rico.DragAndDrop=Class.create();Rico.DragAndDrop.prototype={initialize:function(){this.dropZones=new Array();this.draggables=new Array();this.currentDragObjects=new Array();this.dragElement=null;this.lastSelectedDraggable=null;this.currentDragObjectVisible=false;this.interestedInMotionEvents=false;this._mouseDown=this._mouseDownHandler.bindAsEventListener(this);this._mouseMove=this._mouseMoveHandler.bindAsEventListener(this);this._mouseUp=this._mouseUpHandler.bindAsEventListener(this)},registerDropZone:function(A){this.dropZones[this.dropZones.length]=A},deregisterDropZone:function(A){var D=new Array();var B=0;for(var C=0;C<this.dropZones.length;C++){if(this.dropZones[C]!=A){D[B++]=this.dropZones[C]}}this.dropZones=D},clearDropZones:function(){this.dropZones=new Array()},registerDraggable:function(A){this.draggables[this.draggables.length]=A;this._addMouseDownHandler(A)},clearSelection:function(){for(var A=0;A<this.currentDragObjects.length;A++){this.currentDragObjects[A].deselect()}this.currentDragObjects=new Array();this.lastSelectedDraggable=null},hasSelection:function(){return this.currentDragObjects.length>0},setStartDragFromElement:function(A,B){this.origPos=RicoUtil.toDocumentPosition(B);this.startx=A.screenX-this.origPos.x;this.starty=A.screenY-this.origPos.y;this.interestedInMotionEvents=this.hasSelection();this._terminateEvent(A)},updateSelection:function(A,B){if(!B){this.clearSelection()}if(A.isSelected()){this.currentDragObjects.removeItem(A);A.deselect();if(A==this.lastSelectedDraggable){this.lastSelectedDraggable=null}}else{this.currentDragObjects[this.currentDragObjects.length]=A;A.select();this.lastSelectedDraggable=A}},_mouseDownHandler:function(F){if(arguments.length==0){F=event}var B=F.which!=undefined;if((B&&F.which!=1)||(!B&&F.button!=1)){return }var E=F.target?F.target:F.srcElement;var A=E.draggable;var D=E;while(A==null&&D.parentNode){D=D.parentNode;A=D.draggable}if(A==null){return }this.updateSelection(A,F.ctrlKey);if(this.hasSelection()){for(var C=0;C<this.dropZones.length;C++){this.dropZones[C].clearPositionCache()}}this.setStartDragFromElement(F,A.getMouseDownHTMLElement())},_mouseMoveHandler:function(B){var A=B.which!=undefined;if(!this.interestedInMotionEvents){return }if(!this.hasSelection()){return }if(!this.currentDragObjectVisible){this._startDrag(B)}if(!this.activatedDropZones){this._activateRegisteredDropZones()}this._updateDraggableLocation(B);this._updateDropZonesHover(B);this._terminateEvent(B)},_makeDraggableObjectVisible:function(B){if(!this.hasSelection()){return }var A;if(this.currentDragObjects.length>1){A=this.currentDragObjects[0].getMultiObjectDragGUI(this.currentDragObjects)}else{A=this.currentDragObjects[0].getSingleObjectDragGUI()}if(RicoUtil.getElementsComputedStyle(A,"position")!="absolute"){A.style.position="absolute"}if(A.parentNode==null||A.parentNode.nodeType==11){document.body.appendChild(A)}this.dragElement=A;this._updateDraggableLocation(B);this.currentDragObjectVisible=true},_leftOffset:function(A){return A.offsetX?document.body.scrollLeft:0},_topOffset:function(A){return A.offsetY?document.body.scrollTop:0},_updateDraggableLocation:function(B){var A=this.dragElement.style;A.left=(B.screenX+this._leftOffset(B)-this.startx)+"px";A.top=(B.screenY+this._topOffset(B)-this.starty)+"px"},_updateDropZonesHover:function(B){var C=this.dropZones.length;for(var A=0;A<C;A++){if(!this._mousePointInDropZone(B,this.dropZones[A])){this.dropZones[A].hideHover()}}for(var A=0;A<C;A++){if(this._mousePointInDropZone(B,this.dropZones[A])){if(this.dropZones[A].canAccept(this.currentDragObjects)){this.dropZones[A].showHover()}}}},_startDrag:function(B){for(var A=0;A<this.currentDragObjects.length;A++){this.currentDragObjects[A].startDrag()}this._makeDraggableObjectVisible(B)},_mouseUpHandler:function(B){if(!this.hasSelection()){return }var A=B.which!=undefined;if((A&&B.which!=1)||(!A&&B.button!=1)){return }this.interestedInMotionEvents=false;if(this.dragElement==null){this._terminateEvent(B);return }if(this._placeDraggableInDropZone(B)){this._completeDropOperation(B)}else{this._terminateEvent(B);new Rico.Effect.Position(this.dragElement,this.origPos.x,this.origPos.y,200,20,{complete:this._doCancelDragProcessing.bind(this)})}Event.stopObserving(document.body,"mousemove",this._mouseMove);Event.stopObserving(document.body,"mouseup",this._mouseUp)},_retTrue:function(){return true},_completeDropOperation:function(A){if(this.dragElement!=this.currentDragObjects[0].getMouseDownHTMLElement()){if(this.dragElement.parentNode!=null){this.dragElement.parentNode.removeChild(this.dragElement)}}this._deactivateRegisteredDropZones();this._endDrag();this.clearSelection();this.dragElement=null;this.currentDragObjectVisible=false;this._terminateEvent(A)},_doCancelDragProcessing:function(){this._cancelDrag();if(this.dragElement!=this.currentDragObjects[0].getMouseDownHTMLElement()&&this.dragElement){if(this.dragElement.parentNode!=null){this.dragElement.parentNode.removeChild(this.dragElement)}}this._deactivateRegisteredDropZones();this.dragElement=null;this.currentDragObjectVisible=false},_placeDraggableInDropZone:function(C){var A=false;var D=this.dropZones.length;for(var B=0;B<D;B++){if(this._mousePointInDropZone(C,this.dropZones[B])){if(this.dropZones[B].canAccept(this.currentDragObjects)){this.dropZones[B].hideHover();this.dropZones[B].accept(this.currentDragObjects);A=true;break}}}return A},_cancelDrag:function(){for(var A=0;A<this.currentDragObjects.length;A++){this.currentDragObjects[A].cancelDrag()}},_endDrag:function(){for(var A=0;A<this.currentDragObjects.length;A++){this.currentDragObjects[A].endDrag()}},_mousePointInDropZone:function(B,C){var A=C.getAbsoluteRect();return B.clientX>A.left+this._leftOffset(B)&&B.clientX<A.right+this._leftOffset(B)&&B.clientY>A.top+this._topOffset(B)&&B.clientY<A.bottom+this._topOffset(B)},_addMouseDownHandler:function(A){htmlElement=A.getMouseDownHTMLElement();if(htmlElement!=null){htmlElement.draggable=A;Event.observe(htmlElement,"mousedown",this._onmousedown.bindAsEventListener(this));Event.observe(htmlElement,"mousedown",this._mouseDown)}},_activateRegisteredDropZones:function(){var C=this.dropZones.length;for(var A=0;A<C;A++){var B=this.dropZones[A];if(B.canAccept(this.currentDragObjects)){B.activate()}}this.activatedDropZones=true},_deactivateRegisteredDropZones:function(){var B=this.dropZones.length;for(var A=0;A<B;A++){this.dropZones[A].deactivate()}this.activatedDropZones=false},_onmousedown:function(){Event.observe(document.body,"mousemove",this._mouseMove);Event.observe(document.body,"mouseup",this._mouseUp)},_terminateEvent:function(A){if(A.stopPropagation!=undefined){A.stopPropagation()}else{if(A.cancelBubble!=undefined){A.cancelBubble=true}}if(A.preventDefault!=undefined){A.preventDefault()}else{A.returnValue=false}},initializeEventHandlers:function(){if(typeof document.implementation!="undefined"&&document.implementation.hasFeature("HTML","1.0")&&document.implementation.hasFeature("Events","2.0")&&document.implementation.hasFeature("CSS","2.0")){document.addEventListener("mouseup",this._mouseUpHandler.bindAsEventListener(this),false);document.addEventListener("mousemove",this._mouseMoveHandler.bindAsEventListener(this),false)}else{if(document.attachEvent){document.attachEvent("onmouseup",this._mouseUpHandler.bindAsEventListener(this));document.attachEvent("onmousemove",this._mouseMoveHandler.bindAsEventListener(this))}}}};var dndMgr=new Rico.DragAndDrop();dndMgr.initializeEventHandlers();Rico.Draggable=Class.create();Rico.Draggable.prototype={initialize:function(A,B){this.type=A;this.htmlElement=$(B);this.selected=false},getMouseDownHTMLElement:function(){return this.htmlElement},select:function(){this.selected=true;if(this.showingSelected){return }var B=this.getMouseDownHTMLElement();var A=Rico.Color.createColorFromBackground(B);A.isBright()?A.darken(0.033):A.brighten(0.033);this.saveBackground=RicoUtil.getElementsComputedStyle(B,"backgroundColor","background-color");B.style.backgroundColor=A.asHex();this.showingSelected=true},deselect:function(){this.selected=false;if(!this.showingSelected){return }var A=this.getMouseDownHTMLElement();A.style.backgroundColor=this.saveBackground;this.showingSelected=false},isSelected:function(){return this.selected},startDrag:function(){},cancelDrag:function(){},endDrag:function(){},getSingleObjectDragGUI:function(){return this.htmlElement},getMultiObjectDragGUI:function(A){return this.htmlElement},getDroppedGUI:function(){return this.htmlElement},toString:function(){return this.type+":"+this.htmlElement+":"}};Rico.Dropzone=Class.create();Rico.Dropzone.prototype={initialize:function(A){this.htmlElement=$(A);this.absoluteRect=null},getHTMLElement:function(){return this.htmlElement},clearPositionCache:function(){this.absoluteRect=null},getAbsoluteRect:function(){if(this.absoluteRect==null){var A=this.getHTMLElement();var B=RicoUtil.toViewportPosition(A);this.absoluteRect={top:B.y,left:B.x,bottom:B.y+A.offsetHeight,right:B.x+A.offsetWidth}}return this.absoluteRect},activate:function(){var C=this.getHTMLElement();if(C==null||this.showingActive){return }this.showingActive=true;this.saveBackgroundColor=C.style.backgroundColor;var B="#ffea84";var A=Rico.Color.createColorFromBackground(C);if(A==null){C.style.backgroundColor=B}else{A.isBright()?A.darken(0.2):A.brighten(0.2);C.style.backgroundColor=A.asHex()}},deactivate:function(){var A=this.getHTMLElement();if(A==null||!this.showingActive){return }A.style.backgroundColor=this.saveBackgroundColor;this.showingActive=false;this.saveBackgroundColor=null},showHover:function(){var A=this.getHTMLElement();if(A==null||this.showingHover){return }this.saveBorderWidth=A.style.borderWidth;this.saveBorderStyle=A.style.borderStyle;this.saveBorderColor=A.style.borderColor;this.showingHover=true;A.style.borderWidth="1px";A.style.borderStyle="solid";A.style.borderColor="#ffff00"},hideHover:function(){var A=this.getHTMLElement();if(A==null||!this.showingHover){return }A.style.borderWidth=this.saveBorderWidth;A.style.borderStyle=this.saveBorderStyle;A.style.borderColor=this.saveBorderColor;this.showingHover=false},canAccept:function(A){return true},accept:function(B){var D=this.getHTMLElement();if(D==null){return }n=B.length;for(var A=0;A<n;A++){var C=B[A].getDroppedGUI();if(RicoUtil.getElementsComputedStyle(C,"position")=="absolute"){C.style.position="static";C.style.top="";C.style.top=""}D.appendChild(C)}}};Rico.Effect={};Rico.Effect.SizeAndPosition=Class.create();Rico.Effect.SizeAndPosition.prototype={initialize:function(E,A,H,B,F,G,C,D){this.element=$(E);this.x=A;this.y=H;this.w=B;this.h=F;this.duration=G;this.steps=C;this.options=arguments[7]||{};this.sizeAndPosition()},sizeAndPosition:function(){if(this.isFinished()){if(this.options.complete){this.options.complete(this)}return }if(this.timer){clearTimeout(this.timer)}var F=Math.round(this.duration/this.steps);var C=this.element.offsetLeft;var B=this.element.offsetTop;var D=this.element.offsetWidth;var I=this.element.offsetHeight;this.x=(this.x)?this.x:C;this.y=(this.y)?this.y:B;this.w=(this.w)?this.w:D;this.h=(this.h)?this.h:I;var G=this.steps>0?(this.x-C)/this.steps:0;var E=this.steps>0?(this.y-B)/this.steps:0;var H=this.steps>0?(this.w-D)/this.steps:0;var A=this.steps>0?(this.h-I)/this.steps:0;this.moveBy(G,E);this.resizeBy(H,A);this.duration-=F;this.steps--;this.timer=setTimeout(this.sizeAndPosition.bind(this),F)},isFinished:function(){return this.steps<=0},moveBy:function(B,G){var F=this.element.offsetLeft;var D=this.element.offsetTop;var C=parseInt(B);var A=parseInt(G);var E=this.element.style;if(C!=0){E.left=(F+C)+"px"}if(A!=0){E.top=(D+A)+"px"}},resizeBy:function(A,E){var C=this.element.offsetWidth;var G=this.element.offsetHeight;var B=parseInt(A);var F=parseInt(E);var D=this.element.style;if(B!=0){D.width=(C+B)+"px"}if(F!=0){D.height=(G+F)+"px"}}};Rico.Effect.Size=Class.create();Rico.Effect.Size.prototype={initialize:function(D,A,E,F,B,C){new Rico.Effect.SizeAndPosition(D,null,null,A,E,F,B,C)}};Rico.Effect.Position=Class.create();Rico.Effect.Position.prototype={initialize:function(D,A,F,E,B,C){new Rico.Effect.SizeAndPosition(D,A,F,null,null,E,B,C)}};Rico.Effect.Round=Class.create();Rico.Effect.Round.prototype={initialize:function(C,D,A){var E=document.getElementsByTagAndClassName(C,D);for(var B=0;B<E.length;B++){Rico.Corner.round(E[B],A)}}};Rico.Effect.FadeTo=Class.create();Rico.Effect.FadeTo.prototype={initialize:function(D,C,E,A,B){this.element=$(D);this.opacity=C;this.duration=E;this.steps=A;this.options=arguments[4]||{};this.fadeTo()},fadeTo:function(){if(this.isFinished()){if(this.options.complete){this.options.complete(this)}return }if(this.timer){clearTimeout(this.timer)}var B=Math.round(this.duration/this.steps);var A=this.getElementOpacity();var C=this.steps>0?(this.opacity-A)/this.steps:0;this.changeOpacityBy(C);this.duration-=B;this.steps--;this.timer=setTimeout(this.fadeTo.bind(this),B)},changeOpacityBy:function(B){var A=this.getElementOpacity();var C=Math.max(0,Math.min(A+B,1));this.element.ricoOpacity=C;this.element.style.filter="alpha(opacity:"+Math.round(C*100)+")";this.element.style.opacity=C},isFinished:function(){return this.steps<=0},getElementOpacity:function(){if(this.element.ricoOpacity==undefined){var A=RicoUtil.getElementsComputedStyle(this.element,"opacity");this.element.ricoOpacity=A!=undefined?A:1}return parseFloat(this.element.ricoOpacity)}};Rico.Effect.AccordionSize=Class.create();Rico.Effect.AccordionSize.prototype={initialize:function(F,E,G,A,D,B,C){this.e1=$(F);this.e2=$(E);this.start=G;this.end=A;this.duration=D;this.steps=B;this.options=arguments[6]||{};this.accordionSize()},accordionSize:function(){if(this.isFinished()){this.e1.style.height=this.start+"px";this.e2.style.height=this.end+"px";if(this.options.complete){this.options.complete(this)}return }if(this.timer){clearTimeout(this.timer)}var A=Math.round(this.duration/this.steps);var B=this.steps>0?(parseInt(this.e1.offsetHeight)-this.start)/this.steps:0;this.resizeBy(B);this.duration-=A;this.steps--;this.timer=setTimeout(this.accordionSize.bind(this),A)},isFinished:function(){return this.steps<=0},resizeBy:function(B){var D=this.e1.offsetHeight;var A=this.e2.offsetHeight;var C=parseInt(B);if(B!=0){this.e1.style.height=(D-C)+"px";this.e2.style.height=(A+C)+"px"}}};Rico.LiveGridMetaData=Class.create();Rico.LiveGridMetaData.prototype={initialize:function(A,C,D,B){this.pageSize=A;this.totalRows=C;this.setOptions(B);this.ArrowHeight=16;this.columnCount=D},setOptions:function(A){this.options={largeBufferSize:7,nearLimitFactor:0.2};Object.extend(this.options,A||{})},getPageSize:function(){return this.pageSize},getTotalRows:function(){return this.totalRows},setTotalRows:function(A){this.totalRows=A},getLargeBufferSize:function(){return parseInt(this.options.largeBufferSize*this.pageSize)},getLimitTolerance:function(){return parseInt(this.getLargeBufferSize()*this.options.nearLimitFactor)}};Rico.LiveGridScroller=Class.create();Rico.LiveGridScroller.prototype={initialize:function(B,A){this.isIE=navigator.userAgent.toLowerCase().indexOf("msie")>=0;this.liveGrid=B;this.metaData=B.metaData;this.createScrollBar();this.scrollTimeout=null;this.lastScrollPos=0;this.viewPort=A;this.rows=new Array()},isUnPlugged:function(){return this.scrollerDiv.onscroll==null},plugin:function(){this.scrollerDiv.onscroll=this.handleScroll.bindAsEventListener(this)},unplug:function(){this.scrollerDiv.onscroll=null},sizeIEHeaderHack:function(){if(!this.isIE){return }var A=$(this.liveGrid.tableId+"_header");if(A){A.rows[0].cells[0].style.width=(A.rows[0].cells[0].offsetWidth+1)+"px"}},createScrollBar:function(){var A=this.liveGrid.viewPort.visibleHeight();this.scrollerDiv=document.createElement("div");var C=this.scrollerDiv.style;C.borderRight=this.liveGrid.options.scrollerBorderRight;C.position="relative";C.left=this.isIE?"-6px":"-3px";C.width="19px";C.height=A+"px";C.overflow="auto";this.heightDiv=document.createElement("div");this.heightDiv.style.width="1px";this.heightDiv.style.height=parseInt(A*this.metaData.getTotalRows()/this.metaData.getPageSize())+"px";this.scrollerDiv.appendChild(this.heightDiv);this.scrollerDiv.onscroll=this.handleScroll.bindAsEventListener(this);var D=this.liveGrid.table;D.parentNode.parentNode.insertBefore(this.scrollerDiv,D.parentNode.nextSibling);var B=this.isIE?"mousewheel":"DOMMouseScroll";Event.observe(D,B,function(E){if(E.wheelDelta>=0||E.detail<0){this.scrollerDiv.scrollTop-=(2*this.viewPort.rowHeight)}else{this.scrollerDiv.scrollTop+=(2*this.viewPort.rowHeight)}this.handleScroll(false)}.bindAsEventListener(this),false)},updateSize:function(){var B=this.liveGrid.table;var A=this.viewPort.visibleHeight();this.heightDiv.style.height=parseInt(A*this.metaData.getTotalRows()/this.metaData.getPageSize())+"px"},rowToPixel:function(A){return(A/this.metaData.getTotalRows())*this.heightDiv.offsetHeight},moveScroll:function(A){this.scrollerDiv.scrollTop=this.rowToPixel(A);if(this.metaData.options.onscroll){this.metaData.options.onscroll(this.liveGrid,A)}},handleScroll:function(){if(this.scrollTimeout){clearTimeout(this.scrollTimeout)}var C=this.lastScrollPos-this.scrollerDiv.scrollTop;if(C!=0){var B=this.scrollerDiv.scrollTop%this.viewPort.rowHeight;if(B!=0){this.unplug();if(C<0){this.scrollerDiv.scrollTop+=(this.viewPort.rowHeight-B)}else{this.scrollerDiv.scrollTop-=B}this.plugin()}}var A=parseInt(this.scrollerDiv.scrollTop/this.viewPort.rowHeight);this.liveGrid.requestContentRefresh(A);this.viewPort.scrollTo(this.scrollerDiv.scrollTop);if(this.metaData.options.onscroll){this.metaData.options.onscroll(this.liveGrid,A)}this.scrollTimeout=setTimeout(this.scrollIdle.bind(this),1200);this.lastScrollPos=this.scrollerDiv.scrollTop},scrollIdle:function(){if(this.metaData.options.onscrollidle){this.metaData.options.onscrollidle()}}};Rico.LiveGridBuffer=Class.create();Rico.LiveGridBuffer.prototype={initialize:function(A,B){this.startPos=0;this.size=0;this.metaData=A;this.rows=new Array();this.updateInProgress=false;this.viewPort=B;this.maxBufferSize=A.getLargeBufferSize()*2;this.maxFetchSize=A.getLargeBufferSize();this.lastOffset=0},getBlankRow:function(){if(!this.blankRow){this.blankRow=new Array();for(var A=0;A<this.metaData.columnCount;A++){this.blankRow[A]="&nbsp;"}}return this.blankRow},loadRows:function(B){var E=B.getElementsByTagName("rows")[0];this.updateUI=E.getAttribute("update_ui")=="true";var F=new Array();var G=E.getElementsByTagName("tr");for(var D=0;D<G.length;D++){var K=F[D]=new Array();var J=G[D].getElementsByTagName("td");for(var C=0;C<J.length;C++){var I=J[C];var H=I.getAttribute("convert_spaces")=="true";var A=RicoUtil.getContentAsString(I);K[C]=H?this.convertSpaces(A):A;if(!K[C]){K[C]="&nbsp;"}}}return F},update:function(B,D){var A=this.loadRows(B);if(this.rows.length==0){this.rows=A;this.size=this.rows.length;this.startPos=D;return }if(D>this.startPos){if(this.startPos+this.rows.length<D){this.rows=A;this.startPos=D}else{this.rows=this.rows.concat(A.slice(0,A.length));if(this.rows.length>this.maxBufferSize){var C=this.rows.length;this.rows=this.rows.slice(this.rows.length-this.maxBufferSize,this.rows.length);this.startPos=this.startPos+(C-this.rows.length)}}}else{if(D+A.length<this.startPos){this.rows=A}else{this.rows=A.slice(0,this.startPos).concat(this.rows);if(this.rows.length>this.maxBufferSize){this.rows=this.rows.slice(0,this.maxBufferSize)}}this.startPos=D}this.size=this.rows.length},clear:function(){this.rows=new Array();this.startPos=0;this.size=0},isOverlapping:function(B,A){return((B<this.endPos())&&(this.startPos<B+A))||(this.endPos()==0)},isInRange:function(A){return(A>=this.startPos)&&(A+this.metaData.getPageSize()<=this.endPos())},isNearingTopLimit:function(A){return A-this.startPos<this.metaData.getLimitTolerance()},endPos:function(){return this.startPos+this.rows.length},isNearingBottomLimit:function(A){return this.endPos()-(A+this.metaData.getPageSize())<this.metaData.getLimitTolerance()},isAtTop:function(){return this.startPos==0},isAtBottom:function(){return this.endPos()==this.metaData.getTotalRows()},isNearingLimit:function(A){return(!this.isAtTop()&&this.isNearingTopLimit(A))||(!this.isAtBottom()&&this.isNearingBottomLimit(A))},getFetchSize:function(C){var A=this.getFetchOffset(C);var B=0;if(A>=this.startPos){var D=this.maxFetchSize+A;if(D>this.metaData.totalRows){D=this.metaData.totalRows}B=D-A;if(A==0&&B<this.maxFetchSize){B=this.maxFetchSize}}else{var B=this.startPos-A;if(B>this.maxFetchSize){B=this.maxFetchSize}}return B},getFetchOffset:function(B){var A=B;if(B>this.startPos){A=(B>this.endPos())?B:this.endPos()}else{if(B+this.maxFetchSize>=this.startPos){var A=this.startPos-this.maxFetchSize;if(A<0){A=0}}}this.lastOffset=A;return A},getRows:function(G,E){var F=G-this.startPos;var B=F+E;if(B>this.size){B=this.size}var D=new Array();var A=0;for(var C=F;C<B;C++){D[A++]=this.rows[C]}return D},convertSpaces:function(A){return A.split(" ").join("&nbsp;")}};Rico.GridViewPort=Class.create();Rico.GridViewPort.prototype={initialize:function(C,B,D,A,E){this.lastDisplayedStartPos=0;this.div=C.parentNode;this.table=C;this.rowHeight=B;this.div.style.height=(this.rowHeight*D)+"px";this.div.style.overflow="hidden";this.buffer=A;this.liveGrid=E;this.visibleRows=D+1;this.lastPixelOffset=0;this.startPos=0},populateRow:function(C,B){for(var A=0;A<B.length;A++){C.cells[A].innerHTML=B[A]}},bufferChanged:function(){this.refreshContents(parseInt(this.lastPixelOffset/this.rowHeight))},clearRows:function(){if(!this.isBlank){this.liveGrid.table.className=this.liveGrid.options.loadingClass;for(var A=0;A<this.visibleRows;A++){this.populateRow(this.table.rows[A],this.buffer.getBlankRow())}this.isBlank=true}},clearContents:function(){this.clearRows();this.scrollTo(0);this.startPos=0;this.lastStartPos=-1},refreshContents:function(G){if(G==this.lastRowPos&&!this.isPartialBlank&&!this.isBlank){return }if((G+this.visibleRows<this.buffer.startPos)||(this.buffer.startPos+this.buffer.size<G)||(this.buffer.size==0)){this.clearRows();return }this.isBlank=false;var F=this.buffer.startPos>G;var B=F?this.buffer.startPos:G;var A=(this.buffer.startPos+this.buffer.size<G+this.visibleRows)?this.buffer.startPos+this.buffer.size:G+this.visibleRows;var J=A-B;var K=this.buffer.getRows(B,J);var D=this.visibleRows-J;var H=F?0:J;var C=F?D:0;for(var E=0;E<K.length;E++){this.populateRow(this.table.rows[E+C],K[E])}for(var E=0;E<D;E++){this.populateRow(this.table.rows[E+H],this.buffer.getBlankRow())}this.isPartialBlank=D>0;this.lastRowPos=G;this.liveGrid.table.className=this.liveGrid.options.tableClass;var I=this.liveGrid.options.onRefreshComplete;if(I!=null){I()}},scrollTo:function(A){if(this.lastPixelOffset==A){return }this.refreshContents(parseInt(A/this.rowHeight));this.div.scrollTop=A%this.rowHeight;this.lastPixelOffset=A},visibleHeight:function(){return parseInt(RicoUtil.getElementsComputedStyle(this.div,"height"))}};Rico.LiveGridRequest=Class.create();Rico.LiveGridRequest.prototype={initialize:function(B,A){this.requestOffset=B}};Rico.LiveGrid=Class.create();Rico.LiveGrid.prototype={initialize:function(C,B,H,A,I,D){this.options={tableClass:$(C).className,loadingClass:$(C).className,scrollerBorderRight:"1px solid #ababab",bufferTimeout:20000,sortAscendImg:"images/sort_asc.gif",sortDescendImg:"images/sort_desc.gif",sortImageWidth:9,sortImageHeight:5,ajaxSortURLParms:[],onRefreshComplete:null,requestParameters:null,inlineStyles:true};Object.extend(this.options,I||{});this.ajaxOptions={parameters:null};Object.extend(this.ajaxOptions,D||{});this.tableId=C;this.table=$(C);this.addLiveGridHtml();var F=this.table.rows[0].cells.length;this.metaData=new Rico.LiveGridMetaData(B,H,F,I);this.buffer=new Rico.LiveGridBuffer(this.metaData);var G=this.table.rows.length;this.viewPort=new Rico.GridViewPort(this.table,this.table.offsetHeight/G,B,this.buffer,this);this.scroller=new Rico.LiveGridScroller(this,this.viewPort);this.options.sortHandler=this.sortHandler.bind(this);if($(C+"_header")){this.sort=new Rico.LiveGridSort(C+"_header",this.options)}this.processingRequest=null;this.unprocessedRequest=null;this.initAjax(A);if(this.options.prefetchBuffer||this.options.prefetchOffset>0){var E=0;if(this.options.offset){E=this.options.offset;this.scroller.moveScroll(E);this.viewPort.scrollTo(this.scroller.rowToPixel(E))}if(this.options.sortCol){this.sortCol=I.sortCol;this.sortDir=I.sortDir}this.requestContentRefresh(E)}},addLiveGridHtml:function(){if(this.table.getElementsByTagName("thead").length>0){var A=this.table.cloneNode(true);A.setAttribute("id",this.tableId+"_header");A.setAttribute("class",this.table.className+"_header");for(var B=0;B<A.tBodies.length;B++){A.removeChild(A.tBodies[B])}this.table.deleteTHead();this.table.parentNode.insertBefore(A,this.table)}new Insertion.Before(this.table,"<div id='"+this.tableId+"_container'></div>");this.table.previousSibling.appendChild(this.table);new Insertion.Before(this.table,"<div id='"+this.tableId+"_viewport' style='float:left;'></div>");this.table.previousSibling.appendChild(this.table)},resetContents:function(){this.scroller.moveScroll(0);this.buffer.clear();this.viewPort.clearContents()},sortHandler:function(A){if(!A){return }this.sortCol=A.name;this.sortDir=A.currentSort;this.resetContents();this.requestContentRefresh(0)},adjustRowSize:function(){},setTotalRows:function(A){this.resetContents();this.metaData.setTotalRows(A);this.scroller.updateSize()},initAjax:function(A){ajaxEngine.registerRequest(this.tableId+"_request",A);ajaxEngine.registerAjaxObject(this.tableId+"_updater",this)},invokeAjax:function(){},handleTimedOut:function(){this.processingRequest=null;this.processQueuedRequest()},fetchBuffer:function(C){if(this.buffer.isInRange(C)&&!this.buffer.isNearingLimit(C)){return }if(this.processingRequest){this.unprocessedRequest=new Rico.LiveGridRequest(C);return }var B=this.buffer.getFetchOffset(C);this.processingRequest=new Rico.LiveGridRequest(C);this.processingRequest.bufferOffset=B;var A=this.buffer.getFetchSize(C);var E=false;var D;if(this.options.requestParameters){D=this._createQueryString(this.options.requestParameters,0)}D=(D==null)?"":D+"&";D=D+"id="+this.tableId+"&page_size="+A+"&offset="+B;if(this.sortCol){D=D+"&sort_col="+escape(this.sortCol)+"&sort_dir="+this.sortDir}this.ajaxOptions.parameters=D;ajaxEngine.sendRequest(this.tableId+"_request",this.ajaxOptions);this.timeoutHandler=setTimeout(this.handleTimedOut.bind(this),this.options.bufferTimeout)},setRequestParams:function(){this.options.requestParameters=[];for(var A=0;A<arguments.length;A++){this.options.requestParameters[A]=arguments[A]}},requestContentRefresh:function(A){this.fetchBuffer(A)},ajaxUpdate:function(B){try{clearTimeout(this.timeoutHandler);this.buffer.update(B,this.processingRequest.bufferOffset);this.viewPort.bufferChanged()}catch(A){}finally{this.processingRequest=null}this.processQueuedRequest()},_createQueryString:function(E,F){var H="";if(!E){return H}for(var C=F;C<E.length;C++){if(C!=F){H+="&"}var D=E[C];if(D.name!=undefined&&D.value!=undefined){H+=D.name+"="+escape(D.value)}else{var B=D.indexOf("=");var G=D.substring(0,B);var A=D.substring(B+1);H+=G+"="+escape(A)}}return H},processQueuedRequest:function(){if(this.unprocessedRequest!=null){this.requestContentRefresh(this.unprocessedRequest.requestOffset);this.unprocessedRequest=null}}};Rico.LiveGridSort=Class.create();Rico.LiveGridSort.prototype={initialize:function(B,A){this.headerTableId=B;this.headerTable=$(B);this.options=A;this.setOptions();this.applySortBehavior();if(this.options.sortCol){this.setSortUI(this.options.sortCol,this.options.sortDir)}},setSortUI:function(A,D){var C=this.options.columns;for(var B=0;B<C.length;B++){if(C[B].name==A){this.setColumnSort(B,D);break}}},setOptions:function(){new Image().src=this.options.sortAscendImg;new Image().src=this.options.sortDescendImg;this.sort=this.options.sortHandler;if(!this.options.columns){this.options.columns=this.introspectForColumnInfo()}else{this.options.columns=this.convertToTableColumns(this.options.columns)}},applySortBehavior:function(){var C=this.headerTable.rows[0];var A=C.cells;for(var B=0;B<A.length;B++){this.addSortBehaviorToColumn(B,A[B])}},addSortBehaviorToColumn:function(B,A){if(this.options.columns[B].isSortable()){A.id=this.headerTableId+"_"+B;A.style.cursor="pointer";A.onclick=this.headerCellClicked.bindAsEventListener(this);A.innerHTML=A.innerHTML+'<span id="'+this.headerTableId+"_img_"+B+'">&nbsp;&nbsp;&nbsp;</span>'}},headerCellClicked:function(A){var E=A.target?A.target:A.srcElement;var C=E.id;var B=parseInt(C.substring(C.lastIndexOf("_")+1));var D=this.getSortedColumnIndex();if(D!=-1){if(D!=B){this.removeColumnSort(D);this.setColumnSort(B,Rico.TableColumn.SORT_ASC)}else{this.toggleColumnSort(D)}}else{this.setColumnSort(B,Rico.TableColumn.SORT_ASC)}if(this.options.sortHandler){this.options.sortHandler(this.options.columns[B])}},removeColumnSort:function(A){this.options.columns[A].setUnsorted();this.setSortImage(A)},setColumnSort:function(B,A){if(isNaN(B)){return }this.options.columns[B].setSorted(A);this.setSortImage(B)},toggleColumnSort:function(A){this.options.columns[A].toggleSort();this.setSortImage(A)},setSortImage:function(C){var B=this.options.columns[C].getSortDirection();var A=$(this.headerTableId+"_img_"+C);if(B==Rico.TableColumn.UNSORTED){A.innerHTML="&nbsp;&nbsp;"}else{if(B==Rico.TableColumn.SORT_ASC){A.innerHTML='&nbsp;&nbsp;<img width="'+this.options.sortImageWidth+'" height="'+this.options.sortImageHeight+'" src="'+this.options.sortAscendImg+'"/>'}else{if(B==Rico.TableColumn.SORT_DESC){A.innerHTML='&nbsp;&nbsp;<img width="'+this.options.sortImageWidth+'" height="'+this.options.sortImageHeight+'" src="'+this.options.sortDescendImg+'"/>'}}}},getSortedColumnIndex:function(){var B=this.options.columns;for(var A=0;A<B.length;A++){if(B[A].isSorted()){return A}}return -1},introspectForColumnInfo:function(){var C=new Array();var D=this.headerTable.rows[0];var A=D.cells;for(var B=0;B<A.length;B++){C.push(new Rico.TableColumn(this.deriveColumnNameFromCell(A[B],B),true))}return C},convertToTableColumns:function(C){var B=new Array();for(var A=0;A<C.length;A++){B.push(new Rico.TableColumn(C[A][0],C[A][1]))}return B},deriveColumnNameFromCell:function(A,C){var B=A.innerText!=undefined?A.innerText:A.textContent;return B?B.toLowerCase().split(" ").join("_"):"col_"+C}};Rico.TableColumn=Class.create();Rico.TableColumn.UNSORTED=0;Rico.TableColumn.SORT_ASC="ASC";Rico.TableColumn.SORT_DESC="DESC";Rico.TableColumn.prototype={initialize:function(A,B){this.name=A;this.sortable=B;this.currentSort=Rico.TableColumn.UNSORTED},isSortable:function(){return this.sortable},isSorted:function(){return this.currentSort!=Rico.TableColumn.UNSORTED},getSortDirection:function(){return this.currentSort},toggleSort:function(){if(this.currentSort==Rico.TableColumn.UNSORTED||this.currentSort==Rico.TableColumn.SORT_DESC){this.currentSort=Rico.TableColumn.SORT_ASC}else{if(this.currentSort==Rico.TableColumn.SORT_ASC){this.currentSort=Rico.TableColumn.SORT_DESC}}},setUnsorted:function(A){this.setSorted(Rico.TableColumn.UNSORTED)},setSorted:function(A){this.currentSort=A}};var RicoUtil={getElementsComputedStyle:function(D,A,B){if(arguments.length==2){B=A}var C=$(D);if(C.currentStyle){return C.currentStyle[A]}else{return document.defaultView.getComputedStyle(C,null).getPropertyValue(B)}},createXmlDocument:function(){if(document.implementation&&document.implementation.createDocument){var A=document.implementation.createDocument("","",null);if(A.readyState==null){A.readyState=1;A.addEventListener("load",function(){A.readyState=4;if(typeof A.onreadystatechange=="function"){A.onreadystatechange()}},false)}return A}if(window.ActiveXObject){return Try.these(function(){return new ActiveXObject("MSXML2.DomDocument")},function(){return new ActiveXObject("Microsoft.DomDocument")},function(){return new ActiveXObject("MSXML.DomDocument")},function(){return new ActiveXObject("MSXML3.DomDocument")})||false}return null},getContentAsString:function(A){return A.xml!=undefined?this._getContentAsStringIE(A):this._getContentAsStringMozilla(A)},_getContentAsStringIE:function(A){var C="";for(var B=0;B<A.childNodes.length;B++){var D=A.childNodes[B];if(D.nodeType==4){C+=D.nodeValue}else{C+=D.xml}}return C},_getContentAsStringMozilla:function(B){var A=new XMLSerializer();var D="";for(var C=0;C<B.childNodes.length;C++){var E=B.childNodes[C];if(E.nodeType==4){D+=E.nodeValue}else{D+=A.serializeToString(E)}}return D},toViewportPosition:function(A){return this._toAbsolute(A,true)},toDocumentPosition:function(A){return this._toAbsolute(A,false)},_toAbsolute:function(B,E){if(navigator.userAgent.toLowerCase().indexOf("msie")==-1){return this._toAbsoluteMozilla(B,E)}var A=0;var G=0;var D=B;while(D){var C=0;var F=0;if(D!=B){var C=parseInt(this.getElementsComputedStyle(D,"borderLeftWidth"));var F=parseInt(this.getElementsComputedStyle(D,"borderTopWidth"));C=isNaN(C)?0:C;F=isNaN(F)?0:F}A+=D.offsetLeft-D.scrollLeft+C;G+=D.offsetTop-D.scrollTop+F;D=D.offsetParent}if(E){A-=this.docScrollLeft();G-=this.docScrollTop()}return{x:A,y:G}},_toAbsoluteMozilla:function(B,D){var A=0;var E=0;var C=B;while(C){A+=C.offsetLeft;E+=C.offsetTop;C=C.offsetParent}C=B;while(C&&C!=document.body&&C!=document.documentElement){if(C.scrollLeft){A-=C.scrollLeft}if(C.scrollTop){E-=C.scrollTop}C=C.parentNode}if(D){A-=this.docScrollLeft();E-=this.docScrollTop()}return{x:A,y:E}},docScrollLeft:function(){if(window.pageXOffset){return window.pageXOffset}else{if(document.documentElement&&document.documentElement.scrollLeft){return document.documentElement.scrollLeft}else{if(document.body){return document.body.scrollLeft}else{return 0}}}},docScrollTop:function(){if(window.pageYOffset){return window.pageYOffset}else{if(document.documentElement&&document.documentElement.scrollTop){return document.documentElement.scrollTop}else{if(document.body){return document.body.scrollTop}else{return 0}}}}};Rico.Accordion.prototype.initialize=function(A,C){this.container=$(A);this.lastExpandedTab=null;this.accordionTabs=new Array();this.setOptions(C);this._attachBehaviors();if(!A){return }if(this.options.onLoadShowTab>=this.accordionTabs.length){this.options.onLoadShowTab=0}this.lastExpandedTab=this.accordionTabs[this.options.onLoadShowTab];if(this.options.panelHeight=="auto"){var G=(this.options.onloadShowTab===0)?1:0;if(this.accordionTabs&&this.accordionTabs.length>0){var B=parseInt(RicoUtil.getElementsComputedStyle(this.accordionTabs[G].titleBar,"height"))}if(isNaN(B)){B=this.accordionTabs[G].titleBar.offsetHeight}var H=this.accordionTabs.length*B;var E=parseInt(RicoUtil.getElementsComputedStyle(this.container.parentNode,"height"));if(isNaN(E)){E=this.container.parentNode.offsetHeight}this.options.panelHeight=E-H-2}else{if(this.options.panelHeight=="flex"){this.flexible=true;this.tabHeight=new Object();var G=(this.options.onloadShowTab===0)?1:0;if(this.accordionTabs&&this.accordionTabs.length>0){var B=parseInt(RicoUtil.getElementsComputedStyle(this.accordionTabs[G].titleBar,"height"))}if(isNaN(B)){B=this.accordionTabs[G].titleBar.offsetHeight}var H=this.accordionTabs.length*B;for(var D=0;D<this.accordionTabs.length;D++){this.tabHeight[D]=parseInt(RicoUtil.getElementsComputedStyle(this.accordionTabs[D].content,"height"))+2;if(isNaN(this.tabHeight[D])||this.tabHeight[D]<=0){if(this.accordionTabs[D].content.offsetHeight){this.tabHeight[D]=this.accordionTabs[D].content.offsetHeight}}}this.options.panelHeight=this.tabHeight[this.options.onloadShowTab?this.options.onloadShowTab:0]}else{if(this.options.panelHeight=="max"){var F;this.options.panelHeight=0;for(var D=0;D<this.accordionTabs.length;D++){F=parseInt(RicoUtil.getElementsComputedStyle(this.accordionTabs[D].content,"height"))+parseInt(RicoUtil.getElementsComputedStyle(this.accordionTabs[D].titleBar,"height"));if(isNaN(F)||F<=0){if(this.accordionTabs[D].content.offsetHeight){F=this.accordionTabs[D].content.offsetHeight}}if(F>this.options.panelHeight){this.options.panelHeight=F}}}}}for(var D=0;D<this.accordionTabs.length;D++){if(D!=this.options.onLoadShowTab){this.accordionTabs[D].collapse();this.accordionTabs[D].content.style.display="none"}}if(this.options.maxHeight){if(this.options.panelHeight>this.options.maxHeight){this.options.panelHeight=this.options.maxHeight}}this.lastExpandedTab.content.style.height=this.options.panelHeight+"px";this.lastExpandedTab.showExpanded();this.lastExpandedTab.titleBar.style.fontWeight=this.options.expandedFontWeight;setExpandedClass(this.lastExpandedTab)};Rico.Accordion.prototype.showTabByIndex=function(C,B){var A=arguments.length==1?true:B;this.showTab(this.accordionTabs[C],A,this.flexible?this.tabHeight[C]:undefined)},Rico.Accordion.prototype.showTab=function(F,C,I){if(this.lastExpandedTab==F){return }var H=this.options.panelHeight;var B;if(I){this.options.panelHeight=I}else{if(this.flexible){for(var E=0;E<this.accordionTabs.length;E++){if(F==this.accordionTabs[E]){B=this.tabHeight[E];break}}}else{B=this.options.panelHeight}}var D=arguments.length==1?this.options.doAnimate:C;if(this.options.onHideTab){this.options.onHideTab(this.lastExpandedTab)}if(this.options.onShowTab){this.options.onShowTab(F)}this.lastExpandedTab.showCollapsed();var G=this;var A=this.lastExpandedTab;if(this.options.panelHeight){this.lastExpandedTab.content.style.height=(this.options.panelHeight-1)+"px"}F.titleBar.style.fontWeight=this.options.expandedFontWeight;if(this.options.maxHeight){if(B>this.options.maxHeight){B=this.options.maxHeight}}if(D){new Rico.Effect.AccordionSize(this.lastExpandedTab.content,F.content,1,B,50,5,{complete:function(){G.showTabDone(A)}},H,1);this.lastExpandedTab=F}else{this.lastExpandedTab.content.style.height="1px";F.content.style.height=B+"px";this.lastExpandedTab=F;this.showTabDone(A)}this.options.panelHeight=B};Rico.Accordion.prototype.setOptions=function(A){this.options={expandedBg:"#EEE",hoverBg:"#FFD",collapsedBg:"#EEE",backgroundColor:"#FFF",textColor:"#000",expandedTextColor:"#000",expandedFontWeight:"bold",hoverTextColor:"#000",collapsedTextColor:"#777",collapsedFontWeight:"normal",hoverTextColor:"#000",borderColor:"#FFF",panelHeight:200,onHideTab:setCollapsedClass,onShowTab:setExpandedClass,onLoadShowTab:0,doAnimate:true,maxHeight:false};Object.extend(this.options,A||{})};Rico.Accordion.Tab.prototype._attachBehaviors=function(){this.content.style.border="1px solid "+this.accordion.options.borderColor;this.content.style.borderTopWidth="0px";this.content.style.borderBottomWidth="0px";this.content.style.margin="0px";this.content.style.backgroundColor=this.accordion.options.backgroundColor;this.content.style.color=this.accordion.options.textColor;this.titleBar.onclick=this.titleBarClicked.bindAsEventListener(this);this.titleBar.onmouseover=this.hover.bindAsEventListener(this);this.titleBar.onmouseout=this.unhover.bindAsEventListener(this)};Rico.Effect.AccordionSize.prototype={initialize:function(G,F,B,E,C,H,I,A,D){this.e1=$(G);this.e2=$(F);this.start=B;this.end=E;this.start2=A?A:E;this.end2=D?D:B;this.duration=C;this.steps=H;this.options=arguments[6]||{};this.totalsteps=H;this.accordionSize()},accordionSize:function(){if(this.isFinished()){if(this.timer){clearInterval(this.timer)}this.e1.style.height=this.start+"px";this.e2.style.height=this.end+"px";if(this.options.complete){this.options.complete(this)}return }this.steps--;var C=Math.round(this.duration/this.totalsteps);var B=this.steps>0?this.steps*(this.start2-this.end2)/this.totalsteps-1:0;if(window.ActiveXObject){B+=2}var A=this.steps>0?this.end-this.steps*(this.end-this.start)/this.totalsteps:this.end;this.resizeTo(B,A);if(!this.timer){this.timer=setInterval(this.accordionSize.bind(this),C)}},isFinished:function(){return this.steps<=1},resizeBy:function(D,C){var F=this.e1.offsetHeight;var A=this.e2.offsetHeight;var E=parseInt(D);var B=C?parseInt(C):parseInt(D);if(E!=0){this.e1.style.height=(F-E)+"px"}if(B!=0){this.e2.style.height=(A+B)+"px"}},resizeTo:function(B,A){this.e1.style.height=B+"px";this.e2.style.height=A+"px";this.e1.style.display="";this.e2.style.display=""}};function setCollapsedClass(A){A.titleBar.className="accordionTabTitleBar"}function setExpandedClass(A){A.titleBar.className=A.titleBar.className+" tbexpanded"}function hideForm(A){A.getElementsByTagName("fieldset").item(0).className="collapsed"}function toggleForm(B){var A=B.getElementsByTagName("fieldset").item(0);if(A.className=="collapsed"){A.className="expanded"}else{A.className="collapsed"}}function togglePanelVisibility(A){if(A.className.indexOf("expanded")>=0){A.className=A.className.replace("expanded","collapsed")}else{A.className=A.className.replace("collapsed","expanded")}}function showsubmenu(A){if(A.lastChild.tagName.toLowerCase()=="span"){if(window.hidetimer){if(window.hideelement==A.lastChild){clearTimeout(window.hidetimer);window.hidetimer=null;window.hideelement=null}else{doHide()}}A.lastChild.style.left=(computeAbsoluteLeft(A)-5)+"px";A.lastChild.style.top=(computeAbsoluteTop(A)-0)+"px";if(window.prevSubmenuClass==undefined){window.prevSubmenuClass=A.className}A.className="hoveredtopmenuentry";A.lastChild.className=A.lastChild.className.replace("hidden","visible")}}function showactionsubmenu(A){if(A.lastChild.tagName.toLowerCase()=="span"){if(window.hidetimer){if(window.hideelement==A.lastChild){clearTimeout(window.hidetimer);window.hidetimer=null;window.hideelement=null}else{doHide()}}A.lastChild.style.left=(computeAbsoluteLeft(A)-5)+"px";A.lastChild.style.top=(computeAbsoluteTop(A)-0)+"px";if(window.prevSubmenuClass==undefined){window.prevSubmenuClass=A.className}A.lastChild.className=A.lastChild.className.replace("hidden","visible")}}function computeAbsoluteLeft(A){if(window.ActiveXObject){return A.offsetLeft-A.parentNode.parentNode.parentNode.currentStyle.marginLeft.match("[0-9]+")-A.lastChild.currentStyle.marginLeft.substring(0,1)}return A.offsetLeft}function computeAbsoluteTop(A){if(window.ActiveXObject){return A.offsetHeight}return A.offsetTop+A.offsetHeight}function hidesubmenu(A){if(A.lastChild.tagName.toLowerCase()=="span"){window.hideelement=A.lastChild;window.hidetimer=setTimeout(doHide,100)}}function setDirty(A){if(A===undefined){A=true}window.docdirty=A}function doHide(){window.hideelement.className=window.hideelement.className.replace("visible","hidden");window.hideelement.parentNode.className=window.prevSubmenuClass;window.prevSubmenuClass=undefined;clearTimeout(window.hidetimer);window.hidetimer=null;window.hideelement=null}function updateAttachName(B,C){var D=B.filepath.value;if(D==""){return false}var A=D.lastIndexOf("\\");if(A==-1){A=D.lastIndexOf("/")}D=D.substring(A+1);if(B.filename.value==D){return true}if(B.filename.value==""){B.filename.value=D}else{if(confirm(C+" '"+D+"' ?")){B.filename.value=D}}return true}function openURL(A){win=open(A,"win","titlebar=0,width=750,height=480,resizable,scrollbars");if(win){win.focus()}}function openHelp(){win=open("http://www.xwiki.com/xwiki/bin/view/Doc/XWikiSyntax?xpage=plain","syntax","titlebar=0,width=750,height=480,resizable,scrollbars");if(win){win.focus()}}var XWiki={Version:"0.8_pre1",require:function(A){document.write('<script type="text/javascript" src="'+A+'"><\/script>')},addLibrary:function(B){JSfileName="xwiki.js";if(B=="scriptaculous"){libraries=["prototype.js","util.js","effects.js","dragdrop.js","controls.js"]}if(B=="rico"){libraries=["rico.js"]}var E=document.getElementsByTagName("script");for(var C=0;C<E.length;C++){if(E[C].src&&E[C].src.match(JSfileName)){var D=E[C].src.replace(JSfileName,B)+"/";for(var A=0;A<libraries.length;A++){this.require(D+libraries[A])}}}}};var XWikiAjax={requests:new Array(),start:function(A){this.status=$(A);ajaxEngine.registerRequest("setValue","SetValueResponse?xpage=rdf");ajaxEngine.registerAjaxElement(this.status.id)},addRequest:function(C,A,E,D){var B=Object.extend({type:"set"});B.className=A;B.document=C;B.field=E;B.value=D;this.requests.push(B)},end:function(){this.requests.reverse();var A=this.requests.pop();while(A){if(A.type=="set"){ajaxEngine.sendRequest("setValue","status="+this.status.id,"doc="+A.document,"typedoc="+A.className,"field="+A.field,"value="+A.value)}A=this.requests.pop()}this.status.innerHtml="updated"}};function xwiki_addConfirm(B){var A=B.href.indexOf("#");if(A>=0){var C=B.href.substring(A);B.href=B.href.substring(0,A)+"&confirm=1"+C}else{B.href+="&confirm=1"}}function BrowserDetectLite(){var A=navigator.userAgent.toLowerCase();this.isGecko=(A.indexOf("gecko")!=-1&&A.indexOf("safari")==-1);this.isMozilla=(this.isGecko&&A.indexOf("gecko/")+14==A.length);this.isNS=((this.isGecko)?(A.indexOf("netscape")!=-1):((A.indexOf("mozilla")!=-1)&&(A.indexOf("spoofer")==-1)&&(A.indexOf("compatible")==-1)&&(A.indexOf("opera")==-1)&&(A.indexOf("webtv")==-1)&&(A.indexOf("hotjava")==-1)));this.isIE=((A.indexOf("msie")!=-1)&&(A.indexOf("opera")==-1)&&(A.indexOf("webtv")==-1));this.isSafari=(A.indexOf("safari")!=-1);this.isOpera=(A.indexOf("opera")!=-1);this.isKonqueror=(A.indexOf("konqueror")!=-1&&!this.isSafari);this.isIcab=(A.indexOf("icab")!=-1);this.isAol=(A.indexOf("aol")!=-1);this.isIECompatible=((A.indexOf("msie")!=-1)&&!this.isIE);this.isNSCompatible=((A.indexOf("mozilla")!=-1)&&!this.isNS&&!this.isMozilla);this.versionMinor=parseFloat(navigator.appVersion);if(this.isNS&&this.isGecko){this.versionMinor=parseFloat(A.substring(A.lastIndexOf("/")+1))}else{if(this.isIE&&this.versionMinor>=4){this.versionMinor=parseFloat(A.substring(A.indexOf("msie ")+5))}else{if(this.isMozilla){this.versionMinor=parseFloat(A.substring(A.indexOf("rv:")+3))}else{if(this.isSafari){this.versionMinor=parseFloat(A.substring(A.lastIndexOf("/")+1))}else{if(this.isOpera){if(A.indexOf("opera/")!=-1){this.versionMinor=parseFloat(A.substring(A.indexOf("opera/")+6))}else{this.versionMinor=parseFloat(A.substring(A.indexOf("opera ")+6))}}else{if(this.isKonqueror){this.versionMinor=parseFloat(A.substring(A.indexOf("konqueror/")+10))}else{if(this.isIcab){if(A.indexOf("icab/")!=-1){this.versionMinor=parseFloat(A.substring(A.indexOf("icab/")+6))}else{this.versionMinor=parseFloat(A.substring(A.indexOf("icab ")+6))}}}}}}}}this.versionMajor=parseInt(this.versionMinor);this.geckoVersion=((this.isGecko)?A.substring((A.lastIndexOf("gecko/")+6),(A.lastIndexOf("gecko/")+14)):-1);this.isDOM1=(document.getElementById);this.isDOM2Event=(document.addEventListener&&document.removeEventListener);this.mode=document.compatMode?document.compatMode:"BackCompat";this.isWin=(A.indexOf("win")!=-1);this.isWin32=(this.isWin&&(A.indexOf("95")!=-1||A.indexOf("98")!=-1||A.indexOf("nt")!=-1||A.indexOf("win32")!=-1||A.indexOf("32bit")!=-1||A.indexOf("xp")!=-1));this.isMac=(A.indexOf("mac")!=-1);this.isUnix=(A.indexOf("unix")!=-1||A.indexOf("sunos")!=-1||A.indexOf("bsd")!=-1||A.indexOf("x11")!=-1);this.isLinux=(A.indexOf("linux")!=-1);this.isNS4x=(this.isNS&&this.versionMajor==4);this.isNS40x=(this.isNS4x&&this.versionMinor<4.5);this.isNS47x=(this.isNS4x&&this.versionMinor>=4.7);this.isNS4up=(this.isNS&&this.versionMinor>=4);this.isNS6x=(this.isNS&&this.versionMajor==6);this.isNS6up=(this.isNS&&this.versionMajor>=6);this.isNS7x=(this.isNS&&this.versionMajor==7);this.isNS7up=(this.isNS&&this.versionMajor>=7);this.isIE4x=(this.isIE&&this.versionMajor==4);this.isIE4up=(this.isIE&&this.versionMajor>=4);this.isIE5x=(this.isIE&&this.versionMajor==5);this.isIE55=(this.isIE&&this.versionMinor==5.5);this.isIE5up=(this.isIE&&this.versionMajor>=5);this.isIE6x=(this.isIE&&this.versionMajor==6);this.isIE6up=(this.isIE&&this.versionMajor>=6);this.isIE4xMac=(this.isIE4x&&this.isMac)}var browser=new BrowserDetectLite()