/*
	Lyra
	Build - 1.0.1.45	2008-10-11
	Copyright (C) 2008 Global Reach Internet Productions - www.globalreach.com

	NOTE: This is a combination of Lyra 1.0.4.87 and Aurora specific changes through r98
*/
/*
	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});}});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;}});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 Lyra={};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.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"),3*60*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(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){this._reRenderOutput=false;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.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._data.length;};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:' '}[_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){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(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){showMessage(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){showMessage("Sorry, you don't have permission to do that.  Please check with an administrator if you think this is an error.","error");return false;}
showMessage("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){Lyra.Effects.style(_e,{duration:500,wait:false,transition:Lyra.Effects.Transitions.Quad.easeOut},{'color':'#cccccc'});};this.fadeIn=function(_e){Lyra.Effects.style(_e,{duration:500,wait:false,transition:Lyra.Effects.Transitions.Quad.easeOut},{'color':'#666666'});};this.setDraggable=function(_e,_onDrag,_onDrop,_onMove,_params){};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.Dialog=new function(){this._handles={};this.show=function(_msg){this._tbody=document.getElementsByTagName('BODY')[0];var _div=document.createElement('DIV');_div.className='dialogBackgroundBlind';_div.style.height=this._tbody.offsetHeight+'px';Lyra.Effects.setOpacity(_div,70);this._tbody.appendChild(_div);};}
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);}};this.write_r=function(theObj,parentObj,level){if(theObj==undefined){return;}
if(level==undefined){level=0;}
if(parentObj==undefined){var div=document.createElement("DIV");this.output.appendChild(div);div.appendChild(document.createElement("BR"));parentObj=div;}
var _ul=document.createElement("ul");parentObj.appendChild(_ul);if(typeof(theObj)=='object'){for(var item in theObj){var value=theObj[item];if(typeof(value)=='object'){var _li=document.createElement("LI");_li.innerHTML="["+item+"] => "+typeof(value);_ul.appendChild(_li);if(level<10){this.write_r(value,_li,level+1);}}else{var _li=document.createElement("LI");_li.innerHTML="["+item+"] => "+value;_ul.appendChild(_li);}}}else{var _li=document.createElement("LI");_li.innerHTML="["+theObj+"] => "+typeof(theObj);_ul.appendChild(_li);}};}
Lyra.Log=new function(){this.ERROR=0;this.GENERAL=1;this.write=function(_t,_n){alert(_n);}}
window.onload=function(){Lyra.ClassManager.init(document.getElementsByTagName("BODY")[0]);Lyra.Events.fire("onLoad");}
if(!Lyra.Layouts)Lyra.Layouts={};Lyra.Layouts.List=function(){this._ref=null;this._tbody=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.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(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){this._tbody.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)];};var iii=0;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});}};};
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.getRecordCount()){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.insertRow(this._dragRowBufferHomeIndex,this._dragRowBuffer);var _tempMovedID=this._dataset.getColumn(this._dragRowBufferOriginalIndex,this._primaryKey);var _tempNewPos=this._dragRowBufferHomeIndex+1;this._dataset.moveRow(this._dragRowBufferOriginalIndex,this._dragRowBufferHomeIndex);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){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);};this.deactivate=function(){this.childClass("gridtoggle").deactivate();Lyra.Effects.fadeOut(this._ref);};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="/admin/images/icons/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="/admin/images/icons/light_off.gif";this.parentClass('gridrow')._ref.style.color="#cccccc";}}};this.activate=function(){this._ref.getElementsByTagName("IMG")[0].src="/admin/images/icons/light_on.gif";};this.deactivate=function(){this._ref.getElementsByTagName("IMG")[0].src="/admin/images/icons/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("/admin/images/layout/page_first_off.gif","First Page",false);var _bttn2_off=this.newButton("/admin/images/layout/page_previous_off.gif","Previous Page",false);var _bttn1_on=this.newButton("/admin/images/layout/page_first.gif","First Page",true,"this.parentNode.parentClass('grid').goToPage(1); return false;");var _bttn2_on=this.newButton("/admin/images/layout/page_previous.gif","Previous Page",true,"this.parentNode.parentClass('grid').prevPage(); return false;");var _bttn3_off=this.newButton("/admin/images/layout/page_next_off.gif","Next Page",false);var _bttn4_off=this.newButton("/admin/images/layout/page_last_off.gif","Last Page",false);var _bttn3_on=this.newButton("/admin/images/layout/page_next.gif","Next Page",true,"this.parentNode.parentClass('grid').nextPage(); return false;");var _bttn4_on=this.newButton("/admin/images/layout/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._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.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.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;}
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._tfoot.getElementsByTagName("TD")[0].gridbuttons;if(_tempData.RECORDCOUNT<=this._recordsPerPage){_buttons.clear();}else{_buttons.set(this._currentPage,Math.ceil(_tempData.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.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){var _cLayer=this.getLayerContext(this.getLayerByKey(_pk,_v));var _pos=_cLayer.data.findPosition(_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/icons/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/icons/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);};}
