var Rico={Version:"1.1.2",prototypeVersion:parseFloat(Prototype.Version.split(".")[0]+"."+Prototype.Version.split(".")[1])};if((typeof Prototype=="undefined")||Rico.prototypeVersion<1.3){throw ("Rico requires the Prototype JavaScript framework >= 1.3")}Rico.ArrayExtensions=new Array();if(Object.prototype.extend){Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Object.prototype.extend}else{Object.prototype.extend=function(A){return Object.extend.apply(this,[this,A])};Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Object.prototype.extend}if(Array.prototype.push){Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.push}if(!Array.prototype.remove){Array.prototype.remove=function(A){if(isNaN(A)||A>this.length){return false}for(var B=0,C=0;B<this.length;B++){if(B!=A){this[C++]=this[B]}}this.length-=1};Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.remove}if(!Array.prototype.removeItem){Array.prototype.removeItem=function(B){for(var A=0;A<this.length;A++){if(this[A]==B){this.remove(A);break}}};Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.removeItem}if(!Array.prototype.indices){Array.prototype.indices=function(){var A=new Array();for(index in this){var C=false;for(var B=0;B<Rico.ArrayExtensions.length;B++){if(this[index]==Rico.ArrayExtensions[B]){C=true;break}}if(!C){A[A.length]=index}}return A};Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.indices}if(window.DOMParser&&window.XMLSerializer&&window.Node&&Node.prototype&&Node.prototype.__defineGetter__){if(!Document.prototype.loadXML){Document.prototype.loadXML=function(B){var C=(new DOMParser()).parseFromString(B,"text/xml");while(this.hasChildNodes()){this.removeChild(this.lastChild)}for(var A=0;A<C.childNodes.length;A++){this.appendChild(this.importNode(C.childNodes[A],true))}}}Document.prototype.__defineGetter__("xml",function(){return(new XMLSerializer()).serializeToString(this)})}document.getElementsByTagAndClassName=function(D,E){if(D==null){D="*"}var C=document.getElementsByTagName(D)||document.all;var F=new Array();if(E==null){return C}for(var B=0;B<C.length;B++){var H=C[B];var G=H.className.split(" ");for(var A=0;A<G.length;A++){if(G[A]==E){F.push(H);break}}}return F};Rico.Accordion=Class.create();Rico.Accordion.prototype={initialize:function(A,C){this.container=$(A);this.lastExpandedTab=null;this.accordionTabs=new Array();this.setOptions(C);this._attachBehaviors();if(!A){return }this.container.style.borderBottom="1px solid "+this.options.borderColor;if(this.options.onLoadShowTab>=this.accordionTabs.length){this.options.onLoadShowTab=0}for(var E=0;E<this.accordionTabs.length;E++){if(E!=this.options.onLoadShowTab){this.accordionTabs[E].collapse();this.accordionTabs[E].content.style.display="none"}}this.lastExpandedTab=this.accordionTabs[this.options.onLoadShowTab];if(this.options.panelHeight=="auto"){var F=(this.options.onloadShowTab===0)?1:0;var B=parseInt(RicoUtil.getElementsComputedStyle(this.accordionTabs[F].titleBar,"height"));if(isNaN(B)){B=this.accordionTabs[F].titleBar.offsetHeight}var G=this.accordionTabs.length*B;var D=parseInt(RicoUtil.getElementsComputedStyle(this.container.parentNode,"height"));if(isNaN(D)){D=this.container.parentNode.offsetHeight}this.options.panelHeight=D-G-2}this.lastExpandedTab.content.style.height=this.options.panelHeight+"px";this.lastExpandedTab.showExpanded();this.lastExpandedTab.titleBar.style.fontWeight=this.options.expandedFontWeight},setOptions:function(A){this.options={expandedBg:"#63699c",hoverBg:"#63699c",collapsedBg:"#6b79a5",expandedTextColor:"#ffffff",expandedFontWeight:"bold",hoverTextColor:"#ffffff",collapsedTextColor:"#ced7ef",collapsedFontWeight:"normal",hoverTextColor:"#ffffff",borderColor:"#1f669b",panelHeight:200,onHideTab:null,onShowTab:null,onLoadShowTab:0};Object.extend(this.options,A||{})},showTabByIndex:function(C,B){var A=arguments.length==1?true:B;this.showTab(this.accordionTabs[C],A)},showTab:function(E,D){if(this.lastExpandedTab==E){return }var C=arguments.length==1?true:D;if(this.options.onHideTab){this.options.onHideTab(this.lastExpandedTab)}this.lastExpandedTab.showCollapsed();var B=this;var A=this.lastExpandedTab;this.lastExpandedTab.content.style.height=(this.options.panelHeight-1)+"px";E.content.style.display="";E.titleBar.style.fontWeight=this.options.expandedFontWeight;if(C){new Rico.Effect.AccordionSize(this.lastExpandedTab.content,E.content,1,this.options.panelHeight,100,10,{complete:function(){B.showTabDone(A)}});this.lastExpandedTab=E}else{this.lastExpandedTab.content.style.height="1px";E.content.style.height=this.options.panelHeight+"px";this.lastExpandedTab=E;this.showTabDone(A)}},showTabDone:function(A){A.content.style.display="none";this.lastExpandedTab.showExpanded();if(this.options.onShowTab){this.options.onShowTab(this.lastExpandedTab)}},_attachBehaviors:function(){var A=this._getDirectChildrenByTag(this.container,"DIV");for(var B=0;B<A.length;B++){var E=this._getDirectChildrenByTag(A[B],"DIV");if(E.length!=2){continue}var C=E[0];var D=E[1];this.accordionTabs.push(new Rico.Accordion.Tab(this,C,D))}},_getDirectChildrenByTag:function(E,D){var B=new Array();var A=E.childNodes;for(var C=0;C<A.length;C++){if(A[C]&&A[C].tagName&&A[C].tagName==D){B.push(A[C])}}return B}};Rico.Accordion.Tab=Class.create();Rico.Accordion.Tab.prototype={initialize:function(A,B,C){this.accordion=A;this.titleBar=B;this.content=C;this._attachBehaviors()},collapse:function(){this.showCollapsed();this.content.style.height="1px"},showCollapsed:function(){this.expanded=false;this.titleBar.style.backgroundColor=this.accordion.options.collapsedBg;this.titleBar.style.color=this.accordion.options.collapsedTextColor;this.titleBar.style.fontWeight=this.accordion.options.collapsedFontWeight;this.content.style.overflow="hidden"},showExpanded:function(){this.expanded=true;this.titleBar.style.backgroundColor=this.accordion.options.expandedBg;this.titleBar.style.color=this.accordion.options.expandedTextColor;this.content.style.overflow="auto"},titleBarClicked:function(A){if(this.accordion.lastExpandedTab==this){return }this.accordion.showTab(this)},hover:function(A){this.titleBar.style.backgroundColor=this.accordion.options.hoverBg;this.titleBar.style.color=this.accordion.options.hoverTextColor},unhover:function(A){if(this.expanded){this.titleBar.style.backgroundColor=this.accordion.options.expandedBg;this.titleBar.style.color=this.accordion.options.expandedTextColor}else{this.titleBar.style.backgroundColor=this.accordion.options.collapsedBg;this.titleBar.style.color=this.accordion.options.collapsedTextColor}},_attachBehaviors:function(){this.content.style.border="1px solid "+this.accordion.options.borderColor;this.content.style.borderTopWidth="0px";this.content.style.borderBottomWidth="0px";this.content.style.margin="0px";this.titleBar.onclick=this.titleBarClicked.bindAsEventListener(this);this.titleBar.onmouseover=this.hover.bindAsEventListener(this);this.titleBar.onmouseout=this.unhover.bindAsEventListener(this)}};Rico.AjaxEngine=Class.create();Rico.AjaxEngine.prototype={initialize:function(){this.ajaxElements=new Array();this.ajaxObjects=new Array();this.requestURLS=new Array();this.options={}},registerAjaxElement:function(B,A){if(!A){A=$(B)}this.ajaxElements[B]=A},registerAjaxObject:function(B,A){this.ajaxObjects[B]=A},registerRequest:function(A,B){this.requestURLS[A]=B},sendRequest:function(B,A){if(arguments.length>=2){if(typeof arguments[1]=="string"){A={parameters:this._createQueryString(arguments,1)}}}this.sendRequestWithData(B,null,A)},sendRequestWithData:function(D,C,A){var B=this.requestURLS[D];if(B==null){return }if(arguments.length>=3){if(typeof arguments[2]=="string"){A.parameters=this._createQueryString(arguments,2)}}new Ajax.Request(B,this._requestOptions(A,C))},sendRequestAndUpdate:function(C,A,B){if(arguments.length>=3){if(typeof arguments[2]=="string"){B.parameters=this._createQueryString(arguments,2)}}this.sendRequestWithDataAndUpdate(C,null,A,B)},sendRequestWithDataAndUpdate:function(F,E,A,B){var C=this.requestURLS[F];if(C==null){return }if(arguments.length>=4){if(typeof arguments[3]=="string"){B.parameters=this._createQueryString(arguments,3)}}var D=this._requestOptions(B,E);new Ajax.Updater(A,C,D)},_requestOptions:function(B,D){var C=["X-Rico-Version",Rico.Version];var A="post";if(D==null){if(Rico.prototypeVersion<1.4){C.push("Content-type","text/xml")}else{A="get"}}(!B)?B={}:"";if(!B._RicoOptionsProcessed){if(B.onComplete){B.onRicoComplete=B.onComplete}if(B.overrideOnComplete){B.onComplete=B.overrideOnComplete}else{B.onComplete=this._onRequestComplete.bind(this)}B._RicoOptionsProcessed=true}this.options={requestHeaders:C,parameters:B.parameters,postBody:D,method:A,onComplete:B.onComplete};Object.extend(this.options,B);return this.options},_createQueryString:function(E,F){var H="";for(var C=F;C<E.length;C++){if(C!=F){H+="&"}var D=E[C];if(D.name!=undefined&&D.value!=undefined){H+=D.name+"="+escape(D.value)}else{var B=D.indexOf("=");var G=D.substring(0,B);var A=D.substring(B+1);H+=G+"="+escape(A)}}return H},_onRequestComplete:function(B){if(!B){return }if(B.status!=200){return }var A=B.responseXML.getElementsByTagName("ajax-response");if(A==null||A.length!=1){return }this._processAjaxResponse(A[0].childNodes);var C=this.options.onRicoComplete;if(C!=null){C()}},_processAjaxResponse:function(D){for(var C=0;C<D.length;C++){var E=D[C];if(E.nodeType!=1){continue}var B=E.getAttribute("type");var A=E.getAttribute("id");if(B=="object"){this._processAjaxObjectUpdate(this.ajaxObjects[A],E)}else{if(B=="element"){this._processAjaxElementUpdate(this.ajaxElements[A],E)}else{alert("unrecognized AjaxResponse type : "+B)}}}},_processAjaxObjectUpdate:function(A,B){A.ajaxUpdate(B)},_processAjaxElementUpdate:function(A,B){A.innerHTML=RicoUtil.getContentAsString(B)}};var ajaxEngine=new Rico.AjaxEngine();Rico.Color=Class.create();Rico.Color.prototype={initialize:function(C,B,A){this.rgb={r:C,g:B,b:A}},setRed:function(A){this.rgb.r=A},setGreen:function(A){this.rgb.g=A},setBlue:function(A){this.rgb.b=A},setHue:function(B){var A=this.asHSB();A.h=B;this.rgb=Rico.Color.HSBtoRGB(A.h,A.s,A.b)},setSaturation:function(B){var A=this.asHSB();A.s=B;this.rgb=Rico.Color.HSBtoRGB(A.h,A.s,A.b)},setBrightness:function(A){var B=this.asHSB();B.b=A;this.rgb=Rico.Color.HSBtoRGB(B.h,B.s,B.b)},darken:function(B){var A=this.asHSB();this.rgb=Rico.Color.HSBtoRGB(A.h,A.s,Math.max(A.b-B,0))},brighten:function(B){var A=this.asHSB();this.rgb=Rico.Color.HSBtoRGB(A.h,A.s,Math.min(A.b+B,1))},blend:function(A){this.rgb.r=Math.floor((this.rgb.r+A.rgb.r)/2);this.rgb.g=Math.floor((this.rgb.g+A.rgb.g)/2);this.rgb.b=Math.floor((this.rgb.b+A.rgb.b)/2)},isBright:function(){var A=this.asHSB();return this.asHSB().b>0.5},isDark:function(){return !this.isBright()},asRGB:function(){return"rgb("+this.rgb.r+","+this.rgb.g+","+this.rgb.b+")"},asHex:function(){return"#"+this.rgb.r.toColorPart()+this.rgb.g.toColorPart()+this.rgb.b.toColorPart()},asHSB:function(){return Rico.Color.RGBtoHSB(this.rgb.r,this.rgb.g,this.rgb.b)},toString:function(){return this.asHex()}};Rico.Color.createFromHex=function(D){if(D.length==4){var B=D;var D="#";for(var C=1;C<4;C++){D+=(B.charAt(C)+B.charAt(C))}}if(D.indexOf("#")==0){D=D.substring(1)}var F=D.substring(0,2);var E=D.substring(2,4);var A=D.substring(4,6);return new Rico.Color(parseInt(F,16),parseInt(E,16),parseInt(A,16))};Rico.Color.createColorFromBackground=function(D){var B=RicoUtil.getElementsComputedStyle($(D),"backgroundColor","background-color");if(B=="transparent"&&D.parentNode){return Rico.Color.createColorFromBackground(D.parentNode)}if(B==null){return new Rico.Color(255,255,255)}if(B.indexOf("rgb(")==0){var A=B.substring(4,B.length-1);var C=A.split(",");return new Rico.Color(parseInt(C[0]),parseInt(C[1]),parseInt(C[2]))}else{if(B.indexOf("#")==0){return Rico.Color.createFromHex(B)}else{return new Rico.Color(255,255,255)}}};Rico.Color.HSBtoRGB=function(G,E,I){var C=0;var D=0;var J=0;if(E==0){C=parseInt(I*255+0.5);D=C;J=C}else{var F=(G-Math.floor(G))*6;var H=F-Math.floor(F);var B=I*(1-E);var A=I*(1-E*H);var K=I*(1-(E*(1-H)));switch(parseInt(F)){case 0:C=(I*255+0.5);D=(K*255+0.5);J=(B*255+0.5);break;case 1:C=(A*255+0.5);D=(I*255+0.5);J=(B*255+0.5);break;case 2:C=(B*255+0.5);D=(I*255+0.5);J=(K*255+0.5);break;case 3:C=(B*255+0.5);D=(A*255+0.5);J=(I*255+0.5);break;case 4:C=(K*255+0.5);D=(B*255+0.5);J=(I*255+0.5);break;case 5:C=(I*255+0.5);D=(B*255+0.5);J=(A*255+0.5);break}}return{r:parseInt(C),g:parseInt(D),b:parseInt(J)}};Rico.Color.RGBtoHSB=function(A,E,J){var F;var D;var I;var K=(A>E)?A:E;if(J>K){K=J}var G=(A<E)?A:E;if(J<G){G=J}I=K/255;if(K!=0){D=(K-G)/K}else{D=0}if(D==0){F=0}else{var B=(K-A)/(K-G);var H=(K-E)/(K-G);var C=(K-J)/(K-G);if(A==K){F=C-H}else{if(E==K){F=2+B-C}else{F=4+H-B}}F=F/6;if(F<0){F=F+1}}return{h:F,s:D,b:I}};Rico.Corner={round:function(D,B){var D=$(D);this._setOptions(B);var A=this.options.color;if(this.options.color=="fromElement"){A=this._background(D)}var C=this.options.bgColor;if(this.options.bgColor=="fromParent"){C=this._background(D.offsetParent)}this._roundCornersImpl(D,A,C)},_roundCornersImpl:function(C,A,B){if(this.options.border){this._renderBorder(C,B)}if(this._isTopRounded()){this._roundTopCorners(C,A,B)}if(this._isBottomRounded()){this._roundBottomCorners(C,A,B)}},_renderBorder:function(D,E){var B="1px solid "+this._borderColor(E);var A="border-left: "+B;var F="border-right: "+B;var C="style='"+A+";"+F+"'";D.innerHTML="<div "+C+">"+D.innerHTML+"</div>"},_roundTopCorners:function(C,A,E){var D=this._createCorner(E);for(var B=0;B<this.options.numSlices;B++){D.appendChild(this._createCornerSlice(A,E,B,"top"))}C.style.paddingTop=0;C.insertBefore(D,C.firstChild)},_roundBottomCorners:function(C,A,E){var D=this._createCorner(E);for(var B=(this.options.numSlices-1);B>=0;B--){D.appendChild(this._createCornerSlice(A,E,B,"bottom"))}C.style.paddingBottom=0;C.appendChild(D)},_createCorner:function(B){var A=document.createElement("div");A.style.backgroundColor=(this._isTransparent()?"transparent":B);return A},_createCornerSlice:function(C,D,G,A){var E=document.createElement("span");var B=E.style;B.backgroundColor=C;B.display="block";B.height="1px";B.overflow="hidden";B.fontSize="1px";var F=this._borderColor(C,D);if(this.options.border&&G==0){B.borderTopStyle="solid";B.borderTopWidth="1px";B.borderLeftWidth="0px";B.borderRightWidth="0px";B.borderBottomWidth="0px";B.height="0px";B.borderColor=F}else{if(F){B.borderColor=F;B.borderStyle="solid";B.borderWidth="0px 1px"}}if(!this.options.compact&&(G==(this.options.numSlices-1))){B.height="2px"}this._setMargin(E,G,A);this._setBorder(E,G,A);return E},_setOptions:function(A){this.options={corners:"all",color:"fromElement",bgColor:"fromParent",blend:true,border:false,compact:false};Object.extend(this.options,A||{});this.options.numSlices=this.options.compact?2:4;if(this._isTransparent()){this.options.blend=false}},_whichSideTop:function(){if(this._hasString(this.options.corners,"all","top")){return""}if(this.options.corners.indexOf("tl")>=0&&this.options.corners.indexOf("tr")>=0){return""}if(this.options.corners.indexOf("tl")>=0){return"left"}else{if(this.options.corners.indexOf("tr")>=0){return"right"}}return""},_whichSideBottom:function(){if(this._hasString(this.options.corners,"all","bottom")){return""}if(this.options.corners.indexOf("bl")>=0&&this.options.corners.indexOf("br")>=0){return""}if(this.options.corners.indexOf("bl")>=0){return"left"}else{if(this.options.corners.indexOf("br")>=0){return"right"}}return""},_borderColor:function(A,B){if(A=="transparent"){return B}else{if(this.options.border){return this.options.border}else{if(this.options.blend){return this._blend(B,A)}else{return""}}}},_setMargin:function(D,E,B){var C=this._marginSize(E);var A=B=="top"?this._whichSideTop():this._whichSideBottom();if(A=="left"){D.style.marginLeft=C+"px";D.style.marginRight="0px"}else{if(A=="right"){D.style.marginRight=C+"px";D.style.marginLeft="0px"}else{D.style.marginLeft=C+"px";D.style.marginRight=C+"px"}}},_setBorder:function(D,E,B){var C=this._borderSize(E);var A=B=="top"?this._whichSideTop():this._whichSideBottom();if(A=="left"){D.style.borderLeftWidth=C+"px";D.style.borderRightWidth="0px"}else{if(A=="right"){D.style.borderRightWidth=C+"px";D.style.borderLeftWidth="0px"}else{D.style.borderLeftWidth=C+"px";D.style.borderRightWidth=C+"px"}}if(this.options.border!=false){D.style.borderLeftWidth=C+"px"}D.style.borderRightWidth=C+"px"},_marginSize:function(E){if(this._isTransparent()){return 0}var D=[5,3,2,1];var A=[3,2,1,0];var C=[2,1];var B=[1,0];if(this.options.compact&&this.options.blend){return B[E]}else{if(this.options.compact){return C[E]}else{if(this.options.blend){return A[E]}else{return D[E]}}}},_borderSize:function(E){var D=[5,3,2,1];var B=[2,1,1,1];var A=[1,0];var C=[0,2,0,0];if(this.options.compact&&(this.options.blend||this._isTransparent())){return 1}else{if(this.options.compact){return A[E]}else{if(this.options.blend){return B[E]}else{if(this.options.border){return C[E]}else{if(this._isTransparent()){return D[E]}}}}}return 0},_hasString:function(B){for(var A=1;A<arguments.length;A++){if(B.indexOf(arguments[A])>=0){return true}}return false},_blend:function(C,A){var B=Rico.Color.createFromHex(C);B.blend(Rico.Color.createFromHex(A));return B},_background:function(A){try{return Rico.Color.createColorFromBackground(A).asHex()}catch(B){return"#ffffff"}},_isTransparent:function(){return this.options.color=="transparent"},_isTopRounded:function(){return this._hasString(this.options.corners,"all","top","tl","tr")},_isBottomRounded:function(){return this._hasString(this.options.corners,"all","bottom","bl","br")},_hasSingleTextChild:function(A){return A.childNodes.length==1&&A.childNodes[0].nodeType==3}};Rico.DragAndDrop=Class.create();Rico.DragAndDrop.prototype={initialize:function(){this.dropZones=new Array();this.draggables=new Array();this.currentDragObjects=new Array();this.dragElement=null;this.lastSelectedDraggable=null;this.currentDragObjectVisible=false;this.interestedInMotionEvents=false;this._mouseDown=this._mouseDownHandler.bindAsEventListener(this);this._mouseMove=this._mouseMoveHandler.bindAsEventListener(this);this._mouseUp=this._mouseUpHandler.bindAsEventListener(this)},registerDropZone:function(A){this.dropZones[this.dropZones.length]=A},deregisterDropZone:function(A){var D=new Array();var B=0;for(var C=0;C<this.dropZones.length;C++){if(this.dropZones[C]!=A){D[B++]=this.dropZones[C]}}this.dropZones=D},clearDropZones:function(){this.dropZones=new Array()},registerDraggable:function(A){this.draggables[this.draggables.length]=A;this._addMouseDownHandler(A)},clearSelection:function(){for(var A=0;A<this.currentDragObjects.length;A++){this.currentDragObjects[A].deselect()}this.currentDragObjects=new Array();this.lastSelectedDraggable=null},hasSelection:function(){return this.currentDragObjects.length>0},setStartDragFromElement:function(A,B){this.origPos=RicoUtil.toDocumentPosition(B);this.startx=A.screenX-this.origPos.x;this.starty=A.screenY-this.origPos.y;this.interestedInMotionEvents=this.hasSelection();this._terminateEvent(A)},updateSelection:function(A,B){if(!B){this.clearSelection()}if(A.isSelected()){this.currentDragObjects.removeItem(A);A.deselect();if(A==this.lastSelectedDraggable){this.lastSelectedDraggable=null}}else{this.currentDragObjects[this.currentDragObjects.length]=A;A.select();this.lastSelectedDraggable=A}},_mouseDownHandler:function(F){if(arguments.length==0){F=event}var B=F.which!=undefined;if((B&&F.which!=1)||(!B&&F.button!=1)){return }var E=F.target?F.target:F.srcElement;var A=E.draggable;var D=E;while(A==null&&D.parentNode){D=D.parentNode;A=D.draggable}if(A==null){return }this.updateSelection(A,F.ctrlKey);if(this.hasSelection()){for(var C=0;C<this.dropZones.length;C++){this.dropZones[C].clearPositionCache()}}this.setStartDragFromElement(F,A.getMouseDownHTMLElement())},_mouseMoveHandler:function(B){var A=B.which!=undefined;if(!this.interestedInMotionEvents){return }if(!this.hasSelection()){return }if(!this.currentDragObjectVisible){this._startDrag(B)}if(!this.activatedDropZones){this._activateRegisteredDropZones()}this._updateDraggableLocation(B);this._updateDropZonesHover(B);this._terminateEvent(B)},_makeDraggableObjectVisible:function(B){if(!this.hasSelection()){return }var A;if(this.currentDragObjects.length>1){A=this.currentDragObjects[0].getMultiObjectDragGUI(this.currentDragObjects)}else{A=this.currentDragObjects[0].getSingleObjectDragGUI()}if(RicoUtil.getElementsComputedStyle(A,"position")!="absolute"){A.style.position="absolute"}if(A.parentNode==null||A.parentNode.nodeType==11){document.body.appendChild(A)}this.dragElement=A;this._updateDraggableLocation(B);this.currentDragObjectVisible=true},_leftOffset:function(A){return A.offsetX?document.body.scrollLeft:0},_topOffset:function(A){return A.offsetY?document.body.scrollTop:0},_updateDraggableLocation:function(B){var A=this.dragElement.style;A.left=(B.screenX+this._leftOffset(B)-this.startx)+"px";A.top=(B.screenY+this._topOffset(B)-this.starty)+"px"},_updateDropZonesHover:function(B){var C=this.dropZones.length;for(var A=0;A<C;A++){if(!this._mousePointInDropZone(B,this.dropZones[A])){this.dropZones[A].hideHover()}}for(var A=0;A<C;A++){if(this._mousePointInDropZone(B,this.dropZones[A])){if(this.dropZones[A].canAccept(this.currentDragObjects)){this.dropZones[A].showHover()}}}},_startDrag:function(B){for(var A=0;A<this.currentDragObjects.length;A++){this.currentDragObjects[A].startDrag()}this._makeDraggableObjectVisible(B)},_mouseUpHandler:function(B){if(!this.hasSelection()){return }var A=B.which!=undefined;if((A&&B.which!=1)||(!A&&B.button!=1)){return }this.interestedInMotionEvents=false;if(this.dragElement==null){this._terminateEvent(B);return }if(this._placeDraggableInDropZone(B)){this._completeDropOperation(B)}else{this._terminateEvent(B);new Rico.Effect.Position(this.dragElement,this.origPos.x,this.origPos.y,200,20,{complete:this._doCancelDragProcessing.bind(this)})}Event.stopObserving(document.body,"mousemove",this._mouseMove);Event.stopObserving(document.body,"mouseup",this._mouseUp)},_retTrue:function(){return true},_completeDropOperation:function(A){if(this.dragElement!=this.currentDragObjects[0].getMouseDownHTMLElement()){if(this.dragElement.parentNode!=null){this.dragElement.parentNode.removeChild(this.dragElement)}}this._deactivateRegisteredDropZones();this._endDrag();this.clearSelection();this.dragElement=null;this.currentDragObjectVisible=false;this._terminateEvent(A)},_doCancelDragProcessing:function(){this._cancelDrag();if(this.dragElement!=this.currentDragObjects[0].getMouseDownHTMLElement()&&this.dragElement){if(this.dragElement.parentNode!=null){this.dragElement.parentNode.removeChild(this.dragElement)}}this._deactivateRegisteredDropZones();this.dragElement=null;this.currentDragObjectVisible=false},_placeDraggableInDropZone:function(C){var A=false;var D=this.dropZones.length;for(var B=0;B<D;B++){if(this._mousePointInDropZone(C,this.dropZones[B])){if(this.dropZones[B].canAccept(this.currentDragObjects)){this.dropZones[B].hideHover();this.dropZones[B].accept(this.currentDragObjects);A=true;break}}}return A},_cancelDrag:function(){for(var A=0;A<this.currentDragObjects.length;A++){this.currentDragObjects[A].cancelDrag()}},_endDrag:function(){for(var A=0;A<this.currentDragObjects.length;A++){this.currentDragObjects[A].endDrag()}},_mousePointInDropZone:function(B,C){var A=C.getAbsoluteRect();return B.clientX>A.left+this._leftOffset(B)&&B.clientX<A.right+this._leftOffset(B)&&B.clientY>A.top+this._topOffset(B)&&B.clientY<A.bottom+this._topOffset(B)},_addMouseDownHandler:function(A){htmlElement=A.getMouseDownHTMLElement();if(htmlElement!=null){htmlElement.draggable=A;Event.observe(htmlElement,"mousedown",this._onmousedown.bindAsEventListener(this));Event.observe(htmlElement,"mousedown",this._mouseDown)}},_activateRegisteredDropZones:function(){var C=this.dropZones.length;for(var A=0;A<C;A++){var B=this.dropZones[A];if(B.canAccept(this.currentDragObjects)){B.activate()}}this.activatedDropZones=true},_deactivateRegisteredDropZones:function(){var B=this.dropZones.length;for(var A=0;A<B;A++){this.dropZones[A].deactivate()}this.activatedDropZones=false},_onmousedown:function(){Event.observe(document.body,"mousemove",this._mouseMove);Event.observe(document.body,"mouseup",this._mouseUp)},_terminateEvent:function(A){if(A.stopPropagation!=undefined){A.stopPropagation()}else{if(A.cancelBubble!=undefined){A.cancelBubble=true}}if(A.preventDefault!=undefined){A.preventDefault()}else{A.returnValue=false}},initializeEventHandlers:function(){if(typeof document.implementation!="undefined"&&document.implementation.hasFeature("HTML","1.0")&&document.implementation.hasFeature("Events","2.0")&&document.implementation.hasFeature("CSS","2.0")){document.addEventListener("mouseup",this._mouseUpHandler.bindAsEventListener(this),false);document.addEventListener("mousemove",this._mouseMoveHandler.bindAsEventListener(this),false)}else{document.attachEvent("onmouseup",this._mouseUpHandler.bindAsEventListener(this));document.attachEvent("onmousemove",this._mouseMoveHandler.bindAsEventListener(this))}}};var dndMgr=new Rico.DragAndDrop();dndMgr.initializeEventHandlers();Rico.Draggable=Class.create();Rico.Draggable.prototype={initialize:function(A,B){this.type=A;this.htmlElement=$(B);this.selected=false},getMouseDownHTMLElement:function(){return this.htmlElement},select:function(){this.selected=true;if(this.showingSelected){return }var B=this.getMouseDownHTMLElement();var A=Rico.Color.createColorFromBackground(B);A.isBright()?A.darken(0.033):A.brighten(0.033);this.saveBackground=RicoUtil.getElementsComputedStyle(B,"backgroundColor","background-color");B.style.backgroundColor=A.asHex();this.showingSelected=true},deselect:function(){this.selected=false;if(!this.showingSelected){return }var A=this.getMouseDownHTMLElement();A.style.backgroundColor=this.saveBackground;this.showingSelected=false},isSelected:function(){return this.selected},startDrag:function(){},cancelDrag:function(){},endDrag:function(){},getSingleObjectDragGUI:function(){return this.htmlElement},getMultiObjectDragGUI:function(A){return this.htmlElement},getDroppedGUI:function(){return this.htmlElement},toString:function(){return this.type+":"+this.htmlElement+":"}};Rico.Dropzone=Class.create();Rico.Dropzone.prototype={initialize:function(A){this.htmlElement=$(A);this.absoluteRect=null},getHTMLElement:function(){return this.htmlElement},clearPositionCache:function(){this.absoluteRect=null},getAbsoluteRect:function(){if(this.absoluteRect==null){var A=this.getHTMLElement();var B=RicoUtil.toViewportPosition(A);this.absoluteRect={top:B.y,left:B.x,bottom:B.y+A.offsetHeight,right:B.x+A.offsetWidth}}return this.absoluteRect},activate:function(){var C=this.getHTMLElement();if(C==null||this.showingActive){return }this.showingActive=true;this.saveBackgroundColor=C.style.backgroundColor;var B="#ffea84";var A=Rico.Color.createColorFromBackground(C);if(A==null){C.style.backgroundColor=B}else{A.isBright()?A.darken(0.2):A.brighten(0.2);C.style.backgroundColor=A.asHex()}},deactivate:function(){var A=this.getHTMLElement();if(A==null||!this.showingActive){return }A.style.backgroundColor=this.saveBackgroundColor;this.showingActive=false;this.saveBackgroundColor=null},showHover:function(){var A=this.getHTMLElement();if(A==null||this.showingHover){return }this.saveBorderWidth=A.style.borderWidth;this.saveBorderStyle=A.style.borderStyle;this.saveBorderColor=A.style.borderColor;this.showingHover=true;A.style.borderWidth="1px";A.style.borderStyle="solid";A.style.borderColor="#ffff00"},hideHover:function(){var A=this.getHTMLElement();if(A==null||!this.showingHover){return }A.style.borderWidth=this.saveBorderWidth;A.style.borderStyle=this.saveBorderStyle;A.style.borderColor=this.saveBorderColor;this.showingHover=false},canAccept:function(A){return true},accept:function(B){var D=this.getHTMLElement();if(D==null){return }n=B.length;for(var A=0;A<n;A++){var C=B[A].getDroppedGUI();if(RicoUtil.getElementsComputedStyle(C,"position")=="absolute"){C.style.position="static";C.style.top="";C.style.top=""}D.appendChild(C)}}};Rico.Effect={};Rico.Effect.SizeAndPosition=Class.create();Rico.Effect.SizeAndPosition.prototype={initialize:function(E,A,H,B,F,G,C,D){this.element=$(E);this.x=A;this.y=H;this.w=B;this.h=F;this.duration=G;this.steps=C;this.options=arguments[7]||{};this.sizeAndPosition()},sizeAndPosition:function(){if(this.isFinished()){if(this.options.complete){this.options.complete(this)}return }if(this.timer){clearTimeout(this.timer)}var F=Math.round(this.duration/this.steps);var C=this.element.offsetLeft;var B=this.element.offsetTop;var D=this.element.offsetWidth;var I=this.element.offsetHeight;this.x=(this.x)?this.x:C;this.y=(this.y)?this.y:B;this.w=(this.w)?this.w:D;this.h=(this.h)?this.h:I;var G=this.steps>0?(this.x-C)/this.steps:0;var E=this.steps>0?(this.y-B)/this.steps:0;var H=this.steps>0?(this.w-D)/this.steps:0;var A=this.steps>0?(this.h-I)/this.steps:0;this.moveBy(G,E);this.resizeBy(H,A);this.duration-=F;this.steps--;this.timer=setTimeout(this.sizeAndPosition.bind(this),F)},isFinished:function(){return this.steps<=0},moveBy:function(B,G){var F=this.element.offsetLeft;var D=this.element.offsetTop;var C=parseInt(B);var A=parseInt(G);var E=this.element.style;if(C!=0){E.left=(F+C)+"px"}if(A!=0){E.top=(D+A)+"px"}},resizeBy:function(A,E){var C=this.element.offsetWidth;var G=this.element.offsetHeight;var B=parseInt(A);var F=parseInt(E);var D=this.element.style;if(B!=0){D.width=(C+B)+"px"}if(F!=0){D.height=(G+F)+"px"}}};Rico.Effect.Size=Class.create();Rico.Effect.Size.prototype={initialize:function(D,A,E,F,B,C){new Rico.Effect.SizeAndPosition(D,null,null,A,E,F,B,C)}};Rico.Effect.Position=Class.create();Rico.Effect.Position.prototype={initialize:function(D,A,F,E,B,C){new Rico.Effect.SizeAndPosition(D,A,F,null,null,E,B,C)}};Rico.Effect.Round=Class.create();Rico.Effect.Round.prototype={initialize:function(C,D,A){var E=document.getElementsByTagAndClassName(C,D);for(var B=0;B<E.length;B++){Rico.Corner.round(E[B],A)}}};Rico.Effect.FadeTo=Class.create();Rico.Effect.FadeTo.prototype={initialize:function(D,C,E,A,B){this.element=$(D);this.opacity=C;this.duration=E;this.steps=A;this.options=arguments[4]||{};this.fadeTo()},fadeTo:function(){if(this.isFinished()){if(this.options.complete){this.options.complete(this)}return }if(this.timer){clearTimeout(this.timer)}var B=Math.round(this.duration/this.steps);var A=this.getElementOpacity();var C=this.steps>0?(this.opacity-A)/this.steps:0;this.changeOpacityBy(C);this.duration-=B;this.steps--;this.timer=setTimeout(this.fadeTo.bind(this),B)},changeOpacityBy:function(B){var A=this.getElementOpacity();var C=Math.max(0,Math.min(A+B,1));this.element.ricoOpacity=C;this.element.style.filter="alpha(opacity:"+Math.round(C*100)+")";this.element.style.opacity=C},isFinished:function(){return this.steps<=0},getElementOpacity:function(){if(this.element.ricoOpacity==undefined){var A=RicoUtil.getElementsComputedStyle(this.element,"opacity");this.element.ricoOpacity=A!=undefined?A:1}return parseFloat(this.element.ricoOpacity)}};Rico.Effect.AccordionSize=Class.create();Rico.Effect.AccordionSize.prototype={initialize:function(F,E,G,A,D,B,C){this.e1=$(F);this.e2=$(E);this.start=G;this.end=A;this.duration=D;this.steps=B;this.options=arguments[6]||{};this.accordionSize()},accordionSize:function(){if(this.isFinished()){this.e1.style.height=this.start+"px";this.e2.style.height=this.end+"px";if(this.options.complete){this.options.complete(this)}return }if(this.timer){clearTimeout(this.timer)}var A=Math.round(this.duration/this.steps);var B=this.steps>0?(parseInt(this.e1.offsetHeight)-this.start)/this.steps:0;this.resizeBy(B);this.duration-=A;this.steps--;this.timer=setTimeout(this.accordionSize.bind(this),A)},isFinished:function(){return this.steps<=0},resizeBy:function(B){var D=this.e1.offsetHeight;var A=this.e2.offsetHeight;var C=parseInt(B);if(B!=0){this.e1.style.height=(D-C)+"px";this.e2.style.height=(A+C)+"px"}}};Rico.LiveGridMetaData=Class.create();Rico.LiveGridMetaData.prototype={initialize:function(A,C,D,B){this.pageSize=A;this.totalRows=C;this.setOptions(B);this.ArrowHeight=16;this.columnCount=D},setOptions:function(A){this.options={largeBufferSize:7,nearLimitFactor:0.2};Object.extend(this.options,A||{})},getPageSize:function(){return this.pageSize},getTotalRows:function(){return this.totalRows},setTotalRows:function(A){this.totalRows=A},getLargeBufferSize:function(){return parseInt(this.options.largeBufferSize*this.pageSize)},getLimitTolerance:function(){return parseInt(this.getLargeBufferSize()*this.options.nearLimitFactor)}};Rico.LiveGridScroller=Class.create();Rico.LiveGridScroller.prototype={initialize:function(B,A){this.isIE=navigator.userAgent.toLowerCase().indexOf("msie")>=0;this.liveGrid=B;this.metaData=B.metaData;this.createScrollBar();this.scrollTimeout=null;this.lastScrollPos=0;this.viewPort=A;this.rows=new Array()},isUnPlugged:function(){return this.scrollerDiv.onscroll==null},plugin:function(){this.scrollerDiv.onscroll=this.handleScroll.bindAsEventListener(this)},unplug:function(){this.scrollerDiv.onscroll=null},sizeIEHeaderHack:function(){if(!this.isIE){return }var A=$(this.liveGrid.tableId+"_header");if(A){A.rows[0].cells[0].style.width=(A.rows[0].cells[0].offsetWidth+1)+"px"}},createScrollBar:function(){var A=this.liveGrid.viewPort.visibleHeight();this.scrollerDiv=document.createElement("div");var C=this.scrollerDiv.style;C.borderRight=this.liveGrid.options.scrollerBorderRight;C.position="relative";C.left=this.isIE?"-6px":"-3px";C.width="19px";C.height=A+"px";C.overflow="auto";this.heightDiv=document.createElement("div");this.heightDiv.style.width="1px";this.heightDiv.style.height=parseInt(A*this.metaData.getTotalRows()/this.metaData.getPageSize())+"px";this.scrollerDiv.appendChild(this.heightDiv);this.scrollerDiv.onscroll=this.handleScroll.bindAsEventListener(this);var D=this.liveGrid.table;D.parentNode.parentNode.insertBefore(this.scrollerDiv,D.parentNode.nextSibling);var B=this.isIE?"mousewheel":"DOMMouseScroll";Event.observe(D,B,function(E){if(E.wheelDelta>=0||E.detail<0){this.scrollerDiv.scrollTop-=(2*this.viewPort.rowHeight)}else{this.scrollerDiv.scrollTop+=(2*this.viewPort.rowHeight)}this.handleScroll(false)}.bindAsEventListener(this),false)},updateSize:function(){var B=this.liveGrid.table;var A=this.viewPort.visibleHeight();this.heightDiv.style.height=parseInt(A*this.metaData.getTotalRows()/this.metaData.getPageSize())+"px"},rowToPixel:function(A){return(A/this.metaData.getTotalRows())*this.heightDiv.offsetHeight},moveScroll:function(A){this.scrollerDiv.scrollTop=this.rowToPixel(A);if(this.metaData.options.onscroll){this.metaData.options.onscroll(this.liveGrid,A)}},handleScroll:function(){if(this.scrollTimeout){clearTimeout(this.scrollTimeout)}var C=this.lastScrollPos-this.scrollerDiv.scrollTop;if(C!=0){var B=this.scrollerDiv.scrollTop%this.viewPort.rowHeight;if(B!=0){this.unplug();if(C<0){this.scrollerDiv.scrollTop+=(this.viewPort.rowHeight-B)}else{this.scrollerDiv.scrollTop-=B}this.plugin()}}var A=parseInt(this.scrollerDiv.scrollTop/this.viewPort.rowHeight);this.liveGrid.requestContentRefresh(A);this.viewPort.scrollTo(this.scrollerDiv.scrollTop);if(this.metaData.options.onscroll){this.metaData.options.onscroll(this.liveGrid,A)}this.scrollTimeout=setTimeout(this.scrollIdle.bind(this),1200);this.lastScrollPos=this.scrollerDiv.scrollTop},scrollIdle:function(){if(this.metaData.options.onscrollidle){this.metaData.options.onscrollidle()}}};Rico.LiveGridBuffer=Class.create();Rico.LiveGridBuffer.prototype={initialize:function(A,B){this.startPos=0;this.size=0;this.metaData=A;this.rows=new Array();this.updateInProgress=false;this.viewPort=B;this.maxBufferSize=A.getLargeBufferSize()*2;this.maxFetchSize=A.getLargeBufferSize();this.lastOffset=0},getBlankRow:function(){if(!this.blankRow){this.blankRow=new Array();for(var A=0;A<this.metaData.columnCount;A++){this.blankRow[A]="&nbsp;"}}return this.blankRow},loadRows:function(B){var E=B.getElementsByTagName("rows")[0];this.updateUI=E.getAttribute("update_ui")=="true";var F=new Array();var G=E.getElementsByTagName("tr");for(var D=0;D<G.length;D++){var K=F[D]=new Array();var J=G[D].getElementsByTagName("td");for(var C=0;C<J.length;C++){var I=J[C];var H=I.getAttribute("convert_spaces")=="true";var A=RicoUtil.getContentAsString(I);K[C]=H?this.convertSpaces(A):A;if(!K[C]){K[C]="&nbsp;"}}}return F},update:function(B,D){var A=this.loadRows(B);if(this.rows.length==0){this.rows=A;this.size=this.rows.length;this.startPos=D;return }if(D>this.startPos){if(this.startPos+this.rows.length<D){this.rows=A;this.startPos=D}else{this.rows=this.rows.concat(A.slice(0,A.length));if(this.rows.length>this.maxBufferSize){var C=this.rows.length;this.rows=this.rows.slice(this.rows.length-this.maxBufferSize,this.rows.length);this.startPos=this.startPos+(C-this.rows.length)}}}else{if(D+A.length<this.startPos){this.rows=A}else{this.rows=A.slice(0,this.startPos).concat(this.rows);if(this.rows.length>this.maxBufferSize){this.rows=this.rows.slice(0,this.maxBufferSize)}}this.startPos=D}this.size=this.rows.length},clear:function(){this.rows=new Array();this.startPos=0;this.size=0},isOverlapping:function(B,A){return((B<this.endPos())&&(this.startPos<B+A))||(this.endPos()==0)},isInRange:function(A){return(A>=this.startPos)&&(A+this.metaData.getPageSize()<=this.endPos())},isNearingTopLimit:function(A){return A-this.startPos<this.metaData.getLimitTolerance()},endPos:function(){return this.startPos+this.rows.length},isNearingBottomLimit:function(A){return this.endPos()-(A+this.metaData.getPageSize())<this.metaData.getLimitTolerance()},isAtTop:function(){return this.startPos==0},isAtBottom:function(){return this.endPos()==this.metaData.getTotalRows()},isNearingLimit:function(A){return(!this.isAtTop()&&this.isNearingTopLimit(A))||(!this.isAtBottom()&&this.isNearingBottomLimit(A))},getFetchSize:function(C){var A=this.getFetchOffset(C);var B=0;if(A>=this.startPos){var D=this.maxFetchSize+A;if(D>this.metaData.totalRows){D=this.metaData.totalRows}B=D-A;if(A==0&&B<this.maxFetchSize){B=this.maxFetchSize}}else{var B=this.startPos-A;if(B>this.maxFetchSize){B=this.maxFetchSize}}return B},getFetchOffset:function(B){var A=B;if(B>this.startPos){A=(B>this.endPos())?B:this.endPos()}else{if(B+this.maxFetchSize>=this.startPos){var A=this.startPos-this.maxFetchSize;if(A<0){A=0}}}this.lastOffset=A;return A},getRows:function(G,E){var F=G-this.startPos;var B=F+E;if(B>this.size){B=this.size}var D=new Array();var A=0;for(var C=F;C<B;C++){D[A++]=this.rows[C]}return D},convertSpaces:function(A){return A.split(" ").join("&nbsp;")}};Rico.GridViewPort=Class.create();Rico.GridViewPort.prototype={initialize:function(C,B,D,A,E){this.lastDisplayedStartPos=0;this.div=C.parentNode;this.table=C;this.rowHeight=B;this.div.style.height=(this.rowHeight*D)+"px";this.div.style.overflow="hidden";this.buffer=A;this.liveGrid=E;this.visibleRows=D+1;this.lastPixelOffset=0;this.startPos=0},populateRow:function(C,B){for(var A=0;A<B.length;A++){C.cells[A].innerHTML=B[A]}},bufferChanged:function(){this.refreshContents(parseInt(this.lastPixelOffset/this.rowHeight))},clearRows:function(){if(!this.isBlank){this.liveGrid.table.className=this.liveGrid.options.loadingClass;for(var A=0;A<this.visibleRows;A++){this.populateRow(this.table.rows[A],this.buffer.getBlankRow())}this.isBlank=true}},clearContents:function(){this.clearRows();this.scrollTo(0);this.startPos=0;this.lastStartPos=-1},refreshContents:function(G){if(G==this.lastRowPos&&!this.isPartialBlank&&!this.isBlank){return }if((G+this.visibleRows<this.buffer.startPos)||(this.buffer.startPos+this.buffer.size<G)||(this.buffer.size==0)){this.clearRows();return }this.isBlank=false;var F=this.buffer.startPos>G;var B=F?this.buffer.startPos:G;var A=(this.buffer.startPos+this.buffer.size<G+this.visibleRows)?this.buffer.startPos+this.buffer.size:G+this.visibleRows;var J=A-B;var K=this.buffer.getRows(B,J);var D=this.visibleRows-J;var H=F?0:J;var C=F?D:0;for(var E=0;E<K.length;E++){this.populateRow(this.table.rows[E+C],K[E])}for(var E=0;E<D;E++){this.populateRow(this.table.rows[E+H],this.buffer.getBlankRow())}this.isPartialBlank=D>0;this.lastRowPos=G;this.liveGrid.table.className=this.liveGrid.options.tableClass;var I=this.liveGrid.options.onRefreshComplete;if(I!=null){I()}},scrollTo:function(A){if(this.lastPixelOffset==A){return }this.refreshContents(parseInt(A/this.rowHeight));this.div.scrollTop=A%this.rowHeight;this.lastPixelOffset=A},visibleHeight:function(){return parseInt(RicoUtil.getElementsComputedStyle(this.div,"height"))}};Rico.LiveGridRequest=Class.create();Rico.LiveGridRequest.prototype={initialize:function(B,A){this.requestOffset=B}};Rico.LiveGrid=Class.create();Rico.LiveGrid.prototype={initialize:function(C,B,H,A,I,D){this.options={tableClass:$(C).className,loadingClass:$(C).className,scrollerBorderRight:"1px solid #ababab",bufferTimeout:20000,sortAscendImg:"images/sort_asc.gif",sortDescendImg:"images/sort_desc.gif",sortImageWidth:9,sortImageHeight:5,ajaxSortURLParms:[],onRefreshComplete:null,requestParameters:null,inlineStyles:true};Object.extend(this.options,I||{});this.ajaxOptions={parameters:null};Object.extend(this.ajaxOptions,D||{});this.tableId=C;this.table=$(C);this.addLiveGridHtml();var F=this.table.rows[0].cells.length;this.metaData=new Rico.LiveGridMetaData(B,H,F,I);this.buffer=new Rico.LiveGridBuffer(this.metaData);var G=this.table.rows.length;this.viewPort=new Rico.GridViewPort(this.table,this.table.offsetHeight/G,B,this.buffer,this);this.scroller=new Rico.LiveGridScroller(this,this.viewPort);this.options.sortHandler=this.sortHandler.bind(this);if($(C+"_header")){this.sort=new Rico.LiveGridSort(C+"_header",this.options)}this.processingRequest=null;this.unprocessedRequest=null;this.initAjax(A);if(this.options.prefetchBuffer||this.options.prefetchOffset>0){var E=0;if(this.options.offset){E=this.options.offset;this.scroller.moveScroll(E);this.viewPort.scrollTo(this.scroller.rowToPixel(E))}if(this.options.sortCol){this.sortCol=I.sortCol;this.sortDir=I.sortDir}this.requestContentRefresh(E)}},addLiveGridHtml:function(){if(this.table.getElementsByTagName("thead").length>0){var A=this.table.cloneNode(true);A.setAttribute("id",this.tableId+"_header");A.setAttribute("class",this.table.className+"_header");for(var B=0;B<A.tBodies.length;B++){A.removeChild(A.tBodies[B])}this.table.deleteTHead();this.table.parentNode.insertBefore(A,this.table)}new Insertion.Before(this.table,"<div id='"+this.tableId+"_container'></div>");this.table.previousSibling.appendChild(this.table);new Insertion.Before(this.table,"<div id='"+this.tableId+"_viewport' style='float:left;'></div>");this.table.previousSibling.appendChild(this.table)},resetContents:function(){this.scroller.moveScroll(0);this.buffer.clear();this.viewPort.clearContents()},sortHandler:function(A){if(!A){return }this.sortCol=A.name;this.sortDir=A.currentSort;this.resetContents();this.requestContentRefresh(0)},adjustRowSize:function(){},setTotalRows:function(A){this.resetContents();this.metaData.setTotalRows(A);this.scroller.updateSize()},initAjax:function(A){ajaxEngine.registerRequest(this.tableId+"_request",A);ajaxEngine.registerAjaxObject(this.tableId+"_updater",this)},invokeAjax:function(){},handleTimedOut:function(){this.processingRequest=null;this.processQueuedRequest()},fetchBuffer:function(C){if(this.buffer.isInRange(C)&&!this.buffer.isNearingLimit(C)){return }if(this.processingRequest){this.unprocessedRequest=new Rico.LiveGridRequest(C);return }var B=this.buffer.getFetchOffset(C);this.processingRequest=new Rico.LiveGridRequest(C);this.processingRequest.bufferOffset=B;var A=this.buffer.getFetchSize(C);var E=false;var D;if(this.options.requestParameters){D=this._createQueryString(this.options.requestParameters,0)}D=(D==null)?"":D+"&";D=D+"id="+this.tableId+"&page_size="+A+"&offset="+B;if(this.sortCol){D=D+"&sort_col="+escape(this.sortCol)+"&sort_dir="+this.sortDir}this.ajaxOptions.parameters=D;ajaxEngine.sendRequest(this.tableId+"_request",this.ajaxOptions);this.timeoutHandler=setTimeout(this.handleTimedOut.bind(this),this.options.bufferTimeout)},setRequestParams:function(){this.options.requestParameters=[];for(var A=0;A<arguments.length;A++){this.options.requestParameters[A]=arguments[A]}},requestContentRefresh:function(A){this.fetchBuffer(A)},ajaxUpdate:function(B){try{clearTimeout(this.timeoutHandler);this.buffer.update(B,this.processingRequest.bufferOffset);this.viewPort.bufferChanged()}catch(A){}finally{this.processingRequest=null}this.processQueuedRequest()},_createQueryString:function(E,F){var H="";if(!E){return H}for(var C=F;C<E.length;C++){if(C!=F){H+="&"}var D=E[C];if(D.name!=undefined&&D.value!=undefined){H+=D.name+"="+escape(D.value)}else{var B=D.indexOf("=");var G=D.substring(0,B);var A=D.substring(B+1);H+=G+"="+escape(A)}}return H},processQueuedRequest:function(){if(this.unprocessedRequest!=null){this.requestContentRefresh(this.unprocessedRequest.requestOffset);this.unprocessedRequest=null}}};Rico.LiveGridSort=Class.create();Rico.LiveGridSort.prototype={initialize:function(B,A){this.headerTableId=B;this.headerTable=$(B);this.options=A;this.setOptions();this.applySortBehavior();if(this.options.sortCol){this.setSortUI(this.options.sortCol,this.options.sortDir)}},setSortUI:function(A,D){var C=this.options.columns;for(var B=0;B<C.length;B++){if(C[B].name==A){this.setColumnSort(B,D);break}}},setOptions:function(){new Image().src=this.options.sortAscendImg;new Image().src=this.options.sortDescendImg;this.sort=this.options.sortHandler;if(!this.options.columns){this.options.columns=this.introspectForColumnInfo()}else{this.options.columns=this.convertToTableColumns(this.options.columns)}},applySortBehavior:function(){var C=this.headerTable.rows[0];var A=C.cells;for(var B=0;B<A.length;B++){this.addSortBehaviorToColumn(B,A[B])}},addSortBehaviorToColumn:function(B,A){if(this.options.columns[B].isSortable()){A.id=this.headerTableId+"_"+B;A.style.cursor="pointer";A.onclick=this.headerCellClicked.bindAsEventListener(this);A.innerHTML=A.innerHTML+'<span id="'+this.headerTableId+"_img_"+B+'">&nbsp;&nbsp;&nbsp;</span>'}},headerCellClicked:function(A){var E=A.target?A.target:A.srcElement;var C=E.id;var B=parseInt(C.substring(C.lastIndexOf("_")+1));var D=this.getSortedColumnIndex();if(D!=-1){if(D!=B){this.removeColumnSort(D);this.setColumnSort(B,Rico.TableColumn.SORT_ASC)}else{this.toggleColumnSort(D)}}else{this.setColumnSort(B,Rico.TableColumn.SORT_ASC)}if(this.options.sortHandler){this.options.sortHandler(this.options.columns[B])}},removeColumnSort:function(A){this.options.columns[A].setUnsorted();this.setSortImage(A)},setColumnSort:function(B,A){if(isNaN(B)){return }this.options.columns[B].setSorted(A);this.setSortImage(B)},toggleColumnSort:function(A){this.options.columns[A].toggleSort();this.setSortImage(A)},setSortImage:function(C){var B=this.options.columns[C].getSortDirection();var A=$(this.headerTableId+"_img_"+C);if(B==Rico.TableColumn.UNSORTED){A.innerHTML="&nbsp;&nbsp;"}else{if(B==Rico.TableColumn.SORT_ASC){A.innerHTML='&nbsp;&nbsp;<img width="'+this.options.sortImageWidth+'" height="'+this.options.sortImageHeight+'" src="'+this.options.sortAscendImg+'"/>'}else{if(B==Rico.TableColumn.SORT_DESC){A.innerHTML='&nbsp;&nbsp;<img width="'+this.options.sortImageWidth+'" height="'+this.options.sortImageHeight+'" src="'+this.options.sortDescendImg+'"/>'}}}},getSortedColumnIndex:function(){var B=this.options.columns;for(var A=0;A<B.length;A++){if(B[A].isSorted()){return A}}return -1},introspectForColumnInfo:function(){var C=new Array();var D=this.headerTable.rows[0];var A=D.cells;for(var B=0;B<A.length;B++){C.push(new Rico.TableColumn(this.deriveColumnNameFromCell(A[B],B),true))}return C},convertToTableColumns:function(C){var B=new Array();for(var A=0;A<C.length;A++){B.push(new Rico.TableColumn(C[A][0],C[A][1]))}return B},deriveColumnNameFromCell:function(A,C){var B=A.innerText!=undefined?A.innerText:A.textContent;return B?B.toLowerCase().split(" ").join("_"):"col_"+C}};Rico.TableColumn=Class.create();Rico.TableColumn.UNSORTED=0;Rico.TableColumn.SORT_ASC="ASC";Rico.TableColumn.SORT_DESC="DESC";Rico.TableColumn.prototype={initialize:function(A,B){this.name=A;this.sortable=B;this.currentSort=Rico.TableColumn.UNSORTED},isSortable:function(){return this.sortable},isSorted:function(){return this.currentSort!=Rico.TableColumn.UNSORTED},getSortDirection:function(){return this.currentSort},toggleSort:function(){if(this.currentSort==Rico.TableColumn.UNSORTED||this.currentSort==Rico.TableColumn.SORT_DESC){this.currentSort=Rico.TableColumn.SORT_ASC}else{if(this.currentSort==Rico.TableColumn.SORT_ASC){this.currentSort=Rico.TableColumn.SORT_DESC}}},setUnsorted:function(A){this.setSorted(Rico.TableColumn.UNSORTED)},setSorted:function(A){this.currentSort=A}};var RicoUtil={getElementsComputedStyle:function(D,A,B){if(arguments.length==2){B=A}var C=$(D);if(C.currentStyle){return C.currentStyle[A]}else{return document.defaultView.getComputedStyle(C,null).getPropertyValue(B)}},createXmlDocument:function(){if(document.implementation&&document.implementation.createDocument){var A=document.implementation.createDocument("","",null);if(A.readyState==null){A.readyState=1;A.addEventListener("load",function(){A.readyState=4;if(typeof A.onreadystatechange=="function"){A.onreadystatechange()}},false)}return A}if(window.ActiveXObject){return Try.these(function(){return new ActiveXObject("MSXML2.DomDocument")},function(){return new ActiveXObject("Microsoft.DomDocument")},function(){return new ActiveXObject("MSXML.DomDocument")},function(){return new ActiveXObject("MSXML3.DomDocument")})||false}return null},getContentAsString:function(A){return A.xml!=undefined?this._getContentAsStringIE(A):this._getContentAsStringMozilla(A)},_getContentAsStringIE:function(A){var C="";for(var B=0;B<A.childNodes.length;B++){var D=A.childNodes[B];if(D.nodeType==4){C+=D.nodeValue}else{C+=D.xml}}return C},_getContentAsStringMozilla:function(B){var A=new XMLSerializer();var D="";for(var C=0;C<B.childNodes.length;C++){var E=B.childNodes[C];if(E.nodeType==4){D+=E.nodeValue}else{D+=A.serializeToString(E)}}return D},toViewportPosition:function(A){return this._toAbsolute(A,true)},toDocumentPosition:function(A){return this._toAbsolute(A,false)},_toAbsolute:function(B,E){if(navigator.userAgent.toLowerCase().indexOf("msie")==-1){return this._toAbsoluteMozilla(B,E)}var A=0;var G=0;var D=B;while(D){var C=0;var F=0;if(D!=B){var C=parseInt(this.getElementsComputedStyle(D,"borderLeftWidth"));var F=parseInt(this.getElementsComputedStyle(D,"borderTopWidth"));C=isNaN(C)?0:C;F=isNaN(F)?0:F}A+=D.offsetLeft-D.scrollLeft+C;G+=D.offsetTop-D.scrollTop+F;D=D.offsetParent}if(E){A-=this.docScrollLeft();G-=this.docScrollTop()}return{x:A,y:G}},_toAbsoluteMozilla:function(B,D){var A=0;var E=0;var C=B;while(C){A+=C.offsetLeft;E+=C.offsetTop;C=C.offsetParent}C=B;while(C&&C!=document.body&&C!=document.documentElement){if(C.scrollLeft){A-=C.scrollLeft}if(C.scrollTop){E-=C.scrollTop}C=C.parentNode}if(D){A-=this.docScrollLeft();E-=this.docScrollTop()}return{x:A,y:E}},docScrollLeft:function(){if(window.pageXOffset){return window.pageXOffset}else{if(document.documentElement&&document.documentElement.scrollLeft){return document.documentElement.scrollLeft}else{if(document.body){return document.body.scrollLeft}else{return 0}}}},docScrollTop:function(){if(window.pageYOffset){return window.pageYOffset}else{if(document.documentElement&&document.documentElement.scrollTop){return document.documentElement.scrollTop}else{if(document.body){return document.body.scrollTop}else{return 0}}}}};