(function(a){function b(e){var f=e||window.event,g=[].slice.call(arguments,1),j=0,h=0,k=0;e=a.event.fix(f);e.type="mousewheel";if(f.wheelDelta)j=f.wheelDelta/120;if(f.detail)j=-f.detail/3;k=j;if(f.axis!==undefined&&f.axis===f.HORIZONTAL_AXIS){k=0;h=-1*j}if(f.wheelDeltaY!==undefined)k=f.wheelDeltaY/120;if(f.wheelDeltaX!==undefined)h=-1*f.wheelDeltaX/120;g.unshift(e,j,h,k);return(a.event.dispatch||a.event.handle).apply(this,g)}var c=["DOMMouseScroll","mousewheel"];if(a.event.fixHooks)for(var d=c.length;d;)a.event.fixHooks[c[--d]]=
a.event.mouseHooks;a.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var e=c.length;e;)this.addEventListener(c[--e],b,false);else this.onmousewheel=b},teardown:function(){if(this.removeEventListener)for(var e=c.length;e;)this.removeEventListener(c[--e],b,false);else this.onmousewheel=null}};a.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})})(jQuery);
(function(a){function b(p,o,x,w){w={data:w||(o?o.data:{}),_wrap:o?o._wrap:null,tmpl:null,parent:o||null,nodes:[],calls:h,nest:k,wrap:m,html:u,update:t};p&&a.extend(w,p,{nodes:[],parent:o});if(x){w.tmpl=x;w._ctnt=w._ctnt||w.tmpl(a,w);w.key=++v;(z.length?l:r)[v]=w}return w}function c(p,o,x){var w;x=x?a.map(x,function(A){return typeof A==="string"?p.key?A.replace(/(<\w+)(?=[\s>])(?![^>]*_tmplitem)([^>]*)/g,"$1 "+C+'="'+p.key+'" $2'):A:c(A,p,A._ctnt)}):p;if(o)return x;x=x.join("");x.replace(/^\s*([^<\s][^<]*)?(<[\w\W]+>)([^>]*[^>\s])?\s*$/,
function(A,B,E,G){w=a(E).get();j(w);if(B)w=d(B).concat(w);if(G)w=w.concat(d(G))});return w?w:d(x)}function d(p){var o=document.createElement("div");o.innerHTML=p;return a.makeArray(o.childNodes)}function e(p){return new Function("jQuery","$item","var $=jQuery,call,_=[],$data=$item.data;with($data){_.push('"+a.trim(p).replace(/([\\'])/g,"\\$1").replace(/[\r\t\n]/g," ").replace(/\$\{([^\}]*)\}/g,"{{= $1}}").replace(/\{\{(\/?)(\w+|.)(?:\(((?:[^\}]|\}(?!\}))*?)?\))?(?:\s+(.*?)?)?(\(((?:[^\}]|\}(?!\}))*?)\))?\s*\}\}/g,
function(o,x,w,A,B,E,G){o=a.tmpl.tag[w];if(!o)throw"Template command not found: "+w;w=o._default||[];if(E&&!/\w$/.test(B)){B+=E;E=""}if(B){B=g(B);G=G?","+g(G)+")":E?")":"";G=E?B.indexOf(".")>-1?B+E:"("+B+").call($item"+G:B;E=E?G:"(typeof("+B+")==='function'?("+B+").call($item):("+B+"))"}else E=G=w.$1||"null";A=g(A);return"');"+o[x?"close":"open"].split("$notnull_1").join(B?"typeof("+B+")!=='undefined' && ("+B+")!=null":"true").split("$1a").join(E).split("$1").join(G).split("$2").join(A?A.replace(/\s*([^\(]+)\s*(\((.*?)\))?/g,
function(K,J,M,I){return(I=I?","+I+")":M?")":"")?"("+J+").call($item"+I:K}):w.$2||"")+"_.push('"})+"');}return _;")}function f(p,o){p._wrap=c(p,true,a.isArray(o)?o:[D.test(o)?o:a(o).html()]).join("")}function g(p){return p?p.replace(/\\'/g,"'").replace(/\\\\/g,"\\"):null}function j(p){function o(J){function M(N){N+=x;F=B[N]=B[N]||b(F,r[F.parent.key+x]||F.parent,null,true)}var I,H=J,F,L;if(L=J.getAttribute(C)){for(;H.parentNode&&(H=H.parentNode).nodeType===1&&!(I=H.getAttribute(C)););if(I!==L){H=H.parentNode?
H.nodeType===11?0:H.getAttribute(C)||0:0;if(!(F=r[L])){F=l[L];F=b(F,r[H]||l[H],null,true);F.key=++v;r[v]=F}n&&M(L)}J.removeAttribute(C)}else if(n&&(F=a.data(J,"tmplItem"))){M(F.key);r[F.key]=F;H=(H=a.data(J.parentNode,"tmplItem"))?H.key:0}if(F){for(I=F;I&&I.key!=H;){I.nodes.push(J);I=I.parent}delete F._ctnt;delete F._wrap;a.data(J,"tmplItem",F)}}var x="_"+n,w,A,B={},E,G,K;E=0;for(G=p.length;E<G;E++)if((w=p[E]).nodeType===1){A=w.getElementsByTagName("*");for(K=A.length-1;K>=0;K--)o(A[K]);o(w)}}function h(p,
o,x,w){if(!p)return z.pop();z.push({_:p,tmpl:o,item:this,data:x,options:w})}function k(p,o,x){return a.tmpl(a.template(p),o,x,this)}function m(p,o){var x=p.options||{};x.wrapped=o;return a.tmpl(a.template(p.tmpl),p.data,x,p.item)}function u(p,o){var x=this._wrap;return a.map(a(a.isArray(x)?x.join(""):x).filter(p||"*"),function(w){if(o)w=w.innerText||w.textContent;else{var A;if(!(A=w.outerHTML)){A=document.createElement("div");A.appendChild(w.cloneNode(true));A=A.innerHTML}w=A}return w})}function t(){var p=
this.nodes;a.tmpl(null,null,null,this).insertBefore(p[0]);a(p).remove()}var y=a.fn.domManip,C="_tmplitem",D=/^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /,r={},l={},s,q={key:0,data:{}},v=0,n=0,z=[];a.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(p,o){a.fn[p]=function(x){var w=[];x=a(x);var A,B,E;A=this.length===1&&this[0].parentNode;s=r||{};if(A&&A.nodeType===11&&A.childNodes.length===1&&x.length===1){x[o](this[0]);w=this}else{B=0;for(E=
x.length;B<E;B++){n=B;A=(B>0?this.clone(true):this).get();a.fn[o].apply(a(x[B]),A);w=w.concat(A)}n=0;w=this.pushStack(w,p,x.selector)}x=s;s=null;a.tmpl.complete(x);return w}});a.fn.extend({tmpl:function(p,o,x){return a.tmpl(this[0],p,o,x)},tmplItem:function(){return a.tmplItem(this[0])},template:function(p){return a.template(p,this[0])},domManip:function(p,o,x){if(p[0]&&p[0].nodeType){for(var w=a.makeArray(arguments),A=p.length,B=0,E;B<A&&!(E=a.data(p[B++],"tmplItem")););if(A>1)w[0]=[a.makeArray(p)];
if(E&&n)w[2]=function(G){a.tmpl.afterManip(this,G,x)};y.apply(this,w)}else y.apply(this,arguments);n=0;s||a.tmpl.complete(r);return this}});a.extend({tmpl:function(p,o,x,w){var A=!w;if(A){w=q;p=a.template[p]||a.template(null,p);l={}}else if(!p){p=w.tmpl;r[w.key]=w;w.nodes=[];w.wrapped&&f(w,w.wrapped);return a(c(w,null,w.tmpl(a,w)))}if(!p)return[];if(typeof o==="function")o=o.call(w||{});x&&x.wrapped&&f(x,x.wrapped);o=a.isArray(o)?a.map(o,function(B){return B?b(x,w,p,B):null}):[b(x,w,p,o)];return A?
a(c(w,null,o)):o},tmplItem:function(p){var o;if(p instanceof a)p=p[0];for(;p&&p.nodeType===1&&!(o=a.data(p,"tmplItem"))&&(p=p.parentNode););return o||q},template:function(p,o){if(o){if(typeof o==="string")o=e(o);else if(o instanceof a)o=o[0]||{};if(o.nodeType)o=a.data(o,"tmpl")||a.data(o,"tmpl",e(o.innerHTML));return typeof p==="string"?(a.template[p]=o):o}return p?typeof p!=="string"?a.template(null,p):a.template[p]||a.template(null,D.test(p)?p:a(p)):null},encode:function(p){return(""+p).split("<").join("&lt;").split(">").join("&gt;").split('"').join("&#34;").split("'").join("&#39;")}});
a.extend(a.tmpl,{tag:{tmpl:{_default:{$2:"null"},open:"if($notnull_1){_=_.concat($item.nest($1,$2));}"},wrap:{_default:{$2:"null"},open:"$item.calls(_,$1,$2);_=[];",close:"call=$item.calls();_=call._.concat($item.wrap(call,_));"},each:{_default:{$2:"$index, $value"},open:"if($notnull_1){$.each($1a,function($2){with(this){",close:"}});}"},"if":{open:"if(($notnull_1) && $1a){",close:"}"},"else":{_default:{$1:"true"},open:"}else if(($notnull_1) && $1a){"},html:{open:"if($notnull_1){_.push($1a);}"},"=":{_default:{$1:"$data"},
open:"if($notnull_1){_.push($.encode($1a));}"},"!":{open:""}},complete:function(){r={}},afterManip:function(p,o,x){var w=o.nodeType===11?a.makeArray(o.childNodes):o.nodeType===1?[o]:[];x.call(p,o);j(w);n++}})})(jQuery);function WidgetException(a){this.toString=function(){return"WidgetException: "+a}}
var UI_widgets=function(){var a={},b=[],c=[],d=false,e={},f={_applyTemplate:function(){return jQuery.browser.msie&&jQuery.browser.version=="7.0"?function(l,s){if(typeof s=="undefined")s={};var q=jQuery.extend({},this.options,s);q=jQuery.tmpl(l,q);for(var v=q.get(0).attributes,n=0;n<v.length;n++)v[n].nodeName!="style"&&q.is("["+v[n].nodeName+"]")&&this.element.attr(v[n].nodeName,v[n].nodeValue);for(l in q.get(0).style)this.element.css(l,q.get(0).style[l]);this.element.append(q.contents());this.element.removeAttr("data-parameters")}:
function(l,s){if(typeof s=="undefined")s={};var q=jQuery.extend({},this.options,s);q=jQuery.tmpl(l,q);for(var v=q.get(0).attributes,n=0;n<v.length;n++)this.element.attr(v[n].nodeName,v[n].nodeValue);this.element.append(q.contents());this.element.removeAttr("data-parameters")}}(),_parameter:function(l,s){var q=this.options[l];if(typeof q=="undefined")return s;return q},_setParameter:function(l,s){this.options[l]=s},_booleanParameter:function(l,s){if(typeof s!="boolean")s=false;var q=this.options[l];
if(typeof q=="undefined")return s;if(typeof q=="boolean")return q;if(typeof q=="number")return q!=0;var v=false;if(q.charAt(0)=="!"){v=true;q=q.substring(1)}if(["yes","true","on"].indexOf(q)!=-1)return!v;if(["no","false","off"].indexOf(q)!=-1)return v;return parseInt(q,10)!=0!=v}},g=function(l,s){if(typeof s=="function"){C(s,UI_Base);e[l]=s}else{$.widget("ui."+l,jQuery.extend({},f,s));var q=function(n){return function(z,p){this.name=n;JQ_Base.call(this,z,p)}}(l);C(q,JQ_Base);for(var v in s)typeof s[v]==
"function"&&v.charAt(0)!="_"&&function(n){q.prototype[n]=function(){var z=[n];Array.prototype.push.apply(z,arguments);return this.containerElement()[this.name].apply(this.containerElement(),z)}}(v);e[l]=q;v={};v[l]={open:'                                                                         /* turn parameters into a map */                                            var params = {$1};                                                                                                                                      /* get the identifier and remove the from the params */                     var id = params.id;                                                         delete params.id;                                                                                                                                       /* build the tag that will become the widget */                             var div = $("<div/>");                                                      div.attr("id", id);                                                         div.attr("classname", widgetclass);                                         div.attr("data-parameters", JSON.stringify(params));                                                                                                    /* wrap it in another div and return the inner html */                      _ = _.concat($("<div/>").append(div).html());                           '.replace("widgetclass",
'"'+l+'"'),close:'_ = _.concat("</div>");'};jQuery.extend(jQuery.tmpl.tag,v)}},j=function(l){if(typeof e[l.className]!="undefined"){var s=new e[l.className](l);if(typeof s.id=="string")a[s.id]=s;l=$(l).data().component;if(typeof l!="undefined"){l=PxFramework.component(l);if(typeof l!="undefined"){if(typeof l.widgets=="undefined")l.widgets={};l.widgets[s.id]=s}}return s}},h=function(){if(!d){a.notifier=new UI_Notifier;var l=function(q,v){var n=false;if(typeof e[v.className]!="undefined"){n=typeof a[v.id]!=
"undefined"&&a[v.id]instanceof JQ_Base?a[v.id]:j(v);n.children=[];(n.parent=q)?q.children.push(n):b.push(n)}for(var z=0;z<v.childNodes.length;z++)l(n?n:q,v.childNodes[z])};l(null,document.body);setTimeout(m);$(window).load(m);for(var s=0;s<c.length;s++)c[s]();d=true;return a}},k=function(l,s){for(var q=0;q<b.length;q++){var v=b[q];typeof v[l]=="function"?v[l](s):v.notifyChildren(l,s)}},m=function(){k("recalculate")},u=function(){h();return a},t=function(l){if(typeof a[l]!="undefined")return a[l];
if(l=document.getElementById(l))return j(l)},y=function(l){a[l.id]=l;if(typeof l.children=="undefined")l.children=[];return l},C=function(l,s){if(!(l.prototype instanceof s)){var q=function(){};q.prototype=s.prototype;l.prototype=new q;l.prototype.constructor=l}},D=function(l){var s=a[l];if(typeof s!="undefined"){for(var q=0;q<s.children.length;q++)D(s.children[q].id);a[l].destroy();if(s.parent!=null){var v=s.parent;for(q=0;q<v.children.length;q++)v.children[q].id==s.id&&v.children.splice(q,1)}delete a[l]}},
r=function(){for(var l=[[u],[t,"string"],[y,UI_Base],[g,"string","function"],[g,"string","object"]],s=function(n,z){if(n.length!==z.length)return false;for(var p=0;p<n.length;p++){var o=n[p],x=z[p];if(typeof o=="string"){if(typeof x!=o)return false}else if(!(x instanceof o))return false}return true},q=0;q<l.length;q++){var v=l[q];if(s(v.slice(1),arguments))return v[0].apply(this,arguments)}throw new WidgetException("No matching function prototype found for: ["+$.map($.makeArray(arguments),function(n){return typeof n}).join(", ")+
"]");};r.get=t;r.getByClassName=function(l){var s=[];for(var q in a)a[q].className()==l&&s.push(a[q]);return s};r.registerPostInitializer=function(l){d?l():c.push(l)};r.extend=C;r.notifyRoot=k;r.recalculate=m;r.create=function(l,s){if(typeof e[l].create=="function")return e[l].create(s);if(e[l].prototype instanceof JQ_Base){var q=document.createElement("div");return new e[l](q,s)}throw new WidgetException("Widget "+l+" cannot be created on the fly");};r.destroy=D;return r}();$(window).resize(function(){setTimeout(UI_widgets.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};return this};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)}return this};
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});return this};
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))return this;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)}return this};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)}return this};
UI_Base.prototype.className=function(){if(typeof this.constructor.name!="undefined")return this.constructor.name;return/(\w+)\(/.exec(this.constructor.toString())[1]};UI_Base.prototype.enableAjax=function(a){this.ajaxProcessor=a;return this};UI_Base.prototype.sendAjaxRequest=function(a,b){UI_ajaxRequest("ajax.php",{processor:this.ajaxProcessor,language:UI_language,input:a},function(c){c.output&&alert("unexpected output: "+c.output);b(c.result)});return this};
UI_Base.prototype.createWidget=function(a,b,c,d){if(typeof b.id!="undefined")if(typeof UI_widgets(b.id)=="undefined"){a=UI_widgets.create(a,b);if(typeof c=="undefined"&&typeof this.contentElement=="function")c=this.contentElement();b=a.containerElement();if(a instanceof JQ_Base)b=b.get(0);if(typeof c!="undefined"&&typeof d!="undefined")c.insertBefore(b,d);else typeof c!="undefined"&&c.appendChild(b);a.children=[];a.parent=this;UI_widgets(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())}};UI_Base.prototype.destroy=function(){};
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(typeof HTMLElement=="function"&&typeof HTMLElement.prototype.setCapture=="undefined"){var capture=["click","mousedown","mouseup","mousemove","mouseover","mouseout"];HTMLElement.prototype.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)};HTMLElement.prototype.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=Array.prototype.slice.call(arguments,1),c=this,d=function(){},e=function(){return c.apply(this instanceof d?this:a||{},b.concat(Array.prototype.slice.call(arguments)))};d.prototype=c.prototype;e.prototype=new d;return e};
if(typeof Array.prototype.indexOf!="function")Array.prototype.indexOf=function(a){if(this===void 0||this===null)throw new TypeError;var b=Object(this),c=b.length>>>0;if(c===0)return-1;var d=0;if(arguments.length>0){d=Number(arguments[1]);if(d!==d)d=0;else if(d!==0&&d!==window.Infinity&&d!==-Window.Infinity)d=(d>0||-1)*Math.floor(Math.abs(d))}if(d>=c)return-1;for(d=d>=0?d:Math.max(c-Math.abs(d),0);d<c;d++)if(d in b&&b[d]===a)return d;return-1};
if(typeof Object.keys!="function")Object.keys=function(a){if(a!=Object(a))throw new TypeError("Object.keys called on non-object");var b=[];for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&b.push(c);return b};jQuery.fn.offset=function(a){return function(b){if(b)return a.apply(this,arguments);var c=a.apply(this,arguments);c.right=$(document).width()-c.left-this.outerWidth();c.bottom=$(document).height()-c.top-this.outerHeight();return c}}(jQuery.fn.offset);
jQuery.fn.position=function(){if(this.length==0)return null;var a=this.offset(),b=this.offsetParent().offset();for(var c in a)a[c]-=b[c];return a};
jQuery.offset.setOffset=function(a,b,c){var d=jQuery.css(a,"position");if(d==="static")a.style.position="relative";var e=jQuery(a),f=e.offset(),g=jQuery.css(a,"top"),j=jQuery.css(a,"left"),h=jQuery.css(a,"right"),k=jQuery.css(a,"bottom"),m={},u={};if((d==="absolute"||d==="fixed")&&jQuery.inArray("auto",[g,j,h,k])>-1){u=e.position();d=u.top;j=u.left;h=u.right;k=u.bottom}else{d=parseFloat(g)||0;j=parseFloat(j)||0;h=parseFloat(h)||0;k=parseFloat(k)||0}if(jQuery.isFunction(b))b=b.call(a,c,f);if(b.top!=
null)m.top=b.top-f.top+d;if(b.left!=null)m.left=b.left-f.left+j;if(b.right!=null)m.right=b.right-f.right-h;if(b.bottom!=null)m.bottom=b.bottom-f.bottom+k;"using"in b?b.using.call(a,m):e.css(m)};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}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_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""}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=PxFramework.resource.widgetURL("php",a,true);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:PxFramework.resource.url("")}}return false}
PxFramework.resource.widgetURL=function(a,b,c){if(typeof c=="undefined")c=false;var d="dev",e=document.getElementsByTagName("script");for(var f in e){var g=e[f];if(g.src)if(g.src.match(/^((.*)\/UI\/(.*?))\/scripts\/.*$/)){d=RegExp.$3;break}}return this.url("/UI/"+d+"/"+a+"/"+b,c)};
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),j=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:PxFramework.resource.iconURL(b.icon,b.size);j.src=c;j.height=b.size;j.width=b.size;j.alt=b.icon;f.appendChild(j);g.appendChild(a);e.appendChild(f);e.appendChild(g);d.appendChild(e)}}
function UI_deprecate(a,b,c){if(typeof window.Proxy=="undefined"){if(typeof Object.defineProperty!="function")return c[a]=b;try{Object.defineProperty({},"x",{})}catch(d){return c[a]=b}}if(typeof window.Proxy=="object")c[a]=Proxy.create({getOwnPropertyDescriptor:function(e){return Object.getOwnPropertyDescriptor(b,e)},getOwnPropertyNames:function(){return Object.getOwnPropertyNames(b)},defineProperty:function(e,f){Object.defineProperty(b,e,f)},"delete":function(e){console.warn("delete "+a+'["'+e+'"] is deprecated in '+
c.toString());return delete b[e]},has:function(e){console.warn(e+" in "+a+" is deprecated in "+c.toString());return typeof b[e]!="undefined"},get:function(e,f){console.warn("Using "+a+"."+f+" is deprecated in "+c.toString());return b[f]},set:function(e,f,g){console.warn("Using "+a+"."+f+" is deprecated in "+c.toString());return b[f]=g},enumerate:function(){console.warn("Enumerating "+a+" is deprecated in "+c.toString());return Object.getOwnPropertyNames(b).filter(function(e){return Object.getOwnPropertyDescriptor(b,
e).enumerable})},keys:function(){console.warn("Getting object keys for "+a+" is deprecated in "+c.toString());return Object.getOwnPropertyNames(b).filter(function(e){return Object.getOwnPropertyDescriptor(b,e).enumerable})}});else Object.defineProperty(c,a,{get:function(){console.warn("Using property "+a+" in "+c.toString()+" is deprecated.");return b},set:function(e){b=e}})}
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 JQ_Base(a,b){this.element=$(a);if(typeof b=="undefined")b=this.element.data("parameters");if(typeof b.id=="undefined")b.id=this.element.attr("id");this.id=b.id;this.element[this.name](this.element.data().parameters)}UI_widgets.extend(JQ_Base,UI_Base);JQ_Base.prototype.containerElement=function(){return this.element};JQ_Base.prototype.registerCallback=function(a,b){this.containerElement().bind(a,null,b)};JQ_Base.prototype.unregisterCallback=function(a,b){this.containerElement().unbind(a,b)};
JQ_Base.prototype.registerExpendableCallback=function(a,b){this.containerElement().one(a,null,b)};JQ_Base.prototype.runCallbacks=function(a,b){this.containerElement().trigger(a,b)};JQ_Base.prototype.className=function(){return this.name};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_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_widgets("ui_radio",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_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_widgets("ui_splitter",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,j=0;for(a=0;a<e.number;a++){var h=this.splitterParts[a],k=this.splitterBars[a],
m=Math.min(f-g,h.size()-h.minSize);k.element.style[b]=parseInt(k.element.style[b],10)-m-g+"px";h.element.style[d]=parseInt(h.element.style[d],10)-m+"px";if(g>0)h.element.style[b]=parseInt(h.element.style[b],10)-g+"px";g+=m}f-=g;for(a=this.splitterParts.length-1;a>e.number;a--){h=this.splitterParts[a];k=this.splitterBars[a-1];m=Math.min(f-j,h.size()-h.minSize);k.element.style[c]=parseInt(k.element.style[c],10)-m-j+"px";h.element.style[d]=parseInt(h.element.style[d],10)-m+"px";if(j>0)h.element.style[c]=
parseInt(h.element.style[c],10)-j+"px";j+=m}e.element.style[b]=parseInt(e.element.style[b],10)-g+"px";e.element.style[c]=parseInt(e.element.style[c],10)-j+"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_widgets.extend(UI_SplitterPart,UI_Base);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",j=d?"width":"height",h=d?"offsetWidth":"offsetHeight",k=false,m=false,u=false,t=false,y=false,C=false,D=0,r=function(q){UI_hideFrames(a.element,true);c.onmousedown=null;if(!u){k=a.part(b);m=a.part(b+1);u=k.element;t=m.element}q=new UI_Event(q);y=q.client();D=0;C={left:parseInt(c.style[f],10),right:parseInt(c.style[g],10)};c.onmousemove=s;c.onmouseup=l;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,C)},l=function(q){UI_hideFrames(a.element,false);q=new UI_Event(q);q.offset();c.releaseCapture();c.onmousemove=null;c.onmouseup=null;c.onmousedown=r;q={left:parseInt(c.style[f],10),right:parseInt(c.style[g],10)};var v=isNaN(C.left)?C.right-q.right:q.left-
C.left;if(u.style[j]){var n=parseInt(u.style[j],10);u.style[j]=n+v+"px"}if(u.style[g]){n=parseInt(u.style[g],10);u.style[g]=n-v+"px"}if(t.style[j]){n=parseInt(t.style[j],10);t.style[j]=n-v+"px"}if(t.style[f]){n=parseInt(t.style[f],10);t.style[f]=n+v+"px"}c.style.borderLeft=c.style.borderRight=c.style.borderTop=c.style.borderBottom="0px";c.parentNode.style.cursor="";a.notifyChildren("recalculate");d||(q={top:q.left,bottom:q.right});a.barReleased(b,q)},s=function(q){q=(new UI_Event(q)).client();D+=
q[e]-y[e];var v=a.part(b).minSize,n=a.part(b+1).minSize;if(isNaN(C.left)){var z=parseInt(c.style[g],10);n=parseInt(t.style[g],10)+n;v=parseInt(u.style[g],10)+u[h]-v-5;v=Math.max(n,Math.min(v,z-D));D-=z-v;c.style[g]=v+"px"}else{z=parseInt(c.style[f],10);v=parseInt(u.style[f],10)+v;n=parseInt(t.style[f],10)+t[h]-n-5;v=Math.max(v,Math.min(n,z+D));D-=v-z;c.style[f]=v+"px"}y=q};c.onmousedown=r}
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(h){if(!b.widgetManager.enabled())return false;if(b.displayType()=="textarea")return false;if(b.readonly())return true;return h.offsetX()>
b.element.offsetWidth-20},g=function(){if(b.suggestionActive){b.element.value="";b.element.style.color="";b.suggestionActive=false}};this.registerElementHandlers=function(h){UI_registerHandler(h,"click",function(k){g();k=new UI_Event(k);if(f(k)){b.openDropdown();b.runCallbacks("dropdownOpened",{})}e&&k.stopBubbling();return false});UI_registerHandler(h,"mouseover",function(k){k=new UI_Event(k);b.runCallbacks("mouseOver",{id:b.id,textbox:b});h.style.cursor=f(k)?"pointer":"auto"});UI_registerHandler(h,
"mousemove",function(k){k=new UI_Event(k);h.style.cursor=f(k)?"pointer":"auto"});UI_registerHandler(h,"keyup",function(k){b.runCallbacks("valueChanged",{event:k,value:b.value()});b.contentChanged=true;c&&clearTimeout(c);c=setTimeout(function(){var m=b.errorChecker.run(b.value(),true);m!=b.errorState&&b.runCallbacks("errorStateChanged",{failedTest:m});b.errorState=m;c=false},100)});UI_registerHandler(h,"blur",function(k){b.runCallbacks("lostFocus",k);b.setSuggestion(b.suggestionText)});UI_registerHandler(h,
"focus",function(k){b.runCallbacks("gotFocus",k)});UI_registerHandler(h,"keydown",function(k){g();k=new UI_Event(k);d=k.specialKey()});UI_registerHandler(h,"keydown",function(k){k=new UI_Event(k);b.runCallbacks("keyPressed",k)});UI_registerHandler(h,"keypress",function(k){k=new UI_Event(k);var m=k.keyCode(),u=String.fromCharCode(m),t=k.specialKey(),y=k.ctrlKey();if(t||y)return true;t=b.errorChecker.run(b.element.value+u,true);if(t==undefined)return true;b.runCallbacks("characterBlocked",{keychar:u,
keynum:m,event:k,failedTest:t});k.stopDefault();return false})};this.registerElementHandlers(a);var j=false;this.scheduleSizeChecker=function(){if(!j){var h=function(){var m=parseInt(b.element.clientWidth,10);if(isNaN(m)||m<=0)setTimeout(h,100);else{m=k-m;var u=parseInt(b.element.style.width,10);b.element.style.width=u+m+"px";j=false}},k=parseInt(b.element.clientWidth,10);if(isNaN(k)||k<=0)k=parseInt(b.element.style.width,10);j=setTimeout(h,0)}};this.addPredefinedTest=function(h,k){if(h=="datemutation"||
h=="extendeddate"||h=="extendeddatetime"){document.getElementById(this.id+"_special").disabled=this.element.disabled;document.getElementById(this.id+"_system").disabled=this.element.disabled}if(this.widgetManager.setCurrent(h)&&this.element.className!="ui_textbox_more"&&this.element.tagName!="TEXTAREA"){this.scheduleSizeChecker();this.element.className="ui_textbox_more";this.form&&this.form.checkAutoComplete()}UI_Textbox.prototype.addPredefinedTest.call(this,h,k)}.bind(this);this.setMaxLength=function(h){if(b.displayType()==
"textarea")UI_Textbox.prototype.setMaxLength.call(b,h);else h<0?b.element.removeAttribute("maxlength"):b.element.setAttribute("maxlength",h)};this.removeAllTests=function(){document.getElementById(this.id+"_special").disabled=true;document.getElementById(this.id+"_system").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_widgets("ui_textbox",UI_Textbox);UI_widgets("ui_textbox_more",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);return UI_widgets(new UI_Textbox(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;document.getElementById(this.id+"_system").disabled=true}else{a=!(this.hasTest("datemutation")||this.hasTest("extendeddate")||this.hasTest("extendeddatetime"));document.getElementById(this.id+"_special").disabled=a;document.getElementById(this.id+"_system").disabled=a}};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"";var a=this.widgetManager.hiddenElement(true);if(typeof a!="undefined")return a.value;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(j){j=new UI_Event(j);j.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);var e=function(j){if(j==document.body)return j;if(j.scrollHeight>j.offsetHeight)return j;return e(j.parentNode)},f=e(a.parentNode),g=f.scrollHeight;$(a).css({display:"block",opacity:0,"min-width":parseInt(b.element.offsetWidth,10)-2+"px"});this.checkDropdown();$(a).animate({opacity:1},400);setTimeout(function(){var j=e(a.parentNode);j==f&&j.scrollHeight<=g||a.scrollIntoView&&a.scrollIntoView()})}};
UI_Textbox.prototype.closeDropdown=function(){var a=this.dropdownElement();$(a).is(":visible")&&$(a).animate({opacity:0},400,"swing",function(){$(a).css({display:"none"});var b=document.getElementById("ui_textbox_eventcatcher_"+this.id);if(b){b.originalParent&&b.originalParent.appendChild(a);b.parentNode.removeChild(b)}}.bind(this))};
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),j=parseInt(a.offsetWidth,10);b=parseInt(b.offsetWidth,10);var h=c.top+d+e<f||c.top<e?c.top+d-1:c.top-e+1,k=c.left+j<b?c.left:c.left+g-j;UI_setPosition(a,k,h+1);
setTimeout(function(){UI_setPosition(a,k,h)})}};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_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_HumanDateMutation(a,b,c,d){this.operator=a;this.count=b;this.unit=c;this.floor=d}
UI_HumanDateMutation.parse=function(a){if(a.match(/(plus|min) ([0-9]+) (day|week|month|year);(second|minute|hour|day|month|year)/i)){a=RegExp.$1;var b=parseInt(RegExp.$2,10),c=RegExp.$3,d=RegExp.$4?RegExp.$4:"second";if(!(isNaN(b)||!c||!a||!d))return new UI_HumanDateMutation(a,b,c,d)}};
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=="seconds"?__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};UI_HumanDateMutation.prototype.systemNotation=function(){return this.operator+" "+this.count+" "+this.unit+";"+this.floor};
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_Notifier(){this.id="notifier";var a=[],b=this,c=function(){if(parent&&parent!=window&&typeof parent.UI_widgets=="function"&&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_widgets.extend(UI_Notifier,UI_Base);UI_Notifier.prototype.containerElement=function(){return document.body};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)};
UI_widgets("ui_dropdown",{options:{width:350,height:200},_create:function(){this._applyTemplate("UI_Dropdown");this.flyout=this.element.children(".ui_dropdown_flyout");this.label=this.element.children(".ui_dropdown_label");this.input=this.element.children("input");this.isOpen=false;this.element.bind("click",null,this.toggle.bind(this));this.element.click(function(a){a.stopPropagation()});$("html").click(this.close.bind(this))},label:function(){return this.label.text()},setLabel:function(a){this.label.text(a)},
value:function(){return this.input.val()},setValue:function(a,b){this.input.val(a);typeof b!="undefined"&&this.setLabel(b)},opened:function(){return this.isOpen},toggle:function(){this.isOpen=!this.isOpen;this.flyout.animate({opacity:"toggle",height:"toggle"})},open:function(){this.isOpen||this.toggle()},close:function(){this.isOpen&&this.toggle()}});
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,j=function(u,t){d=u;this.setValue(t);c.closeDropdown();this.runCallbacks("valueChanged",{widget:this,value:t})};
f=function(u,t){if(typeof t=="undefined")t=u;this.options[u]=t;var y="ui_selectable_"+this.id+"_"+g;c.createWidget("ui_selectable",{id:y,enabled:"enabled",wrap:false,content:t,selected:c.element.value===t}).registerCallback("clicked",j.bind(this,UI_widgets(y),u,t));if(c.containerElement().value===u)d=UI_widgets(y);g++}.bind(this);for(var h in this.extraOptions)f(h,this.extraOptions[h]);for(var k in e)if(e[k].length>0)for(var m in e[k])f(k+"/"+e[k][m]);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("ui_selecttimezone",UI_SelectTimezone);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_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_widgets("ui_chart",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 instanceof 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,false);this.chart.redraw()}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_Flyout(a){var b=a.id.substr(14);a=$(a);this.id=b;this.element=a;this.opened=this.groupname=false;this.timer=0;this.direction="southeast";this.parent=this.holdsMouse=false;this.attachPosition="bottom";a.mouseover(function(){this.holdsMouse=true;if(this.timer){clearTimeout(this.timer);this.timer=0}}.bind(this));a.mouseout(function(c){c=$(c.relatedTarget);if(!c.closest(a).length)if(c.attr("class")!="ui_textbox_eventcatcher"){this.holdsMouse=false;this.close()}}.bind(this))}
UI_widgets("ui_flyout",UI_Flyout);UI_Flyout.findFlyout=function(a){if(a instanceof UI_Base)a=a.containerElement();a instanceof jQuery||(a=$(a));a=a.closest(".ui_flyout");if(a.length==1)return UI_widgets(a.attr("id").substr(14))};UI_Flyout.show=function(a){a=UI_Flyout.findFlyout(a);typeof a!="undefined"&&a.open()};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.attach=function(a,b,c){this.parent=typeof a=="string"?$("#"+a):a;if(!(this.parent instanceof jQuery))this.parent=$(this.parent);if(b)this.attachPosition=b;c&&this.setDirection(c)};UI_Flyout.prototype.attachToWidget=function(a,b,c){this.attach(a.containerElement(),b,c);a.registerCallback("mouseOver",function(){this.open()}.bind(this));a.registerCallback("mouseOut",function(){this.hasMouse()||this.close()}.bind(this))};
UI_Flyout.prototype.reposition=function(){if(this.parent){var a=this.element,b=this.parent,c=b.offset();a.css({right:"",bottom:"",left:"",top:""});var d=this.attachPosition,e=this.direction.indexOf("west")>=0,f=this.direction.indexOf("north")>=0,g={};if(d=="left")g.left=c.left;else if(d=="right")g.left=c.left+b.outerWidth();else if(e)g.right=c.right;else g.left=c.left;if(d=="top")g.bottom=c.bottom+b.outerHeight();else if(d=="bottom")g.top=c.top+b.outerHeight();else if(f)g.bottom=c.bottom+b.outerHeight();
else g.top=c.top+b.outerHeight();a.offset(g)}};UI_Flyout.prototype.hasMouse=function(){return this.holdsMouse};
UI_Flyout.prototype.close=function(a){if(this.opened){var b=$(this.containerElement());if(a===true){b.css({opacity:0,height:0,width:0,display:"none"});this.runCallbacks("closed");this.opened=false;if(this.timer){window.clearTimeout(this.timer);this.timer=0}}else if(!this.timer)this.timer=setTimeout(function(){this.timer=0;this.opened=false;b.animate({opacity:0,height:0,width:0},"fast","swing",function(){b.css({display:"none"});this.runCallbacks("closed")}.bind(this))}.bind(this),500)}};
UI_Flyout.prototype.open=function(){if(this.timer){clearTimeout(this.timer);this.timer=0}if(!this.opened){for(var a=$(this.containerElement()),b=a.children(".ui_flyoutcontent"),c=UI_widgets.getByClassName("UI_Flyout"),d=0;d<c.length;d++){var e=c[d];e!=this&&e.close(true)}this.opened=true;a.css({display:"block",height:0,width:0,opacity:0});this.reposition();a.animate({opacity:1,height:b.outerHeight(),width:b.outerWidth()},"fast","swing",function(){this.runCallbacks("opened");a.get(0).style.filter=
""}.bind(this))}};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 j=0,h=0,k=0;k<b;k++){var m=this.cache.get(k+a);if(m==undefined)break;g.grid.setRow(k+a,m);j++}if(!(j>=b)){for(k=b-1;k>=0;k--){m=this.cache.get(k+a);if(m==undefined)break;g.grid.setRow(k+a,m);h++}var u=
{what:"gridData",id:this.grid.id,start:a+j,length:b-j-h,ordered:c>=0?c:-1,sort:d,dataType:e?e:"text"};if(!(u.length<=0)){if(this.timer){if(function(t,y){for(var C in t)if(t[C]!=y[C])return false;return true}(this.pendingRequest,u))return;clearTimeout(this.timer)}this.pendingRequest=u;if(u.start<g.grid.getFirstRow()||u.start>g.grid.getFirstRow()+g.grid.getVisibleRows()){g.timer=false;g.pendingRequest=false}else ldxSendCallback(g.ldx,u,function(t){for(var y=0;y<t.length;y++){g.cache.store(u.start+y,
t[y]);g.grid.setRow(u.start+y,t[y])}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_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_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);if(d){d.checkDropdown();e.registerCallback("opened",function(){d.checkDropdown()})}}})}};this.reset=function(){if(b){UI_widgets.destroy(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_widgets("ui_selectfield",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_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);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_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_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_widgets("ui_gadget",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(j){this.show(j.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(j){var h=UI_Gadget.items[j];setTimeout(function(){h.containerElement().style.visibility="visible";h.current().containerElement(true).css({opacity:0,visibility:"visible"}).animate({opacity:1},400,"swing")},j*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),j=null;for(var h in this.windows)if(this.windows[h].icon()==g){j=this.windows[h];break}g=j.icon(true);if(g.css("display")!="none"){if(e!="all")e=="others"&&this.currentWindow!=j||c.push(g)}else if(this.currentWindow.menu()!="none")e=="others"&&this.currentWindow==j||j.hidden()||d.push(g)}if(typeof a==
"boolean"&&a){$.each(c,function(k,m){m.css({display:"none"})});$.each(d,function(k,m){m.css({display:"block",width:"16px"})})}else{$.each(c,function(k,m){m.animate({width:"0px"},500,"swing",function(){m.css({display:"none"})})});$.each(d,function(k,m){m.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_Tree(a){this.id=a.id.substr(8);this.element=a;this.nodes={};$(a).disableSelection();this.butMode="Open";a=$(a).children(".ui_treenode");for(var b=0;b<a.length;b++){var c=new UI_TreeNode(this,a.get(b));this.nodes[c.id]=c}}UI_widgets("ui_tree",UI_Tree);UI_Tree.prototype.recalculate=function(){};UI_Tree.prototype.containerElement=function(){return this.element};
UI_Tree.prototype.getNode=function(a){if(typeof this.nodes[a]!="undefined")return this.nodes[a];for(var b in this.nodes){var c=this.nodes[b].getNode(a);if(typeof 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(typeof this.nodes[a]=="undefined"){var c=this.createNode(a,b);this.element.appendChild(c);c=new UI_TreeNode(this,c);this.nodes[c.id]=c;this.recalculate();c.recalculate();return c}};UI_Tree.prototype.findNode=function(a){for(var b in this.nodes){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={};this.header=$(b).children(".ui_treenode_header");this.children=$(b).children(".ui_treenode_children");this.content=this.header.children(".ui_treenode_content").get(0);this.button=this.header.children(".ui_tree_img_open, .ui_tree_img_hidden, .ui_tree_img_close");$(this.content).mousedown(function(){if(Object.keys(this.nodes).length==0)return this.tree().runCallbacks("clicked",{treenode:this});var f=this.tree().buttonMode();
if(this.collapsed()){if(!(f=="None"||f=="Close")){this.open();this.tree().runCallbacks("opened",{treenode:this})}}else if(!(f=="None"||f=="Open")){this.close();this.tree().runCallbacks("closed",{treenode:this})}}.bind(this));this.button.click(function(){if(this.button.attr("class")=="ui_tree_img_open"){this.close();this.tree().runCallbacks("closed",{treenode:this})}else if(this.button.attr("class")=="ui_tree_img_close"){this.open();this.tree().runCallbacks("opened",{treenode:this})}}.bind(this));
this.collapsed()||this.tree().runCallbacks("opened",{treenode:this});for(var c=this.children.children(".ui_treenode"),d=0;d<c.length;d++){var e=new UI_TreeNode(this,c.get(d));this.nodes[e.id]=e}}UI_widgets.extend(UI_TreeNode,UI_Base);UI_TreeNode.prototype.parentNode=function(){return this.parent==this.tree()?undefined:this.parent};
UI_TreeNode.prototype.getNode=function(a){if(typeof this.nodes[a]!="undefined")return this.nodes[a];for(var b in this.nodes){var c=this.nodes[b].getNode(a);if(typeof 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 in this.nodes){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=Object.keys(this.nodes).length>0,b=!this.collapsed(),c=this.header.children("img"),d=0;d<c.length;d++){var e=c.get(d);if(e.alt=="Hidden")e.style.display=a?"none":"block";if(e.alt=="Open")e.style.display=a&&b?"block":"none";if(e.alt=="Close")e.style.display=a&&!b?"block":"none"}};
UI_TreeNode.prototype.open=function(a){if(!(Object.keys(this.nodes).length==0||this.button.attr("class")!="ui_tree_img_close")){this.children.css({opacity:0}).animate({opacity:1,height:"show"},400,"swing",a);this.button.attr("class","ui_tree_img_open")}};UI_TreeNode.prototype.makeVisible=function(a){var b=this.parentNode();if(b==undefined)return typeof a=="function"?a():undefined;b.makeVisible(function(){b.open(a)})};
UI_TreeNode.prototype.close=function(){this.children.animate({opacity:0,height:"hide"},400,"swing");this.button.attr("class")!="ui_tree_img_hidden"&&this.button.attr("class","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.is(":visible")};
UI_TreeNode.prototype.addNode=function(a,b){if(this.tree().getNode(a)==undefined){var c=this.tree().createNode(a,b);this.children.append(c);c=new UI_TreeNode(this,c);this.nodes[c.id]=c;if(Object.keys(this.nodes).length==1)this.button.attr("class",this.children.is(":visible")?"ui_tree_img_open":"ui_tree_img_close");this.recalculate();c.recalculate();return c}};
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_Stretch(a){this.id=a.id.substr(11);var b=false,c=$(a).children(".ui_stretchtop"),d=$(a).children(".ui_stretchcenter"),e=$(a).children(".ui_stretchbottom"),f=function(){for(var m=0,u=0,t=0;t<c.length;t++)m+=$(c[t]).outerHeight();for(t=0;t<e.length;t++)u+=$(e[t]).outerHeight();return{top:m,bottom:u}},g={top:-1,bottom:-1};this.recalculate=function(){if(!b){b=true;window.setTimeout(function(){if(d.length==0)return setTimeout(function(){this.notifyChildren("recalculate")}.bind(this));var m=
f();if(!(m.top==g.top&&m.bottom==g.bottom)){g.top=m.top;g.bottom=m.bottom;d.css({top:m.top+"px",bottom:m.bottom+"px",visibility:"visible"});setTimeout(function(){this.notifyChildren("recalculate")}.bind(this))}b=false}.bind(this))}}.bind(this);this.containerElement=function(){return a};if(d.length!=0){c.bind("DOMSubtreeModified",this.recalculate.bind(this));c.bind("resize",this.recalculate.bind(this));e.bind("DOMSubtreeModified",this.recalculate.bind(this));e.bind("resize",this.recalculate.bind(this));
if($.browser.webkit){var j=function(m){var u=m.style;Object.defineProperty(m,"style",{get:function(){setTimeout(function(){this.recalculate()}.bind(this));return u}.bind(this),set:function(y){u=y;setTimeout(function(){this.recalculate()}.bind(this))}.bind(this),enumerable:true,configurable:true});for(var t=0;t<m.childNodes.length;t++)j(m.childNodes[t])}.bind(this);try{for(var h=0;h<c.length;h++)j(c[h]);for(h=0;h<e.length;h++)j(e[h])}catch(k){window.setInterval(function(){this.recalculate()}.bind(this),
500)}}}}UI_widgets("ui_stretchcontainer",UI_Stretch);
function UI_GridSeperator(a,b,c){var d=this;this.gridHeader=a;this.index=c;this.element=typeof b=="undefined"?function(){var m=a.containerElement(),u=a.columnRemainerElement(),t=a.getColumns(),y=t[t.length-1];t=document.createElement("div");t.className="ui_grid_seperator";t.style.left=y.position()+y.width()+"px";y=document.createElement("div");y.className="ui_grid_seperator_left";t.appendChild(y);y=document.createElement("div");y.className="ui_grid_seperator_right";t.appendChild(y);m.insertBefore(t,
u);return t}():b;this.minLeft=0;var e=false,f=false,g=0,j=function(m){d.element.onmousedown=null;m=new UI_Event(m);e=m.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=h;d.element.onlosecapture=h;d.element.setCapture();a.seperatorStartMoving(d.index)},h=function(){d.element.releaseCapture();d.element.onmousemove=null;d.element.onmouseup=null;d.element.onlosecapture=null;d.element.onmousedown=j;d.element.parentNode.style.cursor=
"";a.seperatorFinishedMoving(d.index)},k=function(m){m=(new UI_Event(m)).client();g+=m.x-e.x;var u=parseInt(d.element.style.left,10),t=Math.max(d.minLeft,u+g);u=t-u;g-=u;if(u!=0){d.element.style.left=t+"px";a.seperatorBusyMoving(d.index,u)}e=m};d.element.onmousedown=j}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};
UI_widgets("ui_conditional",{_create:function(){this._applyTemplate("UI_Conditional");this.widgets=[];var a=["id","style","content","disabled"];for(var b in this.options)a.indexOf(b)==-1&&this.attachToWidget(b,this.options[b]);this.visible=true},checkWidgets:function(){for(var a in this.widgets)if(!function(b,c){for(var d=c.split("|"),e=0;e<d.length;e++){var f=d[e];if(f.charAt(0)=="!"){if(b.value()!=f.substr(1))return true}else if(b.value()==f)return true}return false}(this.widgets[a].widget,this.widgets[a].value))return false;
return true},updateWidgets:function(){var a=this.checkWidgets();if(a!=this.visible){this.visible=a;this.element.animate({opacity:a?"show":"hide",height:a?"show":"hide"},UI_widgets.recalculate());if(a)this.enabledElements.prop("disabled",false);else{this.enabledElements=this.element.find(":input:enabled");this.enabledElements.prop("disabled",true)}this.element.trigger(a?"activated":"deactivated")}},attachToWidget:function(a,b){if(typeof a=="string")a=UI_widgets(a);if(a instanceof UI_Base){a.registerCallback("valueChanged",
this.updateWidgets.bind(this));window.setTimeout(this.updateWidgets.bind(this));this.widgets.push({widget:a,value:b})}}});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_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_widgets("ui_geooverlay",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(h){setTimeout(function(){g.runCallbacks("error",{message:h.message})})});
google.visualization.events.addListener(this.geomap,"select",function(){setTimeout(function(){if(g.dataMode!="regions")g.runCallbacks("select");else{var h=g.geomap.getSelection();g.runCallbacks("select",{selection:h})}})});google.visualization.events.addListener(this.geomap,"regionClick",function(h){h.region.length==2&&g.setRegion(h.region);setTimeout(function(){g.runCallbacks("clicked",{region:h.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(j){console.log(j)}};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_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_widgets("ui_entityproperty",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_widgets.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_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));$(a).mousedown(function(c){c.stopPropagation()})}UI_widgets("ui_tooltip",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_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;$(a).disableSelection();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("ui_selectable",UI_Selectable);
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_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;$(b).mousewheel(function(d,e){e*=-30;if(e<-c.startPos)e=-c.startPos;var f=c.height()-b.offsetHeight-c.startPos;if(e>f)e=f;e&&a.mouseWheelMoved(c.startPos+e);return false})}
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)this.selected.indexOf(a)==-1&&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 this.selected.indexOf(a)!=-1};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};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(this.selected.indexOf(a+this.firstRow)!=-1)}};
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($(b).disableSelection();;){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,this.selected.indexOf(d)!=-1));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_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)}}
function UI_Editor(a){this.element=a;this.id=a.id.substr(10);this.errorChecker=new UI_ErrorChecker(this);this.templateVersion=3}UI_widgets.extend(UI_Editor,UI_Base);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};
UI_widgets.extend(UI_SourceEditor,UI_Editor);UI_widgets("ui_sourceEditor",UI_SourceEditor);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.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_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_Balloon(a){this.element=a;this.id=a.id.substr(11);a=this.closeElement();this.ignore=function(){};a.onclick=function(){this.hide();this.runCallbacks("closed")}.bind(this)}UI_widgets("ui_balloon",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(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_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(j,h){if(g.userDefinedSort)return g.userDefinedSort(j.fields[c][0],h.fields[c][0]);else if(g.sorting=="numeric"||e=="numeric")return parseFloat(j.fields[c][0])-parseFloat(h.fields[c][0]);else if(g.sorting=="caseInsensitive"){var k=j.fields[c][0].toString().toUpperCase(),m=h.fields[c][0].toString().toUpperCase();return k==m?0:k<m?-1:1}else if(g.sorting=="caseSensitive"){k=j.fields[c][0].toString();m=h.fields[c][0].toString();
return k==m?0:k<m?-1:1}else{k=j.fields[c][0];m=h.fields[c][0];if(isNaN(parseInt(j,10))||isNaN(parseInt(h,10))){k=j.toString().toUpperCase();m=h.toString().toUpperCase();return k==m?0:k<m?-1:1}else return k-m}};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_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_widgets("ui_warning",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_widgets.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_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,j=false,h=false;this.restoreLocation=false;this.position={left:0,top:0};this.size={height:0,width:0};var k=this,m=function(n){n=new UI_Event(n);n=n.client();var z={x:n.x-j.x,y:n.y-j.y};UI_setPosition(g,n.x-200,n.y-200);if(h.className.indexOf("Left")>0){var p=parseInt(c.style.left,10)+z.x,o=parseInt(c.style.width,
10)-z.x;if(o<147){o=147-o;n.x-=o;p-=o;o=147}c.style.left=p+"px";c.style.width=o+"px"}if(h.className.indexOf("Top")>0){p=parseInt(c.style.top,10)+z.y;o=parseInt(c.style.height,10)-z.y;if(o<50){o=50-o;n.y-=o;p-=o;o=50}c.style.top=p+"px";c.style.height=o+"px"}if(h.className.indexOf("Right")>0){o=parseInt(c.style.width,10)+z.x;if(o<147){n.x+=147-o;o=147}c.style.width=o+"px"}if(h.className.indexOf("Bottom")>0){o=parseInt(c.style.height,10)+z.y;if(o<50){n.y+=50-o;o=50}c.style.height=o+"px"}j=n},u=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";h.onmousedown=t;h.onmouseup=null;h.onmousemove=null;h.releaseCapture();setTimeout(function(){k.limitSize()},0)},t=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);j=n.client();h=n.srcDomElement();h.onmousemove=m;h.onmouseup=u;h.onmousedown=null;g.style.display="block";UI_setPosition(g,j.x-200,j.y-200);g.style.cursor=UI_getStyle(h,"cursor");h.setCapture()}},y=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",
y);for(var C=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",y);D(frame.contentWindow.document)}},D=function(n){if(n.tagName=="IFRAME"){UI_registerHandler(n,"load",C);UI_registerHandler(n,"readystatechange",C);if(n.contentWindow)try{UI_registerHandler(n.contentWindow.document,"keydown",y);D(n.contentWindow.document)}catch(z){}}else for(var p=
0;p<n.childNodes.length;p++)D(n.childNodes[p])},r=0;r<a.childNodes.length;r++){var l=a.childNodes[r];if(l.className=="ui_popupTop")b=l;if(l.className=="ui_popupBottom")this.contentElement=l;if(l.className=="ui_popupTopLeft")l.onmousedown=t;if(l.className=="ui_popupTopCenter")l.onmousedown=t;if(l.className=="ui_popupTopRight")l.onmousedown=t;if(l.className=="ui_popupLeftTop")l.onmousedown=t;if(l.className=="ui_popupLeftCenter")l.onmousedown=t;if(l.className=="ui_popupLeftBottom")l.onmousedown=t;if(l.className==
"ui_popupRightTop")l.onmousedown=t;if(l.className=="ui_popupRightCenter")l.onmousedown=t;if(l.className=="ui_popupRightBottom")l.onmousedown=t;if(l.className=="ui_popupBottomLeft")l.onmousedown=t;if(l.className=="ui_popupBottomCenter")l.onmousedown=t;if(l.className=="ui_popupBottomRight")l.onmousedown=t;if(l.className=="ui_popupSizer")c=l;if(l.className=="ui_popupFollower")g=l;D(l)}for(r=0;r<b.childNodes.length;r++){l=b.childNodes[r];if(l.className=="ui_popupTitle")this.titleElement=l;if(l.className==
"ui_popupClose")d=l;if(l.className=="ui_popupResize")e=l;if(l.className=="ui_popupMinimize")f=l}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 s=function(n){if(!k.maximized()){UI_hideFrames(a,true);n=new UI_Event(n);j=n.client();k.titleElement.onmousedown=
null;k.titleElement.onmousemove=v;k.titleElement.onmouseup=q;k.titleElement.setCapture();k.runCallbacks("startMoving")}},q=function(){UI_hideFrames(a,false);k.titleElement.onmousedown=s;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})},v=function(n){n=new UI_Event(n);n=n.client();var z={x:n.x-j.x,y:n.y-j.y},p=UI_getPosition(a),o=p.left+z.x;z=p.top+z.y;p=document.documentElement.clientWidth?
document.documentElement.clientWidth:document.body.clientWidth;var x=document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight;if(o<0)o=0;if(o+a.clientWidth>p)o=p-a.clientWidth;if(z<0)z=0;if(z+a.clientHeight>x)z=x-a.clientHeight;UI_setPosition(a,o,z);j=n};this.titleElement.onmousedown=s}UI_widgets("ui_popup",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_Clock(a){this.id=a.id.substr(9);this.element=a;var b=this;$.getScript(PxFramework.resource.widgetURL("scripts","/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 j=g.contentWindow.document,h=j.getElementById("coolclock_"+b.id);h&&CoolClock.createClock(h,j)}};g.src=PxFramework.resource.widgetURL("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,j){var h=1;j(5);var k=setInterval(function(){j(h<5?5:h<10?10:
20);h++},100);g.onmouseup=function(){clearTimeout(k);g.releaseCapture();g.onmouseup=null;var m=UI_findElement(function(u){return u.className&&u.className=="ui_clock_label"},b.element);b.runCallbacks("timeChanged",{time:m.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_widgets("ui_clock",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_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_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_widgets("ui_editwebformfield",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+"_tb"),b=UI_widgets(this.id+"_sb");return a.enabled()||b.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_TextboxWidgetManager(a){this.textbox=a;var b=document.getElementById(a.id+"_system"),c=[],d=[],e=new UI_Table(a.dropdownElement());this.extended=this.current=a.dropdownElement().innerHTML.length>0?"custom":false;var f=this,g=function(r,l){var s=e.cell(0,r);s.innerHTML=l.replace(/\s*$/,"");return s},j=function(r){g(0,r);r=document.getElementById("ui_calendar_textbox_calendar_"+a.id);r=new UI_Calendar(r);UI_widgets(r);r.registerCallback("dateClicked",function(l){f.current=="datetime"&&m(["calendar",
"clock"]);if(!(f.current!="date"||a.readonly())){a.setValue(l.value);b.value=l.value;a.runCallbacks("valueChanged",{event:l,value:l.value})}});return r},h=function(r){g(1,r);r=document.getElementById("ui_clock_textbox_clock_"+a.id);r=new UI_Clock(r);UI_widgets(r);r.registerCallback("timeChanged",function(s){f.current=="datetime"&&m(["calendar","clock"]);if(!(f.current!="time"||a.readonly())){a.setValue(s.time);b.value=s.time;a.runCallbacks("valueChanged",{event:s,value:s.time})}});var l=function(s){f.current==
"datetime"&&u("calendar",function(q){var v=new Date(q.date().getTime());v.setDate(v.getDate()+s);q.setDate(v);m(["calendar","clock"])})};r.registerCallback("dayIncreased",function(){l(+1)});r.registerCallback("dayDecreased",function(){l(-1)});return r},k=function(r){g(2,r);r=document.getElementById("ui_datemutation_textbox_datemutation_"+a.id);r=new UI_DateMutation(r);UI_widgets(r);r.registerCallback("valueChanged",function(l){if(!(f.current!="datemutation"||a.readonly())){a.setValue(l.label);b.value=
l.value;a.runCallbacks("valueChanged",{event:l,value:l.value,label:l.label})}});r.registerCallback("buttonClicked",function(){a.closeDropdown()});return r},m=function(r){a.readonly()||t(r,function(l){for(var s=[],q=0;q<r.length;q++)s.push(l[r[q]].value());l=s.join(" ");a.setValue(l);b.value=l;a.runCallbacks("valueChanged",{event:false,value:l})})},u=function(r,l){if(c[r])l&&setTimeout(function(){l(c[r])});else if(d[r]&&d[r].length>0)l&&d[r].push(l);else{d[r]=[l];var s={type:r,value:a.value()};a.sendAjaxRequest(s,
function(q){var v;a:switch(r){case "calendar":v=j(q);break a;case "clock":v=h(q);break a;case "datemutation":v=k(q);break a}q=c[r]=v;for(v=0;v<d[r].length;v++){var n=d[r][v];n&&n(q)}d[r]=[];a.checkDropdown()})}},t=function(r,l){for(var s={},q=0,v=0;v<r.length;v++){var n=r[v];u(n,function(z){return function(p){s[z]=p;q++;q<r.length||l&&l(s)}}(n))}},y=function(){if(f.current=="date"||f.current=="datetime"){f.current="datemutation";u("datemutation")}else if(f.current=="datemutation"){f.current=f.extended==
"extendeddate"?"date":"datetime";u("calendar");f.current=="datetime"&&u("clock")}D();return false},C=function(r,l){var s=document.createElement("a");s.className=r;s.href="#";if(s.innerText==undefined)s.textContent=l;else s.innerText=l;a.dropdownElement().appendChild(s);s.onclick=y;return s},D=function(){e.cell(0,0).style.display=f.current=="date"||f.current=="datetime"?"":"none";e.cell(0,1).style.display=f.current=="time"||f.current=="datetime"?"":"none";e.cell(0,2).style.display=f.current=="datemutation"?
"":"none";var r=UI_findElement(function(s){return s.className=="ui_widgetmanager_datelink"},a.dropdownElement()),l=UI_findElement(function(s){return s.className=="ui_widgetmanager_mutationlink"},a.dropdownElement());if(f.extended=="extendeddate"||f.extended=="extendeddatetime"){r||(r=C("ui_widgetmanager_datelink",__tr("Click here to use a fixed date instead")));l||(l=C("ui_widgetmanager_mutationlink",__tr("Click here to use a variable date")));r.style.display=f.current=="datemutation"?"block":"none";
l.style.display=f.current=="date"||f.current=="datetime"?"block":"none"}else{if(r)r.style.display="none";if(l)l.style.display="none"}};a.registerCallback("dropdownOpened",function(){if(f.current!="custom"){D();if(f.current)if(f.current=="date")u("calendar",function(l){l.setValue(a.value())});else if(f.current=="time")u("clock",function(l){l.setValue(a.value())});else if(f.current=="datetime"){var r=a.value().replace(/^\s\s*/,"").replace(/\s\s*$/,"").split(/\s+/);u("calendar",function(l){r.length>
0&&l.setValue(r[0])});u("clock",function(l){r.length<2||r[0].indexOf("0000")!=-1&&r[1].substr(0,5)=="00:00"||l.setValue(r[1])})}else f.current=="datemutation"&&u("datemutation",function(l){l.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.hiddenElement=function(a){if(typeof a!="boolean")a=true;var b=document.getElementById(this.textbox.id+"_system");if(!(typeof b=="undefined"||b==null))if(!(b.disabled&&a))return b};UI_TextboxWidgetManager.prototype.disable=function(){this.current=false};UI_TextboxWidgetManager.prototype.enabled=function(){return this.current!=false};
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 j=document.createElement("div");j.className="ui_grid_column";j.style.width="50px";j.style.left=e+"px";e=document.createElement("div");e.className="ui_grid_column_enabled";j.appendChild(e);var h=document.createElement("div");
h.className="ui_grid_column_label";e.appendChild(h);h=document.createElement("div");h.className="ui_grid_column_icon";e.appendChild(h);f.insertBefore(j,g);return j}():b;b.onclick=function(){d.disabled()||d.gridHeader.columnClicked(d.index)};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_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_widgets("ui_richtextEditor",UI_RichtextEditor);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_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.frame2).addClass("hidden");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_widgets("ui_frame",UI_Frame);
UI_Frame.container=function(){var a=window.frameElement,b=window.parent;if(!(a==null||typeof b.UI_widgets!="function"))return UI_findWidget(function(c){return c.className()=="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()).addClass("hidden");$(this.loadingFrame).removeClass("hidden");this.visibleFrame().name=this.hiddenFrame().name;this.hiddenFrame().name="";this.hiddenFrame().contentWindow.location="about:blank";var a=this.contentWindow();try{typeof a!="undefined"&&typeof a.UI_widgets=="function"&&a.UI_widgets.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_widgets&&a.UI_widgets.recalculate()}catch(b){}};UI_Frame.prototype.containerElement=function(){return this.element};UI_Frame.prototype.visibleFrame=function(){return!$(this.frame1).hasClass("hidden")?this.frame1:this.frame2};UI_Frame.prototype.hiddenFrame=function(){return $(this.frame1).hasClass("hidden")?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.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_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_widgets("ui_chartimage",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_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 j=function(){var h=b.dateMutation().apply(),k=function(m,u){for(m=""+m;m.length<u;)m="0"+m;return m};if(isNaN(h.getFullYear()))g.parentNode.style.display="none";else{h=h.getFullYear()+"-"+k(h.getMonth()+1,2)+"-"+k(h.getDate(),2)+" "+k(h.getHours(),2)+
":"+k(h.getMinutes(),2)+":"+k(h.getSeconds(),2);g.parentNode.style.display="block";if(g.innerText!=undefined)g.innerText=h;else g.textContent=h}b.runCallbacks("valueChanged",{count:c.value,unit:d.value,operator:e.value,floor:f.value,value:b.dateMutation().systemNotation(),label:b.value()})};UI_registerHandler(c,"blur",function(){var h=parseInt(c.value,10);c.value=isNaN(h)?0:h;j()});UI_registerHandler(d,"change",j);UI_registerHandler(e,"change",j);UI_registerHandler(f,"change",j);a&&UI_registerHandler(a,
"click",function(){j();b.runCallbacks("buttonClicked")});j()}UI_widgets("ui_datemutation",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_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_widgets("ui_checkbox",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_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_widgets("ui_temp",UI_Temp);UI_Temp.prototype.containerElement=function(){return this.element};
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_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_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");c.attachToWidget(a,
"maxlength");c.attachToWidget(a,"minlength")});a.registerCallback("submitBlocked",function(c){var d=UI_widgets("tt").containerElement(),e=UI_findElement(function(h){return h.id=="ui_tt_title"},d),f=UI_findElement(function(h){return h.id=="ui_tt_description"},d),g=UI_findElement(function(h){return h.id=="ui_tt_link"},d),j=false;for(d=0;d<b.warnings.length;d++)if(b.warnings[d]==c.failedTest){j=true;break}d=function(h,k){var m=e.innerText!=undefined?"innerText":"textContent";e[m]=h;f[m]=k;g.style.display=
j?"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(j){j.func.call(this.widget,a,function(h,k){if(!h&&d==undefined)d=j.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,j=0,h=function(m){if(m=="ok"){g++;g>=f&&d(true,m)}else{j++;j==1&&d(false,m)}},k=0;k<e.length;k++)if(e[k]==
"")setTimeout(function(){h("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],h):setTimeout(function(){h("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 j=c.substr(g,1);if(j>="a"&&j<="z")d=true;else if(j>="A"&&j<="Z")e=true;else if(j>="0"&&j<="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="",j=0;j<f.errors.length;j++)g+=(j>0?"\n":"")+__tr("Line %line: %message",{line:f.errors[j].line,message:f.errors[j].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(h,k){e++;var m=h.check?h.check():undefined;if(m!=undefined)setTimeout(function(){k(h,m)});else if(!h.asyncCheck||!h.asyncCheck(function(u,t){k(h,u,t)}))setTimeout(function(){k(h,undefined)})},g=function(h,k,m){if(k==undefined)c++;else d++;d==1&&k!=undefined&&b(h,k,m);c==e&&b()},j=0;j<a.length;j++)f(a[j],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_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,m,u){if(!e){u();e=setInterval(u,200);m.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 j=a.tBodies[0].rows[g],h=0;h<j.cells.length;h++)UI_registerHandler(j.cells[h],"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_widgets("ui_calendar",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 j=f.cells[g];j.innerHTML="&nbsp;";j.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++;j=d.tBodies[0].rows[f].cells[g];j.innerHTML=e;j.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)))};
UI_widgets("ui_shadable",{options:{throbber:false,opacity:50,color:"black"},_create:function(){if(this._booleanParameter("throbber",false)){this.element.css({"background-image":"url("+PxFramework.resource.widgetURL("images","loader.gif")+")","background-position":"center","background-repeat":"no-repeat"});this._setParameter("opacity",60);this._setParameter("color","white")}this.element.css("background-color",this._parameter("color"));this.active=false},setOpacity:function(a){this._setParameter("opacity",
a)},shade:function(){if(!this.active){this.element.css({"z-index":600}).animate({opacity:this._parameter("opacity")/100},"slow","swing",function(){this.element.trigger("shaded",{opacity:this._parameter("opacity")})}.bind(this));this.active=true}},unshade:function(){if(this.active){this.element.animate({opacity:0},"slow","swing",function(){this.element.trigger("unShaded");this.element.css({"z-index":-10})}.bind(this));this.active=false}}});
function UI_Grid(a){this.id=a.id.substr(8);this.element=a;$(a).disableSelection();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_widgets("ui_grid",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};
UI_widgets("ui_icon",{options:{size:16,icon:"about"},_create:function(){this._applyTemplate("UI_Icon",{image:this._imageURL()});this.element.click(function(){this.element.trigger("clicked")}.bind(this))},_imageURL:function(){if(typeof this.options.path=="string")return this.options.path+this.options.icon;return PxFramework.resource.iconURL(this.options.icon,this.options.size)},hide:function(){this.element.fadeOut()},show:function(){this.element.fadeIn()},visible:function(){return this.element.is(":visible")},
size:function(){return this.options.size},icon:function(){return this.options.icon},setIcon:function(a,b){this.options.icon=a;this.options.size=b;this.element.css("background-image","url("+this._imageURL()+")");this.element.animate({height:b,width:b})}});
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");document.getElementById(b.id+"_hidden")&&b.loadTree();if(c){c.registerCallback("dropdownOpened",function(){b.loadTree()});b.registerCallback("opened",function(){c.checkDropdown()});c.containerElement().form!=null&&c.containerElement().form.ui_fields.push(b)}})}
UI_widgets("ui_selectdatabase",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);var j=UI_widgets(b.id+"_textbox");j&&j.checkDropdown();if(a.type&&a.id&&j)for(var h in b.objects)if(b.objects[h].id==b.selected){j.setValue(b.objects[h].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 j=g.treenode;if(j.id.match(/^view:\d+$/))if(!j.collectionsLoaded){j.collectionsLoaded=true;setTimeout(function(){var h=f(j),k=[];for(var m in h.nodes)m.match(/collection:\d+$/)&&
k.push(h.nodes[m]);for(h=0;h<k.length;h++){m=k[h];var u=b.getObject(j.id),t=b.getObject(m.id),y="view:"+u.view+":collection:"+t.collection,C=j.addNode(y,m.contentElement().innerHTML.replace(new RegExp(m.id,"g"),y));b.objects[y]={id:y,collection:t.collection,view:u.view,parent:j.id,active:t.active,name:t.name,title:t.title,value:u.value+":"+t.name,icon:t.icon,open:false};for(y in m.nodes){u=m.nodes[y];t=b.getObject(C.id);var D=b.getObject(u.id),r=b.getObject(C.parentNode().id),l="view:"+r.id+":miniview:"+
D.id;C.addNode(l,u.contentElement().innerHTML.replace(new RegExp(u.id,"g"),l));b.objects[l]={id:l,miniview:D.miniview,view:r.view,parent:C.id,active:true,name:D.name,title:D.title,value:t.value+"."+D.name,icon:D.icon}}}})}})}}};
function UI_Tabs(a){this.id=a.id.substr(8);this.element=a;this.tabs=[];this.notifyTimeout=0;$(a).mousewheel(function(d,e){if(!$(d.target).closest(".ui_tab_content").closest($(a)).length){e*=-1;if(!(this.openTab.key+e==-1||this.openTab.key+e==this.tabs.length-1)){this.show(this.openTab.key+e,true);d.preventDefault()}}}.bind(this));for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];c.className=="ui_tab"&&this.tabs.push(new UI_Tab(this,this.tabs.length,c));if(c.className=="ui_tab_active")this.activeElement=
c}this.openTab=false;setTimeout(function(){var d=UI_widgets("flyout_"+this.id);d.registerCallback("opened",function(){this.runCallbacks("flyoutOpened")}.bind(this));d.registerCallback("closed",function(){this.runCallbacks("flyoutClosed")}.bind(this));for(var e=0;e<this.tabs.length-1;e++)this.tabs[e].installHandlers();this.flyoutTab().element.onmouseover=function(){d.open()};this.flyoutTab().element.onmouseout=function(){d.close()}}.bind(this))}UI_widgets("ui_tabs",UI_Tabs);
UI_Tabs.findTab=function(a){if(a instanceof UI_Base)a=a.containerElement();a instanceof jQuery||(a=$(a));a=a.closest(".ui_tab_content");if(a.length==1){a=/^ui_tabcontent_(.*)_(\d+)$/.exec(a.attr("id"));return UI_widgets(a[1]).tab(a[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("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,b){if(typeof b!="boolean")b=false;if(typeof a=="object"){var c=this.findTab(a);c&&c.show(b)}else{var d=this.openTab;c=this.tabs[a];if(c!==undefined){window.clearTimeout(this.notifyTimeout);if(c.visible()){this.activeElement.style.left=Math.max(0,c.left()-2)+"px";this.activeElement.style.width=Math.max(1,c.width()-6)+"px";this.activeElement.innerHTML=c.element.innerHTML;this.activeElement.onmouseover=null;this.activeElement.onmouseout=
null}else{var e=this.flyoutTab();this.activeElement.style.left=Math.max(1,e.left()-2)+"px";this.activeElement.style.width=Math.max(1,e.width()-6)+"px";this.activeElement.innerHTML=e.element.innerHTML;var f=UI_widgets("flyout_"+this.id);this.activeElement.onmouseover=function(){f.open()};this.activeElement.onmouseout=function(){f.close()}}this.notifyTimeout=window.setTimeout(function(){for(var g=0;g<this.children.length;g++){var j=this.children[g],h=this.findTab(j);typeof h=="undefined"||h!=this.openTab||
(typeof j.recalculate=="function"?j.recalculate():j.notifyChildren("recalculate"))}this.runCallbacks("shown",{current:a,last:d})}.bind(this),b?500:0);if(d){if(d==c)return;d.contentDiv(true).removeClass("active")}c.contentDiv(true).addClass("active");this.openTab=c;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_widgets("ui_tab",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.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(a){this.parent.show(this.key,a);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_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("ui_warningcontainer",UI_WarningContainer);
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,j=f.containerElement(true).outerHeight();if(g!=j){this.warnings[e].height=j;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_widgets.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_widgets.recalculate()}.bind(this))}.bind(this));else{if(b!=d){this.element.style.height=d+"px";UI_widgets.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_widgets.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_widgets.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")}};
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_widgets("ui_editfield",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":c||a.addPredefinedTest("email",c);a.setDisplayType("text");break;case "phone":case "phone_fax":case "phone_gsm":c||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+"_tb");var d=UI_widgets(this.id+"_sb");a.addRegexTest(callback,b,c);d.addRegexTest(callback,b,c)};UI_EditField.prototype.addCustomTest=function(a,b,c){var d=UI_widgets(this.id+"_tb"),e=UI_widgets(this.id+"_sb");d.addCustomTest(a,b,c);e.addCustomTest(a,b,c)};
UI_EditField.prototype.addAsyncTest=function(a,b){var c=UI_widgets(this.id+"_tb"),d=UI_widgets(this.id+"_sb");c.addAsyncTest(a,b);d.addAsyncTest(a,b)};UI_EditField.prototype.addPredefinedTest=function(a){var b=UI_widgets(this.id+"_tb"),c=UI_widgets(this.id+"_sb");b.addPredefinedTest(a);c.addPredefinedTest(a)};UI_EditField.prototype.removeRegExTest=function(a){var b=UI_widgets(this.id+"_tb"),c=UI_widgets(this.id+"_sb");b.removeRegExTest(a);c.removeRegExTest(a)};
UI_EditField.prototype.removeCustomTest=function(a){var b=UI_widgets(this.id+"_tb"),c=UI_widgets(this.id+"_sb");b.removeCustomTest(a);c.removeCustomTest(a)};UI_EditField.prototype.removeAsyncTest=function(a){var b=UI_widgets(this.id+"_tb"),c=UI_widgets(this.id+"_sb");b.removeAsyncTest(a);c.removeAsyncTest(a)};UI_EditField.prototype.removePredefinedTest=function(a){var b=UI_widgets(this.id+"_tb"),c=UI_widgets(self.id+"_sb");b.removePredefinedTest(a);c.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+"_tb"),c=UI_widgets(this.id+"_sb");b.ignoreTest(a);c.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(j){g(j.length==0,j)})};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_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_widgets("ui_button",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(PxFramework.resource.iconURL(a))};
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_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_widgets("ui_pie",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_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);var j=UI_widgets(c.id+"_textbox");if(j){g.registerCallback("opened",
function(){j.checkDropdown()});setTimeout(function(){j.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_widgets("ui_selectdocument",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_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);document.getElementById(a.id+"_system").setValue(event.value)})}
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){this.runCallbacks("valueChanged",{event:d,value:a.value});this.isDirty=false}.bind(this);$(a).change(c);$(a).keyup(c);$(a).focus(function(d){this.runCallbacks("gotFocus",d)}.bind(this));$(a).blur(function(d){this.runCallbacks("lostFocus",d)}.bind(this));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=function(h,k){h.registerCallback("clicked",function(){e.setValue(b.values[k]);if(d)d.value=b.keys[k];e.closeDropdown();b.runCallbacks("valueChanged",{value:b.keys[k]})})},g=0;;g++){var j=UI_widgets("ui_select_"+b.id+"_"+g);if(!j)break;f(j,g)}b.errorChecker=e.errorChecker})}}UI_widgets("ui_select",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_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].className()=="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_widgets("ui_editinline",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,j,h){c.setMode("error");g.runCallbacks("submitBlocked",{id:g.id,value:g.value(),failedTest:j,ignore:function(){c.setMode("edit");g.ignoreTest(j);c.save()},message:h})};UI_ErrorChecker.checkWidgets(a,
function(g,j,h){g==undefined?c.runCallbacks("editFinished",d):e(g,j,h)});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=[];typeof 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_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_widgets("ui_roller",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"};$.template("UI_Dropdown",'<div class="ui_dropdown" style="${width}px" id="${id}">\n    <div class="ui_dropdown_icon"></div>\n    <div class="ui_dropdown_label">{{if label}}${label}{{else}}${value}{{/if}}</div>\n    <input type="hidden" name="{{if name}}${name}{{else}}${id}{{/if}}" value="${value}">\n    <div class="ui_dropdown_flyout" style="max-height: ${height}px; width: ${width}px;">{{html content}}</div>\n</div>\n');
$.template("UI_Conditional",'<div class="ui_conditional" id="${id}"{{if style}} style="${style}"{{/if}}>\n    {{html content}}\n</div>\n');$.template("UI_Icon",'<div\n    class="ui_icon"\n    style="\n        width: ${size}px;\n        height: ${size}px;\n        background-image: url(${image});\n        ${style};\n    "\n    title="${title}"\n></div>\n');
var UI_language = "en_US";
