(function(){Date.patterns.jControlsDate="d.m.Y";Date.patterns.jControlsTime="H:i:s";Date.patterns.jControlsTimeShort="H:i";Date.patterns.jControlsDateTime="d.m.Y H:i:s";Date.patterns.jControlsDateTimeShort="d.m.Y H:i";var REQUIRED_PROTOTYPE='1.6.0';var REQUIRED_PROTOTYPE_EXTENDED='1.0.1';var REQUIRED_SCRIPTACULOUS='1.8.2';var idCounter=0;var containers=$A([]);var loaded=false;var DATATYPES=["number","time","date","datetime","string","ascii"];var ONCLICK_IGNORE_ELEMENTTAG=["OPTION","INPUT","TEXTAREA","SELECT","BUTTON","IMG"];var xTypes={Button:"button",Container:"container",Control:"control",Grid:"grid",Layer:"layer",Loading:"loading",PageList:"pagelist",Select:"select",Tree:"tree",NestedSetContainer:"nestedSet",Calendar:"calendar",unkown:undefined};var convertVersionString=function(versionString){var r=versionString.split('.');return parseInt(r[0])*100000+parseInt(r[1])*1000+parseInt(r[2])};if(typeof Prototype=="undefined"||typeof Element=="undefined"||typeof Element.Methods=="undefined"||convertVersionString(Prototype.Version)<convertVersionString(REQUIRED_PROTOTYPE)){throw("jControls requires the Prototype JavaScript framework >= "+REQUIRED_PROTOTYPE);}if(typeof Scriptaculous=="undefined"||convertVersionString(Scriptaculous.Version)<convertVersionString(REQUIRED_SCRIPTACULOUS)){throw("jControls requires the Prototype JavaScript framework >= "+REQUIRED_PROTOTYPE);}if(typeof Prototype.VersionExtended=="undefined"||convertVersionString(Prototype.VersionExtended)<convertVersionString(REQUIRED_PROTOTYPE_EXTENDED)){throw("jControls requires the Prototype Extended JavaScript framework >= "+REQUIRED_PROTOTYPE_EXTENDED);}var autoload=function(fn){if(!loaded){document.observe("dom:loaded",function(){loaded=true;fn()})}else{fn.bind(window)()}};autoload(Prototype.emptyFunction);var convertToDataType=function(value,dataType){if(!Object.isString(value)){value=String(value)}switch((dataType||"string").toLowerCase()){case"number":return value.strip().toNumber(jControls.FORMAT.NUMBER_DEC_POINT,jControls.FORMAT.NUMBER_THOUSANDS_SEP);break;case"date":return Date.parseDate(value).getTime();break;case"time":return Date.parseDate(value).getTime();break;case"datetime":return Date.parseDate(value).getTime();break;case"ascii":return value;break;case"string":default:return value.toLowerCase();break}};var getId=function(){idCounter++;return"jControl"+idCounter};var register=function(container){containers.push(container);return containers};var unregister=function(container){containers=containers.findAll(function(c){return c!=container})};window.jControls={Version:'1.1.0',FORMAT:{NUMBER_DEC_POINT:".",NUMBER_THOUSANDS_SEP:","},url:{css:"",img:"",imgS:""},xType:"jcontrol",$:function(element){var container=$(element);if(!container&&Object.isString(element)){container=containers.find(function(c){return c.id==element})}else if(container&&!Object.isUndefined(container._jControl)){container=container._jControl}else if(container&&Object.isUndefined(container._jControl)){container=null}return(container?container:null)},$d:function(notice){if(Prototype.Browser.isFF){console.info(notice)}else if(Prototype.Browser.isSafari){console.log(notice)}else if(Prototype.Browser.isOpera){opera.postError(notice)}else if(Prototype.Browser.isIE8&&window.console){if(typeof notice=="object"){console.log(Object.toJSON(notice))}else{console.log(notice)}}else{if(!loaded){autoload(function(){jControls.$d(notice)});return}if(!$("jControls_console")){Element.insert(document.body,{top:"<div id='jControls_console' style='position:absolute;left:0px;height:150px;width:100%;bottom:0px;z-index:100000;overflow:auto;overflow-x:hidden;overflow-y:auto;border-top:1px solid #A06060;background-color:#FFD0D0;font-size:10px;font-family:tahoma,arial,helvetica,sans-serif;'>"+"<div style='font-weight:bold;padding:1px;margin-bottom: 2px;border-bottom:1px solid #858484;'>Console</div>"+"</div>"})}$("jControls_console").insertBottom(Object.toHTML(notice)+"<br />")}}};jControls.url.css=$A(document.getElementsByTagName("link")).find(function(s){return(s.rel&&s.rel=="stylesheet"&&s.type&&s.type=="text/css"&&s.href&&s.href.match(/jControls\.css(\?.*)?$/))}).href.replace(/jControls\.css(\?.*)?$/,'');jControls.url.img=jControls.url.css+"images/";jControls.url.imgS=jControls.url.img+"s.gif";var cookies=null;var loadCookies=function(){cookies=new Array();var c=document.cookie+";";var re=/\s?(.*?)=(.*?);/g;var matches;while((matches=re.exec(c))!=null){var name=matches[1];var value=matches[2];if(name&&name.startsWith("jcontrols-")){cookies.push(new jControls.Cookies.Cookie({name:name.substr("jcontrols-".length),value:value}))}}return cookies};jControls.Cookies=function(name){if(cookies==null)loadCookies();var r=cookies.find(function(cookie){return cookie.name==name});if(!r){r=new jControls.Cookies.Cookie({name:name,value:Object.toJSON(null)});cookies.push(r)}return r};jControls.Cookies.Cookie=Class.create({domain:null,expires:new Date((new Date()).getTime()+7*24*60*60*1000),name:null,path:"/",secure:false,value:null,initialize:function(options){this.name=options.name;this.value=this.decodeValue(options.value)},decodeValue:function(value){try{return value.evalJSON(true)}catch(e){return null}},encodeValue:function(){return Object.toJSON(this.value)},get:function(){return this.value},set:function(value){if(typeof value=="undefined"||value===null){this.value=null;this.clear(this.name);return}this.value=value;this.save();return this},save:function(){document.cookie="jcontrols-"+this.name+"="+this.encodeValue(this.value)+(this.expires==null?"":"; expires="+this.expires.toGMTString())+(this.path==null?"":"; path="+this.path)+(this.domain==null?"":"; domain="+this.domain)+(this.secure==false?"":"; secure")},clear:function(){document.cookie="jcontrols-"+this.name+"=null; expires=Thu, 01-Jan-70 00:00:01 GMT"+(this.path==null?"":"; path="+this.path)+(this.domain==null?"":"; domain="+this.domain)+(this.secure==false?"":"; secure")}});jControls.Ajax={FUNCTION:{REQUEST:function(url,options){return new Ajax.Request(url,options)}},DEFAULT:{OPTIONS:{url:"/",method:"post",loader:true},PARAMETERS:{ajax:1,jControls:1}},Request:function(jControl,options){options=Object.extend(options||{},jControls.Ajax.DEFAULT.OPTIONS);if(Object.isString(options.parameters)){options.parameters=options.parameters.toQueryParams()}options.parameters=Object.extend(options.parameters||{},jControls.Ajax.DEFAULT.PARAMETERS);var on={create:options.onCreate||Prototype.emptyFunction,complete:options.onComplete||Prototype.emptyFunction,success:options.onSuccess||Prototype.emptyFunction};Object.extend(options||{},{onCreate:function(transport){if(options.loader){if(!jControl._jcLoading){jControl._jcLoading=new jControls.Loading({renderTo:jControl.dom})}jControl._jcLoading.show()}on.create(transport)},onComplete:function(transport){on.complete(transport);if(jControl._jcLoading){jControl._jcLoading.hide()}},onSuccess:function(transport){if(typeof transport.responseJSON!="undefined"){on.success(transport.responseJSON)}else{on.success(transport)}}});return jControls.Ajax.FUNCTION.REQUEST(options.url,options)}};jControls.Container=Class.create({_insertFn:function(renderTo,element){Element.insert(renderTo,{bottom:element})},dom:null,id:null,options:null,rendered:false,xType:xTypes.unkown,_domHeightOrg:"",applyTo:function(applyTo){this._insertFn=function(renderTo,element){renderTo.removeChildrens();renderTo.innerHTML="";Element.insert(renderTo,{bottom:element})};return this.render(applyTo)},initialize:function(options){if(!this.xType){this.xType=jControls.Container.xType}this.options=options;this.id=(typeof this.options.id!="undefined"?this.options.id:getId());if(this.options.applyTo){this.applyTo(this.options.applyTo)}else if(this.options.renderAfter){this.renderAfter(this.options.renderAfter)}else if(this.options.renderTop){this.renderTop(this.options.renderTop)}else if(this.options.renderReplace){this.renderReplace(this.options.renderReplace)}else if(this.options.renderTo){this.render(this.options.renderTo)}},remove:function(){this.dom.remove();this.dom._jControl=undefined},render:function(renderTo){if(this.rendered){return this}renderTo=$(renderTo);renderTo=renderTo&&renderTo.nodeType==1?renderTo:renderTo.dom;this.dom=$(document.createElement(this.options.type?this.options.type.toUpperCase():"DIV"));this.dom._jControl=this;this.dom.id=this.id;this.dom.addClass("jcContainer jcxType-"+this.xType+" "+(this.options.cls||""));if(this.options.qtip){this.dom.title=this.options.qtip}if(this.options.html){this.dom.innerHTML=this.options.html}if(this.options.attributes){this.dom.writeAttribute(this.options.attributes)}if(this.options.style){this.dom.setStyle(this.options.style)}if(this.options.listeners){this.dom.on(this.options.listeners)}this._insertFn(renderTo,this.dom);if(Prototype.Browser.isIE){this._domHeightOrg=this.dom.currentStyle["height"];if(this._domHeightOrg=="auto"){this._domHeightOrg="0px"}}else{this._domHeightOrg=this.dom.getStyle("height")}this.rendered=true;return this},renderAfter:function(renderAfter){this._insertFn=function(renderTo,element){Element.insert(renderTo,{after:element})};return this.render(renderAfter)},renderReplace:function(renderReplace){this._insertFn=function(renderTo,element){Element.insert(renderTo,{after:element});Element.remove(renderTo)};return this.render(renderReplace)},renderTo:function(renderTo){this._insertFn=function(renderTo,element){Element.insert(renderTo,{bottom:element})};return this.render(renderTo)},renderTop:function(renderTop){this._insertFn=function(renderTo,element){Element.insert(renderTo,{top:element})};return this.render(renderTop)}});jControls.Container.xType=xTypes.Container;jControls.Layer=Class.create(jControls.Container,{hide:function(){var finishFn=(function(){this.dom.hide();this.dom.setOpacity(0);if(Prototype.Browser.isIE6){$$("select.layer-hide-ie6").invoke("setVisible",true)}}).bind(this);if(this.effect&&this.effect.cancel){this.effect.cancel()}if(this.content){this.effect=new Effect.Parallel([new Effect.Fade(this.dom,{to:0,sync:true,afterFinish:finishFn}),new Effect.Fade(this.content,{to:0,sync:true,afterFinish:(function(){this.content.setOpacity(0)}).bind(this)})],{duration:0.5})}else{this.effect=new Effect.Fade(this.dom,{duration:0.5,to:0,afterFinish:finishFn})}return this},initialize:function($super,options){if(!this.xType){this.xType=jControls.Layer.xType}options.opacity=!Object.isUndefined(options.opacity)?options.opacity:0.8;if(this.listeners==null){this.listeners=options.listeners||{}}this.content=$(options.content);options.contentPosition=options.contentPosition||"centerUp";$super(options)},render:function($super,renderTo){if(this.rendered){return this}renderTo=$(renderTo);renderTo=renderTo&&renderTo.nodeType==1?renderTo:renderTo.dom;this.options.style=this.options.style||{};this.options.style.display="none";$super(document.body);this.dom.addClass("jcLayer"+(Prototype.Browser.isIE6?" jIE6":""));this.dom.setOpacity(0);if(this.content){this.content.hide().setOpacity(0)}if(renderTo==document.body){this.sizes=this.sizes.bind(this,document);if(!Prototype.Browser.isIE6){this.dom.setStyle({position:"fixed"});if(this.content){this.content.setStyle({position:"fixed"})}}else{Event.observe(document,"scroll",this.sizes)}Event.observe(document,"resize",this.sizes)}else{this.sizes=this.sizes.bind(this,renderTo);Event.observe(renderTo,"resize",this.sizes);Event.observe(document,"scroll",this.sizes)}return this},show:function(){if(this.listeners.onBeforeShow&&this.listeners.onBeforeShow(this)===false){return this}if(Prototype.Browser.isIE6){$$("select").each(function(element){if(element.isDisplayed()){element.addClass("layer-hide-ie6").setVisible(false)}})}if(this.effect&&this.effect.cancel){this.effect.cancel()}this.dom.show();if(this.content){this.content.show()}this.sizes();if(this.content){this.effect=new Effect.Parallel([new Effect.Appear(this.dom,{to:this.options.opacity,sync:true}),new Effect.Appear(this.content,{to:1,sync:true})],{duration:0.5,afterFinish:(function(){if(this.listeners.onAfterShow){this.listeners.onAfterShow(this)}}).bind(this)})}else{this.effect=new Effect.Appear(this.dom,{duration:0.5,to:this.options.opacity,afterFinish:(function(){if(this.listeners.onAfterShow){this.listeners.onAfterShow(this)}}).bind(this)})}return this},sizes:function(element){if(!this.rendered){return this}var scrollOffset=document.viewport.getScrollOffsets();var viewport=document.viewport.getDimensions();var contentBox=null;if(this.content){contentBox=this.content.getSize()}viewport.x=scrollOffset.left;viewport.y=scrollOffset.top;viewport.right=viewport.x+viewport.width;viewport.bottom=viewport.y+viewport.height;if(element==document){this.dom.setStyle({width:viewport.width+"px",height:viewport.height+"px"});if(this.content&&this.options.contentPosition!="none"){this.content.setStyle({left:(viewport.width/2-contentBox.width/2)+"px",top:(viewport.height/2-contentBox.height/(this.options.contentPosition=="center"?2:1))+"px"})}}else{var elementBox=element.getBox();this.dom.setBox(elementBox);if(this.content&&this.options.contentPosition!="none"){var left=(elementBox.width/2-contentBox.width/2);var top=(elementBox.height/2-contentBox.height/2);if(!((viewport.x<=elementBox.x&&viewport.y<=elementBox.y&&elementBox.right<=viewport.right&&elementBox.bottom<=viewport.bottom)||(viewport.right<elementBox.x&&viewport.bottom<elementBox.y)||(elementBox.right<viewport.x&&elementBox.bottom<viewport.y))){elementBox.left=viewport.x<elementBox.x?elementBox.x:viewport.x;elementBox.top=viewport.y<elementBox.y?elementBox.y:viewport.y;elementBox.right=elementBox.right<viewport.right?elementBox.right:viewport.right;elementBox.bottom=elementBox.bottom<viewport.bottom?elementBox.bottom:viewport.bottom;left=(elementBox.left-elementBox.x+(elementBox.right-elementBox.left)/2-contentBox.width/2);top=(elementBox.top-elementBox.y+(elementBox.bottom-elementBox.top)/2-contentBox.height/2);if(left<0){left=0}else if(left+contentBox.width>elementBox.width){left=elementBox.width-contentBox.width}if(top<0){top=0}else if(top+contentBox.height>elementBox.height){top=elementBox.height-contentBox.height}}this.content.setStyle({left:(elementBox.x+left)+"px",top:(elementBox.y+top)+"px"})}}return this}});jControls.Layer.xType=xTypes.Layer;jControls.Loading=Class.create(jControls.Container,{layer:null,opacityMax:0.8,text:null,hide:function(){this.layer.hide();return this},initialize:function($super,options){if(!this.xType){this.xType=jControls.Loading.xType}options.text=options.text||jControls.Loading.DEFAULTTEXT;this.opacityMax=options.opacityMax||this.opacityMax;$super(options)},render:function($super,renderTo){var effect=null;if(this.rendered){return this}renderTo=$(renderTo);renderTo=renderTo&&renderTo.nodeType==1?renderTo:renderTo.dom;this.options.style=this.options.style||{};this.options.listeners=this.options.listeners||{};this.options.style.display="none";$super(document.body);this.dom.addClass("jcLoading jcLoading-info"+(Prototype.Browser.isIE6?" IE6":""));Element.insert(this.dom,{bottom:"<div class='jcLoading-background-ml'>"+"<div class='jcLoading-background-mr'>"+"<div class='jcLoading-background-mc'>"+"<div class='jcLoading-animation'></div>"+"<div class='jcLoading-text'>"+this.options.text+"</div>"+"</div>"+"</div>"+"</div>"});this.text=this.dom.down(".jcLoading-text");this.layer=new jControls.Layer({renderTo:renderTo,opacity:this.opacityMax,content:this.dom,listeners:this.options.listeners});return this},setText:function(text){this.dom.clearStyle("width");this.text.innerHTML=text;this.layer.sizes();return this},show:function(text){if(this.text){this.setText(text||this.options.text||jControls.Loading.DEFAULTTEXT)}this.layer.show();return this}});jControls.Loading.xType=xTypes.Loading;jControls.Loading.DEFAULTTEXT="Please wait...";jControls.Control=Class.create(jControls.Container,{closeable:false,collapsable:false,collapsed:false,enabled:true,enterable:true,expanded:true,html:"",initialized:false,inputContainer:null,listeners:null,moveable:false,name:null,pinable:false,pinned:true,title:null,value:null,collapse:function(){if(!this.rendered||this.collapsed||!this.collapsable||(this.listeners.onBeforeCollapse&&this.listeners.onBeforeCollapse(this)===false)){return this}var style=this.dom.readAttribute("style");this.dom._expandHeightClear=(style!=null&&style.indexOf("height")!=-1?false:true);this.dom._expandHeight=this.dom.getStyle("height");new Effect.Morph(this.dom,{duration:0.4,style:{height:this.dom.down(".jcControl-panel").getHeight()+"px"},afterFinish:(function(){if(this.listeners.onAfterCollapse){this.listeners.onAfterCollapse.defer(this)}}).bind(this)});this.collapsed=true;this.expanded=false;this.setCookie();var btnNode=this.dom.down(".jcTool-button-collapsable");if(btnNode.hasClassName("jcTool-collapse-north")){btnNode.removeClass("jcTool-collapse-north").addClass("jcTool-expand-north")}return this},expand:function(){if(!this.rendered||this.expanded||!this.collapsable||!this.dom._expandHeight||(this.listeners.onBeforeExpand&&this.listeners.onBeforeExpand(this)===false)){return this}new Effect.Morph(this.dom,{duration:0.4,style:{height:this.dom._expandHeight},afterFinish:(function(){if(this.dom._expandHeightClear){this.dom.clearStyle("height")}if(this.listeners.onAfterExpand){this.listeners.onAfterExpand.defer(this)}}).bind(this)});this.collapsed=false;this.expanded=true;this.setCookie();var btnNode=this.dom.down(".jcTool-button-collapsable");if(btnNode.hasClassName("jcTool-expand-north")){btnNode.removeClass("jcTool-expand-north").addClass("jcTool-collapse-north")}return this},getCookie:function(options){var cookie=jControls.Cookies(this.id).get()||{};if(typeof cookie.expanded!="undefined"){cookie.expanded=(this.collapsable?cookie.expanded:undefined)}if(typeof cookie.pinned!="undefined"){cookie.pinned=this.pinned}return cookie},getValue:function(){return this.value},initialize:function($super,options){if(!this.xType){this.xType=jControls.Control.xType}if(this.listeners==null){this.listeners=options.listeners||{}}register(this);if(this.listeners.onMouseOver){options.listeners.mouseover={scope:this,fn:function(e){if(this.dom._pe){this.dom._pe.stop()}this.dom._pe=new PeriodicalExecuter((function(){var node=this.dom;node._pe.stop();this.listeners.onMouseOver(this)}).bind(this),0.1)}}}if(this.listeners.onMouseOut){options.listeners.mouseout={scope:this,fn:function(e){if(this.dom._pe){this.dom._pe.stop()}this.dom._pe=new PeriodicalExecuter((function(){var node=this.dom;node._pe.stop();this.listeners.onMouseOut(this)}).bind(this),0.1)}}}if(this.listeners.onMouseMove){options.listeners.mousemove={scope:this,fn:function(e){this.listeners.onMouseMove(e,this)}}}if(this.listeners.onBeforeClick||this.listeners.onAfterClick){options.listeners.click={scope:this,fn:function(e){if(this.listeners.onBeforeClick&&this.listeners.onBeforeClick(this)===false){return}if(this.listeners.onAfterClick){this.listeners.onAfterClick.defer(this)}}}}this.name=options.name||this.id;options.name=undefined;if(this.html==""){this.html=options.html||"";options.html=undefined}if(typeof options.enabled!="undefined"){this.enabled=options.enabled}if(typeof options.enterable!="undefined"){this.enterable=options.enterable}if(typeof options.closeable!="undefined"){this.closeable=options.closeable}if(typeof options.collapsable!="undefined"){this.collapsable=options.collapsable}else if(typeof options.expanded!="undefined"||typeof options.collapsed!="undefined"){this.collapsable=true}if(typeof options.moveable!="undefined"){this.moveable=options.moveable}if(typeof options.pinable!="undefined"){this.pinable=options.pinable}if(typeof options.pinned!="undefined"){this.pinned=options.pinned}if(typeof options.expanded!="undefined"&&typeof options.collapsed=="undefined"){options.collapsed=!options.expanded}else if(typeof options.expanded=="undefined"&&typeof options.collapsed!="undefined"){options.expanded=!options.collapsed}if(!Object.isUndefined(options.expanded)){this.expanded=options.expanded}if(!Object.isUndefined(options.collapsed)){this.collapsed=options.collapsed}if(this.collapsable&&this.expanded==this.collapsed){this.expanded=true;this.collapsed=false}if(Object.isUndefined(options.forceCollapsedState)){options.forceCollapsedState=false}this.title=options.title||this.title;if(!this.moveable&&this.pinnable){this.pinnable=false}$super(options);if(options.value){this.setValue.bind(this).defer(options.value,false)}this.initialized=true},pin:function(state){this.pinned=state;var btnNode=this.dom.down(".jcTool-button-pin");if(this.pinned&&btnNode.hasClassName("jcTool-pin-off")){btnNode.removeClass("jcTool-pin-off").addClass("jcTool-pin-on")}else if(!this.pinned&&btnNode.hasClassName("jcTool-pin-on")){btnNode.removeClass("jcTool-pin-on").addClass("jcTool-pin-off")}if(!this._scrollObserved){this._scrollObserved=true;this._scrollSO=this.getCookie().scrollSO||null;Event.observe(document,"scroll",(function(element,so){if(!this.pinned){return}var xy=this.dom.getXY();if(this._scrollSO){xy[0]-=this._scrollSO.left;xy[1]-=this._scrollSO.top}xy[0]+=so.left;xy[1]+=so.top;this._scrollSO=Object.clone(so);this.dom.setXY(xy);this.setCookie()}).bind(this));$(document).fire("scroll")}this.setCookie();return this},remove:function($super){unregister(this);$super()},render:function($super,renderTo){var cookie;var html="";if(this.rendered){return this}cookie=this.getCookie();if(typeof cookie.expanded!="undefined"&&this.options.forceCollapsedState==false){this.expanded=cookie.expanded;this.collapsed=!cookie.expanded}if(this.xType==jControls.Control.xType&&this.listeners.onBeforeRender&&this.listeners.onBeforeRender(this)===false){return this}$super(renderTo);this.dom.addClass("jcControl");if(!this.enabled){this.dom.addClass("jcControl-disabled")}if(this.title||this.collapsable||this.moveable||this.pinnable){var hasBtn=this.collapsable||this.closeable||this.pinnable;html="<div class='jcControl-panel jcControl-panel-top"+(this.moveable?" jcCursorMove":"")+"'>"+"<span class='jcControl-title' style='width:"+(hasBtn?"auto":"100%")+";'>"+(this.title||"")+"</span>"+(this.closeable?"<div class='jcTool jcTool-button-close jcTool-close' title='"+jControls.Button.TITLE.CLOSE+"'></div>":"")+(this.collapsable?"<div class='jcTool jcTool-button-collapsable jcTool-"+(!this.collapsed?"collapse":"expand")+"-north' title='"+jControls.Button.TITLE.EXPANDCOLLAPSE+"'></div>":"")+(this.pinable?"<div class='jcTool jcTool-button-pin jcTool-pin-"+(this.pinned?"on":"off")+"' title='"+jControls.Button.TITLE.PINNED+"'></div>":"")+(!hasBtn&&Prototype.Browser.isIE?"<div class='jcWidthFull'>&#160;</div>":"")+"<div class='jcClear'></div>"+"</div>"}if(html+this.html!=""){Element.insert(this.dom,{bottom:html+this.html})}if(this.collapsable){(function(){Element.observe(this.dom.down(".jcTool-button-collapsable"),"click",(function(e){var btnNode=this.dom.down(".jcTool-button-collapsable");if(!this.collapsed&&btnNode.hasClassName("jcTool-collapse-north")){this.collapse()}else if(!this.expanded&&btnNode.hasClassName("jcTool-expand-north")){this.expand()}}).bindAsEventListener(this));if(this.collapsed){var style=this.dom.readAttribute("style");this.dom._expandHeightClear=(style!=null&&style.indexOf("height")!=-1?false:true);this.dom._expandHeight=this.dom.getStyle("height");this.dom.setHeight(this.dom.down(".jcControl-panel").getHeight())}}).bind(this).defer()}if(this.closeable&&this.listeners.onClose){(function(){Element.observe(this.dom.down(".jcTool-close"),"click",this.listeners.onClose.curry(this))}).bind(this).defer()}if(this.moveable){(function(){var posMouseOld=null;var posDomBefore=null;var moveXY=this.getCookie().moveXY;if(moveXY){this.dom.setXY(moveXY)}var fn=(function(e){if(posMouseOld==null||!e.isLeftClick()){return}var posDom=this.dom.getBox();var posDomOld=Object.clone(posDom);var posMouse=e.pointer();var viewport=document.viewport.getDimensions();var scrollOffsets=document.viewport.getScrollOffsets();posDom.x=posDom.x+posMouse.x-posMouseOld.x;posDom.y=posDom.y+posMouse.y-posMouseOld.y;if(posDom.x<0){posDom.x=0}if(posDom.y<0){posDom.y=0}if(posDom.x>viewport.width+scrollOffsets.left-posDom.width){posDom.x=viewport.width+scrollOffsets.left-posDom.width}if(posDom.y>viewport.height+scrollOffsets.top-posDom.height){posDom.y=viewport.height+scrollOffsets.top-posDom.height}if(this.listeners.onMove&&this.listeners.onMove(this,posDom,posDomOld)===false){return}this.dom.setXY(posDom);posMouseOld=e.pointer()}).bindAsEventListener(this);Element.observe(this.dom.down(".jcControl-panel-top"),"mousedown",(function(e){if(!e.isLeftClick()){return}if(this.listeners.onBeforeMove&&this.listeners.onBeforeMove(this)===false){return}posMouseOld=e.pointer();posDomBefore=this.dom.getBox();Element.observe(document,"mousemove",fn)}).bindAsEventListener(this));Element.observe(this.dom.down(".jcControl-panel-top"),"mouseup",(function(e){posMouseOld=null;Element.stopObserving(document,"mousemove",fn);if(this.listeners.onAfterMove){this.listeners.onAfterMove(this,this.dom.getBox(),posDomBefore)}this._moveXY=this.dom.getXY();this.setCookie()}).bindAsEventListener(this))}).bind(this).defer()}if(this.pinable){(function(){Element.observe(this.dom.down(".jcTool-button-pin"),"click",(function(e){this.pin(!this.pinned)}).bindAsEventListener(this));if(this.pinned){this.pin.bind(this).defer(this.pinned)}}).bind(this).defer()}if(this.options.buttons){var buttonFn=function(ctl,buttons){buttons.each(function(button){new jControls.Button(Object.extend(button||{},{renderTo:ctl}))})};if(this.xType==jControls.PageList.xType){buttonFn(this,this.options.buttons)}else if(!this.pagelist){this.toolbarBottom=new jControls.Control({cls:"jcControl-panel jcControl-panel-bottom jcToolbar",listeners:{onAfterRender:(function(ctl){buttonFn(ctl,this.options.buttons)}).bind(this)}});this.toolbarBottom.render.bind(this.toolbarBottom).defer(this)}else if(this.pagelist){this.pagelist.listeners.onAfterRender=(this.pagelist.listeners.onAfterRender||Prototype.emptyFunction).wrap(function(proceed,ctl){buttonFn(ctl,this.options.buttons);return proceed(ctl)}).bind(this)}}if(this.xType==jControls.Control.xType&&this.listeners.onAfterRender){this.listeners.onAfterRender.defer(this)}return this},renderValue:function(oldValue,newValue){},setCookie:function(options){jControls.Cookies(this.id).set(Object.extend(options||{},{expanded:(this.collapsable?this.expanded:undefined),pinned:this.pinned,moveXY:this._moveXY,scrollSO:this._scrollSO}));return this},setEnabled:function(state){if(this.enabled!=state){this.enabled=state;this.dom.removeClass("jcControl-disabled");if(!this.enabled){this.dom.addClass("jcControl-disabled")}if(this.listeners.onEnableStateChange){this.listeners.onEnableStateChange.defer(this,state)}}return this},setEnterable:function(state){if(this.enterable!=state){this.enterable=state}return this},setTitle:function(newTitle){this.dom.down(".jcControl-title").innerHTML=newTitle;this.title=newTitle},setValue:function(value,initialized){if(this.value==value){return this}if(typeof initialized=="undefined"){initialized=this.initialized}if(this.listeners.onBeforeChange&&this.listeners.onBeforeChange(this,this.value,value,initialized)===false){return this}var oldValue=this.value;this.value=value;if(this.inputContainer){if(value!=null&&!Object.isUndefined(value)){this.inputContainer.writeAttribute("value",value);this.inputContainer.value=value}else{this.inputContainer.value=""}}this.renderValue(oldValue,this.value);if(this.listeners.onChange){this.listeners.onChange.defer(this,value,initialized)}return this}});jControls.Control.xType=xTypes.Control;jControls.Select=Class.create(jControls.Control,{containerText:null,dataHandler:null,grid:null,handler:null,getHandler:function(){if(!this.handler){if(this.dataHandler==jControls.Calendar&&typeof this.options.data.value=="undefined"){this.options.data.value=this.options.value}this.handler=this.grid=new this.dataHandler(Object.extend(this.options.data,{cls:"jcSelect-list "+(this.options.data.cls||""),id:this.id+"_handler",enterable:true,style:Object.extend(this.options.data.style||{},{display:"none"}),listeners:Object.extend(this.options.data.listeners||{},(function(){var on={};if(this.options.listeners&&this.options.listeners.onBeforeChange){on.onBeforeChange=(function(handler,oldValue,newValue){return this.listeners.onBeforeChange(this,oldValue,newValue)}).bind(this)}on.onChange=(function(handler,value,initialized){if(handler.xType==jControls.Calendar.xType&&(value==null||(value!=null&&this.value==null)||(this.value!=null&&!value.clearTime(true).isEqual(this.value.clearTime(true))))){this.hideList()}var oldValue=this.value;this.value=value;if(this.inputContainer){if(handler.xType==jControls.Calendar.xType){if(value!=null){this.inputContainer.value=handler.options.time.show?value.format("Y-m-d H:i:s"):value.format("Y-m-d")}else{this.inputContainer.value=""}}else{this.inputContainer.value=value}}this.renderValue(oldValue,this.value);if(this.listeners.onChange){this.listeners.onChange.defer(this,value,initialized)}}).bind(this);return on}).bind(this)()),renderTo:document.body}))}return this.handler},hideList:function(event){if(this._preventHideList){this._preventHideList=undefined;return this}if(!this.handler||!this.handler.dom){return this}var box=this.handler.dom.getBox();if(event&&this.handler.xType==jControls.Calendar.xType&&box.x<=event.clientX&&box.y<=event.clientY&&event.clientX<=box.right&&event.clientY<=box.bottom){return}if(this.rendered&&this.handler&&this.handler.rendered){this.handler.dom.hide()}return this},initialize:function($super,options,autoloadIE){if(!this.xType){this.xType=jControls.Select.xType}if(!autoloadIE&&Prototype.Browser.isIE){autoload(this.initialize.bind(this,options,true));return}this.dataHandler=(!Object.isUndefined(options.handler)?options.handler:jControls.Grid);this.id=options.id||getId();$super(options)},remove:function($super){if(this.handler){this.handler.remove()}return $super()},render:function($super,renderTo){if(this.rendered){return this}var html="";renderTo=$(renderTo);renderTo=renderTo&&renderTo.nodeType==1?renderTo:renderTo.dom;if(this.xType==jControls.Select.xType){if(this.listeners.onBeforeRender&&this.listeners.onBeforeRender(this)===false){return this}var parents=renderTo.toggleDisplayed()}$super(renderTo);this.dom.addClass("jcSelect");Event.observe(this.dom,"mousedown",(function(){this.dom.down(".jcSelect-button").addClass("jcSelect-button-click")}).bind(this));Event.observe(this.dom,"mouseup",(function(){this.dom.down(".jcSelect-button").removeClass("jcSelect-button-click")}).bind(this));Event.observe(this.dom,"click",this.showList.bindAsEventListener(this));Event.observe(document,"click",this.hideList.bind(this));Element.insert(this.dom,{bottom:"<input type='hidden' name='"+this.name+"' value='"+(this.value||"")+"' />"+"<div class='jcSelect-value'></div>"+"<div class='jcSelect-button"+(!this.enabled?" jcSelect-button-disabled":"")+"'></div>"});this.containerText=this.dom.down(".jcSelect-value");this.inputContainer=this.dom.down("input",0);if(this.options.emptyText){this.renderValue(null,null)}if(this.xType==jControls.Select.xType){renderTo.toggleDisplayed(parents);if(this.listeners.onAfterRender){this.listeners.onAfterRender.defer(this)}}return this},renderValue:function($super,oldValue,newValue){$super(oldValue,newValue);(function(){var row=null;if(!this.rendered){return}this.containerText.childElements().invoke("remove");row=this.getHandler().getRow(this.value);if(this.value||row){this.getHandler().renderRow(row,this.containerText,true)}else if(this.options.emptyText){this.containerText.applyTo("<div class='jcSelect-select-value-empty'>"+this.options.emptyText+"</div>")}}).bind(this).defer()},setEnabled:function($super,state){$super(state);this.dom.down(".jcSelect-button").removeClass("jcSelect-button-disabled");if(!this.enabled){this.dom.down(".jcSelect-button").addClass("jcSelect-button-disabled")}return this},setListPosition:function(){var parents=this.dom.toggleDisplayed();var box=this.dom.getBox();this.getHandler().dom.setStyle({left:(box.x-(Prototype.Browser.isIE?2:0))+"px",top:(box.y+box.height-(Prototype.Browser.isIE?2:0))+"px",width:(box.width-this.dom.getBorderWidth("lr"))+"px"});this.dom.toggleDisplayed(parents)},setValue:function(value,initialized){if(!this.handler){this.getHandler();(function(){this.getHandler().setValue(value,initialized)}).bind(this).defer()}else{this.getHandler().setValue(value,initialized)}return this},showList:function(){if(!this.rendered||!this.enabled){return this}this.getHandler();if(this.handler.dom.isDisplayed()){return this.hideList()}this.setListPosition();if(this.handler.reset){this.handler.reset()}this.handler.dom.show();if(this.value){this.handler.scrollTo(this.handler.getRow(this.value))}this._preventHideList=true;return this}});jControls.Select.xType=xTypes.Select;jControls.Select.autoload=function(selector){if(jControls.Select._autoloaded){return}jControls.Select._autoloaded=true;autoload(function(){$$(selector||"select:not([class~=noselect])").each(function(element){if(element.hasClassName("jcContainer")){return}jControls.Select.initBy(element)})})};jControls.Select.initBy=function(){arguments=$A(arguments).flatten();if(arguments.length<1&&arguments[0]===undefined){return}if((arguments.length==1&&(Object.isElement(arguments[0])||Object.isString(arguments[0])))||(arguments.length==2&&(Object.isElement(arguments[0])||Object.isString(arguments[0]))&&!Object.isElement(arguments[1])&&!Object.isString(arguments[1]))){var element=$(arguments[0]);var options=arguments[1]||{};if(!element){return}if(element.tagName.toUpperCase()!="SELECT"){return}options=Object.extend({cls:element.className,enterable:false,enabled:!element.disabled,id:element.id||undefined,name:element.name||undefined,renderReplace:element,qtip:element.getQtipText()||undefined,value:element.value||undefined},options||{});options.style=Object.extend(element.collectStyles(),options.style||{});options.listeners=options.listeners||{};if(element.readAttribute("onchange")){var onChange=element.readAttribute("onchange");options.listeners.onChange=(options.listeners.onChange||Prototype.emptyFunction).wrap(function(proceed,select,value,initialized){if(initialized){(function(){eval(onChange)}).bind(select.inputContainer)()}return proceed(select,value,initialized)})}options.data=Object.extend({columns:[{id:"column0",type:jControls.Grid.getElementFormat(element),visible:true}],header:true,sortable:!element.hasClassName("nosort"),data:$A(element.options).collect(function(option){option=$(option);var value=option.text.strip();var attrib=[];if(option.id){attrib.push("id='"+option.id+"'")}if(option.className){attrib.push("class='"+option.className+"'")}if(option.style.cssText){attrib.push("style='"+option.style.cssText+"'")}if(attrib.length!=0){value="<div "+attrib.join(" ")+">"+value+"</div>"}return{id:option.id||option.value,"column0":value,qtip:option.getQtipText()||undefined,style:option.collectStyles()}})},options.data||{});return new jControls.Select(options)}else{var options=arguments.last();options=(options.nodeType!=1&&typeof options!="string"?arguments.pop():{});return arguments.collect(function(element){return jControls.Select.initBy(element,options)},this)}};var renderHeaderComplex=function(control){var htmlColumn="";var cssPrefix=control.xType==jControls.Grid.xType?"jcGrid":"jcTree";control.options.columnStyles.each(function(columnRow,columnRowIndex){htmlColumn=htmlColumn+"<tr class='"+cssPrefix+"-header-hd-row'>";columnRow.each(function(columnCell,columnCellIndex){if(columnCell.render){var column=columnCell.dataCell?control.columns[columnCellIndex]:null;if(column){var columnCls=column.cls;var columnId=column.id;var columnQTip=column.qtip;var columnSortable=column.sortable&&(control.options.sortable||Object.isFunction(control.listeners.onBeforeClickColumn)||Object.isFunction(control.listeners.onAfterClickColumn));var columnSortBy=control.sortBy==column.id;var columnStyle=column.styleText;var columnStyleWidth=column.visible&&!column.style.width?"width:"+control._variableColumnWidth+"%;":"";var columnHighlight=column.columnHighlight||control.options.columnHighlight||false}else{var columnCls=columnCell.element.className;var columnId=columnCell.element.id?columnCell.element.id:"column-"+columnRowIndex+"-"+columnCellIndex;var columnQTip=columnCell.element.readAttribute("qtip")||columnCell.element.readAttribute("title")||"";var columnSortable=control.options.sortable||Object.isFunction(control.listeners.onBeforeClickColumn)||Object.isFunction(control.listeners.onAfterClickColumn);var columnSortBy=false;var columnStyle=Object.toStyleString(columnCell.element.collectStyles());var columnStyleWidth="";var columnHighlight=columnCell.columnHighlight||control.options.columnHighlight||false}if(columnHighlight){var columnHighlightClasses="";for(var i=0;i<columnCell.colspan;i++){columnHighlightClasses=columnHighlightClasses+(i!=0?",":"")+'".'+cssPrefix+'-cell-td-'+(columnCellIndex+i)+'"'}}htmlColumn=htmlColumn+"<td"+(columnCell.rowspan>1?" rowspan='"+columnCell.rowspan+"'":"")+(columnCell.colspan>1?" colspan='"+columnCell.colspan+"'":"")+" class='"+cssPrefix+"-header-hd"+(columnSortBy?" jcSort-"+control.sortOrder:"")+(columnSortable?"":" "+cssPrefix+"-header-hd-nosort")+" "+cssPrefix+"-header-hd-cell "+cssPrefix+"-header-hd-"+columnId+(!columnCell.dataCell?" "+cssPrefix+"-header-hd-nodata":"")+(columnCls?" "+columnCls:"")+"'"+" style='"+columnStyle+columnStyleWidth+"'"+(columnQTip?"title='"+columnQTip+"'":"")+" onclick='jControls.onHeaderColumnClick(event, jControls.$(\""+control.id+"\"), \""+columnId+"\", "+(column?columnCellIndex:'null')+");'"+(columnHighlight?" onmouseover='jControls.$(\""+control.id+"\").dom.select("+columnHighlightClasses+").each(function(element){element.addClass(\""+cssPrefix+"-cell-column-hover\")});' "+" onmouseout='jControls.$(\""+control.id+"\").dom.select("+columnHighlightClasses+").each(function(element){element.removeClass(\""+cssPrefix+"-cell-column-hover\")});' ":"")+">"+"<div class='"+cssPrefix+"-header-hd-inner'>"+columnCell.element.innerHTML.stripTags()+"<img src='"+jControls.url.imgS+"' class='jcSort-icon' />"+"</div>"+"</td>"}});htmlColumn=htmlColumn+"</tr>"});return"<div class='"+cssPrefix+"-header'>"+"<div class='"+cssPrefix+"-header-inner'>"+"<div class='"+cssPrefix+"-header-offset'>"+"<table cellspacing='0' cellpadding='0' border='0' class='"+cssPrefix+"-header-table' style='width:100%'>"+"<thead>"+htmlColumn+"</thead>"+"</table>"+"</div>"+"</div>"+"</div>"};var renderHeaderSimple=function(control){var htmlColumn="";var cssPrefix=control.xType==jControls.Grid.xType?"jcGrid":"jcTree";control.columns.each(function(column,columnIndex){var columnSortable=(control.options.sortable||Object.isFunction(control.listeners.onBeforeClickColumn)||Object.isFunction(control.listeners.onAfterClickColumn))&&column.sortable;column.columnHighlight=column.columnHighlight||control.options.columnHighlight||false;htmlColumn=htmlColumn+"<td"+" class='"+cssPrefix+"-header-hd"+(control.sortBy==column.id?" jcSort-"+control.sortOrder:"")+(columnSortable?"":" "+cssPrefix+"-header-hd-nosort")+" "+cssPrefix+"-header-hd-cell "+cssPrefix+"-header-hd-"+column.id+(column.cls?" "+column.cls:"")+"'"+" style='"+column.styleText+(column.visible&&!column.style.width?"width:"+control._variableColumnWidth+"%;":"")+"'"+(column.qtip?"title='"+column.qtip+"'":"")+" onclick='jControls.onHeaderColumnClick(event, jControls.$(\""+control.id+"\"), \""+column.id+"\", "+columnIndex+");'"+(column.columnHighlight?" onmouseover='jControls.$(\""+control.id+"\").dom.select(\"."+cssPrefix+"-cell-td-"+columnIndex+"\").each(function(element){element.addClass(\""+cssPrefix+"-cell-column-hover\")});' "+" onmouseout='jControls.$(\""+control.id+"\").dom.select(\"."+cssPrefix+"-cell-td-"+columnIndex+"\").each(function(element){element.removeClass(\""+cssPrefix+"-cell-column-hover\")});' ":"")+">"+"<div class='"+cssPrefix+"-header-hd-inner'>"+(column.title?column.title:"")+"<img src='"+jControls.url.imgS+"' class='jcSort-icon' />"+"</div>"+"</td>"});return"<div class='"+cssPrefix+"-header'>"+"<div class='"+cssPrefix+"-header-inner'>"+"<div class='"+cssPrefix+"-header-offset'>"+"<table cellspacing='0' cellpadding='0' border='0' class='"+cssPrefix+"-header-table' style='width:100%'>"+"<thead>"+"<tr class='"+cssPrefix+"-header-hd-row'>"+htmlColumn+"</tr>"+"</thead>"+"</table>"+"</div>"+"</div>"+"</div>"};var correctBodyHeight=function(control){var cssPrefix=control.xType==jControls.Grid.xType?"jcGrid":"jcTree";var fnHeight=Prototype.emptyFunction;if((control.options.header||control.title||control.pagelist||control.toolbarBottom||control.options.footer)&&control._domHeightOrg!=null&&parseInt(control._domHeightOrg)!=0){if(control._domHeightOrg.indexOf("%")!=-1){fnHeight=function(height,header,panelTop,panelBottom,footer){Event.observe(document,"resize",function(){control.dom.down("."+cssPrefix+"-scroller").setStyle({"height":((100-(header?header.getHeight():0)-(panelTop?panelTop.getHeight():0)-(panelBottom?panelBottom.getHeight():0)-(footer?footer.getHeight():0))*100/height)+"%"})});$(document).fire("resize")}}else{fnHeight=function(height,header,panelTop,panelBottom,footer){control.dom.down("."+cssPrefix+"-scroller").setStyle({"height":(height-(header?header.getHeight()+header.getBorderWidth("tb"):0)-(panelTop?panelTop.getHeight()+panelTop.getBorderWidth("tb"):0)-(panelBottom?panelBottom.getHeight()+panelBottom.getBorderWidth("tb"):0)-(footer?footer.getHeight()+footer.getBorderWidth("tb"):0))+"px"})}}fnHeight=fnHeight.wrap(function(proceed){var parents=control.dom.toggleDisplayed();var panelBottom=control.pagelist||control.toolbarBottom;proceed(control.dom._expandHeight?parseInt(control.dom._expandHeight)+control.dom.getBorderWidth("tb"):control.dom.getHeight(),control.dom.down("."+cssPrefix+"-header"),control.dom.down(".jcControl-panel-top"),(panelBottom?panelBottom.dom:undefined),control.dom.down("."+cssPrefix+"-footer"));control.dom.toggleDisplayed(parents)});if(!control.pagelist&&!control.toolbarBottom){fnHeight()}else if(control.pagelist){control.pagelist.listeners.onAfterRender=(control.pagelist.listeners.onAfterRender||Prototype.emptyFunction).wrap(function(proceed,ctl){var result=proceed(ctl);fnHeight();return result})}else if(control.toolbarBottom){control.toolbarBottom.listeners.onAfterRender=(control.toolbarBottom.listeners.onAfterRender||Prototype.emptyFunction).wrap(function(proceed,ctl){var result=proceed(ctl);fnHeight();return result})}}};var renderFooter=function(control){var htmlColumn="";var cssPrefix=control.xType==jControls.Grid.xType?"jcGrid":"jcTree";control.columns.each(function(column,columnIndex){var cell={style:{},visible:true};if(control.options.footer&&control.options.footer.cell&&control.options.footer.cell[column.id]){cell=control.options.footer.cell[column.id]||{}}htmlColumn=htmlColumn+"<td"+(cell.id?" id='"+cell.id+"'":"")+" class='"+cssPrefix+"-footer-hd "+cssPrefix+"-footer-hd-cell "+cssPrefix+"-footer-hd-"+column.id+(cell.cls?" "+cell.cls:"")+"'"+" style='"+column.styleText+" "+Object.toStyleString(cell.style)+" "+(!cell.visible?"display:none;":"")+" "+(cell.visible+column.visible&&!column.style.width?"width:"+control._variableColumnWidth+"%;":"")+"'"+(cell.qtip?"title='"+cell.qtip+"'":"")+">"+"<div class='"+cssPrefix+"-footer-hd-inner'>"+(column.format?column.format(control.options.footer[column.id]):control.options.footer[column.id])+"</div>"+"</td>"});return"<div class='"+cssPrefix+"-footer'>"+"<div class='"+cssPrefix+"-footer-inner'>"+"<div class='"+cssPrefix+"-footer-offset'>"+"<table cellspacing='0' cellpadding='0' border='0' class='"+cssPrefix+"-footer-table' style='width:100%'>"+"<thead>"+"<tr class='"+cssPrefix+"-footer-hd-row'>"+htmlColumn+"</tr>"+"</thead>"+"</table>"+"</div>"+"</div>"+"</div>"};jControls.onHeaderColumnClick=function(e,control,column,columnIndex){Event.stop(e);if(columnIndex==null||!control.enabled){return}if(control.listeners.onBeforeClickColumn&&control.listeners.onBeforeClickColumn(control,column)===false){return}if(control.options.sortable===true&&control.columns[column].sortable===true&&Object.isFunction(control.sort)){var order=control.sortOrder;if(control.sortBy==column){order=(order=='asc'?'desc':'asc')}control.sort(column,order)}if(control.listeners.onAfterClickColumn){control.listeners.onAfterClickColumn.defer(control,column)}};var gridAppendRowData=function(grid,rowData,newPos){rowData.id=rowData.id||("row"+Math.floor(Math.random()*100000000));rowData.visible=typeof rowData.visible!="undefined"?rowData.visible:true;rowData._index=newPos;grid.options.data.splice(newPos,0,rowData);grid.data.splice(newPos,0,rowData);grid.rowDom.splice(newPos,0,{dom:null,rendered:false})};var gridDeleteRowData=function(grid,delPos){grid.options.data.splice(delPos,1);grid.data.splice(delPos,1);grid.rowDom.splice(delPos,1)};var gridSetRowClassAlternate=function(gridDom){gridDom.down(".jcGrid-body").select(".jcGrid-row").each(function(divRow,rowIndex){divRow.removeClass("jcGrid-row-alt");if(rowIndex%2==1){divRow.addClass("jcGrid-row-alt")}})};jControls.Grid=Class.create(jControls.Control,{columns:null,columnsId:null,data:null,pagelist:null,rowDom:null,sortBy:null,sortOrder:null,addRowClass:function(row,className){this.rowDom[row._index].dom.addClass(className);row.cls=(row.cls+" "+className).strip();return this},appendTRToRow:function(row,options){if(options.constructor!==Array){options=[options]}var element=row&&row.nodeType==1?row:this.rowDom[row._index].dom;options.each(function(option){var lastTr=element.down("tr");if(lastTr.next()){lastTr=lastTr.nextSiblings().last()}Element.insert(lastTr,{after:"<tr>"+"<td colspan='"+this.columns.length+"' class='jcGrid-col jcGrid-cell'>"+"<div"+" style='"+(option.style?Object.toStyleString(option.style):"display:none;padding:3px 3px 3px 5px;white-space:normal;")+"'"+(option.cls?" class='"+option.cls+"'":"")+">"+(option.html||"")+"</div>"+"</td>"+"</tr>"})},this);return this},cloneData:function(){this.data=this.options.data.collect(function(row,rowIndex){var clRow=Object.clone(row);clRow._index=rowIndex;return clRow},this)},deleteRow:function(delRow){var delPos=delRow._index;if(this.rendered){this.rowDom[delPos].dom.remove();gridSetRowClassAlternate(this.dom)}gridDeleteRowData(this,delPos);this.data.each(function(row,rowIndex){row._index=rowIndex});return this},getRow:function(index){if(typeof index!="string"&&typeof index!="number"){return index}this.data.find(function(row,rowIndex){if(row.id==index&&typeof row.id==typeof index){index=rowIndex}return row.id==index&&typeof row.id==typeof index});return this.getRowByIndex(index)},getRowByColumnValue:function(column,value){return this.data.find(function(row){if(!row[column]){return}return row[column]==value})},getRowByIndex:function(index){if(Object.isUndefined(this.data[index])){return}return this.data[index]},getRowDom:function(row){if(typeof row!="object"){row=this.getRow(row)}return(this.rowDom[row._index]?this.rowDom[row._index].dom:null)},initialize:function($super,options){if(!this.xType){this.xType=jControls.Grid.xType}this.rowDom=[];this.options=options;this.options.header=(typeof this.options.header!="undefined"?this.options.header:true);this.options.sortable=(typeof this.options.sortable!="undefined"?this.options.sortable:true);this.options.multiselect=(typeof this.options.multiselect!="undefined"?this.options.multiselect:false);if(Object.isUndefined(this.options.columnHighlight)){this.options.columnHighlight=false}this.columns=$A(options.columns);this._variableColumnWidth=0;this.columnsId=this.columns.collect(function(column,index){column.type=column.type||"string";column.visible=(typeof column.visible!="undefined"?column.visible:true);column.sortable=(typeof column.sortable!="undefined"?column.sortable:true);this.columns[column.id]=column;if(column.format){column.format=column.format.bind(this.options)}column.style=column.style||{};if(!column.visible){column.style.display="none"}if(column.visible&&!column.style.width){this._variableColumnWidth++}column.styleText=Object.toStyleString(column.style);return column.id},this);if(this._variableColumnWidth>0){this._variableColumnWidth=Math.floor(100/this._variableColumnWidth)}if(typeof this.options.pages=="boolean"&&this.options.pages){this.options.pages={}}if(typeof this.options.forcePages=="undefined"){this.options.forcePages=true}if(this.options.multiselect){this.value=$A([])}if(this.options.pages&&this.options.ajax&&Object.isUndefined(this.options.sortAjaxUrl)){this.options.sortable=false;this.options.sortBy=null;this.options.sort=null}$super(options)},insertRow:function(newRow,beforeRow){if(!Object.isArray(newRow)){newRow=[newRow]}if(!Object.isUndefined(beforeRow)){beforeRow=this.getRow(beforeRow)}var newPos=(!beforeRow||this.sortBy!=null?this.data.length:beforeRow._index);if(this.rendered&&beforeRow){beforeRow=this.rowDom[beforeRow._index].dom}newRow.each(function(newRow,rowIndex){gridAppendRowData(this,newRow,newPos++);if(this.rendered){var newRowDom=this.renderRow(newRow,this._gBody);if(beforeRow&&this.sortBy==null){Element.insert(beforeRow,{before:newRowDom.remove()})}}},this);if(this.sortBy!=null){this.sort(this.sortBy,this.sortOrder)}else{this.data.each(function(row,rowIndex){row._index=rowIndex})}if(this.rendered){gridSetRowClassAlternate(this.dom)}return this},invertSelection:function(){if(!this.options.multiselect){return this}if(this.value==null){this.value=$A([])}if(this.value.length==0){return this.selectAll()}if(this.value.length==this.data.length){return this.selectNone()}var unsel=this.value.clone();this.selectValue(this.data.findAll(function(row){return this.value.indexOf(row.id)==-1},this));this.unselectValue(unsel);return this},isRowRendered:function(row){return(this.rowDom[row._index]?this.rowDom[row._index].rendered:false)},isRowSelected:function(row){if(!this.options.multiselect){return this.value==row.id}if(!this.value||this.value.constructor!==Array){return false}if(!row){return false}return(this.value.indexOf(row.id)!=-1?true:false)},removeRowClass:function(row,className){this.rowDom[row._index].dom.removeClass(className);row.cls=$w(row.cls).spliceArray($w(className)).join(" ");return this},render:function($super,renderTo){var parents=null;var html="";var cookie=null;if(this.rendered){return this}renderTo=$(renderTo);renderTo=renderTo&&renderTo.nodeType==1?renderTo:renderTo.dom;if(this.xType==jControls.Grid.xType&&this.listeners.onBeforeRender&&this.listeners.onBeforeRender(this)===false){return this}cookie=this.getCookie();if(this.options.sortable&&cookie.sorted&&this.columns[cookie.sortBy]&&!this.options.ajax){this.options.sortBy=cookie.sortBy;this.options.sort=cookie.sortOrder}if(this.options.sortable&&this.options.sort&&!this.options.ajax){this.sort(this.options.sortBy||this.columnsId[0],this.options.sort)}else{this.cloneData()}if(this.xType==jControls.Grid.xType){parents=renderTo.toggleDisplayed()}if(this.options.pages){this.options.pages.current=1;this.options.pages.entrycount=this.options.pages.entrycount||this.options.data.length;this.options.pages.maxperpage=this.options.pages.maxperpage||jControls.PageList.MAXPERPAGE;if(this.options.forcePages||this.options.pages.maxperpage<this.options.pages.entrycount){if(!this.options.pages.listeners){this.options.pages.listeners={}}this.options.pages.listeners.onBeforePage=(function(){if(this.options.ajax){for(var i=this.options.data.length;i<this.options.pages.entrycount;i++){gridAppendRowData(this,{_template:true},i)}}function showPage(grid,pagelist,oldPage,newPage){for(var rowIndex=pagelist.getMinDisplay(newPage),max=pagelist.getMaxDisplay(newPage);rowIndex<=max;rowIndex++){if(grid.data[rowIndex]&&(!grid.rowDom[rowIndex]||!grid.rowDom[rowIndex].rendered)){grid.renderRow(grid.data[rowIndex],grid._gBody,false,true)}}for(var i=0,minPageOld=pagelist.getMinDisplay(oldPage),minPageNew=pagelist.getMinDisplay(newPage);i<pagelist.maxperpage;i++,minPageOld++,minPageNew++){if(grid.rowDom[minPageNew]&&grid.rowDom[minPageNew].rendered){grid.rowDom[minPageNew].dom.show();grid.updateRow(grid.rowDom[minPageNew].dom,minPageNew,grid.data[minPageNew])}if(grid.rowDom[minPageOld]&&grid.rowDom[minPageOld].rendered){grid.rowDom[minPageOld].dom.hide()}}}function hideRows(grid,pagelist,page){for(var rowIndex=pagelist.getMinDisplay(page),max=pagelist.getMaxDisplay(page);rowIndex<=max;rowIndex++){if(grid.rowDom[rowIndex]&&grid.rowDom[rowIndex].rendered){grid.rowDom[rowIndex].dom.hide()}}}return(function(pagelist,oldPage,newPage){if(typeof this.pagelist.pageLoaded=="boolean"||this.pagelist.pageLoaded.indexOf(newPage)!=-1){showPage(this,pagelist,oldPage,newPage);return}var ajaxOptions=Object.clone(this.options.ajax);var on={success:ajaxOptions.onSuccess||Prototype.emptyFunction};if(!ajaxOptions.parameters){ajaxOptions.parameters={}}ajaxOptions.parameters.pagenr=newPage;ajaxOptions.parameters.oldPage=oldPage;ajaxOptions.parameters.newPage=newPage;ajaxOptions.parameters.pageEntryMin=pagelist.getMinDisplay(newPage);ajaxOptions.parameters.pageEntryMax=pagelist.getMaxDisplay(newPage);ajaxOptions.parameters.pageMaxPerPage=pagelist.maxperpage;if(this.listeners.onBeforeAjaxRequest&&this.listeners.onBeforeAjaxRequest(this,ajaxOptions)===false){return}ajaxOptions.onSuccess=(function(data){this.pagelist.pageLoaded.push(newPage);if(this.listeners.onBeforeAjaxRequestSuccess&&this.listeners.onBeforeAjaxRequestSuccess(this,ajaxOptions,data)===false){return}on.success(data);var rowIndex=pagelist.getMinDisplay(newPage);data.each(function(newRow,newRowIndex){gridDeleteRowData(this,rowIndex);gridAppendRowData(this,newRow,rowIndex);this.renderRow(this.data[rowIndex],this._gBody,false,true);rowIndex++},this);showPage(this,pagelist,oldPage,newPage);if(this.listeners.onAfterAjaxRequestSuccess){this.listeners.onAfterAjaxRequestSuccess(this,ajaxOptions,data)}}).bind(this);jControls.Ajax.Request(this,ajaxOptions);if(this.listeners.onAfterAjaxRequest){this.listeners.onAfterAjaxRequest(this,ajaxOptions)}}).bind(this)}).bind(this)();this.pagelist=new jControls.PageList(this.options.pages);this.pagelist.pageLoaded=(this.options.ajax?[this.options.pages.current]:true);this.pagelist.render.bind(this.pagelist).defer(this)}}$super(renderTo);if(this.name&&this.name!=""&&!this.options.multiselect){html=html+"<input type='hidden' name='"+this.name+"' value='"+(this.value||"")+"' />"}if(this.options.header){if(Object.isArray(this.options.columnStyles)){html=html+renderHeaderComplex(this)}else{html=html+renderHeaderSimple(this)}}html=html+"<div class='jcGrid-scroller'><div class='jcGrid-body'></div></div>";if(this.options.footer){html=html+renderFooter(this)}this._gBody=Element.insert(this.dom,{bottom:html}).down(".jcGrid-body");correctBodyHeight(this);var rowIndexMin=(this.pagelist?this.pagelist.getMinDisplay():0);var rowIndexMax=(this.pagelist?this.pagelist.getMaxDisplay():this.data.length-1);this.data.each(function(row,rowIndex){if(rowIndexMin<=rowIndex&&rowIndex<=rowIndexMax){this.renderRow(row,this._gBody)}},this);if(this.name&&this.name!=""&&!this.options.multiselect){this.inputContainer=this.dom.down("input",0)}this.setSortColumn.bind(this).defer(this.options.sortBy,this.options.sort);if(this.xType==jControls.Grid.xType){renderTo.toggleDisplayed(parents);if(this.listeners.onAfterRender){this.listeners.onAfterRender.defer(this)}}},renderRow:function(row,renderTo,valueShow,renderHidden){row._index=row._index||0;if(typeof this.rowDom[row._index]=="undefined"){this.rowDom[row._index]={rendered:false,dom:null}}if(!valueShow&&this.rowDom[row._index].rendered){return}row.visible=(typeof row.visible!="undefined"?row.visible:true);if(!valueShow&&this.listeners.onBeforeRenderRow&&this.listeners.onBeforeRenderRow(this,row)===false){return}var tdhtml="";this.columns.each(function(column,columnIndex){var cell={style:{},visible:true};if(row.cell&&row.cell[column.id]){cell=row.cell[column.id]||{}}if(Object.isUndefined(cell.visible)){cell.visible=true}tdhtml=tdhtml+"<td"+(cell.id?" id='"+cell.id+"'":"")+" class='"+"jcGrid-col "+"jcGrid-cell "+"jcGrid-cell-td-"+column.id+" "+"jcGrid-cell-td-"+columnIndex+(columnIndex==0?" jcGrid-cell-td-first":"")+(columnIndex==this.columns.length-1?" jcGrid-cell-td-last":"")+(cell.cls?" "+cell.cls:"")+"'"+" style='"+column.styleText+" "+Object.toStyleString(cell.style)+" "+(!cell.visible?"display:none;":"")+(cell.visible&&column.visible&&!column.style.width?"width:"+this._variableColumnWidth+"%;":"")+"'"+(cell.qtip?"title='"+cell.qtip+"'":"")+">"+"<div"+" class='jcGrid-cell-inner jcGrid-cell-inner-"+column.id+" jcGrid-cell-inner-"+columnIndex+(columnIndex==0?" jcGrid-cell-inner-first":"")+(columnIndex==this.columns.length-1?" jcGrid-cell-inner-last":"")+"'"+">"+(column.format?column.format(row[column.id]):row[column.id])+"</div>"+"</td>"},this);var rowStyle=Object.clone(row.style||{});rowStyle.width="100%";if(renderHidden||(!valueShow&&(!row.visible||(this.pagelist&&!this.pagelist.isBetween(row._index))))){rowStyle.display="none"}var rowDom=Element.insert(renderTo,{bottom:"<div"+(!valueShow&&row.domId?" id='"+row.domId+"'":"")+" class='"+"jcGrid-row"+(row._index==0?" jcGrid-row-first":"")+(row._index==this.data.length-1?" jcGrid-row-last":"")+(this.pagelist&&(row._index+1)%this.pagelist.maxperpage==0?" jcGrid-row-last-on-page":"")+(!valueShow&&row._index%2?" jcGrid-row-alt":"")+(!valueShow&&this.isRowSelected(row)?" jcGrid-row-selected":"")+(row.cls?" "+row.cls:"")+"'"+(!Object.isUndefined(row.qtip)&&!valueShow?" title='"+row.qtip+"'":"")+" style='"+Object.toStyleString(rowStyle)+"'"+">"+"<table cellspacing='0' cellpadding='0' border='0' class='jcGrid-row-table' style='width:100%;'>"+"<tbody>"+"<tr>"+tdhtml+"</tr>"+"</tbody>"+"</table>"+"</div>"}).childElements().last();if(!valueShow){(function(){if(this.listeners.onMouseOverRow){Event.observe(rowDom,"mouseover",(function(e){if(row._pe){row._pe.stop()}row._pe=new PeriodicalExecuter((function(){row._pe.stop();this.listeners.onMouseOverRow(this,this.getRowByIndex(row._index))}).bind(this),0.1)}).bindAsEventListener(this))}if(this.listeners.onMouseOutRow){Event.observe(rowDom,"mouseout",(function(e){if(row._pe){row._pe.stop()}row._pe=new PeriodicalExecuter((function(){row._pe.stop();this.listeners.onMouseOutRow(this,this.getRowByIndex(row._index))}).bind(this),0.1)}).bindAsEventListener(this))}if(this.listeners.onMouseMoveRow){Event.observe(rowDom,"mousemove",(function(e){if(row._pe){row._pe.stop()}row._pe=new PeriodicalExecuter((function(){row._pe.stop();this.listeners.onMouseMoveRow(e,this,this.getRowByIndex(row._index))}).bind(this),0.1)}).bindAsEventListener(this))}if(this.listeners.onBeforeClickRow||this.listeners.onAfterClickRow||this.enterable){Event.observe(rowDom,"click",(function(e){if(ONCLICK_IGNORE_ELEMENTTAG.indexOf(e.element().tagName.toUpperCase())!=-1){return}if(this.listeners.onBeforeClickRow&&this.listeners.onBeforeClickRow(this,this.getRowByIndex(row._index))===false){return}if(this.enterable&&this.enabled){this.setValue(this.getRowByIndex(row._index))}if(this.listeners.onAfterClickRow){this.listeners.onAfterClickRow.defer(this,this.getRowByIndex(row._index))}}).bindAsEventListener(this))}}).bind(this).defer()}if(!valueShow){this.rowDom[row._index].rendered=true;this.rowDom[row._index].dom=rowDom;if(this.listeners.onAfterRenderRow){this.listeners.onAfterRenderRow.defer(this,row,rowDom)}}return rowDom},scrollTo:function(row){var dom=this.getRowDom(row);var scroller=this.dom.down(".jcGrid-scroller");scroller.scrollTop=0;scroller.scrollTop=dom.getY()-scroller.getY()-(!Prototype.Browser.isIE?dom.getBorderWidth("t"):0);return this},selectAll:function(){if(!this.options.multiselect){return this}return this.selectValue(this.data)},selectNone:function(){if(this.value==null){this.value=$A([])}if(this.value.length==0){return this}if(this.listeners.onBeforeChange&&this.listeners.onBeforeChange(this,this.value,$A([]))===false){return this}this.value=$A([]);if(this.listeners.onChange){this.listeners.onChange.defer(this,this.value,this.initialized)}this.setSelection();return this},selectValue:function(value){if(!this.options.multiselect){return this.setValue(value)}if(this.value==null){this.value=$A([])}if(Object.isArray(value)){value=value.findAll(function(newvalue){return this.value.indexOf(typeof newvalue.id!="undefined"?newvalue.id:newvalue)==-1},this);if(value.find(function(nvalue){var newValue=this.getRow(nvalue);if(!newValue){return}if(this.listeners.onBeforeChange&&this.listeners.onBeforeChange(this,this.value,nvalue)===false){return true}var oldValue=this.value;this.value.push(newValue.id);this.renderValue(oldValue,this.value);if(this.listeners.onChange){this.listeners.onChange.defer(this,value,this.initialized)}},this))return this;this.setSelection()}else{var newValue=this.getRow(value);if(!newValue){return}if(this.value.find(function(selValue){return selValue==newValue.id})){return this}if(this.listeners.onBeforeChange&&this.listeners.onBeforeChange(this,this.value,value)===false){return this}var oldValue=this.value;this.value.push(newValue.id);this.renderValue(oldValue,this.value);if(this.listeners.onChange){this.listeners.onChange.defer(this,value,this.initialized)}this.setSelection()}return this},setCellValue:function(row,column,value,update){update=(typeof update=="undefined"?true:update);this.options.data[row._index][column]=value;this.data[row._index][column]=value;if(this.options.data[row._index]._convertedData&&this.options.data[row._index]._convertedData[column]){this.options.data[row._index]._convertedData[column]=convertToDataType(this.options.data[row._index][column].stripTags(),this.columns[column].type)}if(update){if(this.sortBy!=null&&this.sortBy==column){this.sort(this.sortBy,this.sortOrder)}else{this.updateRow(this.getRowDom(row),row._index,row)}}return this},setCookie:function($super,options){if(!this.options.ajax){options=Object.extend(options||{},{sorted:this.sortBy!=null,sortBy:this.sortBy,sortOrder:this.sortOrder})}return $super(options)},setSelection:function(row){if(!this.rendered){return this}if(!this.options.multiselect){if(!row){row=this.value}if(row!=null){row=this.getRow(row);if(!row){return this}this.dom.down(".jcGrid-row").removeClass("jcGrid-row-selected").nextSiblings().invoke("removeClass","jcGrid-row-selected");var rowNode=(row._index==0?this.dom.down(".jcGrid-body").down(".jcGrid-row"):this.dom.down(".jcGrid-body").down(".jcGrid-row").nextSiblings()[row._index-1]);if(rowNode){rowNode.addClass("jcGrid-row-selected")}}else{this.dom.down(".jcGrid-row").removeClass("jcGrid-row-selected").nextSiblings().invoke("removeClass","jcGrid-row-selected")}}else if(Object.isArray(this.value)){this.dom.select(".jcGrid-row-selected").invoke("removeClass","jcGrid-row-selected");if(!Object.isUndefined(this.name)&&this.name!=""){this.dom.select(".jcGrid-input-multiselect").invoke("remove")}this.value.each(function(selValue){var node=this.getRowDom(this.getRow(selValue));if(node){node.addClass("jcGrid-row-selected")}if(!Object.isUndefined(this.name)&&this.name!=""){new jControls.Container({type:"input",cls:"jcGrid-input-multiselect",attributes:{type:"hidden",name:this.name,value:selValue},renderTo:this})}},this)}else{this.dom.select(".jcGrid-row-selected").invoke("removeClass","jcGrid-row-selected")}return this},setSortColumn:function(columnId,direction){var headers=this.dom.down(".jcGrid-header");if(!headers){return}this.sortBy=columnId;this.sortOrder=direction;headers.select(".jcSort-asc",".jcSort-desc").invoke("removeClass","jcSort-asc jcSort-desc");if(this.sortBy!=null&&this.sortOrder!=null){headers.down(".jcGrid-header-hd-"+this.sortBy).addClass("jcSort-"+this.sortOrder)}},setValue:function($super,value,initialized){if(this.options.multiselect){if(value&&value.constructor===Array){value.each(function(newvalue){this.setValue(newvalue)},this);return this}else{return(this.isRowSelected(this.getRow(value))?this.unselectValue(value):this.selectValue(value))}}if(value!=null&&!Object.isUndefined(value)){var newValue=(typeof value=="object"?value:this.getRow(value));if(newValue){$super(newValue.id,initialized);this.setSelection(newValue)}else{this.setValue(null)}}else{$super(value,initialized);this.setSelection(null)}return this},sort:function(sortBy,order){if(this.listeners.onBeforeSort&&this.listeners.onBeforeSort(this,sortBy,order)===false){return}this.sortBy=sortBy;this.sortOrder=(order||"asc").toLowerCase();if(this.rendered){this.setCookie()}if(!this.options.ajax){this.options.data.sort((function(left,right){if(!left._convertedData){left._convertedData=[]}if(!left._convertedData[this.sortBy]){left._convertedData[this.sortBy]=convertToDataType(String(left[this.sortBy]).stripTags(),this.columns[this.sortBy].type)}var a=left._convertedData[this.sortBy];if(!right._convertedData){right._convertedData=[]}if(!right._convertedData[this.sortBy]){right._convertedData[this.sortBy]=convertToDataType(String(right[this.sortBy]).stripTags(),this.columns[this.sortBy].type)}var b=right._convertedData[this.sortBy];if(Object.isString(a)||Object.isString(b)){[{from:"Ä",to:"Ae"},{from:"ä",to:"ae"},{from:"Ö",to:"Oe"},{from:"ö",to:"oe"},{from:"Ü",to:"Ue"},{from:"ü",to:"ue"},{from:"ß",to:"ss"}].each(function(sign){if(Object.isString(a)){a=a.replace(sign.from,sign.to)}if(Object.isString(b)){b=b.replace(sign.from,sign.to)}})}if(this.sortOrder=="asc"){return a<b?-1:a>b?1:0}else{return a>b?-1:a<b?1:0}}).bind(this));this.cloneData();if(this.listeners.onAfterSort){this.listeners.onAfterSort.defer(this,sortBy,order)}this.update()}else if(this.options.ajax&&!Object.isUndefined(this.options.sortAjaxUrl)&&this.sortBy&&this.sortOrder){window.location.href=this.options.sortAjaxUrl.interpolate({columnId:this.sortBy,direction:this.sortOrder,pageId:(this.pagelist?this.pagelist.getPage():"")});if(this.listeners.onAfterSort){this.listeners.onAfterSort.defer(this,sortBy,order)}}},unselectValue:function(value){if(!this.options.multiselect){return this.setValue(null)}if(this.value==null){return this}if(Object.isArray(value)){value.each(function(newvalue){this.unselectValue(newvalue)},this);return this}var newValue=this.getRow(value);if(!newValue){return}if(!this.value.find(function(selValue){return selValue==newValue.id})){return this}if(this.listeners.onBeforeChange&&this.listeners.onBeforeChange(this,this.value,value)===false){return this}var oldValue=this.value;this.value=this.value.without(newValue.id);this.renderValue(oldValue,this.value);if(this.listeners.onChange){this.listeners.onChange.defer(this,value,this.initialized)}this.setSelection()},update:function(){if(!this.rendered){return this}if(this.listeners.onBeforeUpdate&&this.listeners.onBeforeUpdate(this)===false){return this}this.setSortColumn(this.sortBy,this.sortOrder);this.dom.down(".jcGrid-body").select(".jcGrid-row").each(function(rowNode,rowIndex){if(!rowNode.isDisplayed()){return}this.updateRow(rowNode,rowIndex,this.data[rowIndex])},this);this.setSelection();if(this.listeners.onAfterUpdate){this.listeners.onAfterUpdate.defer(this)}return this},updateRow:function(rowNode,rowIndex,row){if(this.listeners.onBeforeUpdateRow&&this.listeners.onBeforeUpdateRow(this,row,rowNode)===false){return}rowNode.clearStyle(Object.keys(rowNode.collectStyles()).without("display"));if(row.style){rowNode.setStyle(row.style)}rowNode.removeClass($w(rowNode.className).findAll(function(cls){return!cls.startsWith("jc")}).join(" "));rowNode.addClass(row.cls);rowNode.select(".jcGrid-cell").each(function(cellNode,columnIndex){var column=this.columnsId[columnIndex];var cell={style:{},visible:true};if(row.cell&&row.cell[column]){cell=row.cell[column]||{}}if(Object.isUndefined(cell.visible)){cell.visible=true}var innerCell=cellNode.down(".jcGrid-cell-inner");if(innerCell){innerCell.innerHTML="";Element.insert(innerCell,this.columns[column].format?this.columns[column].format(row[column]):row[column])}cellNode.id=(cell.id?" id='"+cell.id+"'":"");cellNode.className="jcGrid-col "+"jcGrid-cell "+"jcGrid-cell-td-"+column+" "+"jcGrid-cell-td-"+columnIndex+(columnIndex==0?" jcGrid-cell-td-first":"")+(columnIndex==this.columns.length-1?" jcGrid-cell-td-last":"")+(cell.cls?" "+cell.cls:"");cellNode.clearStyle(Object.keys(cellNode.collectStyles()));var columnData=this.columns[column]||{styleText:"",style:{}};cellNode.setStyle(columnData.styleText+" "+Object.toStyleString(cell.style)+" "+(!cell.visible?"display:none;":"")+(cell.visible&&columnData.visible&&!columnData.style.width?"width:"+this._variableColumnWidth+"%;":""));cellNode.quickTip(cell.qtip?cell.qtip:"")},this);if(this.listeners.onAfterUpdateRow){this.listeners.onAfterUpdateRow.defer(this,row,rowNode)}}});jControls.Grid.xType=xTypes.Grid;jControls.Grid.autoload=function(selector){if(jControls.Grid._autoloaded){return}jControls.Grid._autoloaded=true;autoload(function(){$$(selector||"table:not([class~=nogrid])").each(function(element){if(element.hasClassName("jcContainer")){return}jControls.Grid.initBy(element)})})};jControls.Grid.getElementFormat=function(element){element=$(element);return DATATYPES.find(function(cls){return element.hasClassName(cls)})||"string"};jControls.Grid.initBy=function(){var getColumnsData=function(element){var result={columns:$A([]),columnStyles:$A([]),lastHeaderTR:null};var isComplexColumnStyle=false;var parentTR=element.down("thead");if(!parentTR){parentTR=element.down("tbody")}if(!parentTR){parentTR=element.down("tr:first");if(parentTR){parentTR=parentTR.parent()}}if(!parentTR){return result}var columnTRs=parentTR.select("tr th:first-child");if(columnTRs.length==0){columnTRs=$A([parentTR.down("tr td:first-child")])}if(columnTRs.length==0){return result}columnTRs=columnTRs.collect(function(childTR){return childTR.parent()}).findAll(function(tr){return tr.parent()==parentTR});if(columnTRs.length==0){return result}result.columnStyles=$A($R(0,columnTRs.length-1));columnTRs.each(function(columnTR,indexTR){var columnIndex=0;if(indexTR!=0&&Object.isArray(result.columnStyles[indexTR])){for(columnIndex=0;!Object.isUndefined(result.columnStyles[indexTR][columnIndex])&&columnIndex<result.columnStyles[indexTR].length;columnIndex++){}}columnTR.childElements().each(function(columnTH,indexTH){var node=columnTH;var colspan=parseInt(node.readAttribute("colspan"))||1;var rowspan=parseInt(node.readAttribute("rowspan"))||1;if(colspan!=1||rowspan!=1){isComplexColumnStyle=true}var isDataCell=indexTR+rowspan==columnTRs.length;for(var i=0;i<colspan;i++){for(var j=0;j<rowspan;j++){if(isDataCell&&j==0){result.columns[columnIndex]=node;node=node.cloneNode(false);if(node.id){node.id=node.id+"."+i}}if(!Object.isArray(result.columnStyles[indexTR+j])){result.columnStyles[indexTR+j]=$A([])}result.columnStyles[indexTR+j][columnIndex]={"colspan":colspan,dataCell:isDataCell&&j==0,element:columnTH,render:i==0&&j==0,"rowspan":rowspan}}columnIndex++}})});result.lastHeaderTR=columnTRs.last();if(!isComplexColumnStyle){result.columnStyles=undefined}return result};var getColumnOptions=function(element,options){var columnData=getColumnsData(element);if(columnData.columns.length==0){return options}options.columnStyles=columnData.columnStyles;options.firstDataTR=columnData.lastHeaderTR.parent();if(Object.isElement(columnData.lastHeaderTR)&&columnData.lastHeaderTR.tagName.toLowerCase()=="thead"){options.firstDataTR=options.firstDataTR.next();if(options.firstDataTR){options.firstDataTR=options.firstDataTR.down()}}else if(Object.isElement(options.firstDataTR)&&options.firstDataTR.tagName.toLowerCase()=="tbody"||options.firstDataTR.tagName.toLowerCase()=="table"){options.firstDataTR=columnData.lastHeaderTR.next()}if((Object.isElement(options.firstDataTR)&&!options.firstDataTR.tagName.toLowerCase()=="tr")||!Object.isElement(options.firstDataTR)){options.firstDataTR=null}if(Object.isUndefined(options.header)){options.header=columnData.columns.first().tagName.toLowerCase()=="th"}if(!options.header){options.firstDataTR=columnData.lastHeaderTR}options.columns=columnData.columns.collect(function(element,columnIndex){if(Object.isUndefined(options.columnIsRowId)&&element.hasClassName("rowid")){options.columnIsRowId=columnIndex}if(element.hasClassName("sorted")||element.hasClassName("sorted-asc")){options.sortBy=element.id||("column"+columnIndex);options.sort="asc"}else if(element.hasClassName("sorted-desc")){options.sortBy=element.id||("column"+columnIndex);options.sort="desc"}return{cls:element.className,id:element.id||("column"+columnIndex),qtip:(element.tagName.toLowerCase()=="th"?element.getQtipText()||undefined:undefined),sortable:!element.hasClassName("nosort"),style:element.collectStyles(),title:(element.tagName.toLowerCase()=="th"?element.innerHTML.strip():""),type:jControls.Grid.getElementFormat(element),visible:(element.getStyle("display")!="none"&&element.getStyle("visibility")!="hidden")}});return options};arguments=$A(arguments).flatten();if(arguments.length<1&&arguments[0]===undefined){return}if((arguments.length==1&&(Object.isElement(arguments[0])||Object.isString(arguments[0])))||(arguments.length==2&&(Object.isElement(arguments[0])||Object.isString(arguments[0]))&&!Object.isElement(arguments[1])&&!Object.isString(arguments[1]))){var element=$(arguments[0]);var options=arguments[1]||{};if(!element){return}if(element.tagName.toUpperCase()!="TABLE"){return}element=element.cleanWhitespaceRecursive();options=Object.extend({cls:element.className,columns:[],enterable:false,id:element.id||undefined,renderReplace:element,sortable:!element.hasClassName("nosort")},options);if(!options.title&&element.getQtipText()){options.title=element.getQtipText()}options.style=Object.extend(element.collectStyles(),options.style||{});options.columns=[];options=getColumnOptions(element,options);var trElements=$A([]);var selectedValues=$A([]);if(options.firstDataTR){trElements=$A([options.firstDataTR]).concat(options.firstDataTR.nextSiblings())}if(trElements.length!=0){options.data=trElements.findAll(function(tr,index){return!tr.hasClassName("footer")}).collect(function(tr,rowIndex){var tdElements=$A([tr.down("td")]);tdElements=tdElements.concat(tdElements.first().nextSiblings());if(tr.hasClassName("selected")){selectedValues.push(rowIndex);tr.removeClass("selected")}return tdElements.inject({cls:tr.className,domId:tr.id||undefined,id:"row"+rowIndex,qtip:tr.getQtipText()||undefined,style:tr.collectStyles(),visible:(tr.getStyle("display")!="none"&&tr.getStyle("visibility")!="hidden")},function(row,td,columnIndex){var columnId=options.columns[columnIndex].id;if(!Object.isUndefined(options.columnIsRowId)&&options.columnIsRowId==columnIndex){row.id=td.innerHTML.strip()}if(Object.isUndefined(row.cell)){row.cell={}}row.cell[columnId]={};row.cell[columnId].id=td.id;row.cell[columnId].cls=td.className;row.cell[columnId].qtip=td.getQtipText();row.cell[columnId].style=td.collectStyles();row.cell[columnId].visible=(td.getStyle("display")!="none"&&td.getStyle("visibility")!="hidden");row[columnId]=td.innerHTML.strip();return row})})}else{options.data=$A([])}if(selectedValues.length==1){options.value=options.data[selectedValues[0]].id}else if(selectedValues.length>1){options.multiselect=true;options.value=selectedValues.collect(function(rowIndex){return options.data[rowIndex].id})}var footerTr=trElements.find(function(tr){return tr.hasClassName("footer")});if(footerTr){var tdElements=$A([footerTr.down("td")]);tdElements=tdElements.concat(tdElements.first().nextSiblings());options.footer=tdElements.inject({cls:footerTr.className,qtip:footerTr.getQtipText()||undefined,style:footerTr.collectStyles()},function(footer,footerTd,columnIndex){var columnId=options.columns[columnIndex].id;if(Object.isUndefined(footer.cell)){footer.cell={}}footer.cell[columnId]={};footer.cell[columnId].id=footerTd.id;footer.cell[columnId].cls=footerTd.className;footer.cell[columnId].qtip=footerTd.getQtipText();footer.cell[columnId].style=footerTd.collectStyles();footer.cell[columnId].visible=(footerTd.getStyle("display")!="none"&&footerTd.getStyle("visibility")!="hidden");footer[columnId]=footerTd.innerHTML.strip();return footer})}return new jControls.Grid(options)}else{var options=arguments.last();options=(options.nodeType!=1&&typeof options!="string"?arguments.pop():{});return arguments.collect(function(element){return jControls.Grid.initBy(element,options)},this)}};var quicktipContainer=null;var quicktipTitle=null;var quicktipText=null;var quicktipXY=null;var quicktipAutoloaded=false;var quicktipCurrent=null;var quicktipSetPosition=function(pos){if(quicktipXY==null&&!pos){return}if(pos){quicktipXY=pos}if(!quicktipContainer.isDisplayed()){return}var size=quicktipContainer.getSize();if(!Prototype.Browser.isIE||Prototype.Browser.isIE7){var maxPos=document.viewport.getDimensions();var scrollOffset=document.viewport.getScrollOffsets();maxPos.width-=size.width+jControls.QuickTip.OFFSET.X;maxPos.height-=size.height+jControls.QuickTip.OFFSET.Y;if(maxPos.width+scrollOffset.left<=quicktipXY.x){quicktipXY.x-=quicktipXY.x-maxPos.width}if(maxPos.height+scrollOffset.top<=quicktipXY.y){quicktipXY.y-=size.height+jControls.QuickTip.OFFSET.Y*2}if(quicktipXY.x<scrollOffset.left){quicktipXY.x=scrollOffset.left}if(quicktipXY.y<scrollOffset.top){quicktipXY.y=scrollOffset.top}}quicktipContainer.setXY([quicktipXY.x+jControls.QuickTip.OFFSET.X,quicktipXY.y+jControls.QuickTip.OFFSET.Y])};var quicktipCreate=function(){if(quicktipContainer!=null){return}Element.insert(document.body,{bottom:"<div class='jcContainer jcQuickTip' style='display:none;'>"+"<div class='jcQuickTip-tl'>"+"<div class='jcQuickTip-tr'>"+"<div class='jcQuickTip-tc'>"+"<div class='jcQuickTip-header'>"+"<span class='jcQuickTip-header-text'>"+"</span>"+"</div>"+"</div>"+"</div>"+"</div>"+"<div class='jcQuickTip-bwrap'>"+"<div class='jcQuickTip-ml'>"+"<div class='jcQuickTip-mr'>"+"<div class='jcQuickTip-mc'>"+"<div class='jcQuickTip-body' style='height:auto;'>"+"</div>"+"</div>"+"</div>"+"</div>"+"<div class='jcQuickTip-bl'>"+"<div class='jcQuickTip-br'>"+"<div class='jcQuickTip-bc'>"+"</div>"+"</div>"+"</div>"+"</div>"+"</div>"});quicktipContainer=document.body.down(".jcQuickTip");quicktipTitle=quicktipContainer.down(".jcQuickTip-header-text");quicktipText=quicktipContainer.down(".jcQuickTip-body");quicktipContainer.cleanWhitespace();Event.observe(document,"mousemove",function(e){quicktipSetPosition(e.pointer())}.bindAsEventListener(this))};jControls.QuickTip={OFFSET:{X:15,Y:15},MAXWIDTH:300,ATTRIBUTE:"qtip",autoload:function(selector,attribute){selector=selector||'[title!=""]';attribute=attribute||"title";var fnSearch=(function(){if(this._searchActive){return Prototype.emptyFunction}this._searchActive=true;return(function(){if(Object.isArray(selector)){selector.each(setQtip)}else{$(document.body).select("[qtip!='']",selector).each(setQtip)}this._searchActive=false}).bind(this)}).bind(this);if(quicktipAutoloaded){fnSearch().defer();return}quicktipAutoloaded=true;function setQtip(element){if(!Prototype.Browser.isIE&&typeof element._qtipText!="undefined"){return}if($(element).hasClassName("no-qtip")){return}var text=element.readAttribute(attribute);if(!text){text=element.readAttribute("qtip")}if(!text||!Object.isString(text)){return}element.writeAttribute(attribute,"");element.writeAttribute("qtip",text);element._qtipText=text;if(text.match(/&lt;|&gt;/gi)){text=text.unescapeHTML()}jControls.QuickTip.set(element,text);return element};Element.insert=Element.insert.wrap(function(proceed,element,content){var result=proceed(element,content);fnSearch().defer();return result});autoload(fnSearch())},getQtipText:function(element){try{return element.title||element.readAttribute(jControls.QuickTip.ATTRIBUTE)}catch(e){}},hide:function(){if(quicktipContainer==null){return}if(this.effect&&this.effect.cancel){this.effect.cancel()}this.effect=new Effect.Fade(quicktipContainer,{duration:0.3,from:quicktipContainer.getOpacity(),to:0})},show:function(options){if(typeof options!="object"){options={text:options}}if(options.text==""){return}quicktipCreate();quicktipContainer.setStyle({width:""});quicktipTitle.innerHTML=options.title||"";if(Prototype.Browser.isIE&&!Prototype.Browser.isIE6){if(options.title){quicktipContainer.down(".jcQuickTip-header").show()}else{quicktipContainer.down(".jcQuickTip-header").hide()}}else if(Prototype.Browser.isIE6){if(!options.title){quicktipContainer.down(".jcQuickTip-header").setStyle({fontSize:"0px"})}else{quicktipContainer.down(".jcQuickTip-header").clearStyle("fontSize")}}quicktipText.innerHTML=options.text;quicktipText.setStyle({width:(options.width?options.width+"px":"auto")});var displayed=quicktipContainer.isDisplayed();if(!displayed){quicktipContainer.show()}if(quicktipText.getWidth()>jControls.QuickTip.MAXWIDTH){quicktipText.setWidth(jControls.QuickTip.MAXWIDTH)}if(Prototype.Browser.isIE){quicktipContainer.setStyle({width:(quicktipText.getWidth()+20)+"px"})}if(!displayed){quicktipContainer.hide()}if(this.effect&&this.effect.cancel){this.effect.cancel()}this.effect=new Effect.Appear(quicktipContainer,{duration:(1-(quicktipContainer.isDisplayed()?quicktipContainer.getOpacity():0))*0.3,from:(quicktipContainer.isDisplayed()?quicktipContainer.getOpacity():0),to:1});quicktipSetPosition()},set:function(element,options){element=$(element);if(quicktipCurrent==element){jControls.QuickTip.show(options)}element.on({mouseover:{scope:window,fn:function(event){quicktipCurrent=Event.element(event);jControls.QuickTip.show(options)}},mouseout:{scope:window,fn:function(){quicktipCurrent=null;jControls.QuickTip.hide()}}});return element}};Element.addMethods({quickTip:jControls.QuickTip.set,getQtipText:jControls.QuickTip.getQtipText});jControls.Button=Class.create(jControls.Control,{checked:null,initialize:function($super,options){if(!this.xType){this.xType=jControls.Button.xType}options.icon=options.icon||"";options.iconDisabled=options.iconDisabled||options.icon;options.text=options.text||"";if(!Object.isUndefined(options.checked)){this.checked=options.checked?true:false}if(Object.isBoolean(this.checked)){options.listeners=options.listeners||{};options.listeners.onAfterClick=(options.listeners.onAfterClick||Prototype.emptyFunction).wrap(function(proceed,btn){if(btn.listeners.onAfterChecked){btn.listeners.onAfterChecked(btn,btn.checked)}proceed(btn)});options.listeners.onBeforeClick=(options.listeners.onBeforeClick||Prototype.emptyFunction).wrap(function(proceed,btn){if(!btn.listeners.onBeforeChecked||(btn.listeners.onBeforeChecked&&btn.listeners.onBeforeChecked(btn,btn.checked)!==false)){btn.setChecked(!btn.checked)}proceed(btn)})}$super(options)},render:function($super,renderTo){var html="";if(this.rendered){return this}$super(renderTo);if(this.xType==jControls.Button.xType&&this.listeners.onBeforeRender&&this.listeners.onBeforeRender(this)===false){return this}this.dom.addClass("jcBtn");this.dom.writeAttribute("onclick","event.stop();");var container=Element.insert(this.dom,{bottom:"<div class='"+"jcBtn-btn"+(this.options.icon&&!this.options.text?" jcBtn-icon-only":"")+(!this.options.icon&&this.options.text?" jcBtn-text-only":"")+(this.options.icon&&this.options.text?" jcBtn-text-icon":"")+(this.enabled?" jcBtn-enabled":" jcBtn-disabled")+(Object.isBoolean(this.checked)&&this.checked&&this.enabled?" jcBtn-checked":"")+(Object.isBoolean(this.checked)&&this.checked&&!this.enabled?" jcBtn-checked-disabled":"")+"'"+">"+"<div class='jcBtn-left'></div>"+"<div class='jcBtn-center'>"+"<div class='jcBtn-button jcBtn-text"+(this.enabled&&this.options.icon?" "+this.options.icon:"")+(!this.enabled&&this.options.icon?" "+this.options.iconDisabled:"")+"'>"+this.options.text+"</div>"+"</div>"+"<div class='jcBtn-right'></div>"+"</div>"}).down(".jcBtn-btn");if(this.options.iconHover){Event.observe(container,"mouseover",(function(e){if(!this.enabled){return}var node=this.dom.down(".jcBtn-button");if(node._pe){node._pe.stop()}node._pe=new PeriodicalExecuter((function(){node._pe.stop();node.addClass(this.options.iconHover)}).bind(this),0.1)}).bindAsEventListener(this));Event.observe(container,"mouseout",(function(e){var node=this.dom.down(".jcBtn-button");if(node._pe){node._pe.stop()}node._pe=new PeriodicalExecuter((function(){node._pe.stop();node.removeClass(this.options.iconHover)}).bind(this),0.1)}).bindAsEventListener(this))}if(this.options.iconPressed){Event.observe(container,"mousedown",(function(e){if(!this.enabled){return}this.dom.down(".jcBtn-button").addClass(this.options.iconPressed)}).bindAsEventListener(this));Event.observe(container,"mouseup",(function(e){if(!this.enabled){return}this.dom.down(".jcBtn-button").removeClass(this.options.iconPressed)}).bindAsEventListener(this))}Event.observe(container,"click",(function(e){if(!this.enabled){Event.stop(e)}}).bindAsEventListener(this));if(this.xType==jControls.Button.xType&&this.listeners.onAfterRender){this.listeners.onAfterRender.defer(this)}return this},setChecked:function(state){this.checked=state;this.dom.down(".jcBtn-btn").removeClass("jcBtn-checked jcBtn-checked-disabled");if(this.checked&&this.enabled){this.dom.down(".jcBtn-btn").addClass("jcBtn-checked")}else if(this.checked&&!this.enabled){this.dom.down(".jcBtn-btn").addClass("jcBtn-checked-disabled")}return this},setEnabled:function($super,state){$super(state);this.dom.down(".jcBtn-btn").removeClass("jcBtn-enabled jcBtn-disabled");this.dom.down(".jcBtn-btn").addClass(this.enabled?"jcBtn-enabled":"jcBtn-disabled");this.dom.down(".jcBtn-button").removeClass(this.options.icon+" "+this.options.iconDisabled+" "+this.options.iconHover+" "+this.options.iconPressed);this.dom.down(".jcBtn-button").addClass(this.enabled?this.options.icon:this.options.iconDisabled);return this}});jControls.Button.TITLE={PAGEFIRST:"erste Seite",PAGEPREV:"vorherige Seite",PAGENEXT:"nächste Seite",PAGELAST:"letzte Seite",CLOSE:"Schließen",EXPAND:"Ausklappen",COLLAPSE:"Einklappen",EXPANDALL:"alle ausklappen",COLLAPSEALL:"alle einklappen",EXPANDCOLLAPSE:"Aus- und Einklappen",PINNED:"Festhalten",SEARCH:"Suche",SEARCHTIPP:"Ab 5 Zeichen wird automatisch bei der Eingabe gesucht."};jControls.Button.xType=xTypes.Button;jControls.PageList=Class.create(jControls.Control,{current:null,count:null,entrycount:null,maxperpage:null,textformat:null,formatText:function(){return(new Template(this.textformat||jControls.PageList.DISPLAYTEXT)).evaluate({index:this.current,count:this.count,mindisplay:this.getMinDisplay()+1,maxdisplay:this.getMaxDisplay()+1,entrycount:this.entrycount||""})},getMaxDisplay:function(page){page=page||this.current;return(this.entrycount==null||page<this.count?page*this.maxperpage-1:this.entrycount-1)},getMinDisplay:function(page){return((page||this.current)-1)*this.maxperpage},getPage:function(){return this.current},initialize:function($super,options){if(!this.xType){this.xType=jControls.PageList.xType}this.current=options.current||1;this.count=options.count||1;this.maxperpage=options.maxperpage||jControls.PageList.MAXPERPAGE;this.textformat=options.textformat||jControls.PageList.DISPLAYTEXT;this.entrycount=options.entrycount||null;if(this.entrycount){this.count=Math.ceil(this.entrycount/this.maxperpage)}if(this.current<1){this.current=1}else if(this.current>this.count){this.current=this.count}this._button={};$super(options)},isBetween:function(value){return this.getMinDisplay()<=value&&value<=this.getMaxDisplay()},render:function($super,renderTo){if(this.rendered){return this}if(this.xType==jControls.PageList.xType&&this.listeners.onBeforeRender&&this.listeners.onBeforeRender(this)===false){return this}this.options.buttons=$A([{id:this.id+"_first",icon:"jcBtn-first",iconDisabled:"jcBtn-first-disabled",enabled:(this.current>1),qtip:jControls.Button.TITLE.PAGEFIRST,renderTo:this,listeners:{onAfterClick:this.setFirstPage.bind(this)}},{id:this.id+"_prev",icon:"jcBtn-prev",iconDisabled:"jcBtn-prev-disabled",enabled:(this.current>1),qtip:jControls.Button.TITLE.PAGEPREV,renderTo:this,listeners:{onAfterClick:this.setPreviousPage.bind(this)}},{id:this.id+"_next",icon:"jcBtn-next",iconDisabled:"jcBtn-next-disabled",enabled:(this.current<this.count),qtip:jControls.Button.TITLE.PAGENEXT,renderTo:this,listeners:{onAfterClick:this.setNextPage.bind(this)}},{id:this.id+"_last",icon:"jcBtn-last",iconDisabled:"jcBtn-last-disabled",enabled:(this.current<this.count),qtip:jControls.Button.TITLE.PAGELAST,renderTo:this,listeners:{onAfterClick:this.setLastPage.bind(this)}}]);$super(renderTo);this._button.first=jControls.$(this.id+"_first");this._button.prev=jControls.$(this.id+"_prev");this._button.next=jControls.$(this.id+"_next");this._button.last=jControls.$(this.id+"_last");this.dom.addClass("jcControl-panel jcControl-panel-bottom jcToolbar");this._button.text=new jControls.Container({id:this.id+"_text",type:"div",cls:"jcGrid-pageinfo",html:this.formatText(),renderAfter:this._button.prev});if(Prototype.Browser.isIE){Element.insert(this.dom,{bottom:"<div class='jcWidthFull'>&#160;</div>"})}if(this.xType==jControls.PageList.xType&&this.listeners.onAfterRender){this.listeners.onAfterRender.defer(this)}return this},setFirstPage:function(){if(this.listeners.onBeforePageFirst&&this.listeners.onBeforePageFirst(this,this.current,1)===false){return this}this.setPage(1);if(this.listeners.onAfterPageFirst){this.listeners.onAfterPageFirst.defer(this,this.current)}return this},setLastPage:function(){if(this.listeners.onBeforePageLast&&this.listeners.onBeforePageLast(this,this.current,this.count)===false){return this}this.setPage(this.count);if(this.listeners.onAfterPageLast){this.listeners.onAfterPageLast.defer(this,this.current)}return this},setNextPage:function(){if(this.listeners.onBeforePageNext&&this.listeners.onBeforePageNext(this,this.current,this.current<this.count?this.current+1:this.count)===false){return this}this.setPage(this.current+1);if(this.listeners.onAfterPageNext){this.listeners.onAfterPageNext.defer(this,this.current)}return this},setPage:function(page){if(page<1){page=1}if(page>this.count){page=this.count}if(this.listeners.onBeforePage&&this.listeners.onBeforePage(this,this.current,page)===false){return this}if(this.listeners.onHideEntry){for(var index=this.getMinDisplay(),max=this.getMaxDisplay();index<=max;index++){this.listeners.onHideEntry(this,index)}}this.current=page;if(this.listeners.onShowEntry){for(var index=this.getMinDisplay(),max=this.getMaxDisplay();index<=max;index++){this.listeners.onShowEntry(this,index)}}if(this.rendered){this._button.first.setEnabled(this.current>1);this._button.prev.setEnabled(this.current>1);this._button.text.dom.innerHTML=this.formatText();this._button.next.setEnabled(this.current<this.count);this._button.last.setEnabled(this.current<this.count)}if(this.listeners.onAfterPage){this.listeners.onAfterPage.defer(this,this.current)}return this},setPreviousPage:function(){if(this.listeners.onBeforePagePrevious&&this.listeners.onBeforePagePrevious(this,this.current,this.current>1?this.current-1:1)===false){return this}this.setPage(this.current-1);if(this.listeners.onAfterPagePrevious){this.listeners.onAfterPagePrevious.defer(this,this.current)}return this}});jControls.PageList.DISPLAYTEXT="Seite #{index} von #{count}";jControls.PageList.MAXPERPAGE=10;jControls.PageList.xType=xTypes.PageList;var nestedSetCreateTree=function(nset){for(var i=0;i<nset.length;i++){var part=nset.partition(function(entry){return nset[i].lft<entry.lft&&entry.rgt<nset[i].rgt});nset=part[1];if(part[0].length!=0){nset[i].childs=part[0]}}nset.each(function(entry){if(entry.childs){entry.childs=nestedSetCreateTree(entry.childs)}});return nset};jControls.NestedSetContainer=Class.create({data:null,tree:null,xType:null,getTree:function(){if(!this.tree){this.tree=nestedSetCreateTree(this.data)}return this.tree},initialize:function(data){if(!this.xType){this.xType=jControls.NestedSetContainer.xType}this.data=data}});jControls.NestedSetContainer.xType=xTypes.NestedSetContainer;var treeUpdateRowClassAlternate=function(tree){var index=0;tree.dom.select(".jcTree-row").each(function(element){if(element.isDisplayed()){if(index%2){element.addClass("jcTree-row-alt")}else{element.removeClass("jcTree-row-alt")}index++}})};var treeCorrectRowData=function(rows,parentRow){rows.each(function(row){if(!Object.isUndefined(parentRow)){row.parent=parentRow}if(!Object.isUndefined(row.data.id)&&typeof row.data.id=="object"&&!Object.isUndefined(row.data.id.value)){row.id=row.data.id.value}else if(!Object.isUndefined(row.data.id)){row.id=row.data.id}if(row.childs&&row.childs.length!=0){treeCorrectRowData(row.childs,row)}})};jControls.Tree=Class.create(jControls.Control,{data:null,rowCollapsed:null,rowDom:null,rowExpanded:null,alternateRow:function(row){if(Object.isUndefined(row)){return}if(row.expanded){this.collapseRow(row)}else{this.expandRow(row)}treeUpdateRowClassAlternate(this)},collapseRow:function(row,anim){if(Object.isUndefined(row)){return}if(this.listeners.onBeforeCollapseNode&&this.listeners.onBeforeCollapseNode(this,row)===false){return}row.expanded=false;if(this.rowCollapsed.indexOf(row.id)==-1){this.rowCollapsed.push(row.id)}this.rowExpanded=this.rowExpanded.without(row.id);this.setCookie();this.setChildVisibleState(row,false,anim);this.rowDom[row._index].dom.removeClass("jcTree-row-expanded").addClass("jcTree-row-collapsed");if(this.listeners.onAfterCollapseNode){this.listeners.onAfterCollapseNode(this,row)}},collapseRows:function(row){if(Object.isUndefined(row)){this.data.each(function(child){this.collapseRows(child)},this);return}if(row.expanded){this.collapseRow(row,false)}if(row.childs&&row.childs.length!=0){row.childs.each(function(child){this.collapseRows(child)},this)}},deleteRow:function(row){if(row.childs&&row.childs.length!=0){row.childs.each(function(child){this.deleteRow(child)},this)}if(!row.parent.xType&&row.parent.childs.length==1){var dom=this.rowDom[row.parent._index].dom;dom.down(".jcTree-elbow-childs").remove();dom.down(".jcTree-symbol-node").removeClass("jcTree-symbol jcTree-symbol-node").addClass("jcTree-spacer").writeAttribute("onclick");dom.down(".jcTree-symbol-folder").removeClass("jcTree-symbol-folder").addClass("jcTree-symbol-item");dom.down(".jcTree-folder").removeClass("jcTree-folder").addClass("jcTree-item");dom.writeAttribute("ondblclick")}this.rowExpanded=this.rowExpanded.without(row.id);this.rowCollapsed=this.rowCollapsed.without(row.id);this.setCookie();if(!Object.isUndefined(row._index)&&this.rowDom[row._index].rendered){this.rowDom[row._index].dom.remove()}row.parent.childs.splice(row._childIndex,1);row.parent.childs.each(function(child,index){child._childIndex=index})},expandRow:function(row,anim){if(Object.isUndefined(row)||row.expanded){return}if(row.parent&&row.parent.xType!=jControls.Tree.xType){this.expandRow(row.parent,anim)}if(this.listeners.onBeforeExpandNode&&this.listeners.onBeforeExpandNode(this,row)===false){return}row.expanded=true;this.rowCollapsed=this.rowCollapsed.without(row.id);if(this.rowExpanded.indexOf(row.id)==-1){this.rowExpanded.push(row.id)}this.setCookie();if(row.childs&&row.expanded){var prevRow=row;row.childs.each(function(child,childIndex){child.deep=row.deep+1;child.parent=row;child._childIndex=childIndex;child.last=(child._childIndex+1)==row.childs.length;prevRow=this.renderRow(child,prevRow,false,true)},this)}this.setChildVisibleState(row,true,anim);this.rowDom[row._index].dom.removeClass("jcTree-row-collapsed").addClass("jcTree-row-expanded");if(this.listeners.onAfterExpandNode){this.listeners.onAfterExpandNode(this,row)}},expandRows:function(row){if(Object.isUndefined(row)){this.data.each(function(child){this.expandRows(child)},this);return}if(!row.expanded){this.expandRow(row,false)}if(row.childs&&row.childs.length!=0){row.childs.each(function(child){this.expandRows(child)},this)}},findRows:function(column,value,options){if(Object.isUndefined(options)){options={}}if(Object.isUndefined(options.cls)){options.cls="jcTree-row-search"}if(Object.isUndefined(options.match)){options.match=false}if(Object.isUndefined(options.expand)){options.expand=true}if(Object.isUndefined(options.collapse)){options.collapse=false}if(Object.isUndefined(options.multi)){options.multi=true}if(Object.isUndefined(options.scrollTo)){options.scrollTo=true}if(options.cls){this.dom.select("."+options.cls).invoke("removeClass",options.cls)}var result=$A([]);var findRowsSearch=function(rows){rows.find(function(row){if((options.match&&row.data[column].value==value)||(!options.match&&String(row.data[column].value).toLowerCase().indexOf(value.toLowerCase())!=-1)){result.push(row)}if(!options.multi&&result.length!=0){return true}if(row.childs&&row.childs.length!=0){findRowsSearch(row.childs)}})};findRowsSearch(this.data);if(result.length==0){return false}if(options.expand){if(options.collapse){this.collapseRows()}result.each(function(row,index){this.expandRow(row,false);if(options.cls){this.rowDom[row._index].dom.addClass(options.cls)}if(index==0&&options.scrollTo){this.rowDom[row._index].dom.scrollTo()}},this)}if(options.multi){return result}return result[0]},getRowById:function(id,rows){if(Object.isUndefined(rows)){rows=this.data}var result=null;rows.find(function(row){if(row.id==id){result=row;return true}if(row.childs&&row.childs.length!=0){var child=this.getRowById(id,row.childs);if(child){result=child;return true}}return false},this);return result},getRow:function(index){if(typeof index!="string"&&typeof index!="number"){return index}return this.getRowById(index)},getRowPathByColumn:function(row,column,result){if(Object.isUndefined(result)){result=$A([])}result.push(row.data[column].value);if(row.parent.xType!=jControls.Tree.xType){result=this.getRowPathByColumn(row.parent,column,result)}return result},initialize:function($super,options){if(!this.xType){this.xType=jControls.Tree.xType}this.options=options;this.rowDom=[];this.rowExpanded=[];this.rowCollapsed=[];this.options.enterable=(typeof this.options.enterable!="undefined"?this.options.enterable:false);this.options.header=(typeof this.options.header!="undefined"?this.options.header:true);this.options.multiselect=(typeof this.options.multiselect!="undefined"?this.options.multiselect:false);this.options.nodesSelectable=(typeof this.options.nodesSelectable!="undefined"?this.options.nodesSelectable:true);this.options.renderComplete=(typeof this.options.renderComplete!="undefined"?this.options.renderComplete:false);this.options.sortable=(typeof this.options.sortable!="undefined"?this.options.sortable:true);if(this.options.data.xType==jControls.NestedSetContainer.xType){this.data=this.options.data.getTree()}else{this.data=this.options.data}this.columns=$A(options.columns);this._variableColumnWidth=0;var firstVisibleColumn=false;this.columnsId=this.columns.collect(function(column,index){column.type=column.type||"string";column.visible=(typeof column.visible!="undefined"?column.visible:true);column.sortable=(typeof column.sortable!="undefined"?column.sortable:true);this.columns[column.id]=column;if(column.format){column.format=column.format.bind(this.options)}column.style=column.style||{};if(!column.visible){column.style.display="none"}if(column.visible&&!column.style.width){this._variableColumnWidth++}column.firstVisible=false;if(column.visible&&!firstVisibleColumn){firstVisibleColumn=true;column.firstVisible=true;if(Object.isUndefined(this.options.searchColumn)||this.options.searchColumn===true){this.options.searchColumn=column.id}if(Object.isUndefined(this.options.columnElbow)){this.options.columnElbow=column.id}}column.styleText=Object.toStyleString(column.style);return column.id},this);if(this._variableColumnWidth>0){this._variableColumnWidth=Math.floor(100/this._variableColumnWidth)}if(this.options.multiselect){this.value=$A([])}treeCorrectRowData(this.data);if(Object.isUndefined(this.options.buttonCollapseAll)){this.options.buttonCollapseAll=true}if(Object.isUndefined(this.options.buttonExpandAll)){this.options.buttonExpandAll=true}if(this.options.searchColumn){if(Object.isUndefined(this.options.buttons)){this.options.buttons=$A([])}this.options.buttons.unshift({icon:"jcBtn-search",iconDisabled:"jcBtn-search-disabled",enabled:false,text:jControls.Button.TITLE.SEARCH,qtip:jControls.Button.TITLE.SEARCH,cls:"jcBtn-search-container",listeners:{onAfterClick:(function(btn){if(btn.dom.previous().value){this.findRows(this.options.searchColumn,btn.dom.previous().value)}}).bind(this),onAfterRender:(function(btn){Element.insert(btn.dom,{before:"<input type='text' class='jcBtn-search-value' title='"+jControls.Button.TITLE.SEARCHTIPP+"' onclick='event.stop();'/>"});btn.dom.previous().on("keyup",function(e){var value=btn.dom.previous().value;btn.setEnabled(value!="");if(e.keyCode==13){this.findRows(this.options.searchColumn,value)}else if(value.length>=jControls.Tree.MINSEARCHSIGN){this.findRows(this.options.searchColumn,value,{collapse:true,scrollTo:false})}},this)}).bind(this)}})}if(this.options.buttonExpandAll){if(Object.isUndefined(options.buttons)){this.options.buttons=$A([])}this.options.buttons.unshift({icon:"jcBtn-expand-all",iconDisabled:"jcBtn-expand-all-disabled",text:jControls.Button.TITLE.EXPANDALL,qtip:jControls.Button.TITLE.EXPANDALL,listeners:{onAfterClick:(function(){this.expandRows()}).bind(this)}})}if(this.options.buttonCollapseAll){if(Object.isUndefined(this.options.buttons)){this.options.buttons=$A([])}this.options.buttons.unshift({icon:"jcBtn-collapse-all",iconDisabled:"jcBtn-collapse-all-disabled",text:jControls.Button.TITLE.COLLAPSEALL,qtip:jControls.Button.TITLE.COLLAPSEALL,listeners:{onAfterClick:(function(){this.data[0].childs.each(function(child){this.collapseRows(child)},this);this.dom.scrollTo()}).bind(this)}})}$super(options)},invertSelection:function(){if(!this.options.multiselect){return this}if(this.value==null){this.value=$A([])}var findAll=(function(rows){rows.each(function(row){if(this.value.indexOf(row.id)==-1){this.selectValue(row)}else{this.unselectValue(row)}if(row.childs&&row.childs.length!=0){findAll(row.childs)}},this)}).bind(this);findAll(this.data);return this},isRowRendered:function(row){return(this.rowDom[row._index]?this.rowDom[row._index].rendered:false)},isRowSelected:function(row){if(!this.options.multiselect){return this.value==row.id}if(!this.value||this.value.constructor!==Array){return false}if(!row){return false}return(this.value.indexOf(row.id)!=-1?true:false)},moveRowDown:function(row){if(row._childIndex==(row.parent.xType?row.parent.data:row.parent.childs).length-1){return this}var rowOther=(row.parent.xType?row.parent.data:row.parent.childs)[row._childIndex+1];if(this.listeners.onBeforeRowMove&&this.listeners.onBeforeRowMove(this,row,"down")===false){return this}if(this.listeners.onBeforeRowMove&&this.listeners.onBeforeRowMove(this,rowOther,"up")===false){return this}row.parent.childs[row._childIndex+1]=row;row.parent.childs[row._childIndex]=rowOther;rowOther._childIndex=row._childIndex;row._childIndex=row._childIndex+1;this.updateRows();if(this.listeners.onAfterRowMove){this.listeners.onAfterRowMove(this,row,"down");this.listeners.onAfterRowMove(this,rowOther,"up")}return this},moveRowLeft:function(row){if(row.deep==0){return this}var rowOtherDown=(row.parent.parent.xType?this.data:row.parent.parent.childs).findAll(function(child){return child._childIndex>row.parent._childIndex});var rowOtherUp=row.parent.childs.findAll(function(child){return child._childIndex>row._childIndex});if(this.listeners.onBeforeRowMove){if(this.listeners.onBeforeRowMove(this,row,"left")===false){return this}if(rowOtherDown.find(function(child){return this.listeners.onBeforeRowMove(this,child,"down")===false},this)){return this}if(rowOtherUp.find(function(child){return this.listeners.onBeforeRowMove(this,child,"up")===false},this)){return this}}row.parent.childs.splice(row._childIndex,1);row.parent.childs.each(function(child,index){child._childIndex=index});(row.parent.parent.xType?this.data:row.parent.parent.childs).splice(row.parent._childIndex+1,0,row);(row.parent.parent.xType?this.data:row.parent.parent.childs).each(function(child,index){child._childIndex=index});row.parent=row.parent.parent;this.updateRows();if(this.listeners.onAfterRowMove){this.listeners.onAfterRowMove(this,row,"left");rowOtherDown.each(function(child){this.listeners.onAfterRowMove(this,child,"down")},this);rowOtherUp.each(function(child){this.listeners.onAfterRowMove(this,child,"up")},this)}return this},moveRowRight:function(row){if(row._childIndex==(row.parent.xType?row.parent.data:row.parent.childs).length-1){return this}var rowOtherUp=(row.parent.xType?row.parent.data:row.parent.childs).findAll(function(child){return child._childIndex>row.parent._childIndex});var rowInsert=row.parent.childs[row._childIndex+1];if(!rowInsert.childs||!Object.isArray(rowInsert.childs)){rowInsert.childs=$A([])}var rowOtherDown=rowInsert.childs;if(this.listeners.onBeforeRowMove){if(this.listeners.onBeforeRowMove(this,row,"right")===false){return this}if(rowOtherUp.find(function(child){return this.listeners.onBeforeRowMove(this,child,"up")===false},this)){return this}if(rowOtherDown.find(function(child){return this.listeners.onBeforeRowMove(this,child,"down")===false},this)){return this}}(row.parent.xType?row.parent.data:row.parent.childs).splice(row._childIndex,1);(row.parent.xType?row.parent.data:row.parent.childs).each(function(child,index){child._childIndex=index});rowInsert.childs.splice(0,0,row);rowInsert.childs.each(function(child,index){child._childIndex=index});row.parent=rowInsert;this.updateRows();if(this.listeners.onAfterRowMove){this.listeners.onAfterRowMove(this,row,"left");rowOtherDown.each(function(child){this.listeners.onAfterRowMove(this,child,"down")},this);rowOtherUp.each(function(child){this.listeners.onAfterRowMove(this,child,"up")},this)}return this},moveRowUp:function(row){if(row._childIndex==0){return this}var rowOther=row.parent.childs[row._childIndex-1];if(this.listeners.onBeforeRowMove&&this.listeners.onBeforeRowMove(this,row,"up")===false){return this}if(this.listeners.onBeforeRowMove&&this.listeners.onBeforeRowMove(this,rowOther,"down")===false){return this}row.parent.childs[row._childIndex-1]=row;row.parent.childs[row._childIndex]=rowOther;rowOther._childIndex=row._childIndex;row._childIndex=row._childIndex-1;this.updateRows();if(this.listeners.onAfterRowMove){this.listeners.onAfterRowMove(this,row,"up");this.listeners.onAfterRowMove(this,rowOther,"down")}return this},render:function($super,renderTo){var parents=null;var html="";var cookie=null;if(this.rendered){return this}renderTo=$(renderTo);renderTo=renderTo&&renderTo.nodeType==1?renderTo:renderTo.dom;if(this.xType==jControls.Tree.xType&&this.listeners.onBeforeRender&&this.listeners.onBeforeRender(this)===false){return this}cookie=this.getCookie();if(this.options.sortable&&cookie.sorted&&this.columns[cookie.sortBy]){this.options.sortBy=cookie.sortBy;this.options.sort=cookie.sortOrder}if(cookie.rowExpanded&&cookie.rowCollapsed){this.rowExpanded=$A(cookie.rowExpanded);this.rowCollapsed=$A(cookie.rowCollapsed)}if(this.options.sortable&&this.options.sort){this.sort(this.options.sortBy||this.columnsId[0],this.options.sort)}else{}if(this.xType==jControls.Tree.xType){parents=renderTo.toggleDisplayed()}$super(renderTo);if(this.name&&this.name!=""&&!this.options.multiselect){html=html+"<input type='hidden' name='"+this.name+"' value='"+(this.value||"")+"' />"}if(this.options.header){if(Object.isArray(this.options.columnStyles)){html=html+renderHeaderComplex(this)}else{html=html+renderHeaderSimple(this)}}html=html+"<div class='jcTree-scroller'><div class='jcTree-body'></div></div>";if(this.options.footer){html=html+renderFooter(this)}this._gBody=Element.insert(this.dom,{bottom:html}).down(".jcTree-body");correctBodyHeight(this);this.data.each(function(row,rowIndex){row._childIndex=rowIndex;row.last=(row._childIndex+1)==this.data.length;this.renderRow(row,this._gBody)},this);if(this.name&&this.name!=""&&!this.options.multiselect){this.inputContainer=this.dom.down("input",0)}this.setSortColumn.bind(this).defer(this.options.sortBy,this.options.sort);if(this.xType==jControls.Tree.xType){renderTo.toggleDisplayed(parents);if(this.listeners.onAfterRender){this.listeners.onAfterRender.defer(this)}}return this},renderRow:function(row,renderTo,valueShow,renderHidden){row._index=row._index||this.rowDom.length;row.deep=row.deep||0;row.parent=row.parent||this;row.id=row.id||this.rowDom.length;if(typeof this.rowDom[row._index]=="undefined"){this.rowDom[row._index]={rendered:false,dom:null}}if(!valueShow&&this.rowDom[row._index].rendered){return}row.visible=(typeof row.visible!="undefined"?row.visible:true);if(!valueShow&&this.listeners.onBeforeRenderNode&&this.listeners.onBeforeRenderNode(this,row)===false){return}if(!Object.isUndefined(this.options.expandNodes)&&Object.isUndefined(row.expanded)){row.expanded=this.options.expandNodes}if(this.rowCollapsed.indexOf(row.id)!=-1){row.expanded=false}else if(this.rowExpanded.indexOf(row.id)!=-1){row.expanded=true}var tdhtml="";this.columns.each(function(column,columnIndex){if(typeof row.data[column.id]!="object"){row.data[column.id]={value:row.data[column.id]}}var cell=row.data[column.id];if(Object.isUndefined(cell.visible)){cell.visible=true}var subHtmlSpacer="";var subHtmlelBow="";var subHtmlSymbols="";if(this.options.columnElbow==column.id){subHtmlSpacer="<div class='jcTree-spacer'></div><div class='jcTree-spacer'></div>";if(row.deep!=0){for(var i=0;i<row.deep;i++){var parentRow=row.parent;for(var j=0;j<(row.deep-i-1);j++){parentRow=parentRow.parent}subHtmlSpacer=subHtmlSpacer+"<div class='jcTree-spacer'></div>";subHtmlSymbols=subHtmlSymbols+"<div class='jcTree-spacer'></div>";if(parentRow.last){subHtmlelBow=subHtmlelBow+"<div class='jcTree-spacer'></div>"}else{subHtmlelBow=subHtmlelBow+"<div class='jcTree-elbow jcTree-elbow-line'></div>"}}}subHtmlelBow=subHtmlelBow+"<div class='jcTree-elbow jcTree-elbow-node"+(row.last?"-end":"")+"'></div>"+"<div class='jcTree-elbow jcTree-elbow-item'></div>";if(row.childs&&row.childs.length!=0){subHtmlelBow=subHtmlelBow+"<div class='jcTree-elbow jcTree-elbow-childs'></div>";subHtmlSymbols=subHtmlSymbols+"<div class='jcTree-symbol jcTree-symbol-node' onclick='jControls.$(\""+this.id+"\").alternateRow($(this).up(\".jcTree-row\")._jcTreeRow);event.stop();'></div>"}else{subHtmlSymbols=subHtmlSymbols+"<div class='jcTree-spacer'></div>"}subHtmlSymbols=subHtmlSymbols+"<div class='jcTree-symbol jcTree-symbol-icon'></div>";subHtmlelBow="<div class='jcTree-container-elbow'>"+subHtmlelBow+"</div>";subHtmlSymbols="<div class='jcTree-container-symbol jcTree-symbol-"+(row.childs&&row.childs.length!=0?"folder":"item")+"'>"+subHtmlSymbols+"</div>"}tdhtml=tdhtml+"<td"+(cell.id?" id='"+cell.id+"'":"")+" class='"+"jcTree-col "+"jcTree-cell "+"jcTree-cell-td-"+column.id+" "+"jcTree-cell-td-"+columnIndex+" "+(columnIndex==0?"jcTree-cell-td-first":"")+" "+(columnIndex==this.columns.length-1?" jcTree-cell-td-last":"")+" "+(cell.cls?cell.cls:"")+" "+(column.firstVisible&&Object.isArray(row.childs)&&row.childs.length!=0?"jcTree-folder":"jcTree-item")+"'"+" style='"+column.styleText+" "+Object.toStyleString(cell.style)+" "+(!cell.visible?"display:none;":"")+(cell.visible&&column.visible&&!column.style.width?"width:"+this._variableColumnWidth+"%;":"")+"'"+(cell.qtip?"title='"+cell.qtip+"'":"")+">"+subHtmlSpacer+subHtmlelBow+subHtmlSymbols+"<div"+" class='jcTree-cell-inner jcTree-cell-inner-"+column.id+" jcTree-cell-inner-"+columnIndex+(columnIndex==0?" jcTree-cell-inner-first":"")+(columnIndex==this.columns.length-1?" jcTree-cell-inner-last":"")+"'"+">"+(column.format?column.format(cell.value):cell.value)+"</div>"+"</td>"},this);var rowStyle=Object.clone(row.style||{});rowStyle.width="100%";if(renderHidden||(!valueShow&&!row.visible)){rowStyle.display="none"}tdhtml="<div"+(!valueShow&&row.domId?" id='"+row.domId+"'":"")+" class='"+"jcTree-row"+" jcTree-level-"+row.deep+(row._childIndex==0?" jcTree-row-first-child":"")+(row.last?" jcTree-row-last-child":"")+(!valueShow&&row._index%2?" jcTree-row-alt":"")+(row.childs&&row.childs.length!=0&&row.expanded?" jcTree-row-expanded":"")+(row.childs&&row.childs.length!=0&&!row.expanded?" jcTree-row-collapsed":"")+(!valueShow&&this.isRowSelected(row)?" jcTree-row-selected":"")+(row.cls?" "+row.cls:"")+"'"+(!Object.isUndefined(row.qtip)&&!valueShow?" title='"+row.qtip+"'":"")+" style='"+Object.toStyleString(rowStyle)+"'"+(row.childs&&row.childs.length!=0?" ondblclick='jControls.$(\""+this.id+"\").alternateRow(this._jcTreeRow);event.stop();'":"")+">"+"<table cellspacing='0' cellpadding='0' border='0' class='jcTree-row-table' style='width:100%;'>"+"<tbody>"+"<tr>"+tdhtml+"</tr>"+"</tbody>"+"</table>"+"</div>";if(Object.isElement(renderTo)){var rowDom=Element.insert(renderTo,{bottom:tdhtml}).childElements().last()}else{Element.insert(this.rowDom[renderTo._index].dom,{after:tdhtml});var rowDom=this.rowDom[renderTo._index].dom.next()}rowDom._jcTreeRow=row;if(!valueShow){(function(){if(this.listeners.onMouseOverRow){Event.observe(rowDom,"mouseover",(function(e){if(row._pe){row._pe.stop()}row._pe=new PeriodicalExecuter((function(){row._pe.stop();this.listeners.onMouseOverRow(this,row)}).bind(this),0.1)}).bindAsEventListener(this))}if(this.listeners.onMouseOutRow){Event.observe(rowDom,"mouseout",(function(e){if(row._pe){row._pe.stop()}row._pe=new PeriodicalExecuter((function(){row._pe.stop();this.listeners.onMouseOutRow(this,row)}).bind(this),0.1)}).bindAsEventListener(this))}if(this.listeners.onMouseMoveRow){Event.observe(rowDom,"mousemove",(function(e){if(row._pe){row._pe.stop()}row._pe=new PeriodicalExecuter((function(){row._pe.stop();this.listeners.onMouseMoveRow(e,this,row)}).bind(this),0.1)}).bindAsEventListener(this))}if(this.listeners.onBeforeClickRow||this.listeners.onAfterClickRow||this.enterable){Event.observe(rowDom,"click",(function(e){if(ONCLICK_IGNORE_ELEMENTTAG.indexOf(e.element().tagName.toUpperCase())!=-1){return}if(this.listeners.onBeforeClickNode&&this.listeners.onBeforeClickNode(this,row)===false){return}if(this.enterable&&this.enabled){this.setValue(row)}if(this.listeners.onAfterClickNode){this.listeners.onAfterClickNode.defer(this,row)}}).bindAsEventListener(this))}}).bind(this).defer()}if(!valueShow){this.rowDom[row._index].rendered=true;this.rowDom[row._index].dom=rowDom;if(this.listeners.onAfterRenderNode){this.listeners.onAfterRenderNode.defer(this,row,rowDom)}}var prevRow=row;if(!valueShow&&row.childs&&(row.expanded||this.options.renderComplete)){row.childs.each(function(child,childIndex){child.deep=row.deep+1;child.parent=row;child._childIndex=childIndex;child.last=(child._childIndex+1)==row.childs.length;if(this.options.renderComplete&&!row.expanded){prevRow=this.renderRow(child,prevRow,valueShow,true)}else{prevRow=this.renderRow(child,prevRow,valueShow,renderHidden)}},this)}return prevRow},scrollTo:function(row){var row=this.getRow(row);if(Object.isUndefined(row._index)||Object.isUndefined(this.rowDom[row._index])||!this.rowDom[row._index].dom){return}var dom=this.rowDom[row._index].dom;var scroller=this.dom.down(".jcTree-scroller");scroller.scrollTop=0;scroller.scrollTop=dom.getY()-scroller.getY()-(!Prototype.Browser.isIE?dom.getBorderWidth("t"):0);return this},selectAll:function(){if(!this.options.multiselect){return this}var findAll=(function(rows){rows.each(function(row){this.selectValue(row);if(row.childs&&row.childs.length!=0){findAll(row.childs)}},this)}).bind(this);findAll(this.data)},selectNone:function(){if(this.value==null){this.value=$A([])}if(this.value.length==0){return this}if(this.listeners.onBeforeChange&&this.listeners.onBeforeChange(this,this.value,$A([]))===false){return this}this.value=$A([]);if(this.listeners.onChange){this.listeners.onChange.defer(this,this.value,this.initialized)}this.setSelection();return this},selectValue:function(value){if(!this.options.multiselect){return this.setValue(value)}if(this.value==null){this.value=$A([])}if(Object.isArray(value)){value=value.findAll(function(newvalue){return this.value.indexOf(typeof newvalue.id!="undefined"?newvalue.id:newvalue)==-1},this);if(value.find(function(nvalue){var newValue=this.getRow(nvalue);if(!newValue){return}if(!this.options.nodesSelectable&&newValue.childs&&newValue.childs.length!=0){return}if(this.listeners.onBeforeChange&&this.listeners.onBeforeChange(this,this.value,nvalue)===false){return true}var oldValue=this.value;this.value.push(newValue.id);this.renderValue(oldValue,this.value);if(this.listeners.onChange){this.listeners.onChange.defer(this,value,this.initialized)}},this))return this;this.setSelection()}else{var newValue=this.getRow(value);if(!newValue){return}if(!this.options.nodesSelectable&&newValue.childs&&newValue.childs.length!=0){return}if(this.value.find(function(selValue){return selValue==newValue.id})){return this}if(this.listeners.onBeforeChange&&this.listeners.onBeforeChange(this,this.value,value)===false){return this}var oldValue=this.value;this.value.push(newValue.id);this.renderValue(oldValue,this.value);if(this.listeners.onChange){this.listeners.onChange.defer(this,value,this.initialized)}this.setSelection()}return this},setChildVisibleState:function(row,visible,anim,elements){if(Object.isUndefined(anim)){anim=true}if(row.childs&&row.childs.length!=0){var els=elements||$A([]);row.childs.each(function(child,childIndex){if(!Object.isUndefined(child._index)&&!Object.isUndefined(this.rowDom[child._index])){els.push(this.rowDom[child._index].dom);if(!visible||(visible&&child.expanded)){this.setChildVisibleState(child,visible,anim,els)}}},this);if(Object.isUndefined(elements)){els.each(function(element){if(anim){element[visible?"blindDown":"blindUp"]({duration:0.5,transition:Effect.Transitions.sinoidal})}else{element[visible?"show":"hide"]()}})}}},setCookie:function($super,options){if(!this.options.ajax){options=Object.extend(options||{},{sorted:this.sortBy!=null,sortBy:this.sortBy,sortOrder:this.sortOrder,rowCollapsed:this.rowCollapsed,rowExpanded:this.rowExpanded})}return $super(options)},setSelection:function(row){if(!this.rendered){return this}if(!this.options.multiselect){if(!row){row=this.value}if(row!=null){row=this.getRow(row);if(!row){return this}this.dom.down(".jcTree-row").removeClass("jcTree-row-selected").nextSiblings().invoke("removeClass","jcTree-row-selected");var rowNode=(row._index==0?this.dom.down(".jcTree-body").down(".jcTree-row"):this.dom.down(".jcTree-body").down(".jcTree-row").nextSiblings()[row._index-1]);if(rowNode){rowNode.addClass("jcTree-row-selected")}}else{this.dom.down(".jcTree-row").removeClass("jcTree-row-selected").nextSiblings().invoke("removeClass","jcTree-row-selected")}}else if(Object.isArray(this.value)){this.dom.select(".jcTree-row-selected").invoke("removeClass","jcTree-row-selected");if(!Object.isUndefined(this.name)&&this.name!=""){this.dom.select(".jcTree-input-multiselect").invoke("remove")}this.value.each(function(selValue){var rowValue=this.getRow(selValue);if(!Object.isUndefined(rowValue._index)&&!Object.isUndefined(this.rowDom[rowValue._index])){this.rowDom[rowValue._index].dom.addClass("jcTree-row-selected")}if(!Object.isUndefined(this.name)&&this.name!=""){new jControls.Container({type:"input",cls:"jcTree-input-multiselect",attributes:{type:"hidden",name:this.name,value:selValue},renderTo:this})}},this)}else{this.dom.select(".jcTree-row-selected").invoke("removeClass","jcTree-row-selected")}return this},setSortColumn:function(columnId,direction){var headers=this.dom.down(".jcTree-header");if(!headers){return}this.sortBy=columnId;this.sortOrder=direction;headers.select(".jcSort-asc",".jcSort-desc").invoke("removeClass","jcSort-asc jcSort-desc");if(this.sortBy!=null&&this.sortOrder!=null){headers.down(".jcTree-header-hd-"+this.sortBy).addClass("jcSort-"+this.sortOrder)}},setValue:function($super,value,initialized){if(this.options.multiselect){if(value&&value.constructor===Array){value.each(function(newvalue){this.setValue(newvalue)},this);return this}else{return(this.isRowSelected(this.getRow(value))?this.unselectValue(value):this.selectValue(value))}}if(value!=null&&!Object.isUndefined(value)){var newValue=(typeof value=="object"?value:this.getRow(value));if(newValue){if(!this.options.nodesSelectable&&newValue.childs&&newValue.childs.length!=0){return}$super(newValue.id,initialized);this.setSelection(newValue)}else{this.setValue(null)}}else{$super(value,initialized);this.setSelection(null)}return this},sort:function(sortBy,order){if(this.listeners.onBeforeSort&&this.listeners.onBeforeSort(this,sortBy,order)===false){return}this.sortBy=sortBy;this.sortOrder=(order||"asc").toLowerCase();if(this.rendered){this.setCookie()}if(this.listeners.onAfterSort){this.listeners.onAfterSort.defer(this,sortBy,order)}},unselectValue:function(value){if(!this.options.multiselect){return this.setValue(null)}if(this.value==null){return this}if(Object.isArray(value)){value.each(function(newvalue){this.unselectValue(newvalue)},this);return this}var newValue=this.getRow(value);if(!newValue){return}if(!this.value.find(function(selValue){return selValue==newValue.id}))return this;if(this.listeners.onBeforeChange&&this.listeners.onBeforeChange(this,this.value,value)===false){return this}var oldValue=this.value;this.value=this.value.without(newValue.id);this.renderValue(oldValue,this.value);if(this.listeners.onChange){this.listeners.onChange.defer(this,value,this.initialized)}this.setSelection()},updateRows:function(){this.dom.select(".jcTree-row").invoke("remove");this.rowDom=$A([]);this.data.each(function(row,rowIndex){row._childIndex=rowIndex;row.last=(row._childIndex+1)==this.data.length;this.renderRow(row,this._gBody)},this)}});jControls.Tree.MINSEARCHSIGN=3;jControls.Tree.xType=xTypes.Tree;var calendarEffectSlidePrepare=function(calendar,displayView,element,anim){if(Prototype.Browser.isIE6||Math.abs(anim)!=1||calendar.displayView!=displayView){return}calendar.effect=true;var effectElement=element.down(".jcCalendar-effect");var effectElementParent=effectElement.up();effectElementParent.setStyle({width:effectElementParent.getWidth()+"px",height:effectElementParent.getHeight()+"px",position:"relative"});effectElement.setStyle({left:"0px",top:"0px",width:effectElement.getWidth()+"px",height:effectElement.getHeight()+"px",position:"absolute"});return $(effectElement.cloneNode(true))};var calendarEffectSlideRun=function(calendar,displayView,element,effectElementClone,anim){if(Prototype.Browser.isIE6||Math.abs(anim)!=1||calendar.displayView!=displayView){return}var effectElement=element.down(".jcCalendar-effect");var effectElementParent=effectElement.up();effectElementParent.insertTop(effectElementClone.addClass("this-is-the-clone"));effectElement.setX(effectElementClone.getX()-1*anim*effectElementClone.getWidth());Effect.multiple([effectElementClone,effectElement],Effect.Move,{x:effectElementClone.getWidth()*anim,y:0,mode:"relative",speed:0,delay:0,duration:0.3,afterFinish:function(effect){if(!calendar.effect){return}effectElementParent.clearStyle("width height position");effectElement.clearStyle("left top width height position");effectElementClone.remove();calendar.effect=false}})};var calendarEffectSwitchViewDown=function(calendar,displayView,oldView,newView,newSelected){if(Prototype.Browser.isIE6){oldView.hide();newView.show();return}if(calendar.effect){return}calendar.displayView=displayView;calendar.effect=true;newSelected=newView.down(".jcCalendar-entry-index-"+Math.abs(newSelected));var effectContainer=oldView.up(".jcCalendar-effect-parent");effectContainer.setStyle({width:effectContainer.getWidth()+"px",height:effectContainer.getHeight()+"px",overflow:"hidden"});newView.show().setStyle({position:"absolute",left:(newSelected?newSelected.getX():calendar.dom.getX()-5)+"px",top:(newSelected?newSelected.getY():calendar.dom.getY()-5)+"px",width:(newSelected?newSelected.getWidth():calendar.dom.getX()+5)+"px",height:(newSelected?newSelected.getHeight():calendar.dom.getY()+5)+"px",overflow:"hidden"}).setOpacity(0);oldView.setStyle({position:"absolute",left:"0px",top:"0px",width:oldView.getWidth()+"px",height:oldView.getHeight()+"px",overflow:"hidden"});new Effect.Parallel([new Effect.Morph(oldView,{sync:true,style:{left:(-1*oldView.getWidth()*1.25/4)+"px",top:(-1*oldView.getHeight()*1.25/4)+"px",width:(oldView.getWidth()*1.25)+"px",height:(oldView.getHeight()*1.25)+"px"}}),new Effect.Fade(oldView,{sync:true,from:1,to:0}),new Effect.Morph(newView,{sync:true,style:{left:"0px",top:"0px",width:oldView.getWidth()+"px",height:oldView.getHeight()+"px"}}),new Effect.Appear(newView,{sync:true,from:0,to:1})],{duration:0.5,delay:0.0,beforeStart:function(){effectContainer.down(".jcCalender-effect-overlay").show()},afterFinish:function(effect){if(!calendar.effect){return}effectContainer.down(".jcCalender-effect-overlay").hide();oldView.hide();oldView.clearStyle("left top width height position overflow");newView.clearStyle("left top width height position overflow");effectContainer.clearStyle("width height overflow");calendar.effect=false}})};var calendarEffectSwitchViewUp=function(calendar,displayView,oldView,newView,oldSelected){if(Prototype.Browser.isIE6){oldView.hide();newView.show();return}if(calendar.effect){return}calendar.displayView=displayView;calendar.effect=true;oldSelected=oldView.down(".jcCalendar-entry-index-"+Math.abs(oldSelected));var effectContainer=oldView.up(".jcCalendar-effect-parent");effectContainer.setStyle({width:effectContainer.getWidth()+"px",height:effectContainer.getHeight()+"px",overflow:"hidden"});newView.show().setStyle({position:"absolute",left:(-1*newView.getWidth()*1.25/4)+"px",top:(-1*newView.getHeight()*1.25/4)+"px",width:(newView.getWidth()*1.25)+"px",height:(newView.getHeight()*1.25)+"px",overflow:"hidden"}).setOpacity(0);oldView.setStyle({position:"absolute",left:"0px",top:"0px",width:oldView.getWidth()+"px",height:oldView.getHeight()+"px",overflow:"hidden"});new Effect.Parallel([new Effect.Morph(oldView,{sync:true,style:{left:(oldSelected?oldSelected.getX():calendar.dom.getX()-5)+"px",top:(oldSelected?oldSelected.getY():calendar.dom.getY()-5)+"px",width:(oldSelected?oldSelected.getWidth():calendar.dom.getX()+5)+"px",height:(oldSelected?oldSelected.getHeight():calendar.dom.getY()+5)+"px"}}),new Effect.Fade(oldView,{sync:true,from:1,to:0}),new Effect.Morph(newView,{sync:true,style:{left:"0px",top:"0px",width:oldView.getWidth()+"px",height:oldView.getHeight()+"px"}}),new Effect.Appear(newView,{sync:true,from:0,to:1})],{duration:0.5,delay:0.0,beforeStart:function(){effectContainer.down(".jcCalender-effect-overlay").show()},afterFinish:function(effect){if(!calendar.effect){return}effectContainer.down(".jcCalender-effect-overlay").hide();oldView.hide();oldView.clearStyle("left top width height position overflow");newView.clearStyle("left top width height position overflow");effectContainer.clearStyle("width height overflow");calendar.effect=false}})};var calendarRenderViewBasics=function(options){Element.insert(options.calendar.dom.down(".jcCalendar-effect-parent"),{bottom:"<div class='jcCalendar-view-"+options.suffix+"'>"+(options.calendar.options.selectable>=options.displayView?"<div class='jcCalendar-select-upper'>"+"<div class='jcCalendar-select-prev'></div>"+"<div class='jcCalendar-select-next'></div>"+"<div class='jcCalendar-select-current'></div>"+"<div class='jcClear'></div>"+"</div>"+"<div class='jcCalendar-effect-parent'>"+"<div class='jcCalendar-effect'>"+options.html+"</div>"+"</div>":"")+"</div>"});var element=options.calendar.dom.down(".jcCalendar-view-"+options.suffix);if(options.calendar.options.selectable<options.displayView){return element}element.down(".jcCalendar-select-prev").on({click:function(){if(options.calendar.effect){return}var date=options.calendar.displayValue.sub(options.interval.type,options.interval.value);if(!date.between(options.calendar.options.date.min,options.calendar.options.date.max)){date=options.calendar.options.date.min.clone()}if(options.listeners.prevBeforeClick&&options.listeners.prevBeforeClick(options.calendar,date)===false){return}options.calendar.renderValue(date.add(options.interval.type,options.interval.value),date,true);if(options.listeners.prevAfterClick){options.listeners.prevAfterClick(options.calendar,date)}}});element.down(".jcCalendar-select-next").on({click:function(){if(options.calendar.effect){return}var date=options.calendar.displayValue.add(options.interval.type,options.interval.value);if(!date.between(options.calendar.options.date.min,options.calendar.options.date.max)){date=options.calendar.options.date.max.clone()}if(options.listeners.nextAfterClick&&options.listeners.nextAfterClick(options.calendar,date)===false){return}options.calendar.renderValue(date.sub(options.interval.type,options.interval.value),date,true);if(options.listeners.nextBeforeClick){options.listeners.nextBeforeClick(options.calendar,date)}}});element.select(".jcCalendar-entry").invoke("on",{click:function(){if(options.calendar.effect||this.hasClassName("jcCalendar-entry-disabled")){return}options.listeners.entryClick(Number($w(this.className).find(function(cls){return cls.startsWith("jcCalendar-entry-index-")}).substr("jcCalendar-entry-index-".length)),element)}});if(Prototype.Browser.isIE6){element.select(".jcCalendar-entry").invoke("on",{mouseover:function(){if(!this.hasClassName("jcCalendar-entry-disabled")){this.addClass("jcCalendar-entry-hover")}},mouseout:function(){this.removeClass("jcCalendar-entry-hover")}});element.down(".jcCalendar-select-prev").on({mouseover:function(){this.addClass("jcCalendar-select-prev-hover")},mouseout:function(){this.removeClass("jcCalendar-select-prev-hover")}});element.down(".jcCalendar-select-next").on({mouseover:function(){this.addClass("jcCalendar-select-next-hover")},mouseout:function(){this.removeClass("jcCalendar-select-next-hover")}})}return element.hide()};var calendarRenderViewTime=function(calendar){calendar.dayView.down(".jcCalendar-select-upper").insertAfter("<div class='jcCalendar-view-time'>"+"<div class='jcCalendar-time-hour'></div>"+"<div class='jcCalendar-time-separator'>:</div>"+"<div class='jcCalendar-time-minute'></div>"+"<div class='jcClear'></div>"+"</div>");calendar.timeHour=new jControls.Select({renderTo:calendar.dayView.down(".jcCalendar-time-hour"),value:calendar.options.value?calendar.options.value.format("H"):null,data:{header:false,cls:"jcCalendar-select-list-time",columns:[{id:"value",type:"string"}],data:$R(0,23).inject([],function(acc,index){acc.push({id:String.leftPad(index,2,"0"),value:String.leftPad(calendar.options.time.meridiem&&index>11?index-12:index,2,"0")+(calendar.options.time.meridiem?" "+(index<=11?"am":"pm"):"")});return acc})},listeners:{onChange:function(select,value,initialized){if(initialized&&value!=null){if(calendar.value){var date=calendar.displayValue.clone();date.setHours(Number(value));if(!date.isEqual(calendar.value)){calendar.setValue(date)}}else{calendar.displayValue.setHours(Number(value))}}}}});calendar.timeMinute=new jControls.Select({renderTo:calendar.dayView.down(".jcCalendar-time-minute"),value:calendar.options.value?String.leftPad(Math.floor(calendar.options.value.getMinutes()/calendar.options.time.intervalMinute)*calendar.options.time.intervalMinute,2,"0"):null,data:{header:false,cls:"jcCalendar-select-list-time",columns:[{id:"id",type:"string"}],data:$R(0,Math.floor(59/calendar.options.time.intervalMinute)).inject([],function(acc,index){acc.push({id:String.leftPad(index*calendar.options.time.intervalMinute,2,"0")});return acc})},listeners:{onChange:function(select,value,initialized){if(initialized&&value!=null){if(calendar.value){var date=calendar.displayValue.clone();date.setMinutes(Number(value));if(!date.isEqual(calendar.value)){calendar.setValue(date)}}else{calendar.displayValue.setMinutes(Number(value))}}}}})};var calendarRenderViewDays=function(calendar){var element=calendarRenderViewBasics({calendar:calendar,suffix:"days",displayView:jControls.Calendar.SELECTABLE.DAY,interval:{type:Date.MONTH,value:1},listeners:{prevBeforeClick:calendar.listeners.onBeforeMonthPrevClick,prevAfterClick:calendar.listeners.onAfterMonthPrevClick,nextBeforeClick:calendar.listeners.onBeforeMonthNextClick,nextAfterClick:calendar.listeners.onAfterMonthNextClick,entryClick:function(dateIndex){var date=calendar.displayValue.getFirstDateOfMonth().getFirstDateOfWeek().clearTime().add(Date.DAY,dateIndex);if(!date.between(calendar.options.date.min.clearTime(true),calendar.options.date.max.clearTime(true))){return}if(calendar.listeners&&calendar.listeners.onBeforeDayClick&&calendar.listeners.onBeforeDayClick(calendar,date)===false){return}if(calendar.value){date.setHours(calendar.value.getHours());date.setMinutes(calendar.value.getMinutes())}else{date.setHours(calendar.displayValue.getHours());date.setMinutes(calendar.displayValue.getMinutes())}if(!calendar.value||!date.isEqual(calendar.value)){calendar.setValue(date)}if(calendar.listeners&&calendar.listeners.onAfterDayClick){calendar.listeners.onAfterDayClick(calendar,date)}}},html:"<div class='jcCalendar-week-line'>"+Date.dayNames.inject("",function(acc,dayName,index){index=Date.firstDayOfWeek+index-(Date.firstDayOfWeek+index<=6?0:7);return acc+"<div class='jcCalendar-week-entry"+(index==0||index==6?" jcCalendar-entry-weekend":"")+"'>"+Date.getShortDayName(index).substring(0,2)+"</div>"})+"<div class='jcClear'></div>"+"</div>"+$R(0,41).inject('',function(acc,dateIndex){var index=dateIndex%7;if(index==0){if(dateIndex!=0){acc=acc+"<div class='jcClear'></div></div>"}acc=acc+"<div class='jcCalendar-entries-line'>"}index=Date.firstDayOfWeek+index-(Date.firstDayOfWeek+index<=6?0:7);return acc+"<div class='jcCalendar-entry jcCalendar-entry-index-"+dateIndex+(index==0||index==6?" jcCalendar-entry-weekend":"")+"'>"+"<div class='jcCalendar-entry-text'>"+(calendar.displayValue.getFirstDateOfMonth().getFirstDateOfWeek().add(Date.DAY,dateIndex).format("j"))+"</div>"+"</div>"})+"<div class='jcClear'></div></div>"});element.down(".jcCalendar-select-current").on({click:function(){calendarEffectSwitchViewUp(calendar,jControls.Calendar.SELECTABLE.MONTH,element,calendar.monthView,((calendar.displayValue.clearTime(true)-calendar.displayValue.getFirstDateOfMonth().getFirstDateOfWeek().clearTime())/(1000*60*60*24)).round())}});return element};var calendarRenderViewMonths=function(calendar){var element=calendarRenderViewBasics({calendar:calendar,suffix:"months",displayView:jControls.Calendar.SELECTABLE.MONTH,interval:{type:Date.YEAR,value:1},listeners:{prevBeforeClick:calendar.listeners.onBeforeYearPrevClick,prevAfterClick:calendar.listeners.onAfterYearPrevClick,nextBeforeClick:calendar.listeners.onBeforeYearNextClick,nextAfterClick:calendar.listeners.onAfterYearNextClick,entryClick:function(dateIndex){var date=Date.parseDate("01."+String.leftPad(dateIndex+1,2,"0")+"."+calendar.displayValue.getFullYear()).getLastDateOfMonth();if(date<calendar.options.date.min.clearTime(true)||calendar.options.date.max.clearTime(true)<date.getFirstDateOfMonth()){return}date=calendar.displayValue.clone();date.setMonth(dateIndex);while(date.getMonth()!=dateIndex){date=date.sub(Date.DAY,1)}if(date<calendar.options.date.min.clearTime(true)){date=calendar.options.date.min.clone()}if(calendar.options.date.max.clearTime(true)<date){date=calendar.options.date.max.clone()}if(calendar.listeners&&calendar.listeners.onBeforeMonthClick&&calendar.listeners.onBeforeMonthClick(calendar,date)===false){return}if(calendar.value){date.setHours(calendar.value.getHours());date.setMinutes(calendar.value.getMinutes())}else{date.setHours(calendar.displayValue.getHours());date.setMinutes(calendar.displayValue.getMinutes())}if(calendar.options.selectable>jControls.Calendar.SELECTABLE.MONTH){calendar.renderValue(calendar.displayValue,date)}else if(!calendar.value||!date.getFirstDateOfMonth().isEqual(calendar.value)){calendar.setValue(date.getFirstDateOfMonth())}if(calendar.listeners&&calendar.listeners.onAfterMonthClick){calendar.listeners.onAfterMonthClick(calendar,date)}if(calendar.options.selectable>jControls.Calendar.SELECTABLE.MONTH){calendarEffectSwitchViewDown(calendar,jControls.Calendar.SELECTABLE.DAY,element,calendar.dayView,((calendar.displayValue.clearTime(true)-calendar.displayValue.getFirstDateOfMonth().getFirstDateOfWeek().clearTime())/(1000*60*60*24)).round())}}},html:$R(0,11).inject("",function(acc,monthIndex){var index=monthIndex%4;if(index==0){if(monthIndex!=0){acc=acc+"<div class='jcClear'></div></div>"}acc=acc+"<div class='jcCalendar-entries-line'>"}return acc+"<div class='jcCalendar-entry jcCalendar-entry-index-"+monthIndex+"'>"+"<div class='jcCalendar-entry-text'>"+Date.getShortMonthName(monthIndex)+"</div>"+"</div>"})+"<div class='jcClear'></div></div>"});element.down(".jcCalendar-select-current").on({click:function(){calendarEffectSwitchViewUp(calendar,jControls.Calendar.SELECTABLE.YEAR,element,calendar.yearView,calendar.displayValue.getMonth())}});return element};var calendarRenderViewYears=function(calendar){var element=calendarRenderViewBasics({calendar:calendar,suffix:"years",displayView:jControls.Calendar.SELECTABLE.YEAR,interval:{type:Date.YEAR,value:9},listeners:{prevBeforeClick:calendar.listeners.onBeforeYearsPrevClick,prevAfterClick:calendar.listeners.onAfterYearsPrevClick,nextBeforeClick:calendar.listeners.onBeforeYearsNextClick,nextAfterClick:calendar.listeners.onAfterYearsNextClick,entryClick:function(dateIndex,element){var date=Math.floor(calendar.displayValue.getFullYear()/10)*10-1+dateIndex;if(date<calendar.options.date.min.getFullYear||calendar.options.date.max.getFullYear()<date){return}date=Date.parseDate(calendar.displayValue.format("d.m.")+date);if(date<calendar.options.date.min.clearTime(true)){date=calendar.options.date.min.clone()}if(calendar.options.date.max.clearTime(true)<date){date=calendar.options.date.max.clone()}if(calendar.listeners&&calendar.listeners.onBeforeYearClick&&calendar.listeners.onBeforeYearClick(calendar,date)===false){return}if(calendar.value){date.setHours(calendar.value.getHours());date.setMinutes(calendar.value.getMinutes())}else{date.setHours(calendar.displayValue.getHours());date.setMinutes(calendar.displayValue.getMinutes())}if(calendar.options.selectable>jControls.Calendar.SELECTABLE.YEAR){calendar.renderValue(calendar.displayValue,date)}else if(!calendar.value||!date.getFirstDateOfYear().isEqual(calendar.value)){calendar.setValue(date.getFirstDateOfYear())}if(calendar.listeners&&calendar.listeners.onAfterYearClick){calendar.listeners.onAfterYearClick(calendar,date)}if(calendar.options.selectable>jControls.Calendar.SELECTABLE.YEAR){calendarEffectSwitchViewDown(calendar,jControls.Calendar.SELECTABLE.MONTH,element,calendar.monthView,calendar.displayValue.getMonth())}}},html:$R(0,11).inject("",function(acc,yearIndex){var index=yearIndex%4;if(index==0){if(yearIndex!=0){acc=acc+"<div class='jcClear'></div></div>"}acc=acc+"<div class='jcCalendar-entries-line'>"}return acc+"<div class='jcCalendar-entry jcCalendar-entry-index-"+yearIndex+(yearIndex==0||yearIndex==11?" jcCalendar-entry-outofrange":"")+"'>"+"<div class='jcCalendar-entry-text'>"+(yearIndex)+"</div>"+"</div>"})+"<div class='jcClear'></div></div>"});element.down(".jcCalendar-select-current").on({click:function(){calendarEffectSwitchViewUp(calendar,jControls.Calendar.SELECTABLE.DECADE,element,calendar.decadeView,calendar.displayValue.getFullYear()-Math.floor(calendar.displayValue.getFullYear()/10)*10-1)}});return element};var calendarRenderViewDecade=function(calendar){return calendarRenderViewBasics({calendar:calendar,suffix:"decade",displayView:jControls.Calendar.SELECTABLE.DECADE,interval:{type:Date.YEAR,value:100},listeners:{prevBeforeClick:calendar.listeners.onBeforeDecadePrevClick,prevAfterClick:calendar.listeners.onAfterDecadePrevClick,nextBeforeClick:calendar.listeners.onBeforeDecadeNextClick,nextAfterClick:calendar.listeners.onAfterDecadeNextClick,entryClick:function(dateIndex,element){var date=Math.floor(calendar.displayValue.getFullYear()/100)*100-10+dateIndex*10;if(date<calendar.options.date.min.getFullYear||calendar.options.date.max.getFullYear()<date){return}date=Date.parseDate(calendar.displayValue.format("d.m.")+date);if(date<calendar.options.date.min.clearTime(true)){date=calendar.options.date.min.clone()}if(calendar.options.date.max.clearTime(true)<date){date=calendar.options.date.max.clone()}if(calendar.listeners&&calendar.listeners.onBeforeYearClick&&calendar.listeners.onBeforeYearClick(calendar,date)===false){return}if(calendar.value){date.setHours(calendar.value.getHours());date.setMinutes(calendar.value.getMinutes())}else{date.setHours(calendar.displayValue.getHours());date.setMinutes(calendar.displayValue.getMinutes())}if(calendar.options.selectable>jControls.Calendar.SELECTABLE.DECADE){calendar.renderValue(calendar.displayValue,date)}else if(!calendar.value||!date.getFirstDateOfYear().isEqual(calendar.value)){calendar.setValue(date.getFirstDateOfYear())}if(calendar.listeners&&calendar.listeners.onAfterYearClick){calendar.listeners.onAfterYearClick(calendar,date)}if(calendar.options.selectable>jControls.Calendar.SELECTABLE.DECADE){calendarEffectSwitchViewDown(calendar,jControls.Calendar.SELECTABLE.YEAR,element,calendar.yearView,calendar.displayValue.getFullYear()-Math.floor(calendar.displayValue.getFullYear()/10)*10-1)}}},html:$R(0,11).inject("",function(acc,yearIndex){var index=yearIndex%4;if(index==0){if(yearIndex!=0){acc=acc+"<div class='jcClear'></div></div>"}acc=acc+"<div class='jcCalendar-entries-line'>"}return acc+"<div class='jcCalendar-entry jcCalendar-entry-index-"+yearIndex+(yearIndex==0||yearIndex==11?" jcCalendar-entry-outofrange":"")+"'>"+"<div class='jcCalendar-entry-text'>"+(yearIndex)+"</div>"+"</div>"})+"<div class='jcClear'></div></div>"})};var calendarUpdateViewDays=function(calendar,oldValue,anim){if(oldValue==null||anim){calendar.dayView.down(".jcCalendar-select-current").applyTo(calendar.displayValue.format("F Y"));var effectElementClone=calendarEffectSlidePrepare(calendar,jControls.Calendar.SELECTABLE.DAY,calendar.dayView,anim);calendar.dayView.down(".jcCalendar-select-prev")[calendar.displayValue.sub(Date.MONTH,1).getLastDateOfMonth().between(calendar.options.date.min,calendar.options.date.max)?"show":"hide"]().quickTip(calendar.displayValue.sub(Date.MONTH,1).format("F Y"));calendar.dayView.down(".jcCalendar-select-next")[calendar.displayValue.add(Date.MONTH,1).getFirstDateOfMonth().between(calendar.options.date.min,calendar.options.date.max)?"show":"hide"]().quickTip(calendar.displayValue.add(Date.MONTH,1).format("F Y"));calendar.dayView.select(".jcCalendar-entries-line").invoke("hide");calendar.dayView.select(".jcCalendar-entry").invoke("removeClass","jcCalendar-entry-disabled jcCalendar-entry-outofrange jcCalendar-entry-selected jcCalendar-entry-now");$R(calendar.displayValue.getFirstDateOfMonth().getFirstDateOfWeek().clearTime(),calendar.displayValue.getLastDateOfMonth().getLastDateOfWeek().clearTime()).each(function(date,index){var element=calendar.dayView.down(".jcCalendar-entry-index-"+index);element.down(".jcCalendar-entry-text").applyTo(date.format("j"));element.up(".jcCalendar-entries-line").show();if(!date.between(calendar.displayValue.getFirstDateOfMonth().clearTime(),calendar.displayValue.getLastDateOfMonth().clearTime())){element.addClass("jcCalendar-entry-outofrange")}if(date.isEqual((new Date()).clearTime())){element.addClass("jcCalendar-entry-now")}if(calendar.value&&date.isEqual(calendar.value.clearTime(true))){element.addClass("jcCalendar-entry-selected")}if(!date.between(calendar.options.date.min.clearTime(true),calendar.options.date.max.clearTime(true))){element.addClass("jcCalendar-entry-disabled")}});calendarEffectSlideRun(calendar,jControls.Calendar.SELECTABLE.DAY,calendar.dayView,effectElementClone,anim)}else if(oldValue!=null&&!oldValue.isEqual(calendar.displayValue)){if(calendar.dayView.down(".jcCalendar-entry-selected")){calendar.dayView.down(".jcCalendar-entry-selected").removeClass("jcCalendar-entry-selected")}var index=((calendar.displayValue.clearTime(true)-calendar.displayValue.getFirstDateOfMonth().getFirstDateOfWeek().clearTime())/(1000*60*60*24)).round();calendar.dayView.down(".jcCalendar-entry-index-"+index).addClass("jcCalendar-entry-selected")}};var calendarUpdateViewMonths=function(calendar,oldValue,anim){if(oldValue==null||oldValue.getFullYear()!=calendar.displayValue.getFullYear()){calendar.monthView.down(".jcCalendar-select-current").applyTo(calendar.displayValue.format("Y"));var effectElementClone=calendarEffectSlidePrepare(calendar,jControls.Calendar.SELECTABLE.MONTH,calendar.monthView,anim);calendar.monthView.down(".jcCalendar-select-prev")[Date.parseDate("31.12."+(calendar.displayValue.getFullYear()-1)).between(calendar.options.date.min,calendar.options.date.max)?"show":"hide"]().quickTip(calendar.displayValue.getFullYear()-1);calendar.monthView.down(".jcCalendar-select-next")[Date.parseDate("01.01."+(calendar.displayValue.getFullYear()+1)).between(calendar.options.date.min,calendar.options.date.max)?"show":"hide"]().quickTip(calendar.displayValue.getFullYear()+1);calendar.monthView.select(".jcCalendar-entry").invoke("removeClass","jcCalendar-entry-disabled jcCalendar-entry-selected jcCalendar-entry-now");$R(0,11).each(function(index){var date=Date.parseDate("01."+String.leftPad(index+1,2,"0")+"."+calendar.displayValue.getFullYear()).clearTime();var element=calendar.monthView.down(".jcCalendar-entry-index-"+index).quickTip(date.format("F Y"));if(date.isEqual((new Date()).getFirstDateOfMonth().clearTime())){element.addClass("jcCalendar-entry-now")}if(calendar.value&&date.isEqual(calendar.value.getFirstDateOfMonth().clearTime(true))){element.addClass("jcCalendar-entry-selected")}if(!date.between(calendar.options.date.min.getFirstDateOfMonth().clearTime(true),calendar.options.date.max.getLastDateOfMonth().clearTime(true))){element.addClass("jcCalendar-entry-disabled")}});calendarEffectSlideRun(calendar,jControls.Calendar.SELECTABLE.MONTH,calendar.monthView,effectElementClone,anim)}else if(oldValue!=null&&calendar.value&&!oldValue.isEqual(calendar.value)){if(calendar.monthView.down(".jcCalendar-entry-selected")){calendar.monthView.down(".jcCalendar-entry-selected").removeClass("jcCalendar-entry-selected")}if(calendar.value.getFullYear()==calendar.displayValue.getFullYear()){calendar.monthView.down(".jcCalendar-entry-index-"+calendar.value.getMonth()).addClass("jcCalendar-entry-selected")}}};var calendarUpdateViewYears=function(calendar,oldValue,anim){var yearIndex=Math.floor(calendar.displayValue.getFullYear()/10)*10;if(oldValue==null||yearIndex!=Math.floor(oldValue.getFullYear()/10)*10){calendar.yearView.down(".jcCalendar-select-current").applyTo(yearIndex+" - "+(yearIndex+9));var effectElementClone=calendarEffectSlidePrepare(calendar,jControls.Calendar.SELECTABLE.YEAR,calendar.yearView,anim);calendar.yearView.down(".jcCalendar-select-prev")[calendar.options.date.min.getFullYear()<=yearIndex-1?"show":"hide"]().quickTip((yearIndex-10)+" - "+(yearIndex-1));calendar.yearView.down(".jcCalendar-select-next")[yearIndex+10<=calendar.options.date.max.getFullYear()?"show":"hide"]().quickTip((yearIndex+10)+" - "+(yearIndex+19));calendar.yearView.select(".jcCalendar-entry").invoke("removeClass","jcCalendar-entry-disabled jcCalendar-entry-selected jcCalendar-entry-now");$R(0,11).each(function(index){var year=yearIndex-1+index;var element=calendar.yearView.down(".jcCalendar-entry-index-"+index);element.down(".jcCalendar-entry-text").applyTo(year);if(year==(new Date()).getFullYear()){element.addClass("jcCalendar-entry-now")}if(calendar.value&&year==calendar.value.getFullYear()){element.addClass("jcCalendar-entry-selected")}if(year<calendar.options.date.min.getFullYear()||calendar.options.date.max.getFullYear()<year){element.addClass("jcCalendar-entry-disabled")}});calendarEffectSlideRun(calendar,jControls.Calendar.SELECTABLE.YEAR,calendar.yearView,effectElementClone,anim)}else if(oldValue!=null&&calendar.value&&oldValue.getFullYear()!=calendar.value.getFullYear()){if(calendar.yearView.down(".jcCalendar-entry-selected")){calendar.yearView.down(".jcCalendar-entry-selected").removeClass("jcCalendar-entry-selected")}if(0<=calendar.value.getFullYear()-(yearIndex-1)&&calendar.value.getFullYear()-(yearIndex-1)<=11){calendar.yearView.down(".jcCalendar-entry-index-"+(calendar.value.getFullYear()-(yearIndex-1))).addClass("jcCalendar-entry-selected")}}};var calendarUpdateViewDecades=function(calendar,oldValue,anim){var yearIndex=Math.floor(calendar.displayValue.getFullYear()/100)*100;if(oldValue==null||yearIndex!=Math.floor(oldValue.getFullYear()/100)*100){calendar.decadeView.down(".jcCalendar-select-current").applyTo(yearIndex+" - "+(yearIndex+99));var effectElementClone=calendarEffectSlidePrepare(calendar,jControls.Calendar.SELECTABLE.DECADE,calendar.decadeView,anim);calendar.decadeView.down(".jcCalendar-select-prev")[calendar.options.date.min.getFullYear()<=yearIndex-1?"show":"hide"]().quickTip((yearIndex-100)+" - "+(yearIndex-1));calendar.decadeView.down(".jcCalendar-select-next")[yearIndex+100<=calendar.options.date.max.getFullYear()?"show":"hide"]().quickTip((yearIndex+100)+" - "+(yearIndex+199));calendar.decadeView.select(".jcCalendar-entry").invoke("removeClass","jcCalendar-entry-disabled jcCalendar-entry-selected jcCalendar-entry-now");$R(0,11).each(function(index){var year=yearIndex-10+index*10;var element=calendar.decadeView.down(".jcCalendar-entry-index-"+index);element.down(".jcCalendar-entry-text").applyTo(year+" - "+(year+9));if(year<=(new Date()).getFullYear()&&(new Date()).getFullYear()<=year+10){element.addClass("jcCalendar-entry-now")}if(calendar.value&&year<=calendar.value.getFullYear()&&calendar.value.getFullYear()<=year+10){element.addClass("jcCalendar-entry-selected")}if(year+10<calendar.options.date.min.getFullYear()||calendar.options.date.max.getFullYear()<year){element.addClass("jcCalendar-entry-disabled")}});calendarEffectSlideRun(calendar,jControls.Calendar.SELECTABLE.DECADE,calendar.decadeView,effectElementClone,anim)}else if(oldValue!=null&&calendar.value&&oldValue.getFullYear()!=calendar.value.getFullYear()){if(calendar.decadeView.down(".jcCalendar-entry-selected")){calendar.decadeView.down(".jcCalendar-entry-selected").removeClass("jcCalendar-entry-selected")}if(0<=calendar.value.getFullYear()-(yearIndex-1)&&calendar.value.getFullYear()-(yearIndex-1)<=11){calendar.decadeView.down(".jcCalendar-entry-index-"+(calendar.value.getFullYear()-(yearIndex-1))).addClass("jcCalendar-entry-selected")}}};jControls.Calendar=Class.create(jControls.Control,{displayValue:null,displayView:null,getRow:function(){return this.value},getValue:function(format){if(!this.value){return null}if(typeof format=="undefined"){format=this.options.format}if(format===false){return this.value.clone()}return this.value.format(format)},initialize:function($super,options){if(!this.xType){this.xType=jControls.Calendar.xType}this.options=options;this.options.value=(typeof this.options.value!="undefined"?this.options.value:null);this.options.date=(typeof this.options.date!="undefined"?this.options.date:{});this.options.date.min=(typeof this.options.date.min!="undefined"?this.options.date.min:"01.01.1000 00:00:00");this.options.date.max=(typeof this.options.date.max!="undefined"?this.options.date.max:"31.12.9999 23:59:59");this.options.selectable=(typeof this.options.selectable!="undefined"?this.options.selectable:jControls.Calendar.SELECTABLE.DAY);this.options.time=(typeof this.options.time!="undefined"?this.options.time:false);this.options.allowEmpty=(typeof this.options.allowEmpty!="undefined"?this.options.allowEmpty:false);this.options.emptyText=(typeof this.options.emptyText!="undefined"?this.options.emptyText:"");if(typeof this.options.date.min=="string"){this.options.date.min=Date.parseDate(this.options.date.min)}if(typeof this.options.date.max=="string"){this.options.date.max=Date.parseDate(this.options.date.max)}if(typeof this.options.value=="string"&&this.options.value==""){this.options.value=null}if(typeof this.options.value=="string"){this.options.value=Date.parseDate(this.options.value)}if(this.options.value&&!this.options.value.clearTime(true).between(this.options.date.min.clearTime(true),this.options.date.max.clearTime(true))){this.options.value=this.options.date.min.clone()}if(this.options.selectable<jControls.Calendar.SELECTABLE.YEAR){this.options.selectable=jControls.Calendar.SELECTABLE.YEAR}if(typeof this.options.time=="boolean"){this.options.time={show:this.options.time}}this.options.time.meridiem=(typeof this.options.time.meridiem!="undefined"?this.options.time.meridiem:false);this.options.time.intervalMinute=(typeof this.options.time.intervalMinute!="undefined"?this.options.time.intervalMinute:1);if(this.options.time.show&&this.options.value){this.options.value.setMinutes(Math.floor(this.options.value.getMinutes()/this.options.time.intervalMinute)*this.options.time.intervalMinute)}if(this.options.value){this.displayValue=this.options.value.clone()}else if((new Date()).between(this.options.date.min,this.options.date.max)){this.displayValue=new Date()}else{this.displayValue=this.options.date.min.clone()}if(this.options.time.show){this.displayValue.setMinutes(Math.floor(this.displayValue.getMinutes()/this.options.time.intervalMinute)*this.options.time.intervalMinute)}if(typeof this.options.format=="undefined"){switch(this.options.selectable){case jControls.Calendar.SELECTABLE.DAY:this.options.format=false;break;case jControls.Calendar.SELECTABLE.MONTH:this.options.format="m.Y";break;case jControls.Calendar.SELECTABLE.YEAR:case jControls.Calendar.SELECTABLE.DECADE:this.options.format="Y";break}}this.displayView=this.options.selectable;if(this.options.allowEmpty){this.options.buttons=[{icon:"jcBtn-delete",listeners:{onAfterClick:(function(btn){this.setValue(null)}).bind(this),onAfterRender:(function(btn){Element.insert(btn.dom,{after:"<div class='jcCalendar-value'>"+(this.value?this.getValue():this.options.emptyText)+"</div>"})}).bind(this)}}]}$super(options)},render:function($super,renderTo){if(this.rendered){return this}renderTo=$(renderTo);renderTo=renderTo&&renderTo.nodeType==1?renderTo:renderTo.dom;if(this.xType==jControls.Calendar.xType&&this.listeners.onBeforeRender&&this.listeners.onBeforeRender(this)===false){return this}$super(renderTo);if(this.name&&this.name!=""){Element.insert(this.dom,{bottom:"<input type='hidden' name='"+this.name+"' value='' />"})}Element.insert(this.dom,{bottom:"<div class='jcCalendar-effect-parent'><div class='jcCalender-effect-overlay' style='display:none;'></div></div>"});if(this.options.selectable>=jControls.Calendar.SELECTABLE.DAY){this.dayView=calendarRenderViewDays(this);if(this.options.time.show){calendarRenderViewTime(this)}}if(this.options.selectable>=jControls.Calendar.SELECTABLE.MONTH){this.monthView=calendarRenderViewMonths(this)}if(this.options.selectable>=jControls.Calendar.SELECTABLE.YEAR){this.yearView=calendarRenderViewYears(this)}if(this.options.selectable>=jControls.Calendar.SELECTABLE.DECADE){this.decadeView=calendarRenderViewDecade(this)}if(this.options.selectable>=jControls.Calendar.SELECTABLE.DAY){this.dayView.show()}else if(this.options.selectable>=jControls.Calendar.SELECTABLE.MONTH){this.monthView.show()}else if(this.options.selectable>=jControls.Calendar.SELECTABLE.YEAR){this.yearView.show()}else if(this.options.selectable>=jControls.Calendar.SELECTABLE.DECADE){this.decadeView.show()}if(this.name&&this.name!=""&&!this.options.multiselect){this.inputContainer=this.dom.down("input",0)}if(this.options.value==null){this.renderValue(null,this.displayValue,false)}if(this.xType==jControls.Calendar.xType&&this.listeners.onAfterRender){this.listeners.onBeforeRender(this)}return this},renderRow:function(date,element){element.applyTo("<div class='jcCalendar-select-value'>"+date.format(this.options.format===false?"d.m.Y H:i":this.options.format)+"</div>");return this},renderValue:function($super,oldValue,newValue,anim){if(typeof anim=="undefined"&&newValue){anim=true}$super(oldValue,newValue);var oldDisplayValue=this.displayValue.clone();if(newValue){this.displayValue=newValue.clone()}else{this.dom.select(".jcCalendar-entry-selected").invoke("removeClass","jcCalendar-entry-selected")}if(this.options.selectable>=jControls.Calendar.SELECTABLE.DAY){calendarUpdateViewDays(this,oldValue,anim?oldDisplayValue.getMonth()-newValue.getMonth()+12*(oldDisplayValue.getFullYear()-newValue.getFullYear()):false);if(this.options.time.show){if(newValue){this.timeHour.setValue(newValue.format("H"));this.timeMinute.setValue(newValue.format("i"))}else{this.timeHour.setValue(null);this.timeMinute.setValue(null)}}}if(this.options.selectable>=jControls.Calendar.SELECTABLE.MONTH){calendarUpdateViewMonths(this,oldValue,anim?oldDisplayValue.getFullYear()-newValue.getFullYear():false)}if(this.options.selectable>=jControls.Calendar.SELECTABLE.YEAR){calendarUpdateViewYears(this,oldValue,anim?Math.floor(oldDisplayValue.getFullYear()/10)-Math.floor(newValue.getFullYear()/10):false)}if(this.options.selectable>=jControls.Calendar.SELECTABLE.DECADE){calendarUpdateViewDecades(this,oldValue,anim?Math.floor(oldDisplayValue.getFullYear()/100)-Math.floor(newValue.getFullYear()/100):false)}return this},reset:function(){if(this.dayView){this.dayView.hide()}if(this.monthView){this.monthView.hide()}if(this.yearView){this.yearView.hide()}if(this.decadeView){this.decadeView.hide()}if(this.options.selectable>=jControls.Calendar.SELECTABLE.DAY){this.dayView.show();this.displayView=jControls.Calendar.SELECTABLE.DAY}else if(this.options.selectable>=jControls.Calendar.SELECTABLE.MONTH){this.monthView.show();this.displayView=jControls.Calendar.SELECTABLE.MONTH}else if(this.options.selectable>=jControls.Calendar.SELECTABLE.YEAR){this.yearView.show();this.displayView=jControls.Calendar.SELECTABLE.YEAR}else if(this.options.selectable>=jControls.Calendar.SELECTABLE.DECADE){this.decadeView.show();this.displayView=jControls.Calendar.SELECTABLE.DECADE}this.renderValue(this.displayValue,this.value,false);return this},scrollTo:function(){return this},setValue:function($super,value){if(typeof value=="string"&&value==""){value=null}if(typeof value=="string"){value=Date.parseDate(value)}if(value&&!value.clearTime(true).between(this.options.date.min.clearTime(true),this.options.date.max.clearTime(true))){value=this.options.date.min.clone()}if(value){value.setMinutes(Math.floor(value.getMinutes()/this.options.time.intervalMinute)*this.options.time.intervalMinute)}$super(value);if(value&&this.name&&this.name!=""){if(this.options.format===false){this.inputContainer.value=this.value.format("Y-m-d H:i:s")}else{this.inputContainer.value=this.value.format(this.options.format)}}if(this.options.allowEmpty&&this.dom.down(".jcCalendar-value")){this.dom.down(".jcCalendar-value").applyTo(this.value?this.getValue():this.options.emptyText)}return this}});jControls.Calendar.xType=xTypes.Calendar;jControls.Calendar.SELECTABLE={DAY:3,MONTH:2,YEAR:1,DECADE:0}})();
