DragIndicator={init:function(A){},setContent:function(A,F,D){Element.clearChildren(this);
var C=DnD.getDnDDefaultParams(this);
if(!C){C={}
}if(D){Object.extend(C,D)
}if(!C["marker"]){if(C[A]){C["marker"]=C[A]
}else{C["marker"]=this.markers[A]
}}var B;
if(F){B=this.indicatorTemplates["single"]
}else{B=this.indicatorTemplates["multi"]
}new Insertion.Top(this,B.invoke("getContent",C).join(""))
},show:function(){if(!this.floatedToBody){if(!this.realParent){this.realParent=this.parentNode;
this._nextSibling=this.nextSibling
}this.realParent.removeChild(this);
document.body.appendChild(this);
this.floatedToBody=true
}Element.show(this);
this.style.position="absolute"
},hide:function(){Element.hide(this);
this.style.position="";
this.offsets=undefined;
this.leave();
if(this.floatedToBody&&this.realParent){document.body.removeChild(this);
if(this._nextSibling){this.realParent.insertBefore(this,this._nextSibling)
}else{this.realParent.appendChild(this)
}this.floatedToBody=false
}},position:function(A,B){if(!this.offsets){Element.show(this);
this.style.position="absolute"
}Element.setStyle(this,{"left":A+"px","top":B+"px"})
},accept:function(){Element.removeClassName(this,"drgind_default");
Element.removeClassName(this,"drgind_reject");
Element.addClassName(this,"drgind_accept");
var A=this.getAcceptClass();
if(A){Element.addClassName(this,A)
}},reject:function(){Element.removeClassName(this,"drgind_default");
Element.removeClassName(this,"drgind_accept");
Element.addClassName(this,"drgind_reject");
var A=this.getRejectClass();
if(A){Element.addClassName(this,A)
}},leave:function(){Element.removeClassName(this,"drgind_accept");
Element.removeClassName(this,"drgind_reject");
Element.addClassName(this,"drgind_default");
var B=this.getAcceptClass();
var A=this.getRejectClass();
if(B){Element.removeClassName(this,B)
}if(A){Element.removeClassName(this,A)
}},getAcceptClass:function(){return this.ils_acceptClass
},getRejectClass:function(){return this.ils_rejectClass
}};
function createDragIndicator(B,C,A){Object.extend(B,DragIndicator);
B.ils_acceptClass=C;
B.ils_rejectClass=A
}DefaultDragIndicatorView=[new E("table",{"style":"height : 100%","className":"drgind_internal","cellspacing":"0","cellpadding":"3","border":"0"},[new E("tbody",{},[new E("tr",{},[new E("td",{"className":"drgind_marker"},[new ET(function(context){return Richfaces.eval("marker",context)
})]),new E("td",{"className":"drgind_text"},[new E("div",{"className":"drgind_wordcut drgind_text_content"},[new ET(function(context){return Richfaces.eval("label",context)
})])])])])]),new E("div",{"className":"drgind_shadow"})]

DnD.SimpleDraggable=Class.create();
Object.extend(DnD.SimpleDraggable.prototype,DnD.Draggable.prototype);
Object.extend(DnD.SimpleDraggable.prototype,{initialize:function(B,A){this.id=$(B);
if(!this.id){alert("drag: Element with ["+B+"] ID was not found in the DOM tree. Probably element has no client ID or client ID hasn't been written. DnD's disabled. Check please!");
return 
}this.options=A;
this.dragIndicatorId=this.options.dragIndicator;
this.eventMouseDown=this.initDrag.bindAsEventListener(this);
Event.observe(this.id,"mousedown",this.eventMouseDown)
},getDnDDragParams:function(){if(this.options.dndParams){return this.options.dndParams.parseJSON(EventHandlersWalk)
}return null
},getIndicator:function(){var A=$(this.dragIndicatorId);
if(!A){A=this.getOrCreateDefaultIndicator()
}return A
},ondragstart:function(B,A){A.params=this.options.parameters;
A.params[this.id]=this.id;
this.setIndicator(B)
},getContentType:function(){return this.options.dragType
},getDraggableOptions:function(){return this.options
},initDrag:function(A){if(Event.isLeftClick(A)){var B=Event.element(A);
if(B.tagName&&(B.tagName.toUpperCase()=="INPUT"||B.tagName.toUpperCase()=="SELECT"||B.tagName.toUpperCase()=="OPTION"||B.tagName.toUpperCase()=="BUTTON"||B.tagName.toUpperCase()=="TEXTAREA")){return 
}Event.stop(A);
this.startDrag(A)
}}})

DnD.SimpleDropZone=Class.create();
Object.extend(DnD.SimpleDropZone.prototype,DnD.Dropzone.prototype);
Object.extend(DnD.SimpleDropZone.prototype,{initialize:function(C,A){this.id=C;
var B=$(C);
if(!B){alert("drop: Element with ["+C+"] ID was not found in the DOM tree. Probably element has no client ID or client ID hasn't been written. DnD's disabled. Check please!");
return 
}this.element=B;
if(A.acceptedTypes){this.acceptedTypes=A.acceptedTypes
}else{this.acceptedTypes=[]
}if(A.typeMapping){this.typeMapping=A.typeMapping
}else{this.typeMapping={}
}this.mouseoverBound=this.mouseover.bindAsEventListener(this);
this.mouseoutBound=this.mouseout.bindAsEventListener(this);
this.mouseupBound=this.mouseup.bindAsEventListener(this);
Event.observe(B,"mouseover",this.mouseoverBound);
Event.observe(B,"mouseout",this.mouseoutBound);
Event.observe(B,"mouseup",this.mouseupBound);
this.options=A||{}
},getDropzoneOptions:function(){return this.options
},getDnDDropParams:function(){if(this.options.dndParams){return this.options.dndParams.parseJSON(EventHandlersWalk)
}return null
},mouseover:function(A){if(window.drag){this.dragEnter(A)
}},mouseup:function(A){this.dragUp(A)
},mouseout:function(A){if(window.drag){this.dragLeave(A)
}},getAcceptedTypes:function(){return this.acceptedTypes
},getTypeMapping:function(){return this.typeMapping
},drop:function(B,A){alert("I drop")
},onafterdrag:function(A){if(this.options.onafterdrag){this.options.onafterdrag.call(this,A)
}}})

Richfaces.TreeSelectEvent="Richfaces.TreeSelectEvent";
Richfaces.TreeExpandEvent="Richfaces.TreeExpandEvent";
Richfaces.TreeCollapseEvent="Richfaces.TreeCollapseEvent";
Tree=Class.create();
Tree.ID_DEVIDER=":";
Tree.ID_CONTENT="content";
Tree.ID_CHILDS_ROW="childs";
Tree.ID_CHILDS_TD="td";
Tree.ID_HANDLE="handle";
Tree.ID_HANDLE_IMG_EXPANDED="img:expanded";
Tree.ID_HANDLE_IMG_COLLAPSED="img:collapsed";
Tree.ID_ICON="icon";
Tree.ID_TEXT="text";
Tree.ID_MAIN_ROW="mainRow";
Tree.CLASS_ITEM_SELECTED="dr-tree-i-sel";
Tree.CLASS_ITEM_EXPANDED="dr-tree-h-ic-line-exp";
Tree.CLASS_ITEM_COLLAPSED="dr-tree-h-ic-line-clp";
Tree.CLASS_AJAX_SELECTED_LISTENER_FLAG="ajax_selected_listener_flag";
Tree.prototype={initialize:function(H,A,E,D,C,G,F){this["rich:destructor"]="destroy";
this.childs=[];
this.elements={};
this.id=H;
this.switchType=E;
this.onselect=new Function("event",(D.onselect?D.onselect:"")+"; return true;");
this.onexpand=new Function("event",(D.onexpand?D.onexpand:"")+"; return true;");
this.oncollapse=new Function("event",(D.oncollapse?D.oncollapse:"")+"; return true;");
this.onAjaxSelect=C;
this.element=$(H);
this.element.component=this;
this.inputId=A;
this.input=$(this.inputId);
this.toggleOnClick=G;
this.showConnectingLines=F;
var B=Object.extend({columnCount:0},arguments[1]||{});
this.options=B;
this.getElements();
this.selectionManager=new Tree.SelectionManager(this);
this.selectionManager.restoreSelection();
Event.observe(this.element,"click",function(M){if(Richfaces.eventIsSynthetic(M)){var N=M["treeItem"];
if(M[Richfaces.TreeSelectEvent]){Event.stop(M);
var K=N.getRichAttribute("onselected");
K=new Function("event",(K?K:"")+"; return true;");
var O=this.selectionManager.activeItem;
N.toggleSelection(M);
var L=K(M);
if(!L){M["cancelSelection"]=true;
M["treeItem"]=O;
if(O){O.toggleSelection(M)
}return 
}L=this.onselect(M);
if(!L){M["cancelSelection"]=true;
M["treeItem"]=O;
if(O){O.toggleSelection(M)
}return 
}var I=Richfaces.getNSAttribute("ajaxselectedlistener",$(M.selectedNode+Tree.ID_DEVIDER+Tree.ID_ICON));
if(I){this.onAjaxSelect(M)
}}else{if(M[Richfaces.TreeExpandEvent]){Event.stop(M);
var J=N.getRichAttribute("onexpand");
if(J){new Function("event",J).call(Event.element(M),M)
}this.onexpand(M)
}else{if(M[Richfaces.TreeCollapseEvent]){Event.stop(M);
var J=N.getRichAttribute("oncollapse");
if(J){new Function("event",J).call(Event.element(M),M)
}this.oncollapse(M)
}}}}}.bindAsEventListener(this))
},destroy:function(){this.selectionManager.destroy();
this.element.component=null;
this.element=null
},getElements:function(B){this.elements.contentTd=$(this.id+Tree.ID_DEVIDER+Tree.ID_CHILDS_ROW);
if(this.elements.contentTd){for(var A=this.elements.contentTd.firstChild;
A!=null;
A=A.nextSibling){if(A.nodeType==1&&A.tagName.toLowerCase()=="table"){this.addChild(new Tree.Item(A,this,this,B))
}}}},addChild:function(A){this.childs.push(A)
},getNodeElements:function(B){if(B){for(var A=0;
A<B.length;
A++){var C=B[A];
if(C!=this.id){this._getNodeElements(this,C,C.substring(0,C.lastIndexOf(":")))
}else{for(var A=0;
A<this.childs.length;
A++){var D=this.childs[A];
D.destroy()
}this.childs=[];
this.getElements(true)
}}this.input=$(this.inputId);
this.selectionManager.restoreSelection()
}},_getNodeElements:function(D,E,A){for(var B=0;
B<D.childs.length;
B++){var G=D.childs[B];
var F=G.id;
if(F==E){G.destroy();
D.childs[B]=new Tree.Item(F,this,G.parent,true);
break
}else{var C=F.substring(0,F.lastIndexOf(":"));
if(A.substr(0,C.length)==C&&A.charAt(C.length)==":"){this._getNodeElements(G,E,A);
break
}}}},showNode:function(F){var D=F;
var C=0;
while(D&&Element.isChildOf(D,this.element)){C+=D.offsetTop;
D=D.offsetParent
}D=F;
var E=C+D.offsetHeight;
var A=this.element.scrollTop;
var B=A+this.element.clientHeight;
if(C<A){this.element.scrollTop=C
}else{if(E>B){this.element.scrollTop=E-this.element.clientHeight
}}},getElement:function(){return $(this.id)
}}

Tree.SelectionManager=Class.create();
Tree.SelectionManager.prototype={initialize:function(A){this.tree=A;
this.eventKeyDown=this.processKeyDown.bindAsEventListener(this);
Event.observe(document,"keydown",this.eventKeyDown);
this.eventLostFocus=this.processLostFocus.bindAsEventListener(this);
Event.observe(document,"click",this.eventLostFocus);
this.eventPreventLostFocus=this.processPreventLostFocus.bindAsEventListener(this);
Event.observe(this.tree.element,"click",this.eventPreventLostFocus)
},destroy:function(){this.activeItem=null;
this.tree=null;
Event.stopObserving(document,"keydown",this.eventKeyDown);
Event.stopObserving(document,"click",this.eventLostFocus)
},restoreSelection:function(){if(this.tree.input.value){var A=$(this.tree.input.value);
if(A){this.inFocus=true;
this.setSelection(A.object)
}}},processPreventLostFocus:function(A){if(Richfaces.eventIsSynthetic(A)){return 
}this.inFocus=true;
this.preventLostFocus=true
},processLostFocus:function(A){if(Richfaces.eventIsSynthetic(A)){return 
}if(!this.preventLostFocus){this.lostFocus()
}else{this.preventLostFocus=false
}},lostFocus:function(){this.inFocus=false
},setSelection:function(A){A.toggleSelection();
this.activeItem=A
},processKeyDown:function(E){if(!this.activeItem){return 
}if(!($(this.activeItem.id))){this.activeItem=null;
this.tree.input.value="";
return 
}var C=false;
var B=E.keyCode||E.charCode;
switch(B){case Event.KEY_UP:if(this.inFocus){if(!E.ctrlKey&&!E.shiftKey&&!E.altKey){var D=this.activeItem;
do{var A=this.getPreviousItemForSelection(D);
if(A&&A!=D){D=A;
if(D.toggleSelection(E)){this.activeItem=D;
D=null
}}else{D=null
}}while(D)
}C=true
}break;
case Event.KEY_DOWN:if(this.inFocus){if(!E.ctrlKey&&!E.shiftKey&&!E.altKey){var D=this.activeItem;
do{var A=this.getNextItemForSelection(D);
if(A&&A!=D){D=A;
if(D.toggleSelection(E)){this.activeItem=D;
D=null
}}else{D=null
}}while(D)
}C=true
}break;
case Event.KEY_LEFT:if(this.inFocus){if(!E.ctrlKey&&!E.shiftKey&&!E.altKey){this.activeItem.collapse()
}C=true
}break;
case Event.KEY_RIGHT:if(this.inFocus){if(!E.ctrlKey&&!E.shiftKey&&!E.altKey){this.activeItem.expand()
}C=true
}break;
case Event.KEY_TAB:this.lostFocus()
}if(C){if(E.preventBubble){E.preventBubble()
}Event.stop(E)
}},getNextItemForSelection:function(C){if(!C.isCollapsed()&&C.hasChilds()){return C.childs.first()
}else{var B=C.next();
if(B!=C){return B
}else{var A=C.parent;
while(A&&A!=this.tree){var B=A.next();
if(B!=A){return B
}else{A=A.parent
}}return C
}}},getPreviousItemForSelection:function(B){var A=B.previous();
if(A==B){if(A.parent==this.tree){A=B
}else{A=B.parent
}}else{if(!A.isCollapsed()&&A.hasChilds()){A=A.childs.last();
while(!A.isCollapsed()&&A.hasChilds()){A=A.childs.last()
}}}return A
}}

Tree.Item=Class.create();
Tree.Item.prototype={initialize:function(E,A,C,D){this.parent=C;
this.tree=A;
this.elements={};
this.elementID={};
var B;
if(typeof E=="string"){B=$(E);
this.id=E
}else{B=E;
this.id=B.id
}B.object=this;
this.elementID.children=this.id+Tree.ID_DEVIDER+Tree.ID_CHILDS_ROW;
this.elementID.mainRow=this.id+Tree.ID_DEVIDER+Tree.ID_MAIN_ROW;
this.elementID.handle=this.id+Tree.ID_DEVIDER+Tree.ID_HANDLE;
this.elementID.handleImgExpanded=this.elementID.handle+Tree.ID_DEVIDER+Tree.ID_HANDLE_IMG_EXPANDED;
this.elementID.handleImgCollapsed=this.elementID.handle+Tree.ID_DEVIDER+Tree.ID_HANDLE_IMG_COLLAPSED;
this.elementID.icon=this.id+Tree.ID_DEVIDER+Tree.ID_ICON;
this.elementID.text=this.id+Tree.ID_DEVIDER+Tree.ID_TEXT;
this.getElements(B,D);
this.eventSelectionClick=this.toggleSelection.bindAsEventListener(this);
this.eventMouseOut=this.processMouseOut.bindAsEventListener(this);
this.eventMouseOver=this.processMouseOver.bindAsEventListener(this);
this.observeEvents(B)
},destroy:function(){if(this.tree.selectionManager&&this==this.tree.selectionManager.activeItem){this.tree.selectionManager.activeItem=null
}for(var A=0;
A<this.childs.length;
A++){this.childs[A].destroy()
}this.childs=null
},observeEvents:function(D){var B=null;
var E=null;
if("NETSCAPE"==RichFaces.navigatorType()){B=$(this.elementID.icon);
E=$(this.elementID.text)
}else{var A=D.rows[0].cells;
B=A[this.elementID.icon];
E=A[this.elementID.text]
}if(B){var C=Richfaces.getNSAttribute("oncontextmenu",B);
if(C&&C.length>0){this.onContextMenu=new Function("event",C+"; return true;").bindAsEventListener(this)
}}if(B){Event.observe(B,"mousedown",this.eventSelectionClick);
Event.observe(B,"mouseout",this.eventMouseOut);
Event.observe(B,"mouseover",this.eventMouseOver);
if(this.onContextMenu){B.oncontextmenu=this.onContextMenu
}}if(E){Event.observe(E,"mousedown",this.eventSelectionClick);
Event.observe(E,"mouseout",this.eventMouseOut);
Event.observe(E,"mouseover",this.eventMouseOver);
if(this.onContextMenu){E.oncontextmenu=this.onContextMenu
}}if(this.tree.switchType=="client"&&this.childs.length>0){this.eventCollapsionClick=this.toggleCollapsion.bindAsEventListener(this);
var F=this.tree.toggleOnClick?this.elementID.mainRow:this.elementID.handle;
Event.observe(F,"click",this.eventCollapsionClick)
}},getElements:function(B,E){this.childs=[];
var C=B.nextSibling;
if(E&&this.tree.showConnectingLines){var A=B.rows[0].cells[0];
if(A.style&&A.style.removeExpression){A.style.backgroundImage=A.currentStyle.backgroundImage;
A.style.removeExpression("backgroundImage")
}if(C){if(C.style&&C.style.removeExpression){C.style.backgroundImage=C.currentStyle.backgroundImage;
C.style.removeExpression("backgroundImage")
}}}if(C){var D=C.firstChild;
while(D!=null){if(D.nodeType==1&&D.tagName.toLowerCase()=="table"){this.addChild(new Tree.Item(D,this.tree,this))
}D=D.nextSibling
}}},addChild:function(A){this.childs.push(A)
},fireExpansionEvent:function(){var A=new Object();
A[Richfaces.TreeExpandEvent]=true;
A["expandedNode"]=this.id;
A["treeItem"]=this;
Richfaces.createEvent("click",this.tree.element,null,A).fire()
},fireCollapsionEvent:function(){var A=new Object();
A[Richfaces.TreeCollapseEvent]=true;
A["collapsedNode"]=this.id;
A["treeItem"]=this;
Richfaces.createEvent("click",this.tree.element,null,A).fire()
},toggleCollapsion:function(){var D=this.id+Tree.ID_DEVIDER+Tree.ID_CHILDS_ROW;
if(this.hasChilds()){Element.toggle(D)
}var C=$(this.elementID.mainRow);
if(C){Element.hide(C);
Element.show(C)
}var B=$(this.id+"NodeExpanded");
var A=$(this.elementID.icon);
if(this.isCollapsed()){Element.hide(this.elementID.handleImgExpanded);
Element.show(this.elementID.handleImgCollapsed);
if(A&&Element.hasClassName(A,Tree.CLASS_ITEM_EXPANDED)){Element.removeClassName(A,Tree.CLASS_ITEM_EXPANDED);
Element.addClassName(A,Tree.CLASS_ITEM_COLLAPSED)
}if(B){B.value="false"
}this.fireCollapsionEvent()
}else{Element.show(this.elementID.handleImgExpanded);
Element.hide(this.elementID.handleImgCollapsed);
if(A&&Element.hasClassName(A,Tree.CLASS_ITEM_COLLAPSED)){Element.removeClassName(A,Tree.CLASS_ITEM_COLLAPSED);
Element.addClassName(A,Tree.CLASS_ITEM_EXPANDED)
}if(B){B.value="true"
}this.fireExpansionEvent()
}},getRichAttribute:function(A){return Richfaces.getNSAttribute(A,$(this.elementID.icon))
},collapse:function(){if(!this.isCollapsed()&&this.tree.switchType!="client"){var B=$(this.tree.toggleOnClick?this.elementID.mainRow:this.elementID.handle);
if(B){B.onclick()
}}if(this.hasChilds()&&!this.isCollapsed()){Element.hide(this.elementID.children);
Element.hide(this.elementID.handleImgExpanded);
Element.show(this.elementID.handleImgCollapsed);
var A=$(this.elementID.icon);
if(A&&Element.hasClassName(A,Tree.CLASS_ITEM_EXPANDED)){Element.removeClassName(A,Tree.CLASS_ITEM_EXPANDED);
Element.addClassName(A,Tree.CLASS_ITEM_COLLAPSED)
}}this.fireCollapsionEvent()
},expand:function(){if(this.isCollapsed()&&this.tree.switchType!="client"){var B=$(this.tree.toggleOnClick?this.elementID.mainRow:this.elementID.handle);
if(B){B.onclick()
}}if(this.hasChilds()&&this.isCollapsed()){Element.show(this.elementID.children);
Element.show(this.elementID.handleImgExpanded);
Element.hide(this.elementID.handleImgCollapsed);
var A=$(this.elementID.icon);
if(A&&Element.hasClassName(A,Tree.CLASS_ITEM_COLLAPSED)){Element.removeClassName(A,Tree.CLASS_ITEM_COLLAPSED);
Element.addClassName(A,Tree.CLASS_ITEM_EXPANDED)
}}this.fireExpansionEvent()
},isCollapsed:function(){var A=$(this.elementID.children);
if(A){return A.style.display=="none"
}else{return true
}},processMouseOut:function(C){if(this.isMouseIn){this.isMouseIn=false;
var B=$(this.elementID.text);
var E=Richfaces.getNSAttribute("highlightedclass",B);
if(E){var D=E.split(" ");
for(var A=0;
A<D.length;
A++){Element.removeClassName(B,D[A])
}if(window.drag){this.dragLeave(C)
}}}},processMouseOver:function(C){if(!this.isMouseIn){this.isMouseIn=true;
var B=$(this.elementID.text);
var E=Richfaces.getNSAttribute("highlightedclass",B);
if(E){var D=E.split(" ");
for(var A=0;
A<D.length;
A++){Element.addClassName(B,D[A])
}if(window.drag){this.dragEnter(C)
}}}},toggleSelection:function(G){if(G&&!G[Richfaces.TreeSelectEvent]&&!Richfaces.eventIsSynthetic(G)){if(G&&G.type=="mousedown"){if(Event.isLeftClick(G)){var A=Event.element(G);
if(A.tagName&&/^(input|select|option|button|textarea)$/i.test(A.tagName)){return 
}Event.stop(G)
}else{return 
}}var H=new Object();
H[Richfaces.TreeSelectEvent]=true;
H["originatingEventType"]=G.type;
H["treeItem"]=this;
H["selectedNode"]=this.id;
var I=Richfaces.createEvent("click",this.tree.element,null,H);
I.fire();
return !I.event["cancelSelection"]
}else{var E=this.tree.selectionManager.activeItem;
if(E){E.deselect()
}var F=$(this.elementID.text);
var C=Richfaces.getNSAttribute("selectedclass",F);
if(C){var B=C.split(" ");
for(var D=0;
D<B.length;
D++){Element.addClassName(F,B[D])
}this.tree.input.value=this.id;
this.tree.selectionManager.activeItem=this;
if(this.tree.options.onSelection){this.tree.options.onSelection(this.id)
}this.tree.showNode(F.parentNode);
if(G&&G["originatingEventType"]=="mousedown"){this.startDrag(G)
}}return true
}},isSelected:function(){return Element.hasClassName(this.elementID.text,Tree.CLASS_ITEM_SELECTED)
},deselect:function(){var B=$(this.elementID.text);
var D=Richfaces.getNSAttribute("selectedclass",B);
if(D){var C=D.split(" ");
for(var A=0;
A<C.length;
A++){Element.removeClassName(B,C[A])
}}},next:function(){var B=this.parent.childs;
for(var A=0;
A<B.length-1;
A++){if(B[A]==this){return B[A+1]
}}return this
},previous:function(){var B=this.parent.childs;
for(var A=1;
A<B.length;
A++){if(B[A]==this){return B[A-1]
}}return this
},hasChilds:function(){return this.childs.length>0
}}

Object.extend(Tree.Item.prototype,DnD.Dropzone.prototype);
Object.extend(Tree.Item.prototype,DnD.Draggable.prototype);
Object.extend(Tree.Item.prototype,{getAcceptedTypes:function(){var B=this.getDropzoneOptions();
if(B){var A=B["acceptedTypes"];
if(A){return A
}}return[]
},mergeParams:function(C){var A=C(this.tree.getElement());
var B=C(this.getElement());
if(A){if(B){Object.extend(A,B)
}return A
}else{return B
}},getDnDDefaultParams:function(){return this.mergeParams(DnD.getDnDDefaultParams)
},getDnDDragParams:function(){return this.mergeParams(DnD.getDnDDragParams)
},getDnDDropParams:function(){return this.mergeParams(DnD.getDnDDropParams)
},getDropzoneOptions:function(){var A=Richfaces.getNSAttribute("dropzoneoptions",$(this.elementID.icon));
if(A){return A.parseJSON(EventHandlersWalk)
}return null
},drop:function(C,A){A.params[DnD.Dropzone.DROP_TARGET_ID]=this.id;
var B=this.getDropzoneOptions();
if(B&&B.parameters){Object.extend(A.params,B.parameters)
}this.tree.drop.call(this,C,A)
},getIndicator:function(){var C=this.getDraggableOptions();
var B=C?C.dragIndicator:null;
var A=$(B);
if(!A){A=this.getOrCreateDefaultIndicator()
}return A
},ondragstart:function(C,A){A.params[this.id]=this.id;
var B=this.getDraggableOptions();
if(B&&B.parameters){Object.extend(A.params,B.parameters)
}this.dragEnter(C)
},ondragend:function(B,A){this.dragStarted=false
},getDraggableOptions:function(){if(window.drag&&window.drag.treeDraggableOptions){return window.drag.treeDraggableOptions
}var A=Richfaces.getNSAttribute("draggableoptions",$(this.elementID.icon));
if(A){var B=A.parseJSON(EventHandlersWalk);
if(window.drag){window.drag.treeDraggableOptions=B
}return B
}return null
},getContentType:function(){var A=this.getDraggableOptions();
if(A){return A["dragType"]
}return""
},getElement:function(){return $(this.elementID.text).parentNode
}})

if(!window.DW){window.DW={}
}if(!window.Richfaces){window.Richfaces={}
}function discardElement(A){var B=document.getElementById("IELeakGarbageBin");
if(!B){B=document.createElement("DIV");
B.id="IELeakGarbageBin";
B.style.display="none";
document.body.appendChild(B)
}window.RichFaces.Memory.clean(A);
B.appendChild(A);
B.innerHTML=""
}ModalPanel=Class.create();
var searchString="MSIE";
var agent=navigator.userAgent;
var idx=agent.indexOf(searchString);
if(idx!=-1){var versIdx=agent.indexOf(";",idx);
var versString;
if(versIdx!=-1){versString=agent.substring(idx+searchString.length,versIdx)
}else{versString=agent.substring(idx+searchString.length)
}if(parseFloat(versString)<7){ModalPanel.disableSelects=true
}}ModalPanel.panels=new Array();
function getSizeElement(){var A;
if(RichFaces.navigatorType()!="OPERA"&&document.compatMode=="CSS1Compat"){A=document.documentElement
}else{A=document.body
}return A
}ModalPanel.prototype={initialize:function(E,B){this["rich:destructor"]="destroy";
this.markerId=$(E);
this.id=$(E+"Container");
this.options=B;
this.baseZIndex=this.options.zindex?this.options.zindex:100;
this.minWidth=Math.max(this.options.minWidth,2*ModalPanel.Sizer.INITIAL_MIN+2);
this.minHeight=Math.max(this.options.minHeight,2*ModalPanel.Sizer.INITIAL_MIN+2);
this.div=E+"Div";
this.cursorDiv=E+"CursorDiv";
this.cdiv=E+"CDiv";
this.contentDiv=E+"ContentDiv";
this.contentTable=E+"ContentTable";
this.shadowDiv=E+"ShadowDiv";
this.borders=new Array();
if(this.options.resizeable){this.borders.push(new ModalPanel.Border(E+"ResizerNWU",this,"NW-resize",ModalPanel.Sizer.NWU));
this.borders.push(new ModalPanel.Border(E+"ResizerN",this,"N-resize",ModalPanel.Sizer.N));
this.borders.push(new ModalPanel.Border(E+"ResizerNEU",this,"NE-resize",ModalPanel.Sizer.NEU));
this.borders.push(new ModalPanel.Border(E+"ResizerNEL",this,"NE-resize",ModalPanel.Sizer.NEL));
this.borders.push(new ModalPanel.Border(E+"ResizerE",this,"E-resize",ModalPanel.Sizer.E));
this.borders.push(new ModalPanel.Border(E+"ResizerSEU",this,"SE-resize",ModalPanel.Sizer.SEU));
this.borders.push(new ModalPanel.Border(E+"ResizerSEL",this,"SE-resize",ModalPanel.Sizer.SEL));
this.borders.push(new ModalPanel.Border(E+"ResizerS",this,"S-resize",ModalPanel.Sizer.S));
this.borders.push(new ModalPanel.Border(E+"ResizerSWL",this,"SW-resize",ModalPanel.Sizer.SWL));
this.borders.push(new ModalPanel.Border(E+"ResizerSWU",this,"SW-resize",ModalPanel.Sizer.SWU));
this.borders.push(new ModalPanel.Border(E+"ResizerW",this,"W-resize",ModalPanel.Sizer.W));
this.borders.push(new ModalPanel.Border(E+"ResizerNWL",this,"NW-resize",ModalPanel.Sizer.NWL))
}if(this.options.moveable&&$(E+"Header")){this.header=new ModalPanel.Border(E+"Header",this,"move",ModalPanel.Header)
}this.markerId.component=this;
var A=$(this.div);
if(A.style.setExpression){if(ModalPanel.disableSelects||Richfaces.getComputedStyle(A,"position")!="fixed"){A.style.position="absolute";
var C=$(this.cursorDiv);
C.style.position="absolute";
A.style.width="1px";
A.style.height="1px";
C.style.width="1px";
C.style.height="1px";
var D=$(this.cdiv);
D.style.position="absolute";
D.mpUseExpr=true
}}if(this.options.onshow&&this.options.onshow!=""){this.eventOnShow=new Function("event",this.options.onshow).bindAsEventListener(this)
}if(this.options.onhide&&this.options.onhide!=""){this.eventOnHide=new Function("event",this.options.onhide).bindAsEventListener(this)
}ModalPanel.panels.push(this);
this.eventFirstOnfocus=this.firstOnfocus.bindAsEventListener(this);
this.eventLastOnfocus=this.lastOnfocus.bindAsEventListener(this);
this.firstHref=E+"FirstHref";
this.lastHref=E+"LastHref";
this.selectBehavior=B.selectBehavior
},width:function(){return this.getContentElement().offsetWidth
},height:function(){return this.getContentElement().offsetHeight
},getContentElement:function(){if(!this._sizedElement){this._sizedElement=this.options.autosized?$(this.contentTable):$(this.contentDiv)
}return this._sizedElement
},destroy:function(){this._sizedElement=null;
ModalPanel.panels=ModalPanel.panels.without(this);
this.traverseSelects(true);
this.parent=null;
this.firstOutside=null;
this.lastOutside=null;
if(this.header){this.header.destroy();
this.header=null
}for(var A=0;
A<this.borders.length;
A++){this.borders[A].destroy()
}this.borders=null;
setTimeout(function(){if(this.floatedToBody){var B=this.id;
var C=B.parentNode;
if(C){C.removeChild(B);
discardElement(B)
}}}.bind(this),0);
this.markerId.component=null;
this.markerId=null
},initIframe:function(){if(this.contentWindow){Element.setStyle(this.contentWindow.document.body,{"margin":"0px 0px 0px 0px"})
}else{}if("transparent"==Element.getStyle(document.body,"background-color")){this.style.filter="alpha(opacity=0)";
this.style.opacity="0"
}},traverseSelects:function(C){if(!ModalPanel.disableSelects){return 
}var F=document.body.childNodes;
for(var A=0;
A<F.length;
A++){var G=F[A];
if(G!=this.id&&G.getElementsByTagName){var E=G.getElementsByTagName("SELECT");
for(var D=0;
D<E.length;
D++){var B=E[D];
if(this.selectBehavior&&"hide"==this.selectBehavior){if(C){if(B._mdwCount){B._mdwCount-=1;
if(B._mdwCount==0){if(B._mdwHidden){Element.setStyle(B,{"visibility":B._mdwHidden});
B._mdwHidden=undefined
}else{Element.setStyle(B,{"visibility":""})
}B._mdwCount=undefined
}}}else{if(B._mdwCount){B._mdwCount+=1
}else{if(B.style.visibility&&""!=B.style.visibility){B._mdwHidden=B.style.visibility
}Element.setStyle(B,{"visibility":"hidden"});
B._mdwCount=1
}}}else{if(C){if(B._mdwCount){B._mdwCount-=1;
if(B._mdwCount==0){if(B._mdwDisabled){B._mdwDisabled=undefined
}else{B.disabled=false
}B._mdwCount=undefined
}}}else{if(B._mdwCount){B._mdwCount+=1
}else{if(B.disabled){B._mdwDisabled=true
}else{B.disabled=true
}B._mdwCount=1
}}}}}}},setLeft:function(B){var A=$(this.cdiv);
if(A.mpUseExpr){A.mpLeft=B
}else{A.style.left=B+"px"
}},setTop:function(B){var A=$(this.cdiv);
if(A.mpUseExpr){A.mpTop=B
}else{A.style.top=B+"px"
}},firstOnfocus:function(A){var B=$(this.firstHref);
if(B){B.focus()
}},lastOnfocus:function(A){var B=$(this.lastHref);
if(B){B.focus()
}},processAllFocusElements:function(A,C){if(A.focus&&/^(?:a|input|select|button|textarea)$/i.test(A.tagName)&&!A.disabled&&!/^hidden$/.test(A.type)&&Element.visible(A)){C.call(this,A)
}else{if(A!=this.id){var B=A.firstChild;
while(B){if(!B.style||Element.visible(B)){this.processAllFocusElements(B,C)
}B=B.nextSibling
}}}},processTabindexes:function(A){if(!this.firstOutside&&!(/^select$/i.test(A.tagName)&&ModalPanel.disableSelects)){this.firstOutside=A
}this.lastOutside=A;
if(A.tabIndex){A.prevTabIndex=A.tabIndex
}A.tabIndex=undefined;
if(A.accesskey){A.prevAccesskey=A.accesskey
}A.accesskey=undefined
},restoreTabindexes:function(A){if(A.prevTabIndex){A.tabIndex=A.prevTabIndex
}if(A.prevAccesskey){A.accesskey=A.prevAccesskey
}},preventFocus:function(){this.processAllFocusElements(document,this.processTabindexes);
if(this.firstOutside){Event.observe(this.firstOutside,"focus",this.eventFirstOnfocus)
}if(this.lastOutside&&this.lastOutside!=this.firstOutside){Event.observe(this.lastOutside,"focus",this.eventLastOnfocus)
}},restoreFocus:function(){this.processAllFocusElements(document,this.restoreTabindexes);
if(this.firstOutside){Event.stopObserving(this.firstOutside,"focus",this.eventFirstOnfocus);
this.firstOutside=null
}if(this.lastOutside){Event.stopObserving(this.lastOutside,"focus",this.eventLastOnfocus);
this.lastOutside=null
}},show:function(S,N){this.preventFocus();
var A=this.id;
if(!this.floatedToBody){this.parent=A.parentNode;
document.body.insertBefore(this.parent.removeChild(A),null);
this.floatedToBody=true
}var V=$(this.cdiv);
var E=V.getElementsByTagName("form");
if(this.options.keepVisualState&&E){this.formOnsubmit=this.setStateInput.bindAsEventListener(this);
for(var T=0;
T<E.length;
T++){Event.observe(E[T],"submit",this.formOnsubmit)
}}var I;
if(ModalPanel.disableSelects&&!this.iframe){this.iframe=this.id.id+"IFrame";
new Insertion.Top(V,'<iframe src="javascript:\'\'" frameborder="0" scrolling="no" id="'+this.iframe+'" style="position: absolute; width: 1px; height: 1px; background-color: white; overflow-y: hidden; z-index: 1;"></iframe>');
I=$(this.iframe);
Event.observe(I,"load",this.initIframe.bindAsEventListener(I))
}var D={};
this.userOptions={};
if(!V.mpSet){Object.extend(D,this.options)
}if(N){Object.extend(D,N);
Object.extend(this.userOptions,N)
}var C=this.getContentElement();
var F=$(this.shadowDiv);
if(!this.options.autosized){if(D.width&&D.width==-1){D.width=300
}if(D.height&&D.height==-1){D.height=200
}}if(D.width&&D.width!=-1){if(this.minWidth>D.width){D.width=this.minWidth
}if(I){I.style.width=D.width+(/px/.test(D.width)?"":"px")
}C.style.width=D.width+(/px/.test(D.width)?"":"px");
F.style.width=D.width+(/px/.test(D.width)?"":"px")
}if(D.height&&D.height!=-1){if(this.minHeight>D.height){D.height=this.minHeight
}if(I){I.style.height=D.height+(/px/.test(D.height)?"":"px")
}C.style.height=D.height+(/px/.test(D.height)?"":"px");
F.style.height=D.height+(/px/.test(D.height)?"":"px")
}V.mpSet=true;
this.traverseSelects();
var W=$(this.div);
if(W.style.position=="absolute"){var L='getSizeElement().clientWidth + "px"';
var H='getSizeElement().clientHeight + "px"';
W.style.setExpression("width",L);
W.style.setExpression("height",H);
var M=$(this.cursorDiv);
M.style.setExpression("width",L);
M.style.setExpression("height",H);
var P='-Position.cumulativeOffset(this.parentNode)[0] + getSizeElement().scrollLeft + "px"';
var K='-Position.cumulativeOffset(this.parentNode)[1] + getSizeElement().scrollTop + "px"';
W.style.setExpression("left",P);
W.style.setExpression("top",K);
M.style.setExpression("left",P);
M.style.setExpression("top",K);
var J='(this.mpLeft || 0) + -Position.cumulativeOffset(this.parentNode)[0] + getSizeElement().scrollLeft + "px"';
var O='(this.mpTop || 0) + -Position.cumulativeOffset(this.parentNode)[1] + getSizeElement().scrollTop + "px"';
V.style.setExpression("left",J);
V.style.setExpression("top",O)
}A.style.visibility="hidden";
Element.show(A);
if(D.left){var U;
if(D.left!="auto"){U=parseInt(D.left,10)
}else{var B=getSizeElement().clientWidth;
var G=this.width();
if(B>=G){U=(B-G)/2
}else{U=0
}}this.setLeft(U)
}if(D.top){var R;
if(D.top!="auto"){R=parseInt(D.top,10)
}else{var B=getSizeElement().clientHeight;
var X=this.height();
if(B>=X){R=(B-X)/2
}else{R=0
}}this.setTop(R)
}if(this.options.autosized){this.observerSize=window.setInterval(this.correctShadowSize.bindAsEventListener(this),500)
}this.doResizeOrMove(ModalPanel.Sizer.Diff.EMPTY);
for(var Q=0;
Q<this.borders.length;
Q++){this.borders[Q].doPosition()
}if(this.header){this.header.doPosition()
}Element.hide(V);
A.style.visibility="";
Element.show(V);
this.lastOnfocus();
var S={};
S.parameters=N||{};
if(this.eventOnShow){this.eventOnShow(S)
}this.shown=true
},startDrag:function(B){for(var A=0;
A<this.borders.length;
A++){}},endDrag:function(B){for(var A=0;
A<this.borders.length;
A++){this.borders[A].doPosition()
}},hide:function(G,F){this.restoreFocus();
this.traverseSelects(true);
var A=$(this.div);
var H=$(this.cdiv);
if(A.style.removeExpression){A.style.removeExpression("width");
A.style.removeExpression("height");
A.style.removeExpression("left");
A.style.removeExpression("top");
var E=$(this.cursorDiv);
E.style.removeExpression("width");
E.style.removeExpression("height");
E.style.removeExpression("left");
E.style.removeExpression("top");
H.style.removeExpression("left");
H.style.removeExpression("top")
}var D=this.id;
Element.hide(D);
if(this.floatedToBody&&this.parent){document.body.removeChild(D);
this.parent.appendChild(D);
this.floatedToBody=false
}var G={};
G.parameters=F||{};
if(this.eventOnHide){this.eventOnHide(G)
}var B=H.getElementsByTagName("form");
if(this.options.keepVisualState&&B){for(var C=0;
C<B.length;
C++){Event.stopObserving(B[C],"submit",this.formOnsubmit)
}}this.shown=false;
if(this.options.autosized){window.clearInterval(this.observerSize)
}},_getStyle:function(B,A){return parseInt(B.style[A].replace("px",""),10)
},doResizeOrMove:function(M){var B={};
var I={};
var C={};
var G=false;
var F;
var L=this.getContentElement();
var D=$(this.shadowDiv);
if(RichFaces.navigatorType()!="OPERA"){F=Richfaces.getComputedStyleSize(L,"width")
}else{F=this._getStyle(L,"width")
}var A=F;
F+=M.deltaWidth||0;
if(F>=this.minWidth||this.options.autosized){if(M.deltaWidth){C.width=F+"px"
}}else{if(M.deltaWidth){C.width=this.minWidth+"px";
B.vx=A-this.minWidth
}B.x=true
}if(B.vx&&M.deltaX){M.deltaX=-B.vx
}var K=$(this.cdiv);
if(M.deltaX&&(B.vx||!B.x)){if(B.vx){M.deltaX=B.vx
}var H;
H=this._getStyle(K,"left");
H+=M.deltaX;
I.left=H+"px"
}if(RichFaces.navigatorType()!="OPERA"){F=Richfaces.getComputedStyleSize(L,"height")
}else{F=this._getStyle(L,"height")
}var A=F;
F+=M.deltaHeight||0;
if(F>=this.minHeight||this.options.autosized){if(M.deltaHeight){C.height=F+"px"
}}else{if(M.deltaHeight){C.height=this.minHeight+"px";
B.vy=A-this.minHeight
}B.y=true
}if(B.vy&&M.deltaY){M.deltaY=-B.vy
}if(M.deltaY&&(B.vy||!B.y)){if(B.vy){M.deltaY=B.vy
}var H;
if(K.mpUseExpr){H=K.mpTop||0;
H+=M.deltaY;
K.mpTop=H;
I.top=H+"px"
}else{H=this._getStyle(K,"top");
H+=M.deltaY;
I.top=H+"px"
}}Element.setStyle(K,I);
Element.setStyle(L,C);
this.correctShadowSize();
if(this.iframe){Element.setStyle($(this.iframe),C)
}Object.extend(this.userOptions,I);
Object.extend(this.userOptions,C);
var J=this.width();
var E=this.height();
this.reductionData=null;
if(J<=2*ModalPanel.Sizer.INITIAL_MAX){this.reductionData={};
this.reductionData.w=J
}if(E<=2*ModalPanel.Sizer.INITIAL_MAX){if(!this.reductionData){this.reductionData={}
}this.reductionData.h=E
}if(this.header){this.header.doPosition()
}return B
},setStateInput:function(E){var D=Event.element(E);
if(E&&D){var A=document.createElement("input");
A.type="hidden";
A.id=this.id.id+"OpenedState";
A.name=this.id.id+"OpenedState";
A.value=this.shown?"true":"false";
D.appendChild(A);
var C=$H(this.userOptions).keys();
if(C){for(var B=0;
B<C.length;
B++){A=document.createElement("input");
A.type="hidden";
A.id=this.id.id+"StateOption_"+C[B];
A.name=this.id.id+"StateOption_"+C[B];
A.value=this.userOptions[C[B]];
D.appendChild(A)
}}return true
}},correctShadowSize:function(G){var E=$(this.shadowDiv);
if(!E){return 
}var D=$(this.iframe);
var C=0;
var B=0;
if(!Richfaces.browser.isIE){C=E.offsetWidth-E.clientWidth;
B=E.offsetHeight-E.clientHeight
}var A=this.width();
var F=this.height();
E.style.width=(A-C)+"px";
E.style.height=(F-B)+"px";
if(D){D.style.width=A+"px";
D.style.height=F+"px"
}}};
Richfaces.findModalPanel=function(F){if(F){var D=(F.charAt(0)==":"?F:":"+F);
for(var B=0;
B<ModalPanel.panels.length;
B++){var A=ModalPanel.panels[B];
if(A&&A.markerId){var E=A.markerId.id;
if(E){if(E.length>=D.length){var C=E.substring(E.length-D.length,E.length);
if(C==D){return A.markerId
}}}}}}};
Richfaces.showModalPanel=function(E,D,C){var B=("MSIE"==RichFaces.navigatorType())?function(H){if(document.readyState!="complete"){var G=arguments;
var F=this;
window.setTimeout(function(){G.callee.apply(F,G)
},50)
}else{H()
}}:function(F){F()
};
var A=$(E);
if(!A){A=Richfaces.findModalPanel(E)
}B(function(){A.component.show(C,D)
})
};
Richfaces.hideModalPanel=function(D,C,B){var A=$(D);
if(!A){A=Richfaces.findModalPanel(D)
}A.component.hide(B,C)
}

ModalPanel.Border=Class.create();
ModalPanel.Border.prototype={initialize:function(E,C,D,B){this.id=E;
var A=$(E);
A.style.cursor=D;
Event.observe($(E),"mousedown",this.startDrag.bindAsEventListener(this));
this.modalPanel=C;
this.sizer=B;
this.boundDoDrag=this.doDrag.bindAsEventListener(this);
this.boundEndDrag=this.endDrag.bindAsEventListener(this)
},destroy:function(){this.modalPanel=null
},show:function(){Element.show(this.id)
},hide:function(){Element.hide(this.id)
},startDrag:function(B){this.doingDrag=true;
this.dragX=B.clientX;
this.dragY=B.clientY;
Event.observe(document,"mousemove",this.boundDoDrag);
Event.observe(document,"mouseup",this.boundEndDrag);
var A=$(this.modalPanel.cursorDiv);
A.style.cursor=$(this.id).style.cursor;
A.style.zIndex=8;
this.modalPanel.startDrag(this);
this.onselectStartHandler=document.onselectstart;
document.onselectstart=function(){return false
}
},doDrag:function(G){if(!this.doingDrag){return 
}var F=G.clientX;
var E=G.clientY;
var C=Richfaces.getWindowSize();
if(F<0){F=0
}else{if(F>=C.width){F=C.width-1
}}if(E<0){E=0
}else{if(E>=C.height){E=C.height-1
}}var B=F-this.dragX;
var A=E-this.dragY;
if(B!=0||A!=0){var H=this.sizer.doDiff(B,A);
var D=this.modalPanel.doResizeOrMove(H);
if(!D.x){this.dragX=F
}else{if(!H.deltaX){this.dragX-=D.vx||0
}else{this.dragX+=D.vx||0
}}if(!D.y){this.dragY=E
}else{if(!H.deltaY){this.dragY-=D.vy||0
}else{this.dragY+=D.vy||0
}}}},endDrag:function(A){this.doingDrag=undefined;
Event.stopObserving(document,"mousemove",this.boundDoDrag);
Event.stopObserving(document,"mouseup",this.boundEndDrag);
this.modalPanel.endDrag(this);
this.modalPanel.doResizeOrMove(ModalPanel.Sizer.Diff.EMPTY);
$(this.modalPanel.cursorDiv).style.zIndex=-200;
document.onselectstart=this.onselectStartHandler;
this.onselectStartHandler=null
},doPosition:function(){this.sizer.doPosition(this.modalPanel,$(this.id))
}};
ModalPanel.Sizer=Class.create();
ModalPanel.Sizer.INITIAL_MIN=4;
ModalPanel.Sizer.INITIAL_MAX=40;
ModalPanel.Sizer.Diff=Class.create();
ModalPanel.Sizer.Diff.prototype={initialize:function(C,A,B,D){this.deltaX=C;
this.deltaY=A;
this.deltaWidth=B;
this.deltaHeight=D
}};
ModalPanel.Sizer.Diff.EMPTY=new ModalPanel.Sizer.Diff(0,0,0,0);
ModalPanel.Sizer.prototype={initialize:function(){},doSetupSize:function(E,B){var C=0;
var A=0;
var D=E.reductionData;
if(D){if(D.w){C=D.w/2
}if(D.h){A=D.h/2
}}if(C>0){if(B.clientWidth>C){if(!B.reducedWidth){B.reducedWidth=B.style.width
}B.style.width=C+"px"
}else{if(C<ModalPanel.Sizer.INITIAL_MAX&&B.reducedWidth==ModalPanel.Sizer.INITIAL_MAX+"px"){B.style.width=C+"px"
}}}else{if(B.reducedWidth){B.style.width=B.reducedWidth;
B.reducedWidth=undefined
}}if(A>0){if(B.clientHeight>A){if(!B.reducedHeight){B.reducedHeight=B.style.height
}B.style.height=A+"px"
}else{if(A<ModalPanel.Sizer.INITIAL_MAX&&B.reducedHeight==ModalPanel.Sizer.INITIAL_MAX+"px"){B.style.height=A+"px"
}}}else{if(B.reducedHeight){B.style.height=B.reducedHeight;
B.reducedHeight=undefined
}}},doSetupPosition:function(D,A,C,B){A.style.left=C+"px";
A.style.top=B+"px"
},doPosition:function(B,A){},doDiff:function(B,A){}};
ModalPanel.Sizer.NWU=Object.extend(new ModalPanel.Sizer(),{doPosition:function(B,A){this.doSetupSize(B,A);
this.doSetupPosition(B,A,0,0)
},doDiff:function(B,A){return new ModalPanel.Sizer.Diff(B,A,-B,-A)
}});
ModalPanel.Sizer.N=new ModalPanel.Sizer();
ModalPanel.Sizer.N.doPosition=function(B,A){A.style.width=B.width()+"px";
this.doSetupPosition(B,A,0,0)
};
ModalPanel.Sizer.N.doDiff=function(B,A){return new ModalPanel.Sizer.Diff(0,A,0,-A)
};
ModalPanel.Sizer.NEU=new ModalPanel.Sizer();
ModalPanel.Sizer.NEU.doPosition=function(B,A){this.doSetupSize(B,A);
this.doSetupPosition(B,A,B.width()-A.clientWidth,0)
};
ModalPanel.Sizer.NEU.doDiff=function(B,A){return new ModalPanel.Sizer.Diff(0,A,B,-A)
};
ModalPanel.Sizer.NEL=new ModalPanel.Sizer();
ModalPanel.Sizer.NEL.doPosition=function(B,A){this.doSetupSize(B,A);
this.doSetupPosition(B,A,B.width()-A.clientWidth,0)
};
ModalPanel.Sizer.NEL.doDiff=function(B,A){return new ModalPanel.Sizer.Diff(0,A,B,-A)
};
ModalPanel.Sizer.E=new ModalPanel.Sizer();
ModalPanel.Sizer.E.doPosition=function(B,A){A.style.height=B.height()+"px";
this.doSetupPosition(B,A,B.width()-A.clientWidth,0)
};
ModalPanel.Sizer.E.doDiff=function(B,A){return new ModalPanel.Sizer.Diff(0,0,B,0)
};
ModalPanel.Sizer.SEU=new ModalPanel.Sizer();
ModalPanel.Sizer.SEU.doPosition=function(B,A){this.doSetupSize(B,A);
this.doSetupPosition(B,A,B.width()-A.clientWidth,B.height()-A.clientHeight)
};
ModalPanel.Sizer.SEU.doDiff=function(B,A){return new ModalPanel.Sizer.Diff(0,0,B,A)
};
ModalPanel.Sizer.SEL=new ModalPanel.Sizer();
ModalPanel.Sizer.SEL.doPosition=function(B,A){this.doSetupSize(B,A);
this.doSetupPosition(B,A,B.width()-A.clientWidth,B.height()-A.clientHeight)
};
ModalPanel.Sizer.SEL.doDiff=function(B,A){return new ModalPanel.Sizer.Diff(0,0,B,A)
};
ModalPanel.Sizer.S=new ModalPanel.Sizer();
ModalPanel.Sizer.S.doPosition=function(B,A){A.style.width=B.width()+"px";
this.doSetupPosition(B,A,0,B.height()-A.clientHeight)
};
ModalPanel.Sizer.S.doDiff=function(B,A){return new ModalPanel.Sizer.Diff(0,0,0,A)
};
ModalPanel.Sizer.SWL=new ModalPanel.Sizer();
ModalPanel.Sizer.SWL.doPosition=function(B,A){this.doSetupSize(B,A);
this.doSetupPosition(B,A,0,B.height()-A.clientHeight)
};
ModalPanel.Sizer.SWL.doDiff=function(B,A){return new ModalPanel.Sizer.Diff(B,0,-B,A)
};
ModalPanel.Sizer.SWU=new ModalPanel.Sizer();
ModalPanel.Sizer.SWU.doPosition=function(B,A){this.doSetupSize(B,A);
this.doSetupPosition(B,A,0,B.height()-A.clientHeight)
};
ModalPanel.Sizer.SWU.doDiff=function(B,A){return new ModalPanel.Sizer.Diff(B,0,-B,A)
};
ModalPanel.Sizer.W=new ModalPanel.Sizer();
ModalPanel.Sizer.W.doPosition=function(B,A){A.style.height=B.height()+"px";
this.doSetupPosition(B,A,0,0)
};
ModalPanel.Sizer.W.doDiff=function(B,A){return new ModalPanel.Sizer.Diff(B,0,-B,0)
};
ModalPanel.Sizer.NWL=new ModalPanel.Sizer();
ModalPanel.Sizer.NWL.doPosition=function(B,A){this.doSetupSize(B,A);
this.doSetupPosition(B,A,0,0)
};
ModalPanel.Sizer.NWL.doDiff=function(B,A){return new ModalPanel.Sizer.Diff(B,A,-B,-A)
};
ModalPanel.Header=new ModalPanel.Sizer();
ModalPanel.Header.doPosition=function(B,A){};
ModalPanel.Header.doDiff=function(B,A){return new ModalPanel.Sizer.Diff(B,A,0,0)
}

Object.extend(Event,{_domReady:function(){var A=arguments.callee;
if(!A.done){A.done=true;
Event._readyCallbacks.each(function(B){B()
});
Event._readyCallbacks=null;
if(Event._timer){clearInterval(Event._timer)
}Event.stopObserving(window,"load",A)
}},onReady:function(B){var A=this._domReady;
if(A.done){return B()
}if(!this._readyCallbacks){this._readyCallbacks=[];
this._timer=setInterval(function(){if(/loaded|complete/.test(document.readyState)){A()
}},10);
this.observe(window,"load",A)
}this._readyCallbacks.push(B)
}});
Array.prototype.remove=function(B){var A=this.indexOf(B,0,this.length);
if(A==-1){return 
}if(A==0){this.shift()
}else{this.splice(A,1)
}}

if(!window.Richfaces){window.Richfaces={}
}Richfaces.getExternalClass=function(C,B){if(C){var A=C.length;
while(B>=A){B-=A
}return(C[B])?C[B]:""
}return""
};
Richfaces.SelectItem=Class.create();
Richfaces.SelectItem.prototype={initialize:function(A,C,B){this._label=A;
this._node=B;
this._node.item=this;
this._id=C;
this.input=$(B.id+"StateInput");
this.selected=/^s/.test(this.input.value);
this.active=/^s?a/.test(this.input.value)
},destroy:function(){this._node.item=null
},doActive:function(E,C){var B=this.CLASSES;
var F=this._node;
var A=B.ROW.ACTIVE;
var D=B.CELL.ACTIVE;
if(this.isSelected()){A=B.ROW.SELECTED+" "+B.ROW.ACTIVE;
D=B.CELL.SELECTED+" "+B.CELL.ACTIVE
}this.changeClass(F,A,D,E,C);
this.active=true;
this.saveState()
},doSelect:function(C,B){var D=this._node;
var A=this.CLASSES;
this.changeClass(D,A.ROW.SELECTED,A.CELL.SELECTED,C,B);
this.selected=true;
this.saveState()
},doNormal:function(C,B){var D=this._node;
var A=this.CLASSES;
this.changeClass(D,A.ROW.NORMAL,A.CELL.NORMAL,C,B);
this.active=false;
this.selected=false;
this.saveState()
},isSelected:function(){return this.selected
},isActive:function(){return this.active
},changeClass:function(H,G,E,F,D){H.className=F+" "+G;
var B=H.cells;
for(var C=0;
C<B.length;
C++){var A=B[C];
A.className=Richfaces.getExternalClass(D,A.cellIndex)+" "+E
}},saveState:function(){var A=/^s?a?/;
if(this.selected&&this.active){this.input.value=this.input.value.replace(A,"sa")
}else{if(this.selected){this.input.value=this.input.value.replace(A,"s")
}else{if(this.active){this.input.value=this.input.value.replace(A,"a")
}else{this.input.value=this.input.value.replace(A,"")
}}}}}

LayoutManager=function(A,B){this.headerTable=$(A);
this.contentTable=$(B);
this.headerDiv=(this.headerTable)?this.headerTable.parentNode:null;
this.contentDiv=this.contentTable.parentNode;
Event.observe(this.contentDiv,"scroll",this.scrollHandler.bindAsEventListener(this))
};
LayoutManager.SCROLL_WIDTH=17;
LayoutManager.STYLE_CONTENTTD_BORDER=1;
LayoutManager.STYLE_CONTENTTD_PADDING=4;
LayoutManager.prototype.widthSynchronization=function(){var E=this.contentTable.tBodies[0].rows;
if(E&&E[0]){var G=E[0].cells;
if(!this.headerTable||!this.headerTable.tHead){return 
}var B=this.headerTable.tHead.rows[0].cells;
var D;
for(var C=0;
C<G.length;
C++){var F=G[C];
var A=B[C];
D=LayoutManager.calculateWidth(F,A).colWidth;
if(C==G.length-1){D=D+this.getScrollWidth()
}A.firstChild.style.width=D+"px";
A.style.width=D+"px"
}}else{if(this.headerTable&&this.headerTable.tHead){this.headerTable.style.width="100%"
}}};
LayoutManager.prototype.getScrollWidth=function(){if(this.contentDiv.clientWidth!=0){return this.contentDiv.offsetWidth-this.contentDiv.clientWidth
}return 0
};
LayoutManager.prototype.scrollHandler=function(){if(this.headerDiv){this.headerDiv.scrollLeft=this.contentDiv.scrollLeft
}};
LayoutManager.getHeaderWidth=function(A,B){return B.offsetWidth+(A.offsetWidth-A.clientWidth)
};
LayoutManager.isIE=function(){return(/MSIE/.test(navigator.userAgent)&&!window.opera)
};
LayoutManager.getElemXY=function(C){var A=C.offsetLeft;
var D=C.offsetTop;
for(var B=C.offsetParent;
B;
B=B.offsetParent){A+=B.offsetLeft;
D+=B.offsetTop
}return{left:A,top:D}
};
LayoutManager.calculateWidth=function(G,B){var H=LayoutManager.getBorderWidth(G,"lr");
var J=LayoutManager.getPaddingWidth(G,"lr");
var E=LayoutManager.getMarginWidth(G,"lr");
var C=LayoutManager.getBorderWidth(B,"lr");
var I=LayoutManager.getPaddingWidth(B,"lr");
var A=LayoutManager.getMarginWidth(B,"lr");
var D=G.offsetWidth-H-J-E;
var F=D+(H-C)+(J-I)+(E-A);
F=(F>0)?F:0;
return{srcWidth:D,colWidth:F}
};
LayoutManager.getBorderWidth=function(B,A){return LayoutManager.getStyles(B,A,LayoutManager.borders)
};
LayoutManager.getPaddingWidth=function(B,A){return LayoutManager.getStyles(B,A,LayoutManager.paddings)
};
LayoutManager.getMarginWidth=function(B,A){return LayoutManager.getStyles(B,A,LayoutManager.margins)
};
LayoutManager.getStyles=function(D,F,E){var G=0;
for(var C=0,A=F.length;
C<A;
C++){var B=parseInt(Element.getStyle(D,E[F.charAt(C)]),10);
if(!isNaN(B)){G+=B
}}return G
};
LayoutManager.borders={l:"border-left-width",r:"border-right-width",t:"border-top-width",b:"border-bottom-width"},LayoutManager.paddings={l:"padding-left",r:"padding-right",t:"padding-top",b:"padding-bottom"},LayoutManager.margins={l:"margin-left",r:"margin-right",t:"margin-top",b:"margin-bottom"}

Control=Class.create();
Control.eventStub=function(){return false
};
Control.onfocus=function(A){A.hasFocus=true
};
Control.onblur=function(A){A.hasFocus=undefined
};
Control.prototype.initialize=function(A,E,D,B,C){this.disabledNode=E;
this.disabledNode.onselectstart=Control.eventStub;
this.enabledNode=A;
this.enabledNode.onselectstart=Control.eventStub;
this.isShown=D;
this.isEnabled=B;
this.action=C
};
Control.prototype.doShow=function(){this.isShown=true;
if(this.isEnabled){this.doHideNode(this.disabledNode);
this.doShowNode(this.enabledNode)
}else{this.doHideNode(this.enabledNode);
this.doShowNode(this.disabledNode)
}};
Control.prototype.doHide=function(){this.isShown=false;
this.doHideNode(this.disabledNode);
this.doHideNode(this.enabledNode)
};
Control.prototype.doEnable=function(){this.isEnabled=true;
this.doHideNode(this.disabledNode);
this.doShowNode(this.enabledNode)
};
Control.prototype.doDisable=function(){this.isEnabled=false;
var B=this.enabledNode.select("a[id='"+this.enabledNode.id+"link']");
var C=undefined;
if(B&&B[0]){var D=B[0];
if(D.hasFocus){var A=this.disabledNode.select("a[id='"+this.disabledNode.id+"link']");
if(A&&A[0]){C=A[0]
}}}this.doHideNode(this.enabledNode);
this.doShowNode(this.disabledNode);
if(C&&C.focus){C.disabled=false;
C.focus();
C.disabled=true
}};
Control.prototype.doHideNode=function(A){A.hide()
};
Control.prototype.doShowNode=function(A){A.show()
}

if(!window.Richfaces){window.Richfaces={}
}Richfaces.disableSelectionText=function(B){B=window.event||B;
if(B.srcElement){if(B.srcElement.tagName){var A=B.srcElement.tagName.toUpperCase();
if(A!="INPUT"&&A!="TEXTAREA"){return false
}}}};
Richfaces.ListBase=Class.create();
Richfaces.ListBase.compare=function(B,A){return((B==A)?0:((B<A)?-1:1))
};
Richfaces.ListBase.ORDERING_LIST_CLASSES={normal:"rich-ordering-list-items",disabled:"rich-ordering-list-disabled",active:"rich-ordering-list-active"};
Richfaces.ListBase.ASC="acs";
Richfaces.ListBase.DESC="desc";
Richfaces.ListBase.CONTROL_SET=["A","INPUT","TEXTAREA","SELECT","OPTION","BUTTON"];
Richfaces.ListBase.prototype={initialize:function(C,H,D,B,G,F,A,E){this["rich:destructor"]="destroy";
this.selectedItems=new Array();
this.container=$(C);
this.shuttleTable=$(H);
this.shuttleTable.onselectstart=Richfaces.disableSelectionText;
this.focusKeeper=$(B);
this.focusKeeper.focused=false;
this.focusKeeper.observe("keydown",(function(I){this.onkeydownHandler(window.event||I)
}).bindAsEventListener(this));
this.focusKeeper.observe("blur",function(I){this.focusListener(I)
}.bindAsEventListener(this));
this.focusKeeper.observe("focus",function(I){this.onfocusHandler(I)
}.bindAsEventListener(this));
this.shuttleTbody=this.shuttleTable.tBodies[0];
this.activeItem=null;
this.pseudoActiveItem=null;
this.items=null;
this.rowClasses=E;
this.columnsClasses=A;
this.retrieveShuttleItems(C,F);
this.shuttle=null;
this.sortOrder=Richfaces.ListBase.ASC;
this.clckHandler=function(I){this.onclickHandler(window.event||I)
}.bindAsEventListener(this);
this.shuttleTable.observe("click",this.clckHandler)
},destroy:function(){this.shuttleTable.onselectstart=null;
var A=this.shuttleItems;
for(var B=0;
B<A.length;
B++){A[B].destroy()
}},setActiveItem:function(A){this.pseudoActiveItem=A;
this.activeItem=A
},retrieveShuttleItems:function(A,F){var D=this.shuttleTbody.rows;
this.shuttleItems=new Array();
var G;
for(var B=0;
B<D.length;
B++){var E=D[B];
G=E.id.split(A+":")[1];
var C=new F(null,(G||B),E);
if(C.isSelected()){this.selectedItems.push(E)
}if(C.isActive()){this.setActiveItem(E)
}this.shuttleItems[B]=C
}},getExtremeItem:function(A){var D=this.selectedItems[0];
var C;
for(var B=1;
B<this.selectedItems.length;
B++){C=this.selectedItems[B];
if(A=="first"){if(C.rowIndex<D.rowIndex){D=C
}}else{if(C.rowIndex>D.rowIndex){D=C
}}}return D
},getEventTargetRow:function(A){var B;
if(A.rangeParent){B=A.target
}else{B=A.srcElement
}if(B==null){return 
}if(B.tagName&&Richfaces.ListBase.CONTROL_SET.indexOf(B.tagName.toUpperCase())!=-1){return 
}while(B.tagName.toLowerCase()!="tr"){B=B.parentNode;
if(!B.tagName){return 
}}return B
},onfocusHandler:function(A){if(!this.activeItem&&this.shuttleItems.length!=0){this.setActiveItem(this.shuttleItems[0]._node)
}if(this.activeItem){this.activeItem.item.doActive(this.getExtRowClass(this.activeItem.rowIndex),this.columnsClasses)
}},onclickHandler:function(A){if(A.srcElement&&(A.srcElement.tagName.toLowerCase()=="tbody")){return 
}var B=this.getEventTargetRow(A);
if(B!=null){if(A.ctrlKey){this.addSelectedItem(B);
this.setActiveItem(B)
}else{if(A.shiftKey){this.selectItemGroup(B);
this.activeItem=B
}else{this.selectionItem(B);
this.setActiveItem(B)
}}this.setFocus()
}},onkeydownHandler:function(A){var B=null;
switch(A.keyCode){case 38:B="up";
this.moveActiveItem(B,A);
break;
case 40:B="down";
this.moveActiveItem(B,A);
break;
case 65:if(A.ctrlKey){this.selectAll();
Event.stop(A)
}this.activeItem.item.doActive(this.getExtRowClass(this.activeItem.rowIndex),this.columnsClasses);
break
}},moveActiveItem:function(D,B){var A=this.activeItem;
var C=this.shuttleTbody.rows;
if((D=="up")&&(A.rowIndex>0)){this.changeActiveItems(C[A.rowIndex-1],A)
}else{if((D=="down")&&(A.rowIndex<this.shuttleItems.length-1)){this.changeActiveItems(C[A.rowIndex+1],A)
}}this.autoScrolling(D,B)
},changeActiveItems:function(A,B){B.item.doNormal();
this.resetMarked();
A.item.doSelect(this.getExtRowClass(A.rowIndex),this.columnsClasses);
A.item.doActive(this.getExtRowClass(A.rowIndex),this.columnsClasses);
this.setActiveItem(A);
this.selectedItems.push(A)
},selectAll:function(){this.resetMarked();
var B=0;
var A=this.shuttleItems.length-1;
this.selectItemRange(B,A)
},selectionItem:function(B){var A=B;
this.resetMarked();
if(B.item.isSelected()){B.item.doNormal(this.getExtRowClass(B.rowIndex),this.columnsClasses)
}else{B.item.doSelect(this.getExtRowClass(B.rowIndex),this.columnsClasses);
this.selectedItems[0]=A
}},addSelectedItem:function(B){var A=B;
if(B.item.isSelected()){this.selectedItems.remove(A);
B.item.doNormal(this.getExtRowClass(B.rowIndex),this.columnsClasses)
}else{B.item.doSelect(this.getExtRowClass(B.rowIndex),this.columnsClasses);
this.selectedItems.push(A)
}if((this.activeItem!=null)&&(this.activeItem.rowIndex!=B.rowIndex)){if(this.activeItem.item.isSelected()){this.activeItem.item.doSelect(this.getExtRowClass(this.activeItem.rowIndex),this.columnsClasses)
}else{this.activeItem.item.doNormal(this.getExtRowClass(this.activeItem.rowIndex),this.columnsClasses)
}}},selectItemGroup:function(B){var A=this.pseudoActiveItem.rowIndex;
var D;
var C;
if(B.rowIndex>A){D=A;
C=B.rowIndex
}else{D=B.rowIndex;
C=A
}this.resetMarked();
this.selectItemRange(D,C)
},selectItemRange:function(D,C){var B=this.shuttleTbody.rows;
for(var A=D;
A<=C;
A++){B[A].item.doSelect(this.getExtRowClass(B[A].rowIndex),this.columnsClasses);
this.selectedItems.push(B[A])
}},resetMarked:function(){var C=this.selectedItems;
var B=C.length;
for(var A=0;
A<B;
A++){var D=C[A];
D.item.doNormal(this.getExtRowClass(D.rowIndex),this.columnsClasses)
}this.selectedItems.length=0
},getSelectItemByNode:function(C){for(var A=0;
A<this.shuttleItems.length;
A++){var B=this.shuttleItems[A];
if(C.rowIndex==B._node.rowIndex){return B
}}return null
},autoScrolling:function(G,F){this.selectedItems.sort(this.compareByRowIndex);
var A;
var H=this.shuttleTable.parentNode.scrollTop;
var B=LayoutManager.getElemXY(this.shuttleTable.parentNode).top;
if(G=="up"||G=="first"){var C=LayoutManager.getElemXY(this.selectedItems[0]).top;
A=(C-H)-B;
if(A<0){this.shuttleTable.parentNode.scrollTop+=A
}}else{if(G=="down"||G=="last"){var E=this.selectedItems[this.selectedItems.length-1];
var D=LayoutManager.getElemXY(this.selectedItems[this.selectedItems.length-1]).top+E.offsetHeight;
var A=(D-H)-(B+this.shuttleTable.parentNode.clientHeight);
if(A>0){this.shuttleTable.parentNode.scrollTop+=A
}}}Event.stop(F)
},setFocus:function(){this.focusKeeper.focus();
this.focusKeeper.focused=true
},focusListener:function(A){A=A||window.event;
this.focusKeeper.focused=false;
if(this.activeItem){if(this.activeItem.item.isSelected()){this.activeItem.item.doSelect(this.getExtRowClass(this.activeItem.rowIndex),this.columnsClasses)
}else{this.activeItem.item.doNormal(this.getExtRowClass(this.activeItem.rowIndex),this.columnsClasses)
}}},compareByLabel:function(B,A){B=B._label;
A=A._label;
return Richfaces.ListBase.compare(B,A)
},compareByRowIndex:function(B,A){B=B.rowIndex;
A=A.rowIndex;
return Richfaces.ListBase.compare(B,A)
},isListActive:function(){if((this.activeItem!=null||this.selectedItems.length!=0)&&this.focusKeeper.focused){return true
}return false
},getExtRowClass:function(A){return Richfaces.getExternalClass(this.rowClasses,A)
}}

if(!window.Richfaces){window.Richfaces={}
}Richfaces.OrderingListSelectItem=Class.create(Richfaces.SelectItem);
Richfaces.OrderingListSelectItem.prototype.CLASSES={ROW:{ACTIVE:"rich-ordering-list-row-active",SELECTED:"rich-ordering-list-row-selected",DISABLED:"rich-ordering-list-row-disabled",NORMAL:"rich-ordering-list-row"},CELL:{ACTIVE:"rich-ordering-list-cell-active",SELECTED:"rich-ordering-list-cell-selected",DISABLED:"rich-ordering-list-cell-disabled",NORMAL:"rich-ordering-list-cell",BEGIN:" rich-ordering-list-cell-first",END:" rich-ordering-list-cell-last"}},Richfaces.OrderingList=Class.create(Richfaces.ListBase,{initialize:function($super,F,H,D,G,A,E,I,J,B,C){$super(F,H,D,G,E,J,B,C);
this.container.component=this;
if(I){this.container.observe("rich:onorderchanged",I)
}this.controlList=new Array();
this.initControlList(F,A)
},destroy:function($super){$super();
this.container.component=null
},initControlList:function(A,D){for(var C=0;
C<D.length;
C++){var F=D[C];
var E=$(A+F[0]);
var B=$(A+F[1]);
if(E&&B){E.observe("click",Richfaces.OrderingList.HANDLERS[F[0]].bindAsEventListener(this));
this.controlList[C]=new Control(E,B,false,false,F[0])
}}},controlListManager:function(){this.selectedItems.sort(this.compareByRowIndex);
var A;
this.controlsProcessing(["first","last","down","up"],"enable");
if((this.shuttleItems.length==0)||(this.selectedItems.length==0)){this.controlsProcessing(["first","last","down","up"],"disable")
}else{if(this.selectedItems[0].rowIndex==0){this.controlsProcessing(["first","up"],"disable")
}if(this.selectedItems[this.selectedItems.length-1].rowIndex==(this.shuttleItems.length-1)){this.controlsProcessing(["down","last"],"disable")
}}},controlsProcessing:function(C,B){for(var A=0;
A<this.controlList.length;
A++){control=this.controlList[A];
if(control!=null){if(C!=null&&C.indexOf(control.action)!=-1){if(B=="disable"){control.doDisable()
}else{control.doEnable()
}}}}},onclickHandler:function($super,A){$super(A);
this.controlListManager()
},moveActiveItem:function($super,B,A){$super(B,A);
this.controlListManager()
},moveSelectedItems:function(F,D){D=window.event||D;
var E=this.shuttleTbody.rows;
var C;
if(this.selectedItems.length>0){this.selectedItems.sort(this.compareByRowIndex);
if((F=="up")&&this.getExtremeItem("first").previousSibling){for(var A=0;
A<this.selectedItems.length;
A++){C=this.selectedItems[A];
C.parentNode.insertBefore(C,C.previousSibling)
}}else{if((F=="down")&&this.getExtremeItem("last").nextSibling){for(var A=this.selectedItems.length-1;
A>-1;
A--){C=this.selectedItems[A];
C.parentNode.insertBefore(C.nextSibling,C)
}}else{if(F=="first"){var G=this.selectedItems[0].rowIndex;
for(var A=0;
A<this.selectedItems.length;
A++){C=this.selectedItems[A];
C.parentNode.insertBefore(C,E[C.rowIndex-G])
}}else{if(F=="last"){var B=this.shuttleItems.length;
var G=B-this.selectedItems[this.selectedItems.length-1].rowIndex;
for(var A=this.selectedItems.length-1;
A>-1;
A--){C=this.selectedItems[A];
if(C.rowIndex+G>B-1){C.parentNode.insertBefore(C,null)
}else{C.parentNode.insertBefore(C,E[C.rowIndex+G])
}}}}}}this.shuttleItems=new Array();
for(var A=0;
A<E.length;
A++){this.shuttleItems.push(E[A].item)
}if(F!=null){this.autoScrolling(F,D)
}this.container.fire("rich:onorderchanged",{});
this.controlListManager()
}},onkeydownHandler:function(A){var B=null;
switch(A.keyCode){case 34:B="last";
this.moveSelectedItems(B,A);
break;
case 33:B="first";
this.moveSelectedItems(B,A);
break;
case 38:B="up";
if(A.ctrlKey){this.moveSelectedItems(B,A)
}else{this.moveActiveItem(B,A)
}break;
case 40:B="down";
if(A.ctrlKey){this.moveSelectedItems(B,A)
}else{this.moveActiveItem(B,A)
}break;
case 65:if(A.ctrlKey){this.selectAll();
Event.stop(A)
}this.activeItem.item.doActive(this.getExtRowClass(this.activeItem.rowIndex),this.columnsClasses);
this.controlListManager();
break
}}});
Richfaces.OrderingList.ACTIVITY_MARKER="a";
Richfaces.OrderingList.SELECTION_MARKER="s";
Richfaces.OrderingList.ITEM_SEPARATOR=",";
Richfaces.OrderingList.HANDLERS={first:function(A){this.moveSelectedItems("first",A);
return false
},last:function(A){this.moveSelectedItems("last",A);
return false
},up:function(A){this.moveSelectedItems("up",A);
return false
},down:function(A){this.moveSelectedItems("down",A);
return false
}}

if(!window.Richfaces){window.Richfaces={}
}Richfaces.ListShuttle=Class.create();
Richfaces.ListShuttle.Source=Class.create(Richfaces.ListBase);
Richfaces.ListShuttle.Target=Class.create(Richfaces.OrderingList);
Richfaces.ListShuttle.Source.SelectItem=Class.create(Richfaces.SelectItem);
Richfaces.ListShuttle.Source.SelectItem.prototype.CLASSES={ROW:{ACTIVE:"rich-shuttle-source-row-active",SELECTED:"rich-shuttle-source-row-selected",DISABLED:"rich-shuttle-source-row-disabled",NORMAL:"rich-shuttle-source-row"},CELL:{ACTIVE:"rich-shuttle-source-cell-active",SELECTED:"rich-shuttle-source-cell-selected",DISABLED:"rich-shuttle-source-cell-disabled",NORMAL:"rich-shuttle-source-cell",BEGIN:" rich-shuttle-source-cell-first",END:" rich-shuttle-source-cell-last"}};
Richfaces.ListShuttle.Target.SelectItem=Class.create(Richfaces.SelectItem);
Richfaces.ListShuttle.Target.SelectItem.prototype.CLASSES={ROW:{ACTIVE:"rich-shuttle-target-row-active",SELECTED:"rich-shuttle-target-row-selected",DISABLED:"rich-shuttle-target-row-disabled",NORMAL:"rich-shuttle-target-row"},CELL:{ACTIVE:"rich-shuttle-target-cell-active",SELECTED:"rich-shuttle-target-cell-selected",DISABLED:"rich-shuttle-target-cell-disabled",NORMAL:"rich-shuttle-target-cell",BEGIN:" rich-shuttle-target-cell-first",END:" rich-shuttle-target-cell-last"}};
Richfaces.ListShuttle.prototype={initialize:function(H,F,A,E,G,B,D,C){this.containerId=A;
this["rich:destructor"]="destroy";
this.container=$(this.containerId);
this.container.component=this;
this.targetList=H;
this.sourceList=F;
this.targetLayoutManager=D;
this.sourceLayoutManager=B;
if(G=="true"){this.targetList.shuttleTable.observe("click",function(I){this.moveItemByClick(window.event||I,this.targetList,this.sourceList)
}.bindAsEventListener(this));
this.sourceList.shuttleTable.observe("click",function(I){this.moveItemByClick(window.event||I,this.sourceList,this.targetList)
}.bindAsEventListener(this));
Event.stopObserving(this.sourceList.shuttleTable,"click",this.sourceList.clckHandler);
Event.stopObserving(this.targetList.shuttleTable,"click",this.targetList.clckHandler)
}else{this.targetList.shuttleTable.observe("dblclick",function(I){this.moveItemByClick(window.event||I,this.targetList,this.sourceList)
}.bindAsEventListener(this));
this.sourceList.shuttleTable.observe("dblclick",function(I){this.moveItemByClick(window.event||I,this.sourceList,this.targetList)
}.bindAsEventListener(this));
F._onclickHandler=F.onclickHandler;
F.onclickHandler=function(I){this.onclickHandler(I,F)
}.bindAsEventListener(this);
H._onclickHandler=H.onclickHandler;
H.onclickHandler=function(I){this.onclickHandler(I,H)
}.bindAsEventListener(this)
}F._onkeydownHandler=F.onkeydownHandler;
F.onkeydownHandler=function(I){this.onkeydownHandler(I,F)
}.bindAsEventListener(this);
H._onkeydownHandler=H.onkeydownHandler;
H.onkeydownHandler=function(I){this.onkeydownHandler(I,H)
}.bindAsEventListener(this);
this.controlList=new Array();
this.initControlList(A,E);
if(C){this.targetList.container.observe("rich:onorderchanged",C);
this.container.observe("rich:onlistchanged",C)
}},destroy:function(){this.container.component=null;
this.targetList.destroy();
this.sourceList.destroy()
},initControlList:function(A,D){for(var C=0;
C<D.length;
C++){var F=D[C];
var E=$(A+F[0]);
var B=$(A+F[1]);
if(E&&B){E.observe("click",Richfaces.ListShuttle.HANDLERS[F[0]].bindAsEventListener(this));
this.controlList[C]=new Control(E,B,false,false,F[0])
}}},controlListManager:function(){this.controlsProcessing(["copy","copyAll","removeAll","remove"],"enable");
if(this.sourceList.shuttleItems.length<1){this.controlsProcessing(["copy","copyAll"],"disable")
}if(this.sourceList.selectedItems.length<1){this.controlsProcessing(["copy"],"disable")
}if(this.targetList.shuttleItems.length<1){this.controlsProcessing(["removeAll","remove"],"disable")
}if(this.targetList.selectedItems.length<1){this.controlsProcessing(["remove"],"disable")
}},onclickHandler:function(B,A){A._onclickHandler(B);
this.controlListManager();
Event.stop(B)
},onkeydownHandler:function(B,A){A._onkeydownHandler(B);
this.controlListManager();
if(B.keyCode!=Event.KEY_TAB){Event.stop(B)
}},controlsProcessing:function(C,B){for(var A=0;
A<this.controlList.length;
A++){control=this.controlList[A];
if(control!=null){if(C!=null&&C.indexOf(control.action)!=-1){if(B=="disable"){control.doDisable()
}else{control.doEnable()
}}}}},moveItems:function(E,F,A){if(A.length>0){var D=A.length;
for(var B=0;
A.length>0;
){var C=A[B];
this.moveItem(E,F,C)
}this.controlListManager();
this.targetList.controlListManager();
this.targetLayoutManager.widthSynchronization();
this.sourceLayoutManager.widthSynchronization();
this.container.fire("rich:onlistchanged",{})
}},moveItem:function(C,D,B){if(!(B instanceof Richfaces.SelectItem)){B=C.getSelectItemByNode(B)
}if(!LayoutManager.isIE()&&(D.shuttleTbody.rows.length==0)){var A=null;
if(B instanceof Richfaces.ListShuttle.Target.SelectItem){A=new Richfaces.ListShuttle.Target.SelectItem(B._label,B._id,B._node.cloneNode(true))
}else{A=new Richfaces.ListShuttle.Source.SelectItem(B._label,B._id,B._node.cloneNode(true))
}this.tableUpdate(D);
this.addItem(D,A);
this.removeItem(C,B);
C.shuttleTable.deleteRow(B._node.rowIndex)
}else{this.addItem(D,B);
this.removeItem(C,B)
}},removeItem:function(B,C){var A=B.shuttleItems;
B.selectedItems.remove(C._node);
A.remove(C);
if(C==B.activeItem){B.activeItem==null
}},addItem:function(A,B){B.doNormal(Richfaces.getExternalClass(B.rowIndex),A.columnsClasses);
A.shuttleTbody.insertBefore(B._node,null);
A.shuttleItems.push(B)
},tableUpdate:function(B){var D=B.shuttleTable;
var A=D.tBodies[0];
var C=A.cloneNode(false);
D.removeChild(A);
D.appendChild(C);
B.shuttleTbody=D.tBodies[0]
},moveItemByClick:function(D,C,E,A){var B=this.sourceList.getEventTargetRow(D);
if(!B){return 
}this.moveItem(C,E,B);
this.controlListManager();
this.targetList.controlListManager();
this.targetLayoutManager.widthSynchronization();
this.sourceLayoutManager.widthSynchronization();
this.container.fire("rich:onlistchanged",{})
}};
Richfaces.ListShuttle.HANDLERS={copy:function(A){this.moveItems(this.sourceList,this.targetList,this.sourceList.selectedItems);
return false
},copyAll:function(A){this.moveItems(this.sourceList,this.targetList,this.sourceList.shuttleItems);
return false
},remove:function(A){this.moveItems(this.targetList,this.sourceList,this.targetList.selectedItems);
return false
},removeAll:function(A){this.moveItems(this.targetList,this.sourceList,this.targetList.shuttleItems);
return false
}}

if(!window.Richfaces){window.Richfaces={}
}if(!Richfaces.componentControl){Richfaces.componentControl={}
}Richfaces.componentControl.eachComponent=function(A,B){jQuery(A).each(function(){if(this.component){B(this.component)
}})
};
Richfaces.componentControl.applyDecorations=function(B,A,C){if(C){C(B)
}Richfaces.componentControl.eachComponent(A,function(D){if(D.applyDecoration){D.applyDecoration(B)
}})
};
Richfaces.componentControl.attachEvent=function(C,F,B,A,E,D){jQuery(C).bind(Richfaces.effectEventOnOut(F),function(G){Richfaces.componentControl.performOperation(G,B,A,E,D)
}).each(function(){Richfaces.componentControl.applyDecorations(this,B,function(G){})
})
};
Richfaces.componentControl.performOperation=function(D,B,A,E,C){Richfaces.componentControl.eachComponent(B,function(F){F[A](D,E)
});
if(C){Event.stop(D)
}};
Richfaces.effectEventOnOut=function(A){return A.substr(0,2)=="on"?A.substr(2):A
}

function __addLoadEvent(A){Event.observe(window,"load",A)
}function __addUnLoadEvent(A){Event.observe(window,"unload",A)
}function __initGmapdiv(C,D,A){var B=document.getElementById(D);
if(GBrowserIsCompatible()){window[C]=new GMap2(B);
B.map=window[C]
}else{B.innerHTML=A
}}function __applyGmapparam(H,F,G,J,A,D,K,C,E,L,B,I){if(GBrowserIsCompatible()){window[H].setCenter(new GLatLng(F,G),J,A);
if(D){window[H].enableDragging()
}else{window[H].disableDragging()
}if(K){window[H].enableInfoWindow()
}else{window[H].disableInfoWindow()
}if(C){window[H].enableDoubleClickZoom()
}else{window[H].disableDoubleClickZoom()
}if(E){window[H].enableContinuousZoom()
}else{window[H].disableContinuousZoom()
}if(L){window[H].addControl(new GMapTypeControl())
}if(B){window[H].addControl(new GScaleControl())
}if(I){window[H].addControl(new GLargeMapControl())
}}}
if(!window.Richfaces){window.Richfaces={}
}Richfaces.processEffect=function(A){new Effect[A.type]($(A.targetId),A)
};
Richfaces.effectEventOnOut=function(A){return A.substr(0,2)=="on"?A.substr(2):A
}

if(!window.Richfaces){window.Richfaces={}
}Richfaces.Slider=Class.create();
Richfaces.Slider.prototype={initialize:function(C,B,E,G,H,I){var A=this;
this.handle=$(C);
this.tip=$(E);
this.track=$(B);
this.mainTable=$(G);
this.input=$(I.inputId)||document.getElementsByName(I.inputId)[0];
this.options=I||{};
this.classes={};
this.classes.arrow="dr-insldr-handler rich-inslider-handler";
this.classes.arrowSelected="dr-insldr-handler-sel rich-inslider-handler-selected";
this.classes.temp=this.handle.className;
this.classes.base=" "+this.trim(this.classes.temp.replace("dr-insldr-handler rich-inslider-handler",""));
this.classes.handleSelected=" "+H;
this.table=this.findTableForTrack(this.track);
this.input.value=this.options.sliderValue;
this.prevInputValue=this.input.value;
this.graggedImageOn=false;
this.range=this.options.range||$R(0,1);
this.value=0;
this.minimum=this.options.minimum||this.range.start;
this.maximum=this.options.maximum||this.range.end;
this.digCount=0;
this.step=this.options.step;
if((this.step+"").indexOf(".")!=-1){var F=(this.step+"");
this.digCount=(F.substring(F.indexOf(".")+1,F.length)).length
}this.availableValues=this.calculateAvailableValues();
this.tip.maxlength=(this.maximum+"").length+(this.digCount!=0?this.digCount+1:0);
this.handleLength=9;
this.active=false;
this.dragging=false;
this.editInFocus=false;
this.disabled=this.options.disabled?true:false;
var D=this.track.childNodes[0];
this.prevMouseUp=window.document.onmouseup;
this.prevMouseMove=window.document.onmousemove;
this.documentBodyOload=this.load.bindAsEventListener(this);
Event.observe(window,"load",this.documentBodyOload);
this.eventWindowResized=this.windowResized.bindAsEventListener(this);
Event.observe(window,"resize",this.eventWindowResized);
if(!this.options.disabled){this.eventMouseUp=this.processMouseUp.bindAsEventListener(this);
this.eventMouseMove=this.update.bindAsEventListener(this);
this.eventMouseDown=this.startDrag.bindAsEventListener(this);
this.eventEditFocus=this.editFocus.bindAsEventListener(this);
this.eventEditBlur=this.editBlur.bindAsEventListener(this);
this.eventEditChange=this.editChange.bindAsEventListener(this);
this.eventEditValidate=this.inputValidate.bindAsEventListener(this);
this.eventInputChange=this.inputChange.bindAsEventListener(this);
this.eventWindowMouseOut=this.windowMouseOut.bindAsEventListener(this);
if(this.options.onerr!=""){this.eventError=new Function(this.options.onerr).bindAsEventListener(this)
}if(this.options.onchange!=""){this.eventChanged=new Function("event",this.options.onchange).bindAsEventListener(this)
}Event.observe(this.track,"mousedown",this.eventMouseDown);
Event.observe(D,"mousedown",this.eventMouseDown);
Event.observe(this.input,"keydown",this.eventEditValidate);
Event.observe(this.input,"keyup",this.eventEditChange);
Event.observe(this.input,"focus",this.eventEditFocus);
Event.observe(this.input,"blur",this.eventEditBlur);
Event.observe(document,"mouseout",this.eventWindowMouseOut);
if(this.input.onchange){this.eventInputOnChange=this.input.onchange.bindAsEventListener(this.input);
this.input.onchange=null
}Event.observe(this.input,"change",this.eventInputChange)
}this.initialized=true;
this.setInitialValue();
this.required=I.required
},setInitialValue:function(){this.setValue(parseFloat(this.options.sliderValue||this.range.start));
this.handle.style.visibility="visible";
this.prevValue=this.value;
this.valueChanged=false
},calculateAvailableValues:function(){var A=new Array();
var C=this.roundFloat(this.minimum);
var B=0;
while(C<this.maximum){A[B]=C;
C=this.roundFloat(C+parseFloat(this.step));
B++
}A[B]=this.roundFloat(this.maximum);
return A
},roundFloat:function(A){if(!this.digCount){return Math.round(A)
}return parseFloat(Number(A).toFixed(this.digCount))
},windowMouseOut:function(A){var B=null;
if(A.srcElement){B=A.toElement
}else{B=A.relatedTarget
}if(B==null){this.endDrag(A)
}},windowResized:function(A){this.setValue(this.value)
},findTableForTrack:function(B){var A=B.parentElement||B.parentNode;
if(A.tagName.toUpperCase()=="TABLE"){return A
}else{return this.findTableForTrack(A)
}},getNearestValue:function(B){var C;
C=this.binsearch(this.availableValues,B);
if(C>0){var A=C-1;
if(Math.abs(B-this.availableValues[A])<Math.abs(this.availableValues[C]-B)){C=A
}}return this.roundFloat(this.availableValues[C])
},binsearch:function(B,E){var D=0;
var C=B.length-1;
var A;
while(D<C){A=Math.round((D+C)/2+0.5)-1;
if(E<=B[A]){C=A
}else{D=A+1
}}return D
},setValue:function(B){if(isNaN(B)){B=0
}var A=this.getNearestValue(B);
this.value=A;
if((!this.editInFocus||A==B)&&(this.required||""!=this.input.value||this.updating)){this.input.value=this.value;
this.handle.style.left=this.translateToPx(this.value)
}else{this.handle.style.left="-2px"
}if(!this.tip.firstChild){this.tip.appendChild(window.document.createTextNode(this.value))
}this.tip.firstChild.nodeValue=this.value;
this.tip.style.left=this.handle.offsetLeft+"px"
},translateToPx:function(A){return Math.round(((this.maximumOffset()-this.handleLength)/(this.range.end-this.range.start))*(A-this.range.start))+"px"
},translateToValue:function(A){return((A/(this.maximumOffset()-this.handleLength)*(this.range.end-this.range.start))+this.range.start)
},maximumOffset:function(){return this.removePx(this.track.style.width||this.track.offsetWidth)
},removePx:function(A){if((A+"").indexOf("px")!=-1){return(A+"").substring(0,A.length-2)
}else{return A
}},startDrag:function(B){if(this.editInFocus){this.input.blur()
}window.document.onmouseup=this.eventMouseUp.bindAsEventListener(this);
window.document.onmousemove=this.eventMouseMove.bindAsEventListener(this);
this.editBlur();
this.prevMouseDownEvent=B;
if(Event.isLeftClick(B)){if(!this.disabled){this.handle.className=this.classes.arrowSelected+this.classes.base+this.classes.handleSelected;
if(this.options.currValue){this.tip.style.display="block"
}Richfaces.createEvent("mousedown",this.mainTable,null,null).fire();
this.active=true;
var C=Event.element(B);
var D=Event.pointerX(B);
var A=Position.cumulativeOffset(this.track);
this.updating=true;
this.setValue(this.translateToValue((D-A[0])-(this.handleLength/2)));
this.updating=false;
var A=Position.cumulativeOffset(this.handle);
this.offsetX=D-A[0]
}Event.stop(B)
}},update:function(A){this.updating=true;
if(this.active){if(!this.dragging){this.dragging=true
}this.draw(A);
Event.stop(A)
}this.updating=false
},draw:function(B){var C=Event.pointerX(B);
var A=Position.cumulativeOffset(this.track);
C-=this.offsetX+A[0];
this.setValue(this.translateToValue(C))
},processMouseUp:function(A){this.endDrag(A);
this.fireClickIfNeeded(A)
},endDrag:function(A){window.document.onmouseup=this.prevMouseUp;
window.document.onmousemove=this.prevMouseMove;
if(this.options.currValue){Element.hide(this.tip)
}if(this.eventChanged&&this.isValueChanged()){this.eventChanged(A)
}this.handle.className=this.classes.arrow+this.classes.base;
if(this.active&&this.dragging){this.active=false;
this.dragging=false;
Richfaces.createEvent("mouseup",this.mainTable,null,null).fire();
Event.stop(A)
}if(RichFaces.navigatorType()!="MSIE"){Richfaces.createEvent("change",this.input,null,null).fire()
}},fireClickIfNeeded:function(A){if((this.prevMouseDownEvent.target!=A.target&&RichFaces.navigatorType()=="FF")||(RichFaces.getOperaVersion()&&RichFaces.getOperaVersion()<9&&A.target.tagName.toLowerCase()!="div")){Richfaces.createEvent("click",this.mainTable,null,null).fire()
}},isValueChanged:function(){var A=this.prevValue!=this.value;
this.prevValue=this.value;
return A
},inputChange:function(A){this.editInFocus=false;
if(isNaN(Number(this.input.value))){this.setValue(this.value)
}else{if(this.outOfRange){if(this.eventError){this.eventError()
}}this.setValue(Number(this.input.value))
}this.value=this.input.value?this.input.value:this.minimum;
if(this.eventInputOnChange){this.eventInputOnChange()
}if(this.eventChanged&&this.isValueChanged()){this.eventChanged(A)
}},inputValidate:function(A){if(A.keyCode==13){if(isNaN(Number(this.input.value))){this.input.value=this.value;
this.editBlur();
this.setValue(this.value)
}}},editChange:function(A){if(isNaN(Number(this.input.value))){this.setValue(Number(this.value));
this.input.value=this.value;
if(this.eventError){this.eventError()
}}else{if(!(A.keyCode>37&&A.keyCode<40)){this.setValue(Number(this.input.value))
}}if(A.keyCode==13){if(this.required||""!=this.input.value){this.input.value=this.getNearestValue(this.value)
}this.input.form.submit()
}if(this.eventChanged&&this.isValueChanged()){this.eventChanged(A)
}},editFocus:function(){this.editInFocus=true
},editBlur:function(){this.editInFocus=false;
if((this.input.value+"").indexOf(this.value)!=0){this.setValue(this.input.value);
this.eventInputChange()
}else{this.setValue(this.input.value)
}},load:function(){if(this.input.value){this.options.sliderValue=this.input.value
}this.setInitialValue()
},trim:function(A){return A.replace(/^\s+|\s+$/,"")
}}

if(!window.Richfaces){window.Richfaces={}
}Richfaces.Spinner=Class.create();
Richfaces.Spinner.prototype={initialize:function(F,B,E,C,A){this.content=$(F.edit);
$(F.edit).component=this;
this.controls=$(F.buttons);
this.fie=$(F.forIE);
this.ch=B.chameleon;
this.items=new Array();
this.table=$(F.buttons.substr(F.buttons.indexOf("buttons")+7));
if(RichFaces.navigatorType()=="FF"||RichFaces.navigatorType()=="NETSCAPE"){if(!this.fie){this.table.style.display="-moz-inline-box"
}}this.options=B;
if(!B.disabled){this.buttonUp=null;
this.buttonDown=null
}this.cycled=B.cycled;
this.edited=B.edited;
var D=this._getDirectChildrenByTag(this.content,"INPUT")[0];
this.upClick=new Function(C.onup+";return true;").bindAsEventListener(D);
this.downClick=new Function(C.ondown+";return true;").bindAsEventListener(D);
this.error=new Function(C.onerr+";return true;").bindAsEventListener(D);
this.data=E;
this.max=null;
this.min=null;
this.delta=null;
this.required=B.required;
this._attachBehaviors();
this._load()
},switchItems:function(B){var A=this.controls.edit.value;
if(B=="up"){if(""==A){this.controls.edit.value=this.min
}else{A-=this.delta*-1;
A=this.roundFloat(A);
if(A<=this.max&&A>=this.min){this.controls.edit.value=A
}else{if(this.cycled){if(this.delta>0){this.controls.edit.value=this.min
}else{this.controls.edit.value=this.max
}}else{this.error();
this.controls.fireEditEvent("error");
this.controls.edit.value=this.max
}}}}else{if(""==A){this.controls.edit.value=this.max
}else{A-=this.delta;
A=this.roundFloat(A);
if(A>=this.min&&A<=this.max){this.controls.edit.value=A
}else{if(this.cycled){if(this.delta<0){this.controls.edit.value=this.min
}else{this.controls.edit.value=this.max
}}else{this.error();
this.controls.fireEditEvent("error");
this.controls.edit.value=this.min
}}}}},roundFloat:function(A){var D=this.delta+"";
if(D.indexOf(".")==-1){return A
}var C=D.length-D.indexOf(".")-1;
if(C>D.length){return A
}var B=A.toFixed(C);
return B
},_load:function(){this.controls.edit.readOnly=this.edited?"":"readOnly";
if(this.options.disabled){this.controls.edit.readOnly="readOnly";
Element.setStyle(this.controls.edit,{color:"gray"})
}else{Element.setStyle(this.controls.edit,{color:""})
}},_attachBehaviors:function(){this.max=this.data.max;
this.min=this.data.min;
this.delta=this.data.delta;
var C=this._getDirectChildrenByTag(this.controls,"TBODY")[0];
var B=this._getDirectChildrenByTag(C,"TR");
var F=this._getDirectChildrenByTag(B[0],"TD")[0];
var G=this._getDirectChildrenByTag(B[1],"TD")[0];
var E=this._getDirectChildrenByTag(this.content,"INPUT")[0];
if(this.ch=="false"){this.buttonUp=this._getDirectChildrenByTag(F,"INPUT")[0];
this.buttonDown=this._getDirectChildrenByTag(G,"INPUT")[0];
var A=null;
var D=null
}else{var A=this._getDirectChildrenByTag(F,"INPUT")[0];
var D=this._getDirectChildrenByTag(G,"INPUT")[0]
}this.controls=new Richfaces.Spinner.Controls(this,{button:F,img:A},{button:G,img:D},E)
},_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.toUpperCase()==D.toUpperCase()){B.push(A[C])
}}return B
},_removePx:function(A){return A.substring(0,A.indexOf("px"))
}};
Richfaces.Spinner.Controls=Class.create();
Richfaces.Spinner.Controls.prototype={initialize:function(C,A,D,B){this.spinner=C;
this.up=$(A.button);
this.upimg=$(A.img);
this.down=$(D.button);
this.downimg=$(D.img);
this.mousedown=false;
this.onUpButton=false;
this.onDownButton=false;
this.fie=this.spinner.fie;
this.edit=$(B);
this.originalColor=B.style.color;
this.prevEditValue=(this.edit.value||!this.spinner.required)?this.edit.value:this.spinner.min;
this.edit.value=this.prevEditValue;
this.previousMU=window.document.onmouseup;
this.previousMM=window.document.onmousemove;
if(!C.options.disabled){this._attachBehaviors();
this.edit.style.color=this.originalColor
}else{if(!this.fie){this.edit.style.color="gray"
}}},upClick:function(A){if(A.preventDefault){A.preventDefault()
}this.spinner.switchItems("up");
this.spinner.upClick();
window.document.onmouseup=this.mouseUp.bindAsEventListener(this);
this.mousedown=true;
this.timer=setTimeout(this.continueUpClick.bind(this),750)
},downClick:function(A){if(A.preventDefault){A.preventDefault()
}this.spinner.switchItems("down");
this.spinner.downClick();
window.document.onmouseup=this.mouseUp.bindAsEventListener(this);
this.mousedown=true;
this.timer=setTimeout(this.continueDownClick.bind(this),750)
},continueUpClick:function(){if(!this.mousedown){return 
}window.document.onmousemove=this.mouseMoveUp.bindAsEventListener(this);
this.spinner.switchItems("up");
if(this.timer){clearTimeout(this.timer)
}this.timer=setTimeout(this.continueUpClick.bind(this),100)
},continueDownClick:function(){if(!this.mousedown){return 
}window.document.onmousemove=this.mouseMoveDown.bindAsEventListener(this);
this.spinner.switchItems("down");
if(this.timer){clearTimeout(this.timer)
}this.timer=setTimeout(this.continueDownClick.bind(this),100)
},mouseUp:function(A){clearTimeout(this.timer);
if(this.spinner.ch=="true"){if(!this.onUpButton){this.upUp()
}if(!this.onDownButton){this.downUp()
}}if(this.mousedown){this.mousedown=false;
this.fireEditEvent("change")
}},mouseMoveDown:function(A){if(A.preventDefault){A.preventDefault()
}if((this.downimg!=Event.element(A))){window.document.onmousemove=this.previousMM;
clearTimeout(this.timer);
this.mousedown=false;
if(this.spinner.ch=="true"){if(!this.onUpButton){this.upUp()
}if(!this.onDownButton){this.downUp()
}}this.fireEditEvent("change")
}},mouseMoveUp:function(A){if(A.preventDefault){A.preventDefault()
}if(this.upimg!=Event.element(A)){window.document.onmousemove=this.previousMM;
clearTimeout(this.timer);
this.mousedown=false;
if(this.spinner.ch=="true"){if(!this.onUpButton){this.upUp()
}if(!this.onDownButton){this.downUp()
}}this.fireEditEvent("change")
}},inputChange:function(A){if((this.edit.value==""&&this.spinner.required)||isNaN(Number(this.edit.value))){this.edit.value=this.prevEditValue
}else{if(""!=this.edit.value){if(this.edit.value>this.spinner.max){this.edit.value=this.spinner.max
}else{if(this.edit.value<this.spinner.min){this.edit.value=this.spinner.min
}}}}if(""!=this.edit.value){this.prevEditValue=this.edit.value
}if(this.eventEditOnChange){this.eventEditOnChange()
}},editChange:function(A){if((this.edit.value<this.spinner.max)&&(this.edit.value>this.spinner.min)&&!isNaN(Number(this.edit.value))&&this.edit.value!=""){this.prevEditValue=this.edit.value
}if(A.keyCode==13){if(this.spinner.required||""!=this.edit.value){this.edit.value=this.getValidValue(this.edit.value)
}this.edit.form.submit()
}},getValidValue:function(A){if(isNaN(A)||A==""){return this.prevEditValue
}if(A>this.spinner.max){return this.spinner.max
}if(A<this.spinner.min){return this.spinner.min
}return A
},drag:function(){return false
},_attachBehaviors:function(){this.up.onmousedown=this.upClick.bindAsEventListener(this);
this.down.onmousedown=this.downClick.bindAsEventListener(this);
this.up.onmouseup=this.mouseUp.bindAsEventListener(this);
this.down.onmouseup=this.mouseUp.bindAsEventListener(this);
this.edit.onkeydown=this.editChange.bindAsEventListener(this);
this.eventInputChange=this.inputChange.bindAsEventListener(this);
if(this.edit.onchange){this.eventEditOnChange=this.edit.onchange
}this.edit.onchange=this.eventInputChange.bindAsEventListener(this.edit)
},fireEditEvent:function(B){if(document.createEvent){var A=document.createEvent("HTMLEvents");
A.initEvent(B,true,false);
this.edit.dispatchEvent(A)
}else{if(document.createEventObject){this.edit.fireEvent("on"+B)
}}}}

function __addLoadEvent(A){Event.observe(window,"load",A)
}function __initVirtualEarthdiv(A,B){window[A]=new VEMap(B)
}function __applyVirtualEarthparam(E,H,G,B,D,A,C){var F=window[E];
F.SetDashboardSize(C);
F.onLoadMap=H;
F.LoadMap();
F.SetCenterAndZoom(new VELatLong(G,B),D);
F.SetMapStyle(A)
}
if(!window.LOG){window.LOG={warn:function(){}}
}if(typeof Effect=="undefined"){throw ("calendar.js requires including script.aculo.us' effects.js library")
}if(!window.Richfaces){window.Richfaces={}
}Richfaces.Calendar={};
Richfaces.Calendar.setElementPosition=function(F,A,L,Y,M){if(!M){M={dx:0,dy:0}
}var I=Richfaces.Calendar.getOffsetDimensions(F);
var G;
var V;
if(A.left!=undefined){G={width:A.width,height:A.height};
V=[A.left,A.top]
}else{G=Richfaces.Calendar.getOffsetDimensions(A);
V=Position.cumulativeOffset(A)
}var B=Richfaces.Calendar.getWindowViewport();
var K=V[0];
var J=V[1];
var S=/^(top|bottom)-(left|right)$/;
var P;
if(typeof L=="object"){K=L.x;
J=L.y
}else{if(L&&(P=L.toLowerCase().match(S))!=null){if(P[2]=="right"){K+=G.width
}if(P[1]=="bottom"){J+=G.height
}}else{}}if(Y&&(P=Y.toLowerCase().match(S))!=null){var W=Y.toLowerCase().split("-");
if(P[2]=="left"){K-=I.width+M.dx
}else{if(P[2]=="right"){K+=M.dx
}}if(P[1]=="top"){J-=I.height+M.dy
}else{if(P[1]=="bottom"){J+=M.dy
}}}else{var Z={square:0};
var O=V[0]-M.dx;
var N=V[1]+M.dy;
var D={right:O+G.width,top:N+G.height};
D.left=D.right-I.width;
D.bottom=D.top+I.height;
K=D.left;
J=D.top;
var Q=Richfaces.Calendar.checkCollision(D,B);
if(Q!=0){if(K>=0&&J>=0&&Z.square<Q){Z={x:K,y:J,square:Q}
}O=V[0]-M.dx;
N=V[1]-M.dy;
D={right:O+G.width,bottom:N};
D.left=D.right-I.width;
D.top=D.bottom-I.height;
K=D.left;
J=D.top;
Q=Richfaces.Calendar.checkCollision(D,B);
if(Q!=0){if(K>=0&&J>=0&&Z.square<Q){Z={x:K,y:J,square:Q}
}O=V[0]+M.dx;
N=V[1]+M.dy;
D={left:O,top:N+G.height};
D.right=D.left+I.width;
D.bottom=D.top+I.height;
K=D.left;
J=D.top;
Q=Richfaces.Calendar.checkCollision(D,B);
if(Q!=0){if(K>=0&&J>=0&&Z.square<Q){Z={x:K,y:J,square:Q}
}O=V[0]+M.dx;
N=V[1]-M.dy;
D={left:O,bottom:N};
D.right=D.left+I.width;
D.top=D.bottom-I.height;
K=D.left;
J=D.top;
Q=Richfaces.Calendar.checkCollision(D,B);
if(Q!=0){if(K<0||J<0||Z.square>Q){K=Z.x;
J=Z.y
}}}}}}var H=F.style;
var C=H.visibility;
var X=H.position;
var R=H.display;
H.visibility="hidden";
H.position="absolute";
H.display="";
if(!window.opera){var U=F.getOffsetParent().viewportOffset();
K-=U[0];
J-=U[1]
}else{if(F.offsetParent){if(F.offsetParent!=document.body){var U=Position.cumulativeOffset(F.offsetParent);
K-=U[0];
J-=U[1];
K+=F.offsetParent.scrollLeft;
J+=F.offsetParent.scrollTop
}else{var U=Richfaces.Calendar.cumulativeScrollOffset(F);
K+=U[0];
J+=U[1]
}}}H.display=R;
H.position=X;
H.visibility=C;
F.style.left=K+"px";
F.style.top=J+"px"
};
Richfaces.Calendar.cumulativeScrollOffset=function(B){var A=0,C=0;
do{A+=B.scrollTop||0;
C+=B.scrollLeft||0;
B=B.parentNode
}while(B&&B!=document.body);
return Element._returnOffset(C,A)
};
Richfaces.Calendar.getOffsetDimensions=function(C){C=$(C);
var H=$(C).getStyle("display");
if(H!="none"&&H!=null){return{width:C.offsetWidth,height:C.offsetHeight}
}var B=C.style;
var G=B.visibility;
var D=B.position;
var A=B.display;
B.visibility="hidden";
B.position="absolute";
B.display="block";
var I=C.offsetWidth;
var F=C.offsetHeight;
B.display=A;
B.position=D;
B.visibility=G;
return{width:I,height:F}
};
Richfaces.Calendar.checkCollision=function(A,B,D){if(A.left>=B.left&&A.top>=B.top&&A.right<=B.right&&A.bottom<=B.bottom){return 0
}var C={left:(A.left>B.left?A.left:B.left),top:(A.top>B.top?A.top:B.top),right:(A.right<B.right?A.right:B.right),bottom:(A.bottom<B.bottom?A.bottom:B.bottom)};
return(C.right-C.left)*(C.bottom-C.top)
};
Richfaces.Calendar.getWindowDimensions=function(){var A=self.innerWidth||document.documentElement.clientWidth||document.body.clientWidth||0;
var B=self.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||0;
return{width:A,height:B}
};
Richfaces.Calendar.getWindowScrollOffset=function(){var B=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;
var A=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0;
return{left:B,top:A}
};
Richfaces.Calendar.getWindowViewport=function(){var B=Richfaces.Calendar.getWindowDimensions();
var A=Richfaces.Calendar.getWindowScrollOffset();
return{left:A.left,top:A.top,right:B.width+A.left,bottom:B.height+A.top}
};
Richfaces.Calendar.clonePosition=function(D,C){if(!D.length){D=[D]
}var F=Position.cumulativeOffset(C);
F={left:F[0],top:F[1]};
var A;
if(C.style.position!="absolute"){A=Position.realOffset(C);
F.left-=A.left;
F.top-=A.top;
A=Richfaces.Calendar.getWindowScrollOffset();
F.left+=A.left;
F.top+=A.top
}for(var B=0;
B<D.length;
B++){A=Richfaces.Calendar.getParentOffset(D[B]);
D[B].style.left=(F.left-A.left)+"px";
D[B].style.top=(F.top-A.top)+"px"
}return F
};
Richfaces.Calendar.getParentOffset=function(C){var G={left:0,top:0};
var B=C.style;
if(B.display!="none"){if(C.offsetParent&&C.offsetParent!=document.body){G=Position.cumulativeOffset(C.offsetParent)
}}else{var F=B.visibility;
var D=B.position;
var A=B.display;
B.visibility="hidden";
B.position="absolute";
B.display="";
if(C.offsetParent&&C.offsetParent!=document.body){G=Position.cumulativeOffset(C.offsetParent)
}B.display=A;
B.position=D;
B.visibility=F
}return G
};
Richfaces.Calendar.joinArray=function(F,B,A,D){var C="";
if(F.length!=0){C=B+F.pop()+A
}while(F.length){C=B+F.pop()+A+D+C
}return C
};
Richfaces.Calendar.getMonthByLabel=function(C,A){var B=0;
while(B<A.length){if(A[B]==C){return B
}else{B++
}}};
Object.extend(Event,{findElementByAttr:function(F,C,D,G,A){var B=Event.findElement(F,C);
while(!B[D]||(A?B[D].indexOf(G)!=0:B[D]!=G)){B=B.parentNode
}return B
}});
Object.extend(Element,{replaceClassName:function(B,A,D){if(!(B=$(B))){return 
}var C=Element.classNames(B);
C.remove(A);
C.add(D);
return B
}});
Richfaces.Calendar.getDefaultMonthNames=function(A){return(A?["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]:["January","February","March","April","May","June","July","August","September","October","November","December"])
};
Richfaces.Calendar.parseDate=function(U,Q,I,A){var L=/([.*+?^<>=!:${}()[\]\/\\])/g;
var J;
var C;
if(!I){I=Richfaces.Calendar.getDefaultMonthNames();
J=I.join("|")
}else{J=I.join("|").replace(L,"\\$1")
}if(!A){A=Richfaces.Calendar.getDefaultMonthNames(true);
C=A.join("|")
}else{C=A.join("|").replace(L,"\\$1")
}var H=1;
var G,M,R;
var W,P,N;
var B=false;
Q=Q.replace(/([.*+?^<>=!:${}()|[\]\/\\])/g,"\\$1");
Q=Q.replace(/(y+|M+|d+|a|H{1,2}|h{1,2}|m{2})/g,function(Y){switch(Y){case"y":case"yy":G=H;
H++;
return"(\\d{2})";
case"MM":M=H;
H++;
return"(\\d{2})";
case"M":M=H;
H++;
return"(\\d{1,2})";
case"d":R=H;
H++;
return"(\\d{1,2})";
case"MMM":M=H;
H++;
B=true;
return"("+C+")";
case"a":W=H;
H++;
return"(AM|am|PM|pm)?";
case"HH":case"hh":P=H;
H++;
return"(\\d{2})?";
case"H":case"h":P=H;
H++;
return"(\\d{1,2})?";
case"mm":N=H;
H++;
return"(\\d{2})?"
}var Z=Y.charAt(0);
if(Z=="y"){G=H;
H++;
return"(\\d{4})"
}if(Z=="M"){M=H;
H++;
return"("+J+")"
}if(Z=="d"){R=H;
H++;
return"(\\d{2})"
}});
var L=new RegExp(Q,"i");
var F=U.match(L);
if(F!=null){var K=parseInt(F[G],10);
if(isNaN(K)){return null
}else{if(K<70){K+=2000
}else{if(K<100){K+=1900
}}}var O=parseInt(F[M],10);
if(isNaN(O)){O=Richfaces.Calendar.getMonthByLabel(F[M],B?A:I)
}else{if(--O<0||O>11){return null
}}var S=parseInt(F[R],10);
if(isNaN(S)||S<1||S>daysInMonth(K,O)){return null
}if(N!=undefined&&P!=undefined){var D,V,X;
V=parseInt(F[N],10);
if(isNaN(V)||V<0||V>59){return null
}D=parseInt(F[P],10);
if(isNaN(D)){return null
}if(W!=undefined){X=F[W].toLowerCase();
if((X!="am"&&X!="pm")||D<1||D>12){return null
}if(X=="pm"){if(D!=12){D+=12
}}else{if(D==12){D=0
}}}else{if(D<0||D>23){return null
}}return new Date(K,O,S,D,V,0)
}return new Date(K,O,S)
}return null
};
Richfaces.Calendar.formatDate=function(A,G,F,H){if(!F){F=Richfaces.Calendar.getDefaultMonthNames()
}if(!H){H=Richfaces.Calendar.getDefaultMonthNames(true)
}var C;
var I;
var B;
var D;
var J=G.replace(/(\\\\|\\[yMdaHhm])|(y+|M+|d+|a|H{1,2}|h{1,2}|m{2})/g,function(K,N,M){if(N){return N.charAt(1)
}switch(M){case"y":case"yy":return A.getYear().toString().slice(-2);
case"M":return(A.getMonth()+1);
case"MM":return((C=A.getMonth()+1)<10?"0"+C:C);
case"MMM":return H[A.getMonth()];
case"d":return A.getDate();
case"a":return(A.getHours()<12?"AM":"PM");
case"HH":return((B=A.getHours())<10?"0"+B:B);
case"H":return A.getHours();
case"hh":return((B=A.getHours())==0?"12":(B<10?"0"+B:(B>12?B-12:B)));
case"h":return((B=A.getHours())==0?"12":(B>12?B-12:B));
case"mm":return((D=A.getMinutes())<10?"0"+D:D)
}var L=M.charAt(0);
if(L=="y"){return A.getFullYear()
}if(L=="M"){return F[A.getMonth()]
}if(L=="d"){return((I=A.getDate())<10?"0"+I:I)
}});
return J
};
Richfaces.Calendar.escape=function(A){return A.replace(/([yMdaHhm\\])/g,"\\$1")
};
Richfaces.Calendar.unescape=function(A){return A.replace(/\\([yMdaHhm\\])/g,"$1")
};
function isLeapYear(A){return new Date(A,1,29).getDate()==29
}function daysInMonth(A,B){return 32-new Date(A,B,32).getDate()
}function daysInMonthByDate(A){return 32-new Date(A.getFullYear(),A.getMonth(),32).getDate()
}function getDay(A,B){var C=A.getDay()-B;
if(C<0){C=7+C
}return C
}function getFirstWeek(D,G,B){var C=new Date(D,0,1);
var F=getDay(C,B);
var A=(7-F<G)?0:1;
return{date:C,firstDay:F,weekNumber:A,mdifw:G,fdow:B}
}function getLastWeekOfPrevYear(D){var A=D.date.getFullYear()-1;
var F=(isLeapYear(A)?366:365);
var C=getFirstWeek(A,D.mdifw,D.fdow);
F=(F-7+D.firstDay);
var B=Math.floor(F/7)+1;
return B+C.weekNumber
}function weekNumber(C,F,D,A){var H=getFirstWeek(C,D,A);
if(F==0){if(H.weekNumber==1){return 1
}return getLastWeekOfPrevYear(H)
}var B=604800000;
var G=new Date(C,F,1);
G.setDate(1+H.firstDay+(getDay(G,A)==0?1:0));
weeknumber=H.weekNumber+Math.floor((G.getTime()-H.date.getTime())/B);
return weeknumber
}Calendar=Class.create();
Object.extend(Calendar.prototype,{initialize:function(U,L){this.id=U;
this.params=L;
this.showApplyButton=(!this.params.popup)?false:this.params.showApplyButton;
if(this.params.showWeekDaysBar==undefined){this.params.showWeekDaysBar=true
}if(this.params.showWeeksBar==undefined){this.params.showWeeksBar=true
}if(!this.params.datePattern){this.params.datePattern="MMM d, y"
}this.setTimeProperties();
if(!this.params.dayListMarkup){this.params.dayListMarkup=CalendarView.dayList;
this.customDayListMarkup=false
}else{this.customDayListMarkup=true
}if(!this.params.weekNumberMarkup){this.params.weekNumberMarkup=CalendarView.weekNumber
}if(!this.params.weekDayMarkup){this.params.weekDayMarkup=CalendarView.weekDay
}if(!this.params.headerMarkup){this.params.headerMarkup=CalendarView.header
}if(!this.params.footerMarkup){this.params.footerMarkup=CalendarView.footer
}this.popupOffset={dx:(isNaN(this.params.horizontalOffset)?0:parseInt(this.params.horizontalOffset,10)),dy:(isNaN(this.params.verticalOffset)?0:parseInt(this.params.verticalOffset,10))};
this.currentDate=this.params.currentDate?this.params.currentDate:(this.params.selectedDate?this.params.selectedDate:new Date());
this.currentDate.setDate(1);
this.selectedDate=this.params.selectedDate;
if(typeof this.params.boundaryDatesMode=="string"){this.params.boundaryDatesMode=this.params.boundaryDatesMode.toLowerCase()
}if(typeof this.params.todayControlMode=="string"){this.todayControlMode=this.params.todayControlMode.toLowerCase()
}if(typeof this.params.isDayEnabled!="function"){this.params.isDayEnabled=function(d){return true
}
}if(typeof this.params.dayStyleClass!="function"){this.params.dayStyleClass=function(d){return""
}
}this.todayDate=new Date();
this.firstWeekendDayNumber=6-this.params.firstWeekDay;
this.secondWeekendDayNumber=(this.params.firstWeekDay>0?7-this.params.firstWeekDay:0);
this.calendarContext=new CalendarContext(this);
this.DATE_ELEMENT_ID=this.params.dayListTableId+"Cell";
this.WEEKNUMBER_ELEMENT_ID=this.params.weekNumberBarId+"Cell";
this.WEEKDAY_ELEMENT_ID=this.params.weekDayBarId+"Cell";
this.POPUP_ID=this.id+"Popup";
this.POPUP_BUTTON_ID=this.id+"PopupButton";
this.INPUT_DATE_ID=this.id+"InputDate";
this.IFRAME_ID=this.id+"IFrame";
this.EDITOR_ID=this.id+"Editor";
this.EDITOR_SHADOW_ID=this.id+"EditorShadow";
this.TIME_EDITOR_LAYOUT_ID=this.id+"TimeEditorLayout";
this.DATE_EDITOR_LAYOUT_ID=this.id+"DateEditorLayout";
this.EDITOR_LAYOUT_SHADOW_ID=this.id+"EditorLayoutShadow";
this.TIME_EDITOR_BUTTON_OK=this.id+"TimeEditorButtonOk";
this.TIME_EDITOR_BUTTON_CANCEL=this.id+"TimeEditorButtonCancel";
this.DATE_EDITOR_BUTTON_OK=this.id+"DateEditorButtonOk";
this.DATE_EDITOR_BUTTON_CANCEL=this.id+"DateEditorButtonCancel";
this.firstDateIndex=0;
this.daysData={startDate:null,days:[]};
this.days=[];
this.todayCellId=null;
this.todayCellColor="";
this.selectedDateCellId=null;
this.selectedDateCellColor="";
var K="";
this.isVisible=true;
if(this.params.popup==true){K="display:none; position:absolute;";
this.isVisible=false
}var M='<table id="'+this.id+'" border="0" cellpadding="0" cellspacing="0" class="rich-calendar-exterior rich-calendar-popup'+(this.params.className?" "+this.params.className:"")+'" style="'+K+this.params.style+'"><tbody>\n';
var D=(this.params.showWeeksBar?"8":"7");
var J=(this.params.optionalHeaderMarkup)?'<tr><td class="rich-calendar-header-optional" colspan="'+D+'" id="'+this.id+'HeaderOptional"></td></tr>':"";
var Y=(this.params.optionalFooterMarkup)?'<tr><td class="rich-calendar-footer-optional" colspan="'+D+'" id="'+this.id+'FooterOptional"></td></tr>':"";
var a=(this.params.showHeader?'<tr><td class="rich-calendar-header" colspan="'+D+'" id="'+this.id+'Header"></td></tr>':"");
var V=(this.params.showFooter?'<tr><td class="rich-calendar-footer" colspan="'+D+'" id="'+this.id+'Footer"></td></tr>':"");
var G="</tbody></table>\n";
var H='<iframe src="javascript:\'\'" frameborder="0" scrolling="no" id="'+this.IFRAME_ID+'" style="display:none; position: absolute; width: 1px; height: 1px; background-color:white;"></iframe>\n';
var P;
var A;
var N="";
var F;
var X="$('"+this.id+"').component.";
var C='onclick="'+X+'eventCellOnClick(event, this);" onmouseover="'+X+'eventCellOnMouseOver(event, this);" onmouseout="'+X+'eventCellOnMouseOut(event, this);"';
if(this.params.showWeekDaysBar){var N='<tr id="'+this.params.weekDayBarId+'">';
if(this.params.showWeeksBar){N+='<td class="rich-calendar-days"><br/></td>'
}var c=this.params.firstWeekDay;
for(var W=0;
W<7;
W++){F={weekDayLabel:this.params.weekDayLabels[c],weekDayLabelShort:this.params.weekDayLabelsShort[c],weekDayNumber:c,isWeekend:this.isWeekend(W),elementId:this.WEEKDAY_ELEMENT_ID+W,component:this};
var b=this.evaluateMarkup(this.params.weekDayMarkup,F);
if(c==6){c=0
}else{c++
}P="rich-calendar-days";
if(F.isWeekend){P+=" rich-calendar-weekends"
}if(W==6){P+=" rich-right-cell"
}N+='<td class="'+P+'" id="'+F.elementId+'">'+b+"</td>"
}N+="</tr>\n"
}var Z="";
var S=0;
this.dayCellClassName=[];
for(k=1;
k<7;
k++){A=(k==6?"rich-bottom-cell ":"");
Z+='<tr id="'+this.params.weekNumberBarId+k+'">';
if(this.params.showWeeksBar){F={weekNumber:k,elementId:this.WEEKNUMBER_ELEMENT_ID+k,component:this};
var I=this.evaluateMarkup(this.params.weekNumberMarkup,F);
Z+='<td class="rich-calendar-week '+A+'" id="'+F.elementId+'">'+I+"</td>"
}for(var W=0;
W<7;
W++){P=A+(!this.params.dayCellClass?"rich-calendar-cell-size":(!this.customDayListMarkup?this.params.dayCellClass:""))+" rich-calendar-cell";
if(W==this.firstWeekendDayNumber||W==this.secondWeekendDayNumber){P+=" rich-calendar-holly"
}if(W==6){P+=" rich-right-cell"
}this.dayCellClassName.push(P);
Z+='<td class="'+P+'" id="'+this.DATE_ELEMENT_ID+S+'" '+C+">"+(this.customDayListMarkup?'<div class="rich-calendar-cell-div'+(this.params.dayCellClass?" "+this.params.dayCellClass:"")+'"></div>':"")+"</td>";
S++
}Z+="</tr>"
}var Q=$(this.POPUP_ID).nextSibling;
if(this.params.popup&&Richfaces.browser.isIE6){do{if(Q.id==this.IFRAME_ID){var O=Q;
Q=Q.nextSibling;
Element.replace(O,H);
break
}}while(Q=Q.nextSibling)
}do{if(Q.id==U){var R=Q;
Q=Q.previousSibling;
Element.replace(R,M+J+a+N+Z+V+Y+G);
break
}}while(Q=Q.nextSibling);
Q=Q.nextSibling;
Q.component=this;
Q.richfacesComponent="richfaces:calendar";
Q=null;
if(this.params.submitFunction){this.submitFunction=this.params.submitFunction.bind(this)
}this.prepareEvents();
if(this.params.popup&&!this.params.disabled){var B=new Function("event","$('"+this.id+"').component.doSwitch();").bindAsEventListener();
Event.observe(this.POPUP_BUTTON_ID,"click",B,false);
if(!this.params.enableManualInput){Event.observe(this.INPUT_DATE_ID,"click",B,false)
}}},dateEditorSelectYear:function(A){if(this.dateEditorYearID){Element.removeClassName(this.dateEditorYearID,"rich-calendar-editor-btn-selected")
}this.dateEditorYear=this.dateEditorStartYear+A;
this.dateEditorYearID=this.DATE_EDITOR_LAYOUT_ID+"Y"+A;
Element.addClassName(this.dateEditorYearID,"rich-calendar-editor-btn-selected")
},dateEditorSelectMonth:function(A){this.dateEditorMonth=A;
Element.removeClassName(this.dateEditorMonthID,"rich-calendar-editor-btn-selected");
this.dateEditorMonthID=this.DATE_EDITOR_LAYOUT_ID+"M"+A;
Element.addClassName(this.dateEditorMonthID,"rich-calendar-editor-btn-selected")
},scrollEditorYear:function(D){var B=$(this.DATE_EDITOR_LAYOUT_ID+"TR");
if(this.dateEditorYearID){Element.removeClassName(this.dateEditorYearID,"rich-calendar-editor-btn-selected");
this.dateEditorYearID=""
}if(!D){if(this.dateEditorMonth!=this.getCurrentMonth()){this.dateEditorMonth=this.getCurrentMonth();
Element.removeClassName(this.dateEditorMonthID,"rich-calendar-editor-btn-selected");
this.dateEditorMonthID=this.DATE_EDITOR_LAYOUT_ID+"M"+this.dateEditorMonth;
Element.addClassName(this.dateEditorMonthID,"rich-calendar-editor-btn-selected")
}}if(B){var F;
var C=this.dateEditorStartYear=this.dateEditorStartYear+D*10;
for(var A=0;
A<5;
A++){B=B.nextSibling;
F=B.firstChild.nextSibling.nextSibling;
F.firstChild.innerHTML=C;
if(C==this.dateEditorYear){Element.addClassName(F.firstChild,"rich-calendar-editor-btn-selected");
this.dateEditorYearID=F.firstChild.id
}F=F.nextSibling;
F.firstChild.innerHTML=C+5;
if(C+5==this.dateEditorYear){Element.addClassName(F.firstChild,"rich-calendar-editor-btn-selected");
this.dateEditorYearID=F.firstChild.id
}C++
}}},updateDateEditor:function(){this.dateEditorYear=this.getCurrentYear();
this.dateEditorStartYear=this.getCurrentYear()-4;
this.scrollEditorYear(0)
},updateTimeEditor:function(){var G=$(this.id+"TimeHours");
var F=$(this.id+"TimeSign");
var C=$(this.id+"TimeMinutes");
var D=this.selectedDate.getHours();
var A=this.selectedDate.getMinutes();
if(this.timeType==2){var B=(D<12?"AM":"PM");
F.value=B;
D=(D==0?"12":(D>12?D-12:D))
}G.value=(this.timeHoursDigits==2&&D<10?"0"+D:D);
C.value=(A<10?"0"+A:A)
},createEditor:function(){var F=$(this.id);
var A='<div id="'+this.EDITOR_SHADOW_ID+'" class="rich-calendar-editor-shadow" style="position:absolute; display:none;"></div><table border="0" cellpadding="0" cellspacing="0" id="'+this.EDITOR_ID+'" style="position:absolute; display:none;"><tbody><tr><td class="rich-calendar-editor-container" align="center"><div style="position:relative; width:100%">';
var H='<div id="'+this.EDITOR_LAYOUT_SHADOW_ID+'" class="rich-calendar-editor-layout-shadow"></div>';
var C="</div></td></tr></tbody></table>";
new Insertion.After(F,A+H+C);
var B=$(this.EDITOR_SHADOW_ID);
var G=$(this.EDITOR_ID);
var D=F.getStyle("z-index");
B.style.zIndex=D;
G.style.zIndex=parseInt(D,10)+1;
this.isEditorCreated=true;
return G
},createTimeEditorLayout:function(B){Element.insert(this.EDITOR_LAYOUT_SHADOW_ID,{after:this.evaluateMarkup(this.calendarContext.timeEditorLayout,this.calendarContext)});
var D=$(this.id+"TimeHours");
var C;
var A=$(this.id+"TimeMinutes");
if(this.timeType==1){sbjQuery(D).SpinButton({digits:this.timeHoursDigits,min:0,max:23})
}else{sbjQuery(D).SpinButton({digits:this.timeHoursDigits,min:1,max:12});
C=$(this.id+"TimeSign");
sbjQuery(C).SpinButton({})
}sbjQuery(A).SpinButton({digits:2,min:0,max:59});
this.correctEditorButtons(B,this.TIME_EDITOR_BUTTON_OK,this.TIME_EDITOR_BUTTON_CANCEL);
this.isTimeEditorLayoutCreated=true
},correctEditorButtons:function(G,C,B){var I=$(C);
var F=$(B);
G.style.visibility="hidden";
G.style.display="";
var H=Richfaces.Calendar.getOffsetDimensions(I.firstChild).width;
var D=Richfaces.Calendar.getOffsetDimensions(F.firstChild).width;
G.style.display="none";
G.style.visibility="";
var A=Richfaces.getComputedStyleSize(I,"width");
if(H>A||D>A){I.style.width=F.style.width=(H>D?H:D)+"px"
}},createDECell:function(G,D,A,F,C){if(A==0){return'<div id="'+G+'" class="rich-calendar-editor-btn'+(C?" "+C:"")+'" onmouseover="this.className=\'rich-calendar-editor-btn rich-calendar-editor-tool-over\';" onmouseout="this.className=\'rich-calendar-editor-btn\';" onmousedown="this.className=\'rich-calendar-editor-btn rich-calendar-editor-tool-press\';" onmouseup="this.className=\'rich-calendar-editor-btn rich-calendar-editor-tool-over\';" onclick="$(\''+this.id+"').component.scrollEditorYear("+F+');">'+D+"</div>"
}else{var B=(A==1?"$('"+this.id+"').component.dateEditorSelectMonth("+F+");":"$('"+this.id+"').component.dateEditorSelectYear("+F+");");
return'<div id="'+G+'" class="rich-calendar-editor-btn'+(C?" "+C:"")+'" onmouseover="Element.addClassName(this, \'rich-calendar-editor-btn-over\');" onmouseout="Element.removeClassName(this,\'rich-calendar-editor-btn-over\');" onclick="'+B+'">'+D+"</div>"
}},createDateEditorLayout:function(F){var A='<table id="'+this.DATE_EDITOR_LAYOUT_ID+'" class="rich-calendar-date-layout" border="0" cellpadding="0" cellspacing="0"><tbody><tr id="'+this.DATE_EDITOR_LAYOUT_ID+'TR">';
var B="</tr></tbody></table>";
var G=0;
this.dateEditorYear=this.getCurrentYear();
var D=this.dateEditorStartYear=this.dateEditorYear-4;
var H='<td align="center">'+this.createDECell(this.DATE_EDITOR_LAYOUT_ID+"M"+G,this.params.monthLabelsShort[G],1,G)+'</td><td align="center" class="rich-calendar-date-layout-split">'+this.createDECell(this.DATE_EDITOR_LAYOUT_ID+"M"+(G+6),this.params.monthLabelsShort[G+6],1,G+6)+'</td><td align="center">'+this.createDECell("","&lt;",0,-1)+'</td><td align="center">'+this.createDECell("","&gt;",0,1)+"</td>";
G++;
for(var C=0;
C<5;
C++){H+='</tr><tr><td align="center">'+this.createDECell(this.DATE_EDITOR_LAYOUT_ID+"M"+G,this.params.monthLabelsShort[G],1,G)+'</td><td align="center" class="rich-calendar-date-layout-split">'+this.createDECell(this.DATE_EDITOR_LAYOUT_ID+"M"+(G+6),this.params.monthLabelsShort[G+6],1,G+6)+'</td><td align="center">'+this.createDECell(this.DATE_EDITOR_LAYOUT_ID+"Y"+C,D,2,C,(C==4?"rich-calendar-editor-btn-selected":""))+'</td><td align="center">'+this.createDECell(this.DATE_EDITOR_LAYOUT_ID+"Y"+(C+5),D+5,2,C+5)+"</td>";
G++;
D++
}this.dateEditorYearID=this.DATE_EDITOR_LAYOUT_ID+"Y4";
this.dateEditorMonth=this.getCurrentMonth();
this.dateEditorMonthID=this.DATE_EDITOR_LAYOUT_ID+"M"+this.dateEditorMonth;
H+='</tr><tr><td colspan="2" class="rich-calendar-date-layout-ok"><div id="'+this.DATE_EDITOR_BUTTON_OK+'" class="rich-calendar-time-btn" style="float:right;" onmousedown="Element.addClassName(this, \'rich-calendar-time-btn-press\');" onmouseout="Element.removeClassName(this, \'rich-calendar-time-btn-press\');" onmouseup="Element.removeClassName(this, \'rich-calendar-time-btn-press\');" onclick="$(\''+this.id+"').component.hideDateEditor(true);\"><span>"+this.params.labels.ok+'</span></div></td><td colspan="2" class="rich-calendar-date-layout-cancel"><div id="'+this.DATE_EDITOR_BUTTON_CANCEL+'" class="rich-calendar-time-btn" style="float:left;" onmousedown="Element.addClassName(this, \'rich-calendar-time-btn-press\');" onmouseout="Element.removeClassName(this, \'rich-calendar-time-btn-press\');" onmouseup="Element.removeClassName(this, \'rich-calendar-time-btn-press\');" onclick="$(\''+this.id+"').component.hideDateEditor(false);\"><span>"+this.params.labels.cancel+"</span></div></td>";
Element.insert(this.EDITOR_LAYOUT_SHADOW_ID,{after:A+H+B});
Element.addClassName(this.dateEditorMonthID,"rich-calendar-editor-btn-selected");
this.correctEditorButtons(F,this.DATE_EDITOR_BUTTON_OK,this.DATE_EDITOR_BUTTON_CANCEL);
this.isDateEditorLayoutCreated=true
},createSpinnerTable:function(A){return'<table cellspacing="0" cellpadding="0" border="0"><tbody><tr><td class="rich-calendar-spinner-input-container"><input id="'+A+'" name="'+A+'" class="rich-calendar-spinner-input" type="text" /></td><td class="rich-calendar-spinner-buttons"><table border="0" cellspacing="0" cellpadding="0"><tbody><tr><td><div id="'+A+'BtnUp" class="rich-calendar-spinner-up" onmousedown="this.className=\'rich-calendar-spinner-up rich-calendar-spinner-pressed\'" onmouseup="this.className=\'rich-calendar-spinner-up\'" onmouseout="this.className=\'rich-calendar-spinner-up\'"/></td></tr><tr><td><div id="'+A+'BtnDown" class="rich-calendar-spinner-down" onmousedown="this.className=\'rich-calendar-spinner-down rich-calendar-spinner-pressed\'" onmouseup="this.className=\'rich-calendar-spinner-down\'" onmouseout="this.className=\'rich-calendar-spinner-down\'" /></td></tr></tbody></table></td></tr></tbody></table>'
},setTimeProperties:function(){this.timeType=0;
var Q=this.params.datePattern;
var N=[];
var P=/(\\\\|\\[yMdaHhm])|(y+|M+|d+|a|H{1,2}|h{1,2}|m{2})/g;
var B;
while(B=P.exec(Q)){if(!B[1]){N.push({str:B[0],marker:B[2],idx:B.index})
}}var F="";
var R="";
var G,M,I,H,O;
var D=this.id;
var C=function(S){return(S.length==0?K.marker:Q.substring(N[L-1].str.length+N[L-1].idx,K.idx+K.str.length))
};
for(var L=0;
L<N.length;
L++){var K=N[L];
var A=K.marker.charAt(0);
if(A=="y"||A=="M"||A=="d"){F+=C(F)
}else{if(A=="a"){O=true;
R+=C(R)
}else{if(A=="H"){M=true;
G=K.marker.length;
R+=C(R)
}else{if(A=="h"){I=true;
G=K.marker.length;
R+=C(R)
}else{if(A=="m"){H=true;
R+=C(R)
}}}}}}this.datePattern=F;
this.timePattern=R;
var J=this;
this.timePatternHtml=R.replace(/(\\\\|\\[yMdaHhm])|(H{1,2}|h{1,2}|m{2}|a)/g,function(S,V,U){if(V){return V.charAt(1)
}switch(U){case"a":return"</td><td>"+J.createSpinnerTable(D+"TimeSign")+"</td><td>";
case"H":case"HH":case"h":case"hh":return"</td><td>"+J.createSpinnerTable(D+"TimeHours")+"</td><td>";
case"mm":return"</td><td>"+J.createSpinnerTable(D+"TimeMinutes")+"</td><td>"
}});
this.timePatternHtml='<table border="0" cellpadding="0"><tbody><tr><td>'+this.timePatternHtml+"</td></tr></tbody></table>";
if(H&&M){this.timeType=1
}else{if(H&&I&&O){this.timeType=2
}}this.timeHoursDigits=G
},doCollapse:function(){if(!this.params.popup||!this.isVisible){return 
}if(this.isEditorVisible){this.hideEditor()
}var A=$(this.id);
if(this.invokeEvent("collapse",A)){Event.stopObserving(window.document,"click",this.eventOnCollapse,false);
var B=null;
if(Richfaces.browser.isIE6){B=$(this.IFRAME_ID)
}if(B){Element.hide(B)
}Element.hide(A);
this.isVisible=false
}},doExpand:function(J){this.skipEventOnCollapse=false;
if(J&&J.type=="click"){this.skipEventOnCollapse=true
}if(!this.params.popup||this.isVisible){return 
}var H=$(this.id);
if(this.invokeEvent("expand",H,J)){var F=null;
if(Richfaces.browser.isIE6){F=$(this.IFRAME_ID)
}var B=$(this.POPUP_ID);
var N=B.firstChild;
var O=N.nextSibling;
if(N&&N.value!=undefined){this.selectDate(N.value,false,{event:J,element:H})
}var C=Position.cumulativeOffset(O);
if(this.params.showInput){var G=Position.cumulativeOffset(N);
C=[C[0]<G[0]?C[0]:G[0],C[1]<G[1]?C[1]:G[1]];
var M=Richfaces.Calendar.getOffsetDimensions(N)
}var K=Richfaces.Calendar.getOffsetDimensions(B);
var I=Richfaces.Calendar.getOffsetDimensions(O);
var L=(window.opera?[0,0]:Position.realOffset(O));
var D={left:C[0]-L[0],top:C[1]-L[1],width:K.width,height:(M&&M.height>I.height?M.height:I.height)};
Richfaces.Calendar.setElementPosition(H,D,this.params.jointPoint,this.params.direction,this.popupOffset);
if(F){F.style.left=H.style.left;
F.style.top=H.style.top;
var A=Richfaces.Calendar.getOffsetDimensions(H);
F.style.width=A.width+"px";
F.style.height=A.height+"px";
Element.show(F)
}Element.show(H);
this.isVisible=true;
Event.observe(window.document,"click",this.eventOnCollapse,false)
}},doSwitch:function(A){this.isVisible?this.doCollapse():this.doExpand(A)
},eventOnCollapse:function(A){if(this.skipEventOnCollapse){this.skipEventOnCollapse=false;
return true
}if(Event.element(A).id==this.POPUP_BUTTON_ID||(!this.params.enableManualInput&&Event.element(A).id==this.INPUT_DATE_ID)){return true
}if(Position.within($(this.id),Event.pointerX(A),Event.pointerY(A))){return true
}this.doCollapse();
return true
},setInputField:function(A,B){var C=$(this.INPUT_DATE_ID);
if(C.value!=A){C.value=A;
this.invokeEvent("changed",C,B,this.selectedDate)
}},getCurrentDate:function(){return this.currentDate
},getSelectedDate:function(){if(!this.selectedDate){return null
}else{return this.selectedDate
}},getSelectedDateString:function(A){if(!this.selectedDate){return""
}if(!A){A=this.params.datePattern
}return Richfaces.Calendar.formatDate(this.selectedDate,A,this.params.monthLabels,this.params.monthLabelsShort)
},getPrevYear:function(){var A=this.currentDate.getFullYear()-1;
if(A<0){A=0
}return A
},getPrevMonth:function(A){var B=this.currentDate.getMonth()-1;
if(B<0){B=11
}if(A){return this.params.monthLabels[B]
}else{return B
}},getCurrentYear:function(){return this.currentDate.getFullYear()
},getCurrentMonth:function(A){var B=this.currentDate.getMonth();
if(A){return this.params.monthLabels[B]
}else{return B
}},getNextYear:function(){return this.currentDate.getFullYear()+1
},getNextMonth:function(A){var B=this.currentDate.getMonth()+1;
if(B>11){B=0
}if(A){return this.params.monthLabels[B]
}else{return B
}},isWeekend:function(A){return(A==this.firstWeekendDayNumber||A==this.secondWeekendDayNumber)
},prepareEvents:function(){this.eventOnCollapse=this.eventOnCollapse.bindAsEventListener(this)
},invokeEvent:function(B,D,G,C){var F=this.params["on"+B];
var A;
if(F){var H;
if(G){H=G
}else{if(document.createEventObject){H=document.createEventObject()
}else{if(document.createEvent){H=document.createEvent("Events");
H.initEvent(B,true,false)
}}}H.rich={component:this};
H.rich.date=C;
try{A=F.call(D,H)
}catch(I){LOG.warn("Exception: "+I.Message+"\n[on"+B+"]")
}}if(A!=false){A=true
}return A
},eventCellOnClick:function(D,C){var B=this.days[parseInt(C.id.substr(this.DATE_ELEMENT_ID.length),10)];
if(B.enabled&&B._month==0){var A=new Date(this.currentDate);
A.setDate(B.day);
if(this.timeType){if(this.selectedDate){A.setHours(this.selectedDate.getHours());
A.setMinutes(this.selectedDate.getMinutes())
}else{A.setHours(12)
}}if(this.selectDate(A,true,{event:D,element:C})&&!this.showApplyButton){this.doCollapse()
}}else{if(this.params.boundaryDatesMode=="scroll"){if(B._month==-1){this.prevMonth()
}else{this.nextMonth()
}}else{if(this.params.boundaryDatesMode=="select"){var A=new Date(B.date);
if(this.timeType){if(this.selectedDate){A.setHours(this.selectedDate.getHours());
A.setMinutes(this.selectedDate.getMinutes())
}else{A.setHours(12)
}}if(this.selectDate(A,false,{event:D,element:C})&&!this.showApplyButton){this.doCollapse()
}}}}},eventCellOnMouseOver:function(C,B){var A=this.days[parseInt(B.id.substr(this.DATE_ELEMENT_ID.length),10)];
if(this.invokeEvent("datemouseover",B,C,A.date)&&A.enabled){if(A._month==0&&B.id!=this.selectedDateCellId&&B.id!=this.todayCellId){Element.addClassName(B,"rich-calendar-hover")
}}},eventCellOnMouseOut:function(C,B){var A=this.days[parseInt(B.id.substr(this.DATE_ELEMENT_ID.length),10)];
if(this.invokeEvent("datemouseout",B,C,A.date)&&A.enabled){if(A._month==0&&B.id!=this.selectedDateCellId&&B.id!=this.todayCellId){Element.removeClassName(B,"rich-calendar-hover")
}}},load:function(B,A){if(B){this.daysData=this.indexData(B,A)
}else{this.daysData=null
}this.render();
if(typeof this.afterLoad=="function"){this.afterLoad();
this.afterLoad=null
}},indexData:function(F,B){var C=F.startDate.getFullYear();
var D=F.startDate.getMonth();
F.index=[];
F.index[C+"-"+D]=0;
if(B){this.currentDate=F.startDate;
this.currentDate.setDate(1);
return F
}var A=daysInMonthByDate(F.startDate)-F.startDate.getDate()+1;
while(F.days[A]){if(D==11){C++;
D=0
}else{D++
}F.index[C+"-"+D]=A;
A+=(32-new Date(C,D,32).getDate())
}return F
},getCellBackgroundColor:function(D){var A;
if(Richfaces.browser.isSafari&&this.params.popup&&!this.isVisible){var C=$(this.id).style;
var F=C.visibility;
var B=C.display;
C.visibility="hidden";
C.display="";
A=Element.getStyle(D,"background-color").parseColor();
C.display=B;
C.visibility=F
}else{A=Element.getStyle(D,"background-color").parseColor()
}return A
},clearEffect:function(A,C,B,F){if(C){C.cancel();
C=null
}if(A){var D=$(A);
D.style["backgroundColor"]="";
if(B){Element.removeClassName(D,B)
}if(F){Element.addClassName(D,F)
}}return null
},render:function(){this.todayDate=new Date();
var d=this.getCurrentYear();
var R=this.getCurrentMonth();
var L=(d==this.todayDate.getFullYear()&&R==this.todayDate.getMonth());
var Q=this.todayDate.getDate();
var S=this.selectedDate&&(d==this.selectedDate.getFullYear()&&R==this.selectedDate.getMonth());
var X=this.selectedDate&&this.selectedDate.getDate();
var H=getDay(this.currentDate,this.params.firstWeekDay);
var G=daysInMonthByDate(this.currentDate);
var A=daysInMonth(d,R-1);
var P=0;
var c=-1;
this.days=[];
var K=A-H+1;
if(H>0){while(K<=A){this.days.push({day:K,isWeekend:this.isWeekend(P),_month:c});
K++;
P++
}}K=1;
c=0;
this.firstDateIndex=P;
if(this.daysData&&this.daysData.index[d+"-"+R]!=undefined){var O=this.daysData.index[d+"-"+R];
if(this.daysData.startDate.getFullYear()==d&&this.daysData.startDate.getMonth()==R){var J=J=(this.daysData.days[O].day?this.daysData.days[O].day:this.daysData.startDate.getDate());
while(K<J){this.days.push({day:K,isWeekend:this.isWeekend(P%7),_month:c});
K++;
P++
}}var W=this.daysData.days.length;
var M;
var V;
while(O<W&&K<=G){V=this.isWeekend(P%7);
M=this.daysData.days[O];
M.day=K;
M.isWeekend=V;
M._month=c;
this.days.push(M);
O++;
K++;
P++
}}while(P<42){if(K>G){K=1;
c=1
}this.days.push({day:K,isWeekend:this.isWeekend(P%7),_month:c});
K++;
P++
}this.renderHF();
this.renderHeaderOptional();
this.renderFooterOptional();
P=0;
var B;
var I;
var D;
if(this.params.showWeeksBar){D=weekNumber(d,R,this.params.minDaysInFirstWeek,this.params.firstWeekDay)
}this.selectedDayElement=null;
var N=true;
var Y;
var a=(this.params.boundaryDatesMode=="scroll"||this.params.boundaryDatesMode=="select");
this.todayCellId=this.clearEffect(this.todayCellId,this.highlightEffect);
this.selectedDateCellId=this.clearEffect(this.selectedDateCellId,this.highlightEffect2);
var M=$(this.params.weekNumberBarId+"1");
for(var U=1;
U<7;
U++){I=this.days[P];
B=M.firstChild;
var Z;
if(this.params.showWeeksBar){if(N&&R==11&&(U==5||U==6)&&(I._month==1||(G-I.day+1)<this.params.minDaysInFirstWeek)){D=1;
N=false
}Z=D;
B.innerHTML=this.evaluateMarkup(this.params.weekNumberMarkup,{weekNumber:D++,elementId:B.id,component:this});
if(U==1&&D>52){D=1
}B=B.nextSibling
}var f=this.params.firstWeekDay;
var F=null;
while(B){I.elementId=B.id;
I.date=new Date(d,R+I._month,I.day);
I.weekNumber=Z;
I.component=this;
I.isCurrentMonth=(I._month==0);
I.weekDayNumber=f;
if(I.enabled!=false){I.enabled=this.params.isDayEnabled(I)
}if(!I.styleClass){I.customStyleClass=this.params.dayStyleClass(I)
}else{var C=this.params.dayStyleClass(I);
I.customStyleClass=I.styleClass;
if(C){I.customStyleClass+=" "+C
}}F=(this.customDayListMarkup?B.firstChild:B);
F.innerHTML=this.evaluateMarkup(this.params.dayListMarkup,I);
if(f==6){f=0
}else{f++
}var b=this.dayCellClassName[P];
if(I._month!=0){b+=" rich-calendar-boundary-dates";
if(a){b+=" rich-calendar-btn"
}}else{if(L&&I.day==Q){this.todayCellId=B.id;
this.todayCellColor=this.getCellBackgroundColor(B);
b+=" rich-calendar-today"
}if(S&&I.day==X){this.selectedDateCellId=B.id;
this.selectedDateCellColor=this.getCellBackgroundColor(B);
b+=" rich-calendar-select"
}else{if(I.enabled){b+=" rich-calendar-btn"
}}if(I.customStyleClass){b+=" "+I.customStyleClass
}}B.className=b;
P++;
I=this.days[P];
B=B.nextSibling
}M=M.nextSibling
}},renderHF:function(){if(this.params.showHeader){this.renderMarkup(this.params.headerMarkup,this.id+"Header",this.calendarContext)
}if(this.params.showFooter){this.renderMarkup(this.params.footerMarkup,this.id+"Footer",this.calendarContext)
}},renderHeaderOptional:function(){this.renderMarkup(this.params.optionalHeaderMarkup,this.id+"HeaderOptional",this.calendarContext)
},renderFooterOptional:function(){this.renderMarkup(this.params.optionalFooterMarkup,this.id+"FooterOptional",this.calendarContext)
},renderMarkup:function(B,A,C){if(!B){return 
}var D=$(A);
if(!D){return 
}D.innerHTML=B.invoke("getContent",C).join("")
},evaluateMarkup:function(A,B){if(!A){return""
}return A.invoke("getContent",B).join("")
},onUpdate:function(){var A=Richfaces.Calendar.formatDate(this.getCurrentDate(),"MM/yyyy");
$(this.id+"InputCurrentDate").value=A;
if(this.submitFunction){this.submitFunction(A)
}else{this.render()
}},nextMonth:function(){this.changeCurrentDateOffset(0,1)
},prevMonth:function(){this.changeCurrentDateOffset(0,-1)
},nextYear:function(){this.changeCurrentDateOffset(1,0)
},prevYear:function(){this.changeCurrentDateOffset(-1,0)
},changeCurrentDate:function(B,C){if(this.getCurrentMonth()!=C||this.getCurrentYear()!=B){var A=new Date(B,C,1);
if(this.invokeEvent("currentdateselect",$(this.id),null,A)){this.currentDate=A;
this.onUpdate();
this.invokeEvent("currentdateselected",$(this.id),null,A)
}}},changeCurrentDateOffset:function(B,C){var A=new Date(this.currentDate.getFullYear()+B,this.currentDate.getMonth()+C,1);
if(this.invokeEvent("currentdateselect",$(this.id),null,A)){this.currentDate=A;
this.onUpdate();
this.invokeEvent("currentdateselected",$(this.id),null,A)
}},today:function(D,G){var B=new Date();
var F=B.getFullYear();
var H=B.getMonth();
var C=B.getDate();
var A=false;
if(C!=this.todayDate.getDate()){A=true;
this.todayDate=B
}if(F!=this.currentDate.getFullYear()||H!=this.currentDate.getMonth()){A=true;
this.currentDate=new Date(F,H,1)
}if(this.todayControlMode=="select"){G=true
}if(A){if(D){this.render()
}else{this.onUpdate()
}}else{if(this.isVisible&&this.todayCellId&&!G){this.clearEffect(this.todayCellId,this.highlightEffect);
if(this.todayCellColor!="transparent"){this.highlightEffect=new Effect.Highlight($(this.todayCellId),{startcolor:this.todayCellColor,duration:0.3,transition:Effect.Transitions.sinoidal,afterFinish:this.onHighlightFinish})
}}}if(this.todayControlMode=="select"){if(A&&!D&&this.submitFunction){this.afterLoad=this.selectToday
}else{this.selectToday()
}}},selectToday:function(){if(this.todayCellId){var C=this.days[parseInt($(this.todayCellId).id.substr(this.DATE_ELEMENT_ID.length),10)];
var A=new Date();
var B=new Date(A.getFullYear(),A.getMonth(),A.getDate());
if(this.timeType){if(this.selectedDate){B.setHours(this.selectedDate.getHours());
B.setMinutes(this.selectedDate.getMinutes())
}else{B.setHours(12)
}}if(C.enabled&&this.selectDate(B,true)&&!this.showApplyButton){this.doCollapse()
}}},onHighlightFinish:function(A){A.element.style["backgroundColor"]=""
},selectDate:function(C,B,J){if(!J){J={event:null,element:null}
}var A=this.selectedDate;
var K;
if(C){if(typeof C=="string"){C=Richfaces.Calendar.parseDate(C,this.params.datePattern,this.params.monthLabels,this.params.monthLabelsShort)
}K=C
}else{K=null
}var H=true;
var D=false;
if((A-K)&&(A!=null||K!=null)){D=true;
H=this.invokeEvent("dateselect",J.element,J.event,C)
}if(H){this.selectedDate=K;
if(this.selectedDate!=null){var G=new Date(this.selectedDate);
if(G.getMonth()==this.currentDate.getMonth()&&G.getFullYear()==this.currentDate.getFullYear()){if(!A||A.getDate()!=G.getDate()){var F=$(this.DATE_ELEMENT_ID+(this.firstDateIndex+this.selectedDate.getDate()-1));
this.clearEffect(this.selectedDateCellId,this.highlightEffect2,"rich-calendar-select","rich-calendar-btn");
this.selectedDateCellId=F.id;
this.selectedDateCellColor=this.getCellBackgroundColor(F);
Element.removeClassName(F,"rich-calendar-btn");
Element.removeClassName(F,"rich-calendar-hover");
Element.addClassName(F,"rich-calendar-select");
this.renderHF()
}else{if(this.timeType!=0){this.renderHF()
}}}else{G.setDate(1);
this.currentDate=G;
if(B){this.render()
}else{this.onUpdate()
}}}else{this.selectedDate=null;
this.clearEffect(this.selectedDateCellId,this.highlightEffect2,"rich-calendar-select","rich-calendar-btn");
if(this.selectedDateCellId){this.selectedDateCellId=null;
this.renderHF()
}var C=new Date();
if(this.currentDate.getMonth()==C.getMonth()&&this.currentDate.getFullYear()==C.getFullYear()){this.renderHF()
}var I=this.todayControlMode;
this.todayControlMode="";
this.today(B,true);
this.todayControlMode=I
}if(D){this.invokeEvent("dateselected",J.element,J.event,this.selectedDate);
if(!this.showApplyButton){this.setInputField(this.selectedDate!=null?this.getSelectedDateString(this.params.datePattern):"",J.event)
}}}return H
},resetSelectedDate:function(){if(!this.selectedDate){return 
}if(this.invokeEvent("dateselect",null,null,null)){this.selectedDate=null;
this.invokeEvent("dateselected",null,null,null);
this.selectedDateCellId=this.clearEffect(this.selectedDateCellId,this.highlightEffect2,"rich-calendar-select","rich-calendar-btn");
this.renderHF();
if(!this.showApplyButton){this.setInputField("",null);
this.doCollapse()
}}},showSelectedDate:function(){if(!this.selectedDate){return 
}if(this.currentDate.getMonth()!=this.selectedDate.getMonth()||this.currentDate.getFullYear()!=this.selectedDate.getFullYear()){this.currentDate=new Date(this.selectedDate);
this.currentDate.setDate(1);
this.onUpdate()
}else{if(this.isVisible&&this.selectedDateCellId){this.clearEffect(this.selectedDateCellId,this.highlightEffect2);
if(this.selectedDateCellColor!="transparent"){this.highlightEffect2=new Effect.Highlight($(this.selectedDateCellId),{startcolor:this.selectedDateCellColor,duration:0.3,transition:Effect.Transitions.sinoidal,afterFinish:this.onHighlightFinish})
}}}},close:function(A){if(A){this.setInputField(this.getSelectedDateString(this.params.datePattern),null)
}this.doCollapse()
},setEditorPosition:function(A,B,D){A;
var C=Richfaces.Calendar.getOffsetDimensions(A);
B.style.width=D.style.width=C.width+"px";
B.style.height=D.style.height=C.height+"px";
Richfaces.Calendar.clonePosition([B,D],A)
},showTimeEditor:function(){var B;
if(this.timeType==0){return 
}if(!this.isEditorCreated){B=this.createEditor()
}else{B=$(this.EDITOR_ID)
}if(!this.isTimeEditorLayoutCreated){this.createTimeEditorLayout(B)
}$(this.TIME_EDITOR_LAYOUT_ID).show();
var A=$(this.EDITOR_SHADOW_ID);
this.setEditorPosition($(this.id),B,A);
this.updateTimeEditor();
A.show();
B.show();
Element.clonePosition(this.EDITOR_LAYOUT_SHADOW_ID,this.TIME_EDITOR_LAYOUT_ID,{offsetLeft:3,offsetTop:3});
this.isEditorVisible=true
},hideEditor:function(){if(this.isTimeEditorLayoutCreated){$(this.TIME_EDITOR_LAYOUT_ID).hide()
}if(this.isDateEditorLayoutCreated){$(this.DATE_EDITOR_LAYOUT_ID).hide()
}$(this.EDITOR_ID).hide();
$(this.EDITOR_SHADOW_ID).hide();
this.isEditorVisible=false
},hideTimeEditor:function(C){this.hideEditor();
if(C&&this.selectedDate){var A=parseInt($(this.id+"TimeMinutes").value,10);
var D=parseInt($(this.id+"TimeHours").value,10);
if(this.timeType==2){if($(this.id+"TimeSign").value.toLowerCase()=="am"){if(D==12){D=0
}}else{if(D!=12){D+=12
}}}var B=new Date(this.selectedDate.getFullYear(),this.selectedDate.getMonth(),this.selectedDate.getDate(),D,A,0);
if(B-this.selectedDate&&this.invokeEvent("timeselect",null,null,B)){this.selectedDate=B;
this.renderHF();
this.invokeEvent("timeselected",null,null,this.selectedDate)
}}if(this.params.popup&&!this.showApplyButton&&C){this.close(true)
}},showDateEditor:function(){var B;
if(!this.isEditorCreated){B=this.createEditor()
}else{B=$(this.EDITOR_ID)
}if(!this.isDateEditorLayoutCreated){this.createDateEditorLayout(B)
}else{this.updateDateEditor()
}$(this.DATE_EDITOR_LAYOUT_ID).show();
var A=$(this.EDITOR_SHADOW_ID);
this.setEditorPosition($(this.id),B,A);
A.show();
B.show();
Element.clonePosition(this.EDITOR_LAYOUT_SHADOW_ID,this.DATE_EDITOR_LAYOUT_ID,{offsetLeft:3,offsetTop:3});
this.isEditorVisible=true
},hideDateEditor:function(A){this.hideEditor();
if(A){this.changeCurrentDate(this.dateEditorYear,this.dateEditorMonth)
}}});
CalendarView={};
CalendarView.getControl=function(F,B,C,D){var A=Object.extend({onclick:(C?"Richfaces.getComponent('calendar',this)."+C+"("+(D?D:"")+");":"")+"return true;",className:"rich-calendar-btn"},B);
return new E("div",A,[new T(F)])
};
CalendarView.getSelectedDateControl=function(B){if(!B.selectedDate||B.showApplyButton){return""
}var C=Richfaces.Calendar.formatDate(B.selectedDate,(B.timeType?B.datePattern:B.params.datePattern),B.params.monthLabels,B.params.monthLabelsShort);
var A=new E("div",{"class":"rich-calendar-tool-btn","onclick":"Richfaces.getComponent('calendar',this).showSelectedDate(); return true;"},[new ET(C)]);
return A
};
CalendarView.getTimeControl=function(B){if(!B.selectedDate||!B.timeType){return""
}var C=Richfaces.Calendar.formatDate(B.selectedDate,B.timePattern,B.params.monthLabels,B.params.monthLabelsShort);
var A=new E("div",{"class":"rich-calendar-tool-btn rich-calendar-tool-btn-hover rich-calendar-tool-btn-press","onclick":"Richfaces.getComponent('calendar',this).showTimeEditor();return true;","onmouseover":"Element.removeClassName(this, 'rich-calendar-tool-btn-press');","onmouseout":"Element.addClassName(this, 'rich-calendar-tool-btn-press');"},[new ET(C)]);
return A
};
CalendarView.toolButtonAttributes={className:"rich-calendar-tool-btn",onmouseover:"this.className='rich-calendar-tool-btn rich-calendar-tool-btn-hover'",onmouseout:"this.className='rich-calendar-tool-btn'",onmousedown:"this.className='rich-calendar-tool-btn rich-calendar-tool-btn-hover rich-calendar-tool-btn-press'",onmouseup:"this.className='rich-calendar-tool-btn rich-calendar-tool-btn-hover'"};
CalendarView.nextYearControl=CalendarView.getControl(">>",CalendarView.toolButtonAttributes,"nextYear");
CalendarView.previousYearControl=CalendarView.getControl("<<",CalendarView.toolButtonAttributes,"prevYear");
CalendarView.nextMonthControl=CalendarView.getControl(">",CalendarView.toolButtonAttributes,"nextMonth");
CalendarView.previousMonthControl=CalendarView.getControl("<",CalendarView.toolButtonAttributes,"prevMonth");
CalendarView.currentMonthControl=function(A){return CalendarView.getControl(Richfaces.Calendar.formatDate(A.calendar.getCurrentDate(),"MMMM, yyyy",A.monthLabels,A.monthLabelsShort),CalendarView.toolButtonAttributes,"showDateEditor")
};
CalendarView.todayControl=function(A){return(A.calendar.todayControlMode!="hidden"?CalendarView.getControl(A.controlLabels.today,CalendarView.toolButtonAttributes,"today"):"")
};
CalendarView.selectedDateControl=function(A){return CalendarView.getSelectedDateControl(A.calendar)
};
CalendarView.timeControl=function(A){return CalendarView.getTimeControl(A.calendar)
};
CalendarView.closeControl=function(A){return(A.calendar.params.popup?CalendarView.getControl(A.controlLabels.close,CalendarView.toolButtonAttributes,"close","false"):"")
};
CalendarView.applyControl=function(A){return(A.calendar.showApplyButton?CalendarView.getControl(A.controlLabels.apply,CalendarView.toolButtonAttributes,"close","true"):"")
};
CalendarView.cleanControl=function(A){return(A.calendar.selectedDate?CalendarView.getControl(A.controlLabels.clean,CalendarView.toolButtonAttributes,"resetSelectedDate"):"")
};
CalendarView.timeEditorFields=function(A){return A.calendar.timePatternHtml
};
CalendarView.header=[new E("table",{"border":"0","cellpadding":"0","cellspacing":"0","width":"100%"},[new E("tbody",{},[new E("tr",{},[new E("td",{"class":"rich-calendar-tool"},[new ET(function(A){return Richfaces.evalMacro("previousYearControl",A)
})]),new E("td",{"class":"rich-calendar-tool"},[new ET(function(A){return Richfaces.evalMacro("previousMonthControl",A)
})]),new E("td",{"class":"rich-calendar-month"},[new ET(function(A){return Richfaces.evalMacro("currentMonthControl",A)
})]),new E("td",{"class":"rich-calendar-tool"},[new ET(function(A){return Richfaces.evalMacro("nextMonthControl",A)
})]),new E("td",{"class":"rich-calendar-tool"},[new ET(function(A){return Richfaces.evalMacro("nextYearControl",A)
})]),new E("td",{"class":"rich-calendar-tool rich-calendar-tool-close","style":function(A){return(this.isEmpty?"display:none;":"")
}},[new ET(function(A){return Richfaces.evalMacro("closeControl",A)
})])])])])];
CalendarView.footer=[new E("table",{"border":"0","cellpadding":"0","cellspacing":"0","width":"100%"},[new E("tbody",{},[new E("tr",{},[new E("td",{"class":"rich-calendar-toolfooter","style":function(A){return(this.isEmpty?"display:none;":"")
}},[new ET(function(A){return Richfaces.evalMacro("selectedDateControl",A)
})]),new E("td",{"class":"rich-calendar-toolfooter","style":function(A){return(this.isEmpty?"display:none;":"")
}},[new ET(function(A){return Richfaces.evalMacro("cleanControl",A)
})]),new E("td",{"class":"rich-calendar-toolfooter","style":function(A){return(this.isEmpty?"display:none;":"")
}},[new ET(function(A){return Richfaces.evalMacro("timeControl",A)
})]),new E("td",{"width":"100%"},[]),new E("td",{"class":"rich-calendar-toolfooter","style":function(A){return(this.isEmpty?"display:none;":"")+(!A.calendar.showApplyButton?"background-image:none;":"")
}},[new ET(function(A){return Richfaces.evalMacro("todayControl",A)
})]),new E("td",{"class":"rich-calendar-toolfooter","style":function(A){return(this.isEmpty?"display:none;":"")+"background-image:none;"
}},[new ET(function(A){return Richfaces.evalMacro("applyControl",A)
})])])])])];
CalendarView.timeEditorLayout=[new E("table",{"id":function(A){return A.calendar.TIME_EDITOR_LAYOUT_ID
},"border":"0","cellpadding":"0","cellspacing":"0","class":"rich-calendar-time-layout"},[new E("tbody",{},[new E("tr",{},[new E("td",{"class":"rich-calendar-time-layout-fields","colspan":"2","align":"center"},[new ET(function(A){return Richfaces.evalMacro("timeEditorFields",A)
})])]),new E("tr",{},[new E("td",{"class":"rich-calendar-time-layout-ok"},[new E("div",{"id":function(A){return A.calendar.TIME_EDITOR_BUTTON_OK
},"class":"rich-calendar-time-btn","style":"float:right;","onmousedown":"Element.addClassName(this, 'rich-calendar-time-btn-press');","onmouseout":"Element.removeClassName(this, 'rich-calendar-time-btn-press');","onmouseup":"Element.removeClassName(this, 'rich-calendar-time-btn-press');","onclick":function(A){return"$('"+A.calendar.id+"').component.hideTimeEditor(true)"
}},[new E("span",{},[new ET(function(A){return A.controlLabels.ok
})])])]),new E("td",{"class":"rich-calendar-time-layout-cancel"},[new E("div",{"id":function(A){return A.calendar.TIME_EDITOR_BUTTON_CANCEL
},"class":"rich-calendar-time-btn","style":"float:left;","onmousedown":"Element.addClassName(this, 'rich-calendar-time-btn-press');","onmouseout":"Element.removeClassName(this, 'rich-calendar-time-btn-press');","onmouseup":"Element.removeClassName(this, 'rich-calendar-time-btn-press');","onclick":function(A){return"$('"+A.calendar.id+"').component.hideTimeEditor(false)"
}},[new E("span",{},[new ET(function(A){return A.controlLabels.cancel
})])])])])])])];
CalendarView.dayList=[new ET(function(A){return A.day
})];
CalendarView.weekNumber=[new ET(function(A){return A.weekNumber
})];
CalendarView.weekDay=[new ET(function(A){return A.weekDayLabelShort
})];
CalendarContext=Class.create();
Object.extend(CalendarContext.prototype,{initialize:function(A){this.calendar=A;
this.monthLabels=A.params.monthLabels;
this.monthLabelsShort=A.params.monthLabelsShort;
this.weekDayLabels=A.params.weekDayLabels;
this.weekDayLabelsShort=A.params.weekDayLabelsShort;
this.controlLabels=A.params.labels
},nextYearControl:CalendarView.nextYearControl,previousYearControl:CalendarView.previousYearControl,nextMonthControl:CalendarView.nextMonthControl,previousMonthControl:CalendarView.previousMonthControl,currentMonthControl:CalendarView.currentMonthControl,selectedDateControl:CalendarView.selectedDateControl,cleanControl:CalendarView.cleanControl,timeControl:CalendarView.timeControl,todayControl:CalendarView.todayControl,closeControl:CalendarView.closeControl,applyControl:CalendarView.applyControl,timeEditorFields:CalendarView.timeEditorFields,timeEditorLayout:CalendarView.timeEditorLayout})

if(!window.Richfaces){window.Richfaces={}
}Richfaces.ContextMenu=Class.create();
Richfaces.ContextMenu.prototype={initialize:function(D,B,C,A){this.options=A||{};
this.id=D;
this.element=$(D);
this.menuContent=null;
this.evaluator=C;
this.element.component=this;
this["rich:destructor"]="destroy";
this.doShow=this.show;
this.doHide=this.hide;
this.delay=B
},destroy:function(){this.element.component=null;
this.element=null;
this.menuContent=null
},attachToParent:function(F,D,B){var A=$(F);
if(!A){A=this.element;
if(A){A=A.parentNode
}}if(A){this.applyDecoration(A)
}var C=D.substr(2);
var E=this.show.bindAsEventListener(this,B);
Event.observe(A,C,E)
},hide:function(){RichFaces.Menu.Layers.shutdown()
},show:function(B,A){this.construct(A);
B.parameters=A;
var C=new RichFaces.Menu.DelayedContextMenu(this.id+"_menu",B);
window.setTimeout(C.show,this.delay)
},construct:function(B){if(this.isNewContext(B)){this.destroyMenu()
}var C=document.createElement("div");
C.id=this.id+":_auto_created";
this.element.appendChild(C);
var A=this.evaluator.invoke("getContent",B||window).join("");
new Insertion.Top(C,A);
this.menuContent=C
},destroyMenu:function(){if(this.menuContent){window.RichFaces.Memory.clean(this.menuContent);
this.menuContent.parentNode.removeChild(this.menuContent);
this.menuContent=null
}},isNewContext:function(A){return true
},applyDecoration:function(A){$(A).addClassName("rich-cm-attached")
}};
Richfaces.disableDefaultHandler=function(A){if(A.startsWith("on")){A=A.substr(2)
}Event.observe(document,A,Event.stop)
};
Richfaces.enableDefaultHandler=function(A){if(A.startsWith("on")){A=A.substr(2)
}Event.stopObserving(document,A,Event.stop)
}

var sbjQuery=oldJQuery;
sbjQuery.fn.SpinButton=function(A){return this.each(function(){this.spinCfg={min:A&&!isNaN(parseFloat(A.min))?Number(A.min):null,max:A&&!isNaN(parseFloat(A.max))?Number(A.max):null,step:A&&A.step?Number(A.step):1,page:A&&A.page?Number(A.page):10,upClass:A&&A.upClass?A.upClass:"up",downClass:A&&A.downClass?A.downClass:"down",reset:A&&A.reset?A.reset:this.value,delay:A&&A.delay?Number(A.delay):500,interval:A&&A.interval?Number(A.interval):100,_btn_width:20,_btn_height:12,_direction:null,_delay:null,_repeat:null,digits:A&&A.digits?Number(A.digits):1};
this.adjustValue=function(G){var F=this.value.toLowerCase();
if(F=="am"){this.value="PM";
return 
}else{if(F=="pm"){this.value="AM";
return 
}}F=(isNaN(this.value)?this.spinCfg.reset:Number(this.value))+Number(G);
if(this.spinCfg.min!==null){F=(F<this.spinCfg.min?(this.spinCfg.max!=null?this.spinCfg.max:this.spinCfg.min):F)
}if(this.spinCfg.max!==null){F=(F>this.spinCfg.max?(this.spinCfg.min!=null?this.spinCfg.min:this.spinCfg.max):F)
}var H=String(F);
while(H.length<this.spinCfg.digits){H="0"+H
}this.value=H
};
sbjQuery(this).keydown(function(F){switch(F.keyCode){case 38:this.adjustValue(this.spinCfg.step);
break;
case 40:this.adjustValue(-this.spinCfg.step);
break;
case 33:this.adjustValue(this.spinCfg.page);
break;
case 34:this.adjustValue(-this.spinCfg.page);
break
}}).bind("mousewheel",function(F){if(F.wheelDelta>=120){this.adjustValue(this.spinCfg.step)
}else{if(F.wheelDelta<=-120){this.adjustValue(-this.spinCfg.step)
}}F.preventDefault()
}).change(function(F){this.adjustValue(0)
});
var D=this;
var C=$(this.id+"BtnUp");
sbjQuery(C).mousedown(function(G){var F=function(){D.adjustValue(D.spinCfg.step)
};
F();
D.spinCfg._delay=window.setTimeout(function(){F();
D.spinCfg._repeat=window.setInterval(F,D.spinCfg.interval)
},D.spinCfg.delay);
D.spinCfg._repeater=true
}).mouseup(function(F){D.spinCfg._repeater=false;
window.clearInterval(D.spinCfg._repeat);
window.clearTimeout(D.spinCfg._delay)
}).dblclick(function(F){if(sbjQuery.browser.msie){D.adjustValue(D.spinCfg.step)
}}).mouseout(function(F){if(D.spinCfg._repeater){D.spinCfg._repeater=false;
window.clearInterval(D.spinCfg._repeat);
window.clearTimeout(D.spinCfg._delay)
}});
var E=$(this.id+"BtnDown");
sbjQuery(E).mousedown(function(G){var F=function(){D.adjustValue(-D.spinCfg.step)
};
F();
D.spinCfg._delay=window.setTimeout(function(){F();
D.spinCfg._repeat=window.setInterval(F,D.spinCfg.interval)
},D.spinCfg.delay);
D.spinCfg._repeater=true
}).mouseup(function(F){D.spinCfg._repeater=false;
window.clearInterval(D.spinCfg._repeat);
window.clearTimeout(D.spinCfg._delay)
}).dblclick(function(F){if(sbjQuery.browser.msie){D.adjustValue(-D.spinCfg.step)
}}).mouseout(function(F){if(D.spinCfg._repeater){D.spinCfg._repeater=false;
window.clearInterval(D.spinCfg._repeat);
window.clearTimeout(D.spinCfg._delay)
}});
if(this.addEventListener){this.addEventListener("DOMMouseScroll",function(F){if(F.detail>0){this.adjustValue(-this.spinCfg.step)
}else{if(F.detail<0){this.adjustValue(this.spinCfg.step)
}}F.preventDefault()
},false)
}});
function B(D,F){var E=D[F],C=document.body;
while((D=D.offsetParent)&&(D!=C)){if(!sbjQuery.browser.msie||(D.currentStyle.position!="relative")){E+=D[F]
}}return E
}}

if(!window.RichFaces){window.RichFaces={}
}if(!RichFaces.Menu){RichFaces.Menu={}
}RichFaces.Menu.fitLayerToContent=function(A){if(!RichFaces.Menu.Layers.IE){return 
}var C=A.childNodes[0];
if(C){if(A.style.width.indexOf("px")!=-1){var B=parseFloat(A.style.width.substring(0,A.style.width.indexOf("px")));
var D=Element.getDimensions(C);
if(D.width>B){A.style.width=D.width+"px"
}}}};
RichFaces.Menu.removePx=function(A){if((A+"").indexOf("px")!=-1){return(A+"").substring(0,A.length-2)
}else{return A
}};
RichFaces.Menu.Layers={listl:new Array(),father:{},lwidthDetected:false,lwidth:{},back:new Array(),horizontals:{},layers:{},levels:["","","","","","","","","","",""],detectWidth:function(){this.IE=(navigator.userAgent.indexOf("MSIE")>-1)&&(navigator.userAgent.indexOf("Opera")<0);
this.NS=(navigator.userAgent.indexOf("Netscape")>-1)
},menuTopShift:-11,menuRightShift:11,menuLeftShift:0,shadowWidth:0,thresholdY:0,abscissaStep:180,CornerRadius:0,toBeHidden:new Array(),toBeHiddenLeft:new Array(),toBeHiddenTop:new Array(),layersMoved:0,layerPoppedUp:"",layerTop:new Array(),layerLeft:new Array(),timeoutFlag:0,useTimeouts:1,timeoutLength:500,showTimeOutFlag:0,showTimeoutLength:0,queuedId:"",LMPopUp:function(B,A,C){if(!this.loaded||(this.isVisible(B)&&!A)){return 
}if(B==this.father[this.layerPoppedUp]){this.LMPopUpL(this.layerPoppedUp,false,C)
}else{if(this.father[B]==this.layerPoppedUp){this.LMPopUpL(B,true,C)
}else{foobar=B;
do{this.LMPopUpL(foobar,true,C);
foobar=this.father[foobar]
}while(foobar)
}}this.layerPoppedUp=B
},isVisible:function(A){return($(A).style.visibility=="visible")
},LMPopUpL:function(A,B,D){if(!this.loaded){return 
}this.detectWidth();
var F=$(A);
RichFaces.Menu.fitLayerToContent(F);
var E=this.isVisible(A);
this.setVisibility(A,B);
this.ieSelectWorkAround(A,B);
var C=this.layers[F.id];
if(E&&!B){if(C){if(C.eventOnClose){C.eventOnClose(D)
}if(C.eventOnCollapse){C.eventOnCollapse(D)
}if(C.refItem){C.refItem.highLightGroup(false)
}}}else{if(!E&&B){if(C){if(C.eventOnOpen){C.eventOnOpen(D)
}if(C.eventOnExpand){C.eventOnExpand(D)
}if(C.level>0){do{C=this.layers[(this.father[C.id])]
}while(C.level>0);
if(C&&C.eventOnGroupActivate){C.eventOnGroupActivate(D)
}}}}}},initIFrame:function(A){var C=$(A);
var B=new Insertion.Before(C,'<iframe src="javascript:\'\'" id="'+C.id+'_iframe" style=" position: absolute; z-index: 1;" class="underneath_iframe"></iframe>');
return B
},ieSelectWorkAround:function(B,A){if(this.IE||this.NS){B=$(B).id;
var F=$(B);
var C=$(B+"_iframe");
if(!C&&A){this.initIFrame(F);
C=$(B+"_iframe")
}var D=(this.NS?7:0);
if(A){var E=Element.getDimensions(F);
C.style.top=F.style.top;
C.style.left=F.style.left;
C.style.width=F.offsetWidth+"px";
C.style.height=F.offsetHeight+"px";
C.style.visibility="visible"
}else{if(C){C.style.visibility="hidden"
}}}},shutdown:function(){var C=false;
for(var B=0;
B<this.listl.length;
B++){var A=this.listl[B];
if($(A)){this.LMPopUpL(A,false)
}else{C=true
}}if(C){this.resetLayers()
}this.layerPoppedUp="";
if(this.Konqueror||this.IE5){this.seeThroughElements(true)
}},resetLayers:function(){var B=new Array();
for(i=0;
i<this.listl.length;
i++){var A=this.listl[i];
if($(A)){B.push(A)
}}this.listl=B
},setVisibility:function(B,C){var D=$(B);
if(C){D.style.visibility="visible"
}else{if(D.getElementsByTagName){var A=D.getElementsByTagName("INPUT");
if(A){$A(A).each(function(E){E.blur()
})
}}D.style.visibility="hidden"
}},clearLMTO:function(){if(this.useTimeouts){clearTimeout(this.timeoutFlag)
}},setLMTO:function(A){if(!A){A=this.timeoutLength
}if(this.useTimeouts){clearTimeout(this.timeoutFlag);
this.timeoutFlag=setTimeout("RichFaces.Menu.Layers.shutdown()",A)
}},loaded:1,clearPopUpTO:function(){clearTimeout(this.showTimeOutFlag)
},showMenuLayer:function(A,C,B){this.clearPopUpTO();
this.showTimeOutFlag=setTimeout(new RichFaces.Menu.DelayedPopUp(A,C,function(){this.layerId=null
}.bind(this)).show,B);
this.layerId=A
},showDropDownLayer:function(A,D,C,B){this.clearPopUpTO();
this.showTimeOutFlag=setTimeout(new RichFaces.Menu.DelayedDropDown(A,D,C).show,B)
},showPopUpLayer:function(A,B){this.shutdown();
this.detectWidth();
this.LMPopUp(menuName,false);
this.setLMTO(4)
}};
RichFaces.Menu.getWindowElement=function(){return(document.documentElement||document.body)
};
RichFaces.Menu.getWindowDimensions=function(){var A,B;
if(self.innerHeight){A=self.innerWidth;
B=self.innerHeight
}else{if(document.documentElement&&document.documentElement.clientHeight){A=document.documentElement.clientWidth;
B=document.documentElement.clientHeight
}else{if(document.body){A=document.body.clientWidth;
B=document.body.clientHeight
}}}return{width:A,height:B}
};
RichFaces.Menu.getWindowScrollOffset=function(){var A,B;
if(typeof pageYOffset!="undefined"){A=window.pageXOffset;
B=window.pageYOffset
}else{if(document.documentElement&&document.documentElement.scrollTop){A=document.documentElement.scrollLeft;
B=document.documentElement.scrollTop
}else{if(document.body){A=document.body.scrollLeft;
B=document.body.scrollTop
}}}return{top:B,left:A}
};
RichFaces.Menu.getPageDimensions=function(){var A,D;
var C=document.body.scrollHeight;
var B=document.body.offsetHeight;
if(C>B){A=document.body.scrollWidth;
D=document.body.scrollHeight
}else{A=document.body.offsetWidth;
D=document.body.offsetHeight
}return{width:A,height:D}
};
RichFaces.Menu.DelayedContextMenu=function(A,B){if(!B){B=window.event
}this.event=Object.clone(B);
this.element=Event.element(B);
this.layer=$(A);
this.show=function(){RichFaces.Menu.Layers.shutdown();
var I=RichFaces.Menu.getPageDimensions();
var J=RichFaces.Menu.getWindowDimensions();
var R=I.height;
var O=I.width;
var E=this.event.clientX;
var C=this.event.clientY;
var K=this.event;
var P=Event.pointerX(K);
var N=Event.pointerY(K);
var Q=Richfaces.Position.getOffsetDimensions(this.layer);
var G=Position.cumulativeOffset(this.layer);
G[0]-=this.layer.offsetLeft||0;
G[1]-=this.layer.offsetTop||0;
var F=P-G[0];
var D=N-G[1];
var H=Element.getDimensions(this.layer);
var M=F;
if(E+H.width>J.width){M-=(H.width-RichFaces.Menu.Layers.shadowWidth-RichFaces.Menu.Layers.CornerRadius)
}if(M<0){M=0
}var L=D;
if(C+H.height>J.height){L-=(H.height-RichFaces.Menu.Layers.shadowWidth-RichFaces.Menu.Layers.CornerRadius)
}if(L<0){L=0
}this.layer.style.left=M+"px";
this.layer.style.top=L+"px";
RichFaces.Menu.Layers.LMPopUp(this.layer.id,false,this.event);
RichFaces.Menu.Layers.clearLMTO();
this.layer=null;
this.element=null;
this.event=null
}.bind(this)
};
RichFaces.Menu.DelayedDropDown=function(B,A,C){if(!C){C=window.event
}this.event=C;
this.element=$(A)||Event.element(C);
this.layer=$(B);
Event.stop(C);
this.listPositions=function(D,E){var G=new Array(new Array(2,1,4),new Array(1,2,3),new Array(4,3,2),new Array(3,4,1));
var H=new Array();
if(D>0&&E>0){H.push({jointPoint:D,direction:E})
}else{if(D>0&&E==0){for(var F=0;
F<3;
F++){H.push({jointPoint:D,direction:G[D-1][F]})
}}else{if(D==0&&E>0){for(var F=0;
F<3;
F++){H.push({jointPoint:G[E-1][F],direction:E})
}}else{if(D==0&&E==0){H.push({jointPoint:4,direction:3});
H.push({jointPoint:1,direction:2});
H.push({jointPoint:3,direction:4});
H.push({jointPoint:2,direction:1})
}}}}return H
}.bind(this);
this.calcPosition=function(D,E){var F;
var G;
switch(D){case 1:F=this.left;
G=this.top;
break;
case 2:F=this.right;
G=this.top;
break;
case 3:F=this.right;
G=this.bottom;
break;
case 4:F=this.left;
G=this.bottom;
break
}switch(E){case 1:F-=this.layerdim.width;
G-=this.layerdim.height;
break;
case 2:G-=this.layerdim.height;
break;
case 4:F-=this.layerdim.width
}return{left:F,top:G}
}.bind(this);
this.show=function(){RichFaces.Menu.Layers.shutdown();
var R=RichFaces.Menu.getWindowScrollOffset();
var I=RichFaces.Menu.getWindowDimensions();
var V=RichFaces.Menu.getPageDimensions();
var M=I.height;
var X=I.width;
var N=Position.positionedOffset(this.element);
var W=this.element.lastChild;
var P=Element.getDimensions(this.element);
var F=Position.cumulativeOffset(this.element);
var E=Position.cumulativeOffset(W);
var U=E[0]-F[0];
var T=E[1]-F[1];
this.top=N[1];
this.left=N[0];
this.bottom=this.top+P.height;
this.right=this.left+P.width;
this.layerdim=Element.getDimensions(this.layer);
var H=RichFaces.Menu.Layers.layers[this.layer.id].options;
var J=0;
if(H.jointPoint){var K=H.jointPoint.toUpperCase();
J=K.indexOf("TL")!=-1?1:J;
J=K.indexOf("TR")!=-1?2:J;
J=K.indexOf("BR")!=-1?3:J;
J=K.indexOf("BL")!=-1?4:J
}var S=0;
if(H.direction){var D=H.direction.toUpperCase();
S=D.indexOf("TOP-LEFT")!=-1?1:S;
S=D.indexOf("TOP-RIGHT")!=-1?2:S;
S=D.indexOf("BOTTOM-RIGHT")!=-1?3:S;
S=D.indexOf("BOTTOM-LEFT")!=-1?4:S
}var Y=H.horizontalOffset;
var O=H.verticalOffset;
var G=this.listPositions(J,S);
var L;
var Z=false;
for(var Q=0;
Q<G.length;
Q++){L=this.calcPosition(G[Q].jointPoint,G[Q].direction);
if((L.left+Y>=R.left)&&(L.left+Y+this.layerdim.width-R.left<=X)&&(L.top+O>=R.top)&&(L.top+O+this.layerdim.height-R.top<=M)){Z=true;
break
}}if(!Z){L=this.calcPosition(G[0].jointPoint,G[0].direction)
}this.layer.style.left=L.left+Y-U-this.left+"px";
this.layer.style.top=L.top+O-T-this.top+"px";
this.layer.style.width=this.layer.clientWidth+"px";
RichFaces.Menu.Layers.LMPopUp(this.layer.id,false,this.event);
RichFaces.Menu.Layers.clearLMTO();
this.layer=null;
this.element=null;
this.event=null
}.bind(this)
};
RichFaces.Menu.DelayedPopUp=function(A,B){if(!B){B=window.event
}this.event=B;
this.element=Event.findElement(B,"div");
if(this.element.id.indexOf(":folder")==(this.element.id.length-7)){this.element=this.element.parentNode
}this.layer=$(A);
this.show=function(){if(!RichFaces.Menu.Layers.isVisible(this.layer)&&RichFaces.Menu.Layers.isVisible(RichFaces.Menu.Layers.father[this.layer.id])){this.reposition();
RichFaces.Menu.Layers.LMPopUp(this.layer,false,this.event)
}this.layer=null;
this.element=null;
this.event=null
}.bind(this)
};
RichFaces.Menu.DelayedPopUp.prototype.reposition=function(){var A=RichFaces.Menu.getWindowScrollOffset();
var K=RichFaces.Menu.getWindowDimensions();
var I=K.height;
var Z=K.width;
var C={top:0,left:0};
var M=Position.positionedOffset(this.element);
var P=RichFaces.Menu.removePx(this.element.parentNode.parentNode.style.left);
var V=RichFaces.Menu.removePx(this.element.parentNode.parentNode.style.top);
M[0]+=Number(P);
M[1]+=Number(V);
var Y=Position.cumulativeOffset(this.element);
var W=[Y[0]-M[0],Y[1]-M[1]];
var U=Element.getDimensions(this.element);
var N=M[1]+C.top;
var G=N+U.height;
var F=M[0]+C.left;
var X=F+U.width;
var Q=Element.getDimensions(this.layer);
var E=RichFaces.Menu.Layers.layers[this.layer.id].options;
var S=0;
var L=0;
if(E.direction){strDirection=E.direction.toUpperCase();
S=strDirection.indexOf("LEFT")!=-1?1:S;
S=strDirection.indexOf("RIGHT")!=-1?2:S;
if(S>0){if(strDirection.indexOf("LEFT-UP")!=-1||strDirection.indexOf("RIGHT-UP")!=-1){L=1
}if(strDirection.indexOf("LEFT-DOWN")!=-1||strDirection.indexOf("RIGHT-DOWN")!=-1){L=2
}}}var D=X;
var T=N-this.layer.firstChild.firstChild.offsetTop;
if(S==0){if(D+Q.width+W[0]-A.left>=Z){var R=D+Q.width+W[0]-A.left-Z;
D=F-Q.width
}if(D+W[0]<0){if(Math.abs(D+W[0])>R){D=X
}}}else{if(S==1){D=F-Q.width
}}if(L!=2){if(T+Q.height+W[1]-A.top>=I||L==1){var B=T+Q.height+W[1]-A.top-I;
var O=this.layer.firstChild.childNodes;
if(O.length>1){var J=O[O.length-2];
var H=Position.positionedOffset(J);
T=N-H[1];
if(L==0){if(T<0){if(Math.abs(T)>B){T=N
}}}}}}this.layer.style.left=D+"px";
this.layer.style.top=T+"px";
this.layer.style.width=this.layer.clientWidth+"px"
};
RichFaces.Menu.selectOpen=false;
RichFaces.Menu.MouseIn=false;
RichFaces.Menu.Layer=Class.create();
RichFaces.Menu.Layer.prototype={initialize:function(A,D,F){RichFaces.Menu.Layers.listl.push(A);
this.id=A;
this.level=0;
this.delay=D;
if(F){this.hideDelay=F
}else{this.hideDelay=F
}var E=$(A);
RichFaces.Menu.fitLayerToContent(E);
this.items=new Array();
RichFaces.Menu.Layers.layers[A]=this;
this.bindings=new Array();
this.highlightParent=true;
this.mouseover=function(K){RichFaces.Menu.MouseIn=true;
RichFaces.Menu.Layers.clearLMTO();
if(this.shouldHighlightParent()&&!this.isWithin(K)){this.highlightLabel()
}Event.stop(K)
}.bindAsEventListener(this);
this.mouseout=function(K){RichFaces.Menu.MouseIn=false;
if(!RichFaces.Menu.selectOpen){RichFaces.Menu.Layers.setLMTO(this.hideDelay)
}if(this.shouldHighlightParent()&&!this.isWithin(K)){this.unHighlightLabel()
}Event.stop(K)
}.bindAsEventListener(this);
var H=new RichFaces.Menu.Layer.Binding(this.id,"mouseover",this.mouseover);
this.bindings.push(H);
H.refresh();
H=new RichFaces.Menu.Layer.Binding(this.id,"mouseout",this.mouseout);
this.bindings.push(H);
H.refresh();
arrayinp=$A(E.getElementsByTagName("select"));
for(i=0;
i<arrayinp.length;
i++){var J=this.openSelect.bindAsEventListener(this);
var I=this.closeSelect.bindAsEventListener(this);
Event.observe(arrayinp[i],"focus",J);
Event.observe(arrayinp[i],"blur",I);
var C=this.MouseoverInInput.bindAsEventListener(this);
var G=this.MouseoutInInput.bindAsEventListener(this);
Event.observe(arrayinp[i],"mouseover",C);
Event.observe(arrayinp[i],"mouseout",G);
var B=this.OnKeyPress.bindAsEventListener(this);
Event.observe(arrayinp[i],"keypress",B)
}arrayinp=$A(E.getElementsByTagName("input"));
for(i=0;
i<arrayinp.length;
i++){var J=this.openSelect.bindAsEventListener(this);
var I=this.closeSelect.bindAsEventListener(this);
Event.observe(arrayinp[i],"focus",J);
Event.observe(arrayinp[i],"blur",I);
var C=this.MouseoverInInput.bindAsEventListener(this);
var G=this.MouseoutInInput.bindAsEventListener(this);
Event.observe(arrayinp[i],"mouseover",C);
Event.observe(arrayinp[i],"mouseout",G);
var B=this.OnKeyPress.bindAsEventListener(this);
Event.observe(arrayinp[i],"keypress",B)
}arrayinp=$A(E.getElementsByTagName("textarea"));
for(i=0;
i<arrayinp.length;
i++){var J=this.openSelect.bindAsEventListener(this);
var I=this.closeSelect.bindAsEventListener(this);
Event.observe(arrayinp[i],"focus",J);
Event.observe(arrayinp[i],"blur",I);
var C=this.MouseoverInInput.bindAsEventListener(this);
var G=this.MouseoutInInput.bindAsEventListener(this);
Event.observe(arrayinp[i],"mouseover",C);
Event.observe(arrayinp[i],"mouseout",G)
}},getLayer:function(){return $(this.id)
},getLabel:function(){return RichFaces.Menu.Layers.layers[this.id].getLayer().parentNode.parentNode
},highlightLabel:function(){var A=$(this.getLabel());
RichFaces.Menu.Items.replaceClasses(A,["dr-menu-label-unselect","rich-ddmenu-label-unselect"],["dr-menu-label-select","rich-ddmenu-label-select"])
},unHighlightLabel:function(){var A=$(this.getLabel());
RichFaces.Menu.Items.replaceClasses(A,["dr-menu-label-select","rich-ddmenu-label-select"],["dr-menu-label-unselect","rich-ddmenu-label-unselect"])
},shouldHighlightParent:function(){var A=this.highlightParent;
var B=null;
if(A&&(B=this.getParentLayer())){A&=B.shouldHighlightParent()
}return A
},getParentLayer:function(){return this.level>0?RichFaces.Menu.Layers.layers[(RichFaces.Menu.Layers.father[this.id])]:null
},isWithin:function(E){E=Event.extend(E);
var B=true;
var C=E.relatedTarget;
while(C&&C.nodeType!=1){C=C.parentNode
}var A=E.target;
var D=$(this.id);
if(C){B=$(C).descendantOf(D)
}B&=$(A).descendantOf(D);
return B
},openSelect:function(B){RichFaces.Menu.selectOpen=true;
var A=this.ClickInput.bindAsEventListener(this);
Event.observe(Event.element(B),"click",this.ClickInput)
},closeSelect:function(B){RichFaces.Menu.selectOpen=false;
var A=this.ClickInput.bindAsEventListener(this);
Event.stopObserving(Event.element(B),"click",this.ClickInput);
if(RichFaces.Menu.MouseIn==false){RichFaces.Menu.Layers.setLMTO(this.hideDelay)
}},OnKeyPress:function(A){if(A.keyCode==13){RichFaces.Menu.Layers.setLMTO(this.hideDelay)
}},MouseoverInInput:function(B){var A=this.ClickInput.bindAsEventListener(this);
Event.observe(Event.element(B),"click",this.ClickInput)
},ClickInput:function(A){Event.stop(A||window.event);
return false
},MouseoutInInput:function(B){var A=this.ClickInput.bindAsEventListener(this);
Event.stopObserving(Event.element(B),"click",this.ClickInput)
},rebind:function(){$A(this.bindings).each(function(A){A.refresh()
})
},showMe:function(A){this.closeSiblings(A);
RichFaces.Menu.Layers.showMenuLayer(this.id,A,this.delay);
RichFaces.Menu.Layers.levels[this.level]=this
},closeSiblings:function(B){if(RichFaces.Menu.Layers.levels[this.level]&&RichFaces.Menu.Layers.levels[this.level].id!=this.id){for(var A=this.level;
A<RichFaces.Menu.Layers.levels.length;
A++){if(RichFaces.Menu.Layers.levels[A]){RichFaces.Menu.Layers.levels[A].hideMe()
}}}},closeMinors:function(C){var B=this.items[C];
for(var A=this.level+(!B.childMenu?1:2);
A<RichFaces.Menu.Layers.levels.length;
A++){if(RichFaces.Menu.Layers.levels[A]){RichFaces.Menu.Layers.levels[A].hideMe()
}}if(B.menu.refItem){B.menu.refItem.highLightGroup(true)
}},addItem:function(D,B){var A=this;
var C=new RichFaces.Menu.Item(D,this,B||{});
this.items[D]=C;
return this
},hideMe:function(A){RichFaces.Menu.Layers.clearPopUpTO();
RichFaces.Menu.Layers.levels[this.level]=null;
RichFaces.Menu.Layers.LMPopUpL(this.id,false)
},asDropDown:function(H,C,G,E,J){this.options=J||{};
if(this.options.ongroupactivate){this.eventOnGroupActivate=this.options.ongroupactivate.bindAsEventListener(this)
}if(this.options.onitemselect){this.eventOnItemSelect=this.options.onitemselect.bindAsEventListener(this)
}if(this.options.oncollapse){this.eventOnCollapse=this.options.oncollapse.bindAsEventListener(this)
}if(this.options.onexpand){this.eventOnExpand=this.options.onexpand.bindAsEventListener(this)
}var A=function(K){RichFaces.Menu.Layers.showDropDownLayer(this.id,H,K,this.delay)
};
var I=function(K){if(J.disabled==false&&!RichFaces.Menu.isWithin(K,$(H))){this.highlightLabel()
}};
var B=function(K){RichFaces.Menu.Layers.setLMTO(this.hideDelay);
RichFaces.Menu.Layers.clearPopUpTO()
};
var D=function(K){if(J.disabled==false&&!RichFaces.Menu.isWithin(K,$(H))){this.unHighlightLabel()
}};
if(!G){G="onmouseover"
}G=this.eventJsToPrototype(G);
if(!E){E="onmouseout"
}E=this.eventJsToPrototype(E);
var F=function(L,K,M){var N=new RichFaces.Menu.Layer.Binding(L,K,M);
this.bindings.push(N);
N.refresh()
}.bind(this);
if(G=="mouseover"){F(H,G,function(K){A.call(this,K);
I.call(this,K)
}.bindAsEventListener(this))
}else{F(C,G,A.bindAsEventListener(this));
F(H,"mouseover",I.bindAsEventListener(this))
}if(E=="mouseout"){F(H,E,function(K){B.call(this,K);
D.call(this,K)
}.bindAsEventListener(this))
}else{F(C,E,B.bindAsEventListener(this));
F(H,"mouseout",D.bindAsEventListener(this))
}RichFaces.Menu.Layers.horizontals[this.id]=H;
return this
},asSubMenu:function(A,B,E,C){this.options=C||{};
if(this.options.onclose){this.eventOnClose=this.options.onclose.bindAsEventListener(this)
}if(this.options.onopen){this.eventOnOpen=this.options.onopen.bindAsEventListener(this)
}if(!E){E="onmouseover"
}E=this.eventJsToPrototype(E);
this.level=RichFaces.Menu.Layers.layers[A].level+1;
RichFaces.Menu.Layers.father[this.id]=A;
if(!B){B="ref"+A
}var G=$(B);
this.refItem=RichFaces.Menu.Layers.layers[A].items[B];
this.refItem.childMenu=this;
var F=new RichFaces.Menu.Layer.Binding(B,E,this.showMe.bindAsEventListener(this));
this.bindings.push(F);
F.refresh();
var D=this;
while(D.level>0){D=RichFaces.Menu.Layers.layers[(RichFaces.Menu.Layers.father[D.id])]
}if(D&&D.hideDelay){this.hideDelay=D.hideDelay
}this.highlightParent=C.highlightParent;
return this
},asContextMenu:function(A){this.highlightParent=false;
this.options=A||{};
if(this.options.ongroupactivate){this.eventOnGroupActivate=this.options.ongroupactivate.bindAsEventListener(this)
}if(this.options.onitemselect){this.eventOnItemSelect=this.options.onitemselect.bindAsEventListener(this)
}if(this.options.oncollapse){this.eventOnCollapse=this.options.oncollapse.bindAsEventListener(this)
}if(this.options.onexpand){this.eventOnExpand=this.options.onexpand.bindAsEventListener(this)
}return this
},eventJsToPrototype:function(B){var A=B.indexOf("on");
if(A>=0){B=B.substr(A+2)
}return B
}};
RichFaces.Menu.Layer.Binding=Class.create();
RichFaces.Menu.Layer.Binding.prototype={initialize:function(A,C,B){this.objectId=A;
this.eventname=C;
this.handler=B
},refresh:function(){var A=$(this.objectId);
if(A&&A.tagName){Event.stopObserving(A,this.eventname,this.handler);
Event.observe(A,this.eventname,this.handler);
return true
}return false
}};
RichFaces.Menu.Items={classNames:["dr-menu-item-enabled","rich-menu-item-enabled"],hoverClassNames:["dr-menu-item-hover","rich-menu-item-hover"],iconClassNames:[],hoverIconClassNames:["dr-menu-icon-selected","rich-menu-item-icon-selected"],labelClassNames:[],hoverLabelClassNames:["rich-menu-item-label-selected"],replaceClasses:function(B,C,A){var D=$(B);
$A(C).each(function(E){D.removeClassName(E)
});
$A(A).each(function(E){D.addClassName(E)
})
},onmouseover:function(I){var F=I.getElement();
var H=I.getIcon();
var A=I.getLabel();
var G=I.getHoverClasses();
var D=I.getIconHoverClasses();
var E=I.getLabelHoverClasses();
var B=I.getInlineStyle();
var C=I.getHoverStyle();
F.style.cssText=B.concat(C);
this.replaceClasses(F,this.classNames,this.hoverClassNames.concat(G));
this.replaceClasses(H,this.iconClassNames,this.hoverIconClassNames.concat(D));
this.replaceClasses(A,this.labelClassNames,this.hoverLabelClassNames.concat(E))
},onmouseout:function(F){var D=F.getElement();
var E=F.getIcon();
var A=F.getLabel();
var G=F.getHoverClasses();
var B=F.getIconHoverClasses();
var C=F.getLabelHoverClasses();
var H=F.getInlineStyle();
D.style.cssText=H;
this.replaceClasses(D,this.hoverClassNames.concat(G),this.classNames);
this.replaceClasses(E,this.hoverIconClassNames.concat(B),this.iconClassNames);
this.replaceClasses(A,this.hoverLabelClassNames.concat(C),this.labelClassNames)
}};
RichFaces.Menu.isWithin=function(D,C){var A=false;
Event.extend(D);
var B=D.relatedTarget;
while(B&&B.nodeType!=1){B=B.parentNode
}if(B){A=B==C||$(B).descendantOf(C)
}return A
};
RichFaces.Menu.Item=Class.create({initialize:function(D,C,A){this.options=A;
this.id=D;
this.menu=C;
this.mouseOver=false;
var B;
B=new RichFaces.Menu.Layer.Binding(D,"mouseover",this.onmouseover.bindAsEventListener(this));
C.bindings.push(B);
B.refresh();
B=new RichFaces.Menu.Layer.Binding(D,"mouseout",this.onmouseout.bindAsEventListener(this));
C.bindings.push(B);
B.refresh();
B=new RichFaces.Menu.Layer.Binding(D,"click",this.onclick.bindAsEventListener(this));
C.bindings.push(B);
B.refresh()
},onclick:function(B){if(this.options.closeOnClick==1){var A=this.menu;
while(A.level>0){A=RichFaces.Menu.Layers.layers[(RichFaces.Menu.Layers.father[A.id])]
}if(A&&A.eventOnItemSelect){A.eventOnItemSelect()
}RichFaces.Menu.Layers.shutdown()
}RichFaces.Menu.Items.onmouseout(this)
},getElement:function(){return $(this.id)
},getIcon:function(){return $(this.id+":icon")
},getLabel:function(){return $(this.id+":anchor")
},getInlineStyle:function(){return this.options.style||""
},getHoverStyle:function(){return this.options.selectStyle||""
},getHoverClasses:function(){return $A(this.options.selectClass).compact()
},getIconHoverClasses:function(){return $A(this.options.iconHoverClass).compact()
},getLabelHoverClasses:function(){return $A(this.options.labelHoverClass).compact()
},isDisabled:function(){return this.options.disabled||false
},onmouseover:function(B){var A=this.getElement();
if(this.options.onmouseover){if(this.options.onmouseover.call(A,B)==false){Event.stop(B);
return 
}}if(RichFaces.Menu.isWithin(B,A)){return 
}this.menu.closeMinors(this.id);
if(this.isDisabled()){return 
}if(this.options.flagGroup==1){this.mouseOver=true;
this.highLightGroup(true)
}RichFaces.Menu.Items.onmouseover(this)
},onmouseout:function(B){Event.extend(B);
if(this.options.onmouseout){if(this.options.onmouseout.call(A,B)==false){Event.stop(B);
return 
}}var A=this.getElement();
if(RichFaces.Menu.isWithin(B,A)){return 
}if(this.isDisabled()){return 
}if(this.options.flagGroup==1){this.mouseOver=false;
this.highLightGroup(false)
}RichFaces.Menu.Items.onmouseout(this)
},highLightGroup:function(A){var B=$(this.id);
if(A){B.removeClassName("dr-menu-item-enabled");
B.addClassName("dr-menu-item-hover");
B.addClassName("rich-menu-group-hover");
if(this.options.selectClass){B.addClassName(this.options.selectClass)
}Element.addClassName(this.id+":icon","rich-menu-item-icon-selected");
Element.addClassName(this.id+":anchor","rich-menu-item-label")
}else{if(!this.mouseOver){B.removeClassName("dr-menu-item-hover");
B.removeClassName("rich-menu-group-hover");
B.addClassName("dr-menu-item-enabled");
if(this.options.selectClass){B.removeClassName(this.options.selectClass)
}Element.removeClassName(this.id+":icon","rich-menu-item-icon-selected");
Element.removeClassName(this.id+":anchor","rich-menu-item-label")
}}}})

if(!window.Richfaces){window.Richfaces={}
}Richfaces.PanelBar=Class.create();
Richfaces.PanelBar.prototype={initialize:function(B,A){this.FF=(RichFaces.navigatorType()==RichFaces.FF)?true:false;
this.isIE=((navigator.userAgent.toLowerCase().indexOf("msie")!=-1)||(navigator.userAgent.toLowerCase().indexOf("explorer")!=-1))?true:false;
this.panel=$(B);
if(!this.panel){return 
}this.hclient=0;
this.COUNT=0;
this.STEP=0;
this.slides=new Array();
this.ch=this.panel.clientHeight;
this.options=A;
this.onitemchange=A.onitemchange;
this.onclick=A.onclick;
this.items=A.items;
this._attachBehaviors();
this.input=$(B+"_panelBarInput");
this.defaultIndex=this.findPanelById($F(B+"_panelBarInput"));
Event.observe(window,"load",this.handleOnLoad.bindAsEventListener(this));
this.mouseover=A.mouseover;
this.mouseout=A.mouseout;
this.mousemove=A.mousemove;
if(this.mouseover&&this.mouseover!=""){Event.observe(this.panel,"mouseover",new Function("event",this.mouseover))
}if(this.mouseout&&this.mouseout!=""){Event.observe(this.panel,"mouseout",new Function("event",this.mouseout))
}if(this.mousemove&&this.mousemove!=""){Event.observe(this.panel,"mousemove",new Function("event",this.mousemove))
}this.showSlide(this.slides[this.defaultIndex]);
this.contentHight=-1
},handleOnLoad:function(){if(this.timer){clearTimeout(this.timer)
}if(this.panel.clientHeight<=0){this.contentHight=-1;
this.timer=setTimeout(this.handleOnLoad.bind(this),100)
}this.showSlide(this.slides[this.defaultIndex])
},getContentHeight:function(){if(this.contentHight){}else{this.contentHight=-1
}if(this.contentHight<=-1){var B=0;
this.hclient=0;
for(var A=0;
A<this.slides.length;
A++){B+=this.slides[A].item.offsetHeight
}this.hclient=B;
this.contentHight=this.panel.clientHeight-B
}return this.contentHight
},showSlide:function(A){if(this.current){this.current.hideContent()
}var B=this.getContentHeight();
if(this.current){this.current.hideHeader()
}A.content.style.height=(B>0?B:0)+"px";
if(B<=1&&(this.panel.style.height==""||this.panel.style.height.indexOf("%")!=-1)){this.panel.style.height="";
A.content.style.height="100%"
}A.showContent();
this.current=A;
this.input.value=this.current.item.id;
this.firstLoad=false
},_attachBehaviors:function(){var C=this._getItems(this.panel);
for(var B=0;
B<C.length;
B++){var A=this._getDirectChildrenByTag(C[B],"DIV");
this.slides.push(new Richfaces.PanelBar.Slide(this,C[B],A[0],A[1],A[2],B,this.onclick))
}},_getItems:function(E){var C=new Array();
var B=this.items.length;
for(var D=E.firstChild,A=0;
D&&A<B;
D=D.nextSibling){if(this.items[A].id==D.id){A++;
C.push(D)
}}return C
},_getDirectChildrenByTag:function(F,D){var B=new Array();
var A=F.childNodes;
for(var C=0;
C<A.length;
C++){var E=A[C];
if(E&&E.tagName&&E.tagName.toUpperCase()==D.toUpperCase()){B.push(E)
}}return B
},findPanelById:function(B){for(var A=0;
A<this.slides.length;
A++){if(this.slides[A].item.id==B){return A
}}return 0
},invokeEvent:function(F,A,I,C,E,B,D){var J;
if(B){var H;
if(A){H=A
}else{if(document.createEventObject){H=document.createEventObject()
}else{if(document.createEvent){H=document.createEvent("Events");
H.initEvent(F,true,false)
}}}H.rich={component:this};
H.rich.enterElement=I;
H.rich.leaveElement=C;
try{J=B.call(E,H)
}catch(G){LOG.warn("Exception: "+G.Message+"\n[on"+F+"]")
}}if(J!=false){J=true
}return J
}};
Richfaces.PanelBar.Slide=Class.create();
Richfaces.PanelBar.Slide.prototype={initialize:function(F,E,G,A,D,C,B){this.index=C;
this.slidePanel=F;
this.item=E;
this.header=G;
this.header_act=A;
this.content=D;
this.onclick=B;
Event.observe(this.header,"click",this.headerOnClick.bindAsEventListener(this));
Event.observe(this.header,"selectstart",this.headerOnSelectStart.bindAsEventListener(this));
Event.observe(this.header_act,"click",this.headerOnClick.bindAsEventListener(this));
Event.observe(this.header_act,"selectstart",this.headerOnSelectStart.bindAsEventListener(this));
this.content.style.display="none";
this.content.style.overflow="auto";
this.content.style.height="0px";
this.hightFirefoxDelta=0;
if(this.slidePanel.isIE){if(this.slidePanel.panel.style.width.indexOf("%")!=-1){this.item.style.width="100%"
}else{this.item.style.width=this.slidePanel.panel.style.width
}}if(this.onclick&&this.onclick!=""){this.onclickFunction=new Function("event",this.onclick)
}},showContent:function(){this.content.style.display="block";
this.content.firstChild.style.height="";
this.header.style.display="none";
this.header_act.style.display=""
},hideContent:function(){this.content.style.display="none";
this.content.firstChild.style.height="100%"
},hideHeader:function(){this.header_act.style.display="none";
this.header.style.display=""
},headerOnClick:function(H){if(this.onclickFunction){var A=this.onclickFunction(H);
if(A==false){return false
}}if(this.content.style.display=="block"){return 
}var G=this.item;
var E=this.slidePanel.current.item;
var C=this.slidePanel.items[this.index];
var F;
var B=this.slidePanel.items;
for(var D=0;
D<B.length;
D++){if(this.slidePanel.items[D].id==E.id){F=this.slidePanel.items[D]
}}if(!this.slidePanel.invokeEvent("onenter",H,E,G,G,C.onenter)){return false
}if(!this.slidePanel.invokeEvent("onleave",H,E,G,E,F.onleave)){return false
}if(!this.slidePanel.invokeEvent("onchangeitem",H,E,G,this.slidePanel.panel,this.slidePanel.onitemchange)){return false
}this.slidePanel.showSlide(this);
this.slidePanel.panel.style.maxHeight="";
this.slidePanel.panel.style.minHeight=""
},headerOnSelectStart:function(){return false
}}

if(!window.DW){window.DW={}
}if(!window.Richfaces){window.Richfaces={}
}var PanelMenuStorage=new Object();
PanelMenu=Class.create();
PanelMenu.prototype={initialize:function(A,C,B){this.myId=A;
this.childObj=new Array();
this.expandSingle=C;
this.lastExpanded=null;
this.selectedChild=B;
this.defaultSelectedClass="dr-pmenu-selected-item";
this.userDefinedSelectedClass="rich-pmenu-selected-element";
this.is="panelMenu";
this.selectedNameInput=$(A+"selectedItemName");
PanelMenuStorage[A]=this
},_getIds:function(D,A){var B=Richfaces.firstDescendant(D);
while(B){if(B.id){A[B.id]=B;
if(B.tagName){var C=B.tagName.toLowerCase();
if(C=="div"){this._getIds(B,A)
}else{if(B.rows){var I=B.rows;
for(var F=0;
F<I.length;
F++){var H=I[F].cells;
for(var E=0;
E<H.length;
E++){var G=H[E];
if(/^icon/.test(G.id)){A[G.id]=G
}}}}}}}B=Richfaces.next(B)
}},getIds:function(){var A=$(this.myId);
var B={};
B[A.id]=A;
this._getIds(A,B);
return B
}};
PanelMenuItem=Class.create();
PanelMenuItem.prototype={initialize:function(T,R,K,E,C,J,B,P,L,Q,N,S,H,F,O,G){if(!K.parentId){return 
}this.type=E.type;
this.onopen=E.onopen;
this.itemId=K.myId;
this.onclose=E.onclose;
this.event=E.event;
this.disabled=E.disabled;
this.name=E.name;
this.params=R;
this.myId=K.myId;
this.mode=E.mode;
if(!this.mode){this.mode=("node"==this.type)?"none":"server"
}this.ajaxSubmit=N;
this.onItemHover=S;
this.target=E.target;
this.hoveredStyles=C;
this.hoveredClasses=J;
this.tdhider=Element.extend(T[K.myId]);
if(!this.tdhider){this.tdhider=$(K.myId)
}this.tablehider=Richfaces.firstDescendant(this.tdhider);
this.haveDynamicIcon=P;
if(this.haveDynamicIcon==true){var D="icon"+K.myId;
this.iconswitcher=Element.extend(T[D]);
if(!this.iconswitcher){this.iconswitcher=$(D)
}}this.childObj=new Array();
this.parentObj=PanelMenuStorage[K.parentId];
this.parentObj.childObj.push(this);
var I=this.parentObj;
while(I){if(I.is&&"panelMenu"==I.is){this.expandSingle=I.expandSingle;
break
}I=I.parentObj
}this.rootMenu=I;
if(this.rootMenu.selectedChild==this.name){this.selected=true
}else{this.selected=false
}this.clientId=K.myId;
this.mainRow=this.tablehider.rows[0];
Element.extend(this.mainRow);
var A=this.mainRow.cells;
this.leftIcon=Richfaces.lastDescendant(A[0]);
this.labelArea=A[1];
this.rightIcon=Richfaces.firstDescendant(A[2]);
this.content=document.getElementsByClassName("dr-pmenu-group-self-label",this.tdhider)[0];
this.iconAlign=H;
this.iconCollapsed=O;
this.iconExpanded=F;
this.iconSpacer=G;
if(L){this.action=L
}PanelMenuStorage[K.myId]=this;
this.initialStyles=null;
this.hasInitialSylesChecked=false;
this._attachBehaviors();
this.inputs=this._getDirectChildrenByTag(this.content,"INPUT");
for(var M=0;
M<this.inputs.length;
M++){if(this.inputs[M].name.indexOf("panelMenuState")!=-1){this.inputState=this.inputs[M]
}else{if(this.inputs[M].name.indexOf("panelMenuAction")!=-1){this.inputAction=this.inputs[M]
}}}if(Q){this.parentObj.lastExpanded=this;
this.expand()
}else{this.expanded=false
}if(this.parentObj.type=="node"&&this.parentObj.expanded){if(this.type=="node"){this.tdhider.style.display=""
}}},collapse:function(){if(!this.disabled){if(this.expanded){if(this._getDirectChildrenByTag(this.content,"INPUT")[0]!=null){this._getDirectChildrenByTag(this.content,"INPUT")[0].value="closed"
}for(var B=0;
B<this.childObj.length;
B++){if(this.childObj[B]._getDirectChildrenByTag(this.childObj[B].content,"INPUT")[0]!=null){this.childObj[B]._getDirectChildrenByTag(this.childObj[B].content,"INPUT")[0].value=""
}if(this.haveDynamicIcon){var A=null;
if(this.iconAlign=="right"){A=this.rightIcon
}else{A=this.leftIcon
}if(A!=null){if(this.iconCollapsed!="none"){if(this.iconCollapsed!=null){A.src=this.iconCollapsed
}else{A.src=this.iconSpacer
}}}}this.childObj[B].collapse();
this.childObj[B].hide()
}}this.expanded=false
}},hide:function(){this.tdhider.style.display="none"
},expand:function(){if(!this.disabled){if(!this.expanded){if(this._getDirectChildrenByTag(this.content,"INPUT")[0]!=null){this.inputState.value="opened"
}if(this.haveDynamicIcon){var A=null;
if(this.iconAlign=="right"){A=this.rightIcon
}else{A=this.leftIcon
}if(A!=null){if(this.iconExpanded!="none"){if(this.iconExpanded!=null){A.src=this.iconExpanded
}else{A.src=this.iconSpacer
}}}}for(var B=0;
B<this.childObj.length;
B++){this.childObj[B].show()
}}this.expanded=true
}},show:function(){this.tdhider.style.display="";
this.tablehider.style.display="";
this.tdhider.style.display=""
},preTrigger:function(A){this.inputAction.setAttribute("value",this.clientId)
},postTrigger:function(A){this.inputAction.setAttribute("value","")
},trigger:function(e){if("none"==this.mode){return 
}this.preTrigger(e);
var form=Event.findElement(e,"form");
if("server"==this.mode){if(this.target){form.target=this.target
}Richfaces.jsFormSubmit(this.myId,form.id,this.target,this.params)
}else{if("ajax"==this.mode){var event=e;
eval(this.ajaxSubmit)
}}this.postTrigger(e)
},itemClicked:function(A){this.globalClearSelection();
this.setSelectedClass();
this.rootMenu.selectedNameInput.value=this.name;
if(this.action){if(this.action=="panelMenuNodeAction"){if(this.expanded){if("node"==this.type){if(new Function(this.onclose+";return true;")()){this.collapse()
}}this.trigger(A)
}else{if(this.parentObj.expandSingle){if(this.parentObj.lastExpanded!=null){this.parentObj.lastExpanded.collapse()
}if("node"==this.type){if(new Function(this.onopen+";return true;")()){this.expand()
}}this.trigger(A);
this.parentObj.lastExpanded=this
}else{if("node"==this.type){if(new Function(this.onopen+";return true;")()){this.expand()
}}this.trigger(A)
}}}else{this.trigger(A)
}}else{if(this.expanded){if("node"==this.type){if(new Function(this.onclose+";return true;")()){this.collapse()
}}this.trigger(A)
}else{if(this.parentObj.expandSingle){if(this.parentObj.lastExpanded!=null){this.parentObj.lastExpanded.collapse()
}if("node"==this.type){if(new Function(this.onopen+";return true;")()){this.expand()
}}this.trigger(A);
this.parentObj.lastExpanded=this
}else{if("node"==this.type){if(new Function(this.onopen+";return true;")()){this.expand()
}}this.trigger(A)
}}}},globalClearSelection:function(B){for(var A in PanelMenuStorage){if(PanelMenuStorage.hasOwnProperty(A)){if(PanelMenuStorage[A].type=="node"||PanelMenuStorage[A].type=="item"){PanelMenuStorage[A].removeSelectedClass()
}}}},setSelectedClass:function(A){this.mainRow.addClassName(this.rootMenu.defaultSelectedClass);
this.mainRow.addClassName(this.rootMenu.userDefinedSelectedClass)
},removeSelectedClass:function(A){this.mainRow.removeClassName(this.rootMenu.defaultSelectedClass);
this.mainRow.removeClassName(this.rootMenu.userDefinedSelectedClass)
},addHoverStyles:function(A){if(!this.selected){if(!this.hasInitialSylesChecked){this.initialStyles=this.tablehider.style.cssText;
this.hasInitialSylesChecked=true
}if(this.hoveredStyles){Element.setStyle(this.tablehider,this.hoveredStyles)
}if(this.hoveredClasses){for(i=0;
i<this.hoveredClasses.length;
i++){this.tablehider.addClassName(this.hoveredClasses[i])
}}}},removeHoverStyles:function(B){if(!this.selected){if(this.hoveredStyles&&this.hasInitialSylesChecked){this.tablehider.style.cssText=this.initialStyles
}if(this.hoveredClasses){for(var A=0;
A<this.hoveredClasses.length;
A++){this.tablehider.removeClassName(this.hoveredClasses[A])
}}}},_getDirectChildrenByTag:function(F,E){var B=F.childNodes;
var C=new Array();
var A;
E=E.toLowerCase();
for(var D=0;
D<B.length;
D++){if(B[D]&&B[D].tagName&&B[D].tagName.toLowerCase()==E){C.push(B[D])
}}return C
},_fireEditEvent:function(B){if(document.createEvent){var A=document.createEvent("HTMLEvents");
A.initEvent(B,true,false);
this.edit.dispatchEvent(A)
}else{if(document.createEventObject){this.edit.fireEvent("on"+B)
}}},hoverItem:function(e){if(this.onItemHover!=""){eval(this.onItemHover)
}},_attachBehaviors:function(){if(!this.disabled){if(this.event){Event.observe(this.tablehider,this.event,this.itemClicked.bindAsEventListener(this),false)
}else{Event.observe(this.tablehider,"click",this.itemClicked.bindAsEventListener(this),false)
}Event.observe(this.tdhider,"mouseover",this.hoverItem.bindAsEventListener(this),false);
Event.observe(this.tablehider,"mouseover",this.addHoverStyles.bindAsEventListener(this),false);
Event.observe(this.tablehider,"mouseout",this.removeHoverStyles.bindAsEventListener(this),false)
}}};
PanelMenu.doExpand=function(C){var B=PanelMenuStorage[C];
if(B&&B.type&&"node"==B.type){var A=B.parentObj;
if(A.expandSingle){if(B.parentObj.lastExpanded!=null){B.parentObj.lastExpanded.collapse()
}}while(A){if(A.type&&"node"==A.type){A.expand()
}A=A.parentObj
}if(!B.expanded&&new Function(B.onopen+";return true;")()){B.expand()
}}};
PanelMenu.doCollapse=function(B){var A=PanelMenuStorage[B];
if(A&&A.type&&"node"==A.type){if(A.expanded&&new Function(A.onclose+";return true;")()){A.collapse()
}}}

if(!ClientUILib){var ClientUILib={Version:"1.0.0",Name:"ClientUILib",LibraryPath:"./",packages:[],load:function(A){if((typeof Prototype=="undefined")||(typeof Element=="undefined")||(typeof Element.Methods=="undefined")||parseFloat(Prototype.Version.split(".")[0]+"."+Prototype.Version.split(".")[1])<1.5){throw ("ClientUILib requires the Prototype JavaScript framework >= 1.5.0")
}$A(document.getElementsByTagName("script")).findAll(function(B){return(B.src&&B.src.match(/ClientUILib\.js(\?.*)?$/))
}).each(function(B){LibraryPath=B.src.replace(/ClientUILib\.js(\?.*)?$/,"")
});
if(A){ClientUILogger.create("ClientUILogger");
this.startTime=(new Date()).getTime()
}this.initBrowser()
},include:function(C){if(!this.packages){this.packages=[]
}if(!this.packages[C]){this.packages[C]=true;
var A=/\./g;
var B=LibraryPath+C.replace(A,"/");
document.write('<script type="text/javascript" src="'+B+'.js"><\/script>')
}},include2:function(D){if(!this.packages){this.packages=[]
}if(!this.packages[D]){this.packages[D]=true;
var A=/\./g;
var B=LibraryPath+D.replace(A,"/");
var C=document.createElement("script");
C.src=B+".js";
C.type="text/javascript";
document.getElementsByTagName("head")[0].appendChild(C)
}},requireClass:function(A){if(!this.packages[A]){ClientUILib.log(ClientUILogger.ERROR,"Library '"+A+"' required!!!");
throw ("Package '"+A+"' is required!")
}},declarePackage:function(libName){var pckg=null;
var packages=$A(libName.split("."));
packages.each(function(s){if(pckg==null){pckg=eval(s)
}else{if(!pckg[s]){pckg[s]={}
}pckg=pckg[s]
}});
this.packages[libName]=true
},log:function(B,A){if(ClientUILogger.isCreated){ClientUILogger.log(B,A)
}else{switch(B){case ClientUILogger.INFO:LOG.info(A);
break;
case ClientUILogger.ERROR:LOG.error(A);
break;
case ClientUILogger.WARNING:LOG.warn(A);
break;
default:LOG.a4jDebug(A)
}}},initBrowser:function(){var A=navigator.userAgent.toLowerCase();
this.isOpera=(A.indexOf("opera")>-1);
this.isSafari=(A.indexOf("webkit")>-1);
this.isIE=(window.ActiveXObject);
this.isIE7=(A.indexOf("msie 7")>-1);
this.isGecko=!this.isSafari&&(A.indexOf("gecko")>-1);
if(A.indexOf("windows")!=-1||A.indexOf("win32")!=-1){this.isWindows=true
}else{if(A.indexOf("macintosh")!=-1){this.isMac=true
}}if(this.isIE&&!this.isIE7){try{document.execCommand("BackgroundImageCache",false,true)
}catch(B){}}}};
var ClientUILogger={INFO:1,WARNING:2,ERROR:3,isCreated:false,width:460,height:90,create:function(){this.logElement=$(document.createElement("div"));
this.logElement.setStyle({position:"absolute"});
this.logElement.setStyle({overflow:"auto"});
this.logElement.setStyle({whiteSpace:"nowrap"});
Event.observe(window,"load",ClientUILogger.init);
Event.observe(window,"resize",ClientUILogger.resizeWindow);
this.isCreated=true
},init:function(){if(ClientUILogger.logElement){document.body.appendChild(ClientUILogger.logElement)
}ClientUILogger.show()
},resizeWindow:function(){ClientUILogger.show()
},show:function(){if(this.logElement){Element.show(this.logElement);
this.logElement.setStyle({width:this.width+"px"});
this.logElement.setStyle({height:this.height+"px"});
this.logElement.setStyle({top:"0px"});
this.logElement.setStyle({left:"250px"});
this.logElement.setStyle({zIndex:"1000"})
}},log:function(E,C){var D=$(document.createElement("div"));
this.logElement.appendChild(D);
D.setStyle({width:"100%"});
var A="bold normal bold 10pt Arial";
var B="red";
switch(E){case ClientUILogger.INFO:B="black";
A="normal normal normal 10pt Arial";
break;
case ClientUILogger.WARNING:B="blue";
A="italic normal normal 10pt Arial";
break;
case ClientUILogger.ERROR:B="red";
A="normal normal bold 10pt Arial";
break;
default:C="UNRESOLVED: level="+E+", msg="+C
}D.setStyle({font:A});
D.setStyle({color:B});
D.appendChild(document.createTextNode("> "+C));
this.logElement.scrollTop=this.logElement.scrollHeight
},getWindowWidth:function(){var A;
if(navigator.appVersion.indexOf("MSIE")>0){A=document.body.clientWidth
}else{A=window.innerWidth
}return A
},getWindowHeight:function(){var A;
if(navigator.appVersion.indexOf("MSIE")>0){A=document.body.clientHeight
}else{A=window.innerHeight
}return A
}};
ClientUILib.load();
var ClientUI={controls:{},layouts:{}};
if(!ClientUILib.isIE){HTMLElement.prototype.click=function(){var A=this.ownerDocument.createEvent("MouseEvents");
A.initMouseEvent("click",true,true,this.ownerDocument.defaultView,1,0,0,0,0,false,false,false,false,0,null);
this.dispatchEvent(A)
}
}Object.extend(Event,{_domReady:function(){if(arguments.callee.done){return 
}arguments.callee.done=true;
if(Event._timer){clearInterval(Event._timer)
}Event._readyCallbacks.each(function(A){A()
});
Event._readyCallbacks=null
},onReady:function(B){if(!this._readyCallbacks){var A=this._domReady;
if(A.done){return B()
}if(document.addEventListener){document.addEventListener("DOMContentLoaded",A,false)
}if(/WebKit/i.test(navigator.userAgent)){this._timer=setInterval(function(){if(/loaded|complete/.test(document.readyState)){A()
}},10)
}Event.observe(window,"load",A);
Event._readyCallbacks=[]
}Event._readyCallbacks.push(B)
}})
}var Utils={DOM:{copyAttributes:function(F,A,B){var K=A.attributes;
var H=(B&&B.exclude)?B.exclude:[];
for(var D=0;
D<K.length;
D++){var J=K[D];
var I=J.nodeName;
var E=J.nodeValue;
var G=E&&E.length>0&&H.indexOf(I)<0;
if(ClientUILib.isIE){G&=J.specified
}if(G){var C=document.createAttribute(I);
C.nodeValue=J.nodeValue;
F.setAttributeNode(C)
}}},replaceNode:function(D,E){var G=document.getElementById(D);
var B=E.getElementById(D);
if(G&&B){var J=G.cells;
for(var F=0;
F<J.length;
F++){Utils.DOM.Event.removeListeners(J[F])
}if(ClientUILib.isIE){var K=String();
var C="<table><tbody>"+B.xml+"</tbody></table>";
var H=document.createElement("DIV");
H.innerHTML=C;
var I=H.firstChild.firstChild.firstChild;
G.parentNode.replaceChild(I,G);
return I
}else{if(ClientUILib.isGecko){var A=document;
Utils.DOM._clearAttributes(G);
Utils.DOM.copyAttributes(G,B);
G.innerHTML=B.innerHTML;
return G
}else{B=document.importNode(B,true);
G.parentNode.replaceChild(B,G)
}}}else{if(!G){ClientUILib.log(ClientUILogger.ERROR,"DOM Element with id "+D+" not found for update.")
}if(!B){ClientUILib.log(ClientUILogger.ERROR,"RESPONSE Element with id "+D+" not found for update.");
if(G){for(var F=0;
F<G.cells.length;
F++){G.cells[F].innerHTML=""
}}}}},_clearAttributes:function(B){var A=B.attributes;
if(B.clearAttributes){B.clearAttributes()
}else{while(B.attributes.length>0){B.removeAttributeNode(B.attributes[0])
}}},_formatNode:function(C){var D=new StringBuilder();
D.append("<").append(C.nodeName);
for(var B=0;
B<C.attributes.length;
B++){var A=C.attributes[B];
if(A.specified){D.append(" ").append(A.nodeName).append('="').append(A.nodeValue).append('" ')
}}D.append("/>");
return D.toString()
},Event:{observe:function(B,D,C,A){if(true){if(!B._listeners){B._listeners=[]
}B._listeners[B._listeners.length]={event:D,handler:C,useCapture:A}
}Event.observe(B,D,C,A)
},stopObserving:function(B,D,C,A){if(B._listeners){B._listeners=B._listeners.reject(function(E){return E.event==D&&E.handler==C&&E.useCapture==A
})
}Event.stopObserving(B,D,C,A)
},removeListeners:function(C){if(C._listeners){var A=C._listeners.length;
for(var B=0;
B<A;
B++){var D=C._listeners[B];
Event.stopObserving(C,D.event,D.handler,D.useCapture)
}C._listeners=null
}}}},AJAX:{updateRows:function(Q,D,A,O,I,F){var C=Q;
var L=A.getBody().templFrozen.getElement().rows.length;
var N=C.startRow;
var G=C.count;
var P,E,B;
var J=A.dataModel;
var K=O;
var M=0;
var H=[];
for(E=0;
E<G;
E++){P=N+E;
if(P>=L){P-=L
}[":f:",":n:"].unbreakableEach(function(R){var T=[K,R,P].join("");
var S=Utils.DOM.replaceNode(T,D);
if(I){if(!H[E]){H[E]={}
}H[E][R]={index:P,row:S};
M++
}})
}if(ClientUILib.isIE7){setTimeout(function(){var R=A.getBody();
["fTable","nTable"].unbreakableEach(function(S){R[S].hide();
R[S].show()
})
},50)
}if(I&&M>0){setTimeout(function(){for(var R=0;
R<G;
R++){I.unbreakableEach(function(S){if(H[R]){if(H[R][":f:"].row){S.call(A,H[R][":f:"])
}if(H[R][":n:"].row){S.call(A,H[R][":n:"])
}}})
}if(F){F.unbreakableEach(function(S){S.call(A)
})
}},100)
}J.eventDataReady.fire(C)
}}};
Utils.execOnLoad=function(A,C,B){if(C()){A()
}else{window.setTimeout(function(){Utils.execOnLoad(A,C,B)
},B)
}};
Utils.Condition={ElementPresent:function(A){return function(){var B=$(A);
return B&&B.offsetHeight>0
}
}};
Array.prototype.unbreakableEach=function(B){for(var A=0;
A<this.length;
A++){B(this[A],A)
}};
ClientUILib.declarePackage("ClientUI.common.utils.StringBuilder");
StringBuilder=Class.create({initialize:function(A){this._string=null;
this._current=0;
this._parts=[];
this.length=0;
if(A!=null){this.append(A)
}},append:function(A){this._parts.push(String(A));
this._string=null;
return this
},toString:function(){if(this._string!=null){return this._string
}var A=this._parts.join("");
this._parts=[A];
this._current=1;
this.length=A.length;
return this._string=A
},clean:function(A){this.initialize()
}});
Object.extend(StringBuilder.prototype,{length:0,_current:0,_parts:[],_string:null});
var Validators={isIEObject:function(A){return this.isObject(A)&&typeof A.constructor!="function"
},isArray:function(A){return this.isObject(A)&&A.constructor==Array
},isBoolean:function(A){return typeof A=="boolean"
},getBoolean:function(B,A){if(this.isBoolean(B)){return B
}if(B=="true"){return true
}else{if(B=="false"){return false
}}return A
},isEmpty:function(B){if(this.isObject(B)){for(var A in B){return false
}}else{if(this.isString(B)&&B.length>0){return false
}}return !this.IsNumber(B)
},isFunction:function(A){return typeof A=="function"
},isNull:function(A){return typeof A=="object"&&!A
},IsNumber:function(B){if(typeof B=="number"&&isFinite(B)){return true
}var A=/(^-?[1-9](\d{1,2}(\,\d{3})*|\d*)|^0{1})$/;
if(A.test(B)){return true
}return false
},IsFormattedNumber:function(B){var A=/^-?(\d{1,3}|\d{1,3}(\,\d{3})*|\d*)$/g;
if(!A.test(B)){return false
}return true
},isObject:function(A){return(typeof A=="object"&&!!A)||this.isFunction(A)
},isString:function(A){return typeof A=="string"
},isUndefined:function(A){return typeof A=="undefined"
}};
ClientUILib.declarePackage("ClientUI.common.box.Box");
ClientUI.common.box.Box=Class.create({initialize:function(D,C,B){this.element=$(D);
if(!this.element){this.element=$(document.createElement("div"));
if($(C)){$(C).appendChild(this.element)
}else{document.body.appendChild(this.element)
}}this.element.wrapper=this;
if(!this.element.parentNode&&$(C)){$(C).appendChild(this.element)
}if(!this.element.id){this.element.id="ClientUI_Box"+ClientUI_common_box_Box_idGenerator++
}if(!B){this.element.setStyle({overflow:"hidden"});
this.element.setStyle({whiteSpace:"nowrap"});
var A=this.element.getStyle("position");
if(A!="absolute"&&A!="fixed"){this.element.setStyle({position:"relative"})
}}},setParent:function(A){if(this.element.parentNode){this.element.parentNode.removeChild(this.element)
}if(A){if(A.getElement){A=A.getElement()
}$(A).appendChild(this.element)
}return this
},getElement:function(){return this.element
},getHeight:function(){if(this.getElement().tagName.toLowerCase()!="body"){var A=Element.getHeight(this.element);
return A>0?A:(this.element.boxHeight?parseInt(this.element.boxHeight):0)
}if(self.innerHeight){return self.innerHeight
}else{if(document.documentElement&&document.documentElement.clientHeight){return document.documentElement.clientHeight
}else{if(document.body){return document.body.clientHeight
}}}},isModified:false,setHeight:function(A){this.element.boxHeight=A;
if(Validators.IsNumber(A)){if(A<0){A=0
}A+="px"
}this.element.setStyle({height:A});
isModified=true;
return this
},getWidth:function(){if(this.getElement().tagName.toLowerCase()!="body"){var A=Element.getWidth(this.element);
return A>0?A:(this.element.boxWidth?parseInt(this.element.boxWidth):0)
}if(self.innerHeight){return self.innerWidth
}else{if(document.documentElement&&document.documentElement.clientHeight){return document.documentElement.clientWidth
}else{if(document.body){return document.body.clientWidth
}}}},setWidth:function(A){this.element.boxWidth=A;
if(Validators.IsNumber(A)){if(A<0){A=0
}A+="px"
}this.element.setStyle({width:A});
isModified=true;
return this
},moveToX:function(A){if(Validators.IsNumber(A)){A+="px"
}this.getElement().setStyle({left:A});
isModified=true;
return this
},moveToY:function(A){if(Validators.IsNumber(A)){A+="px"
}this.getElement().setStyle({top:A});
isModified=true;
return this
},moveTo:function(A,B){this.moveToX(A);
this.moveToY(B);
return this
},hide:function(){Element.hide(this.element);
isModified=true;
return this
},show:function(){Element.show(this.element);
isModified=true;
return this
},updateLayout:function(){isModified=false;
return this
},getViewportWidth:function(){if(this.getElement().tagName.toLowerCase()!="body"){var A=0;
if(this.getElement().clientWidth){A=this.getElement().clientWidth
}else{if(this.getElement().innerWidth){A=this.getElement().innerWidth-getScrollerWidth()
}}if(ClientUILib.isGecko){A-=this.getPadding("lr")
}return A
}return this.getWidth()
},getViewportHeight:function(){if(this.getElement().tagName.toLowerCase()!="body"){var A=0;
if(this.getElement().clientHeight){A=this.getElement().clientHeight
}else{if(this.getElement().innerHeight){A=this.getElement().innerHeight-getScrollerWidth()
}}if(ClientUILib.isGecko){A-=this.getPadding("tb")
}return A
}return this.getHeight()
},getBorderWidth:function(A){return this.getStyles(A,this.borders)
},getPadding:function(A){return this.getStyles(A,this.paddings)
},getStyles:function(E,D){var F=0;
for(var C=0,A=E.length;
C<A;
C++){var B=parseInt(this.getElement().getStyle(D[E.charAt(C)]),10);
if(!isNaN(B)){F+=B
}}return F
},makeAbsolute:function(A){if(A){Position.absolutize(this.getElement())
}else{this.getElement().setStyle({position:"absolute"})
}return this
},getX:function(){return this.getElement().offsetLeft
},getY:function(){return this.getElement().offsetTop
},setStyle:function(A){this.getElement().setStyle(A);
return this
},borders:{l:"border-left-width",r:"border-right-width",t:"border-top-width",b:"border-bottom-width"},paddings:{l:"padding-left",r:"padding-right",t:"padding-top",b:"padding-bottom"},margins:{l:"margin-left",r:"margin-right",t:"margin-top",b:"margin-bottom"}});
if(!ClientUI_common_box_Box_idGenerator){var ClientUI_common_box_Box_idGenerator=0
}ClientUILib.declarePackage("ClientUI.common.box.InlineBox");
ClientUILib.requireClass("ClientUI.common.box.Box");
ClientUI.common.box.InlineBox=Class.create(ClientUI.common.box.Box,{initialize:function($super,C,B,A){if(!C){C=$(document.createElement("span"));
if($(B)){$(B).appendChild(C)
}else{document.body.appendChild(C)
}}if(!C.id){C.id="ClientUI_InlineBox"+ClientUI_common_box_InlineBox_idGenerator++
}$super(C,B,A);
if(!A){this.element.setStyle({display:"block"})
}}});
if(!ClientUI_common_box_InlineBox_idGenerator){var ClientUI_common_box_InlineBox_idGenerator=0
}ClientUILib.declarePackage("ClientUI.common.utils");
if(!ClientUI.common.utils.CustomEvent){ClientUILib.declarePackage("ClientUI.common.utils.CustomEvent");
ClientUI.common.utils.CustomEvent=Class.create({initialize:function(A){this._eventName=A;
this._id=ClientUI_common_utils_CustomEvent_idGenerator++
},getName:function(){return this._eventName
},getId:function(){return this._id
},fire:function(){if(!Event.subscribers||!Event.subscribers.length){return true
}var D=this.getId();
var C=Event.subscribers;
var A=Event.subscribers.findAll(function(E){return E.event.getId()===D
});
var B=$A(arguments);
A.unbreakableEach(function(E){E.callback.apply(E.callback,B)
})
}});
Object.extend(ClientUI.common.utils.CustomEvent,{_eventName:"undefined",_id:-1});
Event._observe=Event.observe;
Event.observe=function(D,C,B,A){if(D&&D.getName&&D.getId){var E=D;
if(!this.subscribers){this.subscribers=[]
}this.subscribers.push({event:E,desc:C,callback:B})
}else{Event._observe(D,C,B,A)
}};
Event._stopObserving=Event.stopObserving;
Event.stopObserving=function(D,C,B,A){if(D&&D.getName&&D.getId){var E=D;
if(this.subscribers&&this.subscribers.length&&this.subscribers.length!==0){var F=E.getId();
this.subscribers=this.subscribers.select(function(G){return G.event.getId()!==F
})
}}else{Event._stopObserving(D,C,B,A)
}};
Event._unloadCache=Event.unloadCache;
Event.unloadCache=function(){if(Event.subscribers){for(var A=0,B=Event.subscribers.length;
A<B;
A++){Event.stopObserving.apply(this,Event.subscribers[A]);
Event.subscribers[A][0]=null
}Event.subscribers=false
}Event._unloadCache()
};
var ClientUI_common_utils_CustomEvent_idGenerator=0
}ClientUILib.declarePackage("ClientUI.common.box.ScrollableBox");
ClientUILib.requireClass("ClientUI.common.box.Box");
ClientUILib.requireClass("ClientUI.common.utils.CustomEvent");
ClientUI.common.box.ScrollableBox=Class.create(ClientUI.common.box.Box,{initialize:function($super,B,A){$super(B,A);
this.element.setStyle({overflow:"auto"});
this.eventHScroll=new ClientUI.common.utils.CustomEvent("OnHScroll");
this.eventVScroll=new ClientUI.common.utils.CustomEvent("OnVScroll");
this.eventOnScroll=this.scrollContent.bindAsEventListener(this);
Event.observe(this.element,"scroll",this.eventOnScroll)
},scrollContent:function(A){this.updateScrollPos()
},updateScrollPos:function(){this.timer=null;
if(this.scrollLeft!==this.getViewportScrollX()){this.scrollLeft=this.getViewportScrollX();
this.eventHScroll.fire(this.getViewportScrollX())
}if(this.scrollTop!==this.getViewportScrollY()){this.scrollTop=this.getViewportScrollY();
this.eventVScroll.fire(this.getViewportScrollY())
}},updateLayout:function($super){$super()
},getViewportScrollX:function(){var A=0;
if(this.getElement().scrollLeft){A=this.getElement().scrollLeft
}else{if(this.getElement().pageXOffset){A=this.getElement().pageXOffset
}else{if(this.getElement().scrollX){A=this.getElement().scrollX
}}}return A
},getViewportScrollY:function(){var A=0;
if(this.getElement().scrollTop){A=this.getElement().scrollTop
}else{if(this.getElement().pageYOffset){A=this.getElement().pageYOffset
}else{if(this.getElement().scrollY){A=this.getElement().scrollY
}}}return A
},getScrollerWidth:function(){if(this.scrollerWidth&&this.scrollerWidth>0){return this.scrollerWidth
}var D=null;
var C=null;
var A=0;
var B=0;
D=document.createElement("div");
D.style.position="absolute";
D.style.top="-1000px";
D.style.left="-1000px";
D.style.width="100px";
D.style.height="50px";
D.style.overflow="hidden";
C=document.createElement("div");
C.style.width="100%";
C.style.height="200px";
D.appendChild(C);
document.body.appendChild(D);
A=C.offsetWidth;
D.style.overflow="auto";
B=C.offsetWidth;
document.body.removeChild(document.body.lastChild);
this.scrollerWidth=(A-B);
return this.scrollerWidth||0
}});
Object.extend(ClientUI.common.box.ScrollableBox.prototype,{eventHScroll:{},eventVScroll:{}});
ClientUILib.declarePackage("ClientUI.controls.grid.DataModel");
ClientUILib.requireClass("ClientUI.common.utils.CustomEvent");
ClientUI.controls.grid.DataModel=Class.create({initialize:function(){this.eventDataReady=new ClientUI.common.utils.CustomEvent("DataModel::OnDataReady")
},getRow:function(A){return[]
},getCount:function(){return 0
},loadRows:function(A){this.eventDataReady.fire(A)
},getRequestDelay:function(){return 1000
}});
Object.extend(ClientUI.controls.grid.DataModel.prototype,{eventDataReady:{}});
ClientUILib.declarePackage("ClientUI.controls.grid.ArrayDataModel");
ClientUILib.requireClass("ClientUI.controls.grid.DataModel");
ClientUI.controls.grid.ArrayDataModel=Class.create(ClientUI.controls.grid.DataModel,{initialize:function($super,A){$super();
this.data=$A(A||[])
},getRow:function(A){return this.data[A]
},getCount:function(){return this.data.length
},getRequestDelay:function(){return 50
}});
ClientUILib.declarePackage("ClientUI.controls.grid.FakeArrayDataModel ");
ClientUI.controls.grid.FakeArrayDataModel=Class.create(ClientUI.controls.grid.DataModel,{initialize:function($super,A,B,C){$super();
this.data=[];
this.count=A;
this.columns=B;
this.gridId=C;
this.curr_options
},getRow:function(A){if(!this.data[A]){this.data[A]=[];
for(var B=0;
B<7;
B++){this.data[A][B]=B+" : "+A
}this.data[A][6]=A%2?"value 1":"value 2"
}return this.data[A]
},getCount:function(){return this.count
},getRequestDelay:function(){return 150
},getCurrentOptions:function(){if(!this.curr_options){this.curr_options={count:grid.getBody().templFrozen.getElement().rows.length,index:0,startRow:0}
}return this.curr_options
},loadRows:function(B){window.loadingStartTime=(new Date()).getTime();
var C=B;
var A=$(this.gridId+"_state_input");
var D=$(this.gridId+"_submit_input");
var E=C.count+","+C.index+","+C.startRow;
A.value=E;
this.curr_options=B;
D.click()
}});
ClientUILib.declarePackage("ClientUI.layouts.LayoutManager");
ClientUI.layouts.LayoutManager=Class.create(ClientUI.common.box.Box,{initialize:function($super,B,A){$super(B,A);
this.container=A;
if(this.container){this.container=new ClientUI.common.box.Box($(this.container))
}this.eventContainerResize=this.containerResize.bindAsEventListener(this);
this.eventOnBeforeResize=new ClientUI.common.utils.CustomEvent("OnBeforeResize");
this.eventOnAfterResize=new ClientUI.common.utils.CustomEvent("OnAfterResize");
this.registerEvents()
},registerEvents:function(){Event.observe(window,"resize",this.eventContainerResize)
},destroy:function(){Event.stopObserving(window,"resize",this.eventContainerResize)
},containerResize:function(A){this.eventOnBeforeResize.fire();
this.updateLayout();
this.eventOnAfterResize.fire()
},updateLayout:function($super){if(this.container){var A=this.container.getWidth();
var B=this.container.getHeight();
if(ClientUILib.isGecko){A-=this.container.getBorderWidth("lr")+this.container.getPadding("lr");
B-=this.container.getBorderWidth("tb")+this.container.getPadding("tb")
}this.setWidth(A);
this.setHeight(B)
}$super()
},getContainer:function(){return this.container
}});
Object.extend(ClientUI.layouts.LayoutManager.prototype,{eventOnBeforeResize:{},eventOnAfterResize:{}});
ClientUILib.declarePackage("ClientUI.common.box.Substrate");
ClientUILib.requireClass("ClientUI.common.box.Box");
ClientUI.common.box.Substrate=Class.create(ClientUI.common.box.Box,{initialize:function($super,D,C,B){if(!D){var A=$(document.createElement("div"));
A.innerHTML='<iframe id="ClientUI_Substrate'+(ClientUI_common_box_Substrate_idGenerator++)+'" src="javascript:\'\'" scrolling="no" frameborder="0" style="filter:Alpha(opacity=0);position:absolute;top:0px;left:0px;display:block"></iframe>';
D=$(A.getElementsByTagName("iframe")[0]);
A.removeChild(D)
}$super(D,C,B);
if(!B){}}});
if(!ClientUI_common_box_Substrate_idGenerator){var ClientUI_common_box_Substrate_idGenerator=0
}ClientUILib.declarePackage("ClientUI.layouts.VLayoutManager");
ClientUILib.requireClass("ClientUI.common.box.Box");
ClientUILib.requireClass("ClientUI.layouts.LayoutManager");
var GridLayout_Enum={HEADER:1,BODY:2,FOOTER:3};
ClientUI.layouts.VLayoutManager=Class.create(ClientUI.layouts.LayoutManager,{initialize:function($super,C,A,B){$super(C,A);
if(!C||!C.id){this.element.id="ClientUI_VLayoutManager"+ClientUI_layouts_VLayoutManager_idGenerator++
}this.registerEvents()
},registerEvents:function($super){$super()
},destroy:function($super){$super()
},addPane:function(B,A){if(!this.panels){this.panels=[]
}this.panels[B]=A;
this.panels[B].makeAbsolute()
},getPane:function(A){return this.panels[A]
},updateLayout:function($super){$super();
var F=this.getContainer();
if(!F){F=this
}var B=F.getHeight();
var E=F.getViewportWidth();
if(ClientUILib.isGecko){E-=F.getBorderWidth("lr")+F.getPadding("lr");
B-=F.getBorderWidth("tb")+F.getPadding("tb")
}if(this.panels){var C=0;
var D=0;
if(this.panels[GridLayout_Enum.HEADER]){C=this.panels[GridLayout_Enum.HEADER].getHeight();
this.panels[GridLayout_Enum.HEADER].moveTo(0,0);
this.panels[GridLayout_Enum.HEADER].setWidth(E);
this.panels[GridLayout_Enum.HEADER].updateLayout()
}if(this.panels[GridLayout_Enum.FOOTER]){D=this.panels[GridLayout_Enum.FOOTER].getHeight();
this.panels[GridLayout_Enum.FOOTER].moveTo(0,B-D);
this.panels[GridLayout_Enum.FOOTER].setWidth(E);
this.panels[GridLayout_Enum.FOOTER].updateLayout()
}if(this.panels[GridLayout_Enum.BODY]){var A=this.panels[GridLayout_Enum.BODY];
A.setWidth(E);
var G=B-(C+D);
A.setHeight(G);
A.moveTo(0,C);
A.updateLayout()
}}}});
if(!ClientUI_layouts_VLayoutManager_idGenerator){var ClientUI_layouts_VLayoutManager_idGenerator=0
}ClientUILib.declarePackage("ClientUI.layouts.GridLayoutManager");
ClientUILib.requireClass("ClientUI.common.box.Box");
ClientUILib.requireClass("ClientUI.layouts.VLayoutManager");
ClientUILib.requireClass("ClientUI.layouts.LayoutManager");
var GridLayout_Enum={HEADER:1,BODY:2,FOOTER:3};
ClientUI.layouts.GridLayoutManager=Class.create(ClientUI.layouts.VLayoutManager,{initialize:function($super,C,A,B){$super(C,A)
},updateLayout:function(){ClientUI.layouts.LayoutManager.prototype.updateLayout.call(this);
var G=this.getContainer();
if(G==null){G=this
}var C=G.getHeight();
var F=G.getViewportWidth();
if(this.panels){var D=0;
var E=0;
var B=0;
if(this.panels[GridLayout_Enum.HEADER]){D=this.panels[GridLayout_Enum.HEADER].getHeight();
this.panels[GridLayout_Enum.HEADER].moveTo(0,0);
this.panels[GridLayout_Enum.HEADER].setWidth(F);
this.panels[GridLayout_Enum.HEADER].updateLayout()
}if(this.panels[GridLayout_Enum.BODY]){var A=this.panels[GridLayout_Enum.BODY];
A.setWidth(F);
var H=C-D;
A.setHeight(H);
A.moveTo(0,D);
A.updateLayout();
B=A.getY()+A.contentBox.getY()+A.scrollBox.getViewportHeight()
}if(this.panels[GridLayout_Enum.FOOTER]){E=this.panels[GridLayout_Enum.FOOTER].getHeight();
this.panels[GridLayout_Enum.FOOTER].moveTo(0,B-E);
this.panels[GridLayout_Enum.FOOTER].setWidth(F);
this.panels[GridLayout_Enum.FOOTER].updateLayout()
}}}});
ClientUILib.declarePackage("ClientUI.controls.grid.GridHeader");
ClientUILib.requireClass("ClientUI.common.box.Box");
ClientUILib.requireClass("ClientUI.common.box.InlineBox");
ClientUI.controls.grid.GridHeader=Class.create(ClientUI.common.box.Box,{initialize:function($super,B,A){this.grid=A;
this.gridId=this.grid.getElement().id;
$super(B);
this.eventSepDblClick=this.OnSepDblClick.bindAsEventListener(this);
this.eventSepMouseDown=this.OnSepMouseDown.bindAsEventListener(this);
this.eventSepMouseUp=this.OnSepMouseUp.bindAsEventListener(this);
this.eventSepMouseMove=this.OnSepMouseMove.bindAsEventListener(this);
this.eventCellMouseDown=this.OnCellMouseDown.bindAsEventListener(this);
Event.observe(document,"mousemove",this.eventSepMouseMove,true);
Event.observe(document,"mouseup",this.eventSepMouseUp,true);
this.createControl(B)
},createControl:function(A){var B="";
if(!A){B="Invalid template specified for GridHeader.";
ClientUILib.log(ClientUILogger.ERROR,B);
throw (B)
}if(!this.parseTemplate(A)){B="Unable to parse template. GridHeader requires template specified over table element with one row.";
ClientUILib.log(ClientUILogger.ERROR,B);
throw (B)
}this.setHeight(this.defaultHeight);
this.setWidth(this.defaultWidth);
this.controlCreated=true;
this.agjustSeparators()
},parseTemplate:function(Q){if(!Q){return false
}var E=Q.childNodes;
for(var L=0;
L<E.length;
L++){if(E[L].tagName&&E[L].tagName.toLowerCase()=="div"){this.container=$(E[L]);
this.container.setStyle({"z-index":100});
break
}}var R=null,P=null;
var E=this.container.childNodes;
for(var L=0;
L<E.length;
L++){if(E[L].id&&E[L].id.indexOf("FrozenBox")>=0){P=E[L]
}else{if(E[L].id&&E[L].id.indexOf("NormalBox")>=0){R=E[L]
}}}if(!R||!P){errMsg="Unable to parse template for GridHeader. Unable to find FrozenBox or NormalBox.";
ClientUILib.log(ClientUILogger.ERROR,errMsg);
throw (errMsg)
}this.contentBox=new ClientUI.common.box.Box(R);
this.contentBox.makeAbsolute();
this.frozenContentBox=new ClientUI.common.box.Box(P);
this.frozenContentBox.makeAbsolute();
var H=this.contentBox.getElement().firstChild;
while(H){if(H.tagName&&H.tagName.toLowerCase()=="table"){this.headerRow=new ClientUI.common.box.Box($(H),null,true);
break
}H=H.nextSibling
}H=this.frozenContentBox.getElement().firstChild;
while(H){if(H.tagName&&H.tagName.toLowerCase()=="table"){this.headerFrozenRow=new ClientUI.common.box.Box($(H),null,true);
break
}H=H.nextSibling
}this.helpObj=new ClientUI.common.box.Box(this.frozenContentBox.getElement(),null,true);
var F=this.headerFrozenRow.getElement().getElementsByTagName("col");
this.fcount=F.length;
var G=this.headerRow.getElement().getElementsByTagName("col");
this.ncount=G.length;
var B=new Array(this.fcount+this.ncount);
var I=0;
var D=0;
var M=this.eventCellMouseDown.bind(this);
var L=0,N,K=0,A;
var C=this.headerFrozenRow.getElement().rows[0].cells;
var J=this.grid.options.ids;
for(L=0;
L<this.fcount;
L++){A=C[L];
B[K]={columnId:J[L],col:F[L],width:parseInt(F[L].width),styleClass:A.className,id:A.id,align:A.align,valign:A.vAlign,title:A.title,minWidth:10,frozen:true,fixedWidth:Validators.getBoolean(A.getAttribute("fixedWidth"),false),sortable:Validators.getBoolean(A.getAttribute("sortable"),false),sorted:Validators.getBoolean(A.getAttribute("sorted"),"desc")};
if(B[K].sortable){Event.observe(A,"click",M)
}N=Element.getHeight(A);
if(N>D){D=N
}I+=B[K].width;
B[K].object=new ClientUI.common.box.InlineBox(A,null,true);
var O=this._getCellElements(K);
B[K].sep=new ClientUI.common.box.InlineBox(O[0],null,true);
B[K].sep.getElement().columnIndex=K;
if(!B[K].fixedWidth){Event.observe(B[K].sep.getElement(),"dblclick",this.eventSepDblClick);
Event.observe(B[K].sep.getElement(),"mousedown",this.eventSepMouseDown)
}else{sep.setStyle({cursor:"auto"})
}K++
}C=this.headerRow.getElement().rows[0].cells;
for(L=0;
L<this.ncount;
L++){A=C[L];
B[K]={columnId:J[L],col:G[L],width:parseInt(G[L].width),styleClass:A.className,id:A.id,align:A.align,valign:A.vAlign,title:A.title,minWidth:10,frozen:false,fixedWidth:Validators.getBoolean(A.getAttribute("fixedWidth"),false),sortable:Validators.getBoolean(A.getAttribute("sortable"),false),sorted:Validators.getBoolean(A.getAttribute("sorted"),"desc")};
if(B[K].sortable){Event.observe(A,"click",M)
}N=Element.getHeight(A);
if(N>D){D=N
}I+=B[K].width;
B[K].object=new ClientUI.common.box.InlineBox(A,null,true);
var O=this._getCellElements(K);
if(O[0]){B[K].sep=new ClientUI.common.box.InlineBox(O[0],null,true);
B[K].sep.getElement().columnIndex=K;
if(!B[K].fixedWidth){Event.observe(B[K].sep.getElement(),"dblclick",this.eventSepDblClick);
Event.observe(B[K].sep.getElement(),"mousedown",this.eventSepMouseDown)
}else{sep.setStyle({cursor:"auto"})
}}K++
}this._columns=B;
this.defaultHeight=D;
this.defaultWidth=I;
if(ClientUILib.isGecko){this.defaultWidth-=this.getBorderWidth("lr")+this.getPadding("lr");
this.defaultHeight-=this.getBorderWidth("tb")+this.getPadding("tb")
}this.frozenSubstrate=new ClientUI.common.box.Box(this.gridId+":hs",this.getElement());
this.frozenSubstrate.getElement().name=this.getElement().id+"HRFrm";
this.frozenSubstrate.setHeight(this.headerRow.getHeight());
return true
},_getCellElements:function(C){var B=new Array(3);
var A=this.grid.getElement().id;
B[0]=$(A+":hsep_"+C);
B[1]=$(A+":hs_"+C);
return B
},agjustSeparators:function(){var C=0;
var A=this.headerFrozenRow.getElement().rows[0].cells;
var D=this.headerRow.getElement().rows[0].cells;
var F=4;
if(D[0].offsetWidth==D[0].clientWidth){F--
}for(var B=0;
B<this.fcount;
C++,B++){this._columns[C].sep.moveToX(A[B].offsetLeft+A[B].offsetWidth-F)
}var E=this.ncount-1;
for(var B=0;
B<E;
C++,B++){this._columns[C].sep.moveToX(D[B].offsetLeft+D[B].offsetWidth-F)
}},updateSize:function(){var H=0,G=0;
var D=0,E,B=0;
var C=this._columns;
var F=$A(this.headerFrozenRow.getElement().getElementsByTagName("col"));
var A=$A(this.headerFrozenRow.getElement().rows[0].cells);
A.each(function(I){if(D<C.length){C[D].width=parseInt(F[B].width);
E=Element.getHeight(I);
if(E>G){G=E
}H+=C[D].width
}D++;
B++
});
B=0;
F=$A(this.headerRow.getElement().getElementsByTagName("col"));
A=$A(this.headerRow.getElement().rows[0].cells);
A.each(function(I){if(D<C.length){C[D].width=parseInt(F[B].width);
E=Element.getHeight(I);
if(E>G){G=E
}H+=C[D].width
}D++;
B++
});
this.defaultHeight=G;
this.defaultWidth=H;
this.setHeight(this.defaultHeight);
this.setWidth(this.defaultWidth);
this.agjustSeparators();
this.updateHeaders()
},updateLayout:function($super){if(!this.controlCreated||!this.grid.controlCreated){return 
}$super();
var B=this.getHeight();
var A=this.grid.getColumnsTotalWidth();
var C=this.grid.getColumnsFrozenWidth();
this.contentBox.setWidth(Math.max(this.getWidth(),A));
this.contentBox.setHeight(B);
this.contentBox.moveTo(C-this.grid.getScrollOffset(),0);
this.headerRow.setHeight(B);
this.frozenContentBox.setWidth(C);
this.frozenContentBox.setHeight(B);
this.frozenContentBox.moveTo(0,0);
this.headerFrozenRow.setHeight(B);
this.frozenSubstrate.setWidth(C);
this.updateHeaders()
},getColumns:function(){return this._columns
},OnSepMouseDown:function(A){this.dragColumnInfo={srcElement:Event.element(A),dragStarted:false,mouseDown:true,startX:Event.pointerX(A),originalX:0};
this.dragColumnInfo.object=this.getColumns()[this.dragColumnInfo.srcElement.columnIndex].object;
this.dragColumnInfo.sep=this.getColumns()[this.dragColumnInfo.srcElement.columnIndex].sep;
this.dragColumnInfo.minWidth=this.getColumns()[this.dragColumnInfo.srcElement.columnIndex].minWidth;
Event.stop(A)
},OnSepMouseUp:function(B){if(this.dragColumnInfo&&this.dragColumnInfo.dragStarted){this.dragColumnInfo.dragStarted=false;
this.dragColumnInfo.mouseDown=false;
var C=Event.pointerX(B)-this.dragColumnInfo.startX;
var A=this.dragColumnInfo.object.getWidth()+C;
if(A<this.dragColumnInfo.minWidth){A=this.dragColumnInfo.minWidth
}setTimeout(function(){this.grid.adjustColumnWidth(this.dragColumnInfo.srcElement.columnIndex,A)
}.bind(this),10)
}this._hideSplitter()
},OnSepMouseMove:function(B){if(this.dragColumnInfo&&this.dragColumnInfo.mouseDown){if(!this.dragColumnInfo.dragStarted){this.dragColumnInfo.dragStarted=true;
this._showSplitter(this.dragColumnInfo.srcElement.columnIndex)
}else{var D=Event.pointerX(B)-this.dragColumnInfo.startX;
var C=this.dragColumnInfo.object.getWidth()-this.dragColumnInfo.minWidth;
if(D>=-C){var A=this.dragColumnInfo.originalX+D;
this.columnSplitter.moveToX(A-6)
}}Event.stop(B)
}},OnSepDblClick:function(A){ClientUILib.log(ClientUILogger.INFO,"OnSepDblClick")
},_showSplitter:function(A){if(!this.columnSplitter){this._createSplitter()
}var B=this.dragColumnInfo.sep.getX();
if(!this.getColumns()[A].frozen){B+=this.grid.getColumnsFrozenWidth()-this.grid.getScrollOffset()
}this.dragColumnInfo.originalX=B;
this.columnSplitter.show();
this.columnSplitter.setHeight(this.defaultHeight+this.grid.getBody().contentBox.getHeight());
this.columnSplitter.moveTo(B,0)
},_hideSplitter:function(){if(this.columnSplitter){this.columnSplitter.hide()
}},_createSplitter:function(){this.columnSplitter=new ClientUI.common.box.Box(this.gridId+":cs",this.grid.getElement());
this.columnSplitter.makeAbsolute();
this.columnSplitter.setWidth(10)
},adjustScrollPosition:function(A){this.contentBox.moveToX(this.grid.getColumnsFrozenWidth()-A)
},OnCellMouseDown:function(D){var C=Event.element(D);
while(C&&!Element.hasClassName(C,"dr-sdt-hc")){C=C.parentNode
}if(C){var B=parseInt(C.getAttribute("columnindex"));
if(B>=0){var E=this.grid.getBody().templFrozen.getElement().rows;
var A=E&&E.length>0?this.grid.getBody()._getRowIndex(E[0].id):0;
this.grid.eventOnSort.fire({column:B,startRow:A,index:this.grid.getBody().currRange.start});
Event.stop(D)
}}},updateHeaders:function(){var G=this.getColumns();
for(var B=0;
B<G.length;
B++){var A=G[B];
var D=A.object;
var C=this._getCellElements(B)[1];
if(C){var F=D.getWidth()-C.getWidth();
var E=(D.getHeight()-C.getHeight())/2;
F=Math.floor(F);
E=Math.floor(E);
C.setStyle({left:F+"px",top:E+"px",visibility:"inherit"})
}}},adjustColumnWidth:function(B,A){this._columns[B].col.width=A>0?A:1;
if(A<=0){this.getColumns()[B].sep.hide()
}this._columns[B].width=A
},setFakeColumnWidth:function(){this._columns.last().col.width=1;
var A=this.grid.getElement().offsetWidth-this.headerRow.getElement().offsetWidth;
if(A<1){A=1
}this._columns.last().col.width=A
},hideColumn:function(B,F){var D=this._columns.splice(B,1)[0];
var A=$(this.grid.getElement().id+"_hc");
A.value=A.value+D.columnId+",";
D.col.parentNode.removeChild(D.col);
D.bodyCol.parentNode.removeChild(D.bodyCol);
D.footerCol.parentNode.removeChild(D.footerCol);
var E;
if(F){E=this.headerFrozenRow.getElement().rows
}else{E=this.headerRow.getElement().rows
}for(var C=0;
C<E.length;
C++){E[C].removeChild(E[C].cells[B])
}}});
Object.extend(ClientUI.controls.grid.GridHeader.prototype,{sepStyleClass:"dr-sdt-hsep",_columns:[]});
ClientUILib.declarePackage("ClientUI.common.box.SplashBox");
ClientUILib.requireClass("ClientUI.common.box.Box");
ClientUILib.requireClass("ClientUI.common.box.Substrate");
ClientUI.common.box.SplashBox=Class.create(ClientUI.common.box.Box,{initialize:function($super,C,A,D,B){$super(null,A);
this.moveTo(-1000,-1000);
this.zIndex=D||500;
this.supressSplash=B||false;
this.createControl(C);
this.hide()
},createControl:function(A){this.element.setStyle({zIndex:this.zIndex});
this.makeAbsolute();
this.frame=new ClientUI.common.box.Substrate(null,this.getElement());
this.frame.getElement().setStyle({zIndex:this.zIndex+1});
this.frame.getElement().setStyle({backgroundColor:"#FFFFFF"});
this.frame.getElement().setStyle({border:"medium none"});
this.frame.getElement().setStyle({opacity:"0"});
this.frame.moveTo(0,0);
this.frame.setWidth(this.getWidth());
this.frame.setHeight(this.getHeight());
if(!this.supressSplash){this.div=new ClientUI.common.box.Box(null,this.getElement());
this.div.getElement().setStyle({zIndex:this.zIndex+2});
this.div.getElement().setStyle({backgroundColor:"#000000"});
this.div.getElement().setStyle({opacity:"0.6"});
this.div.makeAbsolute();
this.div.moveTo(0,0);
this.div.setWidth(this.getWidth());
this.div.setHeight(this.getHeight());
this.div.show()
}this.text=new ClientUI.common.box.Box(A,this.getElement());
this.text.setParent(this.getElement());
this.text.getElement().setStyle({zIndex:this.zIndex+100});
if(!A){this.text.getElement().innerHTML="<font size='4' color='white'>Loading...</font>"
}this.text.makeAbsolute();
this.text.show()
},setSize:function(B,A){this.setWidth(B);
this.setHeight(A);
this.containerWidth=B;
this.containerHeight=A
},setImage:function(A){if(!this.img){this.img=new ClientUI.common.box.Box($(document.createElement("img")),this.div.getElement());
this.img.makeAbsolute()
}this.img.getElement().src=A;
this.text.hide()
},updateLayout:function(){var C=this.containerWidth||this.getWidth();
var B=this.containerHeight||this.getHeight();
this.frame.setWidth(C);
this.frame.setHeight(B);
if(!this.supressSplash){this.div.setWidth(C);
this.div.setHeight(B)
}if(this.img){var A=C/2-this.img.getWidth()/2;
var D=B/2-this.img.getHeight()/2;
this.img.moveTo(A,D)
}else{var A=C/2-this.text.getWidth()/2;
var D=B/2-this.text.getHeight()/2;
this.text.moveTo(A,D)
}}});
ClientUILib.declarePackage("ClientUI.controls.grid.DataCash");
ClientUI.controls.grid.DataCash=Class.create({initialize:function(A){var C=parseInt(A/this.PKG_SIZE+1);
this.cash=new Array(C);
for(var B=0;
B<C;
B++){this.cash[B]=new Array(this.PKG_SIZE)
}},getRow:function(B){var C=parseInt(B/this.PKG_SIZE),A=B%this.PKG_SIZE;
return this.cash[C][A]
},setRow:function(B,D){var C=parseInt(B/this.PKG_SIZE),A=B%this.PKG_SIZE;
this.cash[C][A]=D
}});
Object.extend(ClientUI.controls.grid.DataCash.prototype,{PKG_SIZE:20});
ClientUILib.declarePackage("ClientUI.controls.grid.GridBody");
ClientUILib.requireClass("ClientUI.common.box.Box");
ClientUI.controls.grid.GridBody=Class.create(ClientUI.common.box.Box,{initialize:function($super,B,A){this.grid=A;
this.gridId=A.getElement().id;
$super(B);
this._eventOnHScroll=this._onContentHScroll.bind(this);
this._eventOnVScroll=this._onContentVScroll.bind(this);
this._eventOnDataReady=this._onDataReady.bind(this);
this.createControl(B);
this.registerEvents()
},registerEvents:function(){Event.observe(this.scrollBox.eventHScroll,"grid body hscroll",this._eventOnHScroll);
Event.observe(this.scrollBox.eventVScroll,"grid body vscroll",this._eventOnVScroll);
Event.observe(this.grid.dataModel.eventDataReady,"grid data is loaded",this._eventOnDataReady)
},destroy:function(){Event.stopObserving(this.scrollBox.eventHScroll,"grid body hscroll",this._eventOnHScroll);
Event.stopObserving(this.scrollBox.eventVScroll,"grid body vscroll",this._eventOnVScroll);
Event.stopObserving(this.grid.dataModel.eventDataReady,"grid data is loaded",this._eventOnDataReady)
},_onContentHScroll:function(A){this.grid.adjustScrollPosition(A)
},_onDataReady:function(A){window.loadingUpdateTime=(new Date()).getTime();
this.invalidate(A);
window.loadingInvalidateTime=(new Date()).getTime()
},_onContentVScroll:function(A){this.helpObject1.moveToY(this.sizeBox.getHeight()+this.defaultRowHeight+5);
this.helpObject2.moveToY(this.sizeBox.getHeight()+this.defaultRowHeight+5);
this.setScrollPos(A);
this.adjustDataPosition(A)
},createControl:function(D){var E=D.childNodes;
for(var B=0;
B<E.length;
B++){if(E[B].id==this.gridId+":bc"){this.container=new ClientUI.common.box.Box(E[B],null,true);
this.container.makeAbsolute();
this.container.setStyle({"z-index":20});
if(!ClientUILib.isIE){this.container.setStyle({overflow:"hidden"})
}break
}}this.scrollBox=new ClientUI.common.box.ScrollableBox(this.gridId+":scb",this.getElement());
this.scrollBox.setWidth(this.getWidth());
this.scrollBox.setHeight(this.getHeight());
this.sizeBox=new ClientUI.common.box.Box(this.gridId+":sb",this.scrollBox.getElement());
var G=null,F=null;
var E=this.container.getElement().childNodes;
for(var B=0;
B<E.length;
B++){if(E[B].id&&E[B].id.indexOf("FrozenBox")>=0){F=E[B]
}else{if(E[B].id&&E[B].id.indexOf("NormalBox")>=0){G=E[B]
}}}if(!G||!F){errMsg="Unable to parse template for GridBody. Unable to find FrozenBox or NormalBox.";
ClientUILib.log(ClientUILogger.ERROR,errMsg);
throw (errMsg)
}this.contentBox=new ClientUI.common.box.Box(G);
this.contentBox.makeAbsolute();
this.frozenContentBox=new ClientUI.common.box.Box(F);
this.frozenContentBox.makeAbsolute();
this.helpObject1=new ClientUI.common.box.Box(this.gridId+":nho",this.contentBox.getElement());
this.helpObject2=new ClientUI.common.box.Box(this.gridId+":fho",this.frozenContentBox.getElement());
var C=this.frozenContentBox.getElement().firstChild;
while(C){if(C.tagName&&C.tagName.toLowerCase()=="table"){this.templFrozen=new ClientUI.common.box.Box($(C),null,true);
this.templFrozen.makeAbsolute();
break
}C=C.nextSibling
}C=this.contentBox.getElement().firstChild;
while(C){if(C.tagName&&C.tagName.toLowerCase()=="table"){this.templNormal=new ClientUI.common.box.Box($(C),null,true);
this.templNormal.makeAbsolute();
break
}C=C.nextSibling
}this.parseTemplate(this.templFrozen.getElement(),this.templNormal.getElement());
var A=this.grid.getElement().id;
this.fTable=$(A+":f");
this.nTable=$(A+":n");
this.controlCreated=true;
this.sizeBox.setHeight(this.templNormal.getElement().offsetHeight)
},parseTemplate:function(C,B){if(!B||!B.rows||B.rows.length===0){return false
}var E=this.grid.getHeader().getColumns();
var D=0,A=0;
var F=this.templFrozen.getElement().getElementsByTagName("col");
for(D=0;
D<F.length;
D++){E[A].bodyCol=$(F[D]);
A++
}F=this.templNormal.getElement().getElementsByTagName("col");
for(D=0;
D<F.length;
D++){E[A].bodyCol=$(F[D]);
A++
}this.rowsCount=Math.min(B.rows.length,this.grid.dataModel.getCount());
this.helpObj=new ClientUI.common.box.Box(C,null,true);
this.countToLoad=0;
this.startRow=0;
this.startIndex=0;
this.currRange=$R(0,this.rowsCount);
return true
},setScrollPos:function(A){this.contentBox.getElement().scrollTop=A;
this.frozenContentBox.getElement().scrollTop=A;
if(ClientUILib.isIE&&!ClientUILib.isIE7){this.contentBox.getElement().scrollTop=A;
this.frozenContentBox.getElement().scrollTop=A
}},updateSize:function(){var A=this._calcDefaultRowHeight();
if(isFinite(A)){this.defaultRowHeight=A
}var B=this.templNormal.getElement().rows[0];
if(B){this.defaultRowHeight=Element.getHeight(B.cells[0])
}},updateLayout:function($super){if(!this.controlCreated||!this.grid.controlCreated){return 
}$super();
if(!this.scrollBox||!this.contentBox||!this.sizeBox){return 
}var B=this.grid.getColumnsTotalWidth();
this.scrollBox.moveTo(0,0);
this.scrollBox.setWidth(this.getWidth());
this.scrollBox.setHeight(this.getHeight());
var F=this.grid.getScrollOffset();
var A=this.scrollBox.getHeight();
var D=this.grid.getFooter()?this.grid.getFooter().getHeight():0;
if(D>A){D=0
}var C=this.grid.getColumnsFrozenWidth();
this.frozenContentBox.moveTo(0,0);
this.contentBox.moveTo(C,0);
this.sizeBox.moveTo(0,0);
this.sizeBox.setWidth(B);
this.scrollBox.setWidth(this.getWidth()+1);
this.scrollBox.setHeight(this.getHeight()+1);
this.scrollBox.setWidth(this.getWidth());
this.scrollBox.setHeight(this.getHeight());
var E=this.scrollBox.getViewportWidth();
this.container.setWidth(E);
if(ClientUILib.isIE){this.contentBox.setWidth(E-C)
}else{this.contentBox.setWidth(Math.max(this.getWidth(),B))
}A=this.scrollBox.getElement().clientHeight;
this.contentBox.setHeight(A-D);
this.frozenContentBox.setWidth(C);
this.frozenContentBox.setHeight(A-D);
this.container.setHeight(A-D);
this.defaultRowHeight=this._calcDefaultRowHeight();
this.sizeBox.setHeight(this.defaultRowHeight*this.grid.dataModel.getCount()+D);
this.helpObject1.moveToY(this.sizeBox.getHeight()+this.defaultRowHeight+5);
this.helpObject2.moveToY(this.sizeBox.getHeight()+this.defaultRowHeight+5);
var G=Math.min(B-E,F);
this.grid.adjustScrollPosition(G);
this.dataVisible=parseInt(this.contentBox.getHeight()/this.defaultRowHeight,10)+1;
this.dataVisible=Math.min(this.dataVisible,this.rowsCount);
if(A>0){this.adjustDataPosition(this.currentPos)
}},adjustScrollPosition:function(A){this.templNormal.moveToX(-A)
},getScrollYPosition:function(){return this.contentBox.getElement().scrollTop
},adjustDataPosition:function(G){if(this.currentPos==G){return 
}this.processedPos=G;
var C=(this.currentPos<=G)?true:false;
var D=parseInt(G/this.defaultRowHeight)-1;
if(D<0){D=0
}var F=Math.max(D-(C?1:(this.rowsCount-this.dataVisible-1)),0);
var E=Math.min(D+(C?this.rowsCount-1:this.dataVisible+1),this.grid.dataModel.getCount());
if(F==0){E=this.rowsCount
}else{if(E==this.grid.dataModel.getCount()){F=E-this.rowsCount
}}var B=$R(F,E);
if(this.currRange.start==F&&this.currRange.end==E){return 
}if(F>=E){ClientUILib.log(ClientUILogger.WARNING,"!!! GridBody: adjustDataPosition. Pos: "+G+", From:"+F+", To:"+E);
return 
}var A=this._getPendingTask();
if(E-F>0){A.timer=null;
A.from=F;
A.to=E;
A.first=D;
A.pos=G;
this._setPendingTask(A)
}},_getPendingTask:function(){if(!this.pendingTask){this.pendingTask={timer:null,rowsToLoad:[],rowsToLoadIdx:[],from:0,to:0,first:0,pos:0}
}return this.pendingTask
},_setPendingTask:function(A){clearTimeout(this.pendingTask.timer);
this.pendingTask.timer=null;
this.pendingTask=A;
A.timer=setTimeout(function(){this.startLoadData()
}.bind(this),this.grid.dataModel.getRequestDelay())
},adjustColumnWidth:function(C,B){var A=this.grid.getHeader().getColumns();
A[C].bodyCol.width=B>0?B:1
},setFakeColumnWidth:function(){var A=this.grid.getHeader().getColumns();
var C=A.last().bodyCol;
if(C){C.width=1
}var B=this.grid.getElement().offsetWidth-this.fTable.offsetWidth-this.nTable.offsetWidth;
if(B<1){B=1
}if(C){C.width=B
}},startLoadData:function(){if(this.updateStarted){this._setPendingTask(this._getPendingTask());
return 
}this.updateStarted=true;
var D=this._getPendingTask();
var H=$R(D.from,D.to);
var A=5;
var M=0;
var K=0;
var J=0;
if(this.currRange.end<H.start||this.currRange.start>H.end){A=0
}if(A===0){K=this._getRowIndex(this.templFrozen.getElement().rows[0].id);
M=H.start;
J=H.end-H.start
}else{var F,P,L,G;
J=0;
var E=this.templFrozen.getElement();
var N=this.templNormal.getElement();
if(H.start>this.currRange.start&&H.start<this.currRange.end){A=1;
J=H.start-this.currRange.start;
if(J>0){K=this._getRowIndex(E.rows[0].id);
M=this.currRange.end
}}else{if(H.start==this.currRange.start){A=3;
J=H.end-this.currRange.end;
if(J>0){M=this.currRange.end;
var I=this.rowsCount-J;
K=this._getRowIndex(E.rows[I].id)
}}else{A=2;
J=this.currRange.start-H.start;
if(J>0){M=H.start;
var I=this.rowsCount-J;
K=this._getRowIndex(E.rows[I].id)
}}}}var C=true;
if(M>(D.first+this.dataVisible)||(M+J)<D.first){C=false
}if(J>0&&C){this.updateStarted=true;
ClientUILib.log(ClientUILogger.WARNING,"Start loading: index: "+M+", and startRow: "+K+", and count: "+J);
this.currRange=H;
this.currentPos=D.pos;
if(this.grid.options.hideWhenScrolling){this.container.hide()
}var O={index:M,count:J,startRow:K,switchType:A};
var B={index:O.index,count:O.count,startRow:O.startRow,switchType:O.switchType};
if(O.count>0){setTimeout(function(){this.updateInterval=screen.updateInterval;
screen.updateInterval=1000;
this.grid.dataModel.loadRows(O)
}.bind(this),10)
}}else{this.updateStarted=false
}},forceReRender:function(){if(ClientUILib.isIE&&!ClientUILib.isIE7){var C=this.templFrozen.getElement();
var B=this.templNormal.getElement();
var A=C.insertRow();
C.deleteRow(A.rowIndex);
A=B.insertRow();
B.deleteRow(A.rowIndex)
}},rearrangeRows:function(B,M,H){var L=this.templFrozen.getElement();
var Q=this.templNormal.getElement();
if(B.switchType===0){var O=this.defaultRowHeight*B.index;
var R=this.contentBox.getElement().scrollTop;
if(H){this._showContainer()
}this.templFrozen.moveToY(O);
this.templNormal.moveToY(O);
this.forceReRender()
}else{if(B.switchType===1||B.switchType===2){var D=L.rows.length;
var I=new Array(D),F=new Array(D);
var N=0,P;
var E=B.index;
if(B.switchType===1){for(P=B.count;
P<this.rowsCount;
P++){I[N]=L.rows[P];
F[N]=Q.rows[P];
N++
}for(P=0;
P<B.count;
P++){I[N]=L.rows[P];
F[N]=Q.rows[P];
N++
}}else{for(P=this.rowsCount-B.count;
P<this.rowsCount;
P++){I[N]=L.rows[P];
F[N]=Q.rows[P];
N++
}for(P=0;
P<this.rowsCount-B.count;
P++){I[N]=L.rows[P];
F[N]=Q.rows[P];
N++
}}var A=navigator.product=="Gecko";
var J=L.tBodies[0];
var G=Q.tBodies[0];
var K=J.nextSibling;
var C=G.nextSibling;
if(A){fp=J.parentNode;
fp.removeChild(J);
np=G.parentNode;
np.removeChild(G)
}for(P=0;
P<D;
P++){J.appendChild(I[P]);
G.appendChild(F[P])
}if(A){fp.insertBefore(J,K);
np.insertBefore(G,C)
}var O=(B.switchType==1)?this.currRange.start*this.defaultRowHeight:B.index*this.defaultRowHeight;
if(H){this._showContainer()
}this.templFrozen.moveToY(O);
this.templNormal.moveToY(O)
}else{var O=this.currRange.start*this.defaultRowHeight;
if(H){this._showContainer()
}this.templFrozen.moveToY(O);
this.templNormal.moveToY(O)
}}},_showContainer:function(){this.container.show();
if(ClientUILib.isIE){this.setScrollPos(this.currentPos)
}},invalidate:function(A){screen.updateInterval=this.updateInterval;
this.rearrangeRows(A,true,true);
this.container.show();
this.updateStarted=false
},processCashedValues:function(I){return I;
var B={switchType:I.switchType};
var G=this.getCash();
var E=I.count;
var F=I.index;
var H=I.startRow;
var D=0;
var A;
while(D<E&&(A=G.getRow(F+D))!=null){D++
}if(D>0){B.count=D;
B.index=F;
B.startRow=H;
this._restoreFromCash(B);
I.count-=D;
I.index=F+D;
I.startRow=H+D;
if(I.startRow>=this.rowsCount){I.startRow-=this.rowsCount
}}var C=0;
while(D<E&&!(A=G.getRow(F+D))){D++;
C++
}if(D<E){B.count=I.count-C;
B.index=F+D;
B.startRow=H+D;
if(B.startRow>=this.rowsCount){B.startRow-=this.rowsCount
}this._restoreFromCash(B);
I.count=C;
I.index=F+(D-C);
I.startRow=H+(D-C);
if(I.startRow>=this.rowsCount){I.startRow-=this.rowsCount
}}return I
},getCellText:function(F,D){var E=this.templFrozen.getElement().rows[F].cells;
var C=E.length;
var B=D;
if(B>=C){B-=C;
E=this.templNormal.getElement().rows[F].cells
}var A=document.getElementsByClassName("dr-sdt-bcbody",E[B]);
return(A&&A.length&&A.length>0)?A[0].innerHTML:""
},ensureVisible:function(A){if(A>=0&&A<this.grid.dataModel.getCount()){var B=parseInt(this.contentBox.getHeight()/this.defaultRowHeight,10)+1;
if(this.grid.dataModel.getCount()>B){var C=A*this.defaultRowHeight;
this.scrollBox.getElement().scrollTop=C;
this.currentPos=0;
this._onContentVScroll(this.scrollBox.getElement().scrollTop)
}}},reloadData:function(){this.currentPos=-(this.rowsCount*this.defaultRowHeight);
this.scrollBox.getElement().scrollTop=0;
this.currRange.start=-this.rowsCount;
this.currRange.end=-1;
this._onContentVScroll(0)
},_getRowIndex:function(A){return Number(A.split(this.grid.getElement().id)[1].split(":")[2])
},hideColumn:function(A,D){var C;
if(D){C=this.templFrozen.getElement().rows
}else{C=this.templNormal.getElement().rows
}for(var B=0;
B<C.length;
B++){C[B].removeChild(C[B].cells[A])
}},showRow:function(C){if(C=="up"){this.scrollBox.getElement().scrollTop=this.scrollBox.getElement().scrollTop-this.fTable.rows[1].offsetTop
}else{if(C=="down"){this.scrollBox.getElement().scrollTop=this.scrollBox.getElement().scrollTop+this.fTable.rows[1].offsetTop
}else{var B=$(this.gridId+":n:"+C);
var A=this.fTable.offsetTop+B.offsetTop;
if(this.frozenContentBox.getElement().scrollTop>A){this.scrollBox.getElement().scrollTop=A
}else{A+=B.offsetHeight;
A-=this.frozenContentBox.getElement().clientHeight;
if(this.frozenContentBox.getElement().scrollTop<A){this.scrollBox.getElement().scrollTop=A
}}}}this.scrollBox.updateScrollPos()
},_calcDefaultRowHeight:function(){var A=this.templNormal.getElement();
var B=A.rows.length;
if(B){return Math.ceil(A.offsetHeight/B)
}else{return 16
}}});
Object.extend(ClientUI.controls.grid.GridBody.prototype,{dataVisible:50,dataDelta:5,currentPos:0});
ClientUILib.declarePackage("ClientUI.controls.grid.GridFooter");
ClientUILib.requireClass("ClientUI.common.box.Box");
ClientUI.controls.grid.GridFooter=Class.create(ClientUI.common.box.Box,{initialize:function($super,B,A){this.grid=A;
$super(B);
this.createControl(B)
},createControl:function(A){var B="";
if(!A){B="Invalid template specified for GridFooter.";
ClientUILib.log(ClientUILogger.ERROR,B);
throw (B)
}if(!this.parseTemplate(A)){B="Unable to parse template. GridFooter requires template specified over table element with one row.";
ClientUILib.log(ClientUILogger.ERROR,B);
throw (B)
}this.setHeight(this.defaultHeight);
this.setWidth(this.defaultWidth);
this.controlCreated=true
},parseTemplate:function(D){if(!D){return false
}var E=D.childNodes;
for(var B=0;
B<E.length;
B++){if(E[B].tagName&&E[B].tagName.toLowerCase()=="div"){this.container=new ClientUI.common.box.Box(E[B],null,true);
this.container.setStyle({"z-index":100});
break
}}var H=null,G=null;
var E=this.container.getElement().childNodes;
for(var B=0;
B<E.length;
B++){if(E[B].id&&E[B].id.indexOf("FrozenBox")>=0){G=E[B]
}else{if(E[B].id&&E[B].id.indexOf("NormalBox")>=0){H=E[B]
}}}if(!H||!G){errMsg="Unable to parse template for GridFooter. Unable to find FrozenBox or NormalBox.";
ClientUILib.log(ClientUILogger.ERROR,errMsg);
throw (errMsg)
}this.contentBox=new ClientUI.common.box.Box(H);
this.contentBox.makeAbsolute();
this.frozenContentBox=new ClientUI.common.box.Box(G);
this.frozenContentBox.makeAbsolute();
var C=this.contentBox.getElement().firstChild;
while(C){if(C.tagName&&C.tagName.toLowerCase()=="table"){this.headerRow=new ClientUI.common.box.Box($(C),null,true);
break
}C=C.nextSibling
}C=this.frozenContentBox.getElement().firstChild;
while(C){if(C.tagName&&C.tagName.toLowerCase()=="table"){this.headerFrozenRow=new ClientUI.common.box.Box($(C),null,true);
break
}C=C.nextSibling
}var A=this.grid.getHeader().getColumns();
var B=0;
var F=$A(this.headerFrozenRow.getElement().getElementsByTagName("col"));
F.each(function(I){A[B].footerCol=$(I);
B++
});
F=$A(this.headerRow.getElement().getElementsByTagName("col"));
F.each(function(I){A[B].footerCol=$(I);
B++
});
this.helpObj=new ClientUI.common.box.Box(this.frozenContentBox.getElement(),null,true);
this.defaultWidth=this.grid.getHeader().defaultWidth;
this.defaultHeight=Element.getHeight(this.headerRow.getElement().rows[0].cells[0]);
if(ClientUILib.isGecko){this.defaultHeight-=this.getBorderWidth("tb")+this.getPadding("tb")
}this.frozenSubstrate=new ClientUI.common.box.Box(this.grid.getElement().id+":fs",this.getElement());
this.frozenSubstrate.getElement().name=this.getElement().id+"FRFrm";
this.frozenSubstrate.setHeight(this.defaultHeight);
return true
},updateSize:function(){this.defaultWidth=this.grid.getHeader().defaultWidth;
this.defaultHeight=Element.getHeight(this.headerRow.getElement().rows[0].cells[0]);
if(ClientUILib.isGecko){this.defaultHeight-=this.getBorderWidth("tb")+this.getPadding("tb")
}this.setHeight(this.defaultHeight);
this.setWidth(this.defaultWidth)
},updateLayout:function($super){if(!this.controlCreated||!this.grid.controlCreated){return 
}$super();
var B=this.getHeight();
var A=this.grid.getColumnsTotalWidth();
var C=this.grid.getColumnsFrozenWidth();
this.contentBox.setWidth(Math.max(this.getWidth(),A));
this.contentBox.setHeight(B);
this.contentBox.moveTo(C-this.grid.getScrollOffset(),0);
this.frozenContentBox.setWidth(C);
this.frozenContentBox.setHeight(B);
this.frozenContentBox.moveTo(0,0);
var C=this.grid.getBody().frozenContentBox.getWidth();
var D=this.grid.getBody().scrollBox.getViewportWidth();
this.container.setWidth(D);
this.setWidth(D);
this.frozenSubstrate.setWidth(C)
},adjustScrollPosition:function(A){this.contentBox.moveToX(this.grid.getColumnsFrozenWidth()-A)
},adjustColumnWidth:function(C,B){var A=this.grid.getHeader().getColumns();
A[C].footerCol.width=B>0?B:1
},setFakeColumnWidth:function(){var A=this.grid.getHeader().getColumns();
A.last().footerCol.width=1;
var B=this.grid.getElement().offsetWidth-this.headerRow.getElement().offsetWidth;
if(B<1){B=1
}A.last().footerCol.width=B
},hideColumn:function(A,D){var C;
if(D){C=this.headerFrozenRow.getElement().rows
}else{C=this.headerRow.getElement().rows
}for(var B=0;
B<C.length;
B++){C[B].removeChild(C[B].cells[A])
}}});
ClientUILib.declarePackage("ClientUI.controls.grid.Grid");
ClientUILib.requireClass("ClientUI.common.box.Box");
ClientUILib.requireClass("ClientUI.controls.grid.GridHeader");
ClientUILib.requireClass("ClientUI.controls.grid.GridBody");
ClientUILib.requireClass("ClientUI.controls.grid.GridFooter");
ClientUI.controls.grid.Grid=Class.create(ClientUI.common.box.Box,{initialize:function($super,C,B,A){$super(C);
if(!this.element||!this.element.id){this.element.id="ClientUI_Grid"+ClientUI_controls_grid_Grid_idGenerator++
}this.dataModel=B;
this.templates=$A(A);
this.eventOnSort=new ClientUI.common.utils.CustomEvent("OnSort");
this.eventOnResizeColumn=new ClientUI.common.utils.CustomEvent("OnResizeColumn");
this.createControl()
},createControl:function(){var C=this;
this.layout=new ClientUI.layouts.GridLayoutManager(this.getElement(),null);
var A,D;
for(var B=0;
B<this.templates.length;
B++){D=this.templates[B];
switch(D.pane){case GridLayout_Enum.HEADER:A=new ClientUI.controls.grid.GridHeader($(D.ref),C);
this.layout.addPane(GridLayout_Enum.HEADER,A);
break;
case GridLayout_Enum.BODY:A=new ClientUI.controls.grid.GridBody($(D.ref),C);
this.layout.addPane(GridLayout_Enum.BODY,A);
break;
case GridLayout_Enum.FOOTER:A=new ClientUI.controls.grid.GridFooter($(D.ref),C);
this.layout.addPane(GridLayout_Enum.FOOTER,A);
break
}}this.currentScrollPos=0;
this.controlCreated=true;
this.updateLayout();
if(ClientUILib.isIE&&!ClientUILib.isIE7){var C=this;
setTimeout(function(){C.updateLayout()
},50)
}},updateLayout:function($super){if(!this.controlCreated||this.getHeight()==0){return 
}$super();
var A=this.getHeader();
if(A.getHeight()==0){A.updateSize();
this.getBody().updateSize();
if(this.getFooter()){this.getFooter().updateSize()
}}if(this.layout){this.layout.updateLayout()
}A.updateLayout();
A.setFakeColumnWidth();
this.getBody().setFakeColumnWidth();
if(this.getFooter()){this.getFooter().setFakeColumnWidth()
}},getHeader:function(){return this.layout.getPane(GridLayout_Enum.HEADER)
},getFooter:function(){return this.layout.getPane(GridLayout_Enum.FOOTER)
},getBody:function(){return this.layout.getPane(GridLayout_Enum.BODY)
},adjustColumnWidth:function(A,B){this.getHeader().adjustColumnWidth(A,B);
this.getBody().adjustColumnWidth(A,B);
if(this.getFooter()){this.getFooter().adjustColumnWidth(A,B)
}this.updateLayout();
this.getHeader().agjustSeparators();
this.eventOnResizeColumn.fire(A,B)
},adjustScrollPosition:function(A){if(A<0){A=0
}this.currentScrollPos=A;
this.getHeader().adjustScrollPosition(A);
this.getBody().adjustScrollPosition(A);
if(this.getFooter()){this.getFooter().adjustScrollPosition(A)
}},getScrollOffset:function(){return this.currentScrollPos?this.currentScrollPos:0
},setColumnMinWidth:function(A,B){if(A<0||A>=this.getHeader().getColumns().length){return false
}this.getHeader().getColumns()[A].minWidth=B;
return true
},getColumnsTotalWidth:function(){var A=0;
var C=this.getHeader().getColumns();
for(var B=0;
B<C.length;
B++){A+=C[B].width
}return A
},getColumnsFrozenWidth:function(){var A=0;
var C=this.getHeader().getColumns();
var B=0;
while(B<C.length&&C[B].frozen){A+=C[B++].width
}return A
},invalidate:function(A){this.getBody().invalidate(A)
},adjustColumnsWidth:function(){var B=this.getHeader().getColumns();
for(var A=0;
A<B.length;
A++){this.adjustColumnWidth(A,B[A].width)
}},quickFind:function(B,J,I){var A=I||0;
var K="*"+J+"*";
K=K.replace(/\*/g,".*");
var G=new RegExp(K,"i");
var H=-1;
var F=this.getBody();
var E=F.rowsCount;
for(var C=A;
C<E;
C++){var D=F.getCellText(C,B);
D=D.replace(/,/g,"");
if(D.search(G)!=-1){H=C;
break
}}return H
},ensureVisible:function(A){this.getBody().ensureVisible(A)
},getDataIndex:function(B){var A=this.getBody();
return A.currRange.start+B
},getRowIndex:function(B){var A=this.getBody();
return(B>=A.currRange.start&&B<A.currRange.start+A.rowsCount)?B-A.currRange.start:-1
},hideColumn:function(A){this.adjustColumnWidth(A,0)
},reloadData:function(){this.getBody().reloadData()
},updateRowCount:function(B){var A=parseInt(B);
if(A>=0){this.dataModel.count=A;
this.updateLayout()
}}});
Object.extend(ClientUI.controls.grid.Grid.prototype,{eventOnSort:{},eventOnResizeColumn:{}});
if(!ClientUI_controls_grid_Grid_idGenerator){var ClientUI_controls_grid_Grid_idGenerator=0
}ClientUI.controls.grid.Selection=Class.create({initialize:function(){this.ranges=[]
},addId:function(B){B=parseInt(B);
if(this.isSelectedId(B)){return 
}var A=0;
while(A<this.ranges.length&&B>=this.ranges[A++].indexes[1]){}A--;
if(this.ranges[A-1]&&B==(this.ranges[A-1].indexes[1]+1)){if(B==(this.ranges[A].indexes[0]-1)){this.ranges[A-1].indexes[1]=this.ranges[A].indexes[1];
this.removeRange(A)
}else{this.ranges[A-1].indexes[1]++
}}else{if(this.ranges[A]){if(this.ranges[A]&&B==(this.ranges[A].indexes[0]-1)){this.ranges[A].indexes[0]--
}else{if(B==(this.ranges[A].indexes[1]+1)){this.ranges[A].indexes[1]++
}else{if(B<this.ranges[A].indexes[1]){this.addRange(A,new ClientUI.controls.grid.Range(B,B))
}else{this.addRange(A+1,new ClientUI.controls.grid.Range(B,B))
}}}}else{this.addRange(A,new ClientUI.controls.grid.Range(B,B))
}}},addRange:function(B,A){var C=this.ranges.push(A)-2;
if(B>=0){while(C>=B){this.ranges[C+1]=this.ranges[C--]
}this.ranges[C+1]=A
}},removeRange:function(A){var B=A+1;
while(B!=this.ranges.length){this.ranges[B-1]=this.ranges[B++]
}this.ranges.pop()
},isSelectedId:function(B){var A=0;
while(A<this.ranges.length&&B>=this.ranges[A].indexes[0]){if(B>=this.ranges[A].indexes[0]&&B<=this.ranges[A].indexes[1]){return true
}else{A++
}}return false
},getSelectedIdsQuantity:function(){var B=0;
for(var A=0;
A<this.ranges.length;
A++){B+=this.ranges[A].size()
}return B
},size:function(){return this.getSelectedIdsQuantity()
},removeId:function(B){B=parseInt(B);
if(!this.isSelectedId(B)){return 
}var A=0;
while(A<this.ranges.length&&B>this.ranges[A++].indexes[1]){}A--;
if(this.ranges[A]){if(B==(this.ranges[A].indexes[1])){if(B==(this.ranges[A].indexes[0])){this.removeRange(A)
}else{this.ranges[A].indexes[1]--
}}else{if(B==(this.ranges[A].indexes[0])){this.ranges[A].indexes[0]++
}else{this.addRange(A+1,new ClientUI.controls.grid.Range(B+1,this.ranges[A].indexes[1]));
this.ranges[A].indexes[1]=B-1
}}}},getState:function(){var A=this.clone();
return{size:function(){return A.size()
},each:function(B){A.each(B)
},isSelected:function(B){return A.isSelectedId(B)
}}
},clone:function(){var A=Object.extend(new Object(),this);
A.ranges=new Array(A.ranges.length);
for(var B=0;
B<A.ranges.length;
B++){A.ranges[B]=this.ranges[B].clone()
}return A
},each:function(B){for(var A=0;
A<this.ranges.length;
A++){this.ranges[A].each(B)
}},getRanges:function(){return this.ranges
},setRanges:function(A){this.ranges=A
},initRanges:function(D){if(!D){this.ranges=[];
return 
}var C=D.split(";");
this.ranges=new Array(C.length-1);
var A;
for(var B=0;
B<this.ranges.length;
B++){A=C[B].split(",");
this.ranges[B]=new ClientUI.controls.grid.Range(parseInt(A[0]),parseInt(A[1]))
}},inspectRanges:function(){var A=this.getRanges();
var B="";
A.each(function(C){B+=C.inspect()
});
return B
}});
ClientUI.controls.grid.Range=Class.create({initialize:function(B,A){this.indexes=[B,A]
},inspect:function(){return this.indexes[0]+","+this.indexes[1]+";"
},toString:function(){return this.inspect()
},size:function(){return this.indexes[1]-this.indexes[0]+1
},each:function(B){var A=this.indexes[0];
while(A<=this.indexes[1]){B(A++)
}},clone:function(){var A=Object.extend(new Object(),this);
A.indexes=this.indexes.clone();
return A
}});
ClientUI.controls.grid.SelectionManager=Class.create({initialize:function(A){this.grid=A;
this.selectionFlag;
this.firstIndex;
var B=A.getElement();
this.prefix=B.id;
this.selection=new ClientUI.controls.grid.Selection();
this.inputElement=A.options.selectionInput;
this.onselectionchange=A.options.onselectionchange;
this.selectedClass=A.options.selectedClass;
this.activeClass=A.options.activeClass;
this.restoreState();
this.setListeners();
this.eventKeyPress=this.processKeyDown.bindAsEventListener(this);
Event.observe(document,"keypress",this.eventKeyPress);
if(document.selection){Event.observe(B,"click",this.resetSelection.bindAsEventListener(this))
}this.eventLostFocus=this.processLostFocus.bindAsEventListener(this);
Event.observe(document,"click",this.eventLostFocus);
this.eventPreventLostFocus=this.processPreventLostFocus.bindAsEventListener(this);
Event.observe(B,"click",this.eventPreventLostFocus)
},restoreState:function(){this.selectionFlag=null;
this.selection.initRanges($(this.inputElement).value);
var C=0;
var A;
while(C<this.selection.ranges.length){A=this.selection.ranges[C].indexes[0];
while(A<=this.selection.ranges[C].indexes[1]){var D=$(this.prefix+":f:"+A);
var B=$(this.prefix+":n:"+A);
Element.addClassName(D,"dr-sdt-row-selected");
Element.addClassName(B,"dr-sdt-row-selected");
Element.addClassName(D,"rich-sdt-row-selected");
Element.addClassName(B,"rich-sdt-row-selected");
Element.addClassName(D,this.selectedClass);
Element.addClassName(B,this.selectedClass);
A++
}C++
}this.oldState=this.selection.getState()
},setListeners:function(){var A=$(this.prefix+":f").rows;
var C=$(this.prefix+":n").rows;
this.rowCount=A.length;
var D;
for(var B=0;
B<this.rowCount;
B++){D=Number(A[B].id.split(this.prefix)[1].split(":")[2]);
this.addListener(A[B],D);
this.addListener(C[B],D)
}},addListener:function(C,E){var D=this.processClick.bindAsEventListener(this,E);
var A=C.cells;
for(var B=0;
B<A.length;
B++){Utils.DOM.Event.observe(A[B],"click",D)
}},processPreventLostFocus:function(){this.inFocus=true;
this.preventLostFocus=true
},processLostFocus:function(){if(!this.preventLostFocus){this.lostFocus()
}else{this.preventLostFocus=false
}},lostFocus:function(){this.inFocus=false
},processKeyDown:function(D){if(!D.shiftKey){this.shiftRow=null
}var A,E;
var C=this.activeRow;
var B=false;
this.firstIndex=Number($(this.prefix+":n").rows[0].id.split(this.prefix)[1].split(":")[2]);
switch(D.keyCode||D.charCode){case Event.KEY_UP:if(this.inFocus&&C!=null){if(this.firstIndex!=C){E=(this.rowCount+C-1)%this.rowCount;
if(!D.ctrlKey&&!D.shiftKey){this.selectionFlag="x";
A=[E,E];
this.setSelection(A)
}else{if(!D.ctrlKey&&D.shiftKey){if(!this.shiftRow){this.shiftRow=this.activeRow
}if(this.shiftRow>=this.activeRow){this.addRowToSelection(E)
}else{this.removeRowFromSelection(C)
}}}B=true;
this.setActiveRow(E)
}else{this.grid.getBody().showRow("up")
}}break;
case Event.KEY_DOWN:if(this.inFocus&&C!=null){E=(C+1)%this.rowCount;
if(this.firstIndex!=E){if(!D.ctrlKey&&!D.shiftKey){this.selectionFlag="x";
A=[E,E];
this.setSelection(A)
}else{if(!D.ctrlKey&&D.shiftKey){if(!this.shiftRow){this.shiftRow=this.activeRow
}if(this.shiftRow<=this.activeRow){this.addRowToSelection(E)
}else{this.removeRowFromSelection(C)
}}}B=true;
this.setActiveRow(E)
}else{this.grid.getBody().showRow("down")
}}break;
case 65:case 97:if(this.inFocus&&D.ctrlKey){this.selectionFlag="a";
A=[0,this.rowCount];
this.setSelection(A);
B=true
}break;
case Event.KEY_TAB:this.lostFocus()
}if(B){this.grid.getBody().showRow(this.activeRow);
this.selectionChanged(D);
if(D.preventBubble){D.preventBubble()
}Event.stop(D)
}},processClick:function(B,C){if(!B.shiftKey){this.shiftRow=null
}var A;
if(B.shiftKey&&!B.ctrlKey&&!B.altKey){this.firstIndex=Number($(this.prefix+":n").rows[0].id.split(this.prefix)[1].split(":")[2]);
this.selectionFlag="x";
if(!this.shiftRow){this.shiftRow=this.activeRow
}this.startRow=this.shiftRow;
if(((this.startRow<=C)&&(this.firstIndex<=this.startRow||C<this.firstIndex))||(this.startRow>C&&this.firstIndex<this.startRow&&C<=this.firstIndex)){this.endRow=C
}else{this.endRow=this.startRow;
this.startRow=C
}A=[this.startRow,this.endRow];
this.setSelection(A)
}else{if(!B.shiftKey&&B.ctrlKey&&!B.altKey){if(this.selection.isSelectedId(C)){this.removeRowFromSelection(C)
}else{this.addRowToSelection(C)
}}else{if(!B.shiftKey&&!B.ctrlKey&&!B.altKey){this.selectionFlag="x";
A=[C,C];
this.setSelection(A)
}}}this.setActiveRow(C);
if(B.shiftKey){if(window.getSelection){window.getSelection().removeAllRanges()
}else{if(document.selection){document.selection.empty()
}}}this.selectionChanged(B)
},selectionChanged:function(A){$(this.inputElement).value=this.selection.inspectRanges()+(this.selectionFlag?this.selectionFlag:"");
var B=this.selection.getState();
A.oldSelection=this.oldState;
A.newSelection=B;
if(this.onselectionchange){this.onselectionchange(A)
}this.oldState=B
},setShiftRow:function(A){if(A.shiftKey){if(!this.shiftRow){this.shiftRow=this.activeRow
}}else{this.shiftRow=null
}},setSelection:function(A){var B=A[0];
A[1]=(A[1]+1)%this.rowCount;
while(B!=A[1]){this.addRowToSelection(B);
B=(B+1)%this.rowCount
}while(B!=A[0]){this.removeRowFromSelection(B);
B=(B+1)%this.rowCount
}},resetSelection:function(A){if(A.shiftKey){document.selection.empty()
}},addRowToSelection:function(C){this.selection.addId(C);
var B=$(this.prefix+":f:"+C);
var A=$(this.prefix+":n:"+C);
Element.addClassName(B,"dr-sdt-row-selected");
Element.addClassName(A,"dr-sdt-row-selected");
Element.addClassName(B,"rich-sdt-row-selected");
Element.addClassName(A,"rich-sdt-row-selected");
Element.addClassName(B,this.selectedClass);
Element.addClassName(A,this.selectedClass)
},removeRowFromSelection:function(C){this.selection.removeId(C);
var B=$(this.prefix+":f:"+C);
var A=$(this.prefix+":n:"+C);
Element.removeClassName(B,"dr-sdt-row-selected");
Element.removeClassName(A,"dr-sdt-row-selected");
Element.removeClassName(B,"rich-sdt-row-selected");
Element.removeClassName(A,"rich-sdt-row-selected");
Element.removeClassName(B,this.selectedClass);
Element.removeClassName(A,this.selectedClass)
},setActiveRow:function(C){var B,A;
if(this.activeRow!=null){B=$(this.prefix+":f:"+this.activeRow);
A=$(this.prefix+":n:"+this.activeRow);
Element.removeClassName(B,"dr-sdt-row-active");
Element.removeClassName(A,"dr-sdt-row-active");
Element.removeClassName(B,"rich-sdt-row-active");
Element.removeClassName(A,"rich-sdt-row-active");
Element.removeClassName(B,this.activeClass);
Element.removeClassName(A,this.activeClass)
}B=$(this.prefix+":f:"+C);
A=$(this.prefix+":n:"+C);
Element.addClassName(B,"dr-sdt-row-active");
Element.addClassName(A,"dr-sdt-row-active");
Element.addClassName(B,"rich-sdt-row-active");
Element.addClassName(A,"rich-sdt-row-active");
Element.addClassName(B,this.activeClass);
Element.addClassName(A,this.activeClass);
this.activeRow=C
}});
ClientUILib.declarePackage("ClientUI.controls.grid.ScrollableGrid");
ClientUI.controls.grid.ScrollableGrid=Class.create(ClientUI.controls.grid.Grid,{initialize:function($super,A){this.startInitTime=(new Date()).getTime();
this.options=A;
this.client_id=this.options.client_id;
this.rows_count=$(this.client_id+"_rows_input").value;
this.scroll_si=$(this.client_id+":si");
this.columns_count=this.options.columnsCount;
this.splash_id=this.options.splash_id;
this.dataModel=new ClientUI.controls.grid.FakeArrayDataModel(this.rows_count,this.columns_count,this.client_id);
this.templates=[{pane:GridLayout_Enum.HEADER,ref:this.client_id+"_GridHeaderTemplate"},{pane:GridLayout_Enum.BODY,ref:this.client_id+"_GridBodyTemplate"},{pane:GridLayout_Enum.FOOTER,ref:this.client_id+"_GridFooterTemplate"}];
var B=this;
var C=$super;
Event.onReady(function(){B.init(C)
});
Utils.execOnLoad(function(){B.init(C)
},Utils.Condition.ElementPresent(B.client_id),100);
this.endInitTime=(new Date()).getTime();
this.rowCallbacks=[]
},init:function(A){if(!this.isInitialized){this.isInitialized=true;
this.startCreateTime=(new Date()).getTime();
A(this.client_id,this.dataModel,this.templates);
this.endCreateTime=(new Date()).getTime();
setTimeout(function(){this.startPostProcessTime=(new Date()).getTime();
this.eventOnPostSort=new ClientUI.common.utils.CustomEvent("OnSort");
this.eventOnPostScroll=new ClientUI.common.utils.CustomEvent("OnScroll");
Event.observe(this.eventOnSort,"on sort",this.onSorted.bindAsEventListener(this));
if(this.options.selectionInput){this.selectionManager=new ClientUI.controls.grid.SelectionManager(this)
}this.endPostProcessTime=(new Date()).getTime()
}.bind(this),500);
if(this.scroll_si.value!=""){var B=this.scroll_si.value.split(",");
this.restoreScrollState(B[0],B[1],B[2])
}var C=this.getForm($(this.client_id));
Event.observe(C,"submit",this.restoreScrollPos.bindAsEventListener(this))
}},getForm:function(A){var B=A;
if(B){while(B.tagName.toUpperCase()!="FORM"){B=B.parentNode
}}return B
},onSortComplete:function(C,B,D){var A=C.getJSON("options");
Utils.AJAX.updateRows(A,C,this,this.client_id,[this.updateSelectionCallBack],[function(){this.selectionManager.restoreState();
this.eventOnPostSort.fire(A.column,A.order)
}]);
this.updateLayout()
},onScrollComplete:function(C,B,D){var A=this.dataModel.getCurrentOptions();
window.loadingServerTime=(new Date()).getTime();
Utils.AJAX.updateRows(A,C,this,this.client_id,[this.updateSelectionCallBack],[function(){this.selectionManager.restoreState();
this.eventOnPostScroll.fire(this.getBody().currRange.start)
}]);
window.loadingEndTime=(new Date()).getTime();
ClientUILib.log(ClientUILogger.ERROR,"Total time of data loading of "+A.count+" rows is: "+(window.loadingEndTime-window.loadingStartTime)+" miliseconds.");
ClientUILib.log(ClientUILogger.WARNING,"...Server load time: "+(window.loadingServerTime-window.loadingStartTime));
ClientUILib.log(ClientUILogger.WARNING,"...DOM updated time: "+(window.loadingUpdateTime-window.loadingServerTime));
ClientUILib.log(ClientUILogger.WARNING,"...Grid invalidation time: "+(window.loadingInvalidateTime-window.loadingUpdateTime));
ClientUILib.log(ClientUILogger.WARNING,"...Selection mng time: "+(window.loadingEndTime-window.loadingInvalidateTime))
},onSorted:function(A){this.options.onSortAjaxUpdate(A)
},updateSelectionCallBack:function(A){if(this.selectionManager){this.selectionManager.addListener(A.row,A.index)
}},setSizes:function(C,A){var B=this.element.style;
B.width=C+"px";
B.height=A+"px";
this.updateLayout()
},doCollapse:function(A){var E=this.getHeader();
var D=E.headerFrozenRow.getElement().rows[0].cells.length;
var C=E.headerRow.getElement().rows[0].cells.length;
if(A<D+C-1){var B=true;
if(A>=D){A-=D;
B=false
}this.hideColumn(A,B)
}},hideColumn:function(A,B){this.getHeader().hideColumn(A,B);
this.getBody().hideColumn(A,B);
if(this.getFooter()){this.getFooter().hideColumn(A,B)
}this.updateLayout()
},restoreScrollState:function(E,D,B){var A=this.getBody();
A.scrollBox.getElement().scrollTop=E;
A.currentPos=E;
A.currRange.start=D;
A.currRange.end=B;
A._onContentVScroll(E);
var C=A.currRange.start*A.defaultRowHeight;
A.templFrozen.moveToY(C);
A.templNormal.moveToY(C)
},getScrollPos:function(){return this.getBody().currentPos
},restoreScrollPos:function(){var A=this.getBody();
var D=A.currRange.start;
var B=A.currRange.end;
var C=this.getScrollPos();
this.scroll_si.value=C+","+D+","+B
}});
Object.extend(ClientUI.controls.grid.ScrollableGrid.prototype,{eventOnPostScroll:{},eventOnPostSort:{}})

SimpleTogglePanel=Class.create();
SimpleTogglePanel.prototype={initialize:function(B,A){this.panelId=B;
this.panelId_head=B+"_header";
this.status=A;
if(!this.status){this.status="true"
}},toggleToState:function(){var A=$(this.panelId+"_body");
var C=$(this.panelId+"_switch_on");
var B=$(this.panelId+"_switch_off");
if(this.status=="false"){Element.show(A);
this.status="true";
B.style.display="none";
C.style.display=""
}else{Element.hide(A);
this.status="false";
C.style.display="none";
B.style.display=""
}if(RichFaces.navigatorType()=="MSIE"){}$(this.panelId+"_input").value=this.status
}};
SimpleTogglePanelManager=Class.create();
SimpleTogglePanelManager.panels=$H($A({}));
SimpleTogglePanelManager.add=function(B){var A=new Object();
A[B.panelId]=B;
this.panels=this.panels.merge(A)
};
SimpleTogglePanelManager.toggleOnServer=function(B){var A=A4J.findForm($(B+"_header"));
if(!A||!A.appendChild){return 
}var C=this.panels.get(B);
if(C.status==0){C.status=1
}else{C.status=0
}var D={};
D[B]=C.status;
_JSFFormSubmit(null,A,null,D);
return false
};
SimpleTogglePanelManager.toggleOnClient=function(A){this.panels.get(A).toggleToState();
return false
}

if(!window.RichFaces){window.RichFaces={}
}var Suggestion={};
Suggestion.Base=function(){};
Suggestion.Base.prototype={baseInitialize:function(D,F,A){this.isOpera=(RichFaces.navigatorType()=="OPERA"?true:false);
this.element=$(D);
this.update=$(F);
this.hasFocus=false;
this.changed=false;
this.active=false;
this.index=0;
this.prevIndex=-1;
this.entryCount=0;
this.keyEvent=false;
this.oldValue=this.element.value;
this.skipHover=false;
A.selection=F+"_selection";
var E=(RichFaces.navigatorType()=="MSIE");
if(E){A.iframeId=F+"_iframe"
}if(this.setOptions){this.setOptions(A)
}else{this.options=A||{}
}this.options.param=this.options.param||this.element.name;
this.options.selectedClasses=(this.options.selectedClass||"dr-sb-int-sel rich-sb-int-sel").split(" ");
this.options.selectValueClass=this.options.selectValueClass||" ";
this.options.tokens=$A(A.tokens)||[];
this.options.frequency=this.options.frequency||0.4;
this.options.minChars=parseInt(this.options.minChars)||1;
this.options.onShow=this.options.onShow||function(H,I,G){if(!I.style.position||I.style.position=="absolute"){I.style.position="absolute";
RichFaces.Position.smartClone(H,I,G)
}if(!window.opera){Effect.Appear(I,{duration:0.15});
if(G.iframeId){Effect.Appear($(G.iframeId),{duration:0.15})
}}else{Effect.Appear(I,{duration:0.15,to:0.999999})
}};
this.options.onHide=this.options.onHide||function(H,I,G){if(G.iframeId){new Effect.Fade($(G.iframeId),{duration:0.15})
}new Effect.Fade(I,{duration:0.15})
};
this.options.width=this.options.width||"auto";
if(typeof (this.options.tokens)=="string"){this.options.tokens=new Array(this.options.tokens)
}for(var C=0;
C<this.options.tokens.length;
C++){var B=this.options.tokens[C];
if(B.charAt[0]=="'"&&B.charAt[B.length-1]=="'"){this.options.tokens[C]=B.substring(1,-1)
}}this.observerHandle=null;
this.element.setAttribute("autocomplete","off");
Element.hide(this.update);
this.onBlurListener=this.onBlur.bindAsEventListener(this);
Event.observe(this.element,"blur",this.onBlurListener);
this.onKeyDownListener=this.onKeyDown.bindAsEventListener(this);
Event.observe(this.element,"keydown",this.onKeyDownListener);
if(this.isOpera){this.onKeyUpListener=this.onKeyUp.bindAsEventListener(this);
Event.observe(this.element,"keyup",this.onKeyUpListener);
this.upDown=0
}this.onScrollListener=this.onScroll.bindAsEventListener(this);
if(A.popupClass){Element.addClassName(Element.select(this.update,".dr-sb-ext-decor-3")[0],A.popupClass)
}this.onNothingLabelClick=this.hideNLabel.bindAsEventListener(this)
},onBoxKeyPress:function(A){if(this.upDown==1){this.keyEvent=true;
this.markPrevious();
this.render()
}else{if(this.upDown==2){this.keyEvent=true;
this.markNext();
this.render()
}else{if(this.upDown==3){this.keyEvent=true;
this.markPreviousPage();
this.render()
}else{if(this.upDown==4){this.keyEvent=true;
this.markNextPage();
this.render()
}}}}},cancelSubmit:function(A){Event.stop(A)
},disableSubmit:function(){if(this.isOpera){var A=this.element;
while(A.parentNode&&(!A.tagName||(A.tagName.toUpperCase()!="FORM"))){A=A.parentNode
}if(A.tagName&&(A.tagName.toUpperCase()=="FORM")){this.parentForm=A;
this.onSubmitListener=this.cancelSubmit.bindAsEventListener(this);
Event.observe(A,"submit",this.onSubmitListener)
}}},enableSubmit:function(){if(this.isOpera){if(this.parentForm){Event.stopObserving(this.parentForm,"submit",this.onSubmitListener)
}}},onKeyUp:function(A){if(this.upDown>0){this.element.onkeypress=this.prevOnKeyPress
}this.upDown=0
},show:function(){if("SAFARI"==RichFaces.navigatorType()){this.wasScroll=false;
this.wasBlur=false;
if(!this.overflow){this.overflow=Element.select(this.update,".dr-sb-overflow")[0]
}Event.observe(this.overflow,"scroll",this.onScrollListener)
}if(Element.getStyle(this.update,"display")=="none"){this.options.onShow(this.element,this.update,this.options)
}this.disableSubmit()
},hide:function(){if("SAFARI"==RichFaces.navigatorType()){if(this.wasScroll){this.wasScroll=false;
return 
}if(this.overflow){Event.stopObserving(this.overflow,"scroll",this.onScrollListener)
}}this.stopIndicator();
if(Element.getStyle(this.update,"display")!="none"){this.options.onHide(this.element,this.update,this.options)
}this.enableSubmit();
this.hasFocus=false;
this.active=false
},hideNLabel:function(B){var A=$(this.update.id+"NothingLabel");
if(A){Element.hide(A);
Event.stopObserving(A,"click",this.onNothingLabelClick);
Event.stopObserving(this.element,"blur",this.onNothingLabelClick);
this.hide()
}},startIndicator:function(){if(this.options.indicator){Element.show(this.options.indicator)
}},stopIndicator:function(){if(this.options.indicator){Element.hide(this.options.indicator)
}},isUnloaded:function(){if(this.element.parentNode&&this.update.parentNode){return false
}LOG.info("Element unloaded from DOM");
if(this.element){Event.stopObserving(this.element,"blur",this.onBlurListener);
Event.stopObserving(this.element,"keydown",this.onKeyDownListener)
}return true
},_findTr:function(B){var A=Event.element(B);
while(A&&(!A.tagName||A.tagName.toUpperCase()!="TR")){A=A.parentNode
}return A
},onKeyDown:function(A){if(this.isUnloaded()){return 
}if(!this.initialized){if(this.options.iframeId){var C=$(this.options.iframeId);
var B=C.cloneNode(true);
C.parentNode.removeChild(C);
document.body.insertBefore(B,document.body.firstChild)
}var I=this.update.cloneNode(true);
this.update.parentNode.removeChild(this.update);
this.update=I;
var D=I.getElementsByTagName("script");
for(var E=0;
E<D.length;
E++){var H=D[E];
if(H.parentNode){H.parentNode.removeChild(H)
}}document.body.insertBefore(this.update,document.body.firstChild);
this.initialized=true
}this.wasBlur=false;
if(this.active){this.wasScroll=false;
switch(A.keyCode){case Event.KEY_TAB:case Event.KEY_RETURN:this.selectEntry(A);
Event.stop(A);
case Event.KEY_ESC:this.hide();
this.active=false;
Event.stop(A);
if(this.isOpera){this.element.focus()
}return ;
case Event.KEY_LEFT:case Event.KEY_RIGHT:return ;
case Event.KEY_UP:this.keyEvent=true;
this.markPrevious();
this.render();
if(navigator.appVersion.indexOf("AppleWebKit")>0){Event.stop(A)
}if(this.isOpera){this.upDown=1;
this.prevOnKeyPress=this.element.onkeypress;
this.element.onkeypress=this.onBoxKeyPress.bindAsEventListener(this)
}return ;
case Event.KEY_DOWN:this.keyEvent=true;
this.markNext();
this.render();
if(navigator.appVersion.indexOf("AppleWebKit")>0){Event.stop(A)
}if(this.isOpera){this.upDown=2;
this.prevOnKeyPress=this.element.onkeypress;
this.element.onkeypress=this.onBoxKeyPress.bindAsEventListener(this)
}return ;
case 33:this.keyEvent=true;
this.markPreviousPage();
this.render();
if(navigator.appVersion.indexOf("AppleWebKit")>0){Event.stop(A)
}if(this.isOpera){this.upDown=3;
this.prevOnKeyPress=this.element.onkeypress;
this.element.onkeypress=this.onBoxKeyPress.bindAsEventListener(this)
}return ;
case 34:this.keyEvent=true;
this.markNextPage();
this.render();
if(navigator.appVersion.indexOf("AppleWebKit")>0){Event.stop(A)
}if(this.isOpera){this.upDown=4;
this.prevOnKeyPress=this.element.onkeypress;
this.element.onkeypress=this.onBoxKeyPress.bindAsEventListener(this)
}return 
}}else{if(A.keyCode==Event.KEY_TAB||A.keyCode==Event.KEY_RETURN||A.keyCode==Event.KEY_ESC){return 
}}this.changed=true;
this.hasFocus=true;
if(this.observerHandle){LOG.debug("clear existing observer");
window.clearTimeout(this.observerHandle)
}LOG.debug("set timeout for request suggestion");
var F={};
try{F.target=A.target;
F.srcElement=A.srcElement;
F.type=A.type;
F.altKey=A.altKey;
F.button=A.button;
F.clientX=A.clientX;
F.clientY=A.clientY;
F.ctrlKey=A.ctrlKey;
F.keyCode=A.keyCode;
F.modifiers=A.modifiers;
F.pageX=A.pageX;
F.pageY=A.pageY;
F.screenX=A.screenX;
F.screenY=A.screenY;
F.shiftKey=A.shiftKey;
F.which=A.which
}catch(G){LOG.warn("Exception on clone event")
}this.observerHandle=window.setTimeout(this.onObserverEvent.bind(this,F),this.options.frequency*1000)
},onHover:function(B){var A=this._findTr(B);
if(!this.skipHover){if(this.index!=A.autocompleteIndex){this.index=A.autocompleteIndex;
this.render()
}if(B.type=="mousemove"){Event.stopObserving(A,"mousemove",this.onHover)
}}else{this.skipHover=false;
Event.observe(A,"mousemove",this.onHover.bindAsEventListener(this))
}Event.stop(B)
},onClick:function(B){this.wasScroll=false;
this.wasBlur=false;
var A=this._findTr(B);
this.index=A.autocompleteIndex;
this.selectEntry(B);
this.hide()
},onMouseOut:function(B){var A=this._findTr(B);
Event.stopObserving(A,"mousemove",this.onHover)
},onBlur:function(C){if(this.isUnloaded()){return 
}this.wasBlur=true;
if(!this.active){return 
}var B=RichFaces.Position.calcOffsets(this.update);
if(RichFaces.navigatorType()!="MSIE"){B["x"]=0;
B["y"]=0
}var A=C.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;
var D=C.clientY+document.body.scrollTop+document.documentElement.scrollTop;
if(A>B["x"]&&A<(this.update.clientWidth+B["x"])){if(D>(B["y"]-this.update.clientHeight)&&D<B["y"]){this.element.focus();
return 
}}setTimeout(this.hide.bind(this),250)
},onScroll:function(A){if("SAFARI"==RichFaces.navigatorType()&&this.wasBlur){if(this.element){this.element.focus();
this.wasScroll=true;
this.wasBlur=false
}}},calcEntryPosition:function(F,A){var E=F;
var B=0;
while(E&&(E!=A)){if("SAFARI"==RichFaces.navigatorType()&&"TR"==E.tagName.toUpperCase()){B+=Element.select(E,".dr-sb-cell-padding")[0].offsetTop
}else{B+=E.offsetTop
}if(E.parentNode==A){break
}E=E.offsetParent
}var D;
if("SAFARI"==RichFaces.navigatorType()){var C=Element.select(E,".dr-sb-cell-padding")[0];
D=C.offsetTop+C.offsetHeight
}else{D=F.offsetHeight
}return{realOffset:B,entryOffsetHeight:D}
},countVisibleEntries:function(){var D=this.getEntry(this.index);
var B=Element.select(this.update,"._suggestion_size_")[0]||this.update;
var A=this.calcEntryPosition(D,B);
var C=Math.round(B.clientHeight/A.entryOffsetHeight);
var E=Math.round((A.realOffset-B.scrollTop)/A.entryOffsetHeight);
return{current:E,all:C}
},render:function(){if(this.entryCount>0){LOG.debug("render for index "+this.index+" and old index "+this.prevIndex);
if(this.prevIndex!=this.index){var F=this.getEntry(this.index);
for(var B=0;
B<this.options.selectedClasses.length;
B++){Element.addClassName(F,this.options.selectedClasses[B])
}var H=Element.select(F,".dr-sb-cell-padding");
for(var B=0;
B<H.length;
B++){Element.addClassName(H[B],this.options.selectValueClass)
}if(this.keyEvent){var E=Element.select(this.update,"._suggestion_size_")[0]||this.update;
var I=this.calcEntryPosition(F,E);
var A=E.scrollTop;
if(I.realOffset>E.scrollTop+E.clientHeight-I.entryOffsetHeight){E.scrollTop=I.realOffset-E.clientHeight+I.entryOffsetHeight
}else{if(I.realOffset<E.scrollTop){E.scrollTop=I.realOffset
}}if(A!=E.scrollTop){this.skipHover=true
}this.keyEvent=false
}if(this.prevIndex>=0){var C=this.getEntry(this.prevIndex);
if(C){var D=Element.select(C,".dr-sb-cell-padding");
for(var B=0;
B<D.length;
B++){Element.removeClassName(D[B],this.options.selectValueClass)
}for(var B=0;
B<this.options.selectedClasses.length;
B++){Element.removeClassName(C,this.options.selectedClasses[B])
}}}}this.prevIndex=this.index;
if(this.hasFocus&&!this.wasBlur){this.show();
this.active=true
}}else{var G=$(this.update.id+"NothingLabel");
if(!G||"none"==G.style.display){this.active=false;
this.hide()
}}},markPrevious:function(){if(this.index>0){this.index--
}},markNext:function(){if(this.index<this.entryCount-1){this.index++
}},markPreviousPage:function(){var A=this.countVisibleEntries();
if(this.index>0){if(A.current>0){this.index=this.index-Math.min(A.current,A.all)
}else{this.index=this.index-A.all
}if(this.index<0){this.index=0
}}},markNextPage:function(){var A=this.countVisibleEntries();
if(this.index<this.entryCount-1){if((A.current<A.all-1)&&A.current>=0){this.index=this.index+(A.all-A.current-1)
}else{this.index=this.index+A.all
}if(this.index>this.entryCount-1){this.index=this.entryCount-1
}}},getEntry:function(A){if(this.options.entryClass){return Element.select(this.update,"."+this.options.entryClass)[A]
}else{return this.update.firstChild.firstChild.childNodes[A]
}},getCurrentEntry:function(){return this.getEntry(this.index)
},selectEntry:function(B){this.active=false;
var A=$(this.options.selection);
A.value=this.index;
this.updateElement(this.getCurrentEntry());
if(this.options.onselect){this.options.onselect(this,B)
}if(this.update.onselect){this.update.onselect(this,B)
}A.value=""
},updateElement:function(F){if(this.options.updateElement){this.options.updateElement(F);
return 
}var C="";
if(this.options.select){var A=Element.select(F,"."+this.options.select)||[];
if(A.length>0){C=Element.collectTextNodes(A[0],this.options.select)
}}else{C=Element.collectTextNodesIgnoreClass(F,"informal")
}var E=this.findLastToken();
if(E!=-1){var D=this.element.value.substr(0,E+1);
var B=this.element.value.substr(E+1).match(/^\s+/);
if(B){D+=B[0]
}this.element.value=D+C
}else{this.element.value=C
}this.oldValue=this.element.value;
this.element.focus();
if(this.options.afterUpdateElement){this.options.afterUpdateElement(this.element,F)
}},updateChoices:function(F){if(!this.changed&&this.hasFocus){if(F){this.update.firstChild.replaceChild(F,this.update.firstChild.firstChild)
}var C=[];
if(this.options.entryClass){C=Element.select(this.update,"."+this.options.entryClass)||[]
}else{if(this.update.firstChild&&this.update.firstChild.firstChild&&this.update.firstChild.firstChild.childNodes){Element.cleanWhitespace(this.update);
Element.cleanWhitespace(this.update.firstChild);
Element.cleanWhitespace(this.update.firstChild.firstChild);
C=this.update.firstChild.firstChild.childNodes
}}this.entryCount=C.length;
for(var D=0;
D<this.entryCount;
D++){var E=C[D];
E.autocompleteIndex=D;
this.addObservers(E)
}this.stopIndicator();
var A=Element.select(this.update,"._suggestion_size_")[0]||this.update;
A.scrollTop=-1;
A.scrollLeft=-1;
this.index=0;
this.prevIndex=-1;
var B=$(this.update.id+"NothingLabel");
if(B&&this.hasFocus&&!this.wasBlur){if(this.entryCount<1){Element.show(B);
Event.observe(B,"click",this.onNothingLabelClick);
Event.observe(this.element,"blur",this.onNothingLabelClick);
this.show()
}}this.render()
}},addObservers:function(A){Event.observe(A,"mouseover",this.onHover.bindAsEventListener(this));
Event.observe(A,"click",this.onClick.bindAsEventListener(this));
Event.observe(A,"mouseout",this.onMouseOut.bindAsEventListener(this))
},onObserverEvent:function(B){LOG.debug("Observer event occurs");
this.changed=false;
var A=this.element.value;
if(this.getToken().length>=this.options.minChars){LOG.debug("Call data for update choices");
if((B.keyCode==Event.KEY_DOWN||this.oldValue!=A)&&A.length>0){this.startIndicator();
this.getUpdatedChoices(B)
}}else{this.active=false;
this.hide()
}this.oldValue=A;
this.observerHandle=null
},getToken:function(){var B=this.findLastToken();
if(B!=-1){var A=this.element.value.substr(B+1).replace(/^\s+/,"").replace(/\s+$/,"")
}else{var A=this.element.value
}return/\n/.test(A)?"":A
},findLastToken:function(){var C=-1;
for(var B=0;
B<this.options.tokens.length;
B++){var A=this.element.value.lastIndexOf(this.options.tokens[B]);
if(A>C){C=A
}}return C
}};
RichFaces.Suggestion=Class.create();
Object.extend(Object.extend(RichFaces.Suggestion.prototype,Suggestion.Base.prototype),{initialize:function(A,F,D,E,B,C){var G=C.popup||"ac1update";
if(!$(G)){this.create(D,G,E,C)
}this.baseInitialize(D,G,C);
this.options.asynchronous=true;
this.options.onajaxcomplete=C.oncomplete;
this.options.oncomplete=this.onComplete.bind(this);
this.options.defaultParams=this.options.parameters||null;
this.content=E;
this.containerId=A;
this.actionUrl=F;
if(B&&B!="null"){this.onsubmitFunction=new Function(B+";return true;").bind(this.element)
}return this
},getUpdatedChoices:function(A){this.options.parameters[this.options.param]=this.getToken();
if(this.onsubmitFunction&&!this.onsubmitFunction()){return 
}A4J.AJAX.Submit(this.containerId,this.actionUrl,A,this.options)
},onComplete:function(B,A){LOG.debug("AJAX response  complete - updateChoices");
if(!this.update.style.position||this.update.style.position=="absolute"){this.update.style.position="absolute";
RichFaces.Position.smartClone(this.element,this.update,this.options)
}this.updateChoices();
LOG.debug("Choices updated");
if(this.options.onajaxcomplete){this.options.onajaxcomplete(B,A)
}},create:function(D,B,F,C){if(!$(D)){return 
}var E="display:none;"+(C.popupStyle||"border:1px solid black;position:absolute; background-color:white;");
var A=C.popupClass?' class="'+C.popupClass+'" ':"";
new Insertion.Top($(D).ownerDocument.body,'<div id="'+B+'"'+A+' style="'+E+'"><table id="'+F+'" cellspacing="0" cellpadding="0"><tbody></tbody></table></div>')
}});
RichFaces.Position={source:null,target:null,smartClone:function(E,F,A){this.options=Object.extend({width:"auto"},A||{});
this.source=$(E);
this.target=$(F);
var B={};
var D=this.calcOffsets(this.source);
Element.setStyle(this.target,Object.extend({"left":D["x"]+"px","top":D["y"]+"px"},B));
if(A.iframeId){var C=$(A.iframeId);
Position.clone(this.target,C);
Element.setStyle(this.target,{zIndex:201});
Element.setStyle(C,{zIndex:200});
C.style.position="absolute";
C.style.top=this.target.style.top;
C.style.left=this.target.style.left;
C.style.width=this.target.style.width;
C.style.height=this.target.style.height
}},calcOffsets:function(C){var B=new Object(),A=0;
var F=C.offsetLeft;
var E=C.offsetTop;
for(var D=C.offsetParent;
D;
D=D.offsetParent){F+=D.offsetLeft;
E+=D.offsetTop
}B["x"]=F;
B["y"]=E+C.offsetHeight;
return B
},_removePx:function(A){A+="";
if(A.indexOf("px")!=-1){return A.substr(0,A.indexOf("px"))
}return A
},calcHeight:function(){return this.options.height=="auto"?"":this.options.height
},calcTop:function(B){var C=Position.cumulativeOffset(this.source);
var E=C[1];
var D=this.source.offsetHeight;
var A=this.getBody();
return E+D-1
},calcWidth:function(){if(this.options.width=="auto"){return""
}else{if(this.options.width.indexOf("%")>=0){var B=parseInt(this.options.width.substring(0,this.options.width.indexOf("%")));
var A=parseInt(this.source.offsetWidth)*B/100;
this.options.width=A+"px"
}return this.options.width
}},calcLeft:function(C){var E=Position.cumulativeOffset(this.source);
var F=E[0];
var B=this.source.offsetWidth;
var A=this.getBody();
var D=parseInt(F)+parseInt(B)+parseInt(C);
if(D<=parseInt(A.clientWidth)){return F
}else{return D
}},getBody:function(){return this.source.ownerDocument.body
}}

if(!window.RichFaces){window.RichFaces={}
}var RichFaces_FF_Loaded=(RichFaces.navigatorType()=="FF");
RichFaces.panelTabs={};
RichFaces.createImage=function(B){var A=new Image();
A.src=B;
return A
};
RichFaces.setLabelImages=function(A,B,C){A=$(A);
if(A){A._image=this.createImage(B);
A._mouseoverimage=this.createImage(C)
}};
RichFaces.isTabActive=function(A){var B=$(A);
if(B){return Element.hasClassName(B,"rich-tab-active")
}return false
};
RichFaces.switchTab=function(L,C,O){var A="_lbl";
var K="_cell";
var J="_shifted";
var F="";
var T=RichFaces.panelTabs[L];
var E;
var H=RichFaces_FF_Loaded;
if(T){for(var Q=0;
Q<T.length;
Q++){var B=T[Q];
var V=B.id;
var P=$(V+F);
var U=V+A;
var G=$(U);
var S=V+K;
var D=$(S);
var W=$(V+J);
if(V==C){if(P){Element.show(P)
}E=B;
if(!H){if(G){G.className=B.activeClass
}if(D){D.className=B.cellActiveClass
}}}else{if(P){Element.hide(P)
}if(G){G.className=B.inactiveClass
}if(D){D.className=B.cellInactiveClass
}if(W){W.style.top="0px"
}}}}if(H&&E){var R=$(E.id+A);
var D=$(E.id+K);
if(!R||!G||!D){return 
}var N=RichFaces.findNestingTable(R);
var I=N.parentNode;
var M=N.nextSibling;
I.removeChild(N);
R.className=E.activeClass;
I.insertBefore(N,M);
N=RichFaces.findNestingTable(D);
I=N.parentNode;
M=N.nextSibling;
I.removeChild(N);
D.className=E.cellActiveClass;
I.insertBefore(N,M)
}$(C+"_shifted").style.top="1px";
$(L+"_input").value=O
};
RichFaces.findNestingTable=function(B){var A=B.parentNode;
while(A&&A.nodeName.toLowerCase()!="table"){A=A.parentNode
}return A
};
RichFaces.overTab=function(A){if(RichFaces._shouldHoverTab(A)){Element.addClassName(A,"dr-tbpnl-tb-sel")
}};
RichFaces.outTab=function(A){if(RichFaces._shouldHoverTab(A)){Element.removeClassName(A,"dr-tbpnl-tb-sel")
}};
RichFaces._shouldHoverTab=function(A){return(A.className.indexOf("dr-tbpnl-tb-act")<0)
};
RichFaces.onTabChange=function(A,C,D){var H="_lbl";
var I=RichFaces.panelTabs[C];
var K,F;
if(I){for(var G=0;
G<I.length;
G++){if(K&&F){break
}var B=I[G].id;
if(B==D){F=I[G]
}if(RichFaces.isTabActive(B+H)){K=I[G]
}}}if(K&&F){if(K.ontableave&&K.ontableave!=""){var E=new Function("event","leftTabName","enteredTabName",K.ontableave);
var J=E(A,K.name,F.name);
if(typeof (J)=="boolean"&&!J){return false
}}if(F.ontabenter&&F.ontabenter!=""){var E=new Function("event","leftTabName","enteredTabName",F.ontabenter);
var J=E(A,K.name,F.name);
if(typeof (J)=="boolean"&&!J){return false
}}}return true
}

TogglePanel=Class.create();
TogglePanel.prototype={initialize:function(A,B,C){this.panelId=A;
this.divs=B;
this.currentId=C
},toggleToState:function(B){Element.hide(this.panelId+"_"+this.currentId);
var A;
if(B!=null){A=this.divs.indexOf(B);
this.currentId=this.divs[A]
}else{A=this.divs.indexOf(this.currentId);
if(this.divs.length==(A+1)){this.currentId=this.divs[0]
}else{this.currentId=this.divs[A+1]
}}Element.show(this.panelId+"_"+this.currentId);
$(this.panelId+"_input").value=this.currentId
}};
TogglePanelManager=Class.create();
TogglePanelManager.panels=$H($A({}));
TogglePanelManager.add=function(B){var A=new Object();
A[B.panelId]=B;
this.panels=this.panels.merge(A)
};
TogglePanelManager.toggleOnServer=function(D,B,E){var A=document.forms[D];
if(A==null){return 
}var C={};
C[B]=E;
_JSFFormSubmit(null,A,null,C);
return false
};
TogglePanelManager.toggleOnClient=function(A,B){this.panels.get(A).toggleToState(B);
return false
}

if(!window.Richfaces){window.Richfaces={}
}ToolTip=Class.create();
ToolTip.prototype={initialize:function(J,A,F,G,D,I,C,H,L,K,B){this["rich:destructor"]="destroy";
this.event=J.event;
this.onshow=new Function("event",J.onshow+";return true;");
this.oncomplete=new Function("event",J.oncomplete+";return true;");
this.onhide=new Function("event",J.onhide+";return true;");
this.delay=J.delay;
this.hideDelay=J.hideDelay;
this.id=A;
this.parentId=F;
this.mode=G;
this.direction=I;
this.disabled=D;
this.followMouse=C;
this.horizontalOffset=H;
this.verticalOffset=L;
this.ajaxExecuteString=K;
this.ajaxOptions=B;
this.clientAjaxParams={};
this.toolTip=$(A);
this.toolTip.component=this;
this.toolTipContent=$(A+"content");
this.toolTipDefaultContent=$(A+"defaultContent");
this.toolTip.style.visibility="hidden";
this.toolTip.style.display="block";
this.toolTipOffsetW=this.toolTip.offsetWidth;
this.toolTipOffsetH=this.toolTip.offsetHeight;
this.toolTipW=this.toolTip.getWidth();
this.toolTipH=this.toolTip.getHeight();
this.toolTipBorderHeight=(this.toolTipOffsetH-this.toolTipH)/2;
this.toolTipBorderWidth=(this.toolTipOffsetW-this.toolTipW)/2;
this.toolTip.style.visibility="visible";
this.toolTip.style.display="none";
this.parentAttached=false;
this.hintParentElement=null;
this.isMouseOvered=false;
if(Richfaces.browser.isIE6){var E=parseInt(this.toolTip.style.zIndex);
new Insertion.Before(this.toolTip,'<iframe src="javascript:\'\'" frameborder="0" scrolling="no" id="'+this.id+'iframe"style="position: absolute; width: '+this.toolTipOffsetW+"px; height: "+this.toolTipOffsetH+"px; display: none;background-color:black; z-index: "+ +(E-1)+';"></iframe>');
this.iframe=$(this.id+"iframe")
}this.attachOnLoadEventsListner=this.attachOnLoadEvents.bindAsEventListener(this);
this.setToolTipPositionListner=this.setToolTipPosition.bindAsEventListener(this);
if(this.hideDelay>0){this.doHideListner=this.customHideHandler.bindAsEventListener(this)
}else{this.doHideListner=this.doHide.bindAsEventListener(this)
}this.leaveToolTipListner=this.leaveToolTip.bindAsEventListener(this);
if(!this.disabled){Event.observe(document,"mousemove",this.attachOnLoadEventsListner,true)
}},destroy:function(){if(this.toolTip){this.toolTip.component=null
}if(!this.parentAttached){if(!this.disabled){Event.stopObserving(document,"mousemove",this.attachOnLoadEventsListner,true)
}}else{if(this.followMouse){Event.stopObserving(this.parent,"mousemove",this.setToolTipPositionListner,false)
}Event.stopObserving(this.parent,this.event,this.customEventHandlerListner,false);
Event.stopObserving(this.parent,"mouseout",this.doHideListner,false);
Event.stopObserving(this.toolTip,"mouseout",this.leaveToolTipListner,false)
}this.hintParentElement=null;
this.parent=null;
this.toolTip=null;
this.toolTipContent=null;
this.toolTipDefaultContent=null;
this.iframe=null;
this.eventCopy=null;
this.event=null
},attachOnLoadEvents:function(){if(!this.parentAttached){this.parent=$(this.parentId);
if(this.parent!=null&&!this.disabled){this.attachParentEvents();
this.parentAttached=true
}Event.stopObserving(document,"mousemove",this.attachOnLoadEventsListner,true)
}},customEventHandler:function(A){if(this.activationTimerHandle){return 
}this.eventCopy=A4J.AJAX.CloneObject(A,false);
this.activationTimerHandle=window.setTimeout(function(){this.doShow(this.eventCopy)
}.bindAsEventListener(this),this.delay)
},customHideHandler:function(A){if(this.hidingTimerHandle){return 
}this.eventCopy=A4J.AJAX.CloneObject(A,false);
this.hidingTimerHandle=window.setTimeout(function(){this.doHide(this.eventCopy)
}.bindAsEventListener(this),this.hideDelay)
},attachParentEvents:function(){if(this.followMouse){Event.observe(this.parent,"mousemove",this.setToolTipPositionListner,false)
}var A;
if(this.delay>0){this.customEventHandlerListner=this.customEventHandler.bindAsEventListener(this)
}else{this.customEventHandlerListner=this.doShow.bindAsEventListener(this)
}Event.observe(this.parent,this.event,this.customEventHandlerListner,false);
Event.observe(this.parent,"mouseout",this.doHideListner,false);
Event.observe(this.toolTip,"mouseout",this.leaveToolTipListner,false)
},detectAncestorNode:function(A,B){var C=A;
while(C!=null&&C!=B){C=C.parentNode
}return(C!=null)
},leaveToolTip:function(B){var A=false;
A=this.detectAncestorNode(B.toElement,this.hintParentElement);
A=A||this.detectAncestorNode(B.relatedTarget,this.hintParentElement);
if(!A){this.doHide(B);
this.isMouseOvered=false
}},doShow:function(e){this.setScrollDelta();
var needToShow=true;
var obj;
if(!e){var e=window.event
}var relTarg=e.relatedTarget||e.fromElement;
while(relTarg){if(relTarg==this.parent){needToShow=false;
break
}relTarg=relTarg.parentNode
}if(!needToShow){return 
}this.onshow(e);
this.isMouseOvered=true;
if(e.target){this.hintParentElement=e.target
}if(e.srcElement){this.hintParentElement=e.srcElement
}if(this.mode=="ajax"){if(this.toolTipDefaultContent){this.toolTipContent.innerHTML=this.toolTipDefaultContent.innerHTML;
this.toolTip.style.visibility="hidden";
this.toolTip.style.display="block";
this.setToolTipPosition(e);
this.setToolTipVisible(false)
}var event=e;
var ajaxOptions=this.ajaxOptions;
if(this.clientAjaxParams){if(e.clientX){this.clientAjaxParams["clientX"]=e.clientX;
this.clientAjaxParams["clientY"]=e.clientY
}else{this.clientAjaxParams["event.pageX"]=e.pageX;
this.clientAjaxParams["event.pageY"]=e.pageY
}Object.extend(ajaxOptions["parameters"],this.clientAjaxParams)
}eval(this.ajaxExecuteString)
}else{this.setToolTipPosition(e);
this.displayDiv()
}},doHide:function(C){var B=true;
if(!C){var C=window.event
}var A=C.relatedTarget||C.toElement;
while(A){if(A==this.parent){B=false;
break
}A=A.parentNode
}if(!B){return 
}if(this.activationTimerHandle){window.clearTimeout(this.activationTimerHandle);
this.activationTimerHandle=undefined
}var D=false;
D=this.detectAncestorNode(C.toElement,this.toolTip);
D=D||this.detectAncestorNode(C.relatedTarget,this.toolTip);
if(!D){this.isMouseOvered=false;
this.toolTip.style.visibility="hidden";
this.toolTip.style.display="none";
if(this.iframe){this.iframe.style.display="none"
}this.hintParentElement=null;
this.isMouseOvered=false;
this.onhide(C)
}if(this.hidingTimerHandle){window.clearTimeout(this.hidingTimerHandle);
this.hidingTimerHandle=undefined
}this.scrollDelta=undefined
},doEnable:function(){this.disabled=false
},doDisable:function(){this.disabled=true
},show:function(A){this.doShow(A)
},hide:function(A){this.doHide(A)
},enable:function(A){this.doEnable(A)
},disable:function(A){this.doDisable(A)
},setScrollDelta:function(){if(!this.scrollDelta){this.scrollDelta=[0,0]
}var A=this.parent;
while(A&&!/^body$/i.test(A.tagName)){if(/^absolute$/i.test(Richfaces.getComputedStyle(A,"position"))){if(A.scrollLeft){this.scrollDelta[0]=A.scrollLeft
}if(A.scrollTop){this.scrollDelta[1]=A.scrollTop
}}A=A.parentNode
}},setToolTipPosition:function(H){var B=0;
var A=0;
var L=Event.pointerX(H);
var J=Event.pointerY(H);
var M=Richfaces.Position.getOffsetDimensions(this.toolTip);
var G=this.toolTip.style.display;
var E=this.toolTip.style.visibility;
this.toolTip.style.visibility="hidden";
this.toolTip.style.display="block";
this.toolTip.style.top="0px";
this.toolTip.style.left="0px";
var C=Position.cumulativeOffset(this.toolTip);
this.toolTip.style.visibility=E;
this.toolTip.style.display=G;
C[0]-=this.toolTip.offsetLeft||0;
C[1]-=this.toolTip.offsetTop||0;
B=L-C[0];
A=J-C[1];
var D=/^(top|bottom)-(left|right)$/;
var F=this.direction.match(D);
var N=F[2];
var I=F[1];
this.prePosition({"x":B,"y":A},M,N,I,{"x":this.horizontalOffset,"y":this.verticalOffset});
var K=this.fitToolTip(H.clientX,H.clientY,{"x":B,"y":A},M,N,I,{"x":this.horizontalOffset,"y":this.verticalOffset});
if(this.scrollDelta){K.x+=this.scrollDelta[0];
K.y+=this.scrollDelta[1]
}Element.setStyle(this.toolTip,{"left":K.x+"px","top":K.y+"px"});
if(this.iframe){this.iframe.style.top=(K.y-this.toolTipBorderHeight)+"px";
this.iframe.style.left=(K.x-this.toolTipBorderWidth)+"px"
}this.eventCopy=A4J.AJAX.CloneObject(H,false)
},prePosition:function(E,D,G,B,F){var C,A;
C=G=="left"?E.x-D.width-F.x:E.x+=F.x;
A=B=="top"?E.y-D.height-F.y:E.y+F.y;
return{"x":C,"y":A}
},fitToolTip:function(D,C,B,P,Q,M,H){var F=Richfaces.Position.getWindowDimensions();
var K=D-H.x-P.width;
var L=F.width-(D+H.x+P.width);
var G=C-H.y-P.height;
var A=F.height-(C+H.y+P.height);
if(K<0){this.prePosition({"x":B.x,"y":B.y},P,"right",M,H);
var J=F.width-(D+H.x+P.width);
if(J>0){Q="right"
}else{if(J>K){Q="right"
}}}else{if(L<0){this.prePosition({"x":B.x,"y":B.y},P,"left",M,H);
var I=D-H.x-P.width;
if(I>0){Q="left"
}else{if(I>L){Q="left"
}}}}if(G<0){this.prePosition({"x":B.x,"y":B.y},P,Q,"bottom",H);
var N=F.height-(C+H.y+P.height);
if(N>0){M="bottom"
}else{if(N>G){M="bottom"
}}}else{if(A<0){this.prePosition({"x":B.x,"y":B.y},P,Q,"top",H);
var E=C-H.y-P.height;
if(E>0){M="top"
}else{if(E>A){M="top"
}}}}var O=this.prePosition({"x":B.x,"y":B.y},P,Q,M,H);
return O
},displayDiv:function(){if(this.isMouseOvered){if(this.mode=="ajax"){this.toolTip.style.display="none";
if(this.clientAjaxParams){var B;
if(this.clientAjaxParams.clientX){B="clientX"
}else{B="pageX"
}var A;
if(this.clientAjaxParams.clientY){A="clientY"
}else{A="pageY"
}var C={};
C[B]=this.clientAjaxParams[B];
C[A]=this.clientAjaxParams[A];
this.toolTip.style.visibility="hidden";
this.toolTip.style.display="block";
this.setToolTipPosition((this.eventCopy?this.eventCopy:C))
}}this.setToolTipVisible(true)
}},setToolTipVisible:function(A){this.activationTimerHandle=undefined;
this.toolTip.style.display="block";
this.toolTip.style.visibility="visible";
if(this.iframe){this.iframe.style.display="block"
}if(A){this.oncomplete(window.event)
}}}

