var ui_root=[];
if(typeof window.console!="object")window.console={log:function(a){var b=document.getElementById("debug");if(!b){b=document.createElement("div");b.id="debug";b.style.width="200px";b.style.position="absolute";b.style.right="0px";b.style.top="0px";b.style.bottom="0px";b.style.backgroundColor="#CCCCCC";b.style.border="1px solid gray";b.innerHTML="<b>Console:</b><br/>";document.body.appendChild(b)}var c=document.createElement("div");if(c.innerText==undefined)c.textContent=a;else c.innerText=a;b.appendChild(c)}};
if(window.HTMLElement){var element=HTMLElement.prototype,capture=["click","mousedown","mouseup","mousemove","mouseover","mouseout"];element.setCapture=function(){var a=this,b=false;this._capture=function(d){if(!b){b=true;var e=document.createEvent("MouseEvents");e.initMouseEvent(d.type,d.bubbles,d.cancelable,d.view,d.detail,d.screenX,d.screenY,d.clientX,d.clientY,d.ctrlKey,d.altKey,d.shiftKey,d.metaKey,d.button,d.relatedTarget);a.dispatchEvent(e);b=false}};for(var c=0;c<capture.length;c++)window.addEventListener(capture[c],
this._capture,true)};element.releaseCapture=function(){for(var a=0;a<capture.length;a++)window.removeEventListener(capture[a],this._capture,true);this._capture=null}}if(typeof Function.prototype.bind!="function")Function.prototype.bind=function(a){var b=[].slice,c=b.call(arguments,1),d=this,e=function(){},f=function(){return d.apply(this instanceof e?this:a||{},c.concat(b.call(arguments)))};e.prototype=d.prototype;f.prototype=new e;return f};function UI_widgets(){}UI_widgets.instances={};
UI_widgets.postInitializers=[];UI_widgets.initialized=false;
UI_widgets.initialize=function(){UI_widgets.instances.notifier=new UI_Notifier;var a=function(c,d){var e=false;switch(d.className){case "ui_balloon":e=new UI_Balloon(d);break;case "ui_button":e=new UI_Button(d);break;case "ui_calendar":e=new UI_Calendar(d);break;case "ui_chart":e=new UI_Chart(d);break;case "ui_chartimage":e=new UI_Chartimage(d);break;case "ui_checkbox":e=new UI_Checkbox(d);break;case "ui_clock":e=new UI_Clock(d);break;case "ui_conditional":e=new UI_Conditional(d);break;case "ui_datemutation":e=
new UI_DateMutation(d);break;case "ui_dropdown":e=new UI_Dropdown(d);break;case "ui_editfield":e=new UI_EditField(d);break;case "ui_editfield":e=new UI_EditField(d);break;case "ui_editinline":e=new UI_EditInline(d);break;case "ui_editwebformfield":e=new UI_EditWebformField(d);break;case "ui_entityproperty":e=new UI_EntityProperty(d);break;case "ui_flyout":e=new UI_Flyout(d);break;case "ui_frame":e=new UI_Frame(d);break;case "ui_gadget":e=new UI_Gadget(d);break;case "ui_geooverlay":e=new UI_GeoOverlay(d);
break;case "ui_grid":e=new UI_Grid(d);break;case "ui_icon":e=new UI_Icon(d);break;case "ui_pie":e=new UI_Pie(d);break;case "ui_popup":e=new UI_Popup(d);break;case "ui_radio":e=new UI_Radio(d);break;case "ui_richtextEditor":e=new UI_RichtextEditor(d);break;case "ui_roller":e=new UI_Roller(d);break;case "ui_scrollbar":e=new UI_Scrollbar(d);break;case "ui_select":e=new UI_Select(d);break;case "ui_selectable":e=new UI_Selectable(d);break;case "ui_selectdatabase":e=new UI_SelectDatabase(d);break;case "ui_selectdocument":e=
new UI_SelectDocument(d);break;case "ui_selectfield":e=new UI_SelectField(d);break;case "ui_selecttimezone":e=new UI_SelectTimezone(d);break;case "ui_shadable":e=new UI_Shadable(d);break;case "ui_sourceEditor":e=new UI_SourceEditor(d);break;case "ui_splitter":e=new UI_Splitter(d);break;case "ui_stretchcontainer":e=new UI_Stretch(d);break;case "ui_tabs":e=new UI_Tabs(d);break;case "ui_temp":e=new UI_Temp(d);break;case "ui_textbox":e=new UI_Textbox(d);break;case "ui_textbox_more":e=new UI_Textbox(d);
break;case "ui_tooltip":e=new UI_Tooltip(d);break;case "ui_tree":e=new UI_Tree(d);break;case "ui_warning":e=new UI_Warning(d);break;case "ui_warningcontainer":e=new UI_WarningContainer(d);break}if(e){if(e.id)UI_widgets.instances[e.id]=e;e.children=[];(e.parent=c)?c.children.push(e):ui_root.push(e);var f=typeof d.dataset=="object"&&typeof d.dataset.component=="string"&&d.dataset.component!="";if(f||typeof d.attributes["data-component"]!="undefined"){f=PxFramework.component(f?d.dataset.component:d.attributes["data-component"].value);
if(typeof f!="undefined"){if(typeof f.widgets=="undefined")f.widgets={};f.widgets[e.id]=e}}}for(f=0;f<d.childNodes.length;f++)a(e?e:c,d.childNodes[f])};a(null,document.body);setTimeout(UI_recalculate);UI_registerHandler(window,"load",UI_recalculate);for(var b=0;b<UI_widgets.postInitializers.length;b++)UI_widgets.postInitializers[b]();UI_widgets.initialized=true;return UI_widgets.instances};UI_widgets.get=function(a){return UI_widgets.instances[a]};
UI_widgets.getByClassName=function(a){var b=[];for(var c in ui_widgets)ui_widgets[c].widgetType()==a&&b.push(ui_widgets[c]);return b};UI_widgets.pushWidget=function(a){UI_widgets.instances[a.id]=a};UI_widgets.registerPostInitializer=function(a){UI_widgets.initialized?a():UI_widgets.postInitializers.push(a)};UI_widgets.extend=function(a,b){var c=function(){};c.prototype=b.prototype;a.prototype=new c;a.prototype.constructor=a};
function UI_applyToDom(a,b){b(a);for(var c=0,d=a.childNodes.length;c<d;c++)UI_applyToDom(a.childNodes[c],b)}function UI_parseDate(a){if(a.match(/^(\d\d\d\d)-(\d\d)-(\d\d) (\d\d):(\d\d)(:(\d\d))?$/)){a=parseInt(RegExp.$1,10);var b=parseInt(RegExp.$2,10)-1,c=parseInt(RegExp.$3,10),d=parseInt(RegExp.$4,10),e=parseInt(RegExp.$5,10),f=RegExp.$7?parseInt(RegExp.$7,10):0;return new Date(a,b,c,d,e,f)}}
function UI_registerHandler(a,b,c){if(b=="load")if(window.addEventListener||document.addEventListener)a.addEventListener(b,c,false);else{if(window.attachEvent)return a.attachEvent("on"+b,c)}else if(a.addEventListener){a.addEventListener(b,c,false);return false}else if(a.attachEvent)return a.attachEvent("on"+b,c);return false}
function UI_unregisterHandler(a,b,c){if(a.removeEventListener){a.removeEventListener(b,c,false);return true}else if(a.detachEvent){a.detachEvent("on"+b,c);return true}return false}function UI_openNest(a){var b=a.split(".");for(obj=window;a=b.shift();){if(typeof obj[a]!="object")obj[a]={};obj=obj[a]}return obj}UI_registerHandler(window,"resize",function(){setTimeout(UI_recalculate)});function UI_Base(){}
UI_Base.prototype.registerCallback=function(a,b){if(!this.callbacks||!this.callbacks.length)this.callbacks=[];this.callbacks[this.callbacks.length]={type:a,callback:b}};UI_Base.prototype.unregisterCallback=function(a,b){if(!this.callbacks||!this.callbacks.length)this.callbacks=[];var c=this.callbacks;this.callbacks=[];for(var d=0;d<c.length;d++){var e=c[d];e.type==a&&e.callback==b||(this.callbacks[this.callbacks.length]=e)}};
UI_Base.prototype.registerExpendableCallback=function(a,b){if(typeof this.expendables=="undefined"||this.expendables.constructor!=Array)this.expendables=[];this.expendables.push({type:a,callback:b})};
UI_Base.prototype.runCallbacks=function(a,b){if(b==undefined)b={};b.widget=this;if(!((!this.callbacks||!this.callbacks.length)&&(!this.expendables||this.expendables.constructor!=Array))){if(typeof this.callbacks=="object"&&this.callbacks.constructor==Array)for(var c=0;c<this.callbacks.length;c++){var d=this.callbacks[c];d.type==a&&this.runCallback(d.callback,b)}if(typeof this.expendables=="object"&&this.expendables.constructor==Array){for(c=0;c<this.expendables.length;c++)this.expendables[c].type==
a&&this.runCallback(this.expendables[c].callback,b);for(c=this.expendables.length-1;c>=0;c--)this.expendables[c].type==a&&this.expendables.splice(c,1)}}};UI_Base.prototype.runCallback=function(a,b){setTimeout(function(){a(b)})};UI_Base.prototype.notifyChildren=function(a,b){for(var c=0;c<this.children.length;c++){var d=this.children[c];d[a]?d[a](b):d.notifyChildren(a,b)}};UI_Base.prototype.className=function(){return/(\w+)\(/.exec(this.constructor.toString())[1]};
UI_Base.prototype.enableAjax=function(a,b){this.ajaxProcessor=a;this.key=b};UI_Base.prototype.sendAjaxRequest=function(a,b){UI_ajaxRequest("ajax.php",{processor:this.ajaxProcessor,key:this.key,language:UI_language,input:a},function(c){c.output&&alert("unexpected output: "+c.output);b(c.result)})};UI_Base.prototype.widgetType=function(){return this.constructor.toString().replace(/^function (\w*)[\s\S]*/,"$1")};UI_Base.prototype.widgetID=function(){return this.id};
UI_Base.prototype.createWidget=function(a,b,c,d){if(typeof b.id!="undefined")if(typeof UI_widgets.get(b.id)=="undefined")if(typeof a.create=="function"){a=a.create(b,this);if(typeof c=="undefined"&&typeof this.contentElement=="function")c=this.contentElement();if(typeof c!="undefined"&&typeof d!="undefined")c.insertBefore(a.containerElement(),d);else typeof c!="undefined"&&c.appendChild(a.containerElement());a.children=[];a.parent=this;UI_widgets.pushWidget(a);if(typeof this.children=="undefined")this.children=
[];this.children.push(a);return a}};UI_Base.prototype.adopt=function(a,b,c){var d=a.parent;if(d instanceof UI_Base)for(var e=0;e<d.children.length;e++)if(d.children[e]==a){d.children.splice(e,1);break}a.parent=this;this.children.push(a);if(!(typeof b=="boolean"&&!b)){if(typeof b=="undefined"&&typeof this.contentElement=="function")b=this.contentElement();if(typeof b!="undefined")typeof c!="undefined"?b.insertBefore(a.containerElement(),c):b.appendChild(a.containerElement())}};
function UI_notifyRoot(a,b){for(var c=0;c<ui_root.length;c++){var d=ui_root[c];d[a]?d[a](b):d.notifyChildren(a,b)}}function UI_recalculate(){UI_notifyRoot("recalculate")}function UI_findElement(a,b){if(!b)b=document.body;for(var c=0;c<b.childNodes.length;c++){var d=b.childNodes[c];if(a(d))return d;if(d=UI_findElement(a,d))return d}}function UI_findWidget(a,b){widgets=typeof b=="undefined"?ui_widgets:b.ui_widgets;for(var c in widgets)if(a(widgets[c]))return widgets[c]}
function UI_preHide(){UI_notifyRoot("preHide")}function UI_initWidget(a){UI_widgets.extend(a,UI_Base)}function disableSelection(a){if(typeof a.onselectstart!="undefined")a.onselectstart=function(){return false};else if(typeof a.style.MozUserSelect!="undefined")a.style.MozUserSelect="none";a.style.cursor="default"}
function UI_getWindowSize(a){var b=0,c=0;if(a.innerWidth){b=a.innerWidth;c=a.innerHeight}else if(a.document.documentElement.clientWidth!=0){b=a.document.documentElement.clientWidth;c=a.document.documentElement.clientHeight}else{b=a.document.body.clientWidth;c=a.document.body.clientHeight}return{width:b,height:c}}
function UI_getPosition(a,b){if(a.tagName.toLowerCase()=="area")return UI_getPositionArea(a);var c=b&&!document.all?parseInt(UI_getStyle(a,"border-top-width"),10):0,d=b&&!document.all?parseInt(UI_getStyle(a,"border-left-width"),10):0;if(isNaN(c))c=0;if(isNaN(d))d=0;if(a.offsetParent){var e=UI_getPosition(a.offsetParent,true);if(a.tagName.toLowerCase()=="input"){e.left+=a.offsetLeft+d;e.top+=a.offsetTop+c}else{e.left+=a.offsetLeft-a.scrollLeft+d;e.top+=a.offsetTop-a.scrollTop+c}e.right=e.left+a.offsetWidth;
e.bottom=e.top+a.offsetHeight;return e}else return{left:a.offsetLeft+d,top:a.offsetTop+c,right:a.offsetLeft+d+a.offsetWidth,bottom:a.offsetTop+c+a.offsetHeight}}
function UI_getPositionArea(a){var b=$(a).parent().attr("name");b=$(a.ownerDocument).find("img[usemap=#"+b+"]").offset();var c=a.attributes.coords.value.split(",");switch(a.attributes.shape.value){case "circle":b.left+=parseInt(c[0])-parseInt(c[2]);b.top+=parseInt(c[1])-parseInt(c[2]);b.right=b.left+2*parseInt(c[2]);b.bottom=b.top+2*parseInt(c[2]);break;case "poly":for(var d=a=Infinity,e=-Infinity,f=-Infinity,g=0;g<c.length;g+=2){d=Math.min(d,c[g]);e=Math.max(e,c[g]);a=Math.min(a,c[g+1]);f=Math.max(f,
c[g+1])}b.left+=d;b.top+=a;b.right=b.left+e-d;b.bottom=b.top+f-a;break;case "rect":default:b.left+=parseInt(c[0]);b.top+=parseInt(c[1]);b.right=b.left+parseInt(c[2])-parseInt(c[0]);b.bottom=b.top+parseInt(c[3])-parseInt(c[1])}return b}function UI_setPosition(a,b,c){if(a.offsetParent){var d=UI_getPosition(a.offsetParent,true);b-=d.left;c-=d.top}a.style.left=b+"px";a.style.top=c+"px"}
function UI_getStyle(a,b){if(document.defaultView&&document.defaultView.getComputedStyle)return document.defaultView.getComputedStyle(a,"").getPropertyValue(b);else if(a.currentStyle){b=b.replace(/\-(\w)/g,function(c,d){return d.toUpperCase()});return a.currentStyle[b]}return""}var in_array=function(a,b){for(var c=0;c<b.length;c++)if(a==b[c])return true;return false};
function UI_hideFrames(a,b){if(a.tagName=="IFRAME")if(b){a.oldzIndex=a.style.zIndex;a.style.zIndex=-1000}else a.style.zIndex=a.oldzIndex;for(var c=0;c<a.childNodes.length;c++)UI_hideFrames(a.childNodes[c],b)}
UI_ajaxRequest=function(a,b,c){var d=new XMLHttpRequest;a=UI_resourcesURL().widgets+"/php/"+a;d.onreadystatechange=function(){if(!(d.readyState!=4||d.status!=200)){var e=JSON.parse(d.responseText);e==false&&d.responseText&&d.responseText!="false"?alert("parse error: "+d.responseText):c(e)}};d.open("POST",a,true);d.setRequestHeader("content-type","text/plain");d.send(JSON.stringify(b))};
function UI_resourcesURL(){var a=document.getElementsByTagName("script");for(var b in a){var c=a[b];if(c.src)if(c.src.match(/^((.*)\/UI\/.*?)\/scripts\/.*$/))return{widgets:RegExp.$1,resources:RegExp.$2}}return false}
function UI_loadScript(a,b){var c=UI_resourcesURL().widgets+"/scripts/"+a,d=document.getElementsByTagName("script");for(var e in d){var f=d[e];if(f.src)if(f.src==c){b&&setTimeout(function(){b(a)});return}}f=document.createElement("script");f.type="text/javascript";f.src=c;if(b!=undefined){f.onreadystatechange=function(){if(this.readyState=="complete"||this.readyState=="loaded")b(a)};f.onload=function(){b(a)}}document.getElementsByTagName("head")[0].appendChild(f)}
function UI_iconize(a,b){var c=a.parentNode;if(typeof b.icon!="undefined"){var d=document.createElement("table"),e=d.insertRow(0),f=e.insertCell(0),g=e.insertCell(1),h=document.createElement("img");if(typeof b.size=="undefined")b.size=16;if(typeof b.wrap=="undefined")b.wrap=false;d.cellPadding=0;d.cellSpacing=0;d.className="ui_iconize";if(typeof b.style!="undefined")d.style=b.style;f.style.height=isNaN(b.size)?b.size:b.size+"px";g.className=b.wrap?"ui_wrap":"ui_nowrap";c.replaceChild(d,a);c=typeof b.path!=
"undefined"?b.path+b.icon:UI_resourcesURL().resources+"/icons/"+b.size+"x"+b.size+"/"+b.icon+".png";h.src=c;h.height=b.size;h.width=b.size;h.alt=b.icon;f.appendChild(h);g.appendChild(a);e.appendChild(f);e.appendChild(g);d.appendChild(e)}}function addWidget(a){ui_root.children.push(a);ui_widgets[a.id]=a}
function __tr(a,b){var c=[];if(typeof UI_widgetTexts!="undefined"&&typeof UI_widgetTexts[a]!="undefined")a=UI_widgetTexts[a];for(var d in b)c.push({key:d,value:b[d]});c=c.sort(function(e,f){return e.key.length-f.key.length});for(d=0;d<c.length;d++)a=a.replace("%"+c[d].key,c[d].value);return a}function UI_Balloon(a){this.element=a;this.id=a.id.substr(11);a=this.closeElement();var b=this;this.ignore=function(){};a.onclick=function(){b.hide();b.runCallbacks("closed")}}UI_initWidget(UI_Balloon);
UI_Balloon.prototype.containerElement=function(){return this.element};UI_Balloon.prototype.clone=function(a){var b=this.element.cloneNode(true);b.id=b.id.replace(/ui_balloon_(.*)/,"ui_balloon_"+a);this.element.parentNode.appendChild(b);ui_widgets[a]=new UI_Balloon(b);ui_widgets[a].closeElement().setAttribute("onclick","ui_widgets['"+a+"'].hide(); ui_widgets['"+a+"'].runCallbacks('closed');");return ui_widgets[a]};
UI_Balloon.prototype.closeElement=function(){for(var a=0;a<this.element.childNodes.length;a++){var b=this.element.childNodes[a];if(b.className&&b.className=="ui_balloon_close")return b}return false};UI_Balloon.prototype.visible=function(){return this.element.style.display=="block"};UI_Balloon.prototype.show=function(){this.element.style.display="block"};UI_Balloon.prototype.hide=function(){this.element.style.display="none"};
UI_Balloon.prototype.attachToDomElement=function(a){var b=UI_getPosition(a);b.top+=a.className=="ui_richtextEditor"||a.className=="ui_sourceEditor"?40:15;if(a.className=="ui_sourceEditor")b.left+=10;UI_setPosition(this.element,b.left+5,b.top)};
UI_Balloon.prototype.attachToFormField=function(a,b){var c=this;a.registerCallback("submitBlocked",function(d){c.ignore=d.ignore;if(b!=undefined){for(var e=false,f=0;f<b.length;f++)if(b[f]==d.failedTest)e=true;if(!e)return}UI_Tabs.show(a);c.show();a.containerElement().scrollIntoView();c.attachToDomElement(a.containerElement())});a.registerCallback("gotFocus",function(){c.hide()})};
function UI_Button(a){this.element=a;this.id=a.id.substr(10);this.submitType="submit";this.formTarget=this.confirmationMessage=false;var b=this;a.onclick=function(c){if(b.confirmationMessage&&!confirm(b.confirmationMessage))return false;document.ui_submitField=b.element;b.runCallbacks("clicked");c=new UI_Event(c);if(b.submitType=="nosubmit"){c.stopDefault();return false}if(b.submitType!="rawsubmit"||!a.form)return true;b.formTarget&&a.form.setAttribute("target",b.formTarget);a.form.rawSubmit(a.name);
c.stopDefault();return false};if(a.form){UI_initForm(a.form);a.form.ui_buttons.push(this)}}UI_initWidget(UI_Button);UI_Button.prototype.containerElement=function(){return this.element};UI_Button.prototype.rawSubmit=function(){return this.submitType=="rawsubmit"};UI_Button.prototype.setRawSubmit=function(a){if(a==undefined)a=true;this.submitType=a?"rawsubmit":"submit"};UI_Button.prototype.setSubmitType=function(a){this.submitType=a};UI_Button.prototype.confirmation=function(){return this.confirmationMessage};
UI_Button.prototype.setConfirmation=function(a){this.confirmationMessage=a};UI_Button.prototype.target=function(){return this.formTarget};UI_Button.prototype.setTarget=function(a){this.formTarget=a};UI_Button.prototype.disabled=function(){return this.element.disabled};UI_Button.prototype.enabled=function(){return!this.element.disabled};UI_Button.prototype.disable=function(a){if(a==undefined)a=true;this.element.disabled=a};
UI_Button.prototype.enable=function(a){if(a==undefined)a=true;this.element.disabled=!a};UI_Button.prototype.setEnabled=UI_Button.prototype.enable;UI_Button.prototype.setDisabled=UI_Button.prototype.disable;UI_Button.prototype.setIcon=function(a){this.setBackgroundImage(UI_resourcesURL().resources+"/icons/16x16/"+a+".png")};
UI_Button.prototype.setBackgroundImage=function(a){a="url('"+a+"')";if(this.element.firstChild.className=="ui_button_icon"&&this.element.firstChild.tagName.toLowerCase()=="div"&&this.element.hasChildNodes())this.element.firstChild.style.backgroundImage=a;else{div=document.createElement("div");div.className="ui_button_icon";div.style.backgroundImage=a;div.style.backgroundRepeat="no-repeat";div.style.backgroundPosition="left";for(div.style.paddingLeft="20px";this.element.hasChildNodes();)div.appendChild(this.element.firstChild);
this.element.appendChild(div)}};function UI_Cache(a){this.itemList=[];this.capacity=a}UI_Cache.prototype.store=function(a,b){for(var c=0;c<this.itemList.length;c++)if(this.itemList[c].id==a)return;this.itemList.unshift({id:a,value:b});this.itemList.length>this.capacity&&this.itemList.pop()};UI_Cache.prototype.get=function(a){for(var b=0;b<this.itemList.length;b++)if(this.itemList[b].id==a){a=this.itemList[b];this.itemList.splice(b,1);this.itemList.unshift(a);return a.value}};
UI_Cache.prototype.clear=function(){this.itemList=[]};UI_Cache.prototype.setCapacity=function(a){this.capacity=a};UI_Cache.prototype.capacity=function(){return this.capacity};
function UI_Calendar(a){if(!UI_Calendar.months)UI_Calendar.months=[__tr("january"),__tr("february"),__tr("march"),__tr("april"),__tr("may"),__tr("june"),__tr("july"),__tr("august"),__tr("september"),__tr("october"),__tr("november"),__tr("december")];this.id=a.id.substr(12);this.element=a;this.year=this.month;this.current=new Date;var b=UI_findElement(function(k){return k.className&&k.className=="ui_calendar_next"},a),c=UI_findElement(function(k){return k.className&&k.className=="ui_calendar_prev"},
a),d=this,e=false,f=function(k,l,q){if(!e){q();e=setInterval(q,200);l.setCapture();k=new UI_Event(k);k.stopBubbling();return false}};UI_registerHandler(b,"mousedown",function(k){return f(k,b,function(){d.nextMonth()})});UI_registerHandler(c,"mousedown",function(k){return f(k,c,function(){d.prevMonth()})});UI_registerHandler(b,"mouseup",function(){if(e){clearTimeout(e);e=false;b.releaseCapture()}});UI_registerHandler(c,"mouseup",function(){if(e){clearTimeout(e);e=false;c.releaseCapture()}});a=this.table();
for(var g=1;g<a.tBodies[0].rows.length;g++)for(var h=a.tBodies[0].rows[g],j=0;j<h.cells.length;j++)UI_registerHandler(h.cells[j],"click",function(k){k=(new UI_Event(k)).srcDomElement();k=parseInt(k.innerHTML,10);if(!(isNaN(k)||k==0)){d.setClassName(d.date(),"normal");d.current=new Date(d.year,d.month-1,k);d.setClassName(new Date,"currentDay");d.setClassName(d.date(),"selectedDay");d.runCallbacks("dateClicked",{year:d.year,month:d.month,day:k,value:d.value()})}});a=new Date;this.setMonth(a.getFullYear(),
a.getMonth()+1,a.getDate())}UI_initWidget(UI_Calendar);UI_Calendar.prototype.containerElement=function(){return this.element};UI_Calendar.prototype.header=function(){for(var a=0;a<this.element.childNodes.length;a++){var b=this.element.childNodes[a];if(b.tagName&&b.tagName=="DIV")return b}return false};UI_Calendar.prototype.label=function(){for(var a=this.header(),b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.className&&c.className=="ui_calendar_label")return c}return false};
UI_Calendar.prototype.table=function(){for(var a=0;a<this.element.childNodes.length;a++){var b=this.element.childNodes[a];if(b.tagName&&b.tagName=="TABLE")return b}return false};UI_Calendar.prototype.nextMonth=function(){this.setMonth(this.month>=12?this.year+1:this.year,this.month>=12?1:this.month+1)};UI_Calendar.prototype.prevMonth=function(){this.setMonth(this.month<=1?this.year-1:this.year,this.month<=1?12:this.month-1)};
UI_Calendar.prototype.setMonth=function(a,b){var c=new Date(a,b-1,1);if(!(this.year==a&&this.month==b))if(!(c.getFullYear()<0)){this.year=c.getFullYear();this.month=c.getMonth()+1;var d=this.label(),e=UI_Calendar.months[this.month-1]+" "+a;if(d.innerText)d.innerText=e;else d.textContent=e;d=this.table();for(e=1;e<d.tBodies[0].rows.length;e++)for(var f=d.tBodies[0].rows[e],g=0;g<f.cells.length;g++){var h=f.cells[g];h.innerHTML="&nbsp;";h.className="empty"}for(e=f=1;e<=31;e++){c.setDate(e);if(c.getMonth()==
b-1){g=c.getDay();g=(g+6)%7;g==0&&e>1&&f++;h=d.tBodies[0].rows[f].cells[g];h.innerHTML=e;h.className="normal"}}this.setClassName(new Date,"currentDay");this.setClassName(this.date(),"selectedDay")}};UI_Calendar.prototype.setClassName=function(a,b){if(a.getFullYear()==this.year)if(a.getMonth()==this.month-1){var c=this.table(),d=((new Date(this.year,this.month-1,1)).getDay()+6)%7,e=(a.getDay()+6)%7;d=Math.floor((a.getDate()-1+d)/7)+1;c.tBodies[0].rows[d].cells[e].className=b}};
UI_Calendar.prototype.date=function(){return this.current};UI_Calendar.prototype.setDate=function(a){this.setClassName(this.date(),"normal");this.setClassName(new Date,"currentDay");this.current=a;this.setClassName(this.date(),"selectedDay");this.setMonth(a.getFullYear(),a.getMonth()+1)};UI_Calendar.prototype.value=function(){var a=function(c,d){for(c=""+c;c.length<d;)c="0"+c;return c},b=this.date();return a(b.getFullYear(),4)+"-"+a(b.getMonth()+1,2)+"-"+a(b.getDate(),2)};
UI_Calendar.prototype.setValue=function(a){a.match(/(\d+)-(\d+)-(\d+)/)&&a.indexOf("0000")==-1&&this.setDate(new Date(parseInt(RegExp.$1,10),parseInt(RegExp.$2,10)-1,parseInt(RegExp.$3,10)))};
function UI_Chart(a){this.element=a;this.jelement=$(a);this.id=a.id.substr(9);this.tooltipBody=this.tooltipHeader="";var b=this;Highcharts.setOptions({global:{useUTC:false},lang:{months:__tr("January,February,March,April,May,June,July,August,September,October,November,December").split(","),weekdays:__tr("Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday").split(",")}});this.settings={chart:{renderTo:a.id,defaultSeriesType:"areaspline",backgroundColor:null,plotBackgroundColor:null,plotBorderWidth:null,
plotShadow:false},credits:{enabled:false},legend:{enabled:true},title:{text:""},tooltip:{enabled:true,shared:true,formatter:function(){var c;c={a:Highcharts.dateFormat("%a",this.x),A:Highcharts.dateFormat("%A",this.x),d:Highcharts.dateFormat("%d",this.x),e:Highcharts.dateFormat("%e",this.x),W:Highcharts.dateFormat("%W",this.x),b:Highcharts.dateFormat("%b",this.x),B:Highcharts.dateFormat("%B",this.x),m:Highcharts.dateFormat("%m",this.x),y:Highcharts.dateFormat("%y",this.x),Y:Highcharts.dateFormat("%Y",
this.x),H:Highcharts.dateFormat("%H",this.x),I:Highcharts.dateFormat("%I",this.x),l:Highcharts.dateFormat("%l",this.x),M:Highcharts.dateFormat("%M",this.x),p:Highcharts.dateFormat("%p",this.x),P:Highcharts.dateFormat("%P",this.x),S:Highcharts.dateFormat("%S",this.x),x:this.x};for(var d=0;d<this.points.length;d++)for(var e in this.points[d].point.config)e=="color"||e=="y"||(c[e]=this.points[d].point.config[e]);d=b.tooltipHeader;for(formatter in c)d=d.replace(new RegExp("%"+formatter+"(?!\\w)","g"),
c[formatter]);c=d;for(i=0;i<this.points.length;i++){c=c;e=this.points[i];d={percentage:e.percentage,serie:e.series.name,a:Highcharts.dateFormat("%a",e.x),A:Highcharts.dateFormat("%A",e.x),d:Highcharts.dateFormat("%d",e.x),e:Highcharts.dateFormat("%e",e.x),W:Highcharts.dateFormat("%W",e.x),b:Highcharts.dateFormat("%b",e.x),B:Highcharts.dateFormat("%B",e.x),m:Highcharts.dateFormat("%m",e.x),Y:Highcharts.dateFormat("%Y",e.x),H:Highcharts.dateFormat("%H",e.x),I:Highcharts.dateFormat("%I",e.x),l:Highcharts.dateFormat("%l",
e.x),M:Highcharts.dateFormat("%M",e.x),p:Highcharts.dateFormat("%p",e.x),P:Highcharts.dateFormat("%P",e.x),S:Highcharts.dateFormat("%S",e.x),x:e.x,y:e.y};for(var f in e.point.config)f=="color"||f=="y"||(d[f]=e.point.config[f]);e=b.tooltipBody;for(formatter in d)e=e.replace(new RegExp("%"+formatter+"(?!\\w)","g"),d[formatter]);c=c+e}if(c=="")return false;return c}},plotOptions:{series:{point:{events:{click:function(){var c={widget:b,x:this.x,y:this.y,high:this.high,percentage:this.percentage};for(var d in this.config)d==
"color"||d=="y"||(c[d]=this.config[d]);b.runCallbacks("pointClicked",c)}}}}}};this.recalculateTimeout=false}UI_initWidget(UI_Chart);UI_Chart.prototype.recalculate=function(){this.schedule&&window.clearTimeout(this.schedule);var a=this;this.schedule=window.setTimeout(function(){a.scheduledRecalculate()})};
UI_Chart.prototype.scheduledRecalculate=function(){if(this.settings.series!=undefined)if(!(this.jelement.width()==0||this.jelement.height()==0))if(typeof this.chart=="undefined"){var a=UI_Frame.container();if(typeof a!="undefined"&&a.contentWindow()!=window){var b=this,c=function(){b.chart=new Highcharts.Chart(b.settings);a.unregisterCallback("loaded",c)};a.registerCallback("loaded",c)}else this.chart=new Highcharts.Chart(this.settings)}else{this.chart.setSize(this.jelement.width(),this.jelement.height(),
false);this.chart.redraw()}};UI_Chart.prototype.changeSetting=function(a,b){for(var c=a.split("."),d,e=this.settings;d=c.shift();){if(typeof e[d]=="undefined")e[d]={};if(c.length==0)e[d]=b;e=e[d]}typeof this.chart!="undefined"&&this.recalculate()};
UI_Chart.prototype.setData=function(a){for(var b=0;b<a.length;b++)if(a[b].data.constructor!=Array){var c=[];for(key in a[b].data){isNaN(key)||(key=parseInt(key,10));c.push([key,a[b].data[key]])}a[b].data=c}this.settings.series=a;if(typeof this.chart!="undefined")for(b=0;b<a.length;b++)this.chart.get(a[b].id).setData(a[b].data);else this.recalculate()};
UI_Chart.prototype.showSerie=function(a,b){if(typeof b!="boolean")b=true;for(var c=0;c<this.settings.series.length;c++)if(this.settings.series[c].id==a){this.settings.series[c].visible=b;if(typeof this.chart=="undefined")return;b?this.chart.series[c].show():this.chart.series[c].hide();this.recalculate()}};UI_Chart.prototype.hideSerie=function(a,b){if(typeof b!="boolean")b=true;this.showSerie(a,!b)};UI_Chart.prototype.setAxes=function(a){this.settings.xAxis=a.xaxis;this.settings.yAxis=a.yaxis};
UI_Chart.prototype.setHeight=function(a){this.settings.height=a;typeof this.pie!="undefined"&&this.settings.width!="undefined"&&this.pie.setSize(this.settings.width,this.settings.height)};UI_Chart.prototype.setWidth=function(a){this.settings.width=a;typeof this.chart!="undefined"&&this.settings.height!="undefined"&&this.chart.setSize(this.settings.width,this.settings.height)};UI_Chart.prototype.setColors=function(a){this.settings.colors=a};
UI_Chart.prototype.setTitle=function(a){this.settings.title.text=a;typeof this.chart!="undefined"&&this.chart.setTitle({text:a})};UI_Chart.prototype.setTooltipFormat=function(a,b){this.tooltipHeader=a;this.tooltipBody=b};UI_Chart.prototype.showLegend=function(a){this.settings.legend.enabled=a};UI_Chart.prototype.containerElement=function(a){return typeof a=="boolean"&&a?this.jelement:this.element};
function UI_Chartimage(a){this.element=a;this.id=a.id.substr(14);parameters=a.src.split("?")[1].split("&");for(a=0;a<parameters.length;a++){var b=parameters[a].split("=");switch(b[0]){case "chs":this.width=b[1].split("x")[0];this.height=b[1].split("x")[1];break;case "chm":this.fillColor=b[1].split(",")[1];break;case "chco":this.color=b[1];break;case "chd":this.data=b[1].substring(2);break}}}UI_initWidget(UI_Chartimage);
UI_Chartimage.prototype.recalculate=function(){this.schedule&&window.clearTimeout(this.schedule);var a=this;this.schedule=window.setTimeout(function(){a.scheduledRecalculate()})};
UI_Chartimage.prototype.scheduledRecalculate=function(){this.element.width=this.width;this.element.height=this.height;var a="https://chart.googleapis.com/chart?cht=ls";a+="&chs="+this.width+"x"+this.height;a+="&chm=B,"+this.fillColor+",0,0,0,0.0";a+="&chco="+this.color;a+="&chd=s:"+this.data;if(this.element.src!=a)this.element.src=a};
UI_Chartimage.prototype.setData=function(a){var b=0;for(var c in a)if(parseInt(a[c],10)>b)b=a[c];this.data="";for(c in a){chartElement=Math.round(parseInt(a[c])/b*61);this.data+=chartElement<26?String.fromCharCode(chartElement+65):chartElement<52?String.fromCharCode(chartElement+71):String.fromCharCode(chartElement-4)}this.recalculate()};UI_Chartimage.prototype.width=function(){return this.width};UI_Chartimage.prototype.setWidth=function(a){this.width=a;this.recalculate()};
UI_Chartimage.prototype.height=function(){return this.height};UI_Chartimage.prototype.setHeight=function(a){this.height=a;this.recalculate()};UI_Chartimage.prototype.color=function(){return this.color};UI_Chartimage.prototype.setColor=function(a){this.color=a;this.recalculate()};UI_Chartimage.prototype.fill=function(){return this.fillColor};UI_Chartimage.prototype.setFill=function(a){this.fillColor=typeof a=="boolean"&&!a?"ffffff":typeof a=="boolean"&&a?this.color:a;this.recalculate()};
function UI_Checkbox(a){this.element=a;this.id=a.id.substr(12);this.inputElement=document.getElementById("ui_checkbox_input_"+this.id);var b=this;this.errorChecker=new UI_ErrorChecker(this);b.inputElement.onclick=function(){b.runCallbacks("clicked",b);b.inputElement.blur();b.inputElement.focus()};b.inputElement.onchange=function(){b.runCallbacks("changed",b);b.runCallbacks("valueChanged",b)};if(this.inputElement.form!=null){UI_initForm(this.inputElement.form);this.inputElement.form.ui_fields.push(this)}}
UI_initWidget(UI_Checkbox);UI_initErrorChecker(UI_Checkbox);UI_Checkbox.prototype.containerElement=function(){return this.element};UI_Checkbox.prototype.disable=UI_Checkbox.prototype.setDisabled=function(a){if(a==undefined)a=true;this.inputElement.disabled=a};UI_Checkbox.prototype.enable=UI_Checkbox.prototype.setEnabled=function(a){if(a==undefined)a=true;this.disable(!a)};UI_Checkbox.prototype.checked=function(){return this.inputElement.checked};
UI_Checkbox.prototype.value=function(){return this.inputElement.checked?this.inputElement.value:""};UI_Checkbox.prototype.setChecked=function(a){this.inputElement.checked=a};UI_Checkbox.prototype.setValue=function(a){if(typeof a=="boolean")return this.setChecked(a);this.inputElement.checked=Boolean(a);if(a)this.inputElement.value=a};UI_Checkbox.prototype.title=function(){return this.inputElement.getAttribute("title")};
UI_Checkbox.prototype.setTitle=function(a){var b=UI_findElement(function(c){return c&&c.tagName.toLowerCase()=="label"},this.element);b&&b.setAttribute("title",a);this.inputElement.setAttribute("title",a)};
function UI_Clock(a){this.id=a.id.substr(9);this.element=a;var b=this;UI_loadScript("coolclock/coolclock.js",function(){var f=document.getElementById("coolclock_"+b.id);if(f!==null&&typeof f.getContext=="function")CoolClock.createClock(f);else if(document.all){var g=document.createElement("iframe");g.id="iframe_coolclock_"+b.id;g.className="ui_coolclock_iframe";g.frameBorder="no";g.scrolling="no";g.onreadystatechange=function(){if(!(this.readyState!="complete"&&this.readyState!="loaded")){var h=g.contentWindow.document,
j=h.getElementById("coolclock_"+b.id);j&&CoolClock.createClock(j,h)}};g.src=UI_resourcesURL().widgets+"/scripts/coolclock/ie8-canvas.html?clockID="+b.id;a.insertBefore(g,a.childNodes[0])}});var c=UI_findElement(function(f){return f.className&&f.className=="ui_clock_next"},a),d=UI_findElement(function(f){return f.className&&f.className=="ui_clock_prev"},a),e=function(f,g,h){var j=1;h(5);var k=setInterval(function(){h(j<5?5:j<10?10:20);j++},100);g.onmouseup=function(){clearTimeout(k);g.releaseCapture();
g.onmouseup=null;var l=UI_findElement(function(q){return q.className&&q.className=="ui_clock_label"},b.element);b.runCallbacks("timeChanged",{time:l.innerHTML})};g.setCapture();f=new UI_Event(f);f.stopBubbling();return false};c.onmousedown=function(f){return e(f,c,function(g){b.increase(g)})};d.onmousedown=function(f){return e(f,d,function(g){b.decrease(g)})}}UI_initWidget(UI_Clock);UI_Clock.prototype.containerElement=function(){return this.element};
UI_Clock.prototype.value=function(){return UI_findElement(function(a){return a.className&&a.className=="ui_clock_label"},this.element).innerHTML};UI_Clock.prototype.setValue=function(a){if(a.match(/(\d+):(\d+)/)){a=new Date;a.setHours(RegExp.$1);a.setMinutes(RegExp.$2);a.setSeconds(0);this.setTime(a)}};UI_Clock.prototype.time=function(){var a=this.value(),b=new Date;if(!a.match(/(\d+):(\d+)/))return b;b.setHours(RegExp.$1);b.setMinutes(RegExp.$2);b.setSeconds(0);return b};
UI_Clock.prototype.setTime=function(a){var b=UI_findElement(function(d){return d.className&&d.className=="ui_clock_label"},this.element),c=function(d,e){d=parseInt(d,10);e=parseInt(e,10);if(d<10)d="0"+d;if(e<10)e="0"+e;return d+":"+e};if(typeof a=="string"){if(!a.match(/(\d+):(\d+)/))return;b.innerHTML=c(RegExp.$1,RegExp.$2)}else b.innerHTML=c(a.getHours(),a.getMinutes());if(window.CoolClock)(a=CoolClock.config.clockTracker["coolclock_"+this.id])&&a.refreshDisplay()};
UI_Clock.prototype.increase=function(a){a||(a=5);var b=this.time();a=b.getMinutes()+a;var c=b.getHours();for(a=Math.floor(a/5)*5;a>=60;){a-=60;c+=1;if(!(c<24)){this.runCallbacks("dayIncreased");c=0}}b.setHours(c);b.setMinutes(a);this.setTime(b)};UI_Clock.prototype.decrease=function(a){a||(a=5);var b=this.time();a=b.getMinutes()-a;var c=b.getHours();for(a=Math.ceil(a/5)*5;a<0;){a+=60;c-=1;if(!(c>=0)){this.runCallbacks("dayDecreased");c=23}}b.setHours(c);b.setMinutes(a);this.setTime(b)};
function UI_Conditional(a){this.element=a;this.id=a.id.substr(15);var b={},c=this;this.checkWidgets=function(){var d=function(h,j){j=j.split("|");for(var k=0;k<j.length;k++){var l=j[k];if(l.length>0&&l.substr(0,1)=="!"){if(l.substr(1)!=h)return true}else if(l==h)return true}return false};for(var e in b){if(!ui_widgets[e])return true;var f=b[e],g=ui_widgets[e].value();if(!d(g,f))return false}return true};this.updateWidgets=function(){var d=a.style.display=="block",e=c.checkWidgets();if(d!=e){UI_recalculate();
a.style.display=e?"block":"none";UI_applyToDom(a,function(f){if(!(f.tagName!="TEXTAREA"&&f.tagName!="INPUT"&&f.tagName!="SELECT"))if(!(f.tagName=="INPUT"&&f.type=="hidden"))f.disabled=!e});c.runCallbacks(e?"activated":"deactivated",false)}};this.attachToWidget=function(d,e){var f=ui_widgets[d];if(f){b[d]=e;f.registerCallback("valueChanged",function(){c.updateWidgets()});setTimeout(function(){c.updateWidgets()})}}}UI_initWidget(UI_Conditional);UI_Conditional.prototype.containerElement=function(){return this.element};
function UI_DateFormat(a){this.language=a}UI_DateFormat.prototype.fixNumber=function(a,b){for(a=parseInt(a,10).toString();a.length<b;)a="0"+a;return a};
UI_DateFormat.prototype.toSystem=function(a){var b,c;if(a!=undefined){b=false;b=this.language=="nl"?/^(([1-9]|[012][0-9]|3[01]))[- /.](0[0-9]|1[012]|[0-9])[- /.]((19|20)\d\d)$/:/^((19|20)\d\d)[- /.](0[0-9]|1[012]|[0-9])[- /.]([1-9]|[012][0-9]|3[01])$/;if(a.match(b)==null)return false;c=this.language=="nl"?RegExp.$1:RegExp.$4;b=RegExp.$3;a=this.language=="nl"?RegExp.$4:RegExp.$1;if(c==31&&(b==4||b==6||b==9||b==11))return false;if(c>=30&&b==2)return false;if(b==2&&c==29&&a%4&&(a%100!=0||a%400==0))return false}else{c=
new Date;a=c.getFullYear();b=c.getMonth();c=c.getDate()}return this.fixNumber(a,4)+"-"+this.fixNumber(b,2)+"-"+this.fixNumber(c,2)};UI_DateFormat.prototype.toUser=function(a){var b,c;if(a!=undefined){c=a.split(/-/);a=parseInt(c[0],10);b=parseInt(c[1],10);c=parseInt(c[2],10)}else{c=new Date;a=c.getFullYear();b=c.getMonth();c=c.getDate()}return this.language=="nl"?this.fixNumber(c,4)+"-"+this.fixNumber(b,2)+"-"+this.fixNumber(a,2):this.fixNumber(a,4)+"-"+this.fixNumber(b,2)+"-"+this.fixNumber(c,2)};
function UI_DateMutation(a){this.id=a.id.substr(16);var b=this;this.errorChecker=new UI_ErrorChecker(this);var c=this.countElement(),d=this.unitElement(),e=this.operatorElement(),f=this.floorElement(),g=this.exampleElement();a=this.buttonElement();var h=function(){var j=b.dateMutation().apply(),k=function(l,q){for(l=""+l;l.length<q;)l="0"+l;return l};if(isNaN(j.getFullYear()))g.parentNode.style.display="none";else{j=j.getFullYear()+"-"+k(j.getMonth()+1,2)+"-"+k(j.getDate(),2)+" "+k(j.getHours(),2)+
":"+k(j.getMinutes(),2)+":"+k(j.getSeconds(),2);g.parentNode.style.display="block";if(g.innerText!=undefined)g.innerText=j;else g.textContent=j}b.runCallbacks("valueChanged",{count:c.value,unit:d.value,operator:e.value,floor:f.value,value:b.value()})};UI_registerHandler(c,"blur",function(){var j=parseInt(c.value,10);c.value=isNaN(j)?0:j;h()});UI_registerHandler(d,"change",h);UI_registerHandler(e,"change",h);UI_registerHandler(f,"change",h);a&&UI_registerHandler(a,"click",function(){h();b.runCallbacks("buttonClicked")});
h()}UI_initWidget(UI_DateMutation);UI_initErrorChecker(UI_DateMutation);UI_DateMutation.prototype.containerElement=function(){return document.getElementById("ui_datemutation_"+this.id)};UI_DateMutation.prototype.countElement=function(){return UI_findElement(function(a){return a.tagName=="INPUT"},this.containerElement())};UI_DateMutation.prototype.unitElement=function(){return UI_findElement(function(a){return a.tagName=="SELECT"&&a.name.match(/_unit$/)},this.containerElement())};
UI_DateMutation.prototype.operatorElement=function(){return UI_findElement(function(a){return a.tagName=="SELECT"&&a.name.match(/_operator$/)},this.containerElement())};UI_DateMutation.prototype.floorElement=function(){return UI_findElement(function(a){return a.tagName=="SELECT"&&a.name.match(/_floor$/)},this.containerElement())};UI_DateMutation.prototype.exampleElement=function(){return UI_findElement(function(a){return a.className=="ui_datemutation_examplespan"},this.containerElement())};
UI_DateMutation.prototype.buttonElement=function(){return UI_findElement(function(a){return a.className=="ui_datemutation_button"},this.containerElement())};UI_DateMutation.prototype.dateMutation=function(){var a=parseInt(this.countElement().value,10),b=this.unitElement().value,c=this.operatorElement().value,d=this.floorElement().value;if(isNaN(a))a=this.countElement().value=0;return new UI_HumanDateMutation(c,a,b,d)};UI_DateMutation.prototype.value=function(){return this.dateMutation().toString()};
UI_DateMutation.prototype.setValue=function(a){a=UI_HumanDateMutation.parse(a);if(a!=undefined){this.countElement().value=a.count;this.unitElement().value=a.unit;this.operatorElement().value=a.operator;this.floorElement().value=a.floor}};function UI_DateMutationTextbox(a){var b=ui_widgets["ui_textbox_datemutation_"+a.id];b&&b.registerCallback("valueChanged",function(c){a.setValue(c.count+" "+c.operator+" "+c.unit+" "+c.floor)})}
function UI_Dropdown(a){this.id=a.id.substr(12);this.errorChecker=new UI_ErrorChecker(this);this.element=a;this.inputElement=this.labelElement=false;this.flyoutElement=document.getElementById("ui_dropdown_flyout_"+this.id);for(var b=this.closeTimer=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.className=="ui_dropdown_label")this.labelElement=c;if(c.tagName=="INPUT")this.inputElement=c}var d=this;a.onmousedown=function(){d.opened()?d.close():d.open()};this.flyoutElement.ondeactivate=function(){var e=
function(f,g){if(!g)return false;if(g==f)return true;return e(f,g.parentNode)};if(e(d.flyoutElement,window.event.toElement))return true;setTimeout(function(){d.close()},0);return true};this.flyoutElement.onmousedown=function(e){e=new UI_Event(e);var f=e.client();if(function(g){g=UI_getPosition(g);return f.x>=g.left&&f.x<=g.left+d.flyoutElement.offsetWidth&&f.y>=g.top&&f.y<g.top+d.flyoutElement.offsetHeight}(d.flyoutElement))return true;setTimeout(function(){d.close()});return true};if(this.inputElement.form!=
null){UI_initForm(this.inputElement.form);this.inputElement.form.ui_fields.push(this)}}UI_initWidget(UI_Dropdown);UI_initErrorChecker(UI_Dropdown);UI_Dropdown.prototype.containerElement=function(){return this.element};UI_Dropdown.prototype.label=function(){return this.labelElement.innerText?this.labelElement.innerText:this.labelElement.textContent};
UI_Dropdown.prototype.setLabel=function(a){if(this.labelElement.innerText!=undefined)this.labelElement.innerText=a;else this.labelElement.textContent=a};UI_Dropdown.prototype.value=function(){return this.inputElement.value};UI_Dropdown.prototype.setValue=function(a,b){this.inputElement.value=a;b!=undefined&&this.setLabel(b)};UI_Dropdown.prototype.opened=function(){return this.flyoutElement.style.display=="block"};
UI_Dropdown.prototype.open=function(){if(!this.opened()){this.flyoutElement.style.display="block";var a=UI_getPosition(this.element);UI_setPosition(this.flyoutElement,a.left,a.top+20);this.flyoutElement.setActive?this.flyoutElement.setActive():this.flyoutElement.setCapture()}};UI_Dropdown.prototype.close=function(){if(this.opened()){this.flyoutElement.style.display="none";this.flyoutElement.setActive||this.flyoutElement.releaseCapture()}};
function UI_EditField(a){this.id=a.id.substr(13);this.element=a;this.activeChild=this.subprofile=this.profile=this.field=this.interest=this.collectionfield=false;this.textareaAllowed=true;this.fixedValue=undefined;this.compareMode=UI_EditField.COMPAREMODE_EXACT;this.fieldType=false;var b=this;setTimeout(function(){var c=ui_widgets[b.id+"_tb"],d=ui_widgets[b.id+"_sb"],e=c.containerElement();if(e.form!=null){UI_initForm(e.form);e.form.ui_fields.push(b);c.registerCallback("gotFocus",function(f){b.runCallbacks("gotFocus",
f)});d.registerCallback("gotFocus",function(f){b.runCallbacks("gotFocus",f)})}});this.runCallbacks=function(c,d){if(c!="submitBlocked")return UI_EditField.prototype.runCallbacks.call(b,c,d);return ui_widgets[b.id+"_tb"].runCallbacks(c,d)}}UI_initWidget(UI_EditField);
try{Object.defineProperty(UI_EditField,"COMPAREMODE_EXACT",{get:function(){return 1}});Object.defineProperty(UI_EditField,"COMPAREMODE_PARTIAL",{get:function(){return 2}});Object.defineProperty(UI_EditField,"COMPAREMODE_NONE",{get:function(){return 4}});Object.defineProperty(UI_EditField,"COMPAREMODE_WARNING",{get:function(){return 8}})}catch(error$$2){UI_EditField.COMPAREMODE_EXACT=1;UI_EditField.COMPAREMODE_PARTIAL=2;UI_EditField.COMPAREMODE_NONE=4;UI_EditField.COMPAREMODE_WARNING=8}
UI_EditField.prototype.containerElement=function(){return this.element};
UI_EditField.prototype.initializeField=function(a){var b=ui_widgets[this.id+"_tb"],c=ui_widgets[this.id+"_sb"];if(b&&c){b.disable();c.disable();if(a&&a.type){this.field=a.field?a.field:false;this.collectionfield=a.collectionfield?a.collectionfield:false;this.interest=a.interest?a.interest:false;this.lines=a.lines?a.lines:0;this.profile=a.profile?a.profile:false;this.subprofile=a.subprofile?a.subprofile:false;var d=this.fixedValue==undefined?a.value?a.value:"":this.fixedValue;this.fieldType=a.type;
if(a.type=="select"){c.removeAllTests();c.removeOptions();for(b=0;b<a.labels.length;b++)c.addOption(a.values[b],a.labels[b],a.values[b]==d);if(d!=""&&c.value()!=d){c.addOption("",__tr("Select a valid option"),true,0);c.addCustomTest(function(){return c.value()!=""},false,"invaliddefault");ui_widgets.tt.attachToWidget(c,"invaliddefault")}this.activeChild=c}else b.setValue(d);this.resetChecks()}}};
UI_EditField.prototype.resetChecks=function(){var a=ui_widgets[this.id+"_tb"],b=ui_widgets[this.id+"_sb"];if(a&&b){if(this.compareMode&UI_EditField.COMPAREMODE_NONE){a.removeAllTests();a.addPredefinedTest("regexp");b.disable();b.hide();a.enable();a.show();this.activeChild=a}else{if(this.fieldType==false)return;if(this.fieldType=="select"&&this.compareMode&UI_EditField.COMPAREMODE_EXACT){a.disable();a.hide();b.enable();b.show();this.activeChild=b}else{b.disable();b.hide();a.enable();a.show();a.removeAllTests();
this.activeChild=a;b=this.compareMode&UI_EditField.COMPAREMODE_WARNING;var c=this.compareMode&UI_EditField.COMPAREMODE_PARTIAL;switch(this.fieldType){case "integer":a.addPredefinedTest("numeric",!b);a.setDisplayType("text");break;case "float":a.addPredefinedTest("float",!b);a.setDisplayType("text");break;case "date":a.addPredefinedTest("date",!b);a.addPredefinedTest("notempty");a.setDisplayType("text");break;case "empty_date":a.addPredefinedTest("date",!b);a.setDisplayType("text");break;case "datetime":a.addPredefinedTest("datetime",
!b);a.addPredefinedTest("notempty");a.setDisplayType("text");break;case "empty_datetime":a.addPredefinedTest("datetime",!b);a.setDisplayType("text");break;case "text":case "big":a.setDisplayType(this.lines<=1||!this.textareaAllowed?"text":"textarea",this.lines);break;case "email":a.addPredefinedTest("email",c);a.setDisplayType("text");break;case "phone":case "phone_fax":case "phone_gsm":a.addPredefinedTest("phone",c);a.setDisplayType("text");break;case "select":a.setDisplayType("text");default:break}}}this.runCallbacks("checksReset")}};
UI_EditField.prototype.value=function(){if(!this.activeChild)return"";return this.activeChild.value()};UI_EditField.prototype.setValue=function(a){this.fixedValue=a;this.activeChild&&this.activeChild.setValue(a)};UI_EditField.prototype.enable=UI_EditField.prototype.setEnabled=function(a){if(a==undefined)a=true;this.activeChild&&this.activeChild.enable(a)};UI_EditField.prototype.disable=UI_EditField.prototype.setDisabled=function(a){if(a==undefined)a=true;this.activeChild&&this.activeChild.disable(a)};
UI_EditField.prototype.enabled=function(){if(!this.activeChild)return false;return this.activeChild.enabled()};UI_EditField.prototype.disabled=function(){return!this.enabled()};UI_EditField.prototype.reload=function(a){var b=ui_widgets[this.id+"_tb"],c=ui_widgets[this.id+"_sb"];if(b&&c){b.disable();c.disable();a.what="reload";var d=this;this.sendAjaxRequest(a,function(e){d.initializeField(e)})}};
UI_EditField.prototype.show=function(a){if(typeof a=="undefined")a=true;this.element.style.display=a?"block":"none"};UI_EditField.prototype.hide=function(a){if(typeof a=="undefined")a=true;this.show(!a)};UI_EditField.prototype.setField=function(a,b){var c={};if(this.profile)c.profile=this.profile;if(b!=undefined){c.database=a;c.field=b}else c.field=a;this.reload(c)};
UI_EditField.prototype.setInterest=function(a,b){var c={};if(this.profile)c.profile=this.profile;if(b!=undefined){c.database=a;c.interest=b}else c.interest=a;this.reload(c)};UI_EditField.prototype.setCollectionField=function(a,b,c){var d={};if(this.subprofile)d.subprofile=this.subprofile;if(c!=undefined){d.database=a;d.collection=b;d.collectionfield=c}else if(b!=undefined){d.collection=a;d.collectionfield=b}else d.collectionfield=a;this.reload(d)};
UI_EditField.prototype.setProfile=function(a){this.fixedValue=undefined;this.interest?this.reload({profile:a,interest:this.interest}):this.reload({profile:a,field:this.field})};UI_EditField.prototype.setSubProfile=function(a){this.fixedValue=undefined;this.reload({subprofile:a,collectionfield:this.collectionfield})};UI_EditField.prototype.compareMode=function(){return this.compareMode};UI_EditField.prototype.setCompareMode=function(a){this.compareMode=a;this.resetChecks()};
UI_EditField.prototype.focus=function(){this.activeChild&&this.activeChild.focus()};UI_EditField.prototype.addRegexTest=function(a,b,c){a=ui_widgets[this.id+"_sb"];ui_widgets[this.id+"_tb"].addRegexTest(callback,b,c);a.addRegexTest(callback,b,c)};UI_EditField.prototype.addCustomTest=function(a,b,c){var d=ui_widgets[this.id+"_sb"];ui_widgets[this.id+"_tb"].addCustomTest(a,b,c);d.addCustomTest(a,b,c)};
UI_EditField.prototype.addAsyncTest=function(a,b){var c=ui_widgets[this.id+"_sb"];ui_widgets[this.id+"_tb"].addAsyncTest(a,b);c.addAsyncTest(a,b)};UI_EditField.prototype.addPredefinedTest=function(a){var b=ui_widgets[this.id+"_sb"];ui_widgets[this.id+"_tb"].addPredefinedTest(a);b.addPredefinedTest(a)};UI_EditField.prototype.removeRegExTest=function(a){var b=ui_widgets[this.id+"_sb"];ui_widgets[this.id+"_tb"].removeRegExTest(a);b.removeRegExTest(a)};
UI_EditField.prototype.removeCustomTest=function(a){var b=ui_widgets[this.id+"_sb"];ui_widgets[this.id+"_tb"].removeCustomTest(a);b.removeCustomTest(a)};UI_EditField.prototype.removeAsyncTest=function(a){var b=ui_widgets[this.id+"_sb"];ui_widgets[this.id+"_tb"].removeAsyncTest(a);b.removeAsyncTest(a)};UI_EditField.prototype.removePredefinedTest=function(a){var b=ui_widgets[self.id+"_sb"];ui_widgets[this.id+"_tb"].removePredefinedTest(a);b.removePredefinedTest(a)};UI_EditField.prototype.check=function(){if(this.activeChild)return this.activeChild.check()};
UI_EditField.prototype.asyncCheck=function(a){if(this.activeChild)return this.activeChild.asyncCheck(a)};UI_EditField.prototype.ignoreTest=function(a){var b=ui_widgets[this.id+"_sb"];ui_widgets[this.id+"_tb"].ignoreTest(a);b.ignoreTest(a)};
UI_EditField.prototype.setCheckConstraints=function(a){var b=ui_widgets[this.id+"_tb"],c=ui_widgets[this.id+"_sb"],d=this,e=function(f,g){d.sendAjaxRequest({what:"constraints",profile:d.profile,subprofile:d.subprofile,field:d.field,collectionfield:d.collectionfield,interest:d.interest,value:f},function(h){g(h.length==0,h)})};if(a){b&&b.addAsyncTest(e,"constraints");c&&c.addAsyncTest(e,"constraints");if(a=ui_widgets.tt){b&&a.attachToWidget(b,"constraints");c&&a.attachToWidget(c,"constraints")}}else{b&&
b.removeAsyncTest("constraints");c&&c.removeAsyncTest("constraints")}};UI_EditField.prototype.allowTextarea=function(){return this.textareaAllowed};UI_EditField.prototype.setAllowTextarea=function(a){if(a==undefined)a=true;this.textareaAllowed=a;if(!a){a=ui_widgets[this.id+"_tb"];a.displayType()=="textarea"&&a.setDisplayType("text")}};
function UI_EditInline(a){this.element=a;this.id=this.element.id.substr(14);this.editElement=document.getElementById(this.element.id+"_editmode");this.normalElement=document.getElementById(this.element.id+"_normalmode");this.personalizedElement=document.getElementById(this.element.id+"_personalizedmode");this.icon=document.getElementById(this.element.id+"_saveprogress");this.originalValues=false;this.personalisation=true;var b=this;UI_registerHandler(document.body,"mousedown",function(c){function d(e,
f){if(e==f)return true;if(e==document.body)return false;if(!e.parentNode)return false;return d(e.parentNode,f)}c=new UI_Event(c);d(c.srcDomElement(),a)||b.save()});UI_registerHandler(document,"keydown",function(c){if(b.mode()!="edit")return true;c=new UI_Event(c);c.keyCode()==UI_Event.KEY_ESC&&b.setMode("normal");if(c.keyCode()==UI_Event.KEY_TAB)for(var d=b.dataitems(),e=0;e<d.length;e++)d[e].containerElement()!=c.srcDomElement()&&d[e].containerElement()!=c.srcDomElement().parentNode||e==d.length-
1&&b.save();if(c.keyCode()==UI_Event.KEY_RETURN){d=b.dataitems();for(e=0;e<d.length;e++)if(!(d[e].containerElement()!=c.srcDomElement()&&d[e].containerElement()!=c.srcDomElement().parentNode))if(!(d[e].widgetType()=="UI_Textbox"&&d[e].displayType()=="textarea")){if(e==d.length-1)b.save();else d[e+1].focus&&d[e+1].focus();break}}return true});UI_registerHandler(this.normalElement,"mousedown",function(){b.setMode("edit")});UI_registerHandler(this.personalizedElement,"mousedown",function(){b.setMode("edit")})}
UI_initWidget(UI_EditInline);UI_EditInline.editing=false;UI_EditInline.nextEditor=false;UI_EditInline.prototype.containerElement=function(){return this.element};UI_EditInline.prototype.mode=function(){if(this.icon.style.display=="inline")return"save";if(this.editElement.style.display=="inline")return"edit";return"normal"};
UI_EditInline.prototype.setMode=function(a){var b=this.dataitems(),c=a=="error",d=this.mode();if(a=="error")a="edit";if(d==a)return true;if(d=="normal"&&a=="save")return false;if(d!="save"&&a=="edit"&&UI_EditInline.editing){UI_EditInline.nextEditor=this;return false}else if(a=="edit"){UI_EditInline.editing=true;UI_EditInline.nextEditor=false;if(!c){this.originalValues=[];for(d=0;d<b.length;d++)this.originalValues[d]=b[d].value()}}if(UI_EditInline.editing&&a=="normal"){UI_EditInline.editing=false;
UI_EditInline.nextEditor&&UI_EditInline.nextEditor.setMode("edit")}this.normalElement.style.display=a=="normal"&&!this.personalisation?"inline":"none";this.personalizedElement.style.display=a=="normal"&&this.personalisation?"inline":"none";this.editElement.style.display=a=="normal"?"none":"inline";this.icon.style.display=a=="save"?"inline":"none";for(d=0;d<b.length;d++)b[d].disable(a=="normal");a=="edit"&&!c&&b[0].focus&&b[0].focus();this.runCallbacks(a+"ModeStarted");return true};
UI_EditInline.prototype.save=function(){if(this.mode()=="edit"){for(var a=this.dataitems(),b=0;b<a.length;b++){if(a[b].value()!=this.originalValues[b])break;if(a[b]instanceof UI_Select&&a[b].dirty())break;if(b==a.length-1){this.setMode("normal");return}}var c=this;this.setMode("save");var d=[],e=function(g,h,j){c.setMode("error");g.runCallbacks("submitBlocked",{id:g.id,value:g.value(),failedTest:h,ignore:function(){c.setMode("edit");g.ignoreTest(h);c.save()},message:j})};UI_ErrorChecker.checkWidgets(a,
function(g,h,j){g==undefined?c.runCallbacks("editFinished",d):e(g,h,j)});for(b=0;b<a.length;b++){var f=a[b];d.push(f.value());f.disable()}}};UI_EditInline.prototype.cancel=function(){this.mode()!="save"&&this.setMode("normal")};UI_EditInline.prototype.hide=function(a){if(typeof a=="undefined")a=true;this.element.style.display=a?"none":"inline"};UI_EditInline.prototype.show=function(a){if(typeof a=="undefined")a=true;this.hide(!a)};
UI_EditInline.prototype.dataitems=function(){for(var a=0,b=this.id+"_dataitem_",c=[];ui_widgets[b+a]!=undefined;)c.push(ui_widgets[b+a++]);return c};UI_EditInline.prototype.normalValue=function(){return this.normalElement.innerText!=undefined?this.normalNormalElement.innerText:this.normalElement.textContent};
UI_EditInline.prototype.setNormalValue=function(a){if(a.replace(/^\s+/,"").replace(/\s+$/,"")=="")this.normalElement.innerHTML='<div class="ui_editinline_empty">'+__tr("Click here to edit")+"</div>";else if(this.normalElement.innerText!=undefined)this.normalElement.innerText=a;else this.normalElement.textContent=a};UI_EditInline.prototype.personalizedValue=function(){return typeof this.personalizedElement.innerText!="undefined"?this.personalizedElement.innerText:this.personalizedElement.textContent};
UI_EditInline.prototype.setPersonalizedValue=function(a){if(a.replace(/^\s+/,"").replace(/\s+$/,"")=="")this.personalizedElement.innerHTML='<div class="ui_editinline_empty">'+__tr("Click here to edit")+"</div>";else if(typeof this.personalizedElement.innerText!="undefined")this.personalizedElement.innerText=a;else this.personalizedElement.textContent=a};UI_EditInline.prototype.editValue=function(a){if(typeof a=="undefined")a=0;a=this.dataitems()[a];return typeof a!="undefined"?a.value():false};
UI_EditInline.prototype.setEditValue=function(a,b){var c=typeof b=="undefined"?a:b,d=this.dataitems()[typeof b=="undefined"?0:a];if(!d)return false;d.setValue(c);return true};UI_EditInline.prototype.setPersonalisation=function(a){this.personalisation=a;if(this.mode()=="normal"){this.normalElement.style.display=!a?"inline":"none";this.personalizedElement.style.display=a?"inline":"none"}};
UI_EditInline.prototype.addCustomTest=function(a,b,c,d){if(typeof d=="undefined")d=0;d=this.dataitems()[d];if(typeof d=="undefined")return false;d.addCustomTest(a,b,c)};
function UI_EditWebformField(a){this.id=a.id.substr(20);this.element=a;this.activeChild=this.field=this.interest=false;this.fixedValue=undefined;var b=this;setTimeout(function(){var c=ui_widgets[b.id+"_tb"],d=ui_widgets[b.id+"_sb"],e=c.containerElement();if(e.form!=null){UI_initForm(e.form);e.form.ui_fields.push(b);c.registerCallback("gotFocus",function(f){b.runCallbacks("gotFocus",f)});d.registerCallback("gotFocus",function(f){b.runCallbacks("gotFocus",f)})}});this.runCallbacks=function(c,d){if(c!=
"submitBlocked")return UI_EditWebformField.prototype.runCallbacks.call(b,c,d);return ui_widgets[b.id+"_tb"].runCallbacks(c,d)}}UI_initWidget(UI_EditWebformField);UI_EditWebformField.prototype.containerElement=function(){return this.element};
UI_EditWebformField.prototype.initializeField=function(a){var b=ui_widgets[this.id+"_tb"],c=ui_widgets[this.id+"_sb"];if(b&&c){b.disable();c.disable();if(a&&a.type){this.field=a.field?a.field:false;this.interest=a.interest?a.interest:false;var d=this.fixedValue==undefined?a.value?a.value:"":this.fixedValue;b.removeAllTests();if(a.type=="checkbox"){b.hide();a.disabled||c.enable();c.show();c.removeOptions();c.addOption("no",__tr("Not checked"),d=="");c.addOption("yes",__tr("Checked"),d!="");this.activeChild=
c}else if(a.type=="dropdown"||a.type=="radio_buttons"||a.type=="interest"){b.hide();a.disabled||c.enable();c.show();c.removeOptions();for(b=0;b<a.labels.length;b++)c.addOption(a.values[b],a.labels[b],a.values[b]==d);if(d!=""&&c.value()!=d){c.addOption("",__tr("Select a valid option"),true,0);c.addCustomTest(function(){return c.value()!=""},false,"invaliddefault");ui_widgets.tt.attachToWidget(c,"invaliddefault")}this.activeChild=c}else{c.hide();a.disabled||b.enable();b.show();this.activeChild=b;b.setValue(d);
switch(a.type){case "number":b.addPredefinedTest("numeric");b.setDisplayType("text");break;case "date":case "dateselect":b.addPredefinedTest("date");b.setDisplayType("text");break;case "text":case "password":case "password_repeat":case "hidden":b.setDisplayType("text");break;case "multiline2":case "multiline3":case "multiline4":case "multiline5":case "multiline6":case "multiline7":case "multiline8":case "multiline9":case "multiline10":b.setDisplayType("textarea",a.lines);break;case "email":b.addPredefinedTest("email",
false);b.setDisplayType("text");break;default:alert("unsupported field type "+a.type);break}}}}};UI_EditWebformField.prototype.value=function(){if(!this.activeChild)return"";return this.activeChild.value()};UI_EditWebformField.prototype.setValue=function(a){this.fixedValue=a;this.activeChild&&this.activeChild.setValue(a)};UI_EditWebformField.prototype.enable=UI_EditWebformField.prototype.setEnabled=function(a){if(a==undefined)a=true;this.activeChild&&this.activeChild.enable(a)};
UI_EditWebformField.prototype.disable=UI_EditWebformField.prototype.setDisabled=function(a){if(a==undefined)a=true;this.activeChild&&this.activeChild.disable(a)};UI_EditWebformField.prototype.enabled=function(){var a=ui_widgets[this.id+"_sb"];return ui_widgets[this.id+"_tb"].enabled()||a.enabled()};UI_EditWebformField.prototype.disabled=function(){return!this.enabled()};
UI_EditWebformField.prototype.reload=function(a){var b=ui_widgets[this.id+"_tb"],c=ui_widgets[this.id+"_sb"];if(b&&c){b.disable();c.disable();var d=this;this.sendAjaxRequest(a,function(e){d.initializeField(e)})}};UI_EditWebformField.prototype.setField=function(a,b,c){a={webform:a,field:b};if(c!=undefined&&c>0)a.followup=c;this.reload(a)};UI_EditWebformField.prototype.setInterest=function(a,b){this.reload({webform:a,interest:b})};
UI_EditWebformField.prototype.setFollowup=function(a){this.interest?this.reload({followup:a,interest:this.interest}):this.reload({followup:a,field:this.field})};UI_EditWebformField.prototype.check=function(){return ui_widgets[this.id+"_tb"].check()};UI_EditWebformField.prototype.asyncCheck=function(a){return ui_widgets[this.id+"_tb"].asyncCheck(a)};function UI_Editor(a){this.element=a;this.id=a.id.substr(10);this.errorChecker=new UI_ErrorChecker(this);this.templateVersion=3}UI_initWidget(UI_Editor);
UI_initErrorChecker(UI_Editor);UI_Editor.prototype.containerElement=function(){return this.element};UI_Editor.prototype.setSmartyVersion=function(a){this.templateVersion=a};UI_Editor.prototype.smartyVersion=function(){return this.templateVersion};UI_Editor.prototype.enabled=function(){return true};UI_Editor.prototype.disabled=function(){return false};
function UI_EntityProperty(a){this.element=a;this.id=this.element.id.substr(18);this.errorChecker=new UI_ErrorChecker(this);this.personalisation=true;var b=this;setTimeout(function(){var c=ui_widgets[b.id+"_ei"],d=ui_widgets.tt;if(c){c.registerCallback("editFinished",function(e){b.save(e)});typeof d!="undefined"&&d.attachToWidget(b,"constraints")}})}UI_initWidget(UI_EntityProperty);UI_initErrorChecker(UI_EntityProperty);UI_EntityProperty.prototype.containerElement=function(){return this.element};
UI_EntityProperty.prototype.hide=function(a){if(typeof a=="undefined")a=true;this.element.style.display=a?"none":"inline"};UI_EntityProperty.prototype.show=function(a){if(typeof a=="undefined")a=true;this.hide(!a)};
UI_EntityProperty.prototype.save=function(a){var b=ui_widgets[this.id+"_ei"];if(b){var c=b.dataitems();if(b.mode()=="save"){var d=this;this.sendAjaxRequest(a,function(e){for(var f=0;f<c.length;f++)c[f].setValue(e.value.subproperties[f]);d.setNormalValue(e.value.normal,e.value.personalized);if(e.constraints.length==0){b.setMode("normal");d.runCallbacks("saved",e.values);UI_recalculate()}else{b.setMode("edit");d.runCallbacks("submitBlocked",{id:d.id,value:a,failedTest:"constraints",message:e.constraints.join(",")})}})}}};
UI_EntityProperty.prototype.setNormalValue=function(a,b){var c=ui_widgets[this.id+"_ei"];if(c){c.setNormalValue(a);c.setPersonalizedValue(b)}};UI_EntityProperty.prototype.normalValue=function(){var a=ui_widgets[this.id+"_ei"];if(a)return{normal:a.normalValue(),personalized:a.personalizedValue()}};UI_EntityProperty.prototype.setPersonalisation=function(a){var b=ui_widgets[this.id+"_ei"];if(b){this.personalisation=a;b.setPersonalisation(a)}};
function UI_ErrorChecker(a){this.fixedErrorCheckers=[];this.keypressErrorCheckers=[];this.asyncErrorCheckers=[];this.ignoredTests=[];this.warnings=[];this.theMaxLength=this.theMinLength=-1;this.widget=a;var b=this;this.addCustomTest(function(c){if(b.theMaxLength<0)return true;return c.length<=b.theMaxLength},true,"minlength");this.addCustomTest(function(c){if(b.theMinLength<0)return true;return c.length>=b.theMinLength},false,"maxlength");setTimeout(function(){var c=ui_widgets.tt;if(c){c.attachToWidget(a,
"maxlength");c.attachToWidget(a,"minlength")}});a.registerCallback("submitBlocked",function(c){var d=ui_widgets.tt.containerElement(),e=UI_findElement(function(j){return j.id=="ui_tt_title"},d),f=UI_findElement(function(j){return j.id=="ui_tt_description"},d),g=UI_findElement(function(j){return j.id=="ui_tt_link"},d),h=false;for(d=0;d<b.warnings.length;d++)if(b.warnings[d]==c.failedTest){h=true;break}d=function(j,k){var l=e.innerText!=undefined?"innerText":"textContent";e[l]=j;f[l]=k;g.style.display=
h?"block":"none"};switch(c.failedTest){case "maxlength":d(__tr("This field has a limited length"),__tr("The maximum number of characters has been exceeded. This field can hold up to %count characters",{count:b.theMaxLength}));break;case "minlength":d(__tr("This field has a minimum length"),__tr("At least %count characters must be entered.",{count:b.theMinLength}));break;case "numeric":case "integer":d(__tr("This is a numeric field"),__tr("Only whole numbers are allowed."));break;case "float":case "decimal":d(__tr("This is a numeric field"),
__tr("Both whole numbers and numbers with decimals are allowed. Use a dot to separate the decimals."));break;case "character":d(__tr("This is a character field"),__tr("Only alphabetic characters are allowed. Numbers, spaces and symbols are forbidden."));break;case "identifier":d(__tr("This is an identifier field"),__tr("An identifier starts with an alphabetic character, followed by letters or numbers. It may not end with a space charactar."));break;case "nospace":d(__tr("This field may not contain spaces"),
__tr("Whitespace is not allowed. Spaces, tabs and enters are forbidden."));break;case "email_syntax":d(__tr("This is an e-mail field"),__tr("Only a single valid e-mail address is accepted, for example: username@example.org."));break;case "email_exists":c.message=="warning"?d(__tr("Invalid e-mail address"),__tr("An attempt to deliver a dummy e-mail to this address has failed, but the server reported this as a temporary problem.")):d(__tr("Invalid e-mail address"),__tr("An attempt to deliver a dummy e-mail to this address has failed. This address may not exist."));
break;case "multiemail_syntax":d(__tr("This is an e-mail field"),__tr("Use a comma (',') to separate multiple addresses, for example: user1@example.org, user2@example.org"));break;case "multiemail_exists":c.message=="warning"?d(__tr("Invalid e-mail address"),__tr("An attempt to deliver a dummy e-mail to this address has failed, but the server reported this as a temporary problem.")):d(__tr("Invalid e-mail address"),__tr("An attempt to deliver a dummy e-mail to this address has failed. This address may not exist."));
break;case "phone":d(__tr("This is a phone field"),__tr("Phonenumbers contain only numeric values, with optional -, + characters."));break;case "time":d(__tr("This is a time field"),__tr("A time should be in HH:MM format, for example 11:45."));break;case "postalcode":case "zipcode":d(__tr("This is a postal code field"),__tr("A postal code should contain a valid postal code, for example 1234AB."));break;case "url":d(__tr("This is a URL field"),__tr("A URL field starts with http:// or https://, for example: http://www.example.com."));
break;case "domain":d(__tr("This is a domain field"),__tr("A domain field should not contain http:// or https://, for example: www.example.com."));break;case "notempty":d(__tr("This is a required field"),__tr("It may not be left blank."));break;case "notzero":d(__tr("This is a numeric field"),__tr("Zero values are not allowed."));break;case "positive":d(__tr("This is a numeric field"),__tr("Only positive values are allowed."));break;case "negative":d(__tr("This is a numeric field"),__tr("Only negative values are allowed."));
break;case "notpositive":d(__tr("This is a numeric field"),__tr("Only negative values are allowed. Zero is allowed too."));break;case "notnegative":d(__tr("This is a numeric field"),__tr("Only positive values are allowed. Zero is allowed too."));break;case "strongpassword":d(__tr("This is a password field"),__tr("Only strong passwords with at least six characters are allowed. Use numbers, uppercase and lowercase characters and other symbols (like #, $ or %) to get a strong password."));break;case "date":case "extendeddate":c=
new Date;c=c.getFullYear()+"-11-23";d(__tr("This is a date field"),__tr("A date should be formatted in YYYY-MM-DD format, for example %example.",{example:c}));break;case "datetime":case "extendeddatetime":c=new Date;c=c.getFullYear()+"-11-23 11:23";d(__tr("This is a datetime field"),__tr("The field should be formatted in YYYY-MM-DD hh:mm format, for example %example.",{example:c}));break;case "nothistoric":d(__tr("Invalid date selected"),__tr("The selected date may not be in the past."));break;case "notfuturistic":d(__tr("Invalid date selected"),
__tr("The selected date may not be in the future."));break;case "datemutation":d(__tr("This is a field for a variable date"),__tr("The field should hold a timestamp relative to the current time."));break;case "isafter":d(__tr("Invalid time interval"),__tr("This is the end of a time interval. Therefore it must occur after the beginning of the interval."));break;case "isbefore":d(__tr("Invalid time interval"),__tr("This is the end of a time interval. Therefore it must occur before the end of the interval."));
break;case "personalize":case "templatepersonalize":d(__tr("Error in personalization"),__tr("An error was detected in the personalization of this field.\n%message",{message:c.message}));break;case "regexp":d(__tr("This is a regular expression field"),__tr("This is not a valid regular expression."));break;case "xml":d(__tr("XML error"),__tr("This XML code in this field contains errors."));break;case "constraints":c={constraint:c.message};d(__tr("Restrictions violation"),__tr("The new entered value can not be stored because of a violation of the database restriction. Failed restriction: %constraint",
c));break;case "invaliddefault":d(__tr("Selected option no longer available"),__tr("The selected option has been changed or removed. Please select another option."));break;default:d(__tr("Invalid value"),__tr("You have entered an invalid value in this field"));break}})}
UI_ErrorChecker.prototype.run=function(a,b){if(b==undefined)b=false;for(var c=b?this.keypressErrorCheckers:this.fixedErrorCheckers,d=0;d<c.length;d++){var e=c[d];if(!this.isIgnored(e.name,a))if(!e.func.call(this.widget,a))return e.name}if(!b)return this.run(a,true)};UI_ErrorChecker.prototype.isIgnored=function(a,b){if(!this.ignoredTests[a])return false;for(var c in this.ignoredTests[a])if(this.ignoredTests[a][c]==b)return true;return false};
UI_ErrorChecker.prototype.runAsync=function(a,b){if(this.asyncErrorCheckers.length==0)return false;for(var c=0,d=undefined,e=function(h){h.func.call(this.widget,a,function(j,k){if(!j&&d==undefined)d=h.name;c--;c>0||b(d,k)})}.bind(this),f=0;f<this.asyncErrorCheckers.length;f++){var g=this.asyncErrorCheckers[f];if(!this.isIgnored(g.name,a)){c++;e(g)}}return c>0};
UI_ErrorChecker.prototype.tests=function(){for(var a=[this.fixedErrorCheckers,this.asyncErrorCheckers,this.keypressErrorCheckers],b=[],c=0;c<a.length;c++)for(var d in a[c])b.push(a[c][d].name);return b};UI_ErrorChecker.prototype.removeAllTests=function(){this.fixedErrorCheckers=[];this.asyncErrorCheckers=[];this.keypressErrorCheckers=[]};UI_ErrorChecker.prototype.hasTest=function(a){return typeof this.tests()[a]!="undefined"};
UI_ErrorChecker.prototype.addCustomTest=function(a,b,c){if(b==undefined)b=false;if(c==undefined)c=a.toString();b?this.keypressErrorCheckers.push({func:a,name:c}):this.fixedErrorCheckers.push({func:a,name:c})};UI_ErrorChecker.prototype.removeCustomTest=function(a){for(var b in this.keypressErrorCheckers)this.keypressErrorCheckers[b].name==a&&this.keypressErrorCheckers.splice(b,1);for(b in this.fixedErrorCheckers)this.fixedErrorCheckers[b].name==a&&this.fixedErrorCheckers.splice(b,1)};
UI_ErrorChecker.prototype.addRegexTest=function(a,b,c){if(b==undefined)b=false;if(c==undefined)c=a.toString();this.addCustomTest(function(d){if(d=="")return true;return a.test(d)},b,c)};UI_ErrorChecker.prototype.removeRegexTest=function(a){this.removeCustomTest(a)};
UI_ErrorChecker.prototype.addPredefinedTest=function(a,b){if(b==undefined)b=true;b||this.warnings.push(a);switch(a){case "numeric":case "integer":this.addRegexTest(/^\d*$/,b,a);break;case "float":case "decimal":this.addRegexTest(/^\d*(\.\d*)?$/,b,a);break;case "character":this.addRegexTest(/^[a-zA-Z]*$/,b,a);break;case "identifier":b&&this.addRegexTest(/(^[a-z](\w|\s)*$)/i,b,a);this.addRegexTest(/^([a-z]|([a-z](\w|\s)*\w))$/i,false,a);break;case "nospace":this.addRegexTest(/^\S*$/,b,a);break;case "email":this.addPredefinedTest("email_syntax",
b);this.addPredefinedTest("email_exists",false);break;case "email_syntax":this.addRegexTest(/^[a-z0-9_*]+([._\-][_*a-z0-9]+)*@[a-z0-9]+([._\-][a-z0-9]+)*\.[a-z]{2,6}$/i,false,a);break;case "email_exists":this.addAsyncTest(function(c,d){if(c=="")setTimeout(function(){d(true)});else c.match(/^[a-z0-9_*]+([._\-][_*a-z0-9]+)*@[a-z0-9]+([._\-][a-z0-9]+)*\.[a-z]{2,6}$/i)?UI_ajaxRequest("email.php",c,function(e){d(e=="ok",e)}):setTimeout(function(){d(false)})},a);break;case "multiemail":this.addPredefinedTest("multiemail_syntax",
b);this.addPredefinedTest("multiemail_exists",false);break;case "multiemail_syntax":this.addCustomTest(function(c){c=c.split(/\s*,\s*/);for(var d=0;d<c.length;d++)if(c[d]!="")if(!c[d].match(/^[a-z0-9_*]+([._\-][_*a-z0-9]+)*@[a-z0-9]+([._\-][a-z0-9]+)*\.[a-z]{2,6}$/i))return false;return true},false,a);break;case "multiemail_exists":this.addAsyncTest(function(c,d){for(var e=c.split(/\s*,\s*/),f=e.length,g=0,h=0,j=function(l){if(l=="ok"){g++;g>=f&&d(true,l)}else{h++;h==1&&d(false,l)}},k=0;k<e.length;k++)if(e[k]==
"")setTimeout(function(){j("ok")});else e[k].match(/^[a-z0-9_*]+([._\-][_*a-z0-9]+)*@[a-z0-9]+([._\-][a-z0-9]+)*\.[a-z]{2,6}$/i)?UI_ajaxRequest("email.php",e[k],j):setTimeout(function(){j("failure")})},a);break;case "phone":this.addRegexTest(/^([0-9\-()\/\+\.\s])+$/,b,a);break;case "time":this.addRegexTest(/(^(0[0-9]|1[0-9]|2[0-3]):([0-5][0-9])(:[0-5][0-9])?$)/,false,a);break;case "postalcode":case "zipcode":this.addRegexTest(/(^[0-9][0-9][0-9][0-9]-?([A-Z]|[a-z])([A-Z]|[a-z])$)/,false,a);break;case "url":this.addRegexTest(/(^(https?|s?ftp|ftps|gopher|telnet|file|notes|ms-help):((\/\/)|(\\\\))((.*)(:(.*))?@)?(([\w\d\-_]+\.)+([a-zA-Z]{2,4})|(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(\:\d+)?))\/?.*$)|(^mailto:[a-zA-Z0-9._]+@.+$)/,
false,a);break;case "domain":this.addRegexTest(/(^[a-zA-Z0-9-\s.]+\.([a-zA-Z\.]{2,6}){1,2}$)/,false,a);break;case "notempty":this.addCustomTest(function(c){return c!=""},b,a);break;case "notzero":this.addCustomTest(function(c){return c!=0},b,a);break;case "positive":this.addCustomTest(function(c){return c>0},b,a);break;case "negative":this.addCustomTest(function(c){return c<0},b,a);break;case "notpositive":this.addCustomTest(function(c){return c<=0},b,a);break;case "notnegative":this.addCustomTest(function(c){return c>=
0},b,a);break;case "strongpassword":this.addCustomTest(function(c){if(c.length<6)return false;for(var d=false,e=false,f=false,g=0;g<c.length;g++){var h=c.substr(g,1);if(h>="a"&&h<="z")d=true;else if(h>="A"&&h<="Z")e=true;else if(h>="0"&&h<="9")containsNumber=true;else f=true}c=0;d&&c++;e&&c++;f&&c++;if(f&&c>=2)return true;return c>=3},false,a);break;case "date":this.addRegexTest(/^(\d\d\d\d)[- /.](0[0-9]|1[012]|[0-9])[- /.]([1-9]|[012][0-9]|3[01])$/,false,a);break;case "datetime":this.addRegexTest(/^(\d\d\d\d)[- /.](0[0-9]|1[012]|[0-9])[- /.]([1-9]|[012][0-9]|3[01])\s+(0[0-9]|1[0-9]|2[0-3]):([0-5][0-9])(:[0-5][0-9])?$/,
false,a);break;case "datemutation":this.addCustomTest(function(c){return UI_HumanDateMutation.parse(c)!=undefined},false,a);break;case "extendeddate":this.addCustomTest(function(c){if(c=="")return true;if(c.match(/^(\d\d\d\d)[- /.](0[0-9]|1[012]|[0-9])[- /.]([1-9]|[012][0-9]|3[01])$/))return true;return UI_HumanDateMutation.parse(c)!=undefined},false,a);break;case "extendeddatetime":this.addCustomTest(function(c){if(c=="")return true;if(c.match(/^(\d\d\d\d)[- /.](0[0-9]|1[012]|[0-9])[- /.]([1-9]|[012][0-9]|3[01])\s+(0[0-9]|1[0-9]|2[0-3]):([0-5][0-9])(:[0-5][0-9])?$/))return true;
return UI_HumanDateMutation.parse(c)!=undefined},false,a);break;case "nothistoric":this.addCustomTest(function(c){return UI_parseDate(c)>=(new Date).getTime()},false,a);break;case "notfuturistic":this.addCustomTest(function(c){return UI_parseDate(c)<=(new Date).getTime()},false,a);break;case "personalize":case "templatepersonalize":this.addAsyncTest(function(c,d){var e={value:c};e.smartyversion=this instanceof UI_Editor||this instanceof UI_Textbox?this.smartyVersion():3;UI_ajaxRequest(a=="personalize"?
"personalize.php":"templatepersonalize.php",e,function(f){for(var g="",h=0;h<f.errors.length;h++)g+=(h>0?"\n":"")+__tr("Line %line: %message",{line:f.errors[h].line,message:f.errors[h].msg});d(f.check,g)})},a);break;case "regexp":this.addAsyncTest(function(c,d){UI_ajaxRequest("regexp.php",c,d)},a);break;case "xml":this.addAsyncTest(function(c,d){c==""?setTimeout(function(){d(true)}):UI_ajaxRequest("xml.php",c,d)},a);break}};UI_ErrorChecker.prototype.removePredefinedTest=function(a){this.removeCustomTest(a)};
UI_ErrorChecker.prototype.minLength=function(){return this.theMinLength};UI_ErrorChecker.prototype.setMinLength=function(a){this.theMinLength=a};UI_ErrorChecker.prototype.maxLength=function(){return this.theMaxLength};UI_ErrorChecker.prototype.setMaxLength=function(a){this.theMaxLength=a};UI_ErrorChecker.prototype.addAsyncTest=function(a,b){if(b==undefined)b=a.toString();this.asyncErrorCheckers.push({func:a,name:b})};
UI_ErrorChecker.checkWidgets=function(a,b){for(var c=0,d=0,e=0,f=function(j,k){e++;var l=j.check?j.check():undefined;if(l!=undefined)setTimeout(function(){k(j,l)});else if(!j.asyncCheck||!j.asyncCheck(function(q,o){k(j,q,o)}))setTimeout(function(){k(j,undefined)})},g=function(j,k,l){if(k==undefined)c++;else d++;d==1&&k!=undefined&&b(j,k,l);c==e&&b()},h=0;h<a.length;h++)f(a[h],g);e>0||setTimeout(function(){b()})};
UI_ErrorChecker.prototype.removeAsyncTest=function(a){for(var b in this.asyncErrorCheckers)this.asyncErrorCheckers[b].name==a&&this.asyncErrorCheckers.splice(b,1)};
function UI_initErrorChecker(a){a.prototype.hasTest=function(b){return this.errorChecker.hasTest(b)};a.prototype.removeAllTests=function(){this.errorChecker.removeAllTests()};a.prototype.addCustomTest=function(b,c,d){this.errorChecker.addCustomTest(b,c,d)};a.prototype.removeCustomTest=function(b){this.errorChecker.removeCustomTest(b)};a.prototype.addRegexTest=function(b,c,d){this.errorChecker.addRegexTest(b,c,d)};a.prototype.removeRegexTest=function(b){this.errorChecker.removeRegexTest(b)};a.prototype.removePredefinedTest=
function(b){this.errorChecker.removePredefinedTest(b)};a.prototype.addAsyncTest=function(b,c){this.errorChecker.addAsyncTest(b,c)};a.prototype.removeAsyncTest=function(b){this.errorChecker.removeAsyncTest(b)};a.prototype.setMinLength=function(b){this.errorChecker.setMinLength(b)};a.prototype.setMaxLength=function(b){this.errorChecker.setMaxLength(b)};a.prototype.tests=function(){return this.errorChecker.tests()};a.prototype.addPredefinedTest=function(b,c){if(b=="email"||b=="multiemail"){ui_widgets.tt.attachToWidget(this,
b+"_syntax");ui_widgets.tt.attachToWidget(this,b+"_exists")}else ui_widgets.tt.attachToWidget(this,b);this.errorChecker.addPredefinedTest(b,c)};a.prototype.check=function(){if(!(this.disabled&&this.disabled()))return this.errorChecker.run(this.value(),false)};a.prototype.asyncCheck=function(b){return this.disabled&&this.disabled()?false:this.errorChecker.runAsync(this.value(),b)};a.prototype.triggerTooltips=function(b,c){var d=this;UI_ErrorChecker.checkWidgets([this],function(e,f,g){if(e==undefined)b&&
setTimeout(function(){b(false)});else{d.runCallbacks("submitBlocked",{id:d.id,value:d.value(),failedTest:f,ignore:function(){if(d.ignoreTest){d.ignoreTest(f);c&&c()}},message:g});b&&setTimeout(function(){b(true)})}})};a.prototype.ignoreTest=function(b){if(b=="email"||b=="multiemail")b+="_syntax";if(this.errorChecker.ignoredTests[b])this.errorChecker.ignoredTests[b].push(this.value());else this.errorChecker.ignoredTests[b]=[this.value()];b=="email_syntax"&&this.ignoreTest("email_exists");b=="multiemail_syntax"&&
this.ignoreTest("multiemail_exists")}}function UI_Event(a){if(!a)a=window.event;this.original=function(){return a}}UI_Event.KEY_BACKSPACE=8;UI_Event.KEY_TAB=9;UI_Event.KEY_RETURN=13;UI_Event.KEY_ESC=27;UI_Event.KEY_LEFT=37;UI_Event.KEY_UP=38;UI_Event.KEY_RIGHT=39;UI_Event.KEY_DOWN=40;UI_Event.KEY_DELETE=46;UI_Event.KEY_HOME=36;UI_Event.KEY_END=35;UI_Event.prototype.valid=function(){return typeof this.original()!="undefined"};UI_Event.prototype.altKey=function(){return this.original().altKey};
UI_Event.prototype.ctrlKey=function(){return this.original().ctrlKey};UI_Event.prototype.shiftKey=function(){return this.original().shiftKey};UI_Event.prototype.specialKey=function(){if(this.original().which==null)return false;else if(this.original().which!=0&&this.original().charCode!=0)return false;switch(this.keyCode()){case UI_Event.KEY_BACKSPACE:case UI_Event.KEY_TAB:case UI_Event.KEY_RETURN:case UI_Event.KEY_ESC:case UI_Event.KEY_LEFT:case UI_Event.KEY_UP:case UI_Event.KEY_RIGHT:case UI_Event.KEY_DOWN:case UI_Event.KEY_DELETE:case UI_Event.KEY_HOME:case UI_Event.KEY_END:return true}return false};
UI_Event.prototype.stopBubbling=function(){var a=this.original();if(typeof a.stopPropagation=="function")a.stopPropagation(true);else a.cancelBubble=true};UI_Event.prototype.stopDefault=function(){var a=this.original();if(typeof a.preventDefault=="function")a.preventDefault(true);else a.returnValue=false};UI_Event.prototype.client=function(){var a=this.original();return{x:a.clientX,y:a.clientY}};UI_Event.prototype.clientX=function(){return this.original().clientX};UI_Event.prototype.clientY=function(){return this.original().clientY};
UI_Event.prototype.fromDomElement=function(){var a=this.original();if(a.type=="mouseover"&&typeof a.relatedTarget!="undefined")return a.relatedTarget;if(a.type=="mouseout"&&typeof a.target!="undefined")return a.target;if(typeof a.fromElement!="undefined")return a.fromElement;return null};
UI_Event.prototype.toDomElement=function(){var a=this.original();if(a.type=="mouseover"&&typeof a.target!="undefined")return a.target;if(a.type=="mouseout"&&typeof a.relatedTarget!="undefined")return a.relatedTarget;if(typeof a.toElement!="undefined")return a.toElement;return null};UI_Event.prototype.keyCode=function(){var a=this.original();return a.keyCode?a.keyCode:a.charCode};
UI_Event.prototype.offset=function(){var a=this.original();return typeof a.offsetX!="undefined"?{x:a.offsetX,y:a.offsetY}:typeof a.layerX!="undefined"?{x:a.layerX,y:a.layerY}:null};UI_Event.prototype.offsetX=function(){return this.offset().x};UI_Event.prototype.offsetY=function(){return this.offset().y};UI_Event.prototype.srcDomElement=function(){var a=this.original();return typeof a.target!="undefined"?a.target:typeof a.srcElement!="undefined"?a.srcElement:null};UI_Event.prototype.type=function(){return this.original().type};
UI_Event.prototype.propertyName=function(){return this.original().propertyName};UI_Event.prototype.submitField=function(){if(document.ui_submitField)return document.ui_submitField;return typeof document.activeElement!="undefined"&&document.activeElement!=document.body?document.activeElement:this.original().explicitOriginalTarget};
function UI_Flyout(a){this.id=a.id.substr(14);this.element=a;this.opened=this.groupname=false;this.timer=0;var b=this;this.direction="southeast";this.holdsMouse=false;this.position={left:0,top:0};UI_setPosition(this.element,0,0);this.parent=false;this.attachPosition="bottom";this.element.onmouseout=function(c){c=new UI_Event(c);var d=function(e,f){if(f==e)return true;if(!f||!f.offsetParent)return false;return d(e,f.offsetParent)};c=c.toDomElement();if(!d(a,c))if(!(c&&c.className=="ui_textbox_eventcatcher")){b.holdsMouse=
false;b.close()}};this.element.onmouseover=function(){b.holdsMouse=true;if(b.timer){clearTimeout(b.timer);b.timer=0}}}UI_initWidget(UI_Flyout);UI_Flyout.instances={};UI_Flyout.findFlyout=function(a){if(a.containerElement)a=a.containerElement();for(var b=/^ui_flyoutmenu_(.*)$/;a!=undefined&&a!=document.body;a=a.parentNode)if(a.getAttribute){var c=a.getAttribute("id");if(c&&c.match(b))return ui_widgets[RegExp.$1]}};UI_Flyout.show=function(a){a=UI_Flyout.findFlyout(a);a!=undefined&&a.open()};
UI_Flyout.prototype.recalculate=function(){};UI_Flyout.prototype.containerElement=function(){return this.element};UI_Flyout.prototype.setGroup=function(a){this.groupname=a};UI_Flyout.prototype.group=function(){return this.groupname};UI_Flyout.prototype.setDirection=function(a){this.direction=a};UI_Flyout.prototype.openDown=function(){return this.direction.indexOf("south")>=0};UI_Flyout.prototype.openUp=function(){return this.direction.indexOf("north")>=0};
UI_Flyout.prototype.openLeft=function(){return this.direction.indexOf("west")>=0};UI_Flyout.prototype.openRight=function(){return this.direction.indexOf("east")>=0};UI_Flyout.prototype.getMenu=function(){return this.element};UI_Flyout.prototype.getContent=function(){return document.getElementById("ui_flyoutcontent_"+this.id)};UI_Flyout.prototype.setPosition=function(a,b){this.position.top=b;this.position.left=a};
UI_Flyout.prototype.attach=function(a,b,c){this.parent=typeof a=="string"?document.getElementById(a):a;if(b)this.attachPosition=b;c&&this.setDirection(c)};UI_Flyout.prototype.attachToWidget=function(a,b,c){this.attach(a.containerElement(),b,c);var d=this;a.registerCallback("mouseOver",function(){d.open()});a.registerCallback("mouseOut",function(){d.hasMouse()||d.close()})};
UI_Flyout.prototype.reposition=function(){if(this.parent){var a=UI_getPosition(this.parent),b=0,c=0;if(this.attachPosition=="left"){b=a.left;c=this.openTop()?a.top+this.parent.offsetHeight:a.top}else if(this.attachPosition=="right"){b=a.left+this.parent.offsetWidth;c=this.openTop()?a.top+this.parent.offsetHeight:a.top}else if(this.attachPosition=="top"){b=this.openLeft()?a.left+this.parent.offsetWidth:a.left;c=a.top}else{b=this.openLeft()?a.left+this.parent.offsetWidth:a.left;c=a.top+this.parent.offsetHeight}this.setPosition(b,
c);this.runCallbacks("repositioned",{left:b,top:c})}};UI_Flyout.prototype.hasMouse=function(){return this.holdsMouse};UI_Flyout.prototype.close=function(){if(!(this.timer||!this.opened)){var a=this;this.timer=setTimeout(function(){a.timer=0;a.opened=false;a.animate()},500)}};
UI_Flyout.prototype.open=function(){if(this.timer){clearTimeout(this.timer);this.timer=0}if(!this.opened){for(var a in ui_widgets)if(ui_widgets[a]instanceof UI_Flyout){var b=ui_widgets[a];if(b!=this)if(b.opened){if(b.timer){clearTimeout(b.timer);b.timer=0}var c=b.getMenu();b.getContent().style.visibility="hidden";c.style.display="none";b.opened=false}}this.opened=true;this.animate()}};
UI_Flyout.prototype.animate=function(){var a=false,b=false,c=this;this.parent&&this.reposition();var d=this.getMenu(),e=this.getContent();e.style.visibility="visible";d.style.display="block";var f=e.offsetWidth,g=e.offsetHeight;if(this.opened){d.style.width=this.openLeft()||this.openRight()?"0px":f+"px";d.style.height=this.openUp()||this.openDown()?"0px":g+"px";setTimeout(function(){var j=parseInt(d.offsetWidth,10),k=parseInt(d.offsetHeight,10);k=c.openUp()?c.position.top-k:c.position.top;j=c.openLeft()?
c.position.left-j:c.position.left;UI_setPosition(d,j,k)})}var h=function(){clearTimeout(a);clearTimeout(b);a=b=false;if(c.opened){d.style.width=f+"px";d.style.height=g+"px";var j=UI_getPosition(d),k=j.left;j=j.top;if(isNaN(k))k=0;if(isNaN(j))j=0;UI_setPosition(d,c.openLeft()?c.position.left-f-2:k,c.openUp()?c.position.top-g:j);c.runCallbacks("opened")}else{d.style.display="none";e.style.visibility="hidden";d.style.width=f+"px";d.style.height=g+"px";UI_setPosition(d,0,0);c.runCallbacks("closed")}};
a=setInterval(function(){var j=parseInt(d.style.width,10),k=parseInt(d.style.height,10),l=UI_getPosition(d),q=l.left;l=l.top;if(isNaN(q))q=0;if(isNaN(l))l=0;var o=c.opened?100:-120,s=Math.max(0,Math.min(j+o,f));o=Math.max(0,Math.min(k+o,g));j=s-j;k=o-k;d.style.width=s+"px";d.style.height=o+"px";UI_setPosition(d,c.openLeft()?q-j:q,c.openUp()?l-k:l);c.opened&&s==f&&o==g&&h();if(!c.opened&&(s==0||o==0))h()},50);b=setTimeout(h,100)};
function UI_initForm(a){if(!a.ui_fields){a.ui_fields=[];a.ui_buttons=[];a.checkAutoComplete=function(){for(var b=0;b<a.ui_fields.length;b++){var c=a.ui_fields[b];if(c.hasDropdown&&c.hasDropdown()){a.setAttribute("autocomplete","off");return}}a.setAttribute("autocomplete","on")};UI_registerHandler(a,"submit",UI_submitHandler);a._oldSubmit=a.submit;a.submit=function(){UI_submitReplacement(a)};a.rawSubmit=function(b){UI_disableButtons(a);b&&UI_includeButtonValue(a,b);a._oldSubmit()}}}
function UI_submitHandler(a){a=new UI_Event(a);for(var b=a.srcDomElement();b.form;)b=b.form;var c=a.submitField();b.ui_submitter=c&&c.tagName=="BUTTON"?c:false;document.ui_submitField=false;if(!b.onsubmit){UI_checkForm(b);UI_disableButtons(b)}a.stopDefault();return false}function UI_submitReplacement(a){UI_checkForm(a);UI_disableButtons(a);return false}
function UI_includeButtonValue(a,b){if(a.button)a.button.value=b;else{var c=document.createElement("input");c.type="hidden";c.name="button";c.value=b;a.appendChild(c)}}
function UI_checkForm(a){UI_ErrorChecker.checkWidgets(a.ui_fields,function(b,c,d){if(b==undefined){a.ui_submitter&&a.ui_submitter.name&&UI_includeButtonValue(a,a.ui_submitter.name);a.ui_submitter=false;UI_fixFields(a);a._oldSubmit()}else{UI_enableButtons(a);b.runCallbacks("submitBlocked",{id:b.id,value:b.value(),failedTest:c,ignore:function(){b.ignoreTest&&b.ignoreTest(c)},message:d})}});return"busy"}
function UI_disableButtons(a){for(var b=0;b<a.ui_buttons.length;b++)a.ui_buttons[b].disable();b=a.getAttribute("target");if(!(b&&b!="_self"&&b!="_top"&&b!="_parent")){if(!a.ui_busy){a.ui_busy=document.createElement("div");a.ui_busy.className="ui_busy";document.body.appendChild(a.ui_busy)}a.ui_busy.style.display="block"}}function UI_enableButtons(a){for(var b=0;b<a.ui_buttons.length;b++)a.ui_buttons[b].enable();if(a.ui_busy)a.ui_busy.style.display="none"}
function UI_fixFields(a){for(var b=0;b<a.ui_fields.length;b++){var c=a.ui_fields[b];c.fixValue&&c.fixValue()}}
function UI_Frame(a){this.id=a.id.substr(9);this.element=a;this._transition="smooth";this.type="fast";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.tagName=="IFRAME")if(this.frame1)this.frame2=c;else this.frame1=c;if(c.className=="ui_frame_soft_placeholder")this.softPlaceholder=$(c)}this.frame1.style.display="block";this.frame2.style.display="none";this._loaded=false;this.loadingFrame=null;this.source=this.frame1.src;var d=this;a=function(g){if(d.loadingFrame==undefined)return false;
if(d.loadingFrame.readyState=="interactive")return e(g);if(d.loadingFrame.readyState=="complete")return f(g)};var e=function(g){g=new UI_Event(g);if(!(!d.loadingFrame||g.srcDomElement()!=d.loadingFrame)){if(d.transition()=="smooth"||d.transition()=="fast")d.showLoadingFrame();if(d.transition()=="YYY"||d.transition()=="fast")d.softPlaceholder.animate({opacity:0},400,"swing",function(){$(this).css({display:"none"})})}},f=function(g){g=new UI_Event(g);if(!(!d.loadingFrame||g.srcDomElement()!=d.loadingFrame)){d.showLoadingFrame();
d.softPlaceholder.animate({opacity:0},400,"swing",function(){$(this).css({display:"none"})});d.loadingFrame=null;setTimeout(function(){d.runCallbacks("loaded",{url:d.source})});return true}};UI_registerHandler(this.frame1,"readystatechange",a);UI_registerHandler(this.frame1,"load",f);UI_registerHandler(this.frame2,"readystatechange",a);UI_registerHandler(this.frame2,"load",f);UI_registerHandler(document,"DOMFrameContentLoaded",e)}UI_initWidget(UI_Frame);
UI_Frame.container=function(){var a=window.frameElement,b=window.parent;if(!(a==null||!b.ui_widgets))return UI_findWidget(function(c){return c.widgetType()=="UI_Frame"&&(c.visibleFrame()==a||c.hiddenFrame()==a)},b)};UI_Frame.open=function(a,b){var c=UI_Frame.container();if(typeof c=="undefined")window.location.href=a;else c.open(a,b)};UI_Frame.reload=function(){var a=UI_Frame.container();typeof a=="undefined"?window.location.reload():a.reload()};
UI_Frame.show=function(){var a=window.frameElement;a!=null&&window.parent.UI_Tabs.show(a)};UI_Frame.prototype.setTransition=function(a){this._transition=a};UI_Frame.prototype.transition=function(){return this._transition};
UI_Frame.prototype.showLoadingFrame=function(){if(this.loadingFrame&&this.visibleFrame()!=this.loadingFrame){this.visibleFrame().style.display="none";this.loadingFrame.style.display="block";this.visibleFrame().name=this.hiddenFrame().name;this.hiddenFrame().name="";this.hiddenFrame().contentWindow.location="about:blank";var a=this.contentWindow();try{a!=undefined&&a.UI_recalculate&&a.UI_recalculate()}catch(b){}return true}return false};
UI_Frame.prototype.recalculate=function(){this.type=="auto"&&!this._loaded&&this.load();var a=this.contentWindow();try{a&&a.UI_recalculate&&a.UI_recalculate()}catch(b){}};UI_Frame.prototype.preHide=function(){var a=this.contentWindow();try{a&&a.UI_preHide&&a.UI_preHide()}catch(b){}};UI_Frame.prototype.containerElement=function(){return this.element};UI_Frame.prototype.visibleFrame=function(){return this.frame1.style.display=="block"?this.frame1:this.frame2};
UI_Frame.prototype.hiddenFrame=function(){return this.frame2.style.display=="block"?this.frame1:this.frame2};UI_Frame.prototype.setSrc=function(a){this.source=a;var b=this;switch(this.type){case "fast":this.load();break;case "delayed":setTimeout(function(){b.load()},10);break;case "auto":this.reload()}};UI_Frame.prototype.src=function(){return this.source};UI_Frame.prototype.setType=function(a){this.type=a};UI_Frame.prototype.open=function(a,b){var c=b?b:this.transition();if(a)this.source=a;this.load(c)};
UI_Frame.prototype.load=function(a){this._loaded=true;this.runCallbacks("beginLoading",{url:this.source});a=a?a:this.transition();a!="direct"&&this.softPlaceholder.css({opacity:0,display:"block"}).animate({opacity:0.6},400,"swing");this.preHide();this.hiddenFrame().contentWindow.location=this.source;this.loadingFrame=this.hiddenFrame();if(a=="direct"||a=="XXX"||a=="YYY")this.showLoadingFrame()};
UI_Frame.prototype.reload=function(){if(this.type=="auto"){if(!this._loaded)return;this._loaded=false;var a=UI_Tabs.findTab(this.element);if(typeof a!="object"||!a.shown())return}this.load()};UI_Frame.prototype.loaded=function(){return this._loaded};UI_Frame.prototype.contentWindow=function(){return this.visibleFrame().contentWindow};UI_Frame.prototype.contentDocument=function(){return this.visibleFrame().contentDocument};
function UI_Gadget(a){this.element=a;this.jelement=$(a);this.id=a.id.substr(10);this.jwindowshader=$("#ui_gadget_"+this.id+"_window_shader");this.windows={};this.previousWindow=this.currentWindow=false;a=function(c){this[c]=function(){UI_GadgetWindow.prototype[c].apply(this.currentWindow,arguments)}};for(var b in UI_GadgetWindow.prototype)typeof UI_Gadget.prototype[b]=="undefined"&&typeof this[b]=="undefined"&&a.call(this,b);UI_Gadget.items.push(this)}UI_initWidget(UI_Gadget);UI_Gadget.items=[];
UI_Gadget.prototype.containerElement=function(a){return typeof a=="boolean"&&a?this.jelement:this.element};
UI_Gadget.prototype.setWindows=function(a){for(var b=function(h){this.show(h.target.parentNode.id.substr(this.id.length+16))}.bind(this),c=0;c<a.windows.length;c++){var d=a.windows[c].name,e=a.windows[c].menu,f=document.getElementById("ui_gadget_window_"+this.id+"_"+d),g=document.getElementById("ui_gadget_icon_"+this.id+"_"+d);this.windows[d]=f.className=="ui_gadget_window ui_gadget_modal_window"?new UI_GadgetModalWindow(f,this,d,e,g):new UI_GadgetWindow(f,this,d,e,g);g!==null&&$("#"+g.id).click(b)}this.currentWindow=
this.windows[a.show];this.resetToolbar(true);if(UI_Gadget.items[UI_Gadget.items.length-1]===this)for(c=0;c<UI_Gadget.items.length;c++)(function(h){var j=UI_Gadget.items[h];setTimeout(function(){j.containerElement().style.visibility="visible";j.current().containerElement(true).css({opacity:0,visibility:"visible"}).animate({opacity:1},400,"swing")},h*200)})(c)};
UI_Gadget.prototype.show=function(a){if(typeof a=="string")a=this.windows[a];if(typeof a=="object")if(a!==this.currentWindow)if(a instanceof UI_GadgetModalWindow){this.jwindowshader.css({opacity:0,visibility:"visible"}).animate({opacity:0.6},400);a.containerElement(true).css({opacity:0,visibility:"visible"}).animate({opacity:1},400,"swing",function(){this.style.filter=""})}else if(this.currentWindow instanceof UI_GadgetWindow){this.currentWindow.containerElement().style.visibility="hidden";this.previousWindow=
this.currentWindow;this.currentWindow=a;this.resetToolbar();a.containerElement(true).css({opacity:0,visibility:"visible"}).animate({opacity:1},1E3,"swing",function(){this.style.filter=""})}};
UI_Gadget.prototype.resetToolbar=function(a){for(var b=document.getElementById("ui_gadget_icons_"+this.id).getElementsByTagName("li"),c=[],d=[],e=this.currentWindow.menu(),f=0;f<b.length;f++){var g=b.item(f),h=null;for(var j in this.windows)if(this.windows[j].icon()==g){h=this.windows[j];break}g=h.icon(true);if(g.css("display")!="none"){if(e!="all")e=="others"&&this.currentWindow!=h||c.push(g)}else if(this.currentWindow.menu()!="none")e=="others"&&this.currentWindow==h||h.hidden()||d.push(g)}if(typeof a==
"boolean"&&a){$.each(c,function(k,l){l.css({display:"none"})});$.each(d,function(k,l){l.css({display:"block",width:"16px"})})}else{$.each(c,function(k,l){l.animate({width:"0px"},500,"swing",function(){l.css({display:"none"})})});$.each(d,function(k,l){l.css({width:"0px",display:"block"}).animate({width:"16px"},500,"swing")})}};UI_Gadget.prototype.childbyname=function(a){return this.windows[a]};UI_Gadget.prototype.current=function(){return this.currentWindow};UI_Gadget.prototype.previous=function(){return this.previousWindow};
UI_GadgetWindow=function(a,b,c,d,e){this.element=a;this.name=c;this.gadget=b;this.menuPolicy=d;this.jelement=$("#"+a.id);this.toolbar=document.getElementById("ui_gadget_toolbar_"+b.id+"_"+c);this.jtoolbar=$(this.toolbar);this.content=document.getElementById("ui_gadget_window_"+b.id+"_"+c+"_content");this.jcontent=$(this.content);if(e!==null){this.windowIcon=e;this.jwindowIcon=$("#"+e.id);this.isHidden=this.jwindowIcon.css("display")=="none"}};
UI_GadgetWindow.prototype.containerElement=function(a){return typeof a=="boolean"&&a?this.jelement:this.element};UI_GadgetWindow.prototype.menu=function(){return this.menuPolicy};UI_GadgetWindow.prototype.setMenu=function(a){this.menuPolicy=a};UI_GadgetWindow.prototype.icon=function(a){return typeof a=="boolean"&&a?this.jwindowIcon:this.windowIcon};
UI_GadgetWindow.prototype.hide=function(a){if(a===false)return this.show();if(this.jwindowIcon.css("display")!="none"){this.gadget.current()===this&&this.gadget.show(this.gadget.previous());typeof this.jwindowIcon!="undefined"&&this.jwindowIcon.animate({opacity:0},1E3,"swing",function(){$(this).css({display:"none"})})}};
UI_GadgetWindow.prototype.show=function(a){if(a===false)return this.hide();this.jwindowIcon.css("display")!="inline-block"&&typeof this.jwindowIcon!="undefined"&&this.jwindowIcon.css({display:"inline-block"}).animate({opacity:1},1E3,"swing")};UI_GadgetWindow.prototype.hidden=function(){return this.isHidden};UI_GadgetWindow.prototype.flash=function(){this.containerElement(true).css({opacity:0,visibility:"visible"}).animate({opacity:1},1E3)};
UI_GadgetWindow.prototype.setTitle=function(a){this.jtoolbar.fadeOut();a=jQuery.trim(a);a==""?this.jcontent.animate({top:5},1E3):this.jcontent.animate({top:25},1E3,"swing",function(){this.jtoolbar.text(a);this.jtoolbar.fadeIn()}.bind(this))};function UI_GadgetModalWindow(a,b,c,d,e){UI_GadgetWindow.call(this,a,b,c,d,e);$("#ui_gadget_window_"+b.id+"_"+c+"_close").click(function(){this.close()}.bind(this))}UI_widgets.extend(UI_GadgetModalWindow,UI_GadgetWindow);
UI_GadgetModalWindow.prototype.close=function(){if(this.jelement.css("visibility")!="hidden"){this.jelement.animate({opacity:0},400,"swing",function(){$(this).css({visibility:"hidden"})});this.gadget.jwindowshader.animate({opacity:0},400,"swing",function(){$(this).css({visibility:"hidden"})})}};UI_GadgetModalWindow.prototype.hide=function(a){if(a===false)return this.show();this.close();UI_GadgetWindow.prototype.hide.call(this,true)};
UI_GadgetModalWindow.prototype.show=function(a){if(a===false)return this.hide();UI_GadgetWindow.prototype.show.call(this,true)};function UI_GeoOverlay(a){this.element=a;this.id=a.id.substr(14);this.mapholder=a.childNodes[0];this.throbber=a.childNodes[1];this.regionData=this.countryData=this.geomap=undefined;this.label="";this._dataLevel="Country";google.load("visualization","1",{packages:["geomap"]});google.setOnLoadCallback(this.recalculate);this.options={}}UI_initWidget(UI_GeoOverlay);
UI_GeoOverlay.prototype.scheduleRecalculate=function(){this.schedule&&clearTimeout(this.schedule);this.schedule=false;var a=this;this.schedule=setTimeout(function(){a.recalculate()},200)};
UI_GeoOverlay.prototype.recalculate=function(){if(this.countryData==undefined||typeof google.visualization=="undefined"||typeof google.visualization.DataTable=="undefined")typeof this.scheduleRecalculate=="function"&&this.scheduleRecalculate();else try{var a;if(this.regionData[this.options.region]){a=this.regionData[this.options.region];this._dataLevel="Region"}else{a=this.countryData;this._dataLevel="Country"}var b=0;for(var c in a)a.hasOwnProperty(c)&&b++;var d=new google.visualization.DataTable;
d.addRows(b);d.addColumn("string",this.dataLevel());d.addColumn("number",this.label);b=0;for(var e in a){var f=a[e];d.setValue(b,0,e);d.setValue(b,1,f);b++}this.options.showZoomOut=this.options.region!="world";this.options.zoomOutLabel=__tr("Zoom Out");if(typeof this.geomap=="undefined"){this.geomap=new google.visualization.GeoMap(this.mapholder);var g=this;google.visualization.events.addListener(this.geomap,"error",function(j){setTimeout(function(){g.runCallbacks("error",{message:j.message})})});
google.visualization.events.addListener(this.geomap,"select",function(){setTimeout(function(){if(g.dataMode!="regions")g.runCallbacks("select");else{var j=g.geomap.getSelection();g.runCallbacks("select",{selection:j})}})});google.visualization.events.addListener(this.geomap,"regionClick",function(j){j.region.length==2&&g.setRegion(j.region);setTimeout(function(){g.runCallbacks("clicked",{region:j.region})})});google.visualization.events.addListener(this.geomap,"zoomOut",function(){setTimeout(function(){g.runCallbacks("zoomOut")})});
google.visualization.events.addListener(this.geomap,"drawingDone",function(){setTimeout(function(){g.throbber.style.display="none";g.runCallbacks("done")})})}this.geomap.draw(d,this.options)}catch(h){console.log(h)}};UI_GeoOverlay.prototype.setData=function(a,b){this.countryData=a;this.regionData=b;this.geomap!=undefined&&this.scheduleRecalculate()};UI_GeoOverlay.prototype.setDataMode=function(a){this.options.dataMode=a;this.geomap!=undefined&&this.scheduleRecalculate()};
UI_GeoOverlay.prototype.dataLevel=function(){return this._dataLevel};UI_GeoOverlay.prototype.setDataLevel=function(a){this._dataLevel=a;this.geomap!=undefined&&this.scheduleRecalculate()};UI_GeoOverlay.prototype.region=function(){return this.options.region};UI_GeoOverlay.prototype.setRegion=function(a){this.options.region=String(a);this.geomap!=undefined&&this.scheduleRecalculate()};UI_GeoOverlay.prototype.setHeight=function(a){this.options.height=a+"px";this.geomap!=undefined&&this.scheduleRecalculate()};
UI_GeoOverlay.prototype.setWidth=function(a){this.options.width=a+"px";this.geomap!=undefined&&this.scheduleRecalculate()};UI_GeoOverlay.prototype.setColors=function(a){var b=[];for(var c in a)b.push(parseInt(a[c].substring(1),16));this.options.colors=b;this.geomap!=undefined&&this.scheduleRecalculate()};UI_GeoOverlay.prototype.setLabel=function(a){this.label=a;this.geomap!=undefined&&this.scheduleRecalculate()};UI_GeoOverlay.prototype.containerElement=function(){return this.element};
function UI_Grid(a){this.id=a.id.substr(8);this.element=a;this.header=new UI_GridHeader(this,document.getElementById("ui_grid_header_"+this.id));this.hscroller=new UI_GridHScroller(this,document.getElementById("ui_grid_hscroller_"+this.id));this.vscroller=new UI_GridVScroller(this,document.getElementById("ui_grid_vscroller_"+this.id));this.dataViewer=new UI_GridDataViewer(this,document.getElementById("ui_grid_data_"+this.id));this.scrollbarSettings=this.dataHandler=false;this.selectionMode="user-defined"}
UI_initWidget(UI_Grid);UI_Grid.prototype.initialize=function(a,b){this.dataHandler=b;this.dataHandler.initialize(this);this.selectionMode=a};UI_Grid.prototype.containerElement=function(){return this.element};UI_Grid.prototype.reload=function(a){this.dataHandler.reload(a)};UI_Grid.prototype.initializeDataViewer=function(a){this.dataViewer.initialize(a,this.header.getColumns());var b=this;setTimeout(function(){b.recalculate()})};
UI_Grid.prototype.columnClicked=function(a,b){this.dataRequired(this.dataViewer.firstRow,this.dataViewer.visibleRows);this.runCallbacks("columnClicked",{index:a,ordered:a,sort:b,width:this.header.columns[a].width()})};
UI_Grid.prototype.rowClicked=function(a,b){var c=this.header.sortedColumn(),d={index:a,orderColumn:c?c.column:false,orderType:c?c.type:false,widget:this};this.runCallbacks("rowClicked",d);if(this.selectionMode=="single")if(b){this.dataViewer.selectRow(a,false);this.runCallbacks("rowUnselected",d)}else{for(var e=this.dataViewer.selectedRows(),f=0;f<e.length;f++){this.dataViewer.selectRow(e[f],false);this.runCallbacks("rowUnselected",{index:e[f],orderColumn:c.column,orderType:c.type})}this.dataViewer.selectRow(a,
true);this.runCallbacks("rowSelected",d)}else if(this.selectionMode=="multiple"){this.dataViewer.selectRow(a,!b);this.runCallbacks(b?"rowUnselected":"rowSelected",d)}};
UI_Grid.prototype.columnResized=function(a,b){this.recalculate();this.header.element.style.left=-this.hscroller.value()+"px";this.dataViewer.setColumnSize(a,this.header.columns[a].width()+this.header.seperators[a].width());var c=this.header.sortedColumn();c?this.runCallbacks("columnResized",{index:a,ordered:c.column,sort:c.type,width:b}):this.runCallbacks("columnResized",{index:a,ordered:false,sort:false,width:b})};
UI_Grid.prototype.horizontalPositionChanged=function(a){this.header.element.style.left=-a+"px";this.dataViewer.setLeftPosition(a);this.runCallbacks("horizontalPositionChanged",{value:a})};UI_Grid.prototype.verticalPositionChanged=function(a){this.dataViewer.setStartPosition(a);this.runCallbacks("verticalPositionChanged",{value:a})};UI_Grid.prototype.mouseWheelMoved=function(a){this.vscroller.setValue(a);this.runCallbacks("mouseWheelMoved",{value:a})};
UI_Grid.prototype.recalculate=function(){this.dataViewer.recalculate();var a=this.vscroller.containerElement(),b=this.hscroller.containerElement(),c=this.dataViewer.containerElement();if(this.scrollbarSettings===false||!this.scrollbarSettings.valid()){this.scrollbarSettings=new UI_GridScrollbarSettings;b.style.height=this.scrollbarSettings.height+"px";a.style.width=this.scrollbarSettings.width+"px"}var d=this.element.offsetWidth,e=this.element.offsetHeight;this.header.height();if(this.header.width()<=
d&&this.dataViewer.height()+this.header.height()<=e){this.header.containerElement().style.width=d+"px";b.style.display="none";a.style.display="none";c.style.bottom="0px";c.style.right="0px"}else if(this.header.width()>d-this.scrollbarSettings.width&&this.dataViewer.height()+this.header.height()>e-this.scrollbarSettings.height){b.style.display="block";a.style.display="block";b.style.width=Math.max(1,d-this.scrollbarSettings.width)+"px";a.style.height=Math.max(1,e-this.scrollbarSettings.height)+"px";
c.style.right=this.scrollbarSettings.width+"px";c.style.bottom=this.scrollbarSettings.height+"px"}else if(this.header.width()>d){b.style.display="block";a.style.display="none";b.style.width=d+"px";c.style.right="0px";c.style.bottom=this.scrollbarSettings.height+"px"}else{b.style.display="none";a.style.display="block";a.style.height=e+"px";c.style.right=this.scrollbarSettings.width+"px";c.style.bottom="0px"}if(b.style.display=="block"){c=a.style.display=="none"?this.element.offsetWidth:this.element.offsetWidth-
this.scrollbarSettings.width;this.hscroller.setValues(this.hscroller.value(),c,0,this.header.width())}if(a.style.display=="block"){a=this.element.offsetHeight-this.header.height();if(b.style.display=="block")a-=this.scrollbarSettings.width;this.vscroller.setValues(this.vscroller.value(),a,0,this.dataViewer.height())}this.header.recalculate();this.runCallbacks("recalculated",{width:d,height:e})};
UI_Grid.prototype.dataRequired=function(a,b){if(this.dataHandler){var c=function(){this.runCallbacks("rowsLoaded",{widget:this,start:a,length:b})}.bind(this),d=this.header.sortedColumn();d?this.dataHandler.dataRequired(a,b,d.column,d.type,d.datatype,c):this.dataHandler.dataRequired(a,b,false,false,false,c)}};UI_Grid.prototype.selectRow=function(a,b){this.dataViewer.selectRow(a,b)};UI_Grid.prototype.rowSelected=function(a){return this.dataViewer.isSelected(a)};UI_Grid.prototype.selectedRows=function(){return this.dataViewer.selectedRows()};
UI_Grid.prototype.selectAllRows=function(a){this.dataViewer.selectAllRows(a)};UI_Grid.prototype.setColumnLabel=function(a,b){this.header.setLabel(a,b)};UI_Grid.prototype.setColumnSize=function(a,b){this.header.setSize(a,b)};UI_Grid.prototype.sorted=function(){return this.header.sortedColumn()};UI_Grid.prototype.setSorted=function(a,b){this.header.setSorted(a,b)};UI_Grid.prototype.setDataType=function(a,b){this.header.setDataType(a,b)};UI_Grid.prototype.dataType=function(a){return this.header.dataType(a)};
UI_Grid.prototype.setRows=function(a,b){b.length>0&&this.dataViewer.setRows(a,b)};UI_Grid.prototype.setRow=function(a,b){this.dataViewer.setRowData(a,b)};UI_Grid.prototype.width=function(){return this.vscroller.containerElement().style.display=="none"?this.element.offsetWidth-this.vscroller.containerElement().offsetWidth:this.element.offsetWidth};
UI_Grid.prototype.height=function(){return this.hscroller.containerElement().style.display=="none"?this.element.offsetHeight-this.hscroller.containerElement().offsetHeight:this.element.offsetHeight};UI_Grid.prototype.scrollbarVisible=function(a){if(a=="horizontal"&&this.hscroller.containerElement().style.display=="block")return true;if(a=="vertical"&&this.vscroller.containerElement().style.display=="block")return true;return false};UI_Grid.prototype.visibleRowData=function(a){return this.dataViewer.rowData(a)};
UI_Grid.prototype.getFirstRow=function(){return this.dataViewer.getFirstRow()};UI_Grid.prototype.getVisibleRows=function(){return this.dataViewer.getVisibleRows()};UI_Grid.prototype.dataID=function(a,b){this.dataHandler.dataID(a,b)};UI_Grid.prototype.data=function(a,b){var c=this.visibleRowData(a);c==undefined?this.dataHandler.data(a,b):setTimeout(function(){b(c)})};UI_Grid.prototype.rowCount=function(){return this.dataViewer.rowCount()};UI_Grid.prototype.getHeader=function(){return this.header};
function UI_GridColumn(a,b,c){this.gridHeader=a;this.index=c;this.sortDataType="text";var d=this;this.element=b=typeof b=="undefined"?function(){for(var e=0,f=d.gridHeader.getColumns(),g=0;g<f.length;g++)e+=f[g].width()+4;f=d.gridHeader.containerElement();g=d.gridHeader.columnRemainerElement();var h=document.createElement("div");h.className="ui_grid_column";h.style.width="50px";h.style.left=e+"px";e=document.createElement("div");e.className="ui_grid_column_enabled";h.appendChild(e);var j=document.createElement("div");
j.className="ui_grid_column_label";e.appendChild(j);j=document.createElement("div");j.className="ui_grid_column_icon";e.appendChild(j);f.insertBefore(h,g);return h}():b;b.onclick=function(){d.disabled()||d.gridHeader.columnClicked(d.index)};disableSelection(b);for(a=0;a<b.childNodes.length;a++){c=b.childNodes[a];if(c.className=="ui_grid_column_enabled")this.statusElement=c}for(a=0;a<this.statusElement.childNodes.length;a++){c=this.statusElement.childNodes[a];if(c.className=="ui_grid_column_label")this.labelElement=
c;if(c.className=="ui_grid_column_icon")this.iconElement=c}}UI_GridColumn.prototype.setLabel=function(a){if(this.labelElement.innerText!=undefined)this.labelElement.innerText=a;else this.labelElement.textContent=a};UI_GridColumn.prototype.label=function(){return this.labelElement.innerText!=undefined?this.labelElement.innerText:this.labelElement.textContent};UI_GridColumn.prototype.width=function(){if(this._width)return this._width;return this._width=parseInt(this.element.style.width,10)};
UI_GridColumn.prototype.setWidth=function(a){if(a<10)a=10;this._width=false;this.element.style.width=a+"px"};UI_GridColumn.prototype.setPosition=function(a){this.element.style.left=a+"px"};UI_GridColumn.prototype.position=function(){return parseInt(this.element.style.left,10)};UI_GridColumn.prototype.setSorted=function(a){this.iconElement.className=a=="asc"||a=="desc"?"ui_grid_column_icon_"+a:"ui_grid_column_icon"};
UI_GridColumn.prototype.sorted=function(){if(this.iconElement.className=="ui_grid_column_icon")return false;return this.iconElement.className.substr(20)};UI_GridColumn.prototype.setDataType=function(a){this.sortDataType=a};UI_GridColumn.prototype.dataType=function(){return this.sortDataType};UI_GridColumn.prototype.disabled=function(){return this.statusElement.className=="ui_grid_column_disabled"};
UI_GridColumn.prototype.setDisabled=function(a){this.statusElement.className=a?"ui_grid_column_disabled":"ui_grid_column_enabled"};UI_GridColumn.prototype.getIndex=function(){return this.index};UI_GridColumn.prototype.setIndex=function(a){this.index=a};UI_GridColumn.prototype.remove=function(a){this.element.onclick=null;this.gridHeader.containerElement().removeChild(this.element);typeof a!="undefined"&&a||this.gridHeader.removeColumn(this.getIndex())};
function UI_GridData(a,b){this.element=b;this.grid=a}UI_GridData.prototype.containerElement=function(){return this.element};UI_GridData.prototype.width=function(){return 100};UI_GridData.prototype.height=function(){return 100};
function UI_GridDataViewer(a,b){this.element=b;this.grid=a;this.initalized=this.table=false;this.tableModified=true;this.selected=[];this.rowHeight=this.startPos=this.firstRow=this.visibleRows=this.countRows=0;this.rows=[];var c=this,d=function(e){var f=0;if(!e)e=window.event;if(e.wheelDelta){f=-e.wheelDelta/2;if(window.opera)f=-f}else if(e.detail)f=e.detail*10;if(f<-c.startPos)f=-c.startPos;e=c.height()-b.offsetHeight-c.startPos;if(f>e)f=e;f&&a.mouseWheelMoved(c.startPos+f);return false};if(b.addEventListener)b.addEventListener("DOMMouseScroll",
d,false);else b.onmousewheel=d}UI_GridDataViewer.prototype.initialize=function(a,b){this.modified=!(this.columns==b&&this.countRows==a);if(!(this.initialized&&!this.modified)){this.columns=b;this.countRows=a;this.tableModified=this.initialized=true;this.recalculate()}};UI_GridDataViewer.prototype.recalculate=function(){if(this.initialized&&this.modified){this.constructTable();this.grid.dataRequired(this.getFirstRow(),this.getVisibleRows())}};UI_GridDataViewer.prototype.containerElement=function(){return this.element};
UI_GridDataViewer.prototype.getRow=function(a){a-=this.firstRow;if(!(a<0||a>=this.visibleRows))return this.rows[a]};UI_GridDataViewer.prototype.rowData=function(a){a=this.getRow(a);if(a==undefined)return a;return a.data()};UI_GridDataViewer.prototype.selectRow=function(a,b){if(b)in_array(a,this.selected)||this.selected.push(a);else for(i=0;i<this.selected.length;i++)a==this.selected[i]&&this.selected.splice(i,1);var c=this.getRow(a);c!=undefined&&c.select(b)};
UI_GridDataViewer.prototype.isSelected=function(a){return in_array(a,this.selected)};UI_GridDataViewer.prototype.selectedRows=function(){return this.selected};UI_GridDataViewer.prototype.selectAllRows=function(a){this.selected=[];if(a)for(var b=0;b<this.countRows;b++)this.selected.push(b);for(b=0;b<this.rows.length;b++)this.rows[b].select(a)};UI_GridDataViewer.prototype.rowClicked=function(a){a+=this.firstRow;this.grid.rowClicked(a,this.isSelected(a))};
UI_GridDataViewer.prototype.height=function(){return this.countRows*this.rowHeight+5};UI_GridDataViewer.prototype.setRowCount=function(a){this.countRows=a;this.modified=true};UI_GridDataViewer.prototype.rowCount=function(){return this.countRows};UI_GridDataViewer.prototype.setRowData=function(a,b){var c=this.getRow(a);c!=undefined&&c.setData(b)};UI_GridDataViewer.prototype.setRows=function(a,b){for(var c=0;c<b.length;c++)this.setRowData(c+a,b[c])};
UI_GridDataViewer.prototype.setLeftPosition=function(a){this.element.style.left=-a+"px"};UI_GridDataViewer.prototype.setStartPosition=function(a){this.startPos=a;var b=Math.floor(a/this.rowHeight);this.table.style.top=-(a%this.rowHeight)+"px";if(b!=this.firstRow){this.firstRow=b;this.truncateTable();this.grid.dataRequired(this.firstRow,this.visibleRows)}};UI_GridDataViewer.prototype.startPosition=function(){return this.startPos};UI_GridDataViewer.prototype.getFirstRow=function(){return this.firstRow};
UI_GridDataViewer.prototype.getVisibleRows=function(){return this.visibleRows};UI_GridDataViewer.prototype.setColumnSize=function(a,b){if(this.countRows!=0){var c=this.table.getElementsByTagName("tr"),d=this.grid.header.width(),e=this.grid.element.offsetWidth;e=d<e?e-d:0;for(var f=0;f<c.length;f++){var g=c[f].getElementsByTagName("td");g[a].style.width=b+"px";g[g.length-1].style.width=e+"px"}this.table.style.width=d+e+"px";this.element.style.width=d+e+"px"}};
UI_GridDataViewer.prototype.truncateTable=function(){for(var a=0;a<this.rows.length;a++){var b=this.rows[a];b.truncate();b.select(in_array(a+this.firstRow,this.selected))}};
UI_GridDataViewer.prototype.constructTable=function(){var a=this.element.offsetHeight;if(this.table!==false){if(this.table.offsetHeight>a&&!this.tableModified)return;this.element.removeChild(this.table);this.rows=[]}a=this.element.offsetHeight;this.table=document.createElement("table");this.table.id="ui_grid_table_"+this.grid.id;this.table.cellSpacing=0;this.element.appendChild(this.table);if(this.countRows!=0){var b=document.createElement("div");b.innerHTML="&nbsp;";for(disableSelection(b);;){var c=
0,d=this.table.rows.length+this.firstRow,e=this.table.insertRow(this.table.rows.length);this.rows.push(new UI_GridDataRow(this,e,this.rows.length,in_array(d,this.selected)));for(d=0;d<this.columns.length;d++){var f=e.insertCell(e.cells.length),g=d==0?this.columns[d].width()+2:this.columns[d].width()+this.grid.header.seperators[d].width();f.width=g;f.appendChild(b.cloneNode(true));c+=g}c=this.grid.width()-c<0?0:this.grid.width()-c;e=e.insertCell(e.cells.length);e.style.width=c+"px";e.appendChild(b.cloneNode(true));
if(a==0||this.table.offsetHeight>a||this.countRows==this.rows.length)break}this.visibleRows=this.table.getElementsByTagName("tr").length;a=this.table.getElementsByTagName("tr")[0].offsetHeight;if(a>0)this.rowHeight=a;this.tableModified=false}};UI_GridDataViewer.prototype.toString=function(){return"CountRows: "+this.countRows+" | VisibleRows: "+this.visibleRows+" | firstRow: "+this.firstRow+" | startPos: "+this.startPos};
function UI_GridDataRow(a,b,c,d){this.element=b;this.gridDataViewer=a;this.index=c;this.select(d);var e=this;this.element.onclick=function(){e.gridDataViewer.rowClicked(e.index)}}UI_GridDataRow.prototype.select=function(a){this.element.className=a?"active":"passive"};
UI_GridDataRow.prototype.setData=function(a){for(var b=this.element.getElementsByTagName("td"),c=0;c<b.length-1;c++){var d=b[c].childNodes[0];if(d.textContent||d.textContent=="")d.textContent=a[c][0];else d.innerText=a[c][0]==null?"":a[c][0];a[c].length>1&&a[c][1]?d.setAttribute("style",a[c][1]):d.setAttribute("style","")}};UI_GridDataRow.prototype.data=function(){for(var a=[],b=this.element.getElementsByTagName("td"),c=0;c<b.length-1;c++){var d=b[c].childNodes[0];a.push(d.innerText?d.innerText:d.textContent)}return a};
UI_GridDataRow.prototype.truncate=function(){for(var a=this.element.getElementsByTagName("td"),b=0;b<a.length-1;b++)a[b].childNodes[0].innerHTML="&nbsp;"};function UI_GridFixedDataHandler(a,b){this.grid=false;this.sorted={column:undefined,type:undefined};this.data=[];for(var c=0;c<a.keys.length;c++)this.data.push({id:a.keys[c],fields:a.values[c]});this.sorting=b;this.userDefinedSort=b.substr(0,10)=="javascript"?b.substr(11):false}
UI_GridFixedDataHandler.prototype.initialize=function(a){this.grid=a;var b=this;setTimeout(function(){b.grid.initializeDataViewer(b.data.length)})};UI_GridFixedDataHandler.prototype.reload=function(){};
UI_GridFixedDataHandler.prototype.dataRequired=function(a,b,c,d,e,f){var g=this;a=function(h,j){if(g.userDefinedSort)return g.userDefinedSort(h.fields[c][0],j.fields[c][0]);else if(g.sorting=="numeric"||e=="numeric")return parseFloat(h.fields[c][0])-parseFloat(j.fields[c][0]);else if(g.sorting=="caseInsensitive"){var k=h.fields[c][0].toString().toUpperCase(),l=j.fields[c][0].toString().toUpperCase();return k==l?0:k<l?-1:1}else if(g.sorting=="caseSensitive"){k=h.fields[c][0].toString();l=j.fields[c][0].toString();
return k==l?0:k<l?-1:1}else{k=h.fields[c][0];l=j.fields[c][0];if(isNaN(parseInt(h,10))||isNaN(parseInt(j,10))){k=h.toString().toUpperCase();l=j.toString().toUpperCase();return k==l?0:k<l?-1:1}else return k-l}};if(c!=undefined&&(typeof c=="number"||typeof c=="boolean"&&c!=false)&&c!=this.sorted.column){this.data.sort(a);this.sorted.column=c;this.sorted.type="asc"}if(c!=undefined&&(typeof c=="number"||typeof c=="boolean"&&c!=false)&&d!=this.sorted.type){this.data.reverse();this.sorted.type=d}d=[];for(a=
0;a<this.data.length;a++)d.push(this.data[a].fields);this.grid.setRows(0,d);f()};UI_GridFixedDataHandler.prototype.totalRows=function(){return this.data.length};UI_GridFixedDataHandler.prototype.dataID=function(a,b){var c=this;setTimeout(function(){b(c.data[a].id)})};UI_GridFixedDataHandler.prototype.data=function(a,b){var c=this;setTimeout(function(){b(c.data[a].fields)})};
function UI_GridHScroller(a,b){this.grid=a;this.element=b;this.inside=false;for(var c=0;c<b.childNodes.length;c++){var d=b.childNodes[c];if(d.className=="ui_grid_hscroller_inside")this.inside=d}this.helper=new UI_GridScroller(this);var e=this;b.onscroll=function(){a.horizontalPositionChanged(e.value())}}UI_GridHScroller.prototype.containerElement=function(){return this.element};UI_GridHScroller.prototype.availablePixels=function(){return this.element.offsetWidth};
UI_GridHScroller.prototype.scrollPosition=function(){return this.element.scrollLeft};UI_GridHScroller.prototype.insidePixels=function(){return this.inside.offsetWidth};UI_GridHScroller.prototype.setInsideSize=function(a){this.inside.style.width=a+"px"};UI_GridHScroller.prototype.setPosition=function(a){this.element.scrollLeft=a};UI_GridHScroller.prototype.value=function(){return this.helper.value()};UI_GridHScroller.prototype.setValue=function(a){this.helper.setValue(a)};
UI_GridHScroller.prototype.setValues=function(a,b,c,d){this.helper.setValues(a,b,c,d)};
function UI_GridHeader(a,b){this.grid=a;this.element=b;this.columns=[];this.seperators=[];this.element.style.width=this.grid.element.style.width;this.remainerElement=false;for(var c=0;c<this.element.childNodes.length;c++){var d=this.element.childNodes[c];if(d.className=="ui_grid_column")this.columns.push(new UI_GridColumn(this,d,this.columns.length));else if(d.className=="ui_grid_seperator"){var e=this.seperators.length==0?false:this.seperators[this.seperators.length-1];d=new UI_GridSeperator(this,
d,this.seperators.length);this.seperators.push(d);d.setMinLimit(e?e.position()+20:20)}else if(d.className=="ui_grid_columnremainer")this.remainerElement=d}var f=this;setTimeout(function(){f.remainerElement.style.width="100%"})}UI_GridHeader.prototype.containerElement=function(){return this.element};UI_GridHeader.prototype.columnRemainerElement=function(){return this.remainerElement};
UI_GridHeader.prototype.columnClicked=function(a){for(var b=0;b<this.columns.length;b++)b!=a&&this.columns[b].setSorted(false);b=this.columns[a].sorted();b=b==false||b=="desc"?"asc":"desc";this.columns[a].setSorted(b);this.grid.columnClicked(a,b)};UI_GridHeader.prototype.seperatorStartMoving=function(){for(var a=0;a<this.columns.length;a++)this.columns[a].setDisabled(true)};
UI_GridHeader.prototype.seperatorBusyMoving=function(a,b){for(var c=a+1;c<this.columns.length;c++){var d=this.columns[c],e=this.seperators[c];d.setPosition(d.position()+b);e.setPosition(e.position()+b);e.setMinLimit(e.minLimit()+b)}this.remainerElement.style.left=parseInt(this.remainerElement.style.left,10)+b+"px";this.remainerElement.style.width=Math.max(0,parseInt(this.remainerElement.style.width,10)-b)+"px";this.columns[a].setWidth(this.columns[a].width()+b)};
UI_GridHeader.prototype.seperatorFinishedMoving=function(a){for(var b=0;b<this.columns.length;b++)this.columns[b].setDisabled(false);this.grid.columnResized(a,this.columns[a].width())};UI_GridHeader.prototype.label=function(a){return this.columns[a].label()};UI_GridHeader.prototype.setLabel=function(a,b){this.columns[a].setLabel(b)};
UI_GridHeader.prototype.size=function(a){var b=this.columns[a].width();if(a>0)b+=Math.ceil(this.seperators[a-1].width()/2);return b+Math.floor(this.seperators[a].width()/2)};UI_GridHeader.prototype.setSize=function(a,b){if(a>0)b-=Math.ceil(this.seperators[a-1].width()/2);b-=Math.floor(this.seperators[a].width()/2);b>10&&this.columns[a].setSize(b)};
UI_GridHeader.prototype.sortedColumn=function(){for(var a=0;a<this.columns.length;a++){var b=this.columns[a];if(b.sorted())return{column:b.getIndex(),type:b.sorted(),datatype:b.dataType()}}return false};UI_GridHeader.prototype.sorted=function(a){return this.columns[a].setSorted(sort)};UI_GridHeader.prototype.setSorted=function(a,b){var c=this.sortedColumn();c!=false&&c.column!=a&&this.columns[c.column].setSorted(false);this.columns[a].setSorted(b)};UI_GridHeader.prototype.setDataType=function(a,b){this.columns[a].setDataType(b)};
UI_GridHeader.prototype.dataType=function(a){return this.columns[a].dataType()};UI_GridHeader.prototype.width=function(){if(this.seperators.length==0)return 0;var a=this.seperators[this.seperators.length-1];return a.position()+a.width()};UI_GridHeader.prototype.height=function(){return this.element.offsetHeight};UI_GridHeader.prototype.getColumns=function(){return this.columns};
UI_GridHeader.prototype.addColumn=function(a,b){var c=new UI_GridColumn(this,undefined,this.getColumns().length);this.getColumns().push(c);typeof a!="undefined"&&c.setLabel(a);typeof b!="undefined"&&c.setWidth(b);this.addSeperator();this.recalculate();return c};UI_GridHeader.prototype.removeColumn=function(a){this.columns[a].remove(true);this.seperators[a].removeElement();this.columns.splice(a,1);this.seperators.splice(a,1);for(a=0;a<this.columns.length;a++){this.columns[a].setIndex(a);this.seperators[a].setIndex(a)}this.recalculate()};
UI_GridHeader.prototype.removeAllColumns=function(){for(var a=0;a<this.columns.length;a++){this.columns[a].remove(true);this.seperators[a].removeElement()}this.columns=[];this.seperators=[]};UI_GridHeader.prototype.addSeperator=function(){var a=this.seperators.length==0?false:this.seperators[this.seperators.length-1],b=new UI_GridSeperator(this,undefined,this.seperators.length);this.seperators.push(b);b.setMinLimit(a?a.position()+20:20)};
UI_GridHeader.prototype.recalculate=function(){this.columns[0].setPosition(0);this.seperators[0].setPosition(this.columns[0].width());this.seperators[0].setMinLimit(20);for(var a=this.size(0),b=1;b<this.columns.length;b++){this.columns[b].setPosition(a+4);this.seperators[b].setPosition(a+this.columns[b].width());this.seperators[b].setMinLimit(this.seperators[b-1].minLimit()+20);a+=this.size(b)}this.remainerElement.style.left=a+"px"};
function UI_GridLdxDataHandler(a,b,c){this.grid=false;this.ldx=a;this.init=c;this.timer=0;this.cache=new UI_Cache(1E3);this.pendingRequest=false;this.sortedOrder=this.sortedColumn=undefined;this.dataType=false}
UI_GridLdxDataHandler.prototype.initialize=function(a){this.grid=a;a={what:"gridInitialize",id:this.grid.id};var b=this;if(this.init){b.grid.initializeDataViewer(this.init.rows);this.numberOfRows=this.init.rows;b.setCallbacks(this.init.columnsResizable,this.init.columnsClickable,this.init.rowsClickable)}else ldxSendCallback(this.ldx,a,function(c){b.grid.initializeDataViewer(c.rows);this.numberOfRows=c.rows;b.setCallbacks(c.columnsResizable,c.columnsClickable,c.rowsClickable)})};
UI_GridLdxDataHandler.prototype.reload=function(a){if(typeof a!="undefined"){this.cache.clear();this.grid.initializeDataViewer(a);this.numberOfRows=a}else{var b=this;ldxSendCallback(this.ldx,{what:"gridInitialize",id:this.grid.id},function(c){b.cache.clear();b.numberOfRows=c.rows;b.grid.initializeDataViewer(c.rows)})}};
UI_GridLdxDataHandler.prototype.setCallbacks=function(a,b,c,d){var e=this;a&&this.grid.registerCallback("columnResized",function(f){ldxSendCallback(e.ldx,{what:"gridColumnResized",id:e.grid.id,column:f.index,ordered:f.ordered,sort:f.sort,width:f.width},function(g){e.grid.runCallbacks("columnResizedProcessed",g)})});b&&this.grid.registerCallback("columnClicked",function(f){ldxSendCallback(e.ldx,{what:"gridColumnClicked",id:e.grid.id,column:f.index,ordered:f.index,sort:f.sort,width:f.width},function(g){e.grid.runCallbacks("columnClickedProcessed",
g)})});c&&this.grid.registerCallback("rowClicked",function(f){ldxSendCallback(e.ldx,{what:"gridRowClicked",id:e.grid.id,row:f.index,ordered:f.orderColumn,sort:f.orderType},function(g){e.grid.runCallbacks("rowClickedProcessed",g)})});if(d){this.grid.registerCallback("rowSelected",function(f){ldxSendCallback(e.ldx,{what:"gridRowSelected",id:e.grid.id,row:f.index,ordered:f.orderColumn,sort:f.orderType},function(g){e.grid.runCallbacks("rowSelectedProcessed",g)})});this.grid.registerCallback("rowUnselected",
function(f){ldxSendCallback(e.ldx,{what:"gridRowUnselected",id:e.grid.id,row:f.index,ordered:f.orderColumn,sort:f.orderType},function(g){e.grid.runCallbacks("rowUnselectedProcessed",g)})})}};UI_GridLdxDataHandler.prototype.retreiveLdx=function(){return this.ldx};
UI_GridLdxDataHandler.prototype.dataRequired=function(a,b,c,d,e,f){if(this.numberOfRows&&b+a>this.numberOfRows)b=this.numberOfRows-a;if(this.ldx){var g=this;if(c!=this.sortedColumn||d!=this.sortedOrder||e!=this.dataType)this.cache.clear();this.sortedColumn=c;this.sortedOrder=d;this.dataType=e;for(var h=0,j=0,k=0;k<b;k++){var l=this.cache.get(k+a);if(l==undefined)break;g.grid.setRow(k+a,l);h++}if(!(h>=b)){for(k=b-1;k>=0;k--){l=this.cache.get(k+a);if(l==undefined)break;g.grid.setRow(k+a,l);j++}var q=
{what:"gridData",id:this.grid.id,start:a+h,length:b-h-j,ordered:c>=0?c:-1,sort:d,dataType:e?e:"text"};if(!(q.length<=0)){if(this.timer){if(function(o,s){for(var x in o)if(o[x]!=s[x])return false;return true}(this.pendingRequest,q))return;clearTimeout(this.timer)}this.pendingRequest=q;if(q.start<g.grid.getFirstRow()||q.start>g.grid.getFirstRow()+g.grid.getVisibleRows()){g.timer=false;g.pendingRequest=false}else ldxSendCallback(g.ldx,q,function(o){for(var s=0;s<o.length;s++){g.cache.store(q.start+s,
o[s]);g.grid.setRow(q.start+s,o[s])}g.pendingRequest=false;g.timer=false;f()})}}}};UI_GridLdxDataHandler.prototype.dataID=function(a,b){var c=this.grid.sorted();ldxSendCallback(this.ldx,{what:"gridDataId",id:this.grid.id,row:a,ordered:c?c.column:0,sort:c?c.type:"asc"},b)};
UI_GridLdxDataHandler.prototype.data=function(a,b){var c=function(e){for(var f=[],g=0;g<e.length;g++)f.push(e[g][0]);return f},d=this.cache.get(a);d==undefined?ldxSendCallback(this.ldx,{what:"gridData",id:this.grid.id,start:a,length:1,sort:this.sortedOrder,ordered:this.sortedColumn},function(e){b(c(e[0]))}):setTimeout(function(){b(c(d))})};
function UI_GridScrollbarSettings(){var a=document.createElement("div");a.style.width="100px";a.style.height="100px";a.style.overflow="scroll";a.style.visibility="hidden";a.style.position="absolute";a.style.zIndex=-10000;var b=document.createElement("div");b.style.width="500px";b.style.height="500px";a.appendChild(b);document.body.appendChild(a);this.width=a.offsetWidth-a.clientWidth+1;this.height=a.offsetHeight-a.clientHeight+1;this.isValid=this.width>1&&this.height>1;this.width=Math.max(10,this.width);
this.height=Math.max(10,this.height);a.style.display="none"}UI_GridScrollbarSettings.prototype.valid=function(){return this.isValid};function UI_GridScroller(a){this.scroller=a;this.maxValue=this.minValue=0;this.visibleAmount=1;this.emulatedMaxValue=1E5;this.emulatedMinValue=0;this.scale=1;this.emulated=false;this.scrollPosition=0;this.setValue(0)}
UI_GridScroller.prototype.value=function(){if(this.emulated){var a=this.scroller.insidePixels();if(a==0)return this.emulatedMinValue;a=Math.round(this.scroller.scrollPosition()*this.emulatedRange()/a+this.emulatedMinValue);var b=this.scroller.scrollPosition()/this.emulatedMaxValue;a+=Math.round(b*this.scroller.availablePixels());a=Math.ceil(a*this.scale)}else{a=this.scroller.insidePixels();if(a==0)return this.minValue;a=Math.round(this.scroller.scrollPosition()*this.range()/a+this.minValue)}return a};
UI_GridScroller.prototype.visible=function(){return this.visibleAmount};UI_GridScroller.prototype.range=function(){return this.maxValue-this.minValue};UI_GridScroller.prototype.emulatedRange=function(){return this.emulatedMaxValue-this.emulatedMinValue};UI_GridScroller.prototype.min=function(){return this.minValue};UI_GridScroller.prototype.max=function(){return this.maxValue};
UI_GridScroller.prototype.setValue=function(a){if(a<this.minValue)a=this.minValue;if(a>this.maxValue-this.visibleAmount)a=this.maxValue-this.visibleAmount;var b=this.range(),c=this.scroller.availablePixels(),d=0,e=0;d=Math.round(b*c/this.visibleAmount);e=Math.round(a*d/b);if(this.emulated){d=this.emulatedMaxValue;e/=this.scale}this.scroller.setInsideSize(d);this.scroller.setPosition(e)};
UI_GridScroller.prototype.setValues=function(a,b,c,d){if(b<1)b=1;if(d<c+b)d=c+b;this.visibleAmount=b;this.minValue=c;this.maxValue=d;if(this.emulated)this.scale=this.range()/this.emulatedRange();else if(navigator.userAgent.indexOf("Firefox")!=-1&&d>=9999990)this.emulated=true;else if(navigator.appName=="Microsoft Internet Explorer"&&navigator.userAgent.match(/MSIE\s[89]\.0/)&&d>=1342177)this.emulated=true;this.setValue(a)};
function UI_GridSeperator(a,b,c){var d=this;this.gridHeader=a;this.index=c;this.element=typeof b=="undefined"?function(){var l=a.containerElement(),q=a.columnRemainerElement(),o=a.getColumns(),s=o[o.length-1];o=document.createElement("div");o.className="ui_grid_seperator";o.style.left=s.position()+s.width()+"px";s=document.createElement("div");s.className="ui_grid_seperator_left";o.appendChild(s);s=document.createElement("div");s.className="ui_grid_seperator_right";o.appendChild(s);l.insertBefore(o,
q);return o}():b;this.minLeft=0;var e=false,f=false,g=0,h=function(l){d.element.onmousedown=null;l=new UI_Event(l);e=l.client();g=0;f={left:parseInt(d.element.style.left,10),right:parseInt(d.element.style.right,10)};d.element.onmousemove=k;d.element.onmouseup=j;d.element.onlosecapture=j;d.element.setCapture();a.seperatorStartMoving(d.index)},j=function(){d.element.releaseCapture();d.element.onmousemove=null;d.element.onmouseup=null;d.element.onlosecapture=null;d.element.onmousedown=h;d.element.parentNode.style.cursor=
"";a.seperatorFinishedMoving(d.index)},k=function(l){l=(new UI_Event(l)).client();g+=l.x-e.x;var q=parseInt(d.element.style.left,10),o=Math.max(d.minLeft,q+g);q=o-q;g-=q;if(q!=0){d.element.style.left=o+"px";a.seperatorBusyMoving(d.index,q)}e=l};d.element.onmousedown=h}UI_GridSeperator.prototype.setPosition=function(a){this.element.style.left=a+"px"};UI_GridSeperator.prototype.position=function(){return parseInt(this.element.style.left,10)};
UI_GridSeperator.prototype.setMinLimit=function(a){this.minLeft=a};UI_GridSeperator.prototype.minLimit=function(){return this.minLeft};UI_GridSeperator.prototype.width=function(){if(this._width)return this._width;return this._width=this.element.offsetWidth};UI_GridSeperator.prototype.removeElement=function(){this.element.onmousedown=null;this.gridHeader.containerElement().removeChild(this.element)};UI_GridSeperator.prototype.getIndex=function(){return this.index};
UI_GridSeperator.prototype.setIndex=function(a){this.index=a};function UI_GridVScroller(a,b){this.grid=a;this.element=b;this.inside=false;for(var c=0;c<b.childNodes.length;c++){var d=b.childNodes[c];if(d.className=="ui_grid_vscroller_inside")this.inside=d}this.helper=new UI_GridScroller(this);this.enableScrolling=true;var e=this;b.onscroll=function(){a.verticalPositionChanged(e.value())}}UI_GridVScroller.prototype.containerElement=function(){return this.element};
UI_GridVScroller.prototype.availablePixels=function(){return this.element.offsetHeight};UI_GridVScroller.prototype.scrollPosition=function(){return this.element.scrollTop};UI_GridVScroller.prototype.insidePixels=function(){return this.inside.offsetHeight};UI_GridVScroller.prototype.setInsideSize=function(a){this.inside.style.height=a+"px"};UI_GridVScroller.prototype.setPosition=function(a){this.element.scrollTop=a};UI_GridVScroller.prototype.value=function(){return this.helper.value()};
UI_GridVScroller.prototype.setValue=function(a){this.helper.setValue(a)};UI_GridVScroller.prototype.setValues=function(a,b,c,d){this.helper.setValues(a,b,c,d)};function UI_Group(){this.selectables=[]}UI_Group.prototype.selected=function(a){for(var b=0;b<this.selectables.length;b++)this.selectables[b]!=a&&this.selectables[b].select(false)};UI_Group.prototype.add=function(a){this.selectables.push(a)};function UI_HumanDateMutation(a,b,c,d){this.operator=a;this.count=b;this.unit=c;this.floor=d}
UI_HumanDateMutation.parse=function(a){var b=__tr("%count %unit %mutation (floored to %floor)").replace("(","\\(").replace(")","\\)").replace("%count","(\\d+)").replace("%unit","(\\w+)").replace("%mutation","(.+)").replace("%floor","(\\w+)");if(a.match(new RegExp(b))||a.match(/(\d+) (\w+) (.*)/)){var c=function(e){if(e==__tr("year")||e==__tr("years"))return"year";if(e==__tr("month")||e==__tr("months"))return"month";if(e==__tr("week")||e==__tr("weeks"))return"week";if(e==__tr("day")||e==__tr("days"))return"day";
if(e==__tr("hour")||e==__tr("hours"))return"hour";if(e==__tr("minute")||e==__tr("minutes"))return"minute";if(e==__tr("second")||e==__tr("seconds"))return"second"};a=parseInt(RegExp.$1,10);b=c(RegExp.$2);var d=function(e){if(e==__tr("ago"))return"min";if(e==__tr("in the future"))return"plus"}(RegExp.$3);c=RegExp.$4?c(RegExp.$4):"second";if(!(isNaN(a)||!b||!d||!c))return new UI_HumanDateMutation(d,a,b,c)}};
UI_HumanDateMutation.prototype.toString=function(){var a=function(b,c){switch(c){case "second":return b==1?__tr("second"):__tr("seconds");case "minute":return b==1?__tr("minute"):__tr("minutes");case "hour":return b==1?__tr("hour"):__tr("hours");case "day":return b==1?__tr("day"):__tr("days");case "week":return b==1?__tr("week"):__tr("weeks");case "month":return b==1?__tr("month"):__tr("months");case "year":return b==1?__tr("year"):__tr("years")}};a={count:this.count,unit:a(this.count,this.unit),
mutation:this.operator=="min"?__tr("ago"):__tr("in the future"),floor:a(0,this.floor)};return a.floor=="second"?__tr("%count %unit %mutation",a):__tr("%count %unit %mutation (floored to %floor)",a)};
UI_HumanDateMutation.prototype.apply=function(a){if(a==undefined)a=new Date;var b=this.operator=="min"?-this.count:this.count;switch(this.unit){case "year":a.setFullYear(a.getFullYear()+b);break;case "month":a.setMonth(a.getMonth()+b);break;case "week":a.setDate(a.getDate()+b*7);break;case "day":a.setDate(a.getDate()+b);break;case "hour":a.setHours(a.getHours()+b);break;case "minute":a.setMinutes(a.getMinutes()+b);break;case "second":a.setSeconds(a.getSeconds()+b);break}switch(this.floor){case "year":a.setSeconds(0);
a.setMinutes(0);a.setHours(0);a.setDate(1);a.setMonth(0);break;case "month":a.setSeconds(0);a.setMinutes(0);a.setHours(0);a.setDate(1);break;case "day":a.setSeconds(0);a.setMinutes(0);a.setHours(0);break;case "hour":a.setSeconds(0);a.setMinutes(0);break;case "minute":a.setSeconds(0);break;case "second":break}return a};function UI_Icon(a){this.id=a.id.substr(8);this.element=a;this.jelement=$(a);UI_registerHandler(a,"click",function(){this.runCallbacks("clicked")}.bind(this))}UI_initWidget(UI_Icon);
UI_Icon.create=function(a){var b=document.createElement("img");b.className="ui_icon";b.id="ui_icon_"+a.id;var c=typeof a.icon=="undefined"?"about":a.icon,d=typeof a.size=="undefined"?16:a.size,e=typeof a.alt=="undefined"?c:a.alt,f=typeof a.path=="undefined"?UI_resourcesURL().resources+"/icons/"+d+"x"+d+"/":a.path;b.setAttribute("src",f+c+".png");b.setAttribute("height",d);b.setAttribute("width",d);b.setAttribute("alt",e);typeof a.style!="undefined"&&b.setAttribute("style",a.style);typeof a.title!=
"undefined"&&b.setAttribute("title",a.title);return new UI_Icon(b)};UI_Icon.prototype.containerElement=function(a){if(typeof a!="boolean")a=false;return a?this.jelement:this.element};UI_Icon.prototype.recalculate=function(){};UI_Icon.prototype.hide=function(){this.element.style.display="none"};UI_Icon.prototype.show=function(){this.element.style.display="block"};
UI_Icon.prototype.setIcon=function(a,b){if(this.element.src.match(/^(.*)\/\d\dx\d\d/)){var c=RegExp.$1;this.element.width=this.element.height=b;this.element.src=c+"/"+(b+"x"+b)+"/plain/"+a+".gif"}};
function UI_Item(a){this.id=a.id.substr(8);this.element=a.childNodes[0];this.enabled=true;disableSelection(a);var b=this,c=function(){if(b.enabled){b.element.style.marginTop="1px";b.element.style.marginLeft="1px";b.element.style.marginRight="0px";b.element.onmouseup=d}},d=function(){if(b.enabled){b.element.style.marginTop="0px";b.element.style.marginLeft="0px";b.element.style.marginRight="1px";b.element.onmousedown=c}};a.onmousedown=c}UI_initWidget(UI_Item);UI_Item.prototype.recalculate=function(){};
UI_Item.prototype.containerElement=function(){return this.element};UI_Item.prototype.setEnabled=function(a){this.enabled=a;this.element.className=a?"ui_item_enabled":"ui_item_disabled"};function UI_namespace(a){if(a.charAt(0)==".")a=a.substr(1);if(window==window.top){if(typeof UI_namespace.items[a]=="undefined")return null;return UI_namespace.items[a].UI_openNest("ui_namespace."+a+".namespace")}else return window.top.UI_namespace(a)}
function UI_registerNamespace(a,b){if(a.charAt(0)==".")a=a.substr(1);if(window==window.top){if(typeof UI_namespace.items=="undefined")UI_namespace.items={};if(typeof b=="undefined"){b=window;UI_openNest("ui_namespace."+a+".namespace")}UI_namespace.items[a]=b}else{window.top.UI_registerNamespace(a,window);UI_openNest("ui_namespace."+a+".namespace");var c=UI_Frame.container();typeof c!="undefined"?c.registerExpendableCallback("beginLoading",UI_unregisterNamespace.bind(this,a)):UI_registerHandler(window,
"unload",UI_unregisterNamespace.bind(this,a))}}function UI_unregisterNamespace(a){if(a[0]==".")a=a.substr(1);if(window==window.top)delete UI_namespace.items[a];else window.top.UI_unregisterNamespace(a)}
function UI_Notifier(){this.id="notifier";var a=[],b=this,c=function(){if(parent&&parent!=window&&parent.ui_widgets&&parent.ui_widgets.notifier)return parent.ui_widgets.notifier;return false};this.registerCallback=function(d,e,f){if(typeof f!="boolean")f=true;f&&a.push({type:d,callback:e});if(f=c())return f.registerCallback(d,e,false);return UI_Notifier.prototype.registerCallback.call(b,d,e)};this.unregisterCallback=function(d,e){var f=c();if(f)return f.unregisterCallback(d,e);return UI_Notifier.prototype.unregisterCallback.call(b,
d,e)};this.runCallbacks=function(d,e){var f=c();if(f)return f.runCallbacks(d,e);return UI_Notifier.prototype.runCallbacks.call(b,d,e)};UI_registerHandler(window,"unload",function(){for(var d=0;d<a.length;d++)b.unregisterCallback(a[d].type,a[d].callback)})}UI_initWidget(UI_Notifier);UI_Notifier.prototype.containerElement=function(){return document.body};
function UI_Pie(a){this.element=a;this.jelement=$(a);this.id=a.id.substr(7);this.tooltips=false;var b=this;this.settings={chart:{renderTo:a.id,backgroundColor:null,plotBackgroundColor:null,plotBorderWidth:null,plotShadow:false},credits:{enabled:false},title:{text:""},legend:{enabled:true},plotOptions:{pie:{allowPointSelect:true,cursor:"pointer",showInLegend:true,dataLabels:{enabled:false,distance:20,formatter:function(){return this.point.name+" ("+Math.round(this.percentage)+"%)"}}}},tooltip:{enabled:true,
formatter:function(){if(!b.tooltips)return false;return"<b>"+this.point.name+"</b> ("+Math.round(this.percentage)+"%)"}}}}UI_initWidget(UI_Pie);UI_Pie.prototype.recalculate=function(){this.schedule&&clearTimeout(this.schedule);var a=this;this.schedule=setTimeout(function(){a.scheduledRecalculate()})};
UI_Pie.prototype.scheduledRecalculate=function(){if(!(typeof this.data!="object"||this.data.length==0))if(!(this.jelement.width()==0||this.jelement.height()==0))if(this.pie==undefined){var a=this,b=UI_Frame.container();if(typeof b!="undefined"&&b.contentWindow()!=window){a=this;var c=function(){a.pie=new Highcharts.Chart(a.settings);b.unregisterCallback("loaded",c)};b.registerCallback("loaded",c)}else this.pie=new Highcharts.Chart(this.settings)}else{this.pie.setSize(this.jelement.width(),this.jelement.height(),
false);this.pie.redraw()}};
UI_Pie.prototype.filterSeriesData=function(){if(typeof this.data=="object"){this.runCallbacks("dataAvailable",{widget:this});data=function(){var a=[],b=typeof this.colors=="object"&&this.colors.constructor==Array?0:false;for(var c in this.data){var d={name:c,y:parseInt(this.data[c],10)};if(typeof b=="number"){d.color=this.colors[b];++b;if(b==this.colors.length)b=0}a.push(d)}return a}.call(this);this.settings.series=[{type:"pie",data:data}];typeof this.pie!="undefined"?this.pie.series[0].setData(data):this.recalculate()}};
UI_Pie.prototype.setData=function(a){this.data=a;this.filterSeriesData()};UI_Pie.prototype.setHeight=function(a){this.settings.height=a;typeof this.pie!="undefined"&&this.settings.width!="undefined"&&this.pie.setSize(this.settings.width,this.settings.height)};UI_Pie.prototype.setWidth=function(a){this.settings.width=a;typeof this.pie!="undefined"&&this.settings.height!="undefined"&&this.pie.setSize(this.settings.width,this.settings.height)};UI_Pie.prototype.setColors=function(a){this.colors=a;this.filterSeriesData()};
UI_Pie.prototype.setTitle=function(a){this.settings.title.text=a;typeof this.pie!="undefined"&&this.pie.setTitle({text:a})};UI_Pie.prototype.showLegend=function(a){this.settings.legend.enabled=a};UI_Pie.prototype.showLineLabels=function(a){this.settings.plotOptions.pie.dataLabels.enabled=a};UI_Pie.prototype.showTooltips=function(a){this.tooltips=a};UI_Pie.prototype.containerElement=function(a){return typeof a=="boolean"&&a?this.jelement:this.element};
function UI_Popup(a){this.id=a.id.substr(9);this.element=a;this.jelement=$(a);this.contentElement=false;this.centered=true;var b=false;var c=this.titleElement=false,d=false,e=false,f=false,g=false,h=false,j=false;this.restoreLocation=false;this.position={left:0,top:0};this.size={height:0,width:0};var k=this,l=function(n){n=new UI_Event(n);n=n.client();var v={x:n.x-h.x,y:n.y-h.y};UI_setPosition(g,n.x-200,n.y-200);if(j.className.indexOf("Left")>0){var z=parseInt(c.style.left,10)+v.x,u=parseInt(c.style.width,
10)-v.x;if(u<147){u=147-u;n.x-=u;z-=u;u=147}c.style.left=z+"px";c.style.width=u+"px"}if(j.className.indexOf("Top")>0){z=parseInt(c.style.top,10)+v.y;u=parseInt(c.style.height,10)-v.y;if(u<50){u=50-u;n.y-=u;z-=u;u=50}c.style.top=z+"px";c.style.height=u+"px"}if(j.className.indexOf("Right")>0){u=parseInt(c.style.width,10)+v.x;if(u<147){n.x+=147-u;u=147}c.style.width=u+"px"}if(j.className.indexOf("Bottom")>0){u=parseInt(c.style.height,10)+v.y;if(u<50){n.y+=50-u;u=50}c.style.height=u+"px"}h=n},q=function(n){n=
new UI_Event(n);a.style.left=parseInt(a.style.left,10)+parseInt(c.style.left,10)+5+"px";a.style.top=parseInt(a.style.top,10)+parseInt(c.style.top,10)+5+"px";a.style.width=parseInt(c.style.width,10)-1+"px";a.style.height=parseInt(c.style.height,10)-1+"px";c.style.display="none";g.style.display="none";j.onmousedown=o;j.onmouseup=null;j.onmousemove=null;j.releaseCapture();setTimeout(function(){k.limitSize()},0)},o=function(n){if(!k.maximized()){c.style.display="block";c.style.left="-5px";c.style.top=
"-5px";c.style.width=a.offsetWidth-1+"px";c.style.height=a.offsetHeight-1+"px";n=new UI_Event(n);h=n.client();j=n.srcDomElement();j.onmousemove=l;j.onmouseup=q;j.onmousedown=null;g.style.display="block";UI_setPosition(g,h.x-200,h.y-200);g.style.cursor=UI_getStyle(j,"cursor");j.setCapture()}},s=function(n){if(a.style.visibility!="visible")return true;n=new UI_Event(n);if(n.keyCode()!=UI_Event.KEY_ESC)return true;n.stopDefault();k.runCallbacks("closed");return false};UI_registerHandler(document,"keydown",
s);for(var x=function(n){n=new UI_Event(n);frame=n.srcDomElement();if(frame.readyState!=undefined&&frame.readyState!="complete")return true;if(frame.contentWindow!=undefined){UI_registerHandler(frame.contentWindow.document,"keydown",s);m(frame.contentWindow.document)}},m=function(n){if(n.tagName=="IFRAME"){UI_registerHandler(n,"load",x);UI_registerHandler(n,"readystatechange",x);if(n.contentWindow){UI_registerHandler(n.contentWindow.document,"keydown",s);m(n.contentWindow.document)}}else for(var v=
0;v<n.childNodes.length;v++)m(n.childNodes[v])},r=0;r<a.childNodes.length;r++){var p=a.childNodes[r];if(p.className=="ui_popupTop")b=p;if(p.className=="ui_popupBottom")this.contentElement=p;if(p.className=="ui_popupTopLeft")p.onmousedown=o;if(p.className=="ui_popupTopCenter")p.onmousedown=o;if(p.className=="ui_popupTopRight")p.onmousedown=o;if(p.className=="ui_popupLeftTop")p.onmousedown=o;if(p.className=="ui_popupLeftCenter")p.onmousedown=o;if(p.className=="ui_popupLeftBottom")p.onmousedown=o;if(p.className==
"ui_popupRightTop")p.onmousedown=o;if(p.className=="ui_popupRightCenter")p.onmousedown=o;if(p.className=="ui_popupRightBottom")p.onmousedown=o;if(p.className=="ui_popupBottomLeft")p.onmousedown=o;if(p.className=="ui_popupBottomCenter")p.onmousedown=o;if(p.className=="ui_popupBottomRight")p.onmousedown=o;if(p.className=="ui_popupSizer")c=p;if(p.className=="ui_popupFollower")g=p;m(p)}for(r=0;r<b.childNodes.length;r++){p=b.childNodes[r];if(p.className=="ui_popupTitle")this.titleElement=p;if(p.className==
"ui_popupClose")d=p;if(p.className=="ui_popupResize")e=p;if(p.className=="ui_popupMinimize")f=p}d.onmousedown=function(n){n=new UI_Event(n);n.stopDefault();k.runCallbacks("closed");return false};e.onmousedown=function(n){n=new UI_Event(n);n.stopDefault();k.runCallbacks("maximized");return false};f.onmousedown=function(n){n=new UI_Event(n);n.stopDefault();k.runCallbacks("minimized");return false};var y=function(n){if(!k.maximized()){UI_hideFrames(a,true);n=new UI_Event(n);h=n.client();k.titleElement.onmousedown=
null;k.titleElement.onmousemove=w;k.titleElement.onmouseup=t;k.titleElement.setCapture();k.runCallbacks("startMoving")}},t=function(){UI_hideFrames(a,false);k.titleElement.onmousedown=y;k.titleElement.releaseCapture();k.titleElement.onmousemove=null;k.titleElement.onmouseup=null;var n=UI_getPosition(a);k.runCallbacks("endMoving",{left:n.left,top:n.top})},w=function(n){n=new UI_Event(n);n=n.client();var v={x:n.x-h.x,y:n.y-h.y},z=UI_getPosition(a),u=z.left+v.x;v=z.top+v.y;z=document.documentElement.clientWidth?
document.documentElement.clientWidth:document.body.clientWidth;var A=document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight;if(u<0)u=0;if(u+a.clientWidth>z)u=z-a.clientWidth;if(v<0)v=0;if(v+a.clientHeight>A)v=A-a.clientHeight;UI_setPosition(a,u,v);h=n};this.titleElement.onmousedown=y}UI_initWidget(UI_Popup);UI_Popup.prototype.recalculate=function(){this.centered&&this.centerPopup();this.limitSize()};
UI_Popup.prototype.limitSize=function(){var a=document.documentElement.clientWidth?document.documentElement.clientWidth:document.body.clientWidth,b=document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight;if(this.element.clientWidth>a){this.element.style.width=a+"px";this.element.style.left="0px"}if(this.element.clientHeight>b){this.element.style.height=b+"px";this.element.style.top="0px"}};UI_Popup.prototype.containerElement=function(){return this.contentElement};
UI_Popup.prototype.show=function(){if(this.element.style.visibility!="visible"){if(this.restoreLocation){this.setPosition(this.position.left,this.position.top);this.setSize(this.size.width,this.size.height)}this.jelement.css({visibility:"visible",zIndex:700,opacity:0}).animate({opacity:1},600,"swing",function(){this.element.style.filter=""}.bind(this));this.centered&&this.centerPopup()}};
UI_Popup.prototype.hide=function(){if(this.element.style.visibility!="hidden"){this.normalize();this.jelement.animate({opacity:0},300,"swing",function(){$(this).css({zIndex:-10,visibility:"hidden"})});this.position=UI_getPosition(this.element);this.size={width:parseInt(this.element.style.width,10),height:parseInt(this.element.style.height,10)};this.setPosition(0,0);this.setSize(0,0);this.restoreLocation=true}};
UI_Popup.prototype.maximized=function(){if(this.element.style.visibility!="visible")return false;if(this.element.style.top!="0px")return false;if(this.element.style.left!="0px")return false;if(this.element.style.right!="0px")return false;if(this.element.style.bottom!="0px")return false;return true};
UI_Popup.prototype.maximize=function(){if(!this.maximized())if(this.minimized())this.normalize();else{this.show();this.position=UI_getPosition(this.element);this.size={width:parseInt(this.element.style.width,10),height:parseInt(this.element.style.height,10)};if(this.element.style.removeAttribute){this.element.style.removeAttribute("width");this.element.style.removeAttribute("height")}else{this.element.style.removeProperty("width");this.element.style.removeProperty("height")}this.element.style.top=
"0px";this.element.style.left="0px";this.element.style.right="0px";this.element.style.bottom="0px"}};UI_Popup.prototype.minimized=function(){if(this.element.style.visibility!="visible")return false;if(this.element.style.height!="0px")return false;return true};
UI_Popup.prototype.minimize=function(){if(!this.minimized()){this.show();if(!this.maximized()){this.position=UI_getPosition(this.element);this.size={width:parseInt(this.element.style.width,10),height:parseInt(this.element.style.height,10)}}this.element.style.removeAttribute?this.element.style.removeAttribute("height"):this.element.style.removeProperty("height");this.element.style.height="0px"}};
UI_Popup.prototype.normalize=function(){if(this.maximized()||this.minimized())if(this.maximized()&&this.minimized())this.element.style.removeAttribute?this.element.style.removeAttribute("height"):this.element.style.removeProperty("height");else{if(this.element.style.removeAttribute){this.element.style.removeAttribute("right");this.element.style.removeAttribute("bottom")}else{this.element.style.removeProperty("right");this.element.style.removeProperty("bottom")}this.setPosition(this.position.left,
this.position.top);this.setSize(this.size.width,this.size.height)}};UI_Popup.prototype.visible=function(){return this.element.style.visibility=="visible"};UI_Popup.prototype.setPosition=function(a,b){if(!this.maximized()){this.restoreLocation=false;UI_setPosition(this.element,a,b)}};
UI_Popup.prototype.centerPopup=function(){if(!this.maximized())if(this.visible()){this.centered=true;var a=0,b=0;if(typeof window.innerWidth=="number"){a=window.innerWidth;b=window.innerHeight}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){a=document.documentElement.clientWidth;b=document.documentElement.clientHeight}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){a=document.body.clientWidth;b=document.body.clientHeight}this.setPosition((a-
this.element.offsetWidth)/2,(b-this.element.offsetHeight)/2)}};UI_Popup.prototype.setSize=function(a,b){this.restoreLocation=false;var c=document.documentElement.clientWidth?document.documentElement.clientWidth:document.body.clientWidth,d=document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight;if(a>c)a=c;if(b>d)b=d;if(a>0)this.element.style.width=a+"px";if(b>0)this.element.style.height=b+"px";this.centered&&this.centerPopup()};
UI_Popup.prototype.setTitle=function(a){this.titleElement.innerHTML=a};function UI_Radio(a){this.element=a;this.id=a.id.substr(9);this.inputElement=document.getElementById("ui_radio_input_"+this.id);var b=this;b.inputElement.onclick=function(){b.runCallbacks("clicked",b)};b.inputElement.onchange=function(){b.runCallbacks("changed",b)}}UI_initWidget(UI_Radio);UI_Radio.prototype.containerElement=function(){return this.element};
UI_Radio.prototype.disable=function(a){if(a==undefined)a=true;this.inputElement.disabled=a};UI_Radio.prototype.enable=function(a){if(a==undefined)a=true;this.disable(!a)};UI_Radio.prototype.checked=function(){return this.inputElement.checked};UI_Radio.prototype.check=function(a){if(a==undefined)a=true;this.inputElement.checked=a};
function UI_RichtextEditor(a){UI_Editor.call(this,a);this.initialized="no";this.first=true;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.tagName=="TEXTAREA"){this.textarea=c;if(c.form==null)break;UI_initForm(c.form);c.form.ui_fields.push(this);break}}}UI_widgets.extend(UI_RichtextEditor,UI_Editor);UI_RichtextEditor.prototype.tinyMCE=function(){return tinyMCE.get("ui_editor_area_"+this.id)};
UI_RichtextEditor.prototype.initTinyMCE=function(){if(this.initialized=="busy"){var a=this;if(window.clipboardData?this.element.currentStyle.hasLayout:this.element.offsetWidth>0&&this.element.offsetHeight>0){tinyMCE.execCommand("mceAddControl",false,"ui_editor_area_"+this.id);this.first=false}else setTimeout(function(){a.initTinyMCE()},100)}};
UI_RichtextEditor.prototype.recalculate=function(){if(window.clipboardData?this.element.currentStyle.hasLayout:this.element.offsetWidth>0&&this.element.offsetHeight>0){if(this.initialized=="no"){this.initialized="busy";var a=this;setTimeout(function(){a.initTinyMCE()},this.first&&window.clipboardData?100:0)}if(this.initialized=="yes"){a=this;var b=this.tinyMCE();if(b){var c=UI_findElement(function(f){return f.tagName&&f.tagName.toLowerCase()=="table"},b.getContainer()),d=b.getContentAreaContainer(),
e=d.childNodes[0];b=Math.max(c.offsetHeight-d.offsetHeight,0);c.style.width="110px";d.style.width="108px";e.style.width="108px";c.style.height="110px";d.style.height=110-b+"px";e.style.height=110-b+"px";setTimeout(function(){var f=Math.max(0,c.offsetHeight-d.offsetHeight);if(!(a.element.offsetWidth<5))if(!(a.element.offsetHeight-f<5)){c.style.width=a.element.offsetWidth+"px";d.style.width=a.element.offsetWidth-2+"px";e.style.width=a.element.offsetWidth-2+"px";c.style.height=a.element.offsetHeight+
"px";d.style.height=a.element.offsetHeight-f+"px";e.style.height=a.element.offsetHeight-f+"px"}})}}}else{this.initialized=="yes"&&tinyMCE.execCommand("mceRemoveControl",false,"ui_editor_area_"+this.id);this.initialized="no"}};UI_RichtextEditor.prototype.content=function(){return this.initialized=="yes"?UI_RichtextEditorSaveCallback(false,this.tinyMCE().getContent(),false):this.textarea.value};
UI_RichtextEditor.prototype.setContent=function(a){if(this.initialized=="yes")this.tinyMCE().setContent(a);else this.textarea.value=a};UI_RichtextEditor.prototype.value=UI_RichtextEditor.prototype.content;UI_RichtextEditor.prototype.fixValue=function(){this.textarea.value=this.value()};
var UI_RichtextEditorInitialized=function(a){var b=a.id.substr(15);ui_widgets[b].initialized="yes";ui_widgets[b].recalculate();a=ui_widgets[b].tinyMCE();var c=ui_widgets[b];a.onKeyUp.add(function(){c.contentChanged=true});a.onMouseDown.add(function(){var d,e=document.getElementById(a.editorId);if(document.createEvent){var f=navigator.userAgent.toLowerCase().indexOf("chrome")>-1;d=document.createEvent("MouseEvents");f?d.initMouseEvent("mousedown",true,true,e,0,0,0,0,0,false,false,false,false,0,null):
d.initMouseEvent("mousedown",true,true,window,0,0,0,0,0,false,false,false,false,0,null);e.dispatchEvent(d)}else e.fireEvent&&e.fireEvent("onmousedown")})},UI_RichtextEditorSaveCallback=function(a,b){b=b.replace(/\{[^\}]*\}/g,function(c){return c.replace(/\&amp;/gi,"&").replace(/\&nbsp;/gi," ").replace(/%20/g," ").replace(/\&quot;/gi,'"')});if(navigator.userAgent.toLowerCase().indexOf("firefox")>=0&&b.substring(b.length-6)=="<br />")b=b.substring(0,b.length-6);return b},UI_RichtextEditorExecCommand=
function(a,b,c){if(c=="JustifyLeft"||c=="JustifyCenter"||c=="JustifyRight"||c=="JustifyFull"){b=tinyMCE.getInstanceById(a).getContent();var d=b.match("<p"),e=b.match("<div");b.match("<br");if(d||e)return false;switch(c){case "JustifyLeft":b='<p style="text-align: left;"">'+b+"</p>";case "JustifyRight":b='<p style="text-align: right;">'+b+"</p>";case "JustifyCenter":b='<p style="text-align: center;">'+b+"</p>";case "JustifyFull":b='<p style="text-align: justify;">'+b+"</p>"}tinyMCE.getInstanceById(a).setContent(b);
return true}return false};UI_RichtextEditor.prototype.isChanged=function(){if(this.tinyMCE())return this.tinyMCE().isDirty();return false};
function UI_Roller(a){this.element=a;this.id=a.id.substr(10);this.loader=document.getElementById(a.id+"_loader");this.fullyLoaded=this.loader.style.display!="block";this.EOFHandlers=[];this.runningUpdates=0;this.initialized=false;if(!this.fullyLoaded){this.loader.style.display="none";var b=function(){if(!this.fullyLoaded)this.loader.style.display="block";this.initialized=true;UI_unregisterHandler(this.element,"scroll",b)}.bind(this);UI_registerHandler(this.element,"scroll",b)}UI_registerHandler(this.element,
"scroll",function(){if(!(this.fullyLoaded||this.runningUpdates>0))if(!(this.element.scrollTop+this.element.clientHeight<this.element.scrollHeight-28))for(var c=true,d=function(g){this.runningUpdates--;c&=g;this.runningUpdates>0||c&&this.EOF(true)},e=function(g){setTimeout(function(){g(this.element,d)})}.bind(this),f=0;f<this.EOFHandlers.length;f++){this.runningUpdates++;e(this.EOFHandlers[f])}}.bind(this))}UI_initWidget(UI_Roller);UI_Roller.prototype.containerElement=function(){return this.element};
UI_Roller.prototype.registerEOFHandler=function(a){typeof a=="function"&&this.EOFHandlers.push(a)};UI_Roller.prototype.EOF=function(a){this.fullyLoaded=a;if(this.initialized)this.loader.style.display=a?"none":"block"};
function UI_Select(a){this.id=a.id.substr(10);this.element=a;var b=this;this.isDirty=false;if(typeof a.tagName!="undefined"&&a.tagName.toLowerCase()=="select"){this.errorChecker=new UI_ErrorChecker(this);var c=function(d){b.runCallbacks("valueChanged",{event:d,value:a.value});b.isDirty=false};UI_registerHandler(a,"change",c);UI_registerHandler(a,"keyup",c);UI_registerHandler(a,"focus",function(d){b.runCallbacks("gotFocus",d)});UI_registerHandler(a,"blur",function(d){b.runCallbacks("lostFocus",d)});
if(a.form!=null){UI_initForm(a.form);a.form.ui_fields.push(this)}}else{this.keys=[];this.values=[];this.addAsyncTest=function(d,e){b.textbox().addAsyncTest(d,e)};this.addCustomTest=function(d,e,f){b.textbox().addCustomTest(d,e,f)};setTimeout(function(){var d=b.hiddenElement(),e=b.textbox();e.registerCallback("keyPressed",function(h){b.runCallbacks("keyPressed",h)});e.registerCallback("gotFocus",function(h){b.runCallbacks("gotFocus",h)});e.registerCallback("lostFocus",function(h){b.runCallbacks("lostFocus",
h)});e.registerCallback("valueChanged",function(h){b.runCallbacks("valueChanged",h)});e.registerCallback("submitBlocked",function(h){b.runCallbacks("submitBlocked",h)});for(var f=0;;f++){var g=ui_widgets["ui_select_"+b.id+"_"+f];if(!g)break;(function(h,j){h.registerCallback("clicked",function(){e.setValue(b.values[j]);if(d)d.value=b.keys[j];e.closeDropdown();b.runCallbacks("valueChanged",{value:b.keys[j]})})})(g,f)}b.errorChecker=e.errorChecker})}}UI_initWidget(UI_Select);UI_initErrorChecker(UI_Select);
UI_Select.prototype.containerElement=function(){return this.element};UI_Select.prototype.dirty=function(){return this.isDirty};UI_Select.prototype.setOptions=function(a,b){this.keys=a;this.values=b};UI_Select.prototype.hiddenElement=function(){return UI_findElement(function(a){return a.tagName&&a.tagName.toLowerCase()=="input"&&a.type=="hidden"&&!a.disabled},this.element)};UI_Select.prototype.textbox=function(){var a="ui_select_tb_"+this.id;return ui_widgets[a]?ui_widgets[a]:false};
UI_Select.prototype.value=function(){if(this.element.tagName.toLowerCase()=="select")return this.element.value;var a=this.hiddenElement();if(a)return a.value;return this.textbox().value()};
UI_Select.prototype.setValue=function(a){if(this.element.tagName.toLowerCase()=="select"){for(var b=0;b<this.element.options.length;b++)if(this.element.options[b].value==a){this.element.selectedIndex=b;this.isDirty=false;return}this.isDirty=true;if(this.element.options.length>0)this.element.selectedIndex=0}else if(b=this.hiddenElement()){b.value=a;for(b=0;b<this.keys.length;b++)if(this.keys[b]==a){this.textbox().setValue(this.values[b]);return}}else this.textbox().setValue(a)};
UI_Select.prototype.addOption=function(a,b,c,d){var e=null;if(this.element.tagName.toLowerCase()=="select"){if(c==undefined)c=false;if(d!=undefined&&d>=this.element.options.length)d=undefined;else e=this.element.options[d];a=new Option(b,a,c,c);try{this.element.add(a,e)}catch(f){this.element.add(a,d)}}};UI_Select.prototype.removeOption=function(a){if(this.element.tagName=="SELECT")for(var b=this.element.options.length-1;b>=0;b--)this.element.options.item(b).value==a&&this.element.remove(b)};
UI_Select.prototype.removeOptions=function(){if(this.element.tagName=="SELECT")this.element.options.length=0};UI_Select.prototype.options=function(){if(this.element.tagName.toLowerCase()=="select"){for(var a=[],b=0;b<this.element.options.length;b++)a.push(this.element.options[b].value);return a}else return this.keys};
UI_Select.prototype.disable=function(a){if(a==undefined)a=true;if(this.element.tagName.toLowerCase()=="select")this.element.disabled=a;else{var b=this.hiddenElement();if(b)b.disabled=a;this.textbox().disable(a)}};UI_Select.prototype.enable=function(a){if(a==undefined)a=true;this.disable(!a)};UI_Select.prototype.setEnabled=UI_Select.prototype.enable;UI_Select.prototype.setDisabled=UI_Select.prototype.disable;UI_Select.prototype.enabled=function(){return!this.disabled()};
UI_Select.prototype.disabled=function(){if(this.element.tagName=="SELECT")return this.element.disabled;var a=this.hiddenElement();if(a)return a.disabled;return this.textbox().disabled()};UI_Select.prototype.hide=function(a){if(a==undefined)a=true;if(this.element.tagName.toLowerCase()=="select")this.element.style.display=a?"none":"inline";else this.textbox().hide(a)};UI_Select.prototype.show=function(a){if(a==undefined)a=true;this.hide(!a)};
UI_Select.prototype.focus=function(){this.element.tagName.toLowerCase()=="select"?this.element.focus():this.textbox().focus()};UI_Select.prototype.blur=function(){this.element.tagName.toLowerCase()=="select"?this.element.blur():this.textbox().blur()};
function UI_SelectDatabase(a){this.element=a;this.id=a.id.substr(18);this.errorChecker=new UI_ErrorChecker(this);this.selected=undefined;this.loaded=false;var b=this;setTimeout(function(){b.loadTree();var c=ui_widgets[b.id+"_textbox"],d=document.getElementById(b.id+"_hidden");c&&c.registerCallback("dropdownOpened",function(){b.loadTree()});d&&b.loadTree();c&&b.registerCallback("opened",function(){c.checkDropdown()})});setTimeout(function(){var c=ui_widgets[b.id+"_textbox"];if(c){c=c.element;if(c.form!=
null){UI_initForm(c.form);c.form.ui_fields.push(b)}}})}UI_initWidget(UI_SelectDatabase);UI_initErrorChecker(UI_SelectDatabase);UI_SelectDatabase.prototype.containerElement=function(){return document.getElementById("ui_selectdatabase_"+this.id)};UI_SelectDatabase.prototype.getObject=function(a){for(var b in this.objects){var c=this.objects[b];if(c.id==a)return c}return false};
UI_SelectDatabase.prototype.value=function(){var a=ui_widgets[this.id+"_textbox"],b=document.getElementById(this.id+"_hidden");return a?a.value():b.value};UI_SelectDatabase.prototype.enable=UI_SelectDatabase.prototype.setEnabled=function(a){if(a==undefined)a=true;ui_widgets[this.id+"_textbox"].enable(a);document.getElementById(this.id+"_special").disabled=!a};UI_SelectDatabase.prototype.disable=UI_SelectDatabase.prototype.setDisabled=function(a){if(a==undefined)a=true;this.enable(!a)};
UI_SelectDatabase.prototype.objectSelected=function(a){var b=this.getObject(a),c=ui_widgets[this.id+"_tree"],d=function(e){if(e.tagName=="A")e.style.fontWeight=e.id==a+"_link"?"bold":"normal"};this.selected&&UI_applyToDom(c.getNode(this.selected).contentElement(),d);UI_applyToDom(c.getNode(a).contentElement(),d);this.selected=a;c=ui_widgets[this.id+"_textbox"];d=document.getElementById(this.id+"_hidden");c&&c.setValue(b.value);if(d)d.value=b.value;this.runCallbacks("objectSelected",b);c&&c.closeDropdown()};
UI_SelectDatabase.prototype.loadTree=function(a){var b=this;if(typeof a=="object")b.loaded=false;else a={};if(!b.loaded){b.loaded=true;var c=a.id&&a.type?{id:b.id,value:"",type:a.type,typeid:a.id}:{id:b.id,value:b.value()};b.sendAjaxRequest(c,function(e){b.element.innerHTML=e.html;b.element.parentNode.style.width=b.element.style.width;b.objects=e.objects;b.selected=e.selected;var f=e.combinations;e=undefined;setTimeout(function(){var g=document.getElementById("ui_tree_"+b.id+"_tree");if(g){g=new UI_Tree(g);
ui_widgets[g.id]=g;var h=ui_widgets[b.id+"_textbox"];h&&h.checkDropdown();if(a.type&&a.id&&h)for(var j in b.objects)if(b.objects[j].id==b.selected){h.setValue(b.objects[j].value);break}f&&d(g)}})});var d=function(e){var f=function(g){if(g.id.match(/^database:\d+$/))return g;return f(g.parentNode())};e.registerCallback("opened",function(g){var h=g.treenode;if(h.id.match(/^view:\d+$/))if(!h.collectionsLoaded){h.collectionsLoaded=true;setTimeout(function(){for(var j=f(h),k=[],l=0;l<j.nodes.length;l++){var q=
j.nodes[l];q.id.match(/collection:\d+$/)&&k.push(q)}for(j=0;j<k.length;j++){l=k[j];var o=b.getObject(h.id),s=b.getObject(l.id),x="view:"+o.view+":collection:"+s.collection;q=h.addNode(x,l.contentElement().innerHTML.replace(new RegExp(l.id,"g"),x));b.objects[x]={id:x,collection:s.collection,view:o.view,parent:h.id,active:s.active,name:s.name,title:s.title,value:o.value+":"+s.name,icon:s.icon,open:false};for(o=0;o<l.nodes.length;o++){s=l.nodes[o];x=b.getObject(q.id);var m=b.getObject(s.id),r=b.getObject(q.parentNode().id),
p="view:"+r.id+":miniview:"+m.id;q.addNode(p,s.contentElement().innerHTML.replace(new RegExp(s.id,"g"),p));b.objects[p]={id:p,miniview:m.miniview,view:r.view,parent:q.id,active:true,name:m.name,title:m.title,value:x.value+"."+m.name,icon:m.icon}}}})}})}}};
function UI_SelectDocument(a){this.id=a.id.substr(18);var b=false,c=this;setTimeout(function(){var d=ui_widgets[c.id+"_textbox"],e=document.getElementById(c.id+"_hidden");c.loadTree=function(){if(!b){b=true;var f={id:c.id,value:d.value()};c.sendAjaxRequest(f,function(g){c.objects=g.objects;a.innerHTML=g.html;a.parentNode.style.width=a.style.width;if(g=document.getElementById("ui_tree_"+c.id+"_tree")){g=new UI_Tree(g);ui_widgets[g.id]=g;var h=ui_widgets[c.id+"_textbox"];if(h){g.registerCallback("opened",
function(){h.checkDropdown()});setTimeout(function(){h.checkDropdown()})}}})}};d&&d.registerCallback("dropdownOpened",function(){c.loadTree()});e&&c.loadTree()});c.registerCallback=function(d,e){var f=ui_widgets[c.id+"_textbox"];f&&d=="submitBlocked"?f.registerCallback(d,e):UI_SelectDocument.prototype.registerCallback.call(c,d,e)}}UI_initWidget(UI_SelectDocument);
UI_SelectDocument.prototype.containerElement=function(){var a=ui_widgets[this.id+"_textbox"];if(a)return a.containerElement();return document.getElementById("ui_selectdocument_"+this.id)};UI_SelectDocument.prototype.value=function(){var a=ui_widgets[this.id+"_textbox"],b=document.getElementById(this.id+"_hidden");return a?a.value():b.value};
UI_SelectDocument.prototype.enable=UI_SelectDocument.prototype.setEnabled=function(a){if(a==undefined)a=true;ui_widgets[this.id+"_textbox"].enable(a);document.getElementById(this.id+"_special").disabled=!a};UI_SelectDocument.prototype.disable=UI_SelectDocument.prototype.setDisabled=function(a){if(a==undefined)a=true;this.enable(!a)};UI_SelectDocument.prototype.getObject=function(a){for(var b in this.objects){var c=this.objects[b];if(c.id==a)return c}return false};
UI_SelectDocument.prototype.objectSelected=function(a){var b=this.getObject(a);UI_applyToDom(this.containerElement(),function(e){if(e.tagName=="A")e.style.fontWeight=e.id==a+"_link"?"bold":"normal"});var c=ui_widgets[this.id+"_textbox"],d=document.getElementById(this.id+"_hidden");c&&c.setValue(b.value);if(d)d.value=b.value;this.runCallbacks("objectSelected",b);c&&c.closeDropdown()};
UI_SelectDocument.prototype.addRegexTest=function(a,b,c){return ui_widgets[this.id+"_textbox"].addRegexTest(callback,b,c)};UI_SelectDocument.prototype.addCustomTest=function(a,b,c){return ui_widgets[this.id+"_textbox"].addCustomTest(a,b,c)};UI_SelectDocument.prototype.addAsyncTest=function(a,b){return ui_widgets[this.id+"_textbox"].addAsyncTest(a,b)};UI_SelectDocument.prototype.addPredefinedTest=function(a){return ui_widgets[this.id+"_textbox"].addPredefinedTest(a)};
UI_SelectDocument.prototype.removeRegExTest=function(a){return ui_widgets[this.id+"_textbox"].removeRegExTest(a)};UI_SelectDocument.prototype.removeCustomTest=function(a){return ui_widgets[this.id+"_textbox"].removeCustomTest(a)};UI_SelectDocument.prototype.removeAsyncTest=function(a){return ui_widgets[this.id+"_textbox"].removeAsyncTest(a)};UI_SelectDocument.prototype.removePredefinedTest=function(a){return ui_widgets[this.id+"_textbox"].removePredefinedTest(a)};
UI_SelectDocument.prototype.check=function(){return ui_widgets[this.id+"_textbox"].check()};UI_SelectDocument.prototype.asyncCheck=function(a){return ui_widgets[this.id+"_textbox"].asyncCheck(a)};UI_SelectDocument.prototype.ignoreTest=function(a){return ui_widgets[this.id+"_textbox"].ignoreTest(a)};
function UI_SelectField(a){this.id=a.id.substr(15);var b=false;this.blocked=[];var c=this,d=undefined;c.loadTree=function(){if(!b){b=true;c.sendAjaxRequest({id:c.id},function(e){c.fields=e.fields;a.innerHTML=e.html;a.parentNode.style.width=a.style.width;if(e=document.getElementById("ui_tree_"+c.id+"_tree")){e=new UI_Tree(e);ui_widgets[e.id]=e;if(d){d.checkDropdown();e.registerCallback("opened",function(){d.checkDropdown()})}}})}};this.reset=function(){if(b){delete ui_widgets[c.id+"_tree"];a.innerHTML=
"";b=false}};setTimeout(function(){if(d=ui_widgets[c.id+"_textbox"]){d.registerCallback("dropdownOpened",c.loadTree);c.registerCallback=function(f,g){f=="submitBlocked"?d.registerCallback("submitBlocked",g):UI_SelectField.prototype.registerCallback.call(c,f,g)};for(var e=0;e<c.blocked.length;e++)d.registerCallback("submitBlocked",c.blocked[e])}else{c.loadTree();c.registerCallback=function(f,g){UI_SelectField.prototype.registerCallback.call(c,f,g)};for(e=0;e<c.blocked.length;e++)c.registerCallback("submitBlocked",
c.blocked[e])}});this.registerCallback=function(e,f){e=="submitBlocked"?c.blocked.push(f):UI_SelectField.prototype.registerCallback.call(c,e,f)}}UI_initWidget(UI_SelectField);UI_SelectField.prototype.containerElement=function(){if(textbox=ui_widgets[this.id+"_textbox"])return textbox.containerElement();return document.getElementById("ui_selectfield_"+this.id)};UI_SelectField.prototype.getField=function(a){for(var b in this.fields){var c=this.fields[b];if(c.node==a)return c}return false};
UI_SelectField.prototype.value=function(){var a=ui_widgets[this.id+"_textbox"],b=document.getElementById(this.id+"_hidden");return a?a.value():b.value};UI_SelectField.prototype.setValue=function(a){var b=ui_widgets[this.id+"_textbox"],c=document.getElementById(this.id+"_hidden");b&&b.setValue(a);if(c)c.value=a};UI_SelectField.prototype.enable=UI_SelectField.prototype.setEnabled=function(a){if(a==undefined)a=true;var b=ui_widgets[this.id+"_textbox"];b&&b.enable(a)};
UI_SelectField.prototype.disable=UI_SelectField.prototype.setDisabled=function(a){if(a==undefined)a=true;var b=ui_widgets[this.id+"_textbox"];b&&b.disable(a)};
UI_SelectField.prototype.fieldSelected=function(a){var b=this.getField(a);UI_applyToDom(this.containerElement(),function(e){if(e.tagName=="A")e.style.fontWeight=e.id==a+"_link"?"bold":"normal"});var c=ui_widgets[this.id+"_textbox"],d=document.getElementById(this.id+"_hidden");c&&c.setValue(b.value);if(d)d.value=b.value;this.runCallbacks("fieldSelected",b);c&&c.closeDropdown()};UI_SelectField.prototype.addCustomTest=function(a,b,c){var d=ui_widgets[this.id+"_textbox"];d&&d.addCustomTest(a,b,c)};
function UI_SelectTimezone(a){this.id=a.id.substr(18);this.element=a;var b=false,c=undefined,d=undefined;this.options={};this.errorChecker=new UI_ErrorChecker(this);this.loadTree=function(){if(b)typeof d!="undefined"&&d.containerElement().scrollIntoView();else{b=true;this.sendAjaxRequest({id:this.id},function(e){for(var f=c.dropdownElement();f.hasChildNodes();)f.removeChild(f.firstChild);var g=0,h=function(q,o){d=q;this.setValue(o);c.closeDropdown();this.runCallbacks("valueChanged",{widget:this,value:o})};
f=function(q,o){if(typeof o=="undefined")o=q;this.options[q]=o;var s="ui_selectable_"+this.id+"_"+g;c.createWidget(UI_Selectable,{id:s,enabled:"enabled",wrap:false,content:o,selected:c.element.value===o}).registerCallback("clicked",h.bind(this,ui_widgets[s],q,o));if(c.containerElement().value===q)d=ui_widgets[s];g++}.bind(this);for(var j in this.extraOptions)f(j,this.extraOptions[j]);for(var k in e)if(e[k].length>0)for(var l in e[k])f(k+"/"+e[k][l]);else f(k);typeof d!="undefined"&&d.containerElement().scrollIntoView();
c.checkDropdown()}.bind(this))}}.bind(this);setTimeout(function(){c=ui_widgets[this.id+"_textbox"];c.registerCallback("dropdownOpened",this.loadTree)}.bind(this))}UI_widgets.extend(UI_SelectTimezone,UI_Base);UI_initErrorChecker(UI_SelectTimezone);UI_SelectTimezone.prototype.containerElement=function(){return this.element};UI_SelectTimezone.prototype.value=function(){return document.getElementById(this.id+"_value").value};
UI_SelectTimezone.prototype.setValue=function(a){document.getElementById(this.id+"_value").value=a;ui_widgets[this.id+"_textbox"].setValue(this.options[a])};UI_SelectTimezone.prototype.enable=UI_SelectTimezone.prototype.setEnabled=function(a){ui_widgets[this.id+"_textbox"].enable(a)};UI_SelectTimezone.prototype.disable=UI_SelectTimezone.prototype.setDisabled=function(a){ui_widgets[this.id+"_textbox"].disable(a)};UI_SelectTimezone.prototype.setExtraOptions=function(a){this.extraOptions=a};
function UI_Selectable(a){this.id=a.id.substr(14);this.element=a;for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].tagName=="DIV")this.insideElement=a.childNodes[b];this.selectionType="button";this.enabledState=this.insideElement.className=="ui_selectable_enabled"?true:false;this.selectedState=false;disableSelection(a);var c=this;this.element.onmouseover=function(){c.enabledState&&c.runCallbacks("mouseOver")};this.element.onmouseout=function(){c.runCallbacks("mouseOut")};this.element.onmousedown=
function(){if(c.enabledState){c.runCallbacks("clicked",{selected:!c.selectedState,widget:c});c.insideElement.style.paddingTop="3px";c.insideElement.style.paddingLeft="5px";c.insideElement.style.paddingBottom="0px";c.insideElement.style.paddingRight="3px";if(c.selectionType=="select"){c.select(!c.selectedState);if(c.selectedState){c.insideElement.onmouseup=null;c.selectedState=true;c.runCallbacks("selected")}else{c.insideElement.onmouseup=d;c.selectedState=false;c.runCallbacks("unselected")}}else c.insideElement.onmouseup=
d}};var d=function(){if(c.enabledState){c.insideElement.style.paddingTop="2px";c.insideElement.style.paddingLeft="4px";c.insideElement.style.paddingBottom="1px";c.insideElement.style.paddingRight="4px"}}}UI_widgets.extend(UI_Selectable,UI_Base);
UI_Selectable.create=function(a){var b=document.createElement("div"),c=document.createElement("div"),d=document.createTextNode(a.content);b.id="ui_selectable_"+a.id;b.className="ui_selectable";if(typeof a.align!="undefined")b.align=a.align;if(typeof a.style!="undefined")b.style=a.style;if(typeof a.hidden!="undefined"&&a.hidden===true)b.style.display="none";c.className="ui_selectable_"+(typeof a.enabled!="undefined"?a.enabled:"disabled");c.style.whiteSpace=a.wrap?"normal":"nowrap";if(typeof a.height!=
"undefined")c.style.height=a.height+"px";b.appendChild(c);c.appendChild(d);typeof a.icon!="undefined"&&UI_iconize(d,{icon:a.icon,size:a.iconsize});b=new UI_Selectable(b);typeof a.group!="undefined"&&b.setGroup(a.group);typeof a.type!="undefined"&&b.setSelectionType("select");typeof a.selected!="undefined"&&a.selected===true&&b.select(true);return b};
UI_Selectable.prototype.setGroup=function(a){if(!UI_Selectable.groups)UI_Selectable.groups=[];UI_Selectable.groups[a]||(UI_Selectable.groups[a]=new UI_Group);this.group=UI_Selectable.groups[a];this.group.add(this)};UI_Selectable.prototype.recalculate=function(){$.noop(this.element.clientWidth)};UI_Selectable.prototype.containerElement=function(){return this.element};UI_Selectable.prototype.setEnabled=function(a){this.enabledState=a;this.insideElement.className=a?"ui_selectable_enabled":"ui_selectable_disabled"};
UI_Selectable.prototype.enabled=function(){return this.enabledState};UI_Selectable.prototype.show=function(a){this.element.style.display=a?"block":"none"};UI_Selectable.prototype.setSelectionType=function(a){if(a=="select"||a=="button")this.selectionType=a;else return false;return true};UI_Selectable.prototype.type=function(){return this.selectionType};
UI_Selectable.prototype.select=function(a){if(this.selectionType=="select"){this.selectedState=a;this.insideElement.className=a?"ui_selectable_selected":"ui_selectable_enabled";this.insideElement.style.paddingTop="2px";this.insideElement.style.paddingLeft="4px";this.insideElement.style.paddingBottom="1px";this.insideElement.style.paddingRight="4px";a&&this.group&&this.group.selected(this);return true}else return false};UI_Selectable.prototype.selected=function(){return this.selectedState};
function UI_Shadable(a){this.id=a.id.substr(12);this.element=a;this.opacity=50;this.step=100;this.status="passive"}UI_initWidget(UI_Shadable);UI_Shadable.prototype.recalculate=function(){};UI_Shadable.prototype.containerElement=function(){return this.element};UI_Shadable.prototype.setOpacity=function(a){if(parseFloat(a).toString()!=0&&parseFloat(a).toString()!="NaN"){this.opacity=parseFloat(a).toString();return true}else return false};
UI_Shadable.prototype.shade=function(){if(this.status!="active"){this.element.style.zIndex=600;this.animateBackgroundOpacity("increase",this.step);this.status="active"}};UI_Shadable.prototype.unshade=function(){if(this.status!="passive"){this.animateBackgroundOpacity("decrease",this.opacity-this.step);this.status="passive"}};UI_Shadable.prototype.setStepping=function(a){this.step=a};
UI_Shadable.prototype.animateBackgroundOpacity=function(a,b){if(b>this.opacity)b=this.opacity;if(b<0)b=0;this.element.style.opacity=b/100;this.element.style.filter="alpha(opacity="+b+")";var c=this;if(a=="increase")b<this.opacity?setTimeout(function(){c.animateBackgroundOpacity(a,b+c.step)},50):this.runCallbacks("shaded",{opacity:c.opacity});else if(b>0)setTimeout(function(){c.animateBackgroundOpacity(a,b-c.step)},50);else{this.runCallbacks("unShaded");this.element.style.zIndex="-10"}};
function UI_SourceEditor(a){UI_Editor.call(this,a);this.userPreference="editor";this.state="textarea";this.nextState="editor";this.options=this.initialized=false;a=document.getElementById("ui_editor_area_"+this.id);this.height=this.width=false;if(a.form!=null){UI_initForm(a.form);a.form.ui_fields.push(this)}}UI_widgets.extend(UI_SourceEditor,UI_Editor);
UI_SourceEditor.prototype.updateState=function(a){this.nextState=a;if(this.state!=a){var b=document.getElementById("ui_editor_area_"+this.id);if(a=="editor"){this.options.content=null;this.options.height=null;this.options.width=null;this.initialized=false;this.editor=CodeMirror.fromTextArea(b,this.options);this.state="editor"}else if(a=="textarea")if(this.initialized){this.editor.toTextArea();this.state="textarea"}}};
UI_SourceEditor.prototype.setOptions=function(a){this.options=a;var b=this;this.options.onChange=function(){this.runCallbacks("valueChanged",{value:this.editor.getCode()})}.bind(this);this.options.initCallback=function(){b.initialized=true;b.updateState(b.nextState)}};UI_SourceEditor.prototype.preHide=function(){this.updateState("textarea")};UI_SourceEditor.prototype.recalculate=function(){this.element.offsetWidth<=5||this.element.offsetHeight<=5?this.updateState("textarea"):this.updateState(this.userPreference)};
UI_SourceEditor.prototype.toggle=function(a){if(a==undefined)a=this.userPreference=="textarea";this.userPreference=a?"editor":"textarea";this.updateState(this.userPreference)};UI_SourceEditor.prototype.value=UI_SourceEditor.prototype.content=function(){if(this.state=="textarea")return document.getElementById("ui_editor_area_"+this.id).value;if(!this.initialized)return this.options.content;return this.editor.getCode()};
UI_SourceEditor.prototype.setValue=UI_SourceEditor.prototype.setContent=function(a){if(this.state=="textarea")document.getElementById("ui_editor_area_"+this.id).value=a;return this.editor.setCode(a)};UI_SourceEditor.prototype.selectedText=function(){if(this.state!="editor"||!this.initialized)return"";return this.editor.selection()};UI_SourceEditor.prototype.setSelectedText=function(a){this.state!="editor"||!this.initialized||this.editor.replaceSelection(a)};
UI_SourceEditor.prototype.lines=function(){if(typeof this.editor=="undefined"){var a=document.getElementById("ui_editor_area_"+this.id).value.split("\n");return a.length>0?a.length-1:0}else return this.editor.lineNumber(this.editor.lastLine())};
function UI_Splitter(a){this.id=a.id.substr(13);this.element=a;this.type=a.id.substr(3,1)=="R"?"Row":"Column";this.splitterParts=[];this.splitterBars=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.className=="ui_splitterverticalpart"||c.className=="ui_splitterhorizontalpart"){var d=this.splitterParts.length;this.splitterParts[d]=new UI_SplitterPart(this,d,c)}if(c.className=="ui_splitterverticalbar"||c.className=="ui_splitterhorizontalbar"){d=this.splitterBars.length;this.splitterBars[d]=
new UI_SplitterBar(this,d,c)}}}UI_initWidget(UI_Splitter);UI_Splitter.prototype.containerElement=function(){return this.element};
UI_Splitter.prototype.initialize=function(){var a=this.type=="Row"?this.element.offsetHeight:this.element.offsetWidth;if(a!=0){var b=this.type=="Row"?"top":"left",c=this.type=="Row"?"bottom":"right",d=this.type=="Row"?"height":"width",e=this.getResizablePart();if(!(e.size()>=e.minSize)){var f=a;for(a=0;a<this.splitterParts.length;a++)if(this.splitterParts[a]!=e){f-=this.splitterParts[a].size();f-=5}f=e.minSize-f;var g=0,h=0;for(a=0;a<e.number;a++){var j=this.splitterParts[a],k=this.splitterBars[a],
l=Math.min(f-g,j.size()-j.minSize);k.element.style[b]=parseInt(k.element.style[b],10)-l-g+"px";j.element.style[d]=parseInt(j.element.style[d],10)-l+"px";if(g>0)j.element.style[b]=parseInt(j.element.style[b],10)-g+"px";g+=l}f-=g;for(a=this.splitterParts.length-1;a>e.number;a--){j=this.splitterParts[a];k=this.splitterBars[a-1];l=Math.min(f-h,j.size()-j.minSize);k.element.style[c]=parseInt(k.element.style[c],10)-l-h+"px";j.element.style[d]=parseInt(j.element.style[d],10)-l+"px";if(h>0)j.element.style[c]=
parseInt(j.element.style[c],10)-h+"px";h+=l}e.element.style[b]=parseInt(e.element.style[b],10)-g+"px";e.element.style[c]=parseInt(e.element.style[c],10)-h+"px"}}};UI_Splitter.prototype.recalculate=function(){this.initialize();this.notifyChildren("recalculate")};UI_Splitter.prototype.barClicked=function(a,b){this.runCallbacks("barClicked",{index:a,position:b})};UI_Splitter.prototype.barReleased=function(a,b){this.runCallbacks("barReleased",{index:a,position:b})};
UI_Splitter.prototype.getResizablePart=function(){for(var a=this.type=="Row"?"height":"width",b=0;b<this.splitterParts.length;b++){var c=this.splitterParts[b];if(c.element.style[a]==0)return c}return false};UI_Splitter.prototype.part=function(a){if(a<0||a>=this.splitterParts.length)return false;return this.splitterParts[a]};UI_Splitter.prototype.bar=function(a){if(a<0||a>=this.splitterBars.length)return false;return this.splitterBars[a]};
function UI_SplitterPart(a,b,c){this.splitter=a;this.minSize=50;this.number=b;this.element=c;this.id=c.id.substr(16)}UI_initWidget(UI_SplitterPart);UI_SplitterPart.prototype.containerElement=function(){return this.element};UI_SplitterPart.prototype.minSize=function(){return this.minSize};UI_SplitterPart.prototype.setMinSize=function(a){this.minSize=a};UI_SplitterPart.prototype.topBar=function(){if(this.splitter.type=="Column")return false;return this.splitter.bar(this.number-1)};
UI_SplitterPart.prototype.bottomBar=function(){if(this.splitter.type=="Column")return false;return this.splitter.bar(this.number)};UI_SplitterPart.prototype.leftBar=function(){if(this.splitter.type=="Row")return false;return this.splitter.bar(this.number-1)};UI_SplitterPart.prototype.rightBar=function(){if(this.splitter.type=="Row")return false;return this.splitter.bar(this.number)};
UI_SplitterPart.prototype.rightNeighbour=function(){if(this.splitter.type=="Row")return false;return this.splitter.part(this.number+1)};UI_SplitterPart.prototype.topNeighbour=function(){if(this.splitter.type=="Column")return false;return this.splitter.part(this.number-1)};UI_SplitterPart.prototype.bottomNeighbour=function(){if(this.splitter.type=="Column")return false;return this.splitter.part(this.number+1)};
UI_SplitterPart.prototype.leftNeighbour=function(){if(this.splitter.type=="Row")return false;return this.splitter.part(this.number-1)};
UI_SplitterPart.prototype.growTop=function(a){var b=this.topNeighbour();if(!b)return 0;a=Math.min(a,b.height()-b.minSize);a=Math.max(a,this.minSize-this.height());var c=this.topBar().element;if(c.style.top)c.style.top=parseInt(c.style.top,10)-a+"px";if(c.style.bottom)c.style.bottom=parseInt(c.style.bottom,10)+a+"px";if(b.element.style.height){c=parseInt(b.element.style.height,10);b.element.style.height=c-a+"px"}if(b.element.style.bottom){c=parseInt(b.element.style.bottom,10);b.element.style.bottom=
c+a+"px"}if(this.element.style.height){c=parseInt(this.element.style.height,10);this.element.style.height=c+a+"px"}if(this.element.style.top){c=parseInt(this.element.style.top,10);this.element.style.top=c-a+"px"}this.splitter.notifyChildren("recalculate");return a};
UI_SplitterPart.prototype.growRight=function(a){var b=this.rightNeighbour();if(!b)return 0;a=Math.min(a,b.width()-b.minSize);a=Math.max(a,this.minSize-this.width());var c=this.rightBar().element;if(c.style.left)c.style.left=parseInt(c.style.left,10)+a+"px";if(c.style.right)c.style.right=parseInt(c.style.right,10)-a+"px";if(b.element.style.width){c=parseInt(b.element.style.width,10);b.element.style.width=c-a+"px"}if(b.element.style.left){c=parseInt(b.element.style.left,10);b.element.style.left=c+a+
"px"}if(this.element.style.width){c=parseInt(this.element.style.width,10);this.element.style.width=c+a+"px"}if(this.element.style.right){c=parseInt(this.element.style.right,10);this.element.style.right=c-a+"px"}this.splitter.notifyChildren("recalculate");return a};
UI_SplitterPart.prototype.growLeft=function(a){var b=this.leftNeighbour();if(!b)return 0;a=Math.min(a,b.width()-b.minSize);a=Math.max(a,this.minSize-this.width());var c=this.leftBar().element;if(c.style.left)c.style.left=parseInt(c.style.left,10)-a+"px";if(c.style.right)c.style.right=parseInt(c.style.right,10)+a+"px";if(b.element.style.width){c=parseInt(b.element.style.width,10);b.element.style.width=c-a+"px"}if(b.element.style.right){c=parseInt(b.element.style.right,10);b.element.style.right=c+a+
"px"}if(this.element.style.width){c=parseInt(this.element.style.width,10);this.element.style.width=c+a+"px"}if(this.element.style.left){c=parseInt(this.element.style.left,10);this.element.style.left=c-a+"px"}this.splitter.notifyChildren("recalculate");return a};
UI_SplitterPart.prototype.growBottom=function(a){var b=this.bottomNeighbour();if(!b)return 0;a=Math.min(a,b.height()-b.minSize);a=Math.max(a,this.minSize-this.height());var c=this.bottomBar().element;if(c.style.top)c.style.top=parseInt(c.style.top,10)+a+"px";if(c.style.bottom)c.style.bottom=parseInt(c.style.bottom,10)-a+"px";if(b.element.style.height){c=parseInt(b.element.style.height,10);b.element.style.height=c-a+"px"}if(b.element.style.top){c=parseInt(b.element.style.top,10);b.element.style.top=
c+a+"px"}if(this.element.style.height){c=parseInt(this.element.style.height,10);this.element.style.height=c+a+"px"}if(this.element.style.bottom){c=parseInt(this.element.style.bottom,10);this.element.style.bottom=c-a+"px"}this.splitter.notifyChildren("recalculate");return a};UI_SplitterPart.prototype.width=function(){return this.element.offsetWidth};UI_SplitterPart.prototype.height=function(){return this.element.offsetHeight};
UI_SplitterPart.prototype.size=function(){return this.splitter.type=="Row"?this.height():this.width()};
function UI_SplitterBar(a,b,c){this.id=c.id.substr(15);this.element=c;var d=a.type=="Column",e=d?"x":"y",f=d?"left":"top",g=d?"right":"bottom",h=d?"width":"height",j=d?"offsetWidth":"offsetHeight",k=false,l=false,q=false,o=false,s=false,x=false,m=0,r=function(t){UI_hideFrames(a.element,true);c.onmousedown=null;if(!q){k=a.part(b);l=a.part(b+1);q=k.element;o=l.element}t=new UI_Event(t);s=t.client();m=0;x={left:parseInt(c.style[f],10),right:parseInt(c.style[g],10)};c.onmousemove=y;c.onmouseup=p;c.setCapture();
if(a.type=="Column"){c.style.borderLeft=c.style.borderRight="dashed 1px gray";c.parentNode.style.cursor="e-resize"}else{c.style.borderTop=c.style.borderBottom="dashed 1px gray";c.parentNode.style.cursor="n-resize"}c.style.zIndex=1;a.barClicked(b,x)},p=function(t){UI_hideFrames(a.element,false);t=new UI_Event(t);t.offset();c.releaseCapture();c.onmousemove=null;c.onmouseup=null;c.onmousedown=r;t={left:parseInt(c.style[f],10),right:parseInt(c.style[g],10)};var w=isNaN(x.left)?x.right-t.right:t.left-
x.left;if(q.style[h]){var n=parseInt(q.style[h],10);q.style[h]=n+w+"px"}if(q.style[g]){n=parseInt(q.style[g],10);q.style[g]=n-w+"px"}if(o.style[h]){n=parseInt(o.style[h],10);o.style[h]=n-w+"px"}if(o.style[f]){n=parseInt(o.style[f],10);o.style[f]=n+w+"px"}c.style.borderLeft=c.style.borderRight=c.style.borderTop=c.style.borderBottom="0px";c.parentNode.style.cursor="";a.notifyChildren("recalculate");d||(t={top:t.left,bottom:t.right});a.barReleased(b,t)},y=function(t){t=(new UI_Event(t)).client();m+=
t[e]-s[e];var w=a.part(b).minSize,n=a.part(b+1).minSize;if(isNaN(x.left)){var v=parseInt(c.style[g],10);n=parseInt(o.style[g],10)+n;w=parseInt(q.style[g],10)+q[j]-w-5;w=Math.max(n,Math.min(w,v-m));m-=v-w;c.style[g]=w+"px"}else{v=parseInt(c.style[f],10);w=parseInt(q.style[f],10)+w;n=parseInt(o.style[f],10)+o[j]-n-5;w=Math.max(w,Math.min(n,v+m));m-=w-v;c.style[f]=w+"px"}s=t};c.onmousedown=r}function UI_Stretch(a){this.element=a;this.id=a.id.substr(11)}UI_initWidget(UI_Stretch);
UI_Stretch.prototype.recalculate=function(){var a=[],b=false,c=[];for(e=0;e<this.element.childNodes.length;e++){var d=this.element.childNodes[e];if(d.className){d.className=="ui_stretchtop"&&a.push(d);if(d.className=="ui_stretchcenter")b=d;d.className=="ui_stretchbottom"&&c.push(d)}}if(b){for(var e=d=0;e<a.length;e++){var f=parseInt(a[e].offsetHeight,10);isNaN(f)||(d+=f)}a=0;for(e=c.length-1;e>=0;e--){c[e].style.bottom=a+"px";f=parseInt(c[e].offsetHeight,10);isNaN(f)||(a+=f)}b.style.top=d+"px";b.style.bottom=
a+"px";b.style.visibility="visible";var g=this;setTimeout(function(){g.notifyChildren("recalculate")})}};UI_Stretch.prototype.containerElement=function(){return this.element};function UI_Table(a){this.parent=a;this.thetable=false}UI_Table.prototype.table=function(){if(this.thetable)return this.thetable;this.thetable=document.createElement("table");this.parent.appendChild(this.thetable);this.thetable.className="ui_table";return this.thetable};
UI_Table.prototype.row=function(a){for(var b=this.table(),c=b.rows.length;c<=a;c++)b.insertRow(-1);return b.rows[a]};UI_Table.prototype.cell=function(a,b){a=this.row(a);for(var c=a.cells.length;c<=b;c++)a.insertCell(-1);return a.cells[b]};
function UI_Tabs(a){this.id=a.id.substr(8);this.element=a;this.tabs=[];for(var b=this,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];d.className=="ui_tab"&&this.tabs.push(new UI_Tab(this,this.tabs.length,d));if(d.className=="ui_tab_active")this.activeElement=d}this.openTab=false;setTimeout(function(){var e=ui_widgets["flyout_"+b.id];e.registerCallback("opened",function(){b.runCallbacks("flyoutOpened")});e.registerCallback("closed",function(){b.runCallbacks("flyoutClosed")});e.registerCallback("repositioned",
function(g){b.runCallbacks("flyoutRepositioned",{top:g.top,left:g.left})});for(var f=0;f<b.tabs.length-1;f++)b.tabs[f].installHandlers();b.flyoutTab().element.onmouseover=function(){e.open()};b.flyoutTab().element.onmouseout=function(){e.close()}})}UI_initWidget(UI_Tabs);
UI_Tabs.findTab=function(a){if(a.containerElement)a=a.containerElement();for(var b=/^ui_tabcontent_(.*)_(\d+)$/;a!=undefined&&a!=document.body;a=a.parentNode){a.getAttribute||alert(a.constructor);var c=a.getAttribute("id");if(c&&c.match(b))if(c=ui_widgets[RegExp.$1])return c.tab(RegExp.$2)}};UI_Tabs.show=function(a){a=UI_Tabs.findTab(a);if(a!=undefined){a.show();UI_Tabs.show(a.tabs())}};
UI_Tabs.prototype.recalculate=function(){var a=2,b=this.flyoutTab(),c=UI_widgets.get("flyout_"+this.id);if(this.flyoutVisible()){for(var d=this.element.offsetWidth-b.width()-10,e=0;e<this.tabs.length-1;e++){var f=this.tabs[e];f.element.style.left=a+"px";if(f.width()<d){f.makeVisible(true);d-=f.width();a+=f.width()}else{f.makeVisible(false);d=0}}b.element.style.display="block";b.element.style.left=a+"px";c.attach(b.element.id,false,"southwest")}else{for(e=0;e<this.tabs.length-1;e++){f=this.tabs[e];
f.makeVisible(true);f.element.style.left=a+"px";a+=f.width()}b.element.style.display="none"}this.show(this.openTab.key)};UI_Tabs.prototype.containerElement=function(){return this.element};UI_Tabs.prototype.flyoutVisible=function(){var a=this.element.offsetWidth;a-=10;for(var b=0,c=0;c<this.tabs.length-1;c++){b+=this.tabs[c].width();if(b>a)return true}return false};
UI_Tabs.prototype.show=UI_Tabs.prototype.showWidget=function(a){if(typeof a=="object"){var b=this.findTab(a);b&&b.show()}else{var c=this.openTab;b=this.tabs[a];if(b!==undefined){if(b.visible()){this.activeElement.style.left=Math.max(0,b.left()-2)+"px";this.activeElement.style.width=Math.max(1,b.width()-6)+"px";this.activeElement.innerHTML=b.element.innerHTML;this.activeElement.onmouseover=null;this.activeElement.onmouseout=null}else{var d=this.flyoutTab();this.activeElement.style.left=Math.max(1,
d.left()-2)+"px";this.activeElement.style.width=Math.max(1,d.width()-6)+"px";this.activeElement.innerHTML=d.element.innerHTML;var e=ui_widgets["flyout_"+this.id];this.activeElement.onmouseover=function(){e.open()};this.activeElement.onmouseout=function(){e.close()}}var f=this;setTimeout(function(){for(var g=0;g<f.children.length;g++){var h=f.children[g],j=f.findTab(h);typeof j=="undefined"||j!=f.openTab||(typeof h.recalculate=="function"?h.recalculate():h.notifyChildren("recalculate"))}f.runCallbacks("shown",
{current:a,last:c})});if(c){if(c==b)return;c.preHide();c.contentDiv(true).removeClass("active")}b.contentDiv(true).addClass("active");this.openTab=b;this.openTab.selectable().select(true)}}};UI_Tabs.prototype.activeTab=function(){return this.openTab};UI_Tabs.prototype.tab=function(a){return this.tabs[a]};UI_Tabs.prototype.flyoutTab=function(){return this.tabs[this.tabs.length-1]};UI_Tabs.prototype.findTab=function(a){a=UI_Tabs.findTab(a);if(a!=undefined){if(a.tabs()==this)return a;return this.findTab(a.tabs())}};
function UI_Tab(a,b,c){this.parent=a;this.element=c;this.key=b;this.contentElement=document.getElementById("ui_tabcontent_"+this.parent.id+"_"+this.key);this.contentJElement=$(this.contentElement);this.enabled=true;this.cachedWidth=false}UI_initWidget(UI_Tab);UI_Tab.prototype.enabled=function(){return this.enabled};UI_Tab.prototype.enable=function(a){if(!a&&this.parent.openTab.key==this.key)this.parent.show(this.key+(this.key>0?-1:1));this.enabled=a;this.parent.recalculate()};
UI_Tab.prototype.preHide=function(){for(var a=0;a<this.parent.children.length;a++){var b=this.parent.children[a],c=this.parent.findTab(b);if(!(!c||c!=this)){b.preHide?b.preHide():b.notifyChildren("preHide");return}}};UI_Tab.prototype.flyoutDiv=function(){return document.getElementById("ui_container_"+this.parent.id+"_"+this.key)};UI_Tab.prototype.contentDiv=function(a){if(typeof a!="boolean")a=false;return a?this.contentJElement:this.contentElement};
UI_Tab.prototype.selectable=function(){return ui_widgets["ui_selectable_"+this.parent.id+"_"+this.key]};UI_Tab.prototype.makeVisible=function(a){this.flyoutDiv().style.display=!a&&this.enabled?"block":"none";this.element.style.display=a&&this.enabled?"block":"none"};UI_Tab.prototype.left=function(){return this.element.offsetLeft};
UI_Tab.prototype.width=function(){if(this.visible()){if(document.readyState=="complete")return this.cachedWidth=this.element.offsetWidth;return this.element.offsetWidth}else if(this.cachedWidth)return this.cachedWidth;else{this.element.style.display="block";var a=this.element.offsetWidth;this.element.style.display="none";return a}};UI_Tab.prototype.containerElement=function(){return this.element};UI_Tab.prototype.tabs=function(){return this.parent};
UI_Tab.prototype.visible=function(){return this.element.style.display!="none"};UI_Tab.prototype.shown=function(){return this.parent.activeTab()===this};UI_Tab.prototype.show=function(){this.parent.show(this.key);this.runCallbacks("shown")};UI_Tab.prototype.installHandlers=function(){var a=this;this.element.onmousedown=function(){a.show()};this.selectable().registerCallback("clicked",function(){a.show()})};
function UI_Temp(a){this.id=a.id.substr(8);this.element=a;this.timeout=2;var b=this;UI_registerHandler(window,"load",function(){setTimeout(function(){a.style.display="none"},b.timeout*1E3)})}UI_initWidget(UI_Temp);UI_Temp.prototype.containerElement=function(){return this.element};
function UI_Textbox(a){this.id=a.id.substr(11);this.element=a;this.errorChecker=new UI_ErrorChecker(this);this.errorState=undefined;this.suggestionActive=false;this.suggestionText="";var b=this,c=false,d=undefined,e=this.dropdownElement();this.textAreaValue="";this.widgetManager=new UI_TextboxWidgetManager(this);this.contentChanged=false;this.templateVersion=3;var f=function(j){if(!b.widgetManager.enabled())return false;if(b.displayType()=="textarea")return false;if(b.readonly())return true;return j.offsetX()>
b.element.offsetWidth-20},g=function(){if(b.suggestionActive){b.element.value="";b.element.style.color="";b.suggestionActive=false}};this.registerElementHandlers=function(j){UI_registerHandler(j,"click",function(k){g();k=new UI_Event(k);if(f(k)){b.openDropdown();b.runCallbacks("dropdownOpened",{})}e&&k.stopBubbling();return false});UI_registerHandler(j,"mouseover",function(k){k=new UI_Event(k);b.runCallbacks("mouseOver",{id:b.id,textbox:b});j.style.cursor=f(k)?"pointer":"auto"});UI_registerHandler(j,
"mousemove",function(k){k=new UI_Event(k);j.style.cursor=f(k)?"pointer":"auto"});UI_registerHandler(j,"keyup",function(k){b.runCallbacks("valueChanged",{event:k,value:b.value()});b.contentChanged=true;c&&clearTimeout(c);c=setTimeout(function(){var l=b.errorChecker.run(b.value(),true);l!=b.errorState&&b.runCallbacks("errorStateChanged",{failedTest:l});b.errorState=l;c=false},100)});UI_registerHandler(j,"blur",function(k){b.runCallbacks("lostFocus",k);b.setSuggestion(b.suggestionText)});UI_registerHandler(j,
"focus",function(k){b.runCallbacks("gotFocus",k)});UI_registerHandler(j,"keydown",function(k){g();k=new UI_Event(k);d=k.specialKey()});UI_registerHandler(j,"keydown",function(k){k=new UI_Event(k);b.runCallbacks("keyPressed",k)});UI_registerHandler(j,"keypress",function(k){k=new UI_Event(k);var l=k.keyCode(),q=String.fromCharCode(l),o=k.specialKey(),s=k.ctrlKey();if(o||s)return true;o=b.errorChecker.run(b.element.value+q,true);if(o==undefined)return true;b.runCallbacks("characterBlocked",{keychar:q,
keynum:l,event:k,failedTest:o});k.stopDefault();return false})};this.registerElementHandlers(a);var h=false;this.scheduleSizeChecker=function(){if(!h){var j=function(){var l=parseInt(b.element.clientWidth,10);if(isNaN(l)||l<=0)setTimeout(j,100);else{l=k-l;var q=parseInt(b.element.style.width,10);b.element.style.width=q+l+"px";h=false}},k=parseInt(b.element.clientWidth,10);if(isNaN(k)||k<=0)k=parseInt(b.element.style.width,10);h=setTimeout(j,0)}};this.addPredefinedTest=function(j,k){if(this.widgetManager.setCurrent(j)&&
this.element.className!="ui_textbox_more"&&this.element.tagName!="TEXTAREA"){this.scheduleSizeChecker();this.element.className="ui_textbox_more";this.form&&this.form.checkAutoComplete()}if(j=="datemutation"||j=="extendeddate"||j=="extendeddatetime")document.getElementById(this.id+"_special").disabled=this.element.disabled;UI_Textbox.prototype.addPredefinedTest.call(this,j,k)}.bind(this);this.setMaxLength=function(j){if(b.displayType()=="textarea")UI_Textbox.prototype.setMaxLength.call(b,j);else j<
0?b.element.removeAttribute("maxlength"):b.element.setAttribute("maxlength",j)};this.removeAllTests=function(){document.getElementById(this.id+"_special").disabled=true;this.element.tagName=="INPUT"&&this.element.removeAttribute("maxlength");if(this.element.className=="ui_textbox_more"){this.scheduleSizeChecker();this.element.className="ui_textbox";this.element.form&&this.element.form.checkAutoComplete()}this.widgetManager.disable();UI_Textbox.prototype.removeAllTests.call(this)}.bind(this);if(a.form!=
null){UI_initForm(a.form);a.form.ui_fields.push(this);this.hasDropdown()&&a.form.checkAutoComplete()}}UI_initWidget(UI_Textbox);UI_initErrorChecker(UI_Textbox);UI_Textbox.prototype.cloneTo=function(a,b){var c=this.element.cloneNode(true);c.id=c.id.replace(this.id,a);b.appendChild(c);var d=this.dropdownElement();d=d.cloneNode(false);d.id=d.id.replace(this.id,a);b.appendChild(d);c=new UI_Textbox(c);return ui_widgets[c.id]=c};UI_Textbox.prototype.containerElement=function(){return this.element};
UI_Textbox.prototype.setSmartyVersion=function(a){this.templateVersion=a};UI_Textbox.prototype.smartyVersion=function(){return this.templateVersion};UI_Textbox.prototype.disable=function(a){if(a==undefined)a=true;if(this.element.disabled=a)document.getElementById(this.id+"_special").disabled=true;else document.getElementById(this.id+"_special").disabled=!(this.hasTest("datemutation")||this.hasTest("extendeddate")||this.hasTest("extendeddatetime"))};
UI_Textbox.prototype.enable=function(a){if(a==undefined)a=true;this.disable(!a)};UI_Textbox.prototype.setEnabled=UI_Textbox.prototype.enable;UI_Textbox.prototype.setDisabled=UI_Textbox.prototype.disable;UI_Textbox.prototype.enabled=function(){return!this.element.disabled};UI_Textbox.prototype.disabled=function(){return this.element.disabled};UI_Textbox.prototype.hide=function(a){if(a==undefined)a=true;this.element.style.display=a?"none":"inline"};
UI_Textbox.prototype.show=function(a){if(a==undefined)a=true;this.hide(!a)};UI_Textbox.prototype.setValue=function(a){if(a){this.element.value=a;this.element.style.color="";this.suggestionActive=false}else{this.element.value="";this.setSuggestion(this.suggestionText)}};UI_Textbox.prototype.value=function(){if(this.suggestionActive)return"";return this.element.value};
UI_Textbox.prototype.setSuggestion=function(a){this.suggestionText=a;if(!(this.element.value||!a)){this.element.value=a;this.element.style.color="#999999";this.suggestionActive=true}};UI_Textbox.prototype.fixValue=function(){if(this.suggestionActive){this.element.value="";this.suggestionActive=false}!this.fixer||this.value()==""||this.setValue(this.fixer(this.value()))};UI_Textbox.prototype.setFixer=function(a){this.fixer=a};
UI_Textbox.prototype.openDropdown=function(){var a=this.dropdownElement();if(a.style.display!="block"){var b=this,c=document.getElementById("ui_textbox_eventcatcher_"+this.id);if(c)c.style.display="block";else{c=document.createElement("div");c.className="ui_textbox_eventcatcher";c.id="ui_textbox_eventcatcher_"+this.id;document.body.appendChild(c);var d=function(h){h=new UI_Event(h);h.stopBubbling();return false};UI_registerHandler(c,"mousedown",function(){b.closeDropdown()});UI_registerHandler(a,
"mousedown",d);UI_registerHandler(c,"mousewheel",d)}c.originalParent=a.parentNode;c.appendChild(a);UI_getPosition(b.element);var e=function(h){if(h==document.body)return h;if(h.scrollHeight>h.offsetHeight)return h;return e(h.parentNode)},f=e(a.parentNode),g=f.scrollHeight;a.style.display="block";a.style.minWidth=parseInt(b.element.offsetWidth,10)-2+"px";this.checkDropdown();setTimeout(function(){var h=e(a.parentNode);h==f&&h.scrollHeight<=g||a.scrollIntoView&&a.scrollIntoView()})}};
UI_Textbox.prototype.closeDropdown=function(){var a=this.dropdownElement();if(a.style.display=="block"){a.style.display="none";var b=document.getElementById("ui_textbox_eventcatcher_"+this.id);if(b){b.originalParent&&b.originalParent.appendChild(a);b.parentNode.removeChild(b)}}};
UI_Textbox.prototype.checkDropdown=function(){var a=this.dropdownElement();if(a.style.display=="block"){var b=document.getElementById("ui_textbox_eventcatcher_"+this.id),c=UI_getPosition(this.element),d=parseInt(this.element.offsetHeight,10),e=parseInt(a.offsetHeight,10),f=parseInt(b.offsetHeight,10),g=parseInt(this.element.offsetWidth,10),h=parseInt(a.offsetWidth,10);b=parseInt(b.offsetWidth,10);var j=c.top+d+e<f||c.top<e?c.top+d-1:c.top-e+1,k=c.left+h<b?c.left:c.left+g-h;UI_setPosition(a,k,j+1);
setTimeout(function(){UI_setPosition(a,k,j)})}};UI_Textbox.prototype.contentElement=UI_Textbox.prototype.dropdownElement=function(){return document.getElementById("ui_textbox_more_"+this.id)};UI_Textbox.prototype.hasDropdown=function(){if(this.element.tagName=="TEXTAREA")return false;return this.widgetManager.enabled()};UI_Textbox.prototype.displayType=function(){if(this.element.tagName=="TEXTAREA")return"textarea";return this.element.type};
UI_Textbox.prototype.setDisplayType=function(a,b){if(!(a=="textarea"&&this.element.tagName=="TEXTAREA"))if(!(this.element.tagName=="INPUT"&&this.element.type==a)){this.scheduleSizeChecker();if(a=="textarea"){var c=document.createElement("textarea");c.id=this.element.id;c.rows=typeof b=="undefined"?4:b;c.name=this.element.name;c.className="ui_textbox";c.readOnly=this.element.readOnly;c.value=this.textAreaValue&&this.textAreaValue.indexOf("\n")>=0?this.textAreaValue:this.element.value;c.style.width=
this.element.style.width;this.element.maxLength&&this.errorChecker.setMaxLength(this.element.maxLength);this.element.parentNode.insertBefore(c,this.element);this.element.parentNode.removeChild(this.element);this.element=c}else{c=document.createElement("input");var d=this.widgetManager.enabled();c.id=this.element.id;c.name=this.element.name;c.className=d?"ui_textbox_more":"ui_textbox";c.type=a=="password"?"password":"text";c.value=this.element.value;c.readOnly=this.element.readOnly;c.style.width=this.element.style.width;
d=this.element.tagName=="TEXTAREA"?this.errorChecker.maxLength():this.element.maxLength;if(d>=0)c.maxLength=d;if(this.element.tagName=="TEXTAREA")this.textAreaValue=this.element.value;this.element.parentNode.insertBefore(c,this.element);this.element.parentNode.removeChild(this.element);this.element=c}if(this.suggestionActive)this.element.style.color="#999999";this.registerElementHandlers(this.element);this.element.form&&this.element.form.checkAutoComplete()}};UI_Textbox.prototype.readonly=function(){return this.element.readOnly};
UI_Textbox.prototype.setReadonly=function(a){this.element.readOnly=a};UI_Textbox.prototype.focus=function(){this.element.disabled||this.element.focus()};UI_Textbox.prototype.blur=function(){this.element.disabled||this.element.blur()};UI_Textbox.prototype.isChanged=function(){return this.contentChanged};
UI_Textbox.prototype.isAfter=function(a){this.addCustomTest(function(b){var c=a.value();if(!b||!c)return true;var d=UI_parseDate(b),e=UI_parseDate(c);if(d&&e)return e<=d;else if(!d&&!e){d=UI_HumanDateMutation.parse(b);c=UI_HumanDateMutation.parse(c);if(d&&c){d=d.apply();e=c.apply();return e<=d}}return true},false,"isafter");ui_widgets.tt.attachToWidget(this,"isafter")};
UI_Textbox.prototype.isBefore=function(a){this.addCustomTest(function(b){var c=a.value();if(!b||!c)return true;var d=UI_parseDate(b),e=UI_parseDate(c);if(d&&e)return e>=d;else if(!d&&!e){d=UI_HumanDateMutation.parse(b);c=UI_HumanDateMutation.parse(c);if(d&&c){d=d.apply();e=c.apply();return e>=d}}return true},false,"isbefore");ui_widgets.tt.attachToWidget(this,"isbefore")};
function UI_TextboxWidgetManager(a){this.textbox=a;var b=[],c=[],d=new UI_Table(a.dropdownElement());this.extended=this.current=a.dropdownElement().innerHTML.length>0?"custom":false;var e=this,f=function(m,r){var p=d.cell(0,m);p.innerHTML=r.replace(/\s*$/,"");return p},g=function(m){f(0,m);m=document.getElementById("ui_calendar_textbox_calendar_"+a.id);m=new UI_Calendar(m);ui_widgets[m.id]=m;m.registerCallback("dateClicked",function(r){e.current=="datetime"&&k(["calendar","clock"]);if(!(e.current!=
"date"||a.readonly())){a.setValue(r.value);a.runCallbacks("valueChanged",{event:r,value:r.value})}});return m},h=function(m){f(1,m);m=document.getElementById("ui_clock_textbox_clock_"+a.id);m=new UI_Clock(m);ui_widgets[m.id]=m;m.registerCallback("timeChanged",function(p){e.current=="datetime"&&k(["calendar","clock"]);if(!(e.current!="time"||a.readonly())){a.setValue(p.time);a.runCallbacks("valueChanged",{event:p,value:p.time})}});var r=function(p){e.current=="datetime"&&l("calendar",function(y){var t=
new Date(y.date().getTime());t.setDate(t.getDate()+p);y.setDate(t);k(["calendar","clock"])})};m.registerCallback("dayIncreased",function(){r(+1)});m.registerCallback("dayDecreased",function(){r(-1)});return m},j=function(m){f(2,m);m=document.getElementById("ui_datemutation_textbox_datemutation_"+a.id);m=new UI_DateMutation(m);ui_widgets[m.id]=m;m.registerCallback("valueChanged",function(r){if(!(e.current!="datemutation"||a.readonly())){a.setValue(r.value);a.runCallbacks("valueChanged",{event:r,value:r.value})}});
m.registerCallback("buttonClicked",function(){a.closeDropdown()});return m},k=function(m){a.readonly()||q(m,function(r){var p=[];for(var y in m)p.push(r[m[y]].value());r=p.join(" ");a.setValue(r);a.runCallbacks("valueChanged",{event:false,value:r})})},l=function(m,r){if(b[m])r&&setTimeout(function(){r(b[m])});else if(c[m]&&c[m].length>0)r&&c[m].push(r);else{c[m]=[r];var p={type:m,value:a.value()};a.sendAjaxRequest(p,function(y){var t;a:switch(m){case "calendar":t=g(y);break a;case "clock":t=h(y);
break a;case "datemutation":t=j(y);break a}y=b[m]=t;for(t=0;t<c[m].length;t++){var w=c[m][t];w&&w(y)}c[m]=[];a.checkDropdown()})}},q=function(m,r){for(var p=[],y=0,t=0;t<m.length;t++){var w=m[t];l(w,function(n){return function(v){p[n]=v;y++;y<m.length||r&&r(p)}}(w))}},o=function(){if(e.current=="date"||e.current=="datetime"){e.current="datemutation";l("datemutation")}else if(e.current=="datemutation"){e.current=e.extended=="extendeddate"?"date":"datetime";l("calendar");e.current=="datetime"&&l("clock")}x();
return false},s=function(m,r){var p=document.createElement("a");p.className=m;p.href="#";if(p.innerText==undefined)p.textContent=r;else p.innerText=r;a.dropdownElement().appendChild(p);p.onclick=o;return p},x=function(){d.cell(0,0).style.display=e.current=="date"||e.current=="datetime"?"":"none";d.cell(0,1).style.display=e.current=="time"||e.current=="datetime"?"":"none";d.cell(0,2).style.display=e.current=="datemutation"?"":"none";var m=UI_findElement(function(p){return p.className=="ui_widgetmanager_datelink"},
a.dropdownElement()),r=UI_findElement(function(p){return p.className=="ui_widgetmanager_mutationlink"},a.dropdownElement());if(e.extended=="extendeddate"||e.extended=="extendeddatetime"){m||(m=s("ui_widgetmanager_datelink",__tr("Click here to use a fixed date instead")));r||(r=s("ui_widgetmanager_mutationlink",__tr("Click here to use a variable date")));m.style.display=e.current=="datemutation"?"block":"none";r.style.display=e.current=="date"||e.current=="datetime"?"block":"none"}else{if(m)m.style.display=
"none";if(r)r.style.display="none"}};a.registerCallback("dropdownOpened",function(){if(e.current!="custom"){x();if(e.current)if(e.current=="date")l("calendar",function(r){r.setValue(a.value())});else if(e.current=="time")l("clock",function(r){r.setValue(a.value())});else if(e.current=="datetime"){var m=a.value().replace(/^\s\s*/,"").replace(/\s\s*$/,"").split(/\s+/);l("calendar",function(r){m.length>0&&r.setValue(m[0])});l("clock",function(r){m.length<2||m[0].indexOf("0000")!=-1&&m[1].substr(0,5)==
"00:00"||r.setValue(m[1])})}else e.current=="datemutation"&&l("datemutation",function(r){r.setValue(a.value())})}})}
UI_TextboxWidgetManager.prototype.setCurrent=function(a){if(this.current=="custom")return true;for(var b=["date","datetime","time","datemutation","extendeddate","extendeddatetime"],c=0;c<b.length;c++)if(b[c]==a){this.current=this.extended=a;if(a!="extendeddate"&&a!="extendeddatetime")return true;this.current=UI_HumanDateMutation.parse(this.textbox.value())!=undefined?"datemutation":a=="extendeddate"?"date":"datetime";return true}return false};
UI_TextboxWidgetManager.prototype.disable=function(){this.current=false};UI_TextboxWidgetManager.prototype.enabled=function(){return this.current!=false};
function UI_Tooltip(a){this.element=a;this.id=a.id.substr(11);if(!UI_Tooltip.initialized){UI_registerHandler(document,"mousemove",function(c){UI_Tooltip.mouse={x:c.clientX,y:c.clientY}});UI_Tooltip.initialized=true}var b=function(c){UI_setPosition(a,c.clientX+document.body.scrollLeft-8,c.clientY+document.body.scrollTop+15)};this.followMouse=function(c){if(c==undefined)c=true;if(c){UI_setPosition(a,UI_Tooltip.mouse.x+document.body.scrollLeft-8,UI_Tooltip.mouse.y+document.body.scrollTop+15);UI_registerHandler(document,
"mousemove",b)}else UI_unregisterHandler(document,"mousemove",b)};UI_widgets.registerPostInitializer(function(){this.close=UI_widgets.get(this.id+"_close")}.bind(this));UI_registerHandler(a,"mousedown",function(c){c=new UI_Event(c);c.stopBubbling();return false})}UI_initWidget(UI_Tooltip);UI_Tooltip.prototype.containerElement=function(){return this.element};
UI_Tooltip.prototype.show=function(a,b){this.hide();UI_Tabs.show(a);UI_Flyout.show(a);var c=this,d=function(f){if(f==document.body)return f;var g=UI_getStyle(f,"overflow");if(g=="scroll"||g=="auto")return f;if(!f.parentNode)return f;return d(f.parentNode)},e=d(a.parentNode);if(e){e.appendChild(this.element);setTimeout(function(){if(!b)if(a.className=="ui_richtextEditor"){var f=UI_findElement(function(g){return g.className&&g.className.match(/^mceIframeContainer/)},a);setTimeout(function(){var g=UI_getPosition(f);
UI_setPosition(c.element,g.left+5,g.top+20)})}else if(a.className=="ui_sourceEditor"){f=UI_findElement(function(g){return g.tagName&&g.tagName=="IFRAME"},a);setTimeout(function(){var g=UI_getPosition(f);UI_setPosition(c.element,g.left+50,g.top+40)})}else if(a.className=="ui_textbox"&&a.offsetHeight>70)setTimeout(function(){var g=UI_getPosition(a);UI_setPosition(c.element,g.left+5,g.top+40)});else a.className=="ui_selectdatabase"?setTimeout(function(){var g=a.id.substr(18);a=document.getElementById("ui_textbox_"+
g+"_textbox");if(typeof a!="undefined"){g=UI_getPosition(a);UI_setPosition(c.element,g.left+5,g.top+a.offsetHeight)}}):setTimeout(function(){var g=UI_getPosition(a);UI_setPosition(c.element,g.left+5,g.top+a.offsetHeight)});c.element.style.display="block";b&&c.followMouse()})}};UI_Tooltip.prototype.hide=function(){this.element.style.display="none";this.followMouse(false)};
UI_Tooltip.prototype.attachToElement=function(a,b,c){if(typeof a=="string")a=document.getElementById(a);if(a!=undefined){if(b==undefined)b="hover";if(c==undefined)c=false;var d=this,e=false,f=function(){d.show(a);c&&d.followMouse();e=true},g=function(){if(e){d.hide();e=false}};b=="click"&&UI_registerHandler(a,"click",f);if(b=="hover"){UI_registerHandler(a,"mouseover",f);UI_registerHandler(a,"mouseout",g)}if(b=="focus"){UI_registerHandler(a,"focus",f);UI_registerHandler(a,"blur",g)}}};
UI_Tooltip.prototype.attachToWidget=function(a,b,c){if(typeof a=="string")a=ui_widgets[a];if(a!=undefined){var d=false,e=function(g){if(g.failedTest==b){setTimeout(function(){a.containerElement().scrollIntoView()});this.show(a.containerElement());c&&this.followMouse();d=true;this.close.registerExpendableCallback("clicked",f);this.close.show();this.ignore=function(){g.ignore();f()}}}.bind(this),f=function(){if(d){this.hide();this.close.hide();d=false}}.bind(this);a.registerCallback("submitBlocked",
e);a.registerCallback("gotFocus",f);UI_registerHandler(document,"mousedown",f)}};UI_Tooltip.prototype.ignore=function(){};function UI_Tree(a){this.id=a.id.substr(8);this.element=a;this.nodes=[];disableSelection(this.element);this.butMode="Open";var b=this;a.hasChildNodes()&&window.setTimeout(function(){for(var c=b.element.childNodes.length,d=0;d<c;d++)b.element.childNodes[d].className=="ui_treenode"&&b.nodes.push(new UI_TreeNode(b,b.element.childNodes[d]))})}UI_initWidget(UI_Tree);
UI_Tree.prototype.recalculate=function(){};UI_Tree.prototype.containerElement=function(){return this.element};UI_Tree.prototype.getNode=function(a){for(var b=0;b<this.nodes.length;b++){var c=this.nodes[b].getNode(a);if(c!=undefined)return c}};UI_Tree.prototype.tree=function(){return this};
UI_Tree.prototype.createNode=function(a,b){var c=document.createElement("div");c.id="ui_treenode_"+a;c.className="ui_treenode";var d=document.createElement("div");d.className="ui_treenode_header";var e=document.createElement("div");e.style.display="block";e.className="ui_tree_img_hidden";var f=document.createElement("div");f.className="ui_treenode_content";f.innerHTML=b;var g=document.createElement("div");g.className="ui_treenode_children";g.style.display="none";d.appendChild(e);d.appendChild(f);
c.appendChild(d);c.appendChild(g);return c};UI_Tree.prototype.addNode=function(a,b){if(this.getNode(a)==undefined){var c=this.createNode(a,b);this.element.appendChild(c);c=new UI_TreeNode(this,c);this.nodes.push(c);this.recalculate();c.recalculate();return c}};UI_Tree.prototype.findNode=function(a){for(var b=0;b<this.nodes.length;b++){var c=this.nodes[b].findNode(a);if(c!=undefined)return c}return false};UI_Tree.prototype.buttonMode=function(){return this.butMode};
UI_Tree.prototype.setButtonMode=function(a){if(!(a!="Open&Close"&&a!="Open"&&a!="Close"&&a!="None"))this.butMode=a};
function UI_TreeNode(a,b){this.id=b.id.substr(12);this.element=b;this.parent=a;this.nodes=[];for(var c=this,d=0;d<b.childNodes.length;d++){var e=b.childNodes[d];switch(e.className){case "ui_treenode_header":this.header=e;break;case "ui_treenode_children":this.children=e;break}}for(d=0;d<this.header.childNodes.length;d++){e=this.header.childNodes[d];switch(e.className){case "ui_treenode_content":this.content=e;break;case "ui_tree_img_open":case "ui_tree_img_hidden":case "ui_tree_img_close":this.button=
e;break}}this.content.onmousedown=function(){if(typeof c.nodes[0]=="undefined"){c.tree().runCallbacks("clicked",{treenode:c});return true}var f=c.tree().buttonMode();if(c.collapsed()){if(f=="None"||f=="Close")return true;c.open();c.tree().runCallbacks("opened",{treenode:c})}else{if(f=="None"||f=="Open")return true;c.close();c.tree().runCallbacks("closed",{treenode:c})}return true};this.button.onclick=function(){if(c.button.className=="ui_tree_img_open"){c.close();c.tree().runCallbacks("closed",{treenode:c})}else if(c.button.className==
"ui_tree_img_close"){c.open();c.tree().runCallbacks("opened",{treenode:c})}};c.collapsed()||c.tree().runCallbacks("opened",{treenode:this});this.children.hasChildNodes()&&window.setTimeout(function(){for(var f=c.children.childNodes.length,g=0;g<f;g++)c.children.childNodes[g].className=="ui_treenode"&&c.nodes.push(new UI_TreeNode(c,c.children.childNodes[g]))})}UI_initWidget(UI_TreeNode);UI_TreeNode.prototype.parentNode=function(){return this.parent==this.tree()?undefined:this.parent};
UI_TreeNode.prototype.getNode=function(a){if(a==this.id)return this;for(var b=0;b<this.nodes.length;b++){var c=this.nodes[b].getNode(a);if(c!=undefined)return c}};UI_TreeNode.prototype.findNode=function(a){for(;a.className!="ui_treenode";)a=a.parentNode;if(a==this.element)return this;for(var b=0;b<this.nodes.length;b++){var c=this.nodes[b].findNode(a);if(c!=undefined)return c}};UI_TreeNode.prototype.tree=function(){return this.parent.tree()};
UI_TreeNode.prototype.recalculate=function(){for(var a=this.nodes.length>0,b=!this.collapsed(),c=0;c<this.header.childNodes.length;c++){var d=this.header.childNodes[c];if(d.tagName=="IMG"){if(d.alt=="Hidden")d.style.display=a?"none":"block";if(d.alt=="Open")d.style.display=a&&b?"block":"none";if(d.alt=="Close")d.style.display=a&&!b?"block":"none"}}};
UI_TreeNode.prototype.open=function(){if(!(this.nodes.length==0&&this.button.className!="ui_tree_img_close")){this.children.style.display="block";this.button.className="ui_tree_img_open"}};UI_TreeNode.prototype.makeVisible=function(){var a=this.parentNode();if(a!=undefined){a.open();a.makeVisible()}};UI_TreeNode.prototype.close=function(){this.children.style.display="none";if(this.button.className!="ui_tree_img_hidden")this.button.className="ui_tree_img_close"};
UI_TreeNode.prototype.containerElement=function(){return this.element};UI_TreeNode.prototype.contentElement=function(){return this.content};UI_TreeNode.prototype.collapsed=function(){return this.children.style.display=="none"};
UI_TreeNode.prototype.addNode=function(a,b){if(this.tree().getNode(a)==undefined){var c=this.tree().createNode(a,b);this.children.appendChild(c);c=new UI_TreeNode(this,c);this.nodes.push(c);if(this.nodes.length==1)this.button.className=this.children.style.display=="block"?"ui_tree_img_open":"ui_tree_img_close";this.recalculate();c.recalculate();return c}};
function UI_Warning(a){this.element=a;this.jelement=$(a);this.id=a.id.substr(11);UI_widgets.registerPostInitializer(function(){this.container().registerWarning(this)}.bind(this));this.interval=this.timeout=null;this.isVisible=a.style.display!="none";this.closeButton=document.getElementById("ui_warning_close_"+this.id);this.closeButton.onclick=function(){this.parent.hideWarning(this)}.bind(this);this.isCloseable=this.closeButton.style.display=="block";$(this.closeButton).css({opacity:0});this.jelement.mouseenter(function(){this.isCloseable&&
$(this.closeButton).animate({opacity:1})}.bind(this));this.jelement.mouseleave(function(){this.isCloseable&&$(this.closeButton).animate({opacity:0})}.bind(this))}UI_initWidget(UI_Warning);UI_Warning.prototype.containerElement=function(a){return typeof a=="boolean"&&a?this.jelement:this.element};UI_Warning.prototype.setCloseable=function(a){if(this.isCloseable!=a){a?$(this.closeButton).fadeIn("slow"):$(this.closeButton).fadeOut("slow");this.isCloseable=a}};UI_Warning.prototype.closeable=function(){return this.isCloseable};
UI_Warning.prototype.container=function(){if(typeof this.containerInstance!="undefined")return this.containerInstance;var a=this.element.getAttribute("parent");if(typeof UI_widgets.get(a)!="undefined")return this.containerInstance=UI_widgets.get(a);this.containerInstance=this.parent.createWidget(UI_WarningContainer,{id:a},this.containerElement().parentNode,this.containerElement());this.containerInstance.setAdHoc();return this.containerInstance};
UI_Warning.prototype.show=function(){if(!this.isVisible){this.jelement.fadeIn("slow");this.isVisible=true;this.runCallbacks("opened",{widget:this})}};UI_Warning.prototype.hide=function(){if(this.isVisible){this.jelement.fadeOut("slow",UI_recalculate);this.isVisible=false;this.runCallbacks("closed",{widget:this})}};UI_Warning.prototype.visible=function(){return this.isVisible};
UI_Warning.prototype.setTimeout=function(a){var b=UI_Tabs.findTab(this.element);typeof b=="object"&&!b.shown()&&b.tabs().registerExpendableCallback("shown",this.setTimeout.bind(this,a));a=parseInt(a,10);if(this.timeout!=null){window.clearTimeout(this.timeout);window.clearInterval(this.interval)}var c=document.getElementById("ui_warning_countdown_"+this.id);if(c)c.style.display="block";else{c=document.createElement("div");c.id="ui_warning_countdown_"+this.id;c.style.cssFloat="right";c.style.color=
"gray";c.appendChild(document.createTextNode(""));this.element.insertBefore(c,this.closeButton?this.closeButton.nextSibling:this.element.firstChild)}var d=function(e){var f=Math.floor(e/60);e%=60;if(f<10)f="0"+f;if(e<10)e="0"+e;c.firstChild.nodeValue=f+":"+e};d(a);this.interval=window.setInterval(function(){--a;d(a)},1E3);this.timeout=window.setTimeout(function(){this.hide();c.style.display="none";this.timeout=null;window.clearInterval(this.interval);this.interval=null}.bind(this),a*1E3)};
UI_Warning.create=function(a){var b=document.createElement("div");b.id="ui_warning_"+a.id;b.className="ui_warning";if(typeof a.align!="undefined")b.align=a.align;if(typeof a.style!="undefined")b.style=a.style;if(typeof a.hidden!="undefined"&&a.hidden===true)b.style.display="none";var c=typeof a.size=="undefind"?16:a.size,d=typeof a.icon=="undefind"?"error":a.icon,e=document.createElement("a");e.id="ui_warning_close_"+a.id;e.style.marginLeft="5px";e.style[e.style.cssFloat?"cssFloat":"styleFloat"]=
"right";e.style.display=typeof a.closeable!="undefined"&&a.closeable?"block":"none";b.appendChild(e);var f=document.createElement("div");f.className="ui_warning_content";var g=document.createTextNode(a.content);f.appendChild(g);b.appendChild(f);document.body.appendChild(b);g=new UI_Warning(b);g.createWidget(UI_Icon,{id:a.id+"_closeable",size:c,icon:"error"},e);g.createWidget(UI_Icon,{id:a.id+"_icon",size:c,icon:d,style:"float: left"},b,f);return g};
function UI_WarningContainer(a){this.element=a;this.jelement=$(a);this.id=a.id.substring(20);this.options=a.getElementsByTagName("ul").item(0);var b=this.options.getElementsByTagName("li");this.prev=b.item(3);this.info=b.item(2);this.next=b.item(1);this.expandContainer=b.item(0);UI_registerHandler(this.prev,"click",this.showPrevious.bind(this));UI_registerHandler(this.next,"click",this.showNext.bind(this));this.warnings=[];this.index=0;this.isAdHoc=false;this.state="contracted";$(a).mouseenter(function(){$(this.expandContainer).animate({opacity:1},
400,"swing")}.bind(this));$(a).mouseleave(function(){$(this.expandContainer).animate({opacity:0},400,"swing")}.bind(this));UI_widgets.registerPostInitializer(function(){var c="ui_warningcontainer_"+this.id+"_expand";this.expand=typeof UI_widgets.get(c)=="undefined"?this.createWidget(UI_Icon,{id:c,icon:"arrow_down_blue",title:"expand"},this.expandContainer):UI_widgets.get(c);this.expand.registerExpendableCallback("clicked",UI_WarningContainer.prototype.expand.bind(this))}.bind(this))}
UI_widgets.extend(UI_WarningContainer,UI_Base);
UI_WarningContainer.create=function(a){var b=document.createElement("div");b.id="ui_warningcontainer_"+a.id;b.className="ui_warningcontainer";var c=document.createElement("ul");c.id="ui_warningcontainer_"+a.id+"_options";c.className="ui_warningcontainer_options";b.appendChild(c);a=document.createElement("li");var d=document.createElement("li"),e=document.createElement("li"),f=document.createElement("li");a.style.cursor="pointer";a.style.color="gray";d.style.color="gray";e.style.cursor="pointer";e.style.color=
"gray";f.style.cursor="pointer";$(f).css({opacity:0});a.appendChild(document.createTextNode("\u00ab"));d.appendChild(document.createTextNode("1 of 1"));e.appendChild(document.createTextNode("\u00bb"));c.appendChild(f);c.appendChild(e);c.appendChild(d);c.appendChild(a);return new UI_WarningContainer(b)};UI_WarningContainer.prototype.containerElement=UI_WarningContainer.prototype.contentElement=function(a){return typeof a=="boolean"&&a?this.jelement:this.element};
UI_WarningContainer.prototype.setAdHoc=function(){this.isAdHoc=true};
UI_WarningContainer.prototype.recalculate=function(){for(var a=0,b=0,c=0,d=false,e=0;e<this.warnings.length;e++){var f=this.warnings[e].warning,g=this.warnings[e].height,h=f.containerElement(true).outerHeight();if(g!=h){this.warnings[e].height=h;if(this.state=="expanded"||e==this.index)d=true}if(e==this.index)b=a;if(f.visible()){++a;c+=f.containerElement(true).outerHeight()}}this.element.style.height=this.state=="contracted"?this.warnings[this.index].height+"px":c+"px";this.info.firstChild.nodeValue=
__tr("%current of %count",{current:b+1,count:a});b=this.element.style.display;if(a>1){this.element.style.display="block";$(this.options).fadeIn();this.jelement.addClass("multiple")}else if(a==1){this.element.style.display="block";$(this.options).fadeOut();this.jelement.removeClass("multiple")}else this.element.style.display="none";if(d||b!=this.element.style.display)UI_widgets.registerPostInitializer(UI_recalculate)};
UI_WarningContainer.prototype.registerWarning=function(a){for(var b=0;b<this.warnings.length;b++)if(this.warnings[b].warning==a)return;b=a.containerElement(true);var c=b.outerHeight();this.warnings.push({height:c,warning:a});if(this.warnings.length==1){this.element.style.height=c+"px";b.css({"z-index":15})}else b.css({opacity:0});this.isAdHoc&&this.adopt(a);this.recalculate();a.registerCallback("closed",function(d){d=d.widget;if(this.state=="expanded"){for(;this.warnings[this.index].warning==d;){++this.index;
if(this.index==this.warnings.length)this.index=0}this.element.style.height=parseInt(this.element.style.height,10)-c+"px"}else this.warnings[this.index].warning==d&&this.warnings.filter(function(e){return e.warning.visible()}).length>0?this.showNext():this.recalculate()}.bind(this));a.registerCallback("opened",UI_WarningContainer.prototype.recalculate.bind(this))};
UI_WarningContainer.prototype.show=function(a){if(a instanceof UI_Warning)for(var b=0;b<this.warnings.length;b++)if(this.warnings[b].warning===a){a=b;break}var c=this.index;b=this.warnings[c].height;var d=this.warnings[a].height;if(b>d)this.warnings[c].warning.containerElement(true).animate({opacity:0},"slow","swing",function(){this.warnings[c].warning.containerElement(true).css({"z-index":10});this.warnings[a].warning.containerElement(true).css({"z-index":15}).animate({opacity:1},"slow","swing",
function(){this.element.style.height=d+"px";UI_recalculate()}.bind(this))}.bind(this));else{if(b!=d){this.element.style.height=d+"px";UI_recalculate()}this.warnings[c].warning.containerElement(true).animate({opacity:0},"slow","swing",function(){this.warnings[c].warning.containerElement(true).css({"z-index":10});this.warnings[a].warning.containerElement(true).css({"z-index":15}).animate({opacity:1},"slow","swing")}.bind(this))}this.index=a;this.recalculate()};
UI_WarningContainer.prototype.showNext=function(){if(this.warnings.length!=1){var a=this.index+1;if(a==this.warnings.length)a=0;for(;!this.warnings[a].warning.visible();){++a;if(a==this.warnings.length)a=0}this.show(a)}};UI_WarningContainer.prototype.showPrevious=function(){if(this.warnings.length!=1){var a=this.index-1;if(a<0)a=this.warnings.length-1;for(;!this.warnings[a].warning.visible();){++a;if(a<0)a=this.warnings.length-1}this.show(a)}};
UI_WarningContainer.prototype.hideWarning=function(a){if(this.state=="expanded"){a.hide();this.warnings.filter(function(b){return b.warning.visible()}).length==0&&this.hide()}else this.hide()};UI_WarningContainer.prototype.hide=function(){this.jelement.fadeOut("slow")};
UI_WarningContainer.prototype.expand=function(){if(this.state!="expanded"){this.state="expanded";this.jelement.addClass("expanded");for(var a=0,b=0;b<this.warnings.length;b++)if(this.warnings[b].warning.visible())a+=this.warnings[b].height;this.element.style.height=a+"px";UI_recalculate();for(b=0;b<this.warnings.length;b++)this.warnings[b].warning.visible()&&this.warnings[b].warning.containerElement(true).animate({opacity:1},"slow","swing");this.expand.setIcon("arrow_up_blue",16);this.expand.registerExpendableCallback("clicked",
UI_WarningContainer.prototype.contract.bind(this));$(this.prev).fadeOut("slow");$(this.info).fadeOut("slow");$(this.next).fadeOut("slow")}};
UI_WarningContainer.prototype.contract=function(){if(this.state!="contracted"){this.state="contracted";for(var a=0,b=function(){--a;if(a==0){this.element.style.height=this.warnings[this.index].height+"px";this.jelement.removeClass("expanded");UI_recalculate()}}.bind(this),c=0;c<this.warnings.length;c++)if(c!=this.index){++a;this.warnings[c].warning.containerElement(true).animate({opacity:0},"slow","swing",b)}this.expand.setIcon("arrow_down_blue",16);this.expand.registerExpendableCallback("clicked",
UI_WarningContainer.prototype.expand.bind(this));$(this.prev).fadeIn("slow");$(this.info).fadeIn("slow");$(this.next).fadeIn("slow")}};
var UI_language = "en_US";
