/*
	Lyra
	Build - 1.1.0.	2010-7-20
	Copyright (C) 2010 Global Reach Internet Productions - www.globalreach.com
*/
/*
	JSON.js
	Copyright (C) 2007 Andrea Giammarchi - www.3site.eu
	
	Permission is hereby granted, free of charge,
	to any person obtaining a copy of this software and associated
	documentation files (the "Software"),
	to deal in the Software without restriction,
	including without limitation the rights to use, copy, modify, merge,
	publish, distribute, sublicense, and/or sell copies of the Software,
	and to permit persons to whom the Software is furnished to do so,
	subject to the following conditions:
	
	The above copyright notice and this permission notice shall be included
	in all copies or substantial portions of the Software.
	
	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
	INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
	IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
	DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
	ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
	OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
	MooTools, My Object Oriented Javascript Tools.
	Copyright (c) 2006-2007 Valerio Proietti - mad4milk.net - MIT Style License
*/
var JSON=new function(){this.encode=function(){var	self=arguments.length?arguments[0]:this,result,tmp;if(self===null)
result="null";else if(self!==undefined&&(tmp=$[typeof self](self))){switch(tmp){case	Array:result=[];for(var	i=0,j=0,k=self.length;j<k;j++){if(self[j]!==undefined&&(tmp=JSON.encode(self[j])))
result[i++]=tmp;};result="[".concat(result.join(","),"]");break;case	Boolean:result=String(self);break;case	Date:result='"'.concat(self.getFullYear(),'-',d(self.getMonth()+1),'-',d(self.getDate()),'T',d(self.getHours()),':',d(self.getMinutes()),':',d(self.getSeconds()),'"');break;case	Function:break;case	Number:result=isFinite(self)?String(self):"null";break;case	String:result='"'.concat(self.replace(rs,s).replace(ru,u),'"');break;default:var	i=0,key;result=[];for(key in self){if(self[key]!==undefined&&(tmp=JSON.encode(self[key])))
result[i++]='"'.concat(key.replace(rs,s).replace(ru,u),'":',tmp);};result="{".concat(result.join(","),"}");break;}};return result;};this.toDate=function(){var	self=arguments.length?arguments[0]:this,result;if(rd.test(self)){result=new Date;result.setHours(i(self,11,2));result.setMinutes(i(self,14,2));result.setSeconds(i(self,17,2));result.setMonth(i(self,5,2)-1);result.setDate(i(self,8,2));result.setFullYear(i(self,0,4));}
else if(rt.test(self))
result=new Date(self*1000);return result;};var	c={"\b":"b","\t":"t","\n":"n","\f":"f","\r":"r",'"':'"',"\\":"\\","/":"/"},d=function(n){return n<10?"0".concat(n):n},e=function(c,f,e){e=eval;delete eval;if(typeof eval==="undefined")eval=e;f=eval(""+c);eval=e;return f},i=function(e,p,l){return 1*e.substr(p,l)},p=["","000","00","0",""],rc=null,rd=/^[0-9]{4}\-[0-9]{2}\-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/,rs=/(\x5c|\x2F|\x22|[\x0c-\x0d]|[\x08-\x0a])/g,rt=/^([0-9]+|[0-9]+[,\.][0-9]{1,3})$/,ru=/([\x00-\x07]|\x0b|[\x0e-\x1f])/g,s=function(i,d){return"\\".concat(c[d])},u=function(i,d){var	n=d.charCodeAt(0).toString(16);return"\\u".concat(p[n.length],n)},v=function(k,v){return $[typeof result](result)!==Function&&(v.hasOwnProperty?v.hasOwnProperty(k):v.constructor.prototype[k]!==v[k])},$={"boolean":function(){return Boolean},"function":function(){return Function},"number":function(){return Number},"object":function(o){return o instanceof o.constructor?o.constructor:null},"string":function(){return String},"undefined":function(){return null}},$$=function(m){function $(c,t){t=c[m];delete c[m];try{e(c)}catch(z){c[m]=t;return 1}return 0;};return $(Array)&&$(Object)};try{rc=new RegExp('^("(\\\\.|[^"\\\\\\n\\r])*?"|[,:{}\\[\\]0-9.\\-+Eaeflnr-u \\n\\r\\t])+?$')}
catch(z){rc=/^(true|false|null|\[.*\]|\{.*\}|".*"|\d+|\d+\.\d+)$/}};
var MooTools={version:"1.11"};function $defined(A){return(A!=undefined);}function $type(B){if(!$defined(B)){return false;}if(B.htmlElement){return"element";}var A=typeof B;if(A=="object"&&B.nodeName){switch(B.nodeType){case 1:return"element";case 3:return(/\S/).test(B.nodeValue)?"textnode":"whitespace";}}if(A=="object"||A=="function"){switch(B.constructor){case Array:return"array";case RegExp:return"regexp";case Class:return"class";}if(typeof B.length=="number"){if(B.item){return"collection";}if(B.callee){return"arguments";}}}return A;}function $merge(){var C={};for(var B=0;B<arguments.length;B++){for(var E in arguments[B]){var A=arguments[B][E];var D=C[E];if(D&&$type(A)=="object"&&$type(D)=="object"){C[E]=$merge(D,A);}else{C[E]=A;}}}return C;}var $extend=function(){var A=arguments;if(!A[1]){A=[this,A[0]];}for(var B in A[1]){A[0][B]=A[1][B];}return A[0];};var $native=function(){for(var B=0,A=arguments.length;B<A;B++){arguments[B].extend=function(C){for(var D in C){if(!this.prototype[D]){this.prototype[D]=C[D];}if(!this[D]){this[D]=$native.generic(D);}}};}};$native.generic=function(A){return function(B){return this.prototype[A].apply(B,Array.prototype.slice.call(arguments,1));};};$native(Function,Array,String,Number);function $chk(A){return!!(A||A===0);}function $pick(B,A){return $defined(B)?B:A;}function $random(B,A){return Math.floor(Math.random()*(A-B+1)+B);}function $time(){return new Date().getTime();}function $clear(A){clearTimeout(A);clearInterval(A);return null;}var Abstract=function(A){A=A||{};A.extend=$extend;return A;};var Window=new Abstract(window);var Document=new Abstract(document);document.head=document.getElementsByTagName("head")[0];window.xpath=!!(document.evaluate);if(window.ActiveXObject){window.ie=window[window.XMLHttpRequest?"ie7":"ie6"]=true;}else{if(document.childNodes&&!document.all&&!navigator.taintEnabled){window.webkit=window[window.xpath?"webkit420":"webkit419"]=true;}else{if(document.getBoxObjectFor!=null){window.gecko=true;}}}window.khtml=window.webkit;Object.extend=$extend;if(typeof HTMLElement=="undefined"){var HTMLElement=function(){};if(window.webkit){document.createElement("iframe");}HTMLElement.prototype=(window.webkit)?window["[[DOMElement.prototype]]"]:{};}HTMLElement.prototype.htmlElement=function(){};if(window.ie6){try{document.execCommand("BackgroundImageCache",false,true);}catch(e){}}var Class=function(B){var A=function(){return(arguments[0]!==null&&this.initialize&&$type(this.initialize)=="function")?this.initialize.apply(this,arguments):this;};$extend(A,this);A.prototype=B;A.constructor=Class;return A;};Class.empty=function(){};Class.prototype={extend:function(B){var C=new this(null);for(var D in B){var A=C[D];C[D]=Class.Merge(A,B[D]);}return new Class(C);},implement:function(){for(var B=0,A=arguments.length;B<A;B++){$extend(this.prototype,arguments[B]);}}};Class.Merge=function(C,D){if(C&&C!=D){var B=$type(D);if(B!=$type(C)){return D;}switch(B){case"function":var A=function(){this.parent=arguments.callee.parent;return D.apply(this,arguments);};A.parent=C;return A;case"object":return $merge(C,D);}}return D;};var Chain=new Class({chain:function(A){this.chains=this.chains||[];this.chains.push(A);return this;},callChain:function(){if(this.chains&&this.chains.length){this.chains.shift().delay(10,this);}},clearChain:function(){this.chains=[];}});var Events=new Class({addEvent:function(B,A){if(A!=Class.empty){this.$events=this.$events||{};this.$events[B]=this.$events[B]||[];this.$events[B].include(A);}return this;},fireEvent:function(C,B,A){if(this.$events&&this.$events[C]){this.$events[C].each(function(D){D.create({bind:this,delay:A,"arguments":B})();},this);}return this;},removeEvent:function(B,A){if(this.$events&&this.$events[B]){this.$events[B].remove(A);}return this;}});var Options=new Class({setOptions:function(){this.options=$merge.apply(null,[this.options].extend(arguments));if(this.addEvent){for(var A in this.options){if($type(this.options[A]=="function")&&(/^on[A-Z]/).test(A)){this.addEvent(A,this.options[A]);}}}return this;}});Array.extend({forEach:function(C,D){for(var B=0,A=this.length;B<A;B++){C.call(D,this[B],B,this);}},filter:function(D,E){var C=[];for(var B=0,A=this.length;B<A;B++){if(D.call(E,this[B],B,this)){C.push(this[B]);}}return C;},map:function(D,E){var C=[];for(var B=0,A=this.length;B<A;B++){C[B]=D.call(E,this[B],B,this);}return C;},every:function(C,D){for(var B=0,A=this.length;B<A;B++){if(!C.call(D,this[B],B,this)){return false;}}return true;},some:function(C,D){for(var B=0,A=this.length;B<A;B++){if(C.call(D,this[B],B,this)){return true;}}return false;},indexOf:function(C,D){var A=this.length;for(var B=(D<0)?Math.max(0,A+D):D||0;B<A;B++){if(this[B]===C){return B;}}return-1;},copy:function(D,C){D=D||0;if(D<0){D=this.length+D;}C=C||(this.length-D);var A=[];for(var B=0;B<C;B++){A[B]=this[D++];}return A;},remove:function(C){var B=0;var A=this.length;while(B<A){if(this[B]===C){this.splice(B,1);A--;}else{B++;}}return this;},contains:function(A,B){return this.indexOf(A,B)!=-1;},associate:function(C){var D={},B=Math.min(this.length,C.length);for(var A=0;A<B;A++){D[C[A]]=this[A];}return D;},extend:function(C){for(var B=0,A=C.length;B<A;B++){this.push(C[B]);}return this;},merge:function(C){for(var B=0,A=C.length;B<A;B++){this.include(C[B]);}return this;},include:function(A){if(!this.contains(A)){this.push(A);}return this;},getRandom:function(){return this[$random(0,this.length-1)]||null;},getLast:function(){return this[this.length-1]||null;}});Array.prototype.each=Array.prototype.forEach;Array.each=Array.forEach;function $A(A){return Array.copy(A);}function $each(C,B,D){if(C&&typeof C.length=="number"&&$type(C)!="object"){Array.forEach(C,B,D);}else{for(var A in C){B.call(D||C,C[A],A);}}}Array.prototype.test=Array.prototype.contains;String.extend({test:function(A,B){return(($type(A)=="string")?new RegExp(A,B):A).test(this);},toInt:function(){return parseInt(this,10);},toFloat:function(){return parseFloat(this);},camelCase:function(){return this.replace(/-\D/g,function(A){return A.charAt(1).toUpperCase();});},hyphenate:function(){return this.replace(/\w[A-Z]/g,function(A){return(A.charAt(0)+"-"+A.charAt(1).toLowerCase());});},capitalize:function(){return this.replace(/\b[a-z]/g,function(A){return A.toUpperCase();});},trim:function(){return this.replace(/^\s+|\s+$/g,"");},clean:function(){return this.replace(/\s{2,}/g," ").trim();},rgbToHex:function(B){var A=this.match(/\d{1,3}/g);return(A)?A.rgbToHex(B):false;},hexToRgb:function(B){var A=this.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/);return(A)?A.slice(1).hexToRgb(B):false;},contains:function(A,B){return(B)?(B+this+B).indexOf(B+A+B)>-1:this.indexOf(A)>-1;},escapeRegExp:function(){return this.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1");}});Array.extend({rgbToHex:function(D){if(this.length<3){return false;}if(this.length==4&&this[3]==0&&!D){return"transparent";}var B=[];for(var A=0;A<3;A++){var C=(this[A]-0).toString(16);B.push((C.length==1)?"0"+C:C);}return D?B:"#"+B.join("");},hexToRgb:function(C){if(this.length!=3){return false;}var A=[];for(var B=0;B<3;B++){A.push(parseInt((this[B].length==1)?this[B]+this[B]:this[B],16));}return C?A:"rgb("+A.join(",")+")";}});Function.extend({create:function(A){var B=this;A=$merge({bind:B,event:false,"arguments":null,delay:false,periodical:false,attempt:false},A);if($chk(A.arguments)&&$type(A.arguments)!="array"){A.arguments=[A.arguments];}return function(E){var C;if(A.event){E=E||window.event;C=[(A.event===true)?E:new A.event(E)];if(A.arguments){C.extend(A.arguments);}}else{C=A.arguments||arguments;}var F=function(){return B.apply($pick(A.bind,B),C);};if(A.delay){return setTimeout(F,A.delay);}if(A.periodical){return setInterval(F,A.periodical);}if(A.attempt){try{return F();}catch(D){return false;}}return F();};},pass:function(A,B){return this.create({"arguments":A,bind:B});},attempt:function(A,B){return this.create({"arguments":A,bind:B,attempt:true})();},bind:function(B,A){return this.create({bind:B,"arguments":A});},bindAsEventListener:function(B,A){return this.create({bind:B,event:true,"arguments":A});},delay:function(B,C,A){return this.create({delay:B,bind:C,"arguments":A})();},periodical:function(A,C,B){return this.create({periodical:A,bind:C,"arguments":B})();}});Number.extend({toInt:function(){return parseInt(this);},toFloat:function(){return parseFloat(this);},limit:function(B,A){return Math.min(A,Math.max(B,this));},round:function(A){A=Math.pow(10,A||0);return Math.round(this*A)/A;},times:function(B){for(var A=0;A<this;A++){B(A);}}});var Element=new Class({initialize:function(D,C){if($type(D)=="string"){if(window.ie&&C&&(C.name||C.type)){var A=(C.name)?' name="'+C.name+'"':"";var B=(C.type)?' type="'+C.type+'"':"";delete C.name;delete C.type;D="<"+D+A+B+">";}D=document.createElement(D);}D=$(D);return(!C||!D)?D:D.set(C);}});var Elements=new Class({initialize:function(A){return(A)?$extend(A,this):this;}});Elements.extend=function(A){for(var B in A){this.prototype[B]=A[B];this[B]=$native.generic(B);}};function $(B){if(!B){return null;}if(B.htmlElement){return Garbage.collect(B);}if([window,document].contains(B)){return B;}var A=$type(B);if(A=="string"){B=document.getElementById(B);A=(B)?"element":false;}if(A!="element"){return null;}if(B.htmlElement){return Garbage.collect(B);}if(["object","embed"].contains(B.tagName.toLowerCase())){return B;}$extend(B,Element.prototype);B.htmlElement=function(){};return Garbage.collect(B);}document.getElementsBySelector=document.getElementsByTagName;function $$(){var D=[];for(var C=0,B=arguments.length;C<B;C++){var A=arguments[C];switch($type(A)){case"element":D.push(A);case"boolean":break;case false:break;case"string":A=document.getElementsBySelector(A,true);default:D.extend(A);}}return $$.unique(D);}$$.unique=function(G){var D=[];for(var C=0,A=G.length;C<A;C++){if(G[C].$included){continue;}var B=$(G[C]);if(B&&!B.$included){B.$included=true;D.push(B);}}for(var F=0,E=D.length;F<E;F++){D[F].$included=null;}return new Elements(D);};Elements.Multi=function(A){return function(){var D=arguments;var B=[];var G=true;for(var E=0,C=this.length,F;E<C;E++){F=this[E][A].apply(this[E],D);if($type(F)!="element"){G=false;}B.push(F);}return(G)?$$.unique(B):B;};};Element.extend=function(A){for(var B in A){HTMLElement.prototype[B]=A[B];Element.prototype[B]=A[B];Element[B]=$native.generic(B);var C=(Array.prototype[B])?B+"Elements":B;Elements.prototype[C]=Elements.Multi(B);}};Element.extend({set:function(A){for(var C in A){var B=A[C];switch(C){case"styles":this.setStyles(B);break;case"events":if(this.addEvents){this.addEvents(B);}break;case"properties":this.setProperties(B);break;default:this.setProperty(C,B);}}return this;},inject:function(C,A){C=$(C);switch(A){case"before":C.parentNode.insertBefore(this,C);break;case"after":var B=C.getNext();if(!B){C.parentNode.appendChild(this);}else{C.parentNode.insertBefore(this,B);}break;case"top":var D=C.firstChild;if(D){C.insertBefore(this,D);break;}default:C.appendChild(this);}return this;},injectBefore:function(A){return this.inject(A,"before");},injectAfter:function(A){return this.inject(A,"after");},injectInside:function(A){return this.inject(A,"bottom");},injectTop:function(A){return this.inject(A,"top");},adopt:function(){var A=[];$each(arguments,function(B){A=A.concat(B);});$$(A).inject(this);return this;},remove:function(){return this.parentNode.removeChild(this);},clone:function(C){var B=$(this.cloneNode(C!==false));if(!B.$events){return B;}B.$events={};for(var A in this.$events){B.$events[A]={keys:$A(this.$events[A].keys),values:$A(this.$events[A].values)};}return B.removeEvents();},replaceWith:function(A){A=$(A);this.parentNode.replaceChild(A,this);return A;},appendText:function(A){this.appendChild(document.createTextNode(A));return this;},hasClass:function(A){return this.className.contains(A," ");},addClass:function(A){if(!this.hasClass(A)){this.className=(this.className+" "+A).clean();}return this;},removeClass:function(A){this.className=this.className.replace(new RegExp("(^|\\s)"+A+"(?:\\s|$)"),"$1").clean();return this;},toggleClass:function(A){return this.hasClass(A)?this.removeClass(A):this.addClass(A);},setStyle:function(B,A){switch(B){case"opacity":return this.setOpacity(parseFloat(A));case"float":B=(window.ie)?"styleFloat":"cssFloat";}B=B.camelCase();switch($type(A)){case"number":if(!["zIndex","zoom"].contains(B)){A+="px";}break;case"array":A="rgb("+A.join(",")+")";}this.style[B]=A;return this;},setStyles:function(A){switch($type(A)){case"object":Element.setMany(this,"setStyle",A);break;case"string":this.style.cssText=A;}return this;},setOpacity:function(A){if(A==0){if(this.style.visibility!="hidden"){this.style.visibility="hidden";}}else{if(this.style.visibility!="visible"){this.style.visibility="visible";}}if(!this.currentStyle||!this.currentStyle.hasLayout){this.style.zoom=1;}if(window.ie){this.style.filter=(A==1)?"":"alpha(opacity="+A*100+")";}this.style.opacity=this.$tmp.opacity=A;return this;},getStyle:function(C){C=C.camelCase();var A=this.style[C];if(!$chk(A)){if(C=="opacity"){return this.$tmp.opacity;}A=[];for(var B in Element.Styles){if(C==B){Element.Styles[B].each(function(F){var E=this.getStyle(F);A.push(parseInt(E)?E:"0px");},this);if(C=="border"){var D=A.every(function(E){return(E==A[0]);});return(D)?A[0]:false;}return A.join(" ");}}if(C.contains("border")){if(Element.Styles.border.contains(C)){return["Width","Style","Color"].map(function(E){return this.getStyle(C+E);},this).join(" ");}else{if(Element.borderShort.contains(C)){return["Top","Right","Bottom","Left"].map(function(E){return this.getStyle("border"+E+C.replace("border",""));},this).join(" ");}}}if(document.defaultView){A=document.defaultView.getComputedStyle(this,null).getPropertyValue(C.hyphenate());}else{if(this.currentStyle){A=this.currentStyle[C];}}}if(window.ie){A=Element.fixStyle(C,A,this);}if(A&&C.test(/color/i)&&A.contains("rgb")){return A.split("rgb").splice(1,4).map(function(E){return E.rgbToHex();}).join(" ");}return A;},getStyles:function(){return Element.getMany(this,"getStyle",arguments);},walk:function(A,C){A+="Sibling";var B=(C)?this[C]:this[A];while(B&&$type(B)!="element"){B=B[A];}return $(B);},getPrevious:function(){return this.walk("previous");},getNext:function(){return this.walk("next");},getFirst:function(){return this.walk("next","firstChild");},getLast:function(){return this.walk("previous","lastChild");},getParent:function(){return $(this.parentNode);},getChildren:function(){return $$(this.childNodes);},hasChild:function(A){return!!$A(this.getElementsByTagName("*")).contains(A);},getProperty:function(D){var B=Element.Properties[D];if(B){return this[B];}var A=Element.PropertiesIFlag[D]||0;if(!window.ie||A){return this.getAttribute(D,A);}var C=this.attributes[D];return(C)?C.nodeValue:null;},removeProperty:function(B){var A=Element.Properties[B];if(A){this[A]="";}else{this.removeAttribute(B);}return this;},getProperties:function(){return Element.getMany(this,"getProperty",arguments);},setProperty:function(C,B){var A=Element.Properties[C];if(A){this[A]=B;}else{this.setAttribute(C,B);}return this;},setProperties:function(A){return Element.setMany(this,"setProperty",A);},setHTML:function(){this.innerHTML=$A(arguments).join("");return this;},setText:function(B){var A=this.getTag();if(["style","script"].contains(A)){if(window.ie){if(A=="style"){this.styleSheet.cssText=B;}else{if(A=="script"){this.setProperty("text",B);}}return this;}else{this.removeChild(this.firstChild);return this.appendText(B);}}this[$defined(this.innerText)?"innerText":"textContent"]=B;return this;},getText:function(){var A=this.getTag();if(["style","script"].contains(A)){if(window.ie){if(A=="style"){return this.styleSheet.cssText;}else{if(A=="script"){return this.getProperty("text");}}}else{return this.innerHTML;}}return($pick(this.innerText,this.textContent));},getTag:function(){return this.tagName.toLowerCase();},empty:function(){Garbage.trash(this.getElementsByTagName("*"));return this.setHTML("");}});Element.fixStyle=function(E,A,D){if($chk(parseInt(A))){return A;}if(["height","width"].contains(E)){var B=(E=="width")?["left","right"]:["top","bottom"];var C=0;B.each(function(F){C+=D.getStyle("border-"+F+"-width").toInt()+D.getStyle("padding-"+F).toInt();});return D["offset"+E.capitalize()]-C+"px";}else{if(E.test(/border(.+)Width|margin|padding/)){return"0px";}}return A;};Element.Styles={border:[],padding:[],margin:[]};["Top","Right","Bottom","Left"].each(function(B){for(var A in Element.Styles){Element.Styles[A].push(A+B);}});Element.borderShort=["borderWidth","borderStyle","borderColor"];Element.getMany=function(B,D,C){var A={};$each(C,function(E){A[E]=B[D](E);});return A;};Element.setMany=function(B,D,C){for(var A in C){B[D](A,C[A]);}return B;};Element.Properties=new Abstract({"class":"className","for":"htmlFor",colspan:"colSpan",rowspan:"rowSpan",accesskey:"accessKey",tabindex:"tabIndex",maxlength:"maxLength",readonly:"readOnly",frameborder:"frameBorder",value:"value",disabled:"disabled",checked:"checked",multiple:"multiple",selected:"selected"});Element.PropertiesIFlag={href:2,src:2};Element.Methods={Listeners:{addListener:function(B,A){if(this.addEventListener){this.addEventListener(B,A,false);}else{this.attachEvent("on"+B,A);}return this;},removeListener:function(B,A){if(this.removeEventListener){this.removeEventListener(B,A,false);}else{this.detachEvent("on"+B,A);}return this;}}};window.extend(Element.Methods.Listeners);document.extend(Element.Methods.Listeners);Element.extend(Element.Methods.Listeners);var Garbage={elements:[],collect:function(A){if(!A.$tmp){Garbage.elements.push(A);A.$tmp={opacity:1};}return A;},trash:function(D){for(var B=0,A=D.length,C;B<A;B++){if(!(C=D[B])||!C.$tmp){continue;}if(C.$events){C.fireEvent("trash").removeEvents();}for(var E in C.$tmp){C.$tmp[E]=null;}for(var F in Element.prototype){C[F]=null;}Garbage.elements[Garbage.elements.indexOf(C)]=null;C.htmlElement=C.$tmp=C=null;}Garbage.elements.remove(null);},empty:function(){Garbage.collect(window);Garbage.collect(document);Garbage.trash(Garbage.elements);}};window.addListener("beforeunload",function(){window.addListener("unload",Garbage.empty);if(window.ie){window.addListener("unload",CollectGarbage);}});var Event=new Class({initialize:function(C){if(C&&C.$extended){return C;}this.$extended=true;C=C||window.event;this.event=C;this.type=C.type;this.target=C.target||C.srcElement;if(this.target.nodeType==3){this.target=this.target.parentNode;}this.shift=C.shiftKey;this.control=C.ctrlKey;this.alt=C.altKey;this.meta=C.metaKey;if(["DOMMouseScroll","mousewheel"].contains(this.type)){this.wheel=(C.wheelDelta)?C.wheelDelta/120:-(C.detail||0)/3;}else{if(this.type.contains("key")){this.code=C.which||C.keyCode;for(var B in Event.keys){if(Event.keys[B]==this.code){this.key=B;break;}}if(this.type=="keydown"){var A=this.code-111;if(A>0&&A<13){this.key="f"+A;}}this.key=this.key||String.fromCharCode(this.code).toLowerCase();}else{if(this.type.test(/(click|mouse|menu)/)){this.page={x:C.pageX||C.clientX+document.documentElement.scrollLeft,y:C.pageY||C.clientY+document.documentElement.scrollTop};this.client={x:C.pageX?C.pageX-window.pageXOffset:C.clientX,y:C.pageY?C.pageY-window.pageYOffset:C.clientY};this.rightClick=(C.which==3)||(C.button==2);switch(this.type){case"mouseover":this.relatedTarget=C.relatedTarget||C.fromElement;break;case"mouseout":this.relatedTarget=C.relatedTarget||C.toElement;}this.fixRelatedTarget();}}}return this;},stop:function(){return this.stopPropagation().preventDefault();},stopPropagation:function(){if(this.event.stopPropagation){this.event.stopPropagation();}else{this.event.cancelBubble=true;}return this;},preventDefault:function(){if(this.event.preventDefault){this.event.preventDefault();}else{this.event.returnValue=false;}return this;}});Event.fix={relatedTarget:function(){if(this.relatedTarget&&this.relatedTarget.nodeType==3){this.relatedTarget=this.relatedTarget.parentNode;}},relatedTargetGecko:function(){try{Event.fix.relatedTarget.call(this);}catch(A){this.relatedTarget=this.target;}}};Event.prototype.fixRelatedTarget=(window.gecko)?Event.fix.relatedTargetGecko:Event.fix.relatedTarget;Event.keys=new Abstract({enter:13,up:38,down:40,left:37,right:39,esc:27,space:32,backspace:8,tab:9,"delete":46});Element.Methods.Events={addEvent:function(C,B){this.$events=this.$events||{};this.$events[C]=this.$events[C]||{keys:[],values:[]};if(this.$events[C].keys.contains(B)){return this;}this.$events[C].keys.push(B);var A=C;var D=Element.Events[C];if(D){if(D.add){D.add.call(this,B);}if(D.map){B=D.map;}if(D.type){A=D.type;}}if(!this.addEventListener){B=B.create({bind:this,event:true});}this.$events[C].values.push(B);return(Element.NativeEvents.contains(A))?this.addListener(A,B):this;},removeEvent:function(C,B){if(!this.$events||!this.$events[C]){return this;}var F=this.$events[C].keys.indexOf(B);if(F==-1){return this;}var A=this.$events[C].keys.splice(F,1)[0];var E=this.$events[C].values.splice(F,1)[0];var D=Element.Events[C];if(D){if(D.remove){D.remove.call(this,B);}if(D.type){C=D.type;}}return(Element.NativeEvents.contains(C))?this.removeListener(C,E):this;},addEvents:function(A){return Element.setMany(this,"addEvent",A);},removeEvents:function(A){if(!this.$events){return this;}if(!A){for(var B in this.$events){this.removeEvents(B);}this.$events=null;}else{if(this.$events[A]){this.$events[A].keys.each(function(C){this.removeEvent(A,C);},this);this.$events[A]=null;}}return this;},fireEvent:function(C,B,A){if(this.$events&&this.$events[C]){this.$events[C].keys.each(function(D){D.create({bind:this,delay:A,"arguments":B})();},this);}return this;},cloneEvents:function(C,A){if(!C.$events){return this;}if(!A){for(var B in C.$events){this.cloneEvents(C,B);}}else{if(C.$events[A]){C.$events[A].keys.each(function(D){this.addEvent(A,D);},this);}}return this;}};window.extend(Element.Methods.Events);document.extend(Element.Methods.Events);Element.extend(Element.Methods.Events);Element.Events=new Abstract({mouseenter:{type:"mouseover",map:function(A){A=new Event(A);if(A.relatedTarget!=this&&!this.hasChild(A.relatedTarget)){this.fireEvent("mouseenter",A);}}},mouseleave:{type:"mouseout",map:function(A){A=new Event(A);if(A.relatedTarget!=this&&!this.hasChild(A.relatedTarget)){this.fireEvent("mouseleave",A);}}},mousewheel:{type:(window.gecko)?"DOMMouseScroll":"mousewheel"}});Element.NativeEvents=["click","dblclick","mouseup","mousedown","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","keydown","keypress","keyup","load","unload","beforeunload","resize","move","focus","blur","change","submit","reset","select","error","abort","contextmenu","scroll"];Function.extend({bindWithEvent:function(B,A){return this.create({bind:B,"arguments":A,event:Event});}});Elements.extend({filterByTag:function(A){return new Elements(this.filter(function(B){return(Element.getTag(B)==A);}));},filterByClass:function(A,C){var B=this.filter(function(D){return(D.className&&D.className.contains(A," "));});return(C)?B:new Elements(B);},filterById:function(C,B){var A=this.filter(function(D){return(D.id==C);});return(B)?A:new Elements(A);},filterByAttribute:function(B,A,D,E){var C=this.filter(function(F){var G=Element.getProperty(F,B);if(!G){return false;}if(!A){return true;}switch(A){case"=":return(G==D);case"*=":return(G.contains(D));case"^=":return(G.substr(0,D.length)==D);case"$=":return(G.substr(G.length-D.length)==D);case"!=":return(G!=D);case"~=":return G.contains(D," ");}return false;});return(E)?C:new Elements(C);}});function $E(A,B){return($(B)||document).getElement(A);}function $ES(A,B){return($(B)||document).getElementsBySelector(A);}$$.shared={regexp:/^(\w*|\*)(?:#([\w-]+)|\.([\w-]+))?(?:\[(\w+)(?:([!*^$]?=)["']?([^"'\]]*)["']?)?])?$/,xpath:{getParam:function(B,D,E,C){var A=[D.namespaceURI?"xhtml:":"",E[1]];if(E[2]){A.push('[@id="',E[2],'"]');}if(E[3]){A.push('[contains(concat(" ", @class, " "), " ',E[3],' ")]');}if(E[4]){if(E[5]&&E[6]){switch(E[5]){case"*=":A.push("[contains(@",E[4],', "',E[6],'")]');break;case"^=":A.push("[starts-with(@",E[4],', "',E[6],'")]');break;case"$=":A.push("[substring(@",E[4],", string-length(@",E[4],") - ",E[6].length,' + 1) = "',E[6],'"]');break;case"=":A.push("[@",E[4],'="',E[6],'"]');break;case"!=":A.push("[@",E[4],'!="',E[6],'"]');}}else{A.push("[@",E[4],"]");}}B.push(A.join(""));return B;},getItems:function(B,E,G){var F=[];var A=document.evaluate(".//"+B.join("//"),E,$$.shared.resolver,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);for(var D=0,C=A.snapshotLength;D<C;D++){F.push(A.snapshotItem(D));}return(G)?F:new Elements(F.map($));}},normal:{getParam:function(A,C,E,B){if(B==0){if(E[2]){var D=C.getElementById(E[2]);if(!D||((E[1]!="*")&&(Element.getTag(D)!=E[1]))){return false;}A=[D];}else{A=$A(C.getElementsByTagName(E[1]));}}else{A=$$.shared.getElementsByTagName(A,E[1]);if(E[2]){A=Elements.filterById(A,E[2],true);}}if(E[3]){A=Elements.filterByClass(A,E[3],true);}if(E[4]){A=Elements.filterByAttribute(A,E[4],E[5],E[6],true);}return A;},getItems:function(A,B,C){return(C)?A:$$.unique(A);}},resolver:function(A){return(A=="xhtml")?"http://www.w3.org/1999/xhtml":false;},getElementsByTagName:function(D,C){var E=[];for(var B=0,A=D.length;B<A;B++){E.extend(D[B].getElementsByTagName(C));}return E;}};$$.shared.method=(window.xpath)?"xpath":"normal";Element.Methods.Dom={getElements:function(A,H){var C=[];A=A.trim().split(" ");for(var E=0,D=A.length;E<D;E++){var F=A[E];var G=F.match($$.shared.regexp);if(!G){break;}G[1]=G[1]||"*";var B=$$.shared[$$.shared.method].getParam(C,this,G,E);if(!B){break;}C=B;}return $$.shared[$$.shared.method].getItems(C,this,H);},getElement:function(A){return $(this.getElements(A,true)[0]||false);},getElementsBySelector:function(A,E){var D=[];A=A.split(",");for(var C=0,B=A.length;C<B;C++){D=D.concat(this.getElements(A[C],true));}return(E)?D:$$.unique(D);}};Element.extend({getElementById:function(C){var B=document.getElementById(C);if(!B){return false;}for(var A=B.parentNode;A!=this;A=A.parentNode){if(!A){return false;}}return B;},getElementsByClassName:function(A){return this.getElements("."+A);}});document.extend(Element.Methods.Dom);Element.extend(Element.Methods.Dom);Element.extend({getValue:function(){switch(this.getTag()){case"select":var A=[];$each(this.options,function(B){if(B.selected){A.push($pick(B.value,B.text));}});return(this.multiple)?A:A[0];case"input":if(!(this.checked&&["checkbox","radio"].contains(this.type))&&!["hidden","text","password"].contains(this.type)){break;}case"textarea":return this.value;}return false;},getFormElements:function(){return $$(this.getElementsByTagName("input"),this.getElementsByTagName("select"),this.getElementsByTagName("textarea"));},toQueryString:function(){var A=[];this.getFormElements().each(function(D){var C=D.name;var E=D.getValue();if(E===false||!C||D.disabled){return;}var B=function(F){A.push(C+"="+encodeURIComponent(F));};if($type(E)=="array"){E.each(B);}else{B(E);}});return A.join("&");}});Element.extend({scrollTo:function(A,B){this.scrollLeft=A;this.scrollTop=B;},getSize:function(){return{scroll:{x:this.scrollLeft,y:this.scrollTop},size:{x:this.offsetWidth,y:this.offsetHeight},scrollSize:{x:this.scrollWidth,y:this.scrollHeight}};},getPosition:function(A){A=A||[];var B=this,D=0,C=0;do{D+=B.offsetLeft||0;C+=B.offsetTop||0;B=B.offsetParent;}while(B);A.each(function(E){D-=E.scrollLeft||0;C-=E.scrollTop||0;});return{x:D,y:C};},getTop:function(A){return this.getPosition(A).y;},getLeft:function(A){return this.getPosition(A).x;},getCoordinates:function(B){var A=this.getPosition(B);var C={width:this.offsetWidth,height:this.offsetHeight,left:A.x,top:A.y};C.right=C.left+C.width;C.bottom=C.top+C.height;return C;}});Element.Events.domready={add:function(B){if(window.loaded){B.call(this);return;}var A=function(){if(window.loaded){return;}window.loaded=true;window.timer=$clear(window.timer);this.fireEvent("domready");}.bind(this);if(document.readyState&&window.webkit){window.timer=function(){if(["loaded","complete"].contains(document.readyState)){A();}}.periodical(50);}else{if(document.readyState&&window.ie){if(!$("ie_ready")){var C=(window.location.protocol=="https:")?"://0":"javascript:void(0)";document.write('<script id="ie_ready" defer src="'+C+'"><\/script>');$("ie_ready").onreadystatechange=function(){if(this.readyState=="complete"){A();}};}}else{window.addListener("load",A);document.addListener("DOMContentLoaded",A);}}}};window.onDomReady=function(A){return this.addEvent("domready",A);};window.extend({getWidth:function(){if(this.webkit419){return this.innerWidth;}if(this.opera){return document.body.clientWidth;}return document.documentElement.clientWidth;},getHeight:function(){if(this.webkit419){return this.innerHeight;}if(this.opera){return document.body.clientHeight;}return document.documentElement.clientHeight;},getScrollWidth:function(){if(this.ie){return Math.max(document.documentElement.offsetWidth,document.documentElement.scrollWidth);}if(this.webkit){return document.body.scrollWidth;}return document.documentElement.scrollWidth;},getScrollHeight:function(){if(this.ie){return Math.max(document.documentElement.offsetHeight,document.documentElement.scrollHeight);}if(this.webkit){return document.body.scrollHeight;}return document.documentElement.scrollHeight;},getScrollLeft:function(){return this.pageXOffset||document.documentElement.scrollLeft;},getScrollTop:function(){return this.pageYOffset||document.documentElement.scrollTop;},getSize:function(){return{size:{x:this.getWidth(),y:this.getHeight()},scrollSize:{x:this.getScrollWidth(),y:this.getScrollHeight()},scroll:{x:this.getScrollLeft(),y:this.getScrollTop()}};},getPosition:function(){return{x:0,y:0};}});var Fx={};Fx.Base=new Class({options:{onStart:Class.empty,onComplete:Class.empty,onCancel:Class.empty,transition:function(A){return-(Math.cos(Math.PI*A)-1)/2;},duration:500,unit:"px",wait:true,fps:50},initialize:function(A){this.element=this.element||null;this.setOptions(A);if(this.options.initialize){this.options.initialize.call(this);}},step:function(){var A=$time();if(A<this.time+this.options.duration){this.delta=this.options.transition((A-this.time)/this.options.duration);this.setNow();this.increase();}else{this.stop(true);this.set(this.to);this.fireEvent("onComplete",this.element,10);this.callChain();}},set:function(A){this.now=A;this.increase();return this;},setNow:function(){this.now=this.compute(this.from,this.to);},compute:function(B,A){return(A-B)*this.delta+B;},start:function(B,A){if(!this.options.wait){this.stop();}else{if(this.timer){return this;}}this.from=B;this.to=A;this.change=this.to-this.from;this.time=$time();this.timer=this.step.periodical(Math.round(1000/this.options.fps),this);this.fireEvent("onStart",this.element);return this;},stop:function(A){if(!this.timer){return this;}this.timer=$clear(this.timer);if(!A){this.fireEvent("onCancel",this.element);}return this;},custom:function(B,A){return this.start(B,A);},clearTimer:function(A){return this.stop(A);}});Fx.Base.implement(new Chain,new Events,new Options);Fx.CSS={select:function(B,C){if(B.test(/color/i)){return this.Color;}var A=$type(C);if((A=="array")||(A=="string"&&C.contains(" "))){return this.Multi;}return this.Single;},parse:function(C,D,A){if(!A.push){A=[A];}var F=A[0],E=A[1];if(!$chk(E)){E=F;F=C.getStyle(D);}var B=this.select(D,E);return{from:B.parse(F),to:B.parse(E),css:B};}};Fx.CSS.Single={parse:function(A){return parseFloat(A);},getNow:function(C,B,A){return A.compute(C,B);},getValue:function(C,A,B){if(A=="px"&&B!="opacity"){C=Math.round(C);}return C+A;}};Fx.CSS.Multi={parse:function(A){return A.push?A:A.split(" ").map(function(B){return parseFloat(B);});},getNow:function(E,D,C){var A=[];for(var B=0;B<E.length;B++){A[B]=C.compute(E[B],D[B]);}return A;},getValue:function(C,A,B){if(A=="px"&&B!="opacity"){C=C.map(Math.round);}return C.join(A+" ")+A;}};Fx.CSS.Color={parse:function(A){return A.push?A:A.hexToRgb(true);},getNow:function(E,D,C){var A=[];for(var B=0;B<E.length;B++){A[B]=Math.round(C.compute(E[B],D[B]));}return A;},getValue:function(A){return"rgb("+A.join(",")+")";}};Fx.Style=Fx.Base.extend({initialize:function(B,C,A){this.element=$(B);this.property=C;this.parent(A);},hide:function(){return this.set(0);},setNow:function(){this.now=this.css.getNow(this.from,this.to,this);},set:function(A){this.css=Fx.CSS.select(this.property,A);return this.parent(this.css.parse(A));},start:function(C,B){if(this.timer&&this.options.wait){return this;}var A=Fx.CSS.parse(this.element,this.property,[C,B]);this.css=A.css;return this.parent(A.from,A.to);},increase:function(){this.element.setStyle(this.property,this.css.getValue(this.now,this.options.unit,this.property));}});Element.extend({effect:function(B,A){return new Fx.Style(this,B,A);}});Fx.Styles=Fx.Base.extend({initialize:function(B,A){this.element=$(B);this.parent(A);},setNow:function(){for(var A in this.from){this.now[A]=this.css[A].getNow(this.from[A],this.to[A],this);}},set:function(C){var A={};this.css={};for(var B in C){this.css[B]=Fx.CSS.select(B,C[B]);A[B]=this.css[B].parse(C[B]);}return this.parent(A);},start:function(C){if(this.timer&&this.options.wait){return this;}this.now={};this.css={};var E={},D={};for(var B in C){var A=Fx.CSS.parse(this.element,B,C[B]);E[B]=A.from;D[B]=A.to;this.css[B]=A.css;}return this.parent(E,D);},increase:function(){for(var A in this.now){this.element.setStyle(A,this.css[A].getValue(this.now[A],this.options.unit,A));}}});Element.extend({effects:function(A){return new Fx.Styles(this,A);}});Fx.Elements=Fx.Base.extend({initialize:function(B,A){this.elements=$$(B);this.parent(A);},setNow:function(){for(var C in this.from){var F=this.from[C],E=this.to[C],B=this.css[C],A=this.now[C]={};for(var D in F){A[D]=B[D].getNow(F[D],E[D],this);}}},set:function(G){var B={};this.css={};for(var D in G){var F=G[D],C=this.css[D]={},A=B[D]={};for(var E in F){C[E]=Fx.CSS.select(E,F[E]);A[E]=C[E].parse(F[E]);}}return this.parent(B);},start:function(D){if(this.timer&&this.options.wait){return this;}this.now={};this.css={};var I={},J={};for(var E in D){var G=D[E],A=I[E]={},H=J[E]={},C=this.css[E]={};for(var B in G){var F=Fx.CSS.parse(this.elements[E],B,G[B]);A[B]=F.from;H[B]=F.to;C[B]=F.css;}}return this.parent(I,J);},increase:function(){for(var C in this.now){var A=this.now[C],B=this.css[C];for(var D in A){this.elements[C].setStyle(D,B[D].getValue(A[D],this.options.unit,D));}}}});Fx.Scroll=Fx.Base.extend({options:{overflown:[],offset:{x:0,y:0},wheelStops:true},initialize:function(B,A){this.now=[];this.element=$(B);this.bound={stop:this.stop.bind(this,false)};this.parent(A);if(this.options.wheelStops){this.addEvent("onStart",function(){document.addEvent("mousewheel",this.bound.stop);}.bind(this));this.addEvent("onComplete",function(){document.removeEvent("mousewheel",this.bound.stop);}.bind(this));}},setNow:function(){for(var A=0;A<2;A++){this.now[A]=this.compute(this.from[A],this.to[A]);}},scrollTo:function(B,F){if(this.timer&&this.options.wait){return this;}var D=this.element.getSize();var C={x:B,y:F};for(var E in D.size){var A=D.scrollSize[E]-D.size[E];if($chk(C[E])){C[E]=($type(C[E])=="number")?C[E].limit(0,A):A;}else{C[E]=D.scroll[E];}C[E]+=this.options.offset[E];}return this.start([D.scroll.x,D.scroll.y],[C.x,C.y]);},toTop:function(){return this.scrollTo(false,0);},toBottom:function(){return this.scrollTo(false,"full");},toLeft:function(){return this.scrollTo(0,false);},toRight:function(){return this.scrollTo("full",false);},toElement:function(B){var A=this.element.getPosition(this.options.overflown);var C=$(B).getPosition(this.options.overflown);return this.scrollTo(C.x-A.x,C.y-A.y);},increase:function(){this.element.scrollTo(this.now[0],this.now[1]);}});Fx.Slide=Fx.Base.extend({options:{mode:"vertical"},initialize:function(B,A){this.element=$(B);this.wrapper=new Element("div",{styles:$extend(this.element.getStyles("margin"),{overflow:"hidden"})}).injectAfter(this.element).adopt(this.element);this.element.setStyle("margin",0);this.setOptions(A);this.now=[];this.parent(this.options);this.open=true;this.addEvent("onComplete",function(){this.open=(this.now[0]===0);});if(window.webkit419){this.addEvent("onComplete",function(){if(this.open){this.element.remove().inject(this.wrapper);}});}},setNow:function(){for(var A=0;A<2;A++){this.now[A]=this.compute(this.from[A],this.to[A]);}},vertical:function(){this.margin="margin-top";this.layout="height";this.offset=this.element.offsetHeight;},horizontal:function(){this.margin="margin-left";this.layout="width";this.offset=this.element.offsetWidth;},slideIn:function(A){this[A||this.options.mode]();return this.start([this.element.getStyle(this.margin).toInt(),this.wrapper.getStyle(this.layout).toInt()],[0,this.offset]);},slideOut:function(A){this[A||this.options.mode]();return this.start([this.element.getStyle(this.margin).toInt(),this.wrapper.getStyle(this.layout).toInt()],[-this.offset,0]);},hide:function(A){this[A||this.options.mode]();this.open=false;return this.set([-this.offset,0]);},show:function(A){this[A||this.options.mode]();this.open=true;return this.set([0,this.offset]);},toggle:function(A){if(this.wrapper.offsetHeight==0||this.wrapper.offsetWidth==0){return this.slideIn(A);}return this.slideOut(A);},increase:function(){this.element.setStyle(this.margin,this.now[0]+this.options.unit);this.wrapper.setStyle(this.layout,this.now[1]+this.options.unit);}});Fx.Transition=function(B,A){A=A||[];if($type(A)!="array"){A=[A];}return $extend(B,{easeIn:function(C){return B(C,A);},easeOut:function(C){return 1-B(1-C,A);},easeInOut:function(C){return(C<=0.5)?B(2*C,A)/2:(2-B(2*(1-C),A))/2;}});};Fx.Transitions=new Abstract({linear:function(A){return A;}});Fx.Transitions.extend=function(A){for(var B in A){Fx.Transitions[B]=new Fx.Transition(A[B]);Fx.Transitions.compat(B);}};Fx.Transitions.compat=function(A){["In","Out","InOut"].each(function(B){Fx.Transitions[A.toLowerCase()+B]=Fx.Transitions[A]["ease"+B];});};Fx.Transitions.extend({Pow:function(B,A){return Math.pow(B,A[0]||6);},Expo:function(A){return Math.pow(2,8*(A-1));},Circ:function(A){return 1-Math.sin(Math.acos(A));},Sine:function(A){return 1-Math.sin((1-A)*Math.PI/2);},Back:function(B,A){A=A[0]||1.618;return Math.pow(B,2)*((A+1)*B-A);},Bounce:function(D){var C;for(var B=0,A=1;1;B+=A,A/=2){if(D>=(7-4*B)/11){C=-Math.pow((11-6*B-11*D)/4,2)+A*A;break;}}return C;},Elastic:function(B,A){return Math.pow(2,10*--B)*Math.cos(20*B*Math.PI*(A[0]||1)/3);}});["Quad","Cubic","Quart","Quint"].each(function(B,A){Fx.Transitions[B]=new Fx.Transition(function(C){return Math.pow(C,[A+2]);});Fx.Transitions.compat(B);});var Drag={};Drag.Base=new Class({options:{handle:false,unit:"px",onStart:Class.empty,onBeforeStart:Class.empty,onComplete:Class.empty,onSnap:Class.empty,onDrag:Class.empty,limit:false,modifiers:{x:"left",y:"top"},grid:false,snap:6},initialize:function(B,A){this.setOptions(A);this.element=$(B);this.handle=$(this.options.handle)||this.element;this.mouse={now:{},pos:{}};this.value={start:{},now:{}};this.bound={start:this.start.bindWithEvent(this),check:this.check.bindWithEvent(this),drag:this.drag.bindWithEvent(this),stop:this.stop.bind(this)};this.attach();if(this.options.initialize){this.options.initialize.call(this);}},attach:function(){this.handle.addEvent("mousedown",this.bound.start);return this;},detach:function(){this.handle.removeEvent("mousedown",this.bound.start);return this;},start:function(C){this.fireEvent("onBeforeStart",this.element);this.mouse.start=C.page;var A=this.options.limit;this.limit={x:[],y:[]};for(var D in this.options.modifiers){if(!this.options.modifiers[D]){continue;}this.value.now[D]=this.element.getStyle(this.options.modifiers[D]).toInt();this.mouse.pos[D]=C.page[D]-this.value.now[D];if(A&&A[D]){for(var B=0;B<2;B++){if($chk(A[D][B])){this.limit[D][B]=($type(A[D][B])=="function")?A[D][B]():A[D][B];}}}}if($type(this.options.grid)=="number"){this.options.grid={x:this.options.grid,y:this.options.grid};}document.addListener("mousemove",this.bound.check);document.addListener("mouseup",this.bound.stop);this.fireEvent("onStart",this.element);C.stop();},check:function(A){var B=Math.round(Math.sqrt(Math.pow(A.page.x-this.mouse.start.x,2)+Math.pow(A.page.y-this.mouse.start.y,2)));if(B>this.options.snap){document.removeListener("mousemove",this.bound.check);document.addListener("mousemove",this.bound.drag);this.drag(A);this.fireEvent("onSnap",this.element);}A.stop();},drag:function(A){this.out=false;this.mouse.now=A.page;for(var B in this.options.modifiers){if(!this.options.modifiers[B]){continue;}this.value.now[B]=this.mouse.now[B]-this.mouse.pos[B];if(this.limit[B]){if($chk(this.limit[B][1])&&(this.value.now[B]>this.limit[B][1])){this.value.now[B]=this.limit[B][1];this.out=true;}else{if($chk(this.limit[B][0])&&(this.value.now[B]<this.limit[B][0])){this.value.now[B]=this.limit[B][0];this.out=true;}}}if(this.options.grid[B]){this.value.now[B]-=(this.value.now[B]%this.options.grid[B]);}this.element.setStyle(this.options.modifiers[B],this.value.now[B]+this.options.unit);}this.fireEvent("onDrag",this.element);A.stop();},stop:function(){document.removeListener("mousemove",this.bound.check);document.removeListener("mousemove",this.bound.drag);document.removeListener("mouseup",this.bound.stop);this.fireEvent("onComplete",this.element);}});Drag.Base.implement(new Events,new Options);Element.extend({makeResizable:function(A){return new Drag.Base(this,$merge({modifiers:{x:"width",y:"height"}},A));}});Drag.Move=Drag.Base.extend({options:{droppables:[],container:false,overflown:[]},initialize:function(B,A){this.setOptions(A);this.element=$(B);this.droppables=$$(this.options.droppables);this.container=$(this.options.container);this.position={element:this.element.getStyle("position"),container:false};if(this.container){this.position.container=this.container.getStyle("position");}if(!["relative","absolute","fixed"].contains(this.position.element)){this.position.element="absolute";}var D=this.element.getStyle("top").toInt();var C=this.element.getStyle("left").toInt();if(this.position.element=="absolute"&&!["relative","absolute","fixed"].contains(this.position.container)){D=$chk(D)?D:this.element.getTop(this.options.overflown);C=$chk(C)?C:this.element.getLeft(this.options.overflown);}else{D=$chk(D)?D:0;C=$chk(C)?C:0;}this.element.setStyles({top:D,left:C,position:this.position.element});this.parent(this.element);},start:function(C){this.overed=null;if(this.container){var A=this.container.getCoordinates();var B=this.element.getCoordinates();if(this.position.element=="absolute"&&!["relative","absolute","fixed"].contains(this.position.container)){this.options.limit={x:[A.left,A.right-B.width],y:[A.top,A.bottom-B.height]};}else{this.options.limit={y:[0,A.height-B.height],x:[0,A.width-B.width]};}}this.parent(C);},drag:function(A){this.parent(A);var B=this.out?false:this.droppables.filter(this.checkAgainst,this).getLast();if(this.overed!=B){if(this.overed){this.overed.fireEvent("leave",[this.element,this]);}this.overed=B?B.fireEvent("over",[this.element,this]):null;}return this;},checkAgainst:function(B){B=B.getCoordinates(this.options.overflown);var A=this.mouse.now;return(A.x>B.left&&A.x<B.right&&A.y<B.bottom&&A.y>B.top);},stop:function(){if(this.overed&&!this.out){this.overed.fireEvent("drop",[this.element,this]);}else{this.element.fireEvent("emptydrop",this);}this.parent();return this;}});Element.extend({makeDraggable:function(A){return new Drag.Move(this,A);}});var XHR=new Class({options:{method:"post",async:true,onRequest:Class.empty,onSuccess:Class.empty,onFailure:Class.empty,urlEncoded:true,encoding:"utf-8",autoCancel:false,headers:{}},setTransport:function(){this.transport=(window.XMLHttpRequest)?new XMLHttpRequest():(window.ie?new ActiveXObject("Microsoft.XMLHTTP"):false);return this;},initialize:function(A){this.setTransport().setOptions(A);this.options.isSuccess=this.options.isSuccess||this.isSuccess;this.headers={};if(this.options.urlEncoded&&this.options.method=="post"){var B=(this.options.encoding)?"; charset="+this.options.encoding:"";this.setHeader("Content-type","application/x-www-form-urlencoded"+B);}if(this.options.initialize){this.options.initialize.call(this);}},onStateChange:function(){if(this.transport.readyState!=4||!this.running){return;}this.running=false;var A=0;try{A=this.transport.status;}catch(B){}if(this.options.isSuccess.call(this,A)){this.onSuccess();}else{this.onFailure();}this.transport.onreadystatechange=Class.empty;},isSuccess:function(A){return((A>=200)&&(A<300));},onSuccess:function(){this.response={text:this.transport.responseText,xml:this.transport.responseXML};this.fireEvent("onSuccess",[this.response.text,this.response.xml]);this.callChain();},onFailure:function(){this.fireEvent("onFailure",this.transport);},setHeader:function(A,B){this.headers[A]=B;return this;},send:function(A,C){if(this.options.autoCancel){this.cancel();}else{if(this.running){return this;}}this.running=true;if(C&&this.options.method=="get"){A=A+(A.contains("?")?"&":"?")+C;C=null;}this.transport.open(this.options.method.toUpperCase(),A,this.options.async);this.transport.onreadystatechange=this.onStateChange.bind(this);if((this.options.method=="post")&&this.transport.overrideMimeType){this.setHeader("Connection","close");}$extend(this.headers,this.options.headers);for(var B in this.headers){try{this.transport.setRequestHeader(B,this.headers[B]);}catch(D){}}this.fireEvent("onRequest");this.transport.send($pick(C,null));return this;},cancel:function(){if(!this.running){return this;}this.running=false;this.transport.abort();this.transport.onreadystatechange=Class.empty;this.setTransport();this.fireEvent("onCancel");return this;}});XHR.implement(new Chain,new Events,new Options);var Ajax=XHR.extend({options:{data:null,update:null,onComplete:Class.empty,evalScripts:false,evalResponse:false},initialize:function(B,A){this.addEvent("onSuccess",this.onComplete);this.setOptions(A);this.options.data=this.options.data||this.options.postBody;if(!["post","get"].contains(this.options.method)){this._method="_method="+this.options.method;this.options.method="post";}this.parent();this.setHeader("X-Requested-With","XMLHttpRequest");this.setHeader("Accept","text/javascript, text/html, application/xml, text/xml, */*");this.url=B;},onComplete:function(){if(this.options.update){$(this.options.update).empty().setHTML(this.response.text);}if(this.options.evalScripts||this.options.evalResponse){this.evalScripts();}this.fireEvent("onComplete",[this.response.text,this.response.xml],20);},request:function(A){A=A||this.options.data;switch($type(A)){case"element":A=$(A).toQueryString();break;case"object":A=Object.toQueryString(A);}if(this._method){A=(A)?[this._method,A].join("&"):this._method;}return this.send(this.url,A);},evalScripts:function(){var B,A;if(this.options.evalResponse||(/(ecma|java)script/).test(this.getHeader("Content-type"))){A=this.response.text;}else{A=[];var C=/<script[^>]*>([\s\S]*?)<\/script>/gi;while((B=C.exec(this.response.text))){A.push(B[1]);}A=A.join("\n");}if(A){(window.execScript)?window.execScript(A):window.setTimeout(A,0);}},getHeader:function(A){try{return this.transport.getResponseHeader(A);}catch(B){}return null;}});Object.toQueryString=function(B){var C=[];for(var A in B){C.push(encodeURIComponent(A)+"="+encodeURIComponent(B[A]));}return C.join("&");};Element.extend({send:function(A){return new Ajax(this.getProperty("action"),$merge({data:this.toQueryString()},A,{method:"post"})).request();}});var Cookie=new Abstract({options:{domain:false,path:false,duration:false,secure:false},set:function(C,D,B){B=$merge(this.options,B);D=encodeURIComponent(D);if(B.domain){D+="; domain="+B.domain;}if(B.path){D+="; path="+B.path;}if(B.duration){var A=new Date();A.setTime(A.getTime()+B.duration*24*60*60*1000);D+="; expires="+A.toGMTString();}if(B.secure){D+="; secure";}document.cookie=C+"="+D;return $extend(B,{key:C,value:D});},get:function(A){var B=document.cookie.match("(?:^|;)\\s*"+A.escapeRegExp()+"=([^;]*)");return B?decodeURIComponent(B[1]):false;},remove:function(B,A){if($type(B)=="object"){this.set(B.key,"",$merge(B,{duration:-1}));}else{this.set(B,"",$merge(A,{duration:-1}));}}});var Json={toString:function(C){switch($type(C)){case"string":return'"'+C.replace(/(["\\])/g,"\\$1")+'"';case"array":return"["+C.map(Json.toString).join(",")+"]";case"object":var A=[];for(var B in C){A.push(Json.toString(B)+":"+Json.toString(C[B]));}return"{"+A.join(",")+"}";case"number":if(isFinite(C)){break;}case false:return"null";}return String(C);},evaluate:function(str,secure){return(($type(str)!="string")||(secure&&!str.test(/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/)))?null:eval("("+str+")");}};Json.Remote=XHR.extend({initialize:function(B,A){this.url=B;this.addEvent("onSuccess",this.onComplete);this.parent(A);this.setHeader("X-Request","JSON");},send:function(A){return this.parent(this.url,"json="+Json.toString(A));},onComplete:function(){this.fireEvent("onComplete",[Json.evaluate(this.response.text,this.options.secure)]);}});var Asset=new Abstract({javascript:function(C,B){B=$merge({onload:Class.empty},B);var A=new Element("script",{src:C}).addEvents({load:B.onload,readystatechange:function(){if(this.readyState=="complete"){this.fireEvent("load");}}});delete B.onload;return A.setProperties(B).inject(document.head);},css:function(B,A){return new Element("link",$merge({rel:"stylesheet",media:"screen",type:"text/css",href:B},A)).inject(document.head);},image:function(C,B){B=$merge({onload:Class.empty,onabort:Class.empty,onerror:Class.empty},B);var D=new Image();D.src=C;var A=new Element("img",{src:C});["load","abort","error"].each(function(E){var F=B["on"+E];delete B["on"+E];A.addEvent(E,function(){this.removeEvent(E,arguments.callee);F.call(this);});});if(D.width&&D.height){A.fireEvent("load",A,1);}return A.setProperties(B);},images:function(D,C){C=$merge({onComplete:Class.empty,onProgress:Class.empty},C);if(!D.push){D=[D];}var A=[];var B=0;D.each(function(F){var E=new Asset.image(F,{onload:function(){C.onProgress.call(this,B);B++;if(B==D.length){C.onComplete();}}});A.push(E);});return new Elements(A);}});var Hash=new Class({length:0,initialize:function(A){this.obj=A||{};this.setLength();},get:function(A){return(this.hasKey(A))?this.obj[A]:null;},hasKey:function(A){return(A in this.obj);},set:function(A,B){if(!this.hasKey(A)){this.length++;}this.obj[A]=B;return this;},setLength:function(){this.length=0;for(var A in this.obj){this.length++;}return this;},remove:function(A){if(this.hasKey(A)){delete this.obj[A];this.length--;}return this;},each:function(A,B){$each(this.obj,A,B);},extend:function(A){$extend(this.obj,A);return this.setLength();},merge:function(){this.obj=$merge.apply(null,[this.obj].extend(arguments));return this.setLength();},empty:function(){this.obj={};this.length=0;return this;},keys:function(){var A=[];for(var B in this.obj){A.push(B);}return A;},values:function(){var A=[];for(var B in this.obj){A.push(this.obj[B]);}return A;}});function $H(A){return new Hash(A);}Hash.Cookie=Hash.extend({initialize:function(B,A){this.name=B;this.options=$extend({autoSave:true},A||{});this.load();},save:function(){if(this.length==0){Cookie.remove(this.name,this.options);return true;}var A=Json.toString(this.obj);if(A.length>4096){return false;}Cookie.set(this.name,A,this.options);return true;},load:function(){this.obj=Json.evaluate(Cookie.get(this.name),true)||{};this.setLength();}});Hash.Cookie.Methods={};["extend","set","merge","empty","remove"].each(function(A){Hash.Cookie.Methods[A]=function(){Hash.prototype[A].apply(this,arguments);if(this.options.autoSave){this.save();}return this;};});Hash.Cookie.implement(Hash.Cookie.Methods);var Color=new Class({initialize:function(B,D){D=D||(B.push?"rgb":"hex");var C,A;switch(D){case"rgb":C=B;A=C.rgbToHsb();break;case"hsb":C=B.hsbToRgb();A=B;break;default:C=B.hexToRgb(true);A=C.rgbToHsb();}C.hsb=A;C.hex=C.rgbToHex();return $extend(C,Color.prototype);},mix:function(){var A=$A(arguments);var C=($type(A[A.length-1])=="number")?A.pop():50;var B=this.copy();A.each(function(D){D=new Color(D);for(var E=0;E<3;E++){B[E]=Math.round((B[E]/100*(100-C))+(D[E]/100*C));}});return new Color(B,"rgb");},invert:function(){return new Color(this.map(function(A){return 255-A;}));},setHue:function(A){return new Color([A,this.hsb[1],this.hsb[2]],"hsb");},setSaturation:function(A){return new Color([this.hsb[0],A,this.hsb[2]],"hsb");},setBrightness:function(A){return new Color([this.hsb[0],this.hsb[1],A],"hsb");}});function $RGB(C,B,A){return new Color([C,B,A],"rgb");}function $HSB(C,B,A){return new Color([C,B,A],"hsb");}Array.extend({rgbToHsb:function(){var B=this[0],C=this[1],J=this[2];var G,F,H;var I=Math.max(B,C,J),E=Math.min(B,C,J);var K=I-E;H=I/255;F=(I!=0)?K/I:0;if(F==0){G=0;}else{var D=(I-B)/K;var A=(I-C)/K;var L=(I-J)/K;if(B==I){G=L-A;}else{if(C==I){G=2+D-L;}else{G=4+A-D;}}G/=6;if(G<0){G++;}}return[Math.round(G*360),Math.round(F*100),Math.round(H*100)];},hsbToRgb:function(){var C=Math.round(this[2]/100*255);if(this[1]==0){return[C,C,C];}else{var A=this[0]%360;var E=A%60;var F=Math.round((this[2]*(100-this[1]))/10000*255);var D=Math.round((this[2]*(6000-this[1]*E))/600000*255);var B=Math.round((this[2]*(6000-this[1]*(60-E)))/600000*255);switch(Math.floor(A/60)){case 0:return[C,B,F];case 1:return[D,C,F];case 2:return[F,C,B];case 3:return[F,D,C];case 4:return[B,F,C];case 5:return[C,F,D];}}return false;}});var Scroller=new Class({options:{area:20,velocity:1,onChange:function(A,B){this.element.scrollTo(A,B);}},initialize:function(B,A){this.setOptions(A);this.element=$(B);this.mousemover=([window,document].contains(B))?$(document.body):this.element;},start:function(){this.coord=this.getCoords.bindWithEvent(this);this.mousemover.addListener("mousemove",this.coord);},stop:function(){this.mousemover.removeListener("mousemove",this.coord);this.timer=$clear(this.timer);},getCoords:function(A){this.page=(this.element==window)?A.client:A.page;if(!this.timer){this.timer=this.scroll.periodical(50,this);}},scroll:function(){var A=this.element.getSize();var D=this.element.getPosition();var C={x:0,y:0};for(var B in this.page){if(this.page[B]<(this.options.area+D[B])&&A.scroll[B]!=0){C[B]=(this.page[B]-this.options.area-D[B])*this.options.velocity;}else{if(this.page[B]+this.options.area>(A.size[B]+D[B])&&A.scroll[B]+A.size[B]!=A.scrollSize[B]){C[B]=(this.page[B]-A.size[B]+this.options.area-D[B])*this.options.velocity;}}}if(C.y||C.x){this.fireEvent("onChange",[A.scroll.x+C.x,A.scroll.y+C.y]);}}});Scroller.implement(new Events,new Options);var Slider=new Class({options:{onChange:Class.empty,onComplete:Class.empty,onTick:function(A){this.knob.setStyle(this.p,A);},mode:"horizontal",steps:100,offset:0},initialize:function(D,A,B){this.element=$(D);this.knob=$(A);this.setOptions(B);this.previousChange=-1;this.previousEnd=-1;this.step=-1;this.element.addEvent("mousedown",this.clickedElement.bindWithEvent(this));var C,F;switch(this.options.mode){case"horizontal":this.z="x";this.p="left";C={x:"left",y:false};F="offsetWidth";break;case"vertical":this.z="y";this.p="top";C={x:false,y:"top"};F="offsetHeight";}this.max=this.element[F]-this.knob[F]+(this.options.offset*2);this.half=this.knob[F]/2;this.getPos=this.element["get"+this.p.capitalize()].bind(this.element);this.knob.setStyle("position","relative").setStyle(this.p,-this.options.offset);var E={};E[this.z]=[-this.options.offset,this.max-this.options.offset];this.drag=new Drag.Base(this.knob,{limit:E,modifiers:C,snap:0,onStart:function(){this.draggedKnob();}.bind(this),onDrag:function(){this.draggedKnob();}.bind(this),onComplete:function(){this.draggedKnob();this.end();}.bind(this)});if(this.options.initialize){this.options.initialize.call(this);}},set:function(A){this.step=A.limit(0,this.options.steps);this.checkStep();this.end();this.fireEvent("onTick",this.toPosition(this.step));return this;},clickedElement:function(B){var A=B.page[this.z]-this.getPos()-this.half;A=A.limit(-this.options.offset,this.max-this.options.offset);this.step=this.toStep(A);this.checkStep();this.end();this.fireEvent("onTick",A);},draggedKnob:function(){this.step=this.toStep(this.drag.value.now[this.z]);this.checkStep();},checkStep:function(){if(this.previousChange!=this.step){this.previousChange=this.step;this.fireEvent("onChange",this.step);}},end:function(){if(this.previousEnd!==this.step){this.previousEnd=this.step;this.fireEvent("onComplete",this.step+"");}},toStep:function(A){return Math.round((A+this.options.offset)/this.max*this.options.steps);},toPosition:function(A){return this.max*A/this.options.steps;}});Slider.implement(new Events);Slider.implement(new Options);var SmoothScroll=Fx.Scroll.extend({initialize:function(B){this.parent(window,B);this.links=(this.options.links)?$$(this.options.links):$$(document.links);var A=window.location.href.match(/^[^#]*/)[0]+"#";this.links.each(function(D){if(D.href.indexOf(A)!=0){return;}var C=D.href.substr(A.length);if(C&&$(C)){this.useLink(D,C);}},this);if(!window.webkit419){this.addEvent("onComplete",function(){window.location.hash=this.anchor;});}},useLink:function(B,A){B.addEvent("click",function(C){this.anchor=A;this.toElement(A);C.stop();}.bindWithEvent(this));}});var Sortables=new Class({options:{handles:false,onStart:Class.empty,onComplete:Class.empty,ghost:true,snap:3,onDragStart:function(A,B){B.setStyle("opacity",0.7);A.setStyle("opacity",0.7);},onDragComplete:function(A,B){A.setStyle("opacity",1);B.remove();this.trash.remove();}},initialize:function(D,B){this.setOptions(B);this.list=$(D);this.elements=this.list.getChildren();this.handles=(this.options.handles)?$$(this.options.handles):this.elements;this.bound={start:[],moveGhost:this.moveGhost.bindWithEvent(this)};for(var C=0,A=this.handles.length;C<A;C++){this.bound.start[C]=this.start.bindWithEvent(this,this.elements[C]);}this.attach();if(this.options.initialize){this.options.initialize.call(this);}this.bound.move=this.move.bindWithEvent(this);this.bound.end=this.end.bind(this);},attach:function(){this.handles.each(function(B,A){B.addEvent("mousedown",this.bound.start[A]);},this);},detach:function(){this.handles.each(function(B,A){B.removeEvent("mousedown",this.bound.start[A]);},this);},start:function(C,B){this.active=B;this.coordinates=this.list.getCoordinates();if(this.options.ghost){var A=B.getPosition();this.offset=C.page.y-A.y;this.trash=new Element("div").inject(document.body);this.ghost=B.clone().inject(this.trash).setStyles({position:"absolute",left:A.x,top:C.page.y-this.offset});document.addListener("mousemove",this.bound.moveGhost);this.fireEvent("onDragStart",[B,this.ghost]);}document.addListener("mousemove",this.bound.move);document.addListener("mouseup",this.bound.end);this.fireEvent("onStart",B);C.stop();},moveGhost:function(A){var B=A.page.y-this.offset;B=B.limit(this.coordinates.top,this.coordinates.bottom-this.ghost.offsetHeight);this.ghost.setStyle("top",B);A.stop();},move:function(E){var B=E.page.y;this.previous=this.previous||B;var A=((this.previous-B)>0);var D=this.active.getPrevious();var C=this.active.getNext();if(D&&A&&B<D.getCoordinates().bottom){this.active.injectBefore(D);}if(C&&!A&&B>C.getCoordinates().top){this.active.injectAfter(C);}this.previous=B;},serialize:function(A){return this.list.getChildren().map(A||function(B){return this.elements.indexOf(B);},this);},end:function(){this.previous=null;document.removeListener("mousemove",this.bound.move);document.removeListener("mouseup",this.bound.end);if(this.options.ghost){document.removeListener("mousemove",this.bound.moveGhost);this.fireEvent("onDragComplete",[this.active,this.ghost]);}this.fireEvent("onComplete",this.active);}});Sortables.implement(new Events,new Options);var Tips=new Class({options:{onShow:function(A){A.setStyle("visibility","visible");},onHide:function(A){A.setStyle("visibility","hidden");},maxTitleChars:30,showDelay:100,hideDelay:100,className:"tool",offsets:{x:16,y:16},fixed:false},initialize:function(B,A){this.setOptions(A);this.toolTip=new Element("div",{"class":this.options.className+"-tip",styles:{position:"absolute",top:"0",left:"0",visibility:"hidden"}}).inject(document.body);this.wrapper=new Element("div").inject(this.toolTip);$$(B).each(this.build,this);if(this.options.initialize){this.options.initialize.call(this);}},build:function(B){B.$tmp.myTitle=(B.href&&B.getTag()=="a")?B.href.replace("http://",""):(B.rel||false);if(B.title){var C=B.title.split("::");if(C.length>1){B.$tmp.myTitle=C[0].trim();B.$tmp.myText=C[1].trim();}else{B.$tmp.myText=B.title;}B.removeAttribute("title");}else{B.$tmp.myText=false;}if(B.$tmp.myTitle&&B.$tmp.myTitle.length>this.options.maxTitleChars){B.$tmp.myTitle=B.$tmp.myTitle.substr(0,this.options.maxTitleChars-1)+"&hellip;";}B.addEvent("mouseenter",function(D){this.start(B);if(!this.options.fixed){this.locate(D);}else{this.position(B);}}.bind(this));if(!this.options.fixed){B.addEvent("mousemove",this.locate.bindWithEvent(this));}var A=this.end.bind(this);B.addEvent("mouseleave",A);B.addEvent("trash",A);},start:function(A){this.wrapper.empty();if(A.$tmp.myTitle){this.title=new Element("span").inject(new Element("div",{"class":this.options.className+"-title"}).inject(this.wrapper)).setHTML(A.$tmp.myTitle);}if(A.$tmp.myText){this.text=new Element("span").inject(new Element("div",{"class":this.options.className+"-text"}).inject(this.wrapper)).setHTML(A.$tmp.myText);}$clear(this.timer);this.timer=this.show.delay(this.options.showDelay,this);},end:function(A){$clear(this.timer);this.timer=this.hide.delay(this.options.hideDelay,this);},position:function(A){var B=A.getPosition();this.toolTip.setStyles({left:B.x+this.options.offsets.x,top:B.y+this.options.offsets.y});},locate:function(B){var D={x:window.getWidth(),y:window.getHeight()};var A={x:window.getScrollLeft(),y:window.getScrollTop()};var C={x:this.toolTip.offsetWidth,y:this.toolTip.offsetHeight};var G={x:"left",y:"top"};for(var E in G){var F=B.page[E]+this.options.offsets[E];if((F+C[E]-A[E])>D[E]){F=B.page[E]-this.options.offsets[E]-C[E];}this.toolTip.setStyle(G[E],F);}},show:function(){if(this.options.timeout){this.timer=this.hide.delay(this.options.timeout,this);}this.fireEvent("onShow",[this.toolTip]);},hide:function(){this.fireEvent("onHide",[this.toolTip]);}});Tips.implement(new Events,new Options);var Group=new Class({initialize:function(){this.instances=$A(arguments);this.events={};this.checker={};},addEvent:function(B,A){this.checker[B]=this.checker[B]||{};this.events[B]=this.events[B]||[];if(this.events[B].contains(A)){return false;}else{this.events[B].push(A);}this.instances.each(function(C,D){C.addEvent(B,this.check.bind(this,[B,C,D]));},this);return this;},check:function(C,A,B){this.checker[C][B]=true;var D=this.instances.every(function(F,E){return this.checker[C][E]||false;},this);if(!D){return;}this.checker[C]={};this.events[C].each(function(E){E.call(this,this.instances,A);},this);}});var Accordion=Fx.Elements.extend({options:{onActive:Class.empty,onBackground:Class.empty,display:0,show:false,height:true,width:false,opacity:true,fixedHeight:false,fixedWidth:false,wait:false,alwaysHide:false},initialize:function(){var C,E,F,B;$each(arguments,function(I,H){switch($type(I)){case"object":C=I;break;case"element":B=$(I);break;default:var G=$$(I);if(!E){E=G;}else{F=G;}}});this.togglers=E||[];this.elements=F||[];this.container=$(B);this.setOptions(C);this.previous=-1;if(this.options.alwaysHide){this.options.wait=true;}if($chk(this.options.show)){this.options.display=false;this.previous=this.options.show;}if(this.options.start){this.options.display=false;this.options.show=false;}this.effects={};if(this.options.opacity){this.effects.opacity="fullOpacity";}if(this.options.width){this.effects.width=this.options.fixedWidth?"fullWidth":"offsetWidth";}if(this.options.height){this.effects.height=this.options.fixedHeight?"fullHeight":"scrollHeight";}for(var D=0,A=this.togglers.length;D<A;D++){this.addSection(this.togglers[D],this.elements[D]);}this.elements.each(function(H,G){if(this.options.show===G){this.fireEvent("onActive",[this.togglers[G],H]);}else{for(var I in this.effects){H.setStyle(I,0);}}},this);this.parent(this.elements);if($chk(this.options.display)){this.display(this.options.display);}},addSection:function(E,C,G){E=$(E);C=$(C);var F=this.togglers.contains(E);var B=this.togglers.length;this.togglers.include(E);this.elements.include(C);if(B&&(!F||G)){G=$pick(G,B-1);E.injectBefore(this.togglers[G]);C.injectAfter(E);}else{if(this.container&&!F){E.inject(this.container);C.inject(this.container);}}var A=this.togglers.indexOf(E);E.addEvent("click",this.display.bind(this,A));if(this.options.height){C.setStyles({"padding-top":0,"border-top":"none","padding-bottom":0,"border-bottom":"none"});}if(this.options.width){C.setStyles({"padding-left":0,"border-left":"none","padding-right":0,"border-right":"none"});}C.fullOpacity=1;if(this.options.fixedWidth){C.fullWidth=this.options.fixedWidth;}if(this.options.fixedHeight){C.fullHeight=this.options.fixedHeight;}C.setStyle("overflow","hidden");if(!F){for(var D in this.effects){C.setStyle(D,0);}}return this;},display:function(A){A=($type(A)=="element")?this.elements.indexOf(A):A;if((this.timer&&this.options.wait)||(A===this.previous&&!this.options.alwaysHide)){return this;}this.previous=A;var B={};this.elements.each(function(E,D){B[D]={};var C=(D!=A)||(this.options.alwaysHide&&(E.offsetHeight>0));this.fireEvent(C?"onBackground":"onActive",[this.togglers[D],E]);for(var F in this.effects){B[D][F]=C?0:E[this.effects[F]];}},this);return this.start(B);},showThisHideOpen:function(A){return this.display(A);}});Fx.Accordion=Accordion;
var Lyra={};Lyra.Info={build:"1.1.0."};
Lyra.Base=new function(){this._moduleNames=new Array();this.init=function(){};this._ref=new Object();this.parentClass=function(_c){return Lyra.ClassManager.getParentClassByName(this._ref,_c);}
this.childClass=function(_c){return Lyra.ClassManager.getChildClassByName(this._ref,_c);}
this.parentModule=function(_c){return Lyra.ClassManager.getParentModuleByName(this._ref,_c);}
this.appendModuleName=function(_c){this._moduleNames.push(_c);}};
Lyra.Config=new function(){this._logMode=0;this._gcInterval=3*60;this._messageCallback=null;this.LOG_MODE_OFF=0;this.LOG_MODE_DEVELOPMENT=1;this.LOG_MODE_PRODUCTION=2;this.setLogMode=function(_m){this._logMode=_m;if(_m==this.LOG_MODE_DEVELOPMENT){Lyra.Debug.start();}
return;};this.getLogMode=function(){return this._logMode;};this.setGCInterval=function(_s){this._gcInterval=_s;return;};this.getGCInterval=function(){return this._gcInterval;};this.setMessageCallback=function(_c){this._messageCallback=_c;return;};this.getMessageCallback=function(){return this._messageCallback;};}
Lyra.ClassManager=new function(){this._objects=new Array();this._isStopped=false;this._exclusions='stop,scroll,prompt,print,parent,open,home,forward,focus,find,confirm,close,blur,back,alert';this.init=function(_e){setInterval(Lyra.Utilities.bind(this,"garbageCollect"),Lyra.Config.getGCInterval()*1000);this.parseNewNode(_e);return;};this.stop=function(){this._isStopped=true;return;};this.ignoreClass=function(_n){this._exclusions+=','+_n;}
this.parseNewNode=function(_e){var _startIndex=this._objects.length;this.parse(_e);for(var _i=_startIndex;_i<this._objects.length;_i++){this._objects[_i].init();}
return;}
this.parse=function(_e){if(_e==undefined)return;if(this._isStopped)return;if(_e.nodeType==1){_e.parentClass=new Function("c","return Lyra.ClassManager.getParentClassByName(this,c);");_e.childClass=new Function("c","return Lyra.ClassManager.getChildClassByName(this,c);");_e.parentModule=new Function("c","return Lyra.ClassManager.getParentModuleByName(this,c);");}
if(_e.className){var _classes=_e.className.split(' ');for(var _c=0;_c<_classes.length;_c++){var _skip=false;if(this._exclusions.match(new RegExp(_classes[_c],"g")))_skip=true;if(window[_classes[_c]]&&window[_classes[_c]]._restrict&&!_skip){with(window[_classes[_c]]._restrict){for(var _i=0;_i<parents.length;_i++){if(!this.getParentClassByName(_e,parents[_i])){_skip=true;break;}}}}
if((typeof(window[_classes[_c]])=='function')&&(window[_classes[_c]]&&!_skip)){Lyra.Utilities.extend(window[_classes[_c]],Lyra.Base);var _l=this._objects.push(new window[_classes[_c]](_e))-1;this._objects[_l]._ref=_e;_e[_classes[_c]]=this._objects[_l];if(!_e["classObjects"])_e["classObjects"]=new Array();_e["classObjects"].push(_classes[_c]);}}}
if(_e.hasChildNodes()){for(var _i=0;_i<_e.childNodes.length;_i++){this.parse(_e.childNodes[_i]);}}
return;};this.getParentClassByName=function(_e,_c){while(_e.parentNode){_e=_e.parentNode;if(Lyra.Utilities.matchClass(_e,_c))return _e[_c];}
return null;};this.getChildClassByName=function(_e,_c){if(Lyra.Utilities.matchClass(_e,_c))return _e[_c];if(!_e.hasChildNodes)return null;var _rtn=null;for(var _i=0;_i<_e.childNodes.length;_i++){_rtn=this.getChildClassByName(_e.childNodes[_i],_c);if(_rtn)break;}
return _rtn;};this.getParentModuleByName=function(_e,_c){while(_e.parentNode){_e=_e.parentNode;var _module=Lyra.Utilities.findModule(_e,_c);if(_module!=null)return _module;}
return null;};this.getClassByName=function(_n){return this.getChildClassByName(document.getElementsByTagName("BODY")[0],_n);}
this.garbageCollect=function(){for(var _i=0;_i<this._objects.length;_i++){if(this._objects[_i]&&this._objects[_i]._ref&&!this._objects[_i]._ref.parentNode){this._objects[_i]=null;}}};this.setClassProperty=function(_c,_p,_v){window[_c][_p]=_v;};}
Lyra.Template=function(_e){try{this._base=_e.cloneNode(true);}catch(e){Lyra.Log.write(Lyra.Log.ERROR,"Template could not be initialized because DOM node doesn't exist: "+e);}
this._copy=null;this._data=null;this._outputText="";this._reRenderOutput=false;this._allowedAttributes=["src","href","alt","title","name","value","id"];this._allowedEvents=["onclick","onmouseover","onmouseout"];this._enableOutput=true;this.setValues=function(_d){this._data=_d;return;};this.getCopy=function(_d){if(_d){if(this._data==null)this._data={};for(var _i in _d)this._data[_i]=_d[_i];}
this._copy=this._base.cloneNode(true);this.prepare(this._copy);return this._copy;};this.setDisplay=function(_v){this._base.style.display=_v;return;};this.prepare=function(_e){if(_e.nodeValue&&_e.nodeValue.match(/\{[^\}]+\}/g)){var _temp=_e.nodeValue.replace(/\{[^\}]+\}/g,Lyra.Utilities.bind(this,"replace"));if(this._reRenderOutput){var _rendered=document.createElement("DIV");_rendered.innerHTML=_temp;_e.parentNode.replaceChild(_rendered,_e);}else{_e.nodeValue=_temp;}}
for(var _i=0;_i<this._allowedAttributes.length;_i++){if(_e.getAttribute&&_e.getAttribute(this._allowedAttributes[_i])){var _element=_e.getAttribute(this._allowedAttributes[_i]);if(this._allowedAttributes[_i]=="href"){_element=_element.replace(/(\/;)/g,";");_element=_element.replace(/(%7B)/gi,"{");_element=_element.replace(/(%7D)/gi,"}");_element=_element.replace(/^about:/,"");_element=_element.replace(/^blank/,"");}
if(_element.match(/\{[^\}]+\}/g)){_e.setAttribute(this._allowedAttributes[_i],_element.replace(/\{[^\}]+\}/g,Lyra.Utilities.bind(this,"replace")));}}}
for(var _i=0;_i<this._allowedEvents.length;_i++){if(_e[this._allowedEvents[_i]]){var _temp=_e[this._allowedEvents[_i]].toString().replace(/[\r\n]/,"");_temp=_temp.replace(/^[^\{]+\{/,"");_temp=_temp.replace(/\}$/,"");if(_temp.match(/\{[^\}]+\}/g)){_e[this._allowedEvents[_i]]=new Function(_temp.replace(/\{[^\}]+}/g,Lyra.Utilities.bind(this,"replace")));}}}
for(var _i=0;_i<_e.childNodes.length;_i++){this.prepare(_e.childNodes[_i]);if(!this._enableOutput){_e.removeChild(_e.childNodes[_i]);_i--;}}
return;};this.replace=function(_t){this._outputText="";_t=_t.replace(/[\{\}]/g,"");if(_t.match(/^[A-Za-z0-9]+$/)&&this._data[_t.toUpperCase()]!=undefined){this._outputText=this._data[_t.toUpperCase()];return this._outputText;}
for(var _k in this._data){_t=_t.replace(new RegExp('(^|[^a-zA-Z0-9])'+_k+'([^a-zA-Z0-9]|$)',"gi"),"$1this._data."+_k.toUpperCase()+"$2");}
_t=_t.replace(/show\(/g,"this.show(");_t=_t.replace(/render\(/g,"this.render(");_t=_t.replace(/enableOutput\(/g,"this.enableOutput(");_t=_t.replace(/disableOutput\(/g,"this.disableOutput(");_t=_t.replace(/getOutputStatus\(/g,"this.getOutputStatus(");_t=_t.replace(/enableOutputIf\(/g,"this.enableOutputIf(");this._run=new Function(_t);try{this._run();}catch(e){Lyra.Log.write(Lyra.Log.ERROR,"Template could not be executed. This could be caused by incorrect tag names. Check the data coming from the server to make sure all needed fields are present and correctly named: "+e);}
return this._outputText;};this.show=function(_t){this._outputText+=_t;return;}
this.render=function(_t){this._reRenderOutput=true;this._outputText+=Lyra.Utilities.replaceAllEntities(_t);return;}
this.disableOutput=function(){this._enableOutput=false;return;};this.enableOutput=function(){this._enableOutput=true;return;};this.enableOutputIf=function(_c){this._enableOutput=_c;return _c;};this.getOutputStatus=function(){return this._enableOutput;};}
Lyra.Dataset=function(_d){this._data=_d;this._parentID=null;this._primaryKey="";this._recordCount=null;this.setData=function(_d){this._data=new Array();for(var _i=0;_i<_d.length;_i++){var _temp={};for(var _k in _d[_i]){_temp[_k.toUpperCase()]=_d[_i][_k];}
this._data.push(_temp);}}
this.getData=function(){return this._data;};this.getRecordCount=function(){return this._recordCount|this._data.length;};this.setRecordCount=function(_rc){this._recordCount=_rc;return;}
this.setParentID=function(_id){this._parentID=_id;return;};this.getParentID=function(){return this._parentID;};this.setPrimaryKey=function(_pk){this._primaryKey=_pk;return;};this.getPrimaryKey=function(_pk){return this._primaryKey;};this.getColumn=function(_i,_n){try{return this._data[_i][_n.toUpperCase()];}catch(_exc){return 1;}};this.query=function(_a,_c){var _rtn=new Array();for(var _i=0;_i<this._data.length;_i++){var _match=true;for(var _k in _a){if(_k.toUpperCase()=="INDEX"){if(_a[_k]!=_i){_match=false;}
continue;}
if(_a[_k]!=this._data[_i][_k.toUpperCase()]){_match=false;}}
if(_match){var _tempResult={};if(_c!=undefined){for(var _j=0;_j<_c.length;_j++){if(_c[_j].toUpperCase()=="INDEX"){_tempResult[_c[_j]]=_i;}else if(this._data[_i][_c[_j].toUpperCase()]==undefined){Lyra.Log.write(Lyra.Log.ERROR,"Unable to find column '"+_c[_j]+"' in dataset. Make sure it is being provided in the data coming from the server.");}else{_tempResult[_c[_j]]=this._data[_i][_c[_j].toUpperCase()];}}}else{_tempResult=this._data[_i];}
_rtn.push(_tempResult);}}
return _rtn;};this.setColumn=function(_i,_n,_v){this._data[_i][_n.toUpperCase()]=_v;};this.findPosition=function(_k,_v){for(var _i=0;_i<this._data.length;_i++){if(this._data[_i][_k.toUpperCase()]&&this._data[_i][_k.toUpperCase()]==_v)return _i;}
return null;};this.moveRow=function(_o,_n){var _temp=this._data.slice(_o,_o+1);this._data.splice(_o,1);var ary1=this._data.slice(0,_n);var ary2=this._data.slice(_n,this._data.length);ary1.push(_temp[0]);ary1=ary1.concat(ary2);this._data=ary1;};this.merge=function(_d,_pk){var _diffset={};_diffset.mod=[];_diffset.rem=[];_diffset.add=[];for(var _i=0;_i<_d.length;_i++){var _recordExists=false;for(var _j=0;_j<this._data.length;_j++){if(_d[_i][_pk.toUpperCase()]==this._data[_j][_pk.toUpperCase()]){if(_d[_i].LOCALTIMESTAMP!=this._data[_j].LOCALTIMESTAMP){var _ni=_diffset.mod.push({index:_j,changes:{},alldata:_d[_i],changecount:0})-1;for(var _k in _d[_i]){if(_d[_i][_k]!=this._data[_j][_k]){_diffset.mod[_ni].changes[_k]=_d[_i][_k];_diffset.mod[_ni].changecount++;}}}
_recordExists=true;break;}}
if(!_recordExists){_diffset.add.push({index:_i,data:_d[_i]});}}
for(var _i=0;_i<this._data.length;_i++){if(_d[_i]==undefined||(_d[_i]&&_d[_i][_pk.toUpperCase()]!=this._data[_i][_pk.toUpperCase()])){_diffset.rem.push({index:_i});this._data.splice(_i,1);_i--;}}
return _diffset;};}
Lyra.Storage=function(_n){var _name=_n;this.recall=function(){var _lyra_store=readCookie("LYRA_STORE");if(_lyra_store!=""){_lyra_store=eval("("+_lyra_store+")");}else{_lyra_store={};}
if(_lyra_store[_name])for(var _i in _lyra_store[_name])this[_i]=_lyra_store[_name][_i];};this.save=function(){var _lyra_store=readCookie("LYRA_STORE");if(_lyra_store!=""){_lyra_store=eval("("+_lyra_store+")");}else{_lyra_store={};}
_lyra_store[_name]=this;createCookie("LYRA_STORE",Lyra.Utilities.encodeAsJSON(_lyra_store));};this.recall();}
Lyra.Utilities=new function(){this.uniqueNumber=0;this.extend=function(_c,_p){var _con=_p.toString();var _m=_con.match(/\s*function (.*?)\(/);if(_m!=null)_c.prototype[_m[1]]=_p;for(var _n in _p){_c.prototype[_n]=_p[_n];}
if(_p.prototype){for(var _r in _p.prototype){_c.prototype[_r]=_p.prototype[_r];}}};this.bind=function(_p,_m){return function(_a,_b,_c){return _p[_m](_a,_b,_c);}};this.matchClass=function(_e,_c){if(_e.classObjects){for(var _i=0;_i<_e.classObjects.length;_i++){if(_e.classObjects[_i]==_c)return true;}}
return false;};this.findModule=function(_e,_c){if(_e.classObjects){for(var _i=0;_i<_e.classObjects.length;_i++){if(_e[_e.classObjects[_i]]._moduleNames){for(var _j=0;_j<_e[_e.classObjects[_i]]._moduleNames.length;_j++){if(_e[_e.classObjects[_i]]._moduleNames[_j]==_c)return _e[_e.classObjects[_i]];}}}}
return null;};this.chainable=function(){this.exec=null;this.next=null;this.chain=function(_v){this.exec=_v;this.next=new Lyra.Utilities.chainable();return this.next;};this.execute=function(){if(this.exec)this.exec();if(this.next)this.next.execute();};return;};this.chainBuffer=function(_a){this._vals=new Array();this._chain=new Lyra.Utilities.chainable();for(var _i=0;_i<_a.length;_i++){this._vals.push(_a[_i]);}
this.push=function(_v){this._vals.push(_v);};this.pop=function(_v){var _found=false;for(var _i=0;_i<this._vals.length;_i++){if(this._vals[_i]==_v){this._vals.splice(_i,1);_found=true;}}
if(this._vals.length==0&&_found){this._chain.execute();}};this.chain=function(_v){this._chain.chain(_v);};}
this.getBrowser=function(){with(navigator.userAgent){if(indexOf("Firefox")!=-1)return"firefox";if(indexOf("Safari")!=-1)return"safari";}
return"ie";};this.getElementPosition=function(_e){var _x=0;var _y=0;if(_e.offsetParent){_x=_e.offsetLeft;_y=_e.offsetTop;_e=_e.offsetParent
while(_e.offsetParent){_x+=_e.offsetLeft;_y+=_e.offsetTop;_e=_e.offsetParent}}
return[_x,_y];};this.removeElementChildren=function(_e){while(_e!=undefined&&_e.childNodes.length){_e.removeChild(_e.childNodes[0]);}}
this.getParentByTagName=function(_e,_n){if(_e.tagName==_n){return _e;}else{if(_e.parentNode!=null)return this.getParentByTagName(_e.parentNode,_n);else return null;}};this.replaceAllEntities=function(_t){return _t.replace(new RegExp("&[^;]+;","gi"),this.getEntityCharacter);}
this.getEntityCharacter=function(_v){_v=_v.replace(/[&;]+/g,"");return{quot:'"',apos:"'",amp:'&',lt:'<',gt:'>',nbsp:' ',raquo:'&raquo;',laquo:'&laquo;'}[_v];}
this.encodeAsJSON=function(_o){return JSON.encode(_o);}
this.generateHandle=function(_v){this.uniqueNumber++;return(arguments.length==1?_v:'x')+'_auto'+this.uniqueNumber;}
this.areElementsOverlapping=function(_e1,_e2){var _size1=[_e1.offsetWidth,_e1.offsetHeight];var _size2=[_e2.offsetWidth,_e2.offsetHeight];_pos1=Lyra.Utilities.getElementPosition(_e1);_pos2=Lyra.Utilities.getElementPosition(_e2);var _horizontal_in=false;var _vertical_in=false;if((_pos1[0]+_size1[0]>=_pos2[0]&&_pos1[0]+_size1[0]<=_pos2[0]+_size2[0])||(_pos1[0]>=_pos2[0]&&_pos1[0]<=_pos2[0]+_size2[0])){_horizontal_in=true;}
if((_pos1[1]+_size1[1]>=_pos2[1]&&_pos1[1]+_size1[1]<=_pos2[1]+_size2[1])||(_pos1[1]>=_pos2[1]&&_pos1[1]<=_pos2[1]+_size2[1])){_vertical_in=true;}
if(_horizontal_in&&_vertical_in){return true;}
return false;}
this.hideElements=function(tagName,element){if(Lyra.Utilities.getBrowser()=="ie"){for(i=0;i<document.all.tags(tagName).length;i++){obj=document.all.tags(tagName)[i];if(obj==undefined){continue;}
if(Lyra.Utilities.areElementsOverlapping(obj,element)){obj.style.visibility="hidden";}}}
return;}
this.showElements=function(tagName){if(Lyra.Utilities.getBrowser()=="ie"){for(i=0;i<document.all.tags(tagName).length;i++){obj=document.all.tags(tagName)[i];if(obj==undefined){continue;}
obj.style.visibility="";}}
return;}
this.toggleSection=function(sectionName){var _header=document.getElementById(sectionName+"Header");var _image=document.getElementById(sectionName+"Image");var _enableToggle=false;var _displayValue='';if(_header!=undefined&&_image!=undefined){if(_image.src.search(/\/images\/item_closed.gif/i)>=0){_image.src='/images/item_open.gif';}else{_image.src='/images/item_closed.gif';_displayValue='none';}
for(var i=0;i<_header.parentNode.childNodes.length;i++){if(_header.parentNode.childNodes[i].id!=undefined&&_header.parentNode.childNodes[i].id.length>0){if(_header.parentNode.childNodes[i].id==sectionName+"Header"){_enableToggle=true;}else{_enableToggle=false;}}else if(_enableToggle&&_header.parentNode.childNodes[i].nodeName=="TR"){_header.parentNode.childNodes[i].style.display=_displayValue;}}}
return false;}};
Lyra.Events=new function(){this._events={};this._uid=0;this.create=function(_n){if(!this._events[_n])this._events[_n]={};if(_n=="onMouseMove"){if(Lyra.Utilities.getBrowser()!="ie"){document.addEventListener("onmousemove",this.fireMouseUpEvents,true);}
document.onmousemove=this.fireMouseMoveEvents;}else if(_n=="onMouseUp"){if(Lyra.Utilities.getBrowser()!="ie"){document.addEventListener("onmouseup",this.fireMouseUpEvents,true);}
document.onmouseup=this.fireMouseUpEvents;}
return;};this.destroy=function(_n,_i){if(arguments.length==1){this._events[_n]=null;}else{this._events[_n][_i]=null;}
if(_n=="onMouseMove"&&this._events[_n]==null){if(Lyra.Utilities.getBrowser()!="ie"){document.removeEventListener("onmousemove",this.fireMouseUpEvents,false);}
document.onmousemove=null;}else if(_n=="onMouseUp"&&this._events[_n]==null){if(Lyra.Utilities.getBrowser()!="ie"){document.removeEventListener("onmouseup",this.fireMouseUpEvents,false);}
document.onmouseup=null;}};this.listen=function(_n,_c){var _eventID="e"+(++this._uid);this.create(_n);this._events[_n][_eventID]=_c;return _eventID;};this.fire=function(_n,_p){if(!this._events[_n])return;var _args={};if(_p&&_p.args)_args=_p.args;if(_p&&_p.id){_args.originEvent={name:_n,id:_p.id};this._events[_n][_p.id](_args);}else{for(var _k in this._events[_n]){_args.originEvent={name:_n,id:_k};if(this._events[_n][_k])this._events[_n][_k](_args);}}
return;};this.fireMouseMoveEvents=function(_e){if(Lyra.Utilities.getBrowser()=="ie"){var _y=event.clientY+document.documentElement.scrollTop;var _x=event.clientX+document.documentElement.scrollLeft;}else{var _y=_e.pageY;var _x=_e.pageX;}
Lyra.Events.fire("onMouseMove",{args:{x:_x,y:_y}});return;};this.fireMouseUpEvents=function(){Lyra.Events.fire("onMouseUp");return;};};
Lyra.HTTP=new function(){this._requests=new Array();this._uid=1;this._requestChainBuffers=new Array();this.createRequestPath=function(_p,_a,_nc){var _args="";for(var _k in _a)_args+=_k+'='+escape(_a[_k])+'&';if(arguments.length==3&&_nc==true){_args+="nocache="+(new Date()).getTime().toString();}
if(_args!=''&&!_p.match(/\?/g))_args="?"+_args;else if(_args!=''&&_p.match(/\?/g))_args="&"+_args;return _p+_args;};this.request=function(_p,_a,_c,_b){var _rid="rk"+(++this._uid);if(window.XMLHttpRequest)this._requests[_rid]=new XMLHttpRequest();else if(window.ActiveXObject)this._requests[_rid]=new ActiveXObject('MSXML2.XMLHTTP.3.0');else return-1;var _requestPath=this.createRequestPath(_p,_a,true);Lyra.Debug.write("Request sent ("+_rid+"):",_requestPath);this._requests[_rid].open("GET",this.createRequestPath(_p,_a,true),true);this._requests[_rid].onreadystatechange=function(){if(Lyra.HTTP._requests[_rid].readyState==4){Lyra.Debug.write("Reponse to ("+_rid+"):",Lyra.HTTP._requests[_rid].responseText);if(_b||Lyra.HTTP.handleResponse(Lyra.HTTP._requests[_rid].responseText,_rid)){if(_c)_c(Lyra.HTTP._requests[_rid].responseText,_rid);}
Lyra.HTTP._requests[_rid]==null;}};this._requests[_rid].send(null);return _rid;};this.getRequestState=function(_rid){var _tempRequest=Lyra.HTTP._requests[_rid];if(!_tempRequest)return 4;else return _tempRequest.readyState;};this.handleResponse=function(_r,_rid){try{var temp=eval("("+_r+")");if(temp.RELOCATE){window.location=temp.RELOCATE;}
if(temp.MESSAGETYPE){Lyra.Config.getMessageCallback()(temp.MESSAGE,temp.MESSAGETYPE);}
for(var _i=0;_i<this._requestChainBuffers.length;_i++){this._requestChainBuffers[_i].pop(_rid);}}catch(_e){if(_r.length==0){return false;}else if(_r.search(/\<!--SignInForm--\>/)!=-1){window.location.reload();return false;}else if(_r.search(/\<!--PermissionError--\>/)!=-1){Lyra.Config.getMessageCallback()("Sorry, you don't have permission to do that.  Please check with an administrator if you think this is an error.","error");return false;}
Lyra.Config.getMessageCallback()("The server encountered an unexpected error while processing your request.  Please be assured that site administrators have been informed of the issue.","error");return false;}
return true;};this.waitForRequests=function(_a){var _temp=new Array();for(var _i=0;_i<_a.length;_i++){if(this.getRequestState(_a[_i])!=4){_temp.push(_a[_i]);}}
if(_temp.length==0)return null;var _last=this._requestChainBuffers.push(new Lyra.Utilities.chainBuffer(_temp));return this._requestChainBuffers[_last-1];};}
Lyra.Effects=new function(){this.Transitions=Fx.Transitions;this.style=function(_e,_p,_s){var c=new Lyra.Utilities.chainable();var fx=new Fx.Styles(_e,_p);fx.start(_s).chain(function(){c.execute();});return c;}
this.deleteRow=function(_e){var _index=_e.rowIndex;var _colspan=_e.cells.length;var _parent=_e.parentNode;var _newCell=document.createElement("TD");_newCell.setAttribute("colspan",_colspan);_newCell.style.height="23px";_parent.removeChild(_e);var _r=_parent.insertRow(_index-1);var _c=_r.appendChild(_newCell);Lyra.Effects.style(_c,{duration:300,wait:false,transition:Lyra.Effects.Transitions.Quad.easeIn},{'height':0}).chain(function(){_parent.removeChild(_r);});};this.fadeOut=function(_e,_p){if(arguments.length==1){_p={'color':'#cccccc'};}
Lyra.Effects.style(_e,{duration:500,wait:false,transition:Lyra.Effects.Transitions.Quad.easeOut},_p);};this.fadeIn=function(_e,_p){if(arguments.length==1){_p={'color':'#000000'};}
Lyra.Effects.style(_e,{duration:500,wait:false,transition:Lyra.Effects.Transitions.Quad.easeOut},_p);};this.setOpacity=function(_e,_op){var s=_e.style;s.opacity=(_op/100);s.MozOpacity=(_op/100);s.KhtmlOpacity=(_op/100);s.filter="alpha(opacity="+_op+")";};}
Lyra.Debug=new function(){this.output=null;this.start=function(){this.output=document.createElement("DIV");document.getElementsByTagName("BODY")[0].appendChild(this.output);this.output.style.margin="5px";this.output.style.padding="5px";this.output.style.backgroundColor="#ffffff";this.write("Debug","This div contains debugging information");};this.write=function(title,data){if(!this.output)return;if(title&&title!=''){var div=document.createElement("DIV");var strong=document.createElement("STRONG");var content=document.createElement("DIV");content.innerHTML=data;strong.appendChild(document.createTextNode(title));div.appendChild(strong);div.appendChild(document.createElement("BR"));if(data&&data!='')div.appendChild(content);div.appendChild(document.createElement("BR"));this.output.appendChild(div);}};}
Lyra.Log=new function(){this.ERROR=0;this.GENERAL=1;this.write=function(_t,_n){alert(_n);}}
if(!Lyra.Layouts)Lyra.Layouts={};Lyra.Layouts.List=function(){this._ref=null;this._tbody=null;this._tfoot=null;this._blankRow=null;this._templates={};this._uid=Lyra.Utilities.generateHandle("grid");this._suppressStatus=false;this._useEffects=true;this._STATUS_NONE=0;this._STATUS_LOADING=1;this._TEMPLATE_ITEM='Item';this._TEMPLATE_NOITEMS='NoItems';this.onItemInsert=null;this.init=function(ref){this._ref=ref;try{this._tbody=this._ref.getElementsByTagName("TBODY")[0];this._tfoot=this._ref.getElementsByTagName("TFOOT")[0];this.registerTemplate("Item",0);this.registerTemplate("NoItems",1);this._blankRow=document.createElement("TR");this._blankRow.appendChild(document.createElement("TD"));var colspan=0;var tdElements=this._tbody.getElementsByTagName("TR")[0].getElementsByTagName("TD");for(var i=0;i<tdElements.length;i++){if(tdElements[i].getAttribute('colspan')!=null){colspan+=tdElements[i].getAttribute('colspan')}else{colspan++;}}
this._blankRow.firstChild.setAttribute("colspan",colspan+1);}catch(e){Lyra.Log.write(Lyra.Log.ERROR,"Problem initializing list layout: "+e);}};this.newItemSet=function(_top,_handle){var _temp=new Lyra.Layouts.List.Dataset();_temp._tbody=this._tbody;_temp._blankRow=this._blankRow.cloneNode(true);_temp._templates=this._templates;_temp.setUID(this._uid);_temp._handle=_handle;_temp.enableEffects(this._useEffects);if(this.onItemInsert!=null)_temp.onItemInsert=this.onItemInsert;if(_top==true){Lyra.Events.listen("onRowSetUpdate"+this._uid,Lyra.Utilities.bind(_temp,"updateChildIndexes"));}
return _temp;};this.registerTemplate=function(_n,_e){if(typeof _e=="number"){this._templates[_n]=new Lyra.Template(this._tbody.getElementsByTagName("TR")[_e]);}else{this._templates[_n]=new Lyra.Template(_e);}
this._templates[_n].setDisplay("");};this.clearAll=function(){while(this._tbody.childNodes.length>0){this._tbody.removeChild(this._tbody.firstChild);}};this.suppressStatus=function(_b){if(_b)this.setStatus(this._STATUS_NONE);this._suppressStatus=_b;};this.setStatus=function(_s){if(this._suppressStatus)return;if(_s==this._STATUS_LOADING){setDisplay("containerloading","");}else if(_s==this._STATUS_NONE){setDisplay("containerloading","none");}};this.setTransitionEffects=function(_b){this._useEffects=_b;return;};};Lyra.Layouts.List.Dataset=function(){this.childNodes=new Array();this.parentNode=null;this.offsetParent=null;this.offsetHeight=0;this.rowIndex=0;this.tagName="ITEMSET";this._templates={};this._templateAliases={'Item':'Item','NoItems':'NoItems'};this._tbody=null;this._trueRowIndex=0;this._blankRow=null;this._uid="default";this._handle="";this._callbacks={};this._ignoreCallbacks=false;this._isSystemOperation=false;this._useEffects=true;this._enableDragSorting=false;this._dragSortingActive=true;this._level=-1;this._effectsDuration=300;this.enableEffects=function(_b){this._useEffects=_b;return;};this.setDragSortingEnabled=function(_b){this._enableDragSorting=_b;};this.setDragSortingActive=function(_b){if(this._enableDragSorting&&this._dragSortingActive!=_b){this._dragSortingActive=_b;for(var i=0;i<this.childNodes.length;i++){if(this.childNodes[i].tagName=='TR'){var _tempRef=this.childNodes[i].getElementsByTagName("TD")[0];if(_tempRef!=undefined&&_tempRef.childNodes.length>0&&(_tempRef.firstChild.className=="gridrow_grip"||_tempRef.firstChild.className=="gridrow_grip_disabled")){if(_b){_tempRef.firstChild.className="gridrow_grip";_tempRef.firstChild.onmousedown=new Function("this.parentClass('grid').onItemDrag(this);");}else{_tempRef.firstChild.className="gridrow_grip_disabled";_tempRef.firstChild.onmousedown=new Function("");}}}}}};this.registerTemplate=function(_n,_e){if(typeof _e=="number"){this._templates[_n]=new Lyra.Template(this._tbody.getElementsByTagName("TR")[_e]);}else{this._templates[_n]=new Lyra.Template(_e);}};this.setTemplateAlias=function(_t1,_t2){this._templateAliases[_t1]=_t2;};this.getTemplate=function(_n){return this._templates[_n];};this.registerCallback=function(_n,_c){this._callbacks[_n]=_c;return;};this.ignoreCallbacks=function(_b){this._ignoreCallbacks=_b;return;};this.setIsSystemOperation=function(_b){this._isSystemOperation=_b;return;};this.getHandle=function(){return this._handle;};this.getParentDisplay=function(){return this.parentNode;};this.setLevel=function(_l){this._level=_l;}
this.setContainer=function(_e){this._tbody=_e;};this.getContainer=function(){return this._tbody;};this.setUID=function(_uid){this._uid=_uid;};this.getItems=function(){return this.childNodes;};this.insertItem=function(_n,_d,_i){if(arguments.length==3){if(this._templateAliases[_n])_n=this._templateAliases[_n];var _params={type:'template',template:_n,data:_d};if(this._callbacks['onItemInsert']!=null&&!this._ignoreCallbacks){var _tempParams=this._callbacks['onItemInsert']({mode:'pre',type:_params.type,layer:this._handle,data:_params.data,template:_params.template,ref:null});for(var _k in _tempParams)_params[_k]=_tempParams[_k];}
var _e=this._templates[_params.template].getCopy(_params.data);var _newPosition=this._trueRowIndex+_i;var _transIndex=this.translateIndex(_i);}else{var _params={type:_n.tagName=='TR'?'node':'set',template:'',data:{}};if(this._callbacks['onItemInsert']!=null&&!this._ignoreCallbacks){var _tempParams=this._callbacks['onItemInsert']({mode:'pre',type:_params.type,layer:this._handle,data:_params.data,template:_params.template,ref:null});for(var _k in _tempParams)_params[_k]=_tempParams[_k];}
var _e=_n;var _newPosition=this._trueRowIndex+_d;var _transIndex=this.translateIndex(_d);}
if(_e.tagName=="TR"){var _trs=this._tbody.getElementsByTagName("TR");if(_newPosition<_trs.length){var _tempRef=this._tbody.insertBefore(_e,_trs[_newPosition]);}else{var _tempRef=this._tbody.appendChild(_e);}
this.childNodes.splice(_transIndex,0,_tempRef);if(this._enableDragSorting&&!this._isSystemOperation){var _td=_tempRef.getElementsByTagName("TD")[0];var _dragDiv=document.createElement("DIV");if(this._dragSortingActive){_dragDiv.className="gridrow_grip";_dragDiv.onmousedown=new Function("this.parentClass('grid').onItemDrag(this);");}else{_dragDiv.className="gridrow_grip_disabled";}
_td.insertBefore(_dragDiv,_td.firstChild);}
Lyra.ClassManager.parseNewNode(_tempRef);if(_tempRef.gridrow){_tempRef.gridrow.setLevel(this._level);}}else{_e.parentNode=this;_e.setLevel(this._level+1);this.childNodes.splice(_transIndex,0,_e);var _tempRef=this.childNodes[_transIndex];}
if(this._callbacks['onItemInsert']!=null&&!this._ignoreCallbacks){this._callbacks['onItemInsert']({mode:'post',type:_params.type,layer:this._handle,data:_params.data,template:_params.template,ref:_tempRef});}
Lyra.Events.fire("onRowSetUpdate"+this._uid);return this.childNodes[_transIndex];};this.appendItem=function(_n,_d){if(arguments.length==2){return this.insertItem(_n,_d,this.getTrueSize());}else{return this.insertItem(_n,this.getTrueSize());}};this.prependItem=function(_n,_d){if(arguments.length==2){return this.insertItem(_n,_d,0);}else{return this.insertItem(_n,0);}};this.removeItem=function(_n){if(typeof _n=="number"){var _e=this.getElementsByTagName("TR")[_n];}else{var _e=_n;}
var _position=this.translateIndex(_n);var _colspan=_e.cells.length;var _oldHeight=_e.offsetHeight;var _newCell=document.createElement("TD");_newCell.setAttribute("colspan",_colspan);_newCell.style.height=_oldHeight+"px";this.removeChild(_e);this._ignoreCallbacks=true;this._isSystemOperation=true;var _r=document.createElement("TR");var _c=_r.appendChild(_newCell);this.insertItem(_r,_position);this._ignoreCallbacks=false;this._isSystemOperation=false;if(this._useEffects){var _externRemoveChild=Lyra.Utilities.bind(this,"removeChild");var _externRowSet=this;var _externChain=new Lyra.Utilities.chainable();Lyra.Effects.style(_c,{duration:this._effectsDuration,wait:false,transition:Lyra.Effects.Transitions.Quad.easeIn},{'height':0}).chain(function(){_externRemoveChild(_r);Lyra.Events.fire("onRowSetUpdate"+_externRowSet._uid);_externChain.execute();});return _externChain;}else{this.removeChild(_r);Lyra.Events.fire("onRowSetUpdate"+this._uid);return null;}};this.replaceItem=function(_n1,_d,_n2){if(arguments.length==3){if(this._templateAliases[_n1])_n1=this._templateAliases[_n1];var _params={type:'template',template:_n1,data:_d};if(this._callbacks['onItemInsert']!=null&&!this._ignoreCallbacks){var _tempParams=this._callbacks['onItemInsert']({mode:'pre',type:_params.type,layer:this._handle,data:_params.data,template:_params.template,ref:null});for(var _k in _tempParams)_params[_k]=_tempParams[_k];}
try{var _newNode=this._templates[_n1].getCopy(_d);var _oldNode=_n2;}catch(e){Lyra.Log.write(Lyra.Log.ERROR,"Unable to find or use template '"+_n1+"': "+e);}}else{var _params={type:'node',template:'',data:{}};if(this._callbacks['onItemInsert']!=null&&!this._ignoreCallbacks){var _tempParams=this._callbacks['onItemInsert']({mode:'pre',type:_params.type,layer:this._handle,data:_params.data,template:_params.template,ref:null});for(var _k in _tempParams)_params[_k]=_tempParams[_k];}
var _newNode=_n1;var _oldNode=_d;}
if(typeof _oldNode=="number"){_oldNode=this.childNodes[this.translateIndex(_oldNode)];}
var _tempRef=this.insertBefore(_newNode,_oldNode);if(this._enableDragSorting&&!this._isSystemOperation){var _td=_tempRef.getElementsByTagName("TD")[0];var _dragDiv=document.createElement("DIV");_dragDiv.className="gridrow_grip";_dragDiv.onmousedown=new Function("this.parentClass('grid').onItemDrag(this);");_td.insertBefore(_dragDiv,_td.firstChild);}
Lyra.ClassManager.parseNewNode(_tempRef);if(this._callbacks['onItemInsert']!=null&&!this._ignoreCallbacks){this._callbacks['onItemInsert']({mode:'post',type:_params.type,layer:this._handle,data:_params.data,template:_params.template,ref:_tempRef});}
this.removeChild(_oldNode);return _tempRef;};this.replaceAllItems=function(_n,_d){if(arguments.length==2){if(_d.length){var _externBlankRow=this.clear(0,this.childNodes.length);var _externRowSet=this;if(this._useEffects){Lyra.Effects.style(_externBlankRow.firstChild,{duration:this._effectsDuration,wait:false,transition:Lyra.Effects.Transitions.Quad.easeOut},{'height':_d.length*23}).chain(function(){_externRowSet.removeChild(_externBlankRow);for(var _i=0;_i<_d.length;_i++){_externRowSet.insertItem(_n,_d[_i],_i);}});}else{this.removeChild(_externBlankRow);for(var _i=0;_i<_d.length;_i++){this.insertItem(_n,_d[_i],_i);}}}else{var _externBlankRow=this.clear(0,0);var _externRowSet=this;if(this._useEffects){Lyra.Effects.style(_externBlankRow.firstChild,{duration:this._effectsDuration,wait:false,transition:Lyra.Effects.Transitions.Quad.easeOut},{'height':55}).chain(function(){var _tempRef=_externRowSet.replaceItem(_n,_d,_externBlankRow);});}else{var _tempRef=this.replaceItem(_n,_d,_externBlankRow);}}}else{var _externBlankRow=this.clear(0,0);var _externRowSet=this;if(this._useEffects){Lyra.Effects.style(_externBlankRow.firstChild,{duration:this._effectsDuration,wait:false,transition:Lyra.Effects.Transitions.Quad.easeOut},{'height':23}).chain(function(){_externRowSet.replaceItem(_n,_externBlankRow);});}else{this.replaceItem(_n,_externBlankRow);}}};this.updateItem=function(_n,_d){if(typeof _n!="number"){_n=this.findChildIndex(_n);}
var _thisRow=this.getElementsByTagName("TR")[_n].gridrow;if(_d.ISACTIVE!=undefined){if(_d.ISACTIVE){_thisRow.activate();}else{_thisRow.deactivate();}}};this.removeChild=function(_n){if(typeof _n=="number"){var _tempIndex=this.translateIndex(_n);this._tbody.removeChild(this.childNodes[_tempIndex]);this.childNodes.splice(_tempIndex,1);}else{this.childNodes.splice(this.findChildIndex(_n),1);if(_n.tagName=="TR"&&_n.parentNode!=null){_n.parentNode.removeChild(_n);}else if(_n.tagName=="ITEMSET"){var _tempItems=_n.getItems();while(_tempItems.length>0){_n.removeChild(_tempItems[0]);}}}};this.replaceChild=function(_n1,_n2){if(typeof _n2=="number"){alert("Using an index as the second parameter isn't implemented yet.");}else{var _i=this.findChildIndex(_n2);var _oldIndex=_n2.rowIndex-1;this._tbody.replaceChild(_n1,_n2);var _n=this._tbody.getElementsByTagName("TR")[_oldIndex];this.childNodes[_i]=_n;}};this.insertBefore=function(_n1,_n2){if(_n2.parentNode==null)return null;if(_n1.tagName=="TR"&&_n2.tagName=="TR"){this.childNodes.splice(this.findChildIndex(_n2),0,_n1);var _tempRef=this._tbody.insertBefore(_n1,_n2);Lyra.ClassManager.parseNewNode(_tempRef);if(_tempRef.gridrow){_tempRef.gridrow.setLevel(this._level);}
Lyra.Events.fire("onRowSetUpdate"+this._uid);}else{alert("INSERT BEFORE NOT IMPLEMENTED FOR ROWSET");}
return _tempRef;};this.getElementsByTagName=function(_n){var _temp=new Array();for(var _i=0;_i<this.childNodes.length;_i++){if(this.childNodes[_i].tagName==_n)_temp.push(this.childNodes[_i]);}
return _temp;};this.getTrueSize=function(){var _c=0;for(var _i=0;_i<this.childNodes.length;_i++){if(this.childNodes[_i].tagName=="TR")_c++;else _c+=this.childNodes[_i].getTrueSize();}
return _c;};this.findChildIndex=function(_e){if(_e.tagName!=undefined&&_e.tagName!='TR'&&_e.tagName!='ITEMSET'){_e=Lyra.Utilities.getParentByTagName(_e,'TR');}
for(var _i=0;_i<this.childNodes.length;_i++){if(this.childNodes[_i].tagName==_e.tagName&&this.childNodes[_i].rowIndex==_e.rowIndex){return _i;}}
return-1;};this.getIndexByNode=function(_e){var _tempIndex=this.findChildIndex(_e);var _diff=0;for(var _i=0;_i<_tempIndex;_i++){if(this.childNodes[_i].tagName=='ITEMSET'){_diff++;}}
return _tempIndex-_diff;};this.translateIndex=function(_n){var _c=-1;for(var _i=0;_i<this.childNodes.length;_i++){if(this.childNodes[_i].tagName=="TR")_c++;if(_c==_n)return _i;}
return this.childNodes.length;};this.getChildItem=function(_n){return this.childNodes[this.translateIndex(_n)];};this.updateChildIndexes=function(){var _c=0;for(var _i=0;_i<this.childNodes.length;_i++){if(this.childNodes[_i].tagName=="ITEMSET"){this.childNodes[_i]._trueRowIndex=_c+this._trueRowIndex;this.childNodes[_i].rowIndex=_c+this._trueRowIndex;this.childNodes[_i].updateChildIndexes();_c+=this.childNodes[_i].getTrueSize();}else{++_c;}}};this.clear=function(_s,_r){this._ignoreCallbacks=true;this._isSystemOperation=true;if(_s==0&&_r==0){var _newBlankRow=this.appendItem(this._blankRow.cloneNode(true));_s=0;_r=this.childNodes.length-1;}else{if((_s+_r)<this.getElementsByTagName("TR").length){var _newBlankRow=this.insertBefore(this._blankRow.cloneNode(true),this.getElementsByTagName("TR")[_s+_r]);}else{var _newBlankRow=this.appendItem(this._blankRow.cloneNode(true));}}
this._ignoreCallbacks=false;this._isSystemOperation=false;var _h=0;for(var _i=0;_i<_r;_i++){var _nodeType=this.childNodes[_s].nodeType;var _nodeHeight=this.childNodes[_s].offsetHeight;this.removeChild(this.childNodes[_s]);if(_nodeType==1&&_nodeHeight){_h+=_nodeHeight;_newBlankRow.firstChild.style.height=_h+"px";}}
Lyra.Events.fire("onRowSetUpdate"+this._uid);return _newBlankRow;};this.isHidden=function(){if(this.getTrueSize()==0)return true;else return false;}
this.onItemDrag=function(_e,_d){var _rowHeight;var _rowLevel=this._level==-1?0:this._level;this._documentBody=document.getElementsByTagName('BODY')[0];_e=_e.parentClass("gridrow")._ref;_rowHeight=_e.offsetHeight;var _displayValue=_e.gridrow.getDragDisplay();this._dragRowBufferHomeIndex=this.getIndexByNode(_e);this._dragRowBufferOriginalIndex=this.getIndexByNode(_e);this._dragRowDataBuffer=_d.getData()[this._dragRowBufferHomeIndex];this._dataset=_d;var _tempBlankRow=this._blankRow.cloneNode(true);_tempBlankRow.firstChild.style.height=_rowHeight+"px";this._isSystemOperation=true;this.replaceChild(_tempBlankRow,_e);this._isSystemOperation=false;var _startPosition=Lyra.Utilities.getElementPosition(_tempBlankRow);this._dragRowContainer=document.createElement("DIV");this._dragRowContainer.rowHeight=_rowHeight;this._dragRowContainer.className="gridrow_drag_container";this._dragRowContainer.style.top=_startPosition[1]-3+"px";this._dragRowContainer.style.left=_startPosition[0]-8+(_rowLevel*25)+"px";var _dragRowDisplay=document.createElement("DIV");_dragRowDisplay.className="gridrow_drag_display";_dragRowDisplay.appendChild(document.createTextNode(_displayValue));var _dragRowArrow=document.createElement("DIV");_dragRowArrow.className="gridrow_drag_arrow";this._dragRowContainer.appendChild(_dragRowDisplay);this._dragRowContainer.appendChild(_dragRowArrow);this._documentBody.appendChild(this._dragRowContainer);Lyra.Events.listen("onMouseUp",Lyra.Utilities.bind(this,'dropRow'));Lyra.Events.listen("onMouseMove",Lyra.Utilities.bind(this,'performDrag'));};this.performDrag=function(_p){var i;var _rowTop;var _rowHeight;this._tbodyTop=Lyra.Utilities.getElementPosition(this._tbody)[1];var _rowIndex=-1;for(i=0;i<this._tbody.childNodes.length;i++){_rowTop=Lyra.Utilities.getElementPosition(this._tbody.childNodes[i])[1];if(_p.y<=_rowTop+this._tbody.childNodes[i].offsetHeight){_rowIndex=i;_rowHeight=this._tbody.childNodes[i].offsetHeight;break;}}
if(i>=this._tbody.childNodes.length){_rowIndex=this._tbody.childNodes.length;}
if(_rowIndex>=this._trueRowIndex&&_rowIndex<this._trueRowIndex+this.getTrueSize()){if(this._dragRowBufferHomeIndex==_rowIndex-this._trueRowIndex)return;if(_rowHeight>this._dragRowContainer.rowHeight&&_p.y>=_rowTop+this._dragRowContainer.rowHeight){return;}
var _e=this.getElementsByTagName("TR")[this._dragRowBufferHomeIndex];var _tempBlankRow=_e.cloneNode(true);this.removeChild(_e);this._isSystemOperation=true;if(_rowIndex==this.getTrueSize()+this._trueRowIndex){this.appendItem(_tempBlankRow);}else{var _o=this.getElementsByTagName("TR")[_rowIndex-this._trueRowIndex];this.insertBefore(_tempBlankRow,_o);}
this._isSystemOperation=false;if(this._dragRowBufferHomeIndex<_rowIndex){this._dragRowContainer.style.top=_rowTop-(this._dragRowContainer.rowHeight-_rowHeight)-2+"px";}else{this._dragRowContainer.style.top=_rowTop-2+"px";}
this._dragRowBufferHomeIndex=_rowIndex-this._trueRowIndex;}}
this.dropRow=function(_p){Lyra.Events.destroy(_p.originEvent.name,_p.originEvent.id);Lyra.Events.destroy("onMouseMove");this._dragRowContainer.parentNode.removeChild(this._dragRowContainer);var _e=this.getElementsByTagName("TR")[this._dragRowBufferHomeIndex];this.removeChild(_e);var _tempMovedID=this._dataset.getColumn(this._dragRowBufferOriginalIndex,this._dataset.getPrimaryKey());var _tempNewPos=this._dragRowBufferHomeIndex+1;this._dataset.moveRow(this._dragRowBufferOriginalIndex,this._dragRowBufferHomeIndex);this.insertItem('Item',this._dragRowDataBuffer,this._dragRowBufferHomeIndex);if(this._callbacks['onItemDrop']!=null&&!this._ignoreCallbacks){this._callbacks['onItemDrop']({mode:'post',type:'layer-self-self',layer:this._handle,id:_tempMovedID,position:_tempNewPos});}};};
if(!Lyra.Layouts)Lyra.Layouts={};Lyra.Layouts.Dialog=function(){this._title="";this._content="";this._dataSource="";this._dialog=null;this._width;this._height;this._isVisible=false;this._divStages=null;this._dataCache=null;this._ul=null;this.init=function(ref){};this.setTemplate=function(_t){this._template=new Lyra.Template(_t);};this.show=function(_d){this._isVisible=true;this._template.setValues(_d);this._dialog=this._template.getCopy();document.body.appendChild(this._dialog);this._dialog.style.display='block';var tempDivs=this._dialog.getElementsByTagName('div');for(var i=0;i<tempDivs.length;i++)
if(tempDivs[i].className=='stages')
this._divStages=tempDivs[i];this.getStages();};this.hide=function(){this._isVisible=true;document.body.removeChild(this._dialog);this._dialog=null;};this.setWidth=function(_w){if(typeof _w!='number')return;this._width=_w;this._dialog.style.width=_w+'px';};this.getWidth=function(){return this._width;};this.setHeight=function(_h){if(typeof _h!='number')return;this._height=_h;this._dialog.style.height=_h+'px';};this.getHeight=function(){return this._height;};this.setDataSource=function(_d){this._dataSource=_d;};this.getStages=function(){if(!this._isVisible)return;if(this._dataSource=="")return;Lyra.HTTP.request(this._dataSource,{},Lyra.Utilities.bind(this,"loadStages"));};this.loadStages=function(_json){if(!this._isVisible)return;var data=eval("("+_json+")");var len=data.arrStages.length;if(this._dataCache==null||len!=this._dataCache.arrStages.length){this._dataCache=data;if(len&&this._divStages){this._ul=document.createElement('ul');for(var i=0;i<len;i++){var li=document.createElement('li');li.className=data.arrStages[i].strStatus;li.innerHTML=data.arrStages[i].strTitle;this._ul.appendChild(li);}
Lyra.Utilities.removeElementChildren(this._divStages);this._divStages.appendChild(this._ul);}}else{for(var i=0;i<len;i++){this._ul.childNodes[i].className=data.arrStages[i].strStatus;}}
if(!data.blnIsComplete){this.getStages();}};};
function BasicGrid(){this._version=1;this._datasource="";this._recordsPerPage=null;this._primaryKey="";this._enableDragSorting=false;this._dataset=null;this._recordcount=0;this._currentPage=1;this._documentBody=document.getElementsByTagName("BODY")[0];this._tbody=null;this._tbodyTop=0;this._tfoot=null;this._templateRow=null;this._templateNoRows=null;this._columnCount=null;this._STATUS_NONE=0;this._STATUS_LOADING=1;this._dragRowBuffer=null;this._dragRowBufferHomeIndex=null;this._dragRowBufferOriginalIndex=null;this._dragRowDisplay=null;this.init=function(){this.appendModuleName("BasicGrid");this._tbody=this._ref.getElementsByTagName("TBODY")[0];this._tfoot=this._ref.getElementsByTagName("TFOOT")[0];this._templateRow=new Lyra.Template(this._tbody.getElementsByTagName("TR")[0]);this._templateNoRows=new Lyra.Template(this._tbody.getElementsByTagName("TR")[1]);this._templateRow.setDisplay("");this._templateNoRows.setDisplay("");this._blankRow=document.createElement("TR");this._blankRow.appendChild(document.createElement("TD"));var colspan=0;var tdElements=this._tbody.getElementsByTagName("TR")[0].getElementsByTagName("TD");for(var i=0;i<tdElements.length;i++){if(tdElements[i].getAttribute('colspan')!=null){colspan+=tdElements[i].getAttribute('colspan')}else{colspan++;}}
this._blankRow.firstChild.setAttribute("colspan",colspan+1);Lyra.Events.listen("onLoad",Lyra.Utilities.bind(this,"reload"));return;};this.reload=function(){this.setStatus(this._STATUS_LOADING);this._tempArgs={};if(this._recordsPerPage!=null){this._tempArgs.startRecord=((this._currentPage-1)*this._recordsPerPage)+1;this._tempArgs.maxRecords=this._recordsPerPage;}
Lyra.HTTP.request(this._datasource,this._tempArgs,Lyra.Utilities.bind(this,"update"));return;};this.send=function(_u,_a,_r){this.setStatus(this._STATUS_LOADING);if(arguments.length==3&&!_r){var _externSetStatus=Lyra.Utilities.bind(this,"setStatus");var _externStatusNone=this._STATUS_NONE;Lyra.HTTP.request(_u,_a,function(){_externSetStatus(_externStatusNone);});}
if(arguments.length==2||(arguments.length==3&&_r)){Lyra.HTTP.request(_u,_a,Lyra.Utilities.bind(this,"reload"));}
return;};this.update=function(_d){var _tempData=eval("("+_d+")");if(_tempData.RECORDCOUNT==0){var _externBlankRow=this.clear();var _externTBody=this._tbody;var _externTemplateNoRows=this._templateNoRows;Lyra.Effects.style(_externBlankRow.firstChild,{duration:300,wait:false,transition:Lyra.Effects.Transitions.Quad.easeOut},{'height':55}).chain(function(){_externBlankRow.parentNode.removeChild(_externBlankRow);_externTBody.appendChild(_externTemplateNoRows.getCopy());});this._dataset=new Lyra.Dataset(_tempData.DATA);}else{var _merge=false;if(this._dataset!=null){if(_tempData.DATA.length<=30&&this._dataset.getRecordCount()<=30){var _diffs=this._dataset.merge(_tempData.DATA,this._primaryKey);if(_diffs.rem.length<=3&&_diffs.add.length<=3){_merge=true;}}}
this._dataset=new Lyra.Dataset(_tempData.DATA);this._recordcount=this._dataset.getRecordCount();if(_merge){for(var _i=0;_i<_diffs.mod.length;_i++){if(_diffs.mod[_i].changes.ISACTIVE||_diffs.mod[_i].changes.ISACTIVE==0){this.toggleRow(_diffs.mod[_i].index,_diffs.mod[_i].changes.ISACTIVE);}}
for(var _i=0;_i<_diffs.rem.length;_i++){this.removeRow(_diffs.rem[_i].index+_i);}
for(var _i=0;_i<_diffs.add.length;_i++){this.insertRow(_diffs.add[_i].index,_diffs.add[_i].data);}}else{var _externBlankRow=this.clear();var _externInsertRow=Lyra.Utilities.bind(this,"insertRow");Lyra.Effects.style(_externBlankRow.firstChild,{duration:300,wait:false,transition:Lyra.Effects.Transitions.Quad.easeOut},{'height':_tempData.DATA.length*23}).chain(function(){_externBlankRow.parentNode.removeChild(_externBlankRow);var _newRows=_tempData.DATA;for(var _i=0;_i<_newRows.length;_i++){_externInsertRow(_i,_newRows[_i]);}});}}
if(this._recordsPerPage!=null){var _buttons=this._tfoot.getElementsByTagName("TD")[0].gridbuttons;if(_tempData.RECORDCOUNT<=this._recordsPerPage){_buttons.clear();}else{_buttons.set(this._currentPage,Math.ceil(_tempData.RECORDCOUNT/this._recordsPerPage));}}
this.setStatus(this._STATUS_NONE);};this.getVersionNumber=function(){return this._version;};this.setStatus=function(_s){if(_s==this._STATUS_LOADING){document.getElementById("containerloading").style.display="";}else if(_s==this._STATUS_NONE){document.getElementById("containerloading").style.display="none";}};this.clear=function(){var _newBlankRow=this._tbody.appendChild(this._blankRow.cloneNode(true));var _h=0;while(this._tbody.childNodes.length>1){var _nodeType=this._tbody.firstChild.nodeType;var _nodeHeight=this._tbody.firstChild.offsetHeight;this._tbody.removeChild(this._tbody.firstChild);if(_nodeType==1&&_nodeHeight){_h+=_nodeHeight;_newBlankRow.firstChild.style.height=_h+"px";}}
return _newBlankRow;};this.removeRow=function(_i){var _thisRow=this._tbody.getElementsByTagName("TR")[_i];Lyra.Effects.deleteRow(_thisRow);};this.insertRow=function(_i,_d){this._templateRow.setValues(_d);var _trs=this._tbody.getElementsByTagName("TR");if(_i<_trs.length){var _newRow=this._tbody.insertBefore(this._templateRow.getCopy(),_trs[_i]);}else{var _newRow=this._tbody.appendChild(this._templateRow.getCopy());}
if(this._enableDragSorting){var _td=_newRow.getElementsByTagName("TD")[0];var _dragDiv=document.createElement("DIV");_dragDiv.className="gridrow_grip";_dragDiv.onmousedown=new Function("this.parentClass('grid').dragRow(this);");_td.insertBefore(_dragDiv,_td.firstChild);}
Lyra.ClassManager.parseNewNode(_newRow);};this.toggleRow=function(_i,_s){var _thisRow=this._tbody.getElementsByTagName("TR")[_i].gridrow;if(_s){_thisRow.activate();}else{_thisRow.deactivate();}};this.getColumn=function(_i,_n){if(this._dataset){return this._dataset.getColumn(_i,_n);}
return"";};this.nextPage=function(){this._currentPage++;this.reload();return;};this.prevPage=function(){if(this._currentPage>1){this._currentPage--;this.reload();}
return;};this.goToPage=function(_n){if(_n>=1){this._currentPage=_n;this.reload();}
return;};this.dragRow=function(_e){var _rowHeight;_e=_e.parentClass("gridrow")._ref;_rowHeight=_e.offsetHeight;var _displayValue=_e.gridrow.getDragDisplay();this._dragRowBufferHomeIndex=_e.rowIndex-1;this._dragRowBufferOriginalIndex=_e.rowIndex-1;this._dragRowBuffer=this._dataset.getData()[this._dragRowBufferHomeIndex];var _tempBlankRow=this._blankRow.cloneNode(true);_tempBlankRow.firstChild.style.height=_rowHeight+"px";this._tbody.replaceChild(_tempBlankRow,_e);var _startPosition=Lyra.Utilities.getElementPosition(_tempBlankRow);this._dragRowContainer=document.createElement("DIV");this._dragRowContainer.rowHeight=_rowHeight;this._dragRowContainer.className="gridrow_drag_container";this._dragRowContainer.style.top=_startPosition[1]-3+"px";this._dragRowContainer.style.left=_startPosition[0]-8+"px";var _dragRowDisplay=document.createElement("DIV");_dragRowDisplay.className="gridrow_drag_display";_dragRowDisplay.appendChild(document.createTextNode(_displayValue));var _dragRowArrow=document.createElement("DIV");_dragRowArrow.className="gridrow_drag_arrow";this._dragRowContainer.appendChild(_dragRowDisplay);this._dragRowContainer.appendChild(_dragRowArrow);this._documentBody.appendChild(this._dragRowContainer);Lyra.Events.listen("onMouseUp",Lyra.Utilities.bind(this,'dropRow'));Lyra.Events.listen("onMouseMove",Lyra.Utilities.bind(this,'performDrag'));};this.performDrag=function(_p){var i;var _rowTop;var _rowHeight;this._tbodyTop=Lyra.Utilities.getElementPosition(this._tbody)[1];var _rowIndex=-1;for(i=0;i<this._tbody.childNodes.length;i++){_rowTop=Lyra.Utilities.getElementPosition(this._tbody.childNodes[i])[1];if(_p.y<=_rowTop+this._tbody.childNodes[i].offsetHeight){_rowIndex=i;_rowHeight=this._tbody.childNodes[i].offsetHeight;break;}}
if(i>=this._tbody.childNodes.length){_rowIndex=this._tbody.childNodes.length;}
if(_rowIndex>=0&&_rowIndex<this._dataset.getData().length){if(this._dragRowBufferHomeIndex==_rowIndex)return;if(_rowHeight>this._dragRowContainer.rowHeight&&_p.y>=_rowTop+this._dragRowContainer.rowHeight){return;}
var _e=this._tbody.getElementsByTagName("TR")[this._dragRowBufferHomeIndex];var _tempBlankRow=_e.cloneNode(true);this._tbody.removeChild(_e);if(_rowIndex==this._dataset.getRecordCount()-1){this._tbody.appendChild(_tempBlankRow);}else{var _o=this._tbody.getElementsByTagName("TR")[_rowIndex];this._tbody.insertBefore(_tempBlankRow,_o);}
if(this._dragRowBufferHomeIndex<_rowIndex){this._dragRowContainer.style.top=_rowTop-(this._dragRowContainer.rowHeight-_rowHeight)-2+"px";}else{this._dragRowContainer.style.top=_rowTop-2+"px";}
this._dragRowBufferHomeIndex=_rowIndex;}}
this.dropRow=function(_p){Lyra.Events.destroy(_p.originEvent.name,_p.originEvent.id);Lyra.Events.destroy("onMouseMove");this._dragRowContainer.parentNode.removeChild(this._dragRowContainer);var _e=this._tbody.getElementsByTagName("TR")[this._dragRowBufferHomeIndex];this._tbody.removeChild(_e);this._dataset.moveRow(this._dragRowBufferOriginalIndex,this._dragRowBufferHomeIndex);this.insertRow(this._dragRowBufferHomeIndex,this._dragRowBuffer);var _tempMovedID=this._dataset.getColumn(this._dragRowBufferOriginalIndex,this._primaryKey);var _tempNewPos=this._dragRowBufferHomeIndex+1;if(this.onRowDrop){this.onRowDrop(_tempMovedID,_tempNewPos);}};this.serializeDataset=function(_pk,_c){var _tempLength=this._dataset.getData().length;var _output={};for(var _i=0;_i<_tempLength;_i++){if(_c.length>1){var _tempCols=new Array();for(var _k=0;_k<_c.length;_k++){if(_c[_k]=="RelativeListPosition"){_tempCols.push(_i);}else{_tempCols.push(this._dataset.getColumn(_i,_c[_k]));}
_output[this._dataset.getColumn(_i,_pk)]=_tempCols;}}else{var _tempCols="";for(var _k=0;_k<_c.length;_k++){if(_c[_k]=="RelativeListPosition"){_tempCols=_i;}else{_tempCols=this._dataset.getColumn(_i,_c[_k]);}
_output[this._dataset.getColumn(_i,_pk)]=_tempCols;}}}
return Lyra.Utilities.encodeAsJSON(_output);}}
function gridrow(ref){this._textColorActive='#000000';this._textColorInactive='#cccccc';if(!gridrow._disableMouseover){ref.onmouseover=new Function("this.className='gridrow_hover';");ref.onmouseout=new Function("this.className='gridrow';");}
this.activate=function(){this.childClass("gridtoggle").activate();Lyra.Effects.fadeIn(this._ref,{color:this._textColorActive});};this.deactivate=function(){this.childClass("gridtoggle").deactivate();Lyra.Effects.fadeOut(this._ref,{color:this._textColorInactive});};this.getDragDisplay=function(){var _grid=this.parentClass('grid');if(_grid.getVersionNumber()>1){return _grid.getDataByNode(this._ref,[gridrow._dragDisplayColumn])[gridrow._dragDisplayColumn];}else{return this.parentClass("grid").getColumn(this._ref.rowIndex-1,gridrow._dragDisplayColumn);}};this.setLevel=function(_l){if(_l!=0){this._ref.getElementsByTagName("TD")[0].style.paddingLeft=(_l*25)+"px";}};}
gridrow._restrict={parents:["grid"]};function gridtoggle(ref){this.init=function(){var _grid=this.parentClass('grid');if(_grid==null){return;}else if(_grid.getVersionNumber()>1){var _state=_grid.getDataByNode(this._ref,['IsActive'])['IsActive'];if(_state==false){this._ref.getElementsByTagName("IMG")[0].src="/images/light_off.gif";this.parentClass('gridrow')._ref.style.color="#cccccc";}}else{var _row=this.parentClass('gridrow')._ref.rowIndex;if(this.parentClass('grid')!=null&&!this.parentClass('grid').getColumn(_row-1,"isactive")){this._ref.getElementsByTagName("IMG")[0].src="/images/light_off.gif";this.parentClass('gridrow')._ref.style.color="#cccccc";}}};this.activate=function(){this._ref.getElementsByTagName("IMG")[0].src="/images/light_on.gif";};this.deactivate=function(){this._ref.getElementsByTagName("IMG")[0].src="/images/light_off.gif";};}
function gridbuttons(ref){this.clear=function(){while(this._ref.hasChildNodes()){this._ref.removeChild(this._ref.firstChild);}};this.set=function(_n,_t){var _tempLink=document.createElement("A");_tempLink.setAttribute("href","##");var _tempPage=null;var _tempSpan=document.createElement("SPAN");_tempSpan.setAttribute("class","gridpages");var _bttn1_off=this.newButton("/images/page_first_off.gif","First Page",false);var _bttn2_off=this.newButton("/images/page_previous_off.gif","Previous Page",false);var _bttn1_on=this.newButton("/images/page_first.gif","First Page",true,"this.parentNode.parentClass('grid').goToPage(1); return false;");var _bttn2_on=this.newButton("/images/page_previous.gif","Previous Page",true,"this.parentNode.parentClass('grid').prevPage(); return false;");var _bttn3_off=this.newButton("/images/page_next_off.gif","Next Page",false);var _bttn4_off=this.newButton("/images/page_last_off.gif","Last Page",false);var _bttn3_on=this.newButton("/images/page_next.gif","Next Page",true,"this.parentNode.parentClass('grid').nextPage(); return false;");var _bttn4_on=this.newButton("/images/page_last.gif","Last Page",true,"this.parentNode.parentClass('grid').goToPage("+_t+"); return false;");this.clear();var _nw=10;var _rpp=this.parentClass('grid')._recordsPerPage;var _tp=_t;var _sp=_n-Math.floor(_nw/2);if(_sp<=0)_sp=1;var _ep=_sp+_nw;if(_ep>_tp){_ep=_tp;_sp=_ep-_nw;if(_sp<=0)_sp=1;}
if(_n==1){this._ref.appendChild(_bttn1_off);this._ref.appendChild(_bttn2_off);}else{this._ref.appendChild(_bttn1_on);this._ref.appendChild(_bttn2_on);}
for(var _i=_sp;_i<=_ep;_i++){_tempPage=_tempLink.cloneNode(true);_tempPage.onclick=new Function("this.parentNode.parentNode.parentClass('grid').goToPage("+_i+"); return false;");if(_i==_n){_tempPage.style.textDecoration="underline";}
_tempPage.appendChild(document.createTextNode(_i));_tempSpan.appendChild(_tempPage);}
this._ref.appendChild(_tempSpan);if(_n==_t){this._ref.appendChild(_bttn3_off);this._ref.appendChild(_bttn4_off);}else{this._ref.appendChild(_bttn3_on);this._ref.appendChild(_bttn4_on);}};this.newButton=function(_s,_a,_l,_e){var _tempImage=document.createElement("IMG");_tempImage.setAttribute("width",16);_tempImage.setAttribute("height",16);_tempImage.src=_s;_tempImage.alt=_a;_tempImage.title=_a;if(_l){var _tempLink=document.createElement("A");_tempLink.setAttribute("href","#");_tempLink.onclick=new Function(_e);_tempLink.appendChild(_tempImage);return _tempLink;}else{return _tempImage;}};}
gridbuttons._restrict={parents:["grid"]};
function DataGrid(){this._version=2;this._datasource="";this._recordsPerPage=null;this._recordcount=0;this._currentPage=1;this._primaryKey="";this._layout=null;this._groups={};this._layers={};this._layerChainBuffers=new Array();this._pageButtons=null;this._loadOnInit=true;this._enableDragSorting=false;this._dragSortingActive=true;this._workingLayer=null;this._defaultLayerCacheTimeout=60;this.getVersionNumber=function(){return this._version;};this._filters=new Array();this._numFilters=0;this.addFilter=function(_f){this._filters[this._numFilters]=_f;this._numFilters++;};this.removeFilter=function(_pos){if(_pos<0||_pos>=this._numFilters)return;for(var _i=_pos;_i<this._numFilters-1;_i++){this._filters[_i]=this._filters[_numFilters];}
this._numFilters--;};this.init=function(){this.appendModuleName("DataGrid");this.setLayout(Lyra.Layouts.List);var _hLayer=this.createLayer('',{});if(this.onInit)this.onInit();this.getLayoutContext().clearAll();if(this._loadOnInit)Lyra.Events.listen("onLoad",Lyra.Utilities.bind(this,"reload"));if(this.onInitComplete)this.onInitComplete();};this.setDatasource=function(_n,_pk){this._datasource=_n;this._primaryKey=_pk;return;};this.getDatasource=function(){var ret=this._datasource;for(var _i=0;_i<this._numFilters;_i++){ret+="&"+this._filters[_i].getQueryString();}
return ret;}
this.setLoadOnInit=function(_b){this._loadOnInit=_b;return;};this.setDragSortingEnabled=function(_b){this._enableDragSorting=_b;return;};this.getDragSortingEnabled=function(){this._enableDragSorting=_b;return;};this.setDragSortingActive=function(_b){this._dragSortingActive=_b;return;};this.getDragSortingActive=function(){this._dragSortingActive=_b;return;};this.setLayout=function(_l){this._layout=new _l();this._layout.init(this._ref);return;};this.getLayoutContext=function(){return this._layout;};this.send=function(_u,_a,_r,_cb){this._layout.setStatus(this._layout._STATUS_LOADING);var _externLayout=this._layout;if(arguments.length==3&&!_r){var _rid=Lyra.HTTP.request(_u,_a,function(){_externLayout.setStatus(_externLayout._STATUS_NONE);});}
if(arguments.length==2||(arguments.length==3&&_r)){var _rid=Lyra.HTTP.request(_u,_a,Lyra.Utilities.bind(this,"reload"));}
return _rid;};this.reload=function(){this._layout.setStatus(this._layout._STATUS_LOADING);this._tempArgs={};if(this._recordsPerPage!=null){this._tempArgs.startRecord=((this._currentPage-1)*this._recordsPerPage)+1;this._tempArgs.maxRecords=this._recordsPerPage;}
for(var _i=0;_i<this._numFilters;_i++){if(!this._filters[_i].isDisabled()){var _fields=this._filters[_i].getFields();for(var _k in _fields){this._tempArgs[_k]=_fields[_k];}}}
var _hLayer=this.getLayerByPath(this._datasource,this._tempArgs);if(_hLayer==null){_hLayer=this.createLayer(this._datasource,this._tempArgs);}else{this.updateLayerData(_hLayer,true);}
var _externUpdate=Lyra.Utilities.bind(this,"update");this.waitForLayers([_hLayer]).chain(function(){_externUpdate(_hLayer);});return;};this.update=function(_hLayer){var _tempData=this._layers[_hLayer].data;var _tempParentID=_tempData.getParentID();var _parentDataset=this.findDataset(_tempParentID);var _parentDisplay=this._layers[_parentDataset].display;this.setWorkingLayer(this._layers[_hLayer]);_parentDisplay.ignoreCallbacks(true);_parentDisplay.setIsSystemOperation(true);if(this._layers[_hLayer].display.isHidden()){if(_parentDataset=='TOP'){_parentDisplay.appendItem(this._layers[_hLayer].display);}else if(_parentDataset!=null){var _tempPosition=this._layers[_parentDataset].data.findPosition(this._primaryKey,_tempParentID)+1;_parentDisplay.insertItem(this._layers[_hLayer].display,_tempPosition);}}
_parentDisplay.ignoreCallbacks(false);_parentDisplay.setIsSystemOperation(false);if(_tempData.getRecordCount()==0){var _params={template:this._layout._TEMPLATE_NOITEMS,data:_tempData};if(this.onLayerUpdate){var _tempParams=this.onLayerUpdate({mode:'pre',action:'update',handle:_hLayer,template:_params.template,data:_tempData});for(var _k in _tempParams)_params[_k]=_tempParams[_k];}
if(_params.template!=null){this._layers[_hLayer].display.replaceAllItems(_params.template,_params.data);}else{this.hideLayer(_hLayer);}}else{if(this.onLayerUpdate){var _tempParams=this.onLayerUpdate({mode:'pre',action:'update',handle:_hLayer,template:null,data:_tempData});}
var _merge=false;if(this._layers[_hLayer].oldData!=undefined&&this._layers[_hLayer].data!=null&&!this._layers[_hLayer].display.isHidden()){if(_tempData.getData().length<=30&&this._layers[_hLayer].oldData.getRecordCount()<=30){var _diffs=this._layers[_hLayer].oldData.merge(_tempData.getData(),this._layers[_hLayer].primaryKey);if(_diffs.rem.length<=3&&_diffs.add.length<=3){_merge=true;}}}
this._recordcount=_tempData.getRecordCount();if(_merge){for(var _i=0;_i<_diffs.mod.length;_i++){var _iSingleRecord=1;if(_diffs.mod[_i].changes.DATEMODIFIED!=undefined)
_iSingleRecord++;if(_diffs.mod[_i].changes.LOCALTIMESTAMP!=undefined)
_iSingleRecord++;if(_diffs.mod[_i].changecount==_iSingleRecord){if(_diffs.mod[_i].changes.ISACTIVE||_diffs.mod[_i].changes.ISACTIVE==0){this._layers[_hLayer].display.updateItem(_diffs.mod[_i].index,{ISACTIVE:_diffs.mod[_i].changes.ISACTIVE});}else{this._layers[_hLayer].display.replaceItem("Item",_diffs.mod[_i].alldata,_diffs.mod[_i].index);}}else{this._layers[_hLayer].display.replaceItem("Item",_diffs.mod[_i].alldata,_diffs.mod[_i].index);}}
for(var _i=0;_i<_diffs.rem.length;_i++){this._layers[_hLayer].display.removeItem(_diffs.rem[_i].index+_i);}
for(var _i=0;_i<_diffs.add.length;_i++){this._layers[_hLayer].display.insertItem(_params.template,_diffs.add[_i].data,_diffs.add[_i].index);}}else{this._layers[_hLayer].display.replaceAllItems("Item",_tempData.getData());}}
if(this._recordsPerPage!=null){var _buttons=this._layout._tfoot.getElementsByTagName("TD")[0].gridbuttons;if(this._recordcount<=this._recordsPerPage){_buttons.clear();}else{_buttons.set(this._currentPage,Math.ceil(this._recordcount/this._recordsPerPage));}}
if(this.onLayerUpdate)this.onLayerUpdate({mode:'post',action:'update',handle:_hLayer});this._layout.setStatus(this._layout._STATUS_NONE);};this.nextPage=function(){this._currentPage++;this.reload();return;};this.prevPage=function(){if(this._currentPage>1){this._currentPage--;this.reload();}
return;};this.goToPage=function(_n){if(_n>=1){this._currentPage=_n;this.reload();}
return;};this.getLayerContext=function(_h){if(!this._layers[_h])return null;return this._layers[_h];};this.createLayer=function(_u,_a){this._layout.setStatus(this._layout._STATUS_LOADING);if(!this._layers['TOP']){var _tempHandle='TOP';}else{var _tempHandle=Lyra.Utilities.generateHandle('ds');}
this._layers[_tempHandle]={};var _tempLayer=this._layers[_tempHandle];_tempLayer.display=this._layout.newItemSet(_tempHandle=='TOP'?true:false,_tempHandle);_tempLayer.display.setDragSortingEnabled(this._enableDragSorting);_tempLayer.display.setDragSortingActive(this._dragSortingActive);if(this.onItemInsert)_tempLayer.display.registerCallback('onItemInsert',Lyra.Utilities.bind(this,'onItemInsert'));if(this.onItemDrop)_tempLayer.display.registerCallback('onItemDrop',Lyra.Utilities.bind(this,'onItemDrop'));_tempLayer.data=new Lyra.Dataset([]);if(_u!=''){_tempLayer.path=Lyra.HTTP.createRequestPath(_u,_a,false);_tempLayer.rid=Lyra.HTTP.request(_u,_a,Lyra.Utilities.bind(this,"pushData"));}else{_tempLayer.path='';_tempLayer.rid=null;}
_tempLayer.primaryKey=this._primaryKey;_tempLayer.cacheExpires=null;_tempLayer.info={};return _tempHandle;};this.showLayer=function(_h){var _externUpdate=Lyra.Utilities.bind(this,"update");if(this.updateLayerData(_h,false)){this.waitForLayers([_h]).chain(function(){_externUpdate(_h);});}else{this.update(_h);}};this.hideLayer=function(_h){var _externLayer=this._layers[_h].display;var _externGrid=this;this._layers[_h].display.clear(0,0);if(this._layers[_h].display.getItems().length>0){var _tempChain=this._layers[_h].display.removeItem(0);if(_tempChain!=null){_tempChain.chain(function(){if(_externLayer.parentNode!=null){_externLayer.parentNode.removeChild(_externLayer);}
if(_externGrid.onLayerUpdate)_externGrid.onLayerUpdate({mode:'post',action:'remove',handle:_h});});}else{if(_externLayer.getParentDisplay()!=null){_externLayer.getParentDisplay().removeChild(_externLayer);}
if(_externGrid.onLayerUpdate)_externGrid.onLayerUpdate({mode:'post',action:'remove',handle:_h});}}else{if(_externLayer.getParentDisplay()!=null){_externLayer.getParentDisplay().removeChild(_externLayer);}
if(this.onLayerUpdate)this.onLayerUpdate({mode:'post',action:'remove',handle:_h});}}
this.updateLayerData=function(_h,_f){var _cLayout=this.getLayoutContext();var _cLayer=this.getLayerContext(_h);var _force=false;if(arguments.length==2&&_f)_force=true;if(_cLayer.path!=''&&(_cLayer.cacheExpires==null||_cLayer.cacheExpires<(new Date())||_force)){_cLayout.setStatus(this._layout._STATUS_LOADING);_cLayer.rid=Lyra.HTTP.request(_cLayer.path,{},Lyra.Utilities.bind(this,"pushData"));return true;}else{return false;}};this.getBaseLayer=function(){return'TOP';};this.getLayerByPath=function(_u,_a){var _tempPath=Lyra.HTTP.createRequestPath(_u,_a,false);for(var _k in this._layers){if(this._layers[_k].path==_tempPath)return _k;}
return null;};this.getLayerByNode=function(_e){for(var _k in this._layers){if(this._layers[_k].display&&this._layers[_k].display.findChildIndex(_e)!=-1){return _k;};}
return null;};this.getLayerByKey=function(_pk,_v){for(var _k in this._layers){if(this._layers[_k].data&&this._layers[_k].data.findPosition(_pk,_v)!=null){return _k;};}
return null;}
this.getLayerByRID=function(_rid){for(var _k in this._layers){if(this._layers[_k].rid==_rid)return _k;}
return"";};this.getAllLayers=function(_h){var _exclude={};var _rtn=new Array();if(arguments.length==1){var _temp=(new Array(_h)).concat(this.getParentLayers(_h));for(var _i=0;_i<_temp.length;_i++)_exclude[_temp[_i]]=true;}
for(var _k in this._layers){if(!_exclude[_k])_rtn.push(_k);}
return _rtn;};this.getParentLayer=function(_h){var _cDisplay=this.getDisplayContext(_h);if(_cDisplay==null)return null;_cDisplay=_cDisplay.getParentDisplay();if(_cDisplay==null)return null;return _cDisplay.getHandle();};this.getParentLayers=function(_h){var _hParent=this.getParentLayer(_h);if(_hParent!=null){return(new Array(_hParent)).concat(this.getParentLayers(_hParent));}else{return(new Array());}};this.getSiblingLayers=function(_h){var _rtn=this.getChildLayers(this.getParentLayer(_h),false);if(_rtn==null)return null;for(var _i=0;_i<_rtn.length;_i++){if(_rtn[_i]==_h)_rtn.splice(_i,1);}
return _rtn;};this.getChildLayers=function(_h,_d){var _cDisplay=this.getDisplayContext(_h);if(_cDisplay==null)return null;var _children=_cDisplay.getItems();var _rtn=new Array();for(var _i=0;_i<_children.length;_i++){if(_children[_i].tagName=="ITEMSET"){_rtn.push(_children[_i].getHandle());if(arguments.length==2&&_d==true){_rtn=_rtn.concat(this.getChildLayers(_children[_i].getHandle(),true));}}}
return _rtn;};this.getVisibleLayers=function(_h){var _rtn=new Array();if(arguments.length==1){if(typeof _h=='object'){for(var _i=0;_i<_h.length;_i++){if(this.isLayerVisible(_h[_i]))_rtn.push(_h[_i]);}}else if(this.isLayerVisible(_h)){_rtn.push(_h);}}else{for(var _k in this._layers){if(this.isLayerVisible(_k)&&_k!=this.getBaseLayer())_rtn.push(_k);}}
return _rtn;};this.isLayerVisible=function(_h){return!this.isLayerHidden(_h);}
this.isLayerHidden=function(_h){if(!this._layers[_h])return true;if(!this._layers[_h].display||this._layers[_h].display.isHidden()){return true;}else{return false;}};this.isLayerLoading=function(_h){var _rid=this.getLayerContext(_h).rid;if(Lyra.HTTP.getRequestState(_rid)==4)return false;else return true;};this.setLayerDragSortingEnabled=function(_h,_b){var _cDisplay=this.getDisplayContext(_h);_cDisplay.setDragSortingEnabled(_b);};this.setLayerDragSortingActive=function(_h,_b){var _cDisplay=this.getDisplayContext(_h);_cDisplay.setDragSortingActive(_b);};this.setLayerInfo=function(_h,_i){var _tempInfo=this._layers[_h].info;for(var _k in _i){_tempInfo[_k]=_i[_k];}};this.getLayerInfo=function(_h){return this._layers[_h].info;};this.setWorkingLayer=function(_r){this._workingLayer=_r;return;};this.waitForLayers=function(_a){var _temp=new Array();for(var _i=0;_i<_a.length;_i++){if(this.isLayerLoading(_a[_i])){_temp.push(_a[_i]);}}
if(_temp.length==0)return null;var _last=this._layerChainBuffers.push(new Lyra.Utilities.chainBuffer(_temp));return this._layerChainBuffers[_last-1];};this.refreshLayer=function(_h){var _tempUpdate=Lyra.Utilities.bind(this,"update");this.updateLayerData(_h,true);this.waitForLayers([_h]).chain(function(){_tempUpdate(_h);});};this.setLayerCacheExpiration=function(_h,_d){if(arguments.length==1){var _now=new Date();this._layers[_h].cacheExpires=_now.setSeconds(_now.getSeconds()+this._defaultLayerCacheTimeout);}else{this._layers[_h].cacheExpires=_d;}};this.setLayerPrimaryKey=function(_h,_pk){this._layers[_h].primaryKey=_pk;this._layers[_h].data.setPrimaryKey(_pk);};this.getLayerPrimaryKey=function(_h){return this._layers[_h].primaryKey;};this.getLayerDataSerialized=function(_h,_c){var _cData=this.getDataContext(_h);var _tempData=_cData.query({},[this.getLayerPrimaryKey(_h)].concat(_c));var _output={};for(var _i=0;_i<_tempData.length;_i++){if(_c.length>1){var _tempCols=new Array();for(var _k=0;_k<_c.length;_k++){_tempCols.push(_tempData[_i][_c[_k]]);_output[_tempData[_i][this.getLayerPrimaryKey(_h)]]=_tempCols;}}else{var _tempCols="";for(var _k=0;_k<_c.length;_k++){_tempCols=_tempData[_i][_c[_k]];_output[_tempData[_i][this.getLayerPrimaryKey(_h)]]=_tempCols;}}}
return Lyra.Utilities.encodeAsJSON(_output);};this.getDisplayContext=function(_h){if(!this._layers[_h]||(this._layers[_h]&&!this._layers[_h].display))return null;return this._layers[_h].display;};this.getDataContext=function(_h){return this._layers[_h].data;};this.getGroupContext=function(_h){if(!this._groups[_h])return null;return this._groups[_h];};this.createGroup=function(_l){var _hGroup=Lyra.Utilities.generateHandle('lg');this._groups[_hGroup]={};this._groups[_hGroup].layers=new Array();for(var _i=0;_i<_l.length;_i++){if(typeof _l[_i]=='string'){this._groups[_hGroup].layers.push(_l[_i]);}else{this._groups[_hGroup].layers.push(this.createLayer(_l[_i]['path'],_l[_i]['arguments']));}}
return _hGroup;};this.getGroupByLayer=function(_h){for(var _k in this._groups){for(var _i=0;_i<this._groups[_k].layers.length;_i++){if(this._groups[_k].layers[_i]==_h)return _k;}};return null;};this.getParentGroup=function(_h){var _parentLayer=this.getParentLayer(this._groups[_h].layers[0]);return this.getGroupByLayer(_parentLayer);};this.getSiblingGroups=function(_h){var _checkLayer=this._groups[_h].layers[0];var _tempLayers=this.getSiblingLayers(_checkLayer);if(_tempLayers==null)return[];var _used={};_used[_h]=true;var _rtn=new Array();for(var _i=0;_i<_tempLayers.length;_i++){var _tempGroup=this.getGroupByLayer(_tempLayers[_i]);if(!_used[_tempGroup]){_rtn.push(_tempGroup);_used[_tempGroup]=true;}}
return _rtn;};this.showGroup=function(_h){var _externGrid=this;var _layersToWaitFor=new Array();var _cGroup=this.getGroupContext(_h);if(_cGroup!=null){for(var _i=0;_i<_cGroup.layers.length;_i++){if(this.updateLayerData(_cGroup.layers[_i])){_layersToWaitFor.push(_cGroup.layers[_i]);}}
if(_layersToWaitFor.length>0){this.waitForLayers(_layersToWaitFor).chain(function(){for(var _i=0;_i<_cGroup.layers.length;_i++){_externGrid.showLayer(_cGroup.layers[_i]);}});}else{for(var _i=0;_i<_cGroup.layers.length;_i++){this.showLayer(_cGroup.layers[_i]);}}}
return;};this.hideGroup=function(_h){var _cGroup=this.getGroupContext(_h);if(_cGroup!=null){for(var _i=0;_i<_cGroup.layers.length;_i++){if(this.isLayerVisible(_cGroup.layers[_i]))this.hideLayer(_cGroup.layers[_i]);}}
return;};this.isGroupVisible=function(_h){var _cGroup=this.getGroupContext(_h);for(var _i=0;_i<_cGroup.layers.length;_i++){if(this.isLayerVisible(_cGroup.layers[_i]))return true;}
return false;};this.updateGroupData=function(_h){var _cGroup=this.getGroupContext(_h);if(_cGroup==null)return null;var _rtn=false;for(var _i=0;_i<_cGroup.layers.length;_i++){if(this.updateLayerData(_cGroup.layers[_i]))_rtn=true;}
return _rtn;};this.waitForGroup=function(_h){var _cGroup=this.getGroupContext(_h);if(_cGroup==null)return null;else return this.waitForLayers(_cGroup.layers);};this.pushData=function(_d,_rid){var _hTempLayer=this.getLayerByRID(_rid);var _tempLayer=this._layers[_hTempLayer];var _now=new Date();try{var _tempData=eval("("+_d+")");if(_tempLayer){if(_tempLayer.data){_tempLayer.oldData=_tempLayer.data;}
_tempLayer.data=new Lyra.Dataset(_tempData.DATA);_tempLayer.data.setRecordCount(_tempData.RECORDCOUNT);_tempLayer.data.setParentID(_tempData.PARENTID);_tempLayer.data.setPrimaryKey(_tempLayer.primaryKey);_tempLayer.cacheExpires=_now.setSeconds(_now.getSeconds()+this._defaultLayerCacheTimeout);}}catch(e){Lyra.Log.write(Lyra.Log.ERROR,"Error parsing JSON data: "+e);}
for(var _i=0;_i<this._layerChainBuffers.length;_i++){this._layerChainBuffers[_i].pop(_hTempLayer);}
this._layout.setStatus(this._layout._STATUS_NONE);};this.getItemByKey=function(_pk,_v){try{var _cLayer=this.getLayerContext(this.getLayerByKey(_pk,_v));var _pos=_cLayer.data.findPosition(_pk,_v);}catch(e){Lyra.Log.write(Lyra.Log.ERROR,"Unable to find a record in the dataset where '"+_pk+"' = '"+_v+"'.");}
return _cLayer.display.getChildItem(_pos);};this.getDataByNode=function(_e,_c){var _hLayer=this.getLayerByNode(_e);var _cLayerDisplay=this.getDisplayContext(_hLayer);var _cLayerData=this.getDataContext(_hLayer);var _tempIndex=_cLayerDisplay.getIndexByNode(_e);return _cLayerData.query({index:_tempIndex},_c)[0];};this.findDataset=function(_k){if(_k=='')return'TOP';for(var _i in this._layers){if(this._layers[_i]==null||!this._layers[_i].data)continue;var _tempPosition=this._layers[_i].data.findPosition(this._primaryKey,_k);if(_tempPosition!=null){return _i;break;}}
return'TOP';};this.getColumn=function(_i,_n){if(this._workingLayer){return this._workingLayer.data.getColumn(_i,_n);}
return"";};this.onItemDrag=function(_e){var _hLayer=this.getLayerByNode(_e);var _cDisplay=this.getDisplayContext(_hLayer);_cDisplay.onItemDrag(_e,this.getDataContext(_hLayer));};}
function FileBrowser(ref){this.DataGrid(ref);this._MODE_TREE='tree';this._MODE_FLAT='flat';this._TOOLBAR_ALWAYS='always';this._TOOLBAR_BOTTOM='bottom';this._TOOLBAR_NONE='none';this._FOLDER_OPEN='open';this._FOLDER_CLOSED='closed';this._FOLDER_UNKNOWN='unknown';this._toolbarState=this._TOOLBAR_ALWAYS;this._isAutoCloseEnabled=false;this._foldersDatasource='';this._foldersPrimaryKey='';this._foldersParentPrimaryKey='';this._filesDatasource='';this._filesPrimaryKey='';this._filesFolderPrimaryKey='';this._folderGroups={};this._firstFolderGroup=null;this._preloadedData={};this.start=function(){this.appendModuleName("FileBrowser");this.setLoadOnInit(false);var _cLayout=this.getLayoutContext();_cLayout.registerTemplate('Page',1);_cLayout.registerTemplate('NoFilesOrFolders',2);if(this._toolbarState!=this._TOOLBAR_NONE){_cLayout.registerTemplate('Tools',3);}
var _hGroup=this.newFolderGroup('');var _cbGroups=this.waitForGroup(_hGroup);if(_cbGroups==null){this.showGroup(_hGroup);}else{var _externGrid=this;_cbGroups.chain(function(){_externGrid.showGroup(_hGroup);});}
return;};this.newFolderGroup=function(_id){var _argFolderParent={};var _argFolder={};_argFolderParent[this._foldersParentPrimaryKey]=_id;_argFolder[this._foldersPrimaryKey]=_id;if(this._preloadedData[_id]&&this._preloadedData[_id]!=null){var _hFolders=this.createLayer('',null);var _hFiles=this.createLayer('',null);var _cFolderData=this.getDataContext(_hFolders);var _cFileData=this.getDataContext(_hFiles);_cFolderData.setData(this._preloadedData[_id]['folders'].DATA);_cFileData.setData(this._preloadedData[_id]['files'].DATA);_cFolderData.setParentID(this._preloadedData[_id]['files'].PARENTID);_cFileData.setParentID(this._preloadedData[_id]['files'].PARENTID);_cFolderData.setPrimaryKey(this._foldersPrimaryKey);_cFileData.setPrimaryKey(this._filesPrimaryKey);this.setLayerCacheExpiration(_hFolders);this.setLayerCacheExpiration(_hFiles);this._preloadedData[_id]=null;}else{var _hFolders=this.createLayer(this._foldersDatasource,_argFolderParent);var _hFiles=this.createLayer(this._filesDatasource,_argFolder);}
this.setLayerInfo(_hFolders,{type:'folder'});this.setLayerInfo(_hFiles,{type:'file'});this.setLayerPrimaryKey(_hFiles,this._filesPrimaryKey);this.setLayerPrimaryKey(_hFolders,this._foldersPrimaryKey);var _cLayout=this.getLayoutContext();var _cFiles=this.getDisplayContext(_hFiles);_cFiles.setTemplateAlias(_cLayout._TEMPLATE_ITEM,'Page');if(this._toolbarState!=this._TOOLBAR_NONE){var _hTools=this.createLayer('',{});this.setLayerDragSortingEnabled(_hTools,false);var _cTools=this.getDisplayContext(_hTools);_cTools.setTemplateAlias(_cLayout._TEMPLATE_ITEM,'Tools');var _cToolData=this.getDataContext(_hTools);var _cParentLayer=this.getLayerByKey(this._foldersPrimaryKey,_id);if(_cParentLayer!=null){var _cParentData=this.getDataContext(_cParentLayer).query(_argFolder);}else{var _cParentData=[_argFolder];}
_cToolData.setParentID(_id);_cToolData.setData(_cParentData);var _hGroup=this.createGroup([_hFolders,_hFiles,_hTools]);}else{var _hGroup=this.createGroup([_hFolders,_hFiles]);}
if(this._firstFolderGroup==null){this._firstFolderGroup=_hGroup;}
this._folderGroups[_id]=_hGroup;return _hGroup;};this.getFolderByGroup=function(_h){for(var _k in this._folderGroups){if(this._folderGroups[_k]==_h)return _k;}
return null;};this.setDisplayMode=function(_m){return;};this.setAutoClosePaths=function(_b){this._isAutoCloseEnabled=_b;return;};this.setAutoOpenPaths=function(_b,_p){Lyra.HTTP.request(_p,{},Lyra.Utilities.bind(this,'parseMultiPartResponse'));return;};this.setToolbar=function(_m){this._toolbarState=_m;return;};this.setFoldersDatasource=function(_p,_pk,_ppk){this._foldersDatasource=_p;this._foldersPrimaryKey=_pk;this._foldersParentPrimaryKey=_ppk;this.setDatasource(_p,_pk);return;};this.setFilesDatasource=function(_p,_pk,_fpk){this._filesDatasource=_p;this._filesPrimaryKey=_pk;this._filesFolderPrimaryKey=_fpk;return;};this.setSaveState=function(_b,_id){return;};this.setFolderSorting=function(_b){return;};this.setFileSorting=function(_b){return;};this.getFolderStatus=function(_id){if(this._folderGroups[_id]){var _hGroup=this._folderGroups[_id];if(this.isGroupVisible(_hGroup)){return this._FOLDER_OPEN;}else{return this._FOLDER_CLOSED;}}else{return this._FOLDER_UNKNOWN;}};this.openFolder=function(_id){if(this.getFolderStatus(_id)==this._FOLDER_CLOSED){var _hGroup=this._folderGroups[_id];}else{var _hGroup=this.newFolderGroup(_id);}
var _cbGroups=this.waitForGroup(_hGroup);var _icon='/images/folder_open.gif';if(this.onChooseFolderIcon)_icon=this.onChooseFolderIcon(this._FOLDER_OPEN,_hGroup);if(_cbGroups==null){this.showGroup(_hGroup);if(this._isAutoCloseEnabled)this.closeFolderSiblings(_id);this.getItemByKey(this._foldersPrimaryKey,_id).getElementsByTagName('IMG')[0].src=_icon;this.setParentGroupDragSortActive(_hGroup,false);this.setGroupDragSortActive(_hGroup,true);}else{var _externGrid=this;_cbGroups.chain(function(){_externGrid.showGroup(_hGroup);if(_externGrid._isAutoCloseEnabled)_externGrid.closeFolderSiblings(_id);_externGrid.getItemByKey(_externGrid._foldersPrimaryKey,_id).getElementsByTagName('IMG')[0].src=_icon;_externGrid.setParentGroupDragSortActive(_hGroup,false);_externGrid.setGroupDragSortActive(_hGroup,true);});}};this.closeFolder=function(_id){var _hGroup=this._folderGroups[_id];if(_hGroup!=null){this.hideGroup(_hGroup);var _icon='/images/folder.gif';if(this.onChooseFolderIcon)_icon=this.onChooseFolderIcon(this._FOLDER_CLOSED,_hGroup);this.getItemByKey(this._foldersPrimaryKey,_id).getElementsByTagName('IMG')[0].src=_icon;this.setParentGroupDragSortActive(_hGroup,true);}
return;};this.toggleFolder=function(_id){if(this.getFolderStatus(_id)==this._FOLDER_OPEN){this.closeFolder(_id);}else{this.openFolder(_id);};return;};this.closeFolderSiblings=function(_id){var _hGroup=this._folderGroups[_id];var _tempGroups=this.getSiblingGroups(_hGroup);for(var _i=0;_i<_tempGroups.length;_i++){this.closeFolder(this.getFolderByGroup(_tempGroups[_i]));}};this.refreshFolder=function(_id){return;};this.sendAndUpdateFolder=function(_id,_p,_a){var _rid=this.send(_p,_a,false);var _cbRequest=Lyra.HTTP.waitForRequests([_rid]);if(_cbRequest!=null){var _externGrid=this;var _hLayer=this.getLayerByKey(this._foldersPrimaryKey,_id);_cbRequest.chain(function(){_externGrid.refreshLayer(_hLayer);});}
return;};this.sendAndUpdateFile=function(_id,_p,_a){var _rid=this.send(_p,_a,false);var _cbRequest=Lyra.HTTP.waitForRequests([_rid]);if(_cbRequest!=null){var _externGrid=this;var _hLayer=this.getLayerByKey(this._filesPrimaryKey,_id);_cbRequest.chain(function(){_externGrid.refreshLayer(_hLayer);});}
return;};this.onLayerUpdate=function(_a){var _cLayout=this.getLayoutContext();if(_a.mode=='pre'&&_a.template==_cLayout._TEMPLATE_NOITEMS){return{template:null}}else{return{};}};this.setParentGroupDragSortActive=function(_h,_en){var _pGroup=this.getParentGroup(_h);this.setGroupDragSortActive(_pGroup,_en);};this.setGroupDragSortActive=function(_h,_en){if(_h!=null){var _cGroup=this.getGroupContext(_h);for(var _i=0;_i<_cGroup.layers.length;_i++){if(this.onDragSortStateChange){var _enable=this.onDragSortStateChange(_cGroup.layers[_i],_en);this.setLayerDragSortingActive(_cGroup.layers[_i],_enable);}else{this.setLayerDragSortingActive(_cGroup.layers[_i],_en);}}}};this.parseMultiPartResponse=function(_d){var _tempData=eval('('+_d+')');for(var i=0;i<_tempData.CHUNKS.length;i+=2){var _tempID=_tempData.CHUNKS[i].PARENTID;this._preloadedData[_tempID]={};this._preloadedData[_tempID]['folders']=_tempData.CHUNKS[i];this._preloadedData[_tempID]['files']=_tempData.CHUNKS[i+1];}
return;};this.onItemDrop=function(_a){if(this.getLayerInfo(_a.layer).type=='folder'){if(this.onFolderDrop)this.onFolderDrop(this.getLayerDataSerialized(_a.layer,['index']),_a);}else{if(this.onFileDrop)this.onFileDrop(this.getLayerDataSerialized(_a.layer,['index']),_a);}
};this.getPath=function(_key,_del,_id){var _return=_del;while(_id!=''){var _hDataset=this.findDataset(_id);if(_hDataset==undefined)break;var _dataset=this.getDataContext(_hDataset);if(_dataset==undefined)break;var _search={};_search[this._foldersPrimaryKey]=_id;var _searchResults=_dataset.query(_search,[_key]);_return=_del+_searchResults[0][_key]+_return;_id=_dataset.getParentID();}
return _return;};}
Lyra.Utilities.extend(FileBrowser,DataGrid);
function SearchBar(ref){this._fuseaction="";this._arguments={};this._searchVariable="";this._maxRecords=5;this._dataset=null;this._documentBody=document.getElementsByTagName("BODY")[0];this._templateRow=null;this._container=ref;this._inputbox=null;this._table=null;this._tbody=null;this._templateRow=null;this._templateNoRows=null;this._minLength=3;this._popupDelay=500;this._popupCloseDelay=2000;this._searchCriteria="";this._setResizeToInputField=true;this._lastReferenceKey="";this._callbacks={};this._STATUS_NONE=0;this._STATUS_LOADING=1;this.init=function(){this.appendModuleName("SearchBar");this._inputbox=this._container.getElementsByTagName("INPUT")[0];this._table=this._container.getElementsByTagName("TABLE")[0];this._tbody=this._table.getElementsByTagName("TBODY")[0];this._templateRow=new Lyra.Template(this._tbody.getElementsByTagName("TR")[0]);if(this._tbody.getElementsByTagName("TR").length>1){this._templateNoRows=new Lyra.Template(this._tbody.getElementsByTagName("TR")[1]);}
if(this._setResizeToInputField==true){Lyra.Events.listen("onLoad",Lyra.Utilities.bind(this,"setSize"));}
this._templateRow.setDisplay("");if(this._templateNoRows!=null){this._templateNoRows.setDisplay("");}
this.setEventHandlers();if(this._loadOnInit){Lyra.Events.listen("onLoad",Lyra.Utilities.bind(this,"reload"));}
return;};this.setDatasource=function(_f,_a,_s){this._fuseaction=_f;this._arguments=_a;this._searchVariable=_s;return;};this.setMinimumInputLength=function(_n){this._minLength=_n;return;};this.setMaxRecords=function(_n){this._maxRecords=_n;return;};this.setResizeToInputField=function(_n){this._setResizeToInputField=_n;return;};this.setPopupDelay=function(_n){this._popupDelay=_n;return;};this.getSearchValue=function(){return getFieldValue(this._inputbox.id);}
this.setSize=function(){$(this._table).setStyle("width",$(this._inputbox).getSize().size.x);}
this.setEventHandlers=function(){var _e=this._inputbox;var _externalSearchBar=this;_e.onblur=function(){_externalSearchBar.onblur();}
_e.onfocus=function(event){_externalSearchBar.onfocus();}
_e.onkeyup=function(){_externalSearchBar.onkeyup();}
return};this.onblur=function(){this._lockClosed=true;setTimeout(Lyra.Utilities.bind(this,"closePopup"),250);if(this._callbacks['onblur']!=null){this._callbacks['onblur']();}};this.onfocus=function(){this._lockClosed=false;this.openPopup();if(this._callbacks['onfocus']!=null){this._callbacks['onfocus']();}};this.onkeyup=function(){if(this._callbacks['onkeyup']!=null){this._callbacks['onkeyup'](this._searchCriteria!=this.getSearchValue());}
if(this._timer!==undefined&&this._timer!=null){clearTimeout(this._timer);}
this._timer=setTimeout(Lyra.Utilities.bind(this,"openPopup"),this._popupDelay);};this.openPopup=function(){if(this._dataset!=null&&this._dataset.getRecordCount()!=0){this.showPopup();}
this.reload();};this.showPopup=function(){if(this._lockClosed==undefined||!this._lockClosed){$(this._table).setStyle("display","");Lyra.Utilities.hideElements("SELECT",this._table);}}
this.closePopup=function(){$(this._table).setStyle("display","none");Lyra.Utilities.showElements("SELECT");}
this.registerCallback=function(_n,_c){this._callbacks[_n]=_c;return;};this.select=function(_e,_data){if(this._callbacks['onSelect']!=null){this._callbacks['onSelect'](_data);this._searchCriteria=this.getSearchValue();}};this.buildDatasource=function(_p,_a,_v){_a[this._searchVariable]=_v;return Lyra.HTTP.createRequestPath(_p,_a,true,_v);};this.reload=function(){if(this.getSearchValue().length>=this._minLength){this._datasource=this.buildDatasource(this._fuseaction,this._arguments,this.getSearchValue());this._tempArgs={};if(this._datasource.length!=0&&this._searchCriteria!=this.getSearchValue()){this.setStatus(this._STATUS_LOADING);this._searchCriteria=this.getSearchValue();this._lastReferenceKey=Lyra.HTTP.request(this._datasource,this._tempArgs,Lyra.Utilities.bind(this,"update"));}}
return;};this.send=function(_u,_a,_r){this.setStatus(this._STATUS_LOADING);if(arguments.length==3&&!_r){var _externSetStatus=Lyra.Utilities.bind(this,"setStatus");var _externStatusNone=this._STATUS_NONE;Lyra.HTTP.request(_u,_a,function(){_externSetStatus(_externStatusNone);});}
if(arguments.length==2||(arguments.length==3&&_r)){Lyra.HTTP.request(_u,_a,Lyra.Utilities.bind(this,"reload"));}
return;};this.update=function(_d,_id){if(this._lastReferenceKey==_id){var _tempData=eval("("+_d+")");if(_tempData.RECORDCOUNT==0){Lyra.Utilities.showElements("SELECT");this.clear();if(this._templateNoRows!=null){this._tbody.appendChild(this._templateNoRows.getCopy());Lyra.Utilities.hideElements("SELECT",this._table);this.showPopup();}else{this.closePopup();}
if(this._callbacks['onNoData']!=null){this._callbacks['onNoData']();this._searchCriteria=this.getSearchValue();}}else{Lyra.Utilities.showElements("SELECT");this._dataset=new Lyra.Dataset(_tempData.DATA);this._recordcount=this._dataset.getRecordCount();this.clear();var _newRows=_tempData.DATA;for(var _i=0;_i<_newRows.length&&(this._maxRecords==null||_i<this._maxRecords);_i++){this.insertRow(_i,_newRows[_i]);}
this.showPopup();if(this._recordcount==1&&this._callbacks['onOneEntry']!=null){this._callbacks['onOneEntry'](_newRows[0]);this._searchCriteria=this.getSearchValue();}else if(this._recordcount>1&&this._callbacks['onMultipleEntries']!=null){this._callbacks['onMultipleEntries']();this._searchCriteria=this.getSearchValue();}}
this.setStatus(this._STATUS_NONE);}};this.setStatus=function(_s){if(_s==this._STATUS_LOADING){document.getElementById("containerloading").style.display="";}else if(_s==this._STATUS_NONE){document.getElementById("containerloading").style.display="none";}};this.clear=function(){while(this._tbody.childNodes.length>0){this._tbody.removeChild(this._tbody.firstChild);}};this.removeRow=function(_i){var _thisRow=this._tbody.getElementsByTagName("TR")[_i];Lyra.Effects.deleteRow(_thisRow);};this.insertRow=function(_i,_d){var _externalThis=this;var _externalD=_d;this._templateRow.setValues(_d);var _trs=this._tbody.getElementsByTagName("TR");if(_i<_trs.length){var _newRow=this._tbody.insertBefore(this._templateRow.getCopy(),_trs[_i]);}else{var _newRow=this._tbody.appendChild(this._templateRow.getCopy());}
_newRow.onclick=function(){_externalThis.select(this,_externalD);}
Lyra.ClassManager.parseNewNode(_newRow);};this.getColumn=function(_i,_n){if(this._dataset){return this._dataset.getColumn(_i,_n);}
return"";};this.serializeDataset=function(_pk,_c){var _tempLength=this._dataset.getData().length;var _output={};for(var _i=0;_i<_tempLength;_i++){if(_c.length>1){var _tempCols=new Array();for(var _k=0;_k<_c.length;_k++){if(_c[_k]=="RelativeListPosition"){_tempCols.push(_i);}else{_tempCols.push(this._dataset.getColumn(_i,_c[_k]));}
_output[this._dataset.getColumn(_i,_pk)]=_tempCols;}}else{var _tempCols="";for(var _k=0;_k<_c.length;_k++){if(_c[_k]=="RelativeListPosition"){_tempCols=_i;}else{_tempCols=this._dataset.getColumn(_i,_c[_k]);}
_output[this._dataset.getColumn(_i,_pk)]=_tempCols;}}}
return Lyra.Utilities.encodeAsJSON(_output);};}
function Filter(){this._version=2;this._parent=null;this._fields={};this._numFields=0;this._disabled=false;this.init=function(_ref){this._parent=Lyra.ClassManager.getClassByName('grid');this._parent.addFilter(this);var _fields=this._ref.fields.value.split(',');for(var _i=0;_i<_fields.length;_i++){this.addField(_fields[_i]);if(this._ref[_fields[_i]].value.length)
this.setFieldVal(_fields[_i],this._ref[_fields[_i]].value);}};this.getVersionNumber=function(){return this._version;};this.getParent=function(){return this._parent;};this.addField=function(_f){if(this._fields.hasOwnProperty(_f))return false;this._fields[_f]="";this._numFields++;return true};this.removeField=function(_f){if(this._fields.hasOwnProperty(_f)){delete this._fields[_f];this._numFields--;}};this.getFields=function(){return this._fields;};this.getFieldVal=function(_f){var ret=null;if(this._fields.hasOwnProperty(_f)){ret=this._fields[_f];}
return ret;};this.setFieldVal=function(_f,_v){if(this._fields.hasOwnProperty(_f)){this._fields[_f]=_v;}};this.clear=function(){for(var _k in this._fields){this.removeField(_k);}
this._disabled=false;};this.empty=function(){return(this._numFields==0);};this.isDisabled=function(){return this._disabled;};this.setDisabled=function(_d){if(typeof _d=="boolean")this._disabled=_d;};}
var DEFAULT_CYCLE_DELAY=5000;var DEFAULT_CYCLE_MODE='linear';var DEFAULT_HEIGHT=400;var DEFAULT_THUMB_HEIGHT=100;var DEFAULT_THUMB_WIDTH=100;var DEFAULT_TRANSITION='fade';var DEFAULT_WIDTH=600;var SLIDESHOW_STATUS_LOADING=1;var SLIDESHOW_STATUS_INITIALIZED=2;var SLIDESHOW_STATUS_PAUSED=4;var VALID_TRANSITIONS=new Array("slide-left","slide-up","slide-right","slide-down","wipe-left","wipe-up","fade");function SlideShow(ref){this._version=2;this._dataSource="";this._status=0;this._width=DEFAULT_WIDTH;this._height=DEFAULT_HEIGHT;this._thumbWidth=DEFAULT_THUMB_WIDTH;this._thumbHeight=DEFAULT_THUMB_HEIGHT;this._enableAutoStart=false;this._enableEffects=false;this._enablePreload=true;this._data={};this._pages=new Array();this._numPages=0;this._curPage=null;this._curLayer=null;this._divDisplay=null;this._divCaption=null;this._divControls=null;this._divThumbnails=null;this._spanThumbnailsLoading=null;this._cycleMode=DEFAULT_CYCLE_MODE;this._cycleDelay=DEFAULT_CYCLE_DELAY;this._cycleInterval=null;this._isPaused=true;this._thumbLinks=new Array();this._thumbSrcs=new Array();this._thumbCbkCount=0;this._hasNumberButtons=false;this.notifyPause=function(s){};this.notifyResume=function(s){};this._pageStart=0;this._Page=function(){this._parent=null;this._offset=-1;this._next=null;this._prev=null;this._content="";this._url="";this._caption="";this._transition=DEFAULT_TRANSITION;this._cache=null;this._type="";this._thumbnail="";this._thumbWidth=DEFAULT_THUMB_WIDTH;this._thumbHeight=DEFAULT_THUMB_HEIGHT;this._website="";this._isTargetBlank=false;this.preload=function(){this._cache=this._parent._newLayer(this);}};this.init=function(){this._setStatus(SLIDESHOW_STATUS_LOADING);this.appendModuleName("SlideShow");this._getDivs();if(this.onInit)this.onInit();this._setDisplayDims();if(this._dataSource=="internal"){this.loadData(this._data);}else{this._getData();}
if(this._enableAutoStart==true)this._setCycleInterval();this._unsetStatus(SLIDESHOW_STATUS_LOADING);this._setStatus(SLIDESHOW_STATUS_INITIALIZED);if(this.onInitComplete)this.onInitComplete();};this._setStatus=function(_s){this._status=this._status|_s;};this._unsetStatus=function(_s){this._status=this._status&~_s;};this.hasStatus=function(_s){return this._status&_s;};this._toggleStatus=function(_s){this._status=this._status^_s;};this.pause=function(){if(!this.hasStatus(SLIDESHOW_STATUS_PAUSED)){this._setStatus(SLIDESHOW_STATUS_PAUSED);if(this._cycleInterval!=null){clearInterval(this._cycleInterval);}
this.notifyPause(this);}};this.resume=function(){if(this.hasStatus(SLIDESHOW_STATUS_PAUSED)){this._unsetStatus(SLIDESHOW_STATUS_PAUSED);this._setCycleInterval();this.notifyResume(this);}};this.toggle=function(){if(this.hasStatus(SLIDESHOW_STATUS_PAUSED)){this.resume();this.notifyResume(this);}else{this.pause();this.notifyPause(this);}};this.nextPage=function(){this._changePage(this._curPage._next);};this.prevPage=function(){this._changePage(this._curPage._prev);};this.gotoPage=function(_p){if(_p<0||_p>=this._numPages)return;this._changePage(this._pages[_p]);};this.getCurrentPage=function(){return this._curPage;};this.randomPage=function(){if(this._numPages==1)return;var randomNumber;do{randomNumber=Math.floor(Math.random()*this._numPages);}while(this._curPage==this._pages[randomNumber]);this._changePage(this._pages[randomNumber]);};this.loadData=function(_json){this._data=eval("("+_json+")");this._data=this._data.data;var len=this._data.length;if(len>0){for(var i=0;i<len;i++){var datum=this._data[i];if(datum){var content="";var url="";var page=new this._Page();if(datum.type){if(datum.type=="image"){var w=datum.width;var h=datum.height;if((datum.width>this._width&&datum.height>this._height&&datum.width>=datum.height)||datum.width>this._width){w=this._width;h=w*datum.height/datum.width;}else if(datum.height>this._height){h=this._height;w=h*datum.width/datum.height;}
if(datum.fncImageClick){content='<div class="image" style="width: '+this._width+'px; height: '+this._height+'px"><img class="clickable" src="'+datum.content+'" width="'+w+'" height="'+h+'" border="0" style="margin-top: '+((this._height-h)/2)+'px;" onClick="'+datum.fncImageClick+'"/></div>';}else{content='<div class="image" style="width: '+this._width+'px; height: '+this._height+'px"><img src="'+datum.content+'" width="'+w+'" height="'+h+'" border="0" style="margin-top: '+((this._height-h)/2)+'px;"/></div>';}
url=datum.content;}else if(datum.type="html"){content=datum.content;}
page._type=datum.type;}else{page._type="html";}
page._parent=this;page._content=content;page._url=url;if(datum.caption)page._caption=datum.caption;if(datum.transition)page._transition=datum.transition;if(datum.largeImage)page._largeImage=datum.largeImage;if(datum.largeImageWidth)page._largeImageWidth=datum.largeImageWidth;if(datum.largeImageHeight)page._largeImageHeight=datum.largeImageHeight;if(datum.thumbnail)page._thumbnail=datum.thumbnail;if(datum.thumbWidth)page._thumbWidth=datum.thumbWidth;if(datum.thumbHeight)page._thumbHeight=datum.thumbHeight;if(datum.website)page._website=datum.website;if(datum.isTargetBlank)page._isTargetBlank=datum.isTargetBlank;if(this._enablePreload)page.preload();this._addPage(page);}}}
if(this._cycleMode=="random"){var randomNumber=Math.floor(Math.random()*this._numPages);this._curPage=this._pages[randomNumber];}else{this._curPage=this._pages[this._pageStart];}
this._curLayer=this._newLayer(this._curPage);this._updateCaption(this._curPage._caption);$(this._curLayer).injectTop(this._divDisplay);this._generateNumberButtons(this._numPages);this.selectNumberButton(this._curPage._offset);this._generateThumbnails();};this._addPage=function(_p){if(this._numPages==0){_p._offset=0;_p._next=_p;_p._prev=_p;}else{_p._offset=this._numPages;_p._next=this._pages[0];_p._prev=this._pages[this._numPages-1];_p._prev._next=_p._next._prev=_p;}
this._pages.push(_p);this._numPages++;};this._getDivs=function(){this._divDisplay=$(this._ref).getElement('.display');this._divCaption=$(this._ref).getElement('.caption');this._divControls=$(this._ref).getElement('.controls');this._divThumbnails=$(this._ref).getElement('.thumbnails');if(this._divThumbnails)this._spanThumbnailsLoading=$(this._divThumbnails).getElement('span');};this._setDisplayDims=function(){this._divDisplay.style.width=this._width+"px";this._divDisplay.style.height=this._height+"px";};this._getData=function(){Lyra.HTTP.request(this._dataSource,{},Lyra.Utilities.bind(this,"loadData"));};this._updateCaption=function(_c){if(this._divCaption==null)return;if(_c=="")
this._divCaption.style.visibility="hidden";else
this._divCaption.style.visibility="visible";Lyra.Utilities.removeElementChildren(this._divCaption);var caption=document.createElement('span');caption.innerHTML=_c;this._divCaption.appendChild(caption);};this._newLayer=function(_p){if(_p.cache!=null)return _p.cache.cloneNode(true);var newLayer=document.createElement('div');newLayer.className="layer";newLayer.style.width=this._width+"px";newLayer.style.height=this._height+"px";newLayer.style.position="absolute";newLayer.style.top="0";newLayer.innerHTML=_p._content;return newLayer;};this._setCycleInterval=function(){if(this._cycleInterval!=null)
clearInterval(this._cycleInterval);if(this._cycleMode=="linear"){this._cycleInterval=setInterval(this.nextPage.bind(this),this._cycleDelay);}else if(this._cycleMode=="random"){this._cycleInterval=setInterval(this.randomPage.bind(this),this._cycleDelay);}
this._isPaused=false;};this._changePage=function(_p){if(this._curPage==_p)return;if(this.onChangePage)this.onChangePage();var newLayer=this._newLayer(_p);this._divDisplay.insertBefore(newLayer,this._curLayer);var transition;if(this._enableEffects){if(_p._transition=="random"){var randomNumber=Math.floor(Math.random()*VALID_TRANSITIONS.length);transition=VALID_TRANSITIONS[randomNumber];}else if(_p._transition=="default"){transition=DEFAULT_TRANSITION;}else{transition=_p._transition;}}else{transition="none";}
if(transition.indexOf("slide")==0){var fx=new Fx.Styles(this._curLayer,{duration:500});fx.display=this._divDisplay;var ops={};switch(transition){case'slide-left':ops={'left':-this._width};break;case'slide-up':ops={'top':-this._height};break;case'slide-right':ops={'left':this._width};break;case'slide-down':ops={'top':this._height};break;}
fx.start(ops).chain(function(){for(var i=this.display.childNodes.length-1;i>=0;i--){if(this.display.childNodes[i].className=="layer"){this.display.removeChild(this.display.childNodes[i]);break;}}});}else if(transition.indexOf("wipe")==0){var fx=new Fx.Styles(this._curLayer,{duration:500});fx.display=this._divDisplay;var ops={};switch(transition)
{case'wipe-left':ops={'width':0};break;case'wipe-up':ops={'height':0};break;}
fx.start(ops).chain(function(){for(var i=this.display.childNodes.length-1;i>=0;i--){if(this.display.childNodes[i].className=="layer"){this.display.removeChild(this.display.childNodes[i]);break;}}});}else if(transition=="fade"){var fx=new Fx.Styles(this._curLayer,{duration:500});fx.display=this._divDisplay;fx.start({'opacity':0}).chain(function(){for(var i=this.display.childNodes.length-1;i>=0;i--){if(this.display.childNodes[i].className=="layer"){this.display.removeChild(this.display.childNodes[i]);break;}}});}else{this._divDisplay.removeChild(this._curLayer);}
this._updateCaption(_p._caption);this._curPage=_p;this.selectNumberButton(_p._offset);this._curLayer=newLayer;if(this.onChangePageComplete)this.onChangePageComplete();};this._generateNumberButtons=function(_n){if(this._divControls==null)return;var placeholder=null;for(var i=0;i<this._divControls.childNodes.length;i++)
if(this._divControls.childNodes[i].className=='numbers_placeholder')
placeholder=this._divControls.childNodes[i];if(placeholder==null)return;this._hasNumberButtons=true;this._numberButtons=[];for(var i=0;i<_n;i++){var btn=document.createElement('input');btn.type="button";btn.className="btn"+i;btn.value=""+(i+1);btn.handle=this;btn.page=i;$(btn).addEvent('click',function(){this.blur();this.handle.pause();this.handle.gotoPage(this.page);});this._divControls.insertBefore(btn,placeholder);this._numberButtons[i]=$(btn);}
this._divControls.removeChild(placeholder);};this.selectNumberButton=function(_i){if(this._divControls==null||!this._hasNumberButtons){return;}
this._numberButtons.each(function(btn){if(btn.page==_i){$(btn).addClass("active");}else{$(btn).removeClass("active");}});};this._generateThumbnails=function(){if(this._divThumbnails==null)return;this._thumbCbkCount=this._numPages;for(var i=0;i<this._numPages;i++){var p=this._pages[i];var link=document.createElement('a');link.handle=this;link.page=i;link.className="thumbnail";link.style.width=this._pages[i]._thumbWidth+"px";link.style.height=this._pages[i]._thumbHeight+"px";$(link).addEvent('click',function(){this.blur();this.handle.gotoPage(this.page);});this._thumbSrcs[i]="";if(p._thumbnail!=undefined&&p._thumbnail!=""){this._thumbSrcs[i]=p._thumbnail;this._thumbLinks.push(link);this._cbkGenerateThumbnails();}else{var m=p._url.match(/(.*)[\/\\]([^\/\\]+\.\w+)$/);var path=m[1];var file_name=m[2];this._thumbSrcs[i]=path+"/th_"+file_name;Lyra.HTTP.request("/examples/resize.cfm",{src:".."+p._url,dst:".."+path+"/th_"+file_name,width:this._thumbWidth,height:this._thumbHeight},Lyra.Utilities.bind(this,"_cbkGenerateThumbnails"));this._thumbLinks.push(link);}}};this._cbkGenerateThumbnails=function(){if(this._thumbCbkCount==1){this._divThumbnails.removeChild(this._spanThumbnailsLoading);for(var i=0;i<this._numPages;i++){if(this._thumbSrcs[i]!=""){var img=document.createElement('img');img.src=this._thumbSrcs[i];img.style.width=this._pages[i]._thumbWidth+"px";img.style.height=this._pages[i]._thumbHeight+"px";this._thumbLinks[i].appendChild(img);}
this._divThumbnails.appendChild(this._thumbLinks[i]);}}
this._thumbCbkCount--;};};
function PageOverlay(ref){this._version=2;this._ref=ref;this._dialog=null;this._height;this.init=function(){this.appendModuleName("PageOverlay");if(this.onInit)this.onInit();if(this.onInitComplete)this.onInitComplete();};this.setDialogLayout=function(_l){this._dialog=new _l();this._dialog.init(this._ref);};this.setDialogTemplate=function(_t){this._dialog.setTemplate(_t);_t.style.display="none";};this.show=function(){this._ref.style.display="block";};this.hide=function(){this._ref.style.display="none";};this.showDialog=function(_d){this.show();this._dialog.show(_d);};this.hideDialog=function(){this._dialog.hide();};this.adjustWidth=function(){this._ref.style.width=window.getSize().size.x+'px';}
this.adjustHeight=function(){this._height=window.getSize().size.y;this._ref.style.height=this._height+'px';};this.setDialogWidth=function(_w){if(typeof _w!='number')return;this._dialog.setWidth(_w);};this.setDialogHeight=function(_h){if(typeof _h!='number')return;this._dialog.setHeight(_h);};this.setDialogDataSource=function(_d){if(typeof _d!='string')return;this._dialog.setDataSource(_d);};};

