/* 
Copyright (c) 2009 Reinier Zevenhuijzen, Netherlands
http://www.framework-z.com

This file is available under the terms of the  MIT Licence: 
http://www.ibiblio.org/pub/Linux/LICENSES/mit.license
*/

function $elm(a,b){if(typeof a==='object')return a instanceof Z?a.elm:a;var c=document.getElementById(a);if(b&&!c)throw new Error("Element with id '"+a+"' isn't found.");return c;}
$=$elm;function $style(a){return $(a,true).style;}
function $computedStyle(a,b){var c=$(a,true);return 'currentStyle' in c?c.currentStyle[b]:window.getComputedStyle(c,null)[b];}
function $show(a){var b=$(a,true);b.style.display=$show.blocks[b.tagName]?'block':'inline';}
$show.blocks={'DIV':1,'TABLE':1,'P':1,'TD':1,'TR':1,'BODY':1};function $hide(a){$style(a,true).display='none';}
function $display(a,b){(b?$show:$hide)(a);}
function $shown(a,b){var c=$(a,true);var d=!(c.style.display==='none'||(!c.style.display&&$computedStyle(c,'display')==='none'));	if(d&&b&&c.parentNode&&c.parentNode.nodeType==1)return $shown(c.parentNode,b);return d;}
function $undef(a){return typeof a==='undefined';}
function $def(a){return!$undef(a);}
function $null(a){return a===null||$undef(a);}
function $notnull(a){return!$null(a);}
function $ifnull(a,b){return $null(a)?b:a}
function $ifnot(a,b){return a?a:b;}
function $toStr(a,b){return $null(a)?$ifnot(b,''):(a+'');}
$str=$toStr;function $toHtml(a,b){a=$str(a).htmlEncode();if(b)a=a.replace(/\n/g,'<br />');return a;}
$html=$toHtml;function $toAttr(a){return $str(a).attributeEncode();}
$attr=$toAttr;function $generateID(){return '_z_generatedID_'+$generateID.c++;}
$generateID.c=0;function $pos(a,b){return a>=0?a:b;}
function $createNamespace(a){if(typeof a==='object')return a;var b=a.split('.');var c=window;for(var d=0;d<b.length;d++){var e=b[d];c=e in c?c[e]:(c[e]={});}
return c;}
function $namespace(a,b){var c=Array.prototype.slice.call(arguments,0);var b=arguments[arguments.length-1];if(typeof b==='function')c.pop();for(var d=0;d<c.length;d++){c[d]=$createNamespace(c[d]);}
if(typeof b==='function')b.apply(null,c);return c[0];}
function $event(a){return a?a:window.event;}
function $target(a){a=$event(a);return $ifnot(a.target,a.srcElement);}
function $ztarget(a){var b=$target(a);return b?Z(b):null;}
function $handle(a,b,c,d){if(d)c=c.bind(d);if(b instanceof Array){$foreacha(b,function(f){$handle(a,f,c)});return c;}
a=$(a);if(a.attachEvent)a.attachEvent('on'+b,c);else a.addEventListener(b,c,false);return c;}
function $dehandle(a,b,c){if(b instanceof Array){$foreacha(b,function(e){$dehandle(a,e,c)});return c;}
a=$(a);if(a.detachEvent)a.detachEvent('on'+b,c);else a.removeEventListener(b,c,false);return c;}
function $foreach(a,b,c){if(a instanceof Array)return $foreacha(a,b,c);for(var d in a){var e=b.call(c,a[d],d,a);if($notnull(e))return e};return null;}
function $foreacha(a,b,c){for(var d=0;d<a.length;d++){var e=b.call(c,a[d],d,a);if($notnull(e))return e};return null;}
function $where(a,b,c){var d=a instanceof Array?[]:{};for(var e in a)if(b.call(c,a[e],e,a))d[e]=a[e];return d;}
function $wherea(a,b,c){var d=[];for(var e=0;e<a.length;e++)if(e in a&&b.call(c,a[e],e,a))d.push(a[e]);return d;}
function $select(a,b,c,d){var e=a instanceof Array?[]:{};for(var f in array){var a=c.call(d,array[f],f,array);if(!b||$notnull(a))e.push(a);}
return e;}
function $selecta(a,b,c,d){var e=[];for(var f=0;f<a.length;f++){if(f in a){var g=c.call(d,a[f],f,a);if(!b||$notnull(g))e.push(g);}}
return e;}
function $clone(a,b){var c=a instanceof Array,d=c?[]:{};if(c)for(var e=0;e<a.length;e++)d[e]=b?$clone(a[e],true):a[e];else for(var e in a)d[e]=b?$clone(a[e],true):a[e];return d;}
$addTo=function(a,b){for(var c in b)a[c]=b[c];}
function $base(a,b,c){var d=Array.prototype.slice.call(arguments,3);var e=b.callee,f=c;var g=e.prototype,h=f.prototype;f.apply(a,d);var i={};for(var j in a)if(typeof a[j]==='function'&&a.hasOwnProperty(j))i[j]=a[j];for(var j in i)a[$basefuncID(j,e)]=i[j];if(g.__$baseConstr)return a;g.__$baseConstr=c;for(var j in h) {if(!h.hasOwnProperty(j)||typeof h[j]!=='function')continue;if(!g[j])g[j]=h[j];g[$basefuncID(j,e)]=h[j];}
return a;}
function $baseID(a){return!a.$baseID?a.$baseID=++$baseID.c:a.$baseID;}
$baseID.c=0;function $basefuncID(a,b){return '__$base_'+$baseID(b)+'_'+a;}
function $basefunc(a,b,c){var d=Array.prototype.slice.call(arguments,3);return a[$basefuncID(b,c)].apply(a,d);}
function $basefuncWithArgs(a,b,c,d){return a[$basefuncID(b,c)].apply(a,d);}
function $interface(a,b){var c=a.callee.prototype;if(c.__$interfaceConstrs)return;var d=Array.prototype.slice.call(arguments,1);c.__$interfaceConstrs=d;}
function $extends(a,b){for(var c=a.__$baseConstr;c;c=c.prototype.__$baseConstr)if(c==b)return true;return false;}
function $instanceof(a,b){if(a instanceof b||a.constructor==b)return true;return $extends(a,b);}
function $is(a,b){return $extends(a,b)||$implements(a,b);}
function $implements(a,b,c){if(c)return $checkInterface(a,b);if(typeof a!=='object'&&typeof a!=='function')return false;var d=a.__$interfaceConstrs;if(d&&Array.contains(d,b))return true;if(a.__$baseConstr)return $implements(a.__$baseConstr.prototype,b);return false;}
function $checkInterface(a,b,c){var d=b.__$staticInstance;if(!d){d=new b();b.__$staticInstance=d;}
if(!c)c=[];for(var e in d){var f=a[e],g=d[e];if(typeof f!==typeof g)c.push(e);else if(typeof f==='object' &&!$instanceof(f,g.constructor))c.push(e);}
return c.length==0;}
$console=new function(){var a=window.console,b,c;var d=this;d.debug=d.log=function(h){f(h,'debug');}
d.warn=function(h){f(h,'warn');}
d.error=function(h){f(h,'error');}
function f(h,i){if(a){if('log' in a&&!('debug' in a))a.log(h);else a[i](h);}
else if(b){g();c.append(Z.create('div').text(h).addClass(i));}}
d.clear=function(){c.remove();c=null;}
function g(){if(c)return;c=Z.create('div').addClass('z_console');Z(document.body).append(c,true);c.html('<div><b>Javascript console</b> <a href="" onclick="$console.clear();return false;">clear</a></div>');ZUtil.addCss('.z_console { background:white;color:black; border:1px solid red; padding:2px; } .z_console .warn { color:orange } .z_console .error { color:red }');}
d.enable=function(h){b=h;}}();Function.prototype.bind=function(a){var b=this;return function(){b.apply(a,arguments);}}
$addTo(String.prototype,{contains:function(a){return this.indexOf(a)>=0;},lastIndexOf:function(a,b){if($undef(b))b=this.length-1;for(var c=b;c>=0;c--)if(this.substr(c,a.length)==a)return c;return-1;},startsWith:function(a){return this.slice(0,Math.min(a.length,this.length))===a.toString();},endsWith:function(a){return this.slice(this.length-Math.min(a.length,this.length))===a.toString();},trim:function(){return this.replace(/^\s+/,'').replace(/\s+$/,'');},splitKeyValue:function(a){var b=this.indexOf(a);if(b<0)return{key:this,value:''};return{key:this.slice(0,b),value:this.slice(b+1)};},htmlEncode:function(){return this.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');},htmlDecode:function(){return this.replace(/&lt;/g,'<').replace(/&gt;/g,'>').replace(/&amp;/g,'&');},extractTextFromHtml:function(){var a=document.createElement('div');a.innerHTML=this;return Z(a).text();},attributeEncode:function(a){return this.htmlEncode().replace(a?"'":'"',a?'&#39;':'&quot;');}});$addTo(Array,{indexOf:function(a,b){for(var c=0;c<a.length;c++)if(a[c]===b)return c;return-1;},contains:function(a,b){return Array.indexOf(a,b)>=0;},remove:function(a,b){var c=Array.indexOf(a,b);if(c<0)return false;a.splice(c,1);return true;}});function Z(a){if(this==window){var b=$(a,true);return b.z?b.z:new Z(b);}
this.elm=this.$=a;a.z=this;this.props={};}
Z.zify=function(a,b){var c=a instanceof Array||b;var d=c?[]:{};if(c)for(var e=0;e<a.length;e++)d[e]=Z(a[e]);else for(var e in a)d[e]=Z(a[e]);return d;}
Z.create=function(a,b){var c=document.createElement(a);if($def(b))c.id=b;return Z(c);}
Z.prototype={_:1,handle:function(a,b){$handle(this.elm,a,b);return this;},dehandle:function(a,b){$dehandle(this.elm,a,b);return this;},onClick:function(a,b){var c=this;return this.handle('click', function(e){var f;if(!b&&(c.tag()=='A'||(c.tag()=='INPUT'&&c.attribute('type')=='submit'))){f=ZUtil.preventDefault(e);}
a.apply(null,arguments);return f;});},onContextmenu:function(a,b){var c=this;return this.handle('contextmenu', function(e){a.apply(null,arguments);if(!b)return ZUtil.preventDefault(e);});},onBlur:function(a){return this.handle('blur',a)},onFocus:function(a){return this.handle('focus',a)},onChange:function(a){return this.handle('change',a)},onKeyup:function(a){return this.handle('keyup',a)},onKeydown:function(a){return this.handle('keydown',a)},onKeypress:function(a){return this.handle('keypress',a)},onMouseover:function(a){return this.handle('mouseover',a)},onMouseout:function(a){return this.handle('mouseout',a)},onMousemove:function(a){return this.handle('mousemove',a)},onMousedown:function(a){return this.handle('mousedown',a)},onMouseup:function(a){return this.handle('mouseup',a)},html:function(a,b){if($undef(a))return this.elm.innerHTML;if(!b)this.elm.innerHTML=a;else this.elm.innerHTML+=a;return this;},text:function(a,b){var c='innerText' in this.elm?'innerText':'textContent';if($undef(a))return this.elm[c];if(b)this.elm[c]+=a;else this.elm[c]=a;return this;},value:function(a){if($undef(a))return this.elm.value;this.elm.value=a;return this;},style:function(a,b){if(a==='opacity'&&this.elm.currentStyle){if($undef(b)){var c=this.elm.style.filter;if(c.startsWith('alpha(opacity='))return c.slice(14,c.length-1)/100;return 1;}
this.elm.style.filter='alpha(opacity='+(b*100)+')';this.elm.style.zoom=1;return this;}
if($undef(b))return this.elm.style[a];else this.elm.style[a]=b;return this;},styles:function(a){for(var b in a)this.style(b,a[b]);return this;},computedStyle:function(a){return $computedStyle(this,a);},attribute:function(a,b){if($undef(b))return this.elm.getAttribute(a);this.elm.setAttribute(a,b);return this;},classes:function(){return this.elm.className.split(/\s+/);},addClass:function(a,b){if(!$null(b)&&!b){this.removeClass(a);return this;}
var c=this.classes();if(Array.contains(c,a))return this;c.push(a);this.elm.className=c.join(' ');return this;},removeClass:function(a){var b=this.classes();var c=Array.indexOf(b,a);if(c<0)return this;b.splice(c,1);this.elm.className=b.join(' ');return this;},hasClass:function(a){return Array.contains(this.classes(),a);},parent:function(){var a=this.elm.parentNode;return a?Z(a):null;},children:function(){return Z.zify(this.elm.childNodes,true);},child:function(a){return Z(this.elm.childNodes[a]);},childCount:function(){return this.elm.childNodes.length;},clear:function(){this.html('');return this;},remove:function(){if(!this.elm.parentNode)return;this.elm.parentNode.removeChild(this.elm);return this;},moveTo:function(a){this.remove();$(a).appendChild(this.elm);return this;},append:function(a,b){if(b&&this.elm.firstChild){this.elm.insertBefore($(a),this.elm.firstChild);}
else this.elm.appendChild($(a));return this;},insertBefore:function(a){this.elm.parentNode.insertBefore($(a),this.elm);return this;},insertAfter:function(a){if(!this.elm.nextSibling)this.parent().append(a);else this.elm.parentNode.insertBefore($(a),this.elm.nextSibling)},clone:function(){var a=this.elm.cloneNode(true);a.z=null;a.id='';return Z(a);},contains:function(a){a=$(a);while(a){if(a==this.$)return true;a=a.parentNode;}
return false;},containsEvent:function(a){return this.contains($target(a));},tag:function(){return this.elm.tagName;},show:function(){$show(this);return this;},hide:function(){$hide(this);return this;},display:function(a){$display(this,a);return this;},shown:function(a){return $shown(this,a);},position:function(a){return ZUtil.position(this.elm,a);},dimension:function(){return ZUtil.dimension(this.elm);},property:function(a,b){if($undef(b))return this.properties?this.properties[a]:null;if(!this.properties)this.properties={};this.properties[a]=b;},getById:function(a,b){var c=this.getTemplateRoot();if(!c)return(!b&&!$(a))?null:Z(a);var d=c['_'+a];if(!d&&b)throw new Error("Z object with id '"+a+"' not found in applied template.");return d;},getId:function(){return this.attribute('_id')||this.elm.id;},getTemplateRoot:function(){var a=this;while(a&&!a.template)a=a.parent();return a&&a.template?a:null;},getTemplatePrefix:function(){if(!this.template)throw new Error("This Z-object isn't a template root");if(!this.templatePrefix)this.templatePrefix=$generateID()+'_';return this.templatePrefix;},getTemplate:function(){var a=this.getTemplateRoot();return a?a.template:null;}}
ZConfig=new function(){var a=this;var b='';a.setServer=function(m){b=m;}
a.getServer=function(){return b;}
a.isServer=function(m){return b==m;}
a.isLocalServer=function(){return a.isServer('local');}
a.isDevelopmentServer=function(){return a.isServer('development');}
a.isStagingServer=function(){return a.isServer('staging');}
a.isTestServer=function(){return a.isServer('test');}
a.isAcceptanceServer=function(){return a.isServer('acceptance');}
a.isProductionServer=function(){return a.isServer('production');}
var d={};a.setSetting=function(m,n){d[m]=n;}
a.getSetting=function(m){return d[m];}
var e=[];a.addCookieDomainRule=function(m,n){e.push({regex:m,domain:n});}
a.getCookieDomain=function(m){for(var n=e.length-1;n>=0;n--){var o=e[n];if(o.regex.test(m))return o.domain;}
var p=location.host;return/\..*\./.test(p)?p:'';}
var f=[];a.addCookieSecureRule=function(m,n){f.push({regex:m,secure:n});}
a.getSecureCookieRule=function(m){for(var n=f.length-1;n>=0;n--){var o=f[n];if(o.regex.test(m))return o.doSecure;}
return false;}
var g=null;a.setImagesPath=function(m){g=m;}
var h={};a.mapImagePath=function(m,n){h[m]=n;}
a.getImagesPath=function(){return $ifnull(g,ZUtil.combinePaths(a.frameworkPath(),'images'));}
a.getImagePath=function(m){var m=$ifnot(h[m],m);if(ZUtil.isAbsolutePath(m))return m;return ZUtil.combinePaths(a.getImagesPath(),m);}
var i='Not all data was entered correctly. Please try to correct these items:';var j=null;var k='<div class="z_summary_icon" style="float:left;"><img src="{icon}" border="0" /></div> <div class="z_summary_header" >{header}</div> <div class="z_summary_list">{list}</div> <div class="z_summary_footer">{footer}</div> <div style="clear:both" />';var l='.z_summary { background:#fdd;border:1px solid #b00; padding:8px; width:300px; } .z_summary_header { float:left; width:265px; padding-left:10px; padding-bottom:12px; } .z_summary_list { clear:left; } .z_summary_list ul { padding-left:10px; margin-top:0px; margin-left:5px;  } ';a.getSummaryFormat=function(){return k;}
a.setSummaryFormat=function(m){k=m;}
a.getSummaryCss=function(){return l;}
a.setSummaryCss=function(m){l=m;}
a.getSummaryHeader=function(){return i;}
a.setSummaryHeader=function(m){i=m;}
a.getSummaryFooter=function(){return j;}
a.setSummaryFooter=function(m){j=m;}
a.frameworkPath=function(m){if(!$undef(m))Z._frameworkPath=m;if(!$undef(Z._frameworkPath))return Z._frameworkPath;var n=document.getElementsByTagName('script');for(var o in n){var p=n[o].src;if(!p)continue;var q=p.toLowerCase();var r=q.indexOf('/z.js');if(r<0&&q.startsWith('z.js'))r=0;if(r<0)r=q.indexOf('/zcore.js');if(r<0&&q.startsWith('zcore.js'))r=0;if(r<0)r=q.indexOf('/zfull.js');if(r<0&&q.startsWith('zfull.js'))r=0;if(r<0)r=q.indexOf('/ztiny.js');if(r<0&&q.startsWith('ztiny.js'))r=0;if(r<0)continue;var m=p.slice(0,r);if(!ZUtil.isAbsolutePath(m)){m=document.location.pathname;var s=$pos(m.lastIndexOf('/'),m.length);m=location.protocol+'//'+location.host+m.slice(0,s);}
return Z._frameworkPath=m;}
alert("The path of Framework Z couldn't be found automaticly. Please set the path explicitly using ZConfig.frameworkPath(...)");}}();ZConfig.CultureInfo=function(){this.decimalPoint=',';this.digitGroupSeparator='.';this.digitGroupSize=3;this.shortDateOrder=ZConfig.CultureInfo.ShortDateOrder.DDMMYYYY;this.shortDateSeparator=ZConfig.CultureInfo.ShortDateSeparator.Dash;this.firstDay=0;this.lang={};$addTo(this.lang,{months:['January','February','March','April','May','June','July','August','September','October','November','December'],monthsShort:['Jan','Febr','Mar','Apr','May','June','July','Aug','Sept','Oct','Nov','Dec'],days:['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],daysShort:['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],today:'today',holdCtrToMoveDownAYearholdShiftToMoveDown10Years:'Hold [ctrl] to move down a year, hold [ctrl+shift] to move down 10 years.',holdCtrToMoveUpAYearholdShiftToMoveUp10Years:'Hold [ctrl] to move up a year, hold [ctrl+shift] to move up 10 years.'});this.create=function(b){var c=$clone(this);for(var d in b)c[d]=b[d];return c;}};ZConfig.CultureInfo.ShortDateOrder={DDMMYYYY:1,MMDDYYYY:2,YYYYMMDD:3};ZConfig.CultureInfo.ShortDateSeparator={Slash:'/',Dash:'-',Dot:'.'};ZConfig.CultureInfo.get=function(a){if(!a)return ZConfig.culture;if($instanceof(a,ZConfig.CultureInfo))return a;if(typeof a==='object'){return ZConfig.culture.create(a);}
return ZConfig.culture;}
ZConfig.culture=new ZConfig.CultureInfo();ZUtil={};$addTo(ZUtil,{position:function(a,b){var c=0,d=0;var a=$(a);var e=a;var f=a.style.position;if(!f||f==='static')a.style.position='relative';do{c+=a.offsetLeft;d+=a.offsetTop;a=a.offsetParent;}while(a!=null&&!b);e.style.position=f;return{x:c,y:d};},dimension:function(a){a=$(a);return{w:a.offsetWidth,h:a.offsetHeight};},containsPosition:function(a,b){var c=ZUtil.position(a);var d=ZUtil.dimension(a);return b.x>c.x &&b.x<c.x+d.w&&b.y>c.y&&b.y<c.y+d.h	;},combinePaths:function(a,b){if(a.endsWith('/'))a=a.slice(0,a.length-1);if(b.startsWith('/'))b=b.slice(1);return a+'/'+b;},isAbsolutePath:function(a){return a.startsWith('/')||a.startsWith('http://')||a.startsWith('https://');},key:function(a){a=$event(a);return 'which' in a?a.which:a.keyCode;},Keys:{Backspace:8,Tab:9,Enter:13,Shift:16,Ctrl:17,Alt:18,Esc:27,PageUp:33,PageDown:34,End:35,Home:36,Left:37,Up:38,Right:39,Down:40,Insert:45,Delete:46,Digit0:48,Digit1:49,Digit2:50,Digit3:51,Digit4:52,Digit5:53,Digit6:54,Digit7:55,Digit8:56,Digit9:57,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,WinLeft:91,WinRight:92,Select:93,Numpad0:96,Numpad1:97,Numpad2:98,Numpad3:99,Numpad4:100,Numpad5:101,Numpad6:102,Numpad7:103,Numpad8:104,Numpad9:105,Multiply:106,Add:107,Subtract:109,DecimalPoint:110,Divide:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,Semicolon:186,EqualSign:187,Comma:188,Dash:189,Period:190,ForwardSlash:191,GraveAccent:192,OpenBracket:219,BackSlash:220,CloseBracket:221,SingleQuot:222},isControlKey:function(a){var b=a;return!((b>=47&&b<=90)||(b>=96&&b<=123)||(b>=186&&b<=192)||(b>=220&&b<=222));},isRightClick:function(a){a=$event(a);return 'which' in a?a.which==3:a.button==2;}   ,toFullYear:function(a,b,c){var a=Math.round(a-0);if(a>=100||a<=-100)return a;var d=new Date().getFullYear();var e=Math.floor(d/100)*100;a+=e;if($null(b)){c=d-e;b=true;}
if($null(c)){c=b?d-e:0;}
if(b){if(a<d-c)a+=100;}
else{if(a>d+c)a-=100;}
return a;},getTextboxSelection:function(a){if(document.selection)return document.selection.createRange().text;if(a.setSelectionRange)return a.value.substring(a.selectionStart,a.selectionEnd);else return '';},preventDefault:function(a){a=$event(a);if(a.preventDefault)a.preventDefault();return false;},query:function(a,b){return ZUtil.queries(a,b)[0];},queries:function(a,b){if(!b)b=document.location.href;var c=b.indexOf('?');if(c<0)return [];var d=b.slice(c+1).split('&');var e=[];for(var f in d){var g=d[f];var h=g.indexOf('=');if(g.slice(0,h)==a)e.push(unescape(g.slice(h+1)));}
return e;},addQuery:function(a,b,c){if(!a)a=document.location.href;if(c instanceof Array)$foreacha(c,function(e){a=ZUtil.addQuery(a,b,e);});else{a+=a.indexOf('?')<0?'?':'&';a+=b+'='+$ifnot(window.encodeURIComponent,escape)(c);}
return a;},getCookie:function(a){var b=document.cookie.split(';');for(var c=0;c<b.length;c++){var d=b[c].split("=");if(d[0].trim()===a)return unescape(d[1]);}
return null;},setCookie:function(a,b,c,d,e,f,g){if($null(c)&&$null(d))d=20*60;if($null(d))d=0;if($null(c))c=0;if(!f)f=ZConfig.getCookieDomain(a);if($null(e))e=ZConfig.getSecureCookieRule(a);var h=(e===true||e==='always')||(e==='current'&&ZUtil.isSecure())?';secure':'';document.cookie=a+"="+b +";expires="+new Date(new Date().getTime()+(d*1000)+(c*24*60*60*1000)).toUTCString()+";path="+(!g?'/':g)+(!f?'':';domain='+f)+h;},deleteCookie:function(a){ZUtil.setCookie(a,'',-1,0);},isSecure:function(){return location.protocol=='https:';},addCss:function(a,b){var c=document.createElement('style');c.type='text/css';if(c.styleSheet)c.styleSheet.cssText=a;else c.appendChild(document.createTextNode(a));Z(document.getElementsByTagName('head')[0]).append(c,b);},formToObject:function(a,b){a=$(a);var c={};$foreacha(a.elements,function(e){var f=$str(e.tagName).toLowerCase();var g=$str(e.type).toLowerCase();var h=$ifnot(e.name,e.id);if(!h)return;if(f==='input'&&g==='radio'){if(e.checked)c[h]=e.value;}
else if(f==='input'&&g==='checkbox'){if(e.checked)c[h]='on';}
else if(f==='select'&&e.multiple){c[h]=$selecta(e.options,true,function(k){return k.selected?$ifnull(k.value,k.text):null;});}
else if(f==='select'){var j=e.selectedIndex<0?null:e.options[e.selectedIndex].value;c[h]=b?(e.selectedIndex<0?[]:[j]):j;}
else if(f==='input'&&(g==='submit'||g==='button')){}
else c[h]=e.value;});return c;},bodyDimension:function(a,b){b=b||window;var c=b.document.body;var d=b.document.documentElement;var e='clientWidth' in c?{w:c.clientWidth,h:c.clientHeight}:'clientWidth' in d?{w:d.clientWidth,h:d.clientHeight}:{w:b.innerWidth,h:b.innerHeight};if(a){var f=ZUtil.scrollDimension();return{h:Math.max(e.h,f.h),w:Math.max(e.w,f.w)};}
return e;},scrollDimension:function(a){a=a||window;var b=a.document.body;var c=a.document.documentElement;return 'innerWidth' in a?{w:a.innerWidth,h:a.innerHeight}:'clientWidth' in c?{w:c.clientWidth,h:c.clientHeight}:{w:b.clientWidth,h:b.clientHeight};},scrollPosition:function(a){a=a||window;var b=a.document.body;var c=a.document.documentElement;return 'pageXOffset' in a?{x:a.pageXOffset,y:a.pageYOffset}:{x:Math.max(b.scrollLeft,c.scrollLeft),y:Math.max(b.scrollTop,c.scrollTop)};},isIE6:function(){return/msie|MSIE 6/.test(navigator.userAgent);},isIE7:function(){return/msie|MSIE 7/.test(navigator.userAgent);}});$addTo(Date.prototype,{isBefore:function(a,b){var c=this,d=a;if(b){c=c.clone();c.truncate();d=d.clone();d.truncate();}
return c.getTime()<d.getTime();},isAfter:function(a,b){var c=this,d=a;if(b){c=c.clone();c.truncate();d=d.clone();d.truncate();}
return c.getTime()>d.getTime();},isSameDay:function(a){return this.getDate()==a.getDate()&&this.getMonth()==a.getMonth()&&this.getFullYear()==a.getFullYear();},isToday:function(){return this.isSameDay(new Date());},addYears:function(a){this.setFullYear(this.getFullYear()+a);return this;},addMonths:function(a){this.setMonth(this.getMonth()+a);return this;},addDays:function(a){this.addMilliseconds(a*1000*60*60*24);return this;},addHours:function(a){this.addMilliseconds(a*1000*60*60);return this;},addMinutes:function(a){this.addMilliseconds(a*1000*60);return this;},addMilliseconds:function(a){this.setTime(this.getTime()+a);return this;},truncate:function(){this.setHours(0);this.setMinutes(0);this.setMilliseconds(0);return this;},clone:function(){return new Date(this.getTime());},subtract:function(a){return new ZDateDifference(this,a);},format:function(a,b){b=b||ZConfig.culture;var c=b.lang;return a.replace(/\{/g,'{{').replace(/\}/g,'}}').replace(/DD/g,'{2}').replace(/D/g,'{3}').replace(/dd/g,this.getDate().format('D2')).replace(/d/g,this.getDate()).replace(/MMMM/g,'{0}').replace(/MMM/g,'{1}').replace(/MM/g,(1+this.getMonth()).format('D2')).replace(/M/g,(1+this.getMonth())).replace(/yyyy/g,this.getFullYear()).replace(/yy/g,(this.getFullYear()+'').slice(2)).replace(/mmmm/g,this.getMilliseconds().format('D4')).replace(/mm/g,this.getMinutes().format('D2')).replace(/ss/g,this.getSeconds().format('D2')).replace(/s/g,this.getSeconds()).replace(/hh/g,this.getHours().format('D2')).replace(/h/g,this.getHours()).format(c.months[this.getMonth()],c.monthsShort[this.getMonth()],b.lang.days[this.getDay()],b.lang.daysShort[this.getDay()]);}});Date.isValid=function(a,b,c){var d=new Date(a,b,c);return d.getFullYear()==a&&d.getMonth()==b&&d.getDate()==c;}
function ZDateDifference(a,b){this.date1=a;this.date2=b;}
$addTo(ZDateDifference.prototype,{round:function(a){return a>=0?Math.floor(a):Math.ceil(a)},totalMilliseconds:function(){return(this.date1.getTime()-(this.date1.getTimezoneOffset()*60*1000))-(this.date2.getTime()-(this.date2.getTimezoneOffset()*60*1000));},totalSeconds:function(){return this.totalMilliseconds()/(1000)},totalMinutes:function(){return this.totalMilliseconds()/(1000*60)},totalHours:function(){return this.totalMilliseconds()/(1000*60*60)},totalMonths:function(){return 12 *(this.date1.getFullYear()-this.date2.getFullYear())-(this.date2.getMonth()-this.date1.getMonth())-((this.date2.getDate()-this.date1.getDate())/31);},totalDays:function(){return this.totalMilliseconds()/(1000*60*60*24);},totalYears:function(){return this.totalMilliseconds()/(1000*60*60*24*365);},years:function(){return this.round(this.totalMilliseconds()/(1000*60*60*24*365));},months:function(){return this.round(this.totalMonths());},days:function(){return this.round(this.totalDays());},hours:function(){return this.round(this.totalHours()-(this.days()*24));},minutes:function(){return this.round(this.totalMinutes()-(this.days()*24*60)-(this.hours()*60));}});$addTo(String.prototype,{toNumber:function(a){a=ZConfig.CultureInfo.get(a);var b=this;b=b.replace(new RegExp('\\'+a.digitGroupSeparator,'g'),"");b=b.replace(new RegExp('\\'+a.decimalPoint),'.');return b-0;},pad:function(a,b){if(!b)b='0';var c=this;while(c.length<a)c=b+c;return c;},namedFormat:function(a){var b=this;for(var c in a){var d=$str(a[c]).replace(/\{/g,'{{').replace(/\}/g,'}}');var e=0;while((e=b.indexOf('{'+c+'}',e))>=0){if(e==0||b.charAt(e-1)!=='{'){b=b.slice(0,e)+d+b.slice(e+c.length+2);e+=d.length;}
else e+=c.length+2;}}
b=b.replace(/\{\{/g,'{');b=b.replace(/\}\}/g,'}');return b;},format:function(){for(var a=0,b={};a<arguments.length;a++)b[a]=arguments[a];return this.namedFormat(b);},capitalize:function(){var a=true,b=this;for(var c=0;c<b.length;c++){var d=b.charAt(c);if(a)b=b.slice(0,c)+d.toUpperCase()+b.slice(c+1);a=d==' '||d=='\t'||d=='\n'||d=='\f'||d=='\r';}
return b;}});Number.prototype.format=function(a,b){b=ZConfig.CultureInfo.get(b);var c=a.charAt(0);var d=c.toLowerCase();var e=a.slice(1)-0;if(a.length==1)e='a'-0;	var f=this;function g(o){return o.replace(/\./g,b.decimalPoint);}
if(d==='d')return f.toFixed(0).pad(isNaN(e)?0:e);if(d==='f')return g(f.toFixed(isNaN(e)?3:e));if(d==='g')return g(isNaN(e)?f.toString():f.toPrecision(e));if(d==='e')return g(f.toExponential(e>0?e:6));if(d==='n'){var h=f.toFixed(isNaN(e)?2:e);var i=e>0?h.slice(0,h.indexOf('.')):h;var j=e>0?h.slice(i.length+1):'';for(var k='',l=i.length-1,m=0;l>=0;l--,m++){if((m%b.digitGroupSize)==0&&m>0)k=b.digitGroupSeparator+k;k=i.charAt(l)+k;}
for(var n='',l=0,m=0;l<j.length;l++,m++){if((m%b.digitGroupSize)==0&&m>0)n=n+b.digitGroupSeparator;n=n+j.charAt(l);}
return k+(e>0?(b.decimalPoint+n):'');}
if(d==='y'){return ZUtil.toFullYear(this,c==='Y',isNaN(e)?null:e).toString();}}
ZUtil.addCss('.z_hidden { display:none; }');function ZEvent(a,b){this.handlers={};	this.host=a;this.parent=null;if(b)this.registerEvents(b);}
ZEvent.register=function(a,b){if(a.events instanceof ZEvent){a.events.registerEvents(b);return;}
a.events=new ZEvent(a,b);a.addEventListener=a.events.add.bind(a.events);a.removeEventListener=a.events.remove.bind(a.events);}
ZEvent.prototype={_:1,registerEvents:function(a){var b=this.host;$foreach(a,function(d){b['on'+d.charAt(0).toUpperCase()+d.slice(1)]=function(f){return $handle(b,d,f);};});},add:function(a,b){a=a.toLowerCase();if(this._find(a,b)>=0)return false;if(!this.handlers[a])this.handlers[a]=[b];else{this.handlers[a]=$clone(this.handlers[a]);this.handlers[a].push(b);}
return true;},remove:function(a,b){a=a.toLowerCase();var c=this._find(a,b);if(c!=-1){this.handlers[a]=$clone(this.handlers[a]);this.handlers[a].splice(c,1);}
return c!=-1;},_find:function(a,b){a=a.toLowerCase();var c=this.handlers[a];return!c?-1:Array.indexOf(c,b);},fire:function(a,b){a=a.toLowerCase();var c=this.handlers[a];if(!c)return;if(!b)b={};if(!b.type)b.type=a;if(!b.target)b.target=this.host;var d=false;b.cancelBubble=function(){d=true;}
for(var f in c)c[f].call(this.host,b);if(this.parent&&!d)this.parent.events.fire(a,b);}}
Function.prototype.ensureLoaded=function(a){var b=this;return function(){var d=Array.prototype.slice.call(arguments);var e=this;a.load(function(){b.apply(e,d);});}}
ZLoader=function(a,b,c,d){if(this==window){e.notify();return;}
var e=this;e.baseUrl=$str(a,'');e.htmlElms=[];var f=false,g=false;var h=[],i=[];var j=0;ZEvent.register(e,['finish','start','finishOne']);function k(){$foreach(b,function(n){e.addScript(n);});$foreach(c,function(n){e.addHtml(n);});$foreach(d,function(n){e.addCss(n);});e.addFunction(function(n){n.notify();});}
e.addFunction=function(m,n){j++;if(n||g||f)m(e);	
else h.push(m);}
e.addLoader=function(m,n){e.addFunction(function(p){m.load(p.notify);},n);}
e.addCss=function(m,n){e.addFunction(function(){ZTransport.get(e.resolve(m),'css',function(){e.notify({url:m});});},n);}
e.addScript=function(m,n){e.addFunction(function(){ZTransport.get(e.resolve(m),'eval',function(){e.notify({url:m});});},n);}
e.addHtml=function(m,n,o,p){var q=document.createElement('div');e.htmlElms.push(q);$display(q,p);if(!o)document.body.appendChild(q);else Z(o).append(q);e.addFunction(function(){ZTransport.get(e.resolve(m),'text',function(t){q.innerHTML=t;e.notify({url:m});});},n);return q;}
e.hookUpEvent=function(m,n){j++;$handle(m,n,function(){e.notify();});}
e.hookedUpSomething=function(){j++;}
e.setPreload=function(m){if(!m)m=10000+Math.floor(Math.random()* 10000);var n=setInterval(function(){if(!ZTransport.requestCount){clearInterval(n);e.load();}},m);return e;}
e.resolve=function(m){if(m.startsWith('/')||m.startsWith('http://')||m.startsWith('https://'))return m;var n=e.baseUrl;if(n&&!n.endsWith('/'))n+='/';return n+m;}
e.load=function(m){if(f){if(m)m();return;}
if(m)i.push(m);if(g)return;g=true;e.events.fire('start');$foreach(h,function(o){o(e);});}
e.notify=function(m){e.events.fire('finishOne',m);if(!--j)e.notifyFullyLoaded();}
e.isLoaded=function(){return f;}
e.isLoading=function(){return g;}
e.notifyFullyLoaded=function(){if(f)return;f=true;g=false;e.events.fire('finish');$foreach(i,function(n){n();});}
k();}
ZLoader.predefined={};$initializer=new ZLoader();$handle(window,'load',function(){$initializer.load()});ZTransport={};ZTransport.requestCount=0;ZTransport.submit=function(a,b,c,d,e){var f=!c;if(f)c=document.createElement('form');else{c=$(c);while(c&&c.tagName!='FORM')c=c.parentNode;}
c.action=$str(a,document.location.href);c.method=$str(b,(!f&&c.method)?c.method:'get');c.target=$str(e,(!f&&c.target)?c.target:'_self');var g=[];var h=function(k,l){var m=document.createElement('input');m.type='hidden';m.name=k;m.value=l;c.appendChild(m);g.push(m);};$foreach(d,function(k,l){if(k instanceof Array)$foreacha(k,function(n){h(l,n);});else h(l,k);});if(f)document.body.appendChild(c);var j=document.createElement('input');j.type='submit';$hide(j);c.appendChild(j);j.click();if(f)Z(c).remove();$foreach(g,function(k){Z(k).remove();});Z(j).remove();}
ZTransport.ajax=function(a,b,c,d,e,f,g,h){var i=window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject("Microsoft.XMLHTTP");i.onreadystatechange=function(){if(i.readyState!=4)return;if(i.status!=200){if(f)f(i);else if(ZTransport.errorFunction)ZTransport.errorFunction(i);return;}
ZTransport.requestCount--;var n=d=='json' ?ZJSON.parse(i.responseText,$ifnot(g,JSON_dateReviver)):d=='xml'?i.responseXML.documentElement:d=='text'?i.responseText:d=='request'?i:d=='eval'?eval(i.responseText):i.responseText;if(d=='css')ZUtil.addCss(n);if(e)e(n);}
var k='get';var l=a;var m=null;b=$str(b,'get').toLowerCase();if(b=='json'){k='post';m=ZJSON.stringify(c,h);}
else if(b=='post'){k='post';m='';if(c)$foreach(c,function(n,o){m=ZUtil.addQuery(m,o,n);});if(m.startsWith('?'))m=m.slice(1);}
else if(b=='get'){k='get';if(c)$foreach(c,function(n,o){l=ZUtil.addQuery(l,o,n);});}
i.open(k,l,true);if(b=='json')i.setRequestHeader("Content-Type","application/json");if(b=='post')i.setRequestHeader("Content-Type","application/x-www-form-urlencoded");ZTransport.requestCount++;i.send(m);}
ZTransport.get=function(a,b,c,d){return ZTransport.ajax(a,'get',null,b,c,d);}
ZTransport.errorFunction=function(){}
ZTransport.jsonp=function(a,b,c){if(b)$foreach(b,function(h,i){a=ZUtil.addQuery(a,i,h);});var e=a.lastIndexOf('?');if($pos(a.indexOf('?'),e)>=e)throw "No jsonp marker (?) was found in de baseUrl.";var f='jsonp_callback_'+ZTransport.jsonp.curID++;a=a.slice(0,e)+'ZTransport_'+f+a.slice(e+1);window["ZTransport_"+f]=function(){delete window["ZTransport_"+f];Z(g).remove();c.apply(null,arguments);};var g=document.createElement('script');g.src=a;g.type='text/javascript';document.body.appendChild(g);}
ZTransport.jsonp.curID=0;ZAjaxNetService=function(a,b){var c=this;c.url=a;c.version=b||ZAjaxNetService.version;c.applyTimezone=ZAjaxNetService.applyTimezone;if(c.version!="3.5"&&c.version!="2.0"){throw 'Unknown ajax.net version specified: '+c.version+'. Use "3.5" or "2.0"';}
c.call=function(h,i,j,k,l){var m=this.url+'/'+h;ZTransport.ajax(m,'json',i,'request',function(o){i=g(o.responseText);if(c.version=="3.5"&&i&&'d' in i)i=i.d;if(j)j(i,l);},function(o){var p=o.getResponseHeader('jsonerror')==='true';var q=!p?{Message:o.responseText,ExceptionType:'ServerError',StackTrace:''}:g(o.responseText);if(c.version=="3.5"&&q&&'d' in q)q=q.d;if(k)k(q,l);else if(c.onFailed)c.onFailed(q,l);else ZAjaxNetService.onFailed(q,l);},null,e);}
function e(h,i){if(this[h] instanceof Date){var j=this[h].getTime();if(c.applyTimezone&&j!=62135596800000)j-=ZAjaxNetService.timezoneOffset;return new ZAjaxNetDate("\"\\/Date("+j+")\\/\"");}
return i;}
function f(h){var i=/"\\\/Date\((-?\d+)\)\\\/"/;while(i.test(h)){var j=RegExp.lastParen-0;	
if(c.applyTimezone&&j!=62135596800000&&b=='2.0')j+=ZAjaxNetService.timezoneOffset;h=RegExp.leftContext+'new Date('+j+')'+RegExp.rightContext;}
return h;}
function g(h){h=f(h);return ZJSON.parse(h);}}
ZAjaxNetService.timezoneOffset=new Date().getTimezoneOffset()*60*1000;ZAjaxNetService.applyTimezone=true;ZAjaxNetService.minDate=new Date(62135596800000);ZAjaxNetService.version="3.5";ZAjaxNetService.onFailed=function(){};

//asd
if(!this.ZJSON){ZJSON={};}
(function(){function f(n){return n<10?'0'+n:n;}
if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return this.getUTCFullYear()+'-'+
f(this.getUTCMonth()+1)+'-'+
f(this.getUTCDate())+'T'+
f(this.getUTCHours())+':'+
f(this.getUTCMinutes())+':'+
f(this.getUTCSeconds())+'Z';};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};}
var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';}
function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}
if(typeof rep==='function'){value=rep.call(holder,key,value);}
switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}
gap+=indent;partial=[];if(value instanceof ZAjaxNetDate){return value.str}if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null';}
v=partial.length===0?'[]':gap?'[\n'+gap+
partial.join(',\n'+gap)+'\n'+
mind+']':'['+partial.join(',')+']';gap=mind;return v;}
if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==='string'){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}
v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+
mind+'}':'{'+partial.join(',')+'}';gap=mind;return v;}}
if(typeof ZJSON.stringify!=='function'){ZJSON.stringify=function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' ';}}else if(typeof space==='string'){indent=space;}
rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('ZJSON.stringify');}
return str('',{'':value});};}
if(typeof ZJSON.parse!=='function'){ZJSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}
return reviver.call(holder,key,value);}
cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\u'+
('0000'+a.charCodeAt(0).toString(16)).slice(-4);});}
if(/^[\[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|new Date\(-?\d+\)|'[^'\\\n\r]*'|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?|[0-9a-zA-Z$]+\s*:/g, ']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j;}
throw new SyntaxError('ZJSON.parse');};}})();
JSON_dateReviver=function(a,b){var c;if(typeof b==='string'){c=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(b);if(c){return new Date(Date.UTC(+c[1],+c[2]-1,+c[3],+c[4],+c[5],+c[6]));}}
return b;}
function ZAjaxNetDate(a){this.str=a;};ZBack={};ZBack.add=function(a,b,c){var d=++ZBack.currentIndex;ZBack._backObjs[d]={redo:a,save:b,title:c};ZBack._backObjs.length=d+1;if(d>0){var e=ZBack._backObjs[d-1];e.state=e.save?e.save():null;}
var f=ZConfig.frameworkPath()+'/zback_frame.html?i='+d+'&t='+new Date().getTime();if(ZBack._wind){ZBack._wind.location=f;}
else{var g=document.createElement('iframe');g.src=f;document.body.appendChild(g);$hide(g);}
if(c)document.title=c;return a;}
ZBack.currentIndex=-1;ZBack._backObjs=[];ZBack._wind=null;ZBack._callback=function(a,b){ZBack._wind=b;if(a!=ZBack.currentIndex&&ZBack._backObjs[a]){if(a>ZBack.currentIndex&&ZBack._backObjs.length>a+1){var c=ZBack._backObjs[a-1];c.state=c.save?c.save():null;}
else if(a<ZBack.currentIndex&&ZBack._backObjs.length>0){var d=ZBack._backObjs[a+1];d.state=d.save?d.save():null;}
ZBack.currentIndex=a;var e=ZBack._backObjs[a];e.redo(e.state);if($notnull(e.title))document.title=backOj.title;}}
ZStyle={};ZStyle.colors={aqua:'#00FFFF',black:'#000000',blue:'#0000FF',fuchsia:'#FF00FF',gray:'#808080',green:'#008000',lime:'#00FF00',maroon:'#800000',navy:'#000080',olive:'#808000',purple:'#800080',red:'#FF0000',silver:'#C0C0C0',teal:'#008080',white:'#FFFFFF',yellow:'#FFFF00'};ZStyle.currentStyle=function(a,b,c){if(c&&c[b]){return c[b];}
var d=null;if(b==='opacity'&&a.currentStyle){d=a.currentStyle['filter'];if(d.startsWith('alpha(opacity=')){var e=ZStyle.parseStyle(d,b);e.unit='opacity';e.value/=100;return e;}
return{value:1,unit:'opacity'};}
if(b==='offsetHeight'||b==='offsetWidth'){var f=b==='offsetHeight';var g=a.style[f?'height':'width'];a.style[f?'height':'width']='100%';var h=a.style.display;$show(a);var i=ZStyle.parseStyle(f?a.offsetHeight:a.offsetWidth);a.style[f?'height':'width']=g;a.style.display=h;return i;}
if(b==='viewportHeight'||b==='viewportWidth'){var f=b==='viewportHeight';var i=ZStyle.currentStyle(a,f?'offsetHeight':'offsetWidth',c);var g=ZStyle.currentStyle(a,f?'height':'width',c).value;return{value:Math.round(g*100/i.value),unit:'%'};}
if(a.currentStyle)d=a.currentStyle[b];else d=window.getComputedStyle(a,null)[b];return ZStyle.parseStyle(d,b);}
ZStyle.parseStyle=function(a,b){if(typeof a==='undefined')return{value:null,unit:''};if(typeof a==='number')return{value:a,unit:''};if(a.slice(0,'alpha(opacity='.length)=='alpha(opacity='){return{value:a.slice('alpha(opacity='.length,a.length-1)-0,unit:'alpha(opacity='};}
var c=ZStyle;if(a.charAt(0)=='#')return{value:c.parseHexColor(a),unit:'rgb'};if(a.substr(0,4)=='rgba')return{value:c.parseRgbColor(a),unit:'rgba'};if(a.substr(0,3)=='rgb')return{value:c.parseRgbColor(a),unit:'rgb'};if(c.colors[a])return{value:c.parseHexColor(c.colors[a]),unit:'rgb'};var d=a.match(/^(\d+\.?\d*)(\D*)$/);if(!d)return{value:a,unit:''};return{value:d[1]-0,unit:d[2]};}
ZStyle.parseRgbColor=function(a){var b=a.substring(a.indexOf('(')+1,a.length-1).split(',');for(var c in b)b[c]=b[c]-0;return b;}
ZStyle.parseHexColor=function(a){var b=function(d,e){return parseInt('0x'+(e==2?a.substr(d,e):(a.substr(d,e)+a.substr(d,e))))}
return a.length==4?[ b(1,1),b(2,1),b(3,1)]:[ b(1,2),b(3,2),b(5,2)]}
ZStyle.allowFloats={'-moz-opacity':1,'opacity':1}
ZStyle.styleToString=function(a,b,c){if(c=='alpha(opacity=')return 'alpha(opacity='+b+')';if(c=='rgb'||c=='rgba')return c+'('+b.join(',')+')';return b+''+c;}
ZStyle.setStyle=function(a,b,c,d){var e=c.value,f=c.unit;if(b=='opacity'&&a.currentStyle){f='alpha(opacity=';e=e*100;b='filter';a.style.zoom=1;}
if(b==='viewportHeight'||b==='viewportWidth'){var g=b==='viewportHeight';var h=ZStyle.currentStyle(a,g?'offsetHeight':'offsetWidth',d);a.style[g?'height':'width']=e==100?'100%':Math.round(e*h.value/100)+'px';}
else a.style[b]=ZStyle.styleToString(b,e,f);}
function ZTimeline(a){this.frame=new ZTimeframe(this,a);this.isStopped=false;this.runningCount=0;this.playIndex=0;this.currentFrames={};this.thisObj=a;this.lastFrame=this.frame;ZEvent.register(this,['finish','play','stop']);}
ZTimeline.prototype={_:1,play:function(){this.stop();this.runningCount=0;this.isStopped=false;this.playIndex++
this.events.fire('play');this._frameStarted(this.frame);this.frame.notify();return this;},stop:function(){this.isStopped=true;this.events.fire('stop');return this;},execute:function(){return this.frame.execute.apply(this.frame,arguments);},sleep:function(){return this.frame.sleep.apply(this.frame,arguments);},_frameStarted:function(a){this.runningCount++;this.currentFrames[a.id]=a;},_frameEnded:function(a){this.runningCount--;delete this.currentFrames[a.id];if(!this.runningCount&&!a.tasks.length){this.events.fire('finish');}}}
ZTimeline.prototype.play.zTimelineNotifierIndex=0;ZTimeline.notifier={};ZTimeline.thisObj={};ZTimeline.rate=35;ZTimeline.callee=null;ZTimeline._timer=null;ZTimeline._timerFuncs={};ZTimeline._timerCount=0;ZTimeline._timerIDCount=0;ZTimeline.addListener=function(a){a._zTimeframeTimerID=++ZTimeline._timerIDCount;ZTimeline._timerFuncs[ZTimeline._timerIDCount]=a;if(!ZTimeline._timerCount++)ZTimeline._timer=setInterval(function(){for(var c in ZTimeline._timerFuncs)ZTimeline._timerFuncs[c]();},ZTimeline.rate);}
ZTimeline.removeListener=function(a){delete ZTimeline._timerFuncs[a._zTimeframeTimerID];if(!--ZTimeline._timerCount)clearInterval(ZTimeline._timer);}
function ZTimeframe(a,b){this.tasks=[];this.isNotified=false;this.notify=this.notify.bind(this);this.timeline=a;this.id=++ZTimeframe._idCount;this.thisObj=b;ZEvent.register(this,['finish']);if(b){var c=this;for(var d in b){var e=b[d];if(this[d])continue;if(typeof e!=='function')continue;var f=function(h){this[d]=function(){var j=Array.prototype.slice.call(arguments);j.unshift(h);j.unshift(b);return c.executeWithThis.apply(c,j);}}.call(this,e);if(e.zTimelineNotifierIndex)this[d].zTimelineNotifierIndex=e.zTimelineNotifierIndex;}}}
ZTimeframe._idCount=0;ZTimeframe._taskCount=0;ZTimeframe.__task={};ZTimeframe.prototype={_:1,_callFunc:function(a){if(this.isStopped)return;this.timeline._frameStarted(this);ZTimeline.current=this.timeline;this._prepareTask(a);	
if(typeof a.func==='object'){ZTimeframe.__task[++ZTimeframe._taskCount]=a;var b='ZTimeframe.__task['+ZTimeframe._taskCount+'].func(';for(var c=0;c<a.args.length;c++){if(c>0)b+=',';b+='ZTimeframe.__task['+ZTimeframe._taskCount+'].args['+c+']';}
b+=')';eval(b);delete ZTimeframe.__task[ZTimeframe._taskCount];}
else a.func.apply(a.obj,a.args);ZTimeline.current=null;if(!a.hasNotifier)a.notifier();},notify:function(){this.timeline._frameEnded(this);this.events.fire('finish');if(this.timeline.isStopped)return;for(var a=0;a<this.tasks.length;a++){this._callFunc(this.tasks[a]);}},executeWithThis:function(a,b){var c=[];for(var d=2;d<arguments.length;d++){c.push(arguments[d]);}
if(a==ZTimeline.thisObj)obj=this.thisObj;if(typeof b==='string')b=a[b];var e=new ZTimeframe(this.timeline,$ifnot(this.nextThisObj,this.thisObj));var f={obj:a,func:b,args:c,frame:e};this.tasks.push(f);return e;},execute:function(a){var b=Array.prototype.slice.call(arguments);b.unshift(null);return this.executeWithThis.apply(this,b);},subject:function(a){if($undef(a))return this.thisObj;if(typeof a==='string')a=Z(a);this.nextThisObj=a;var b=this.execute(function(){});this.nextThisObj=null;return b;},_prepareTask:function(a){var b=this.timeline.playIndex;var c=this;a.notifier=function(){if(c.timeline.playIndex==b)a.frame.notify();}
var e=false;for(var f=0;f<a.args.length;f++){if(a.args[f]==ZTimeline.notifier){a.args[f]=a.notifier;e=true;}}
if(typeof a.func.zTimelineNotifierIndex==='number'){a.args[a.func.zTimelineNotifierIndex]=a.notifier;e=true;}
a.hasNotifier=e;},sleep:function(a){return this.execute(setTimeout,ZTimeline.notifier,a);}}
Function.prototype.execOnZTimeframe=function(a){var b=this;var c=function(){if(ZTimeline.current&&arguments.length>a){b.apply(this,arguments);}
else{var e=new ZTimeline(this);var f=Array.prototype.slice.call(arguments);f.unshift(b);f.unshift(this);var g=e.frame.executeWithThis.apply(e.frame,f).sleep(0);e.play();return g;}}
b.zTimelineNotifierIndex=c.zTimelineNotifierIndex=a;return c;}
Z.prototype.sleep=function(a,b){setTimeout(b,a);}.execOnZTimeframe(1);Z.prototype.timeframe=function(a){var b=new ZTimeline(this);var c=b.frame.sleep(0);if(!a)b.play();return c;};function ZTween(a,b,c,d){this.rate=window.ZTimeline?ZTimeline.rate:20;if(!c)c=200;b=$clone(b);var e={};var f=false;var g=0;var h=Math.ceil(c/this.rate);if(!d)d=new ZTween.PowerInterpolator(1);var i=d.calcFrames(h);var j=ZStyle.colors;var k=null;var l={};m();function m(){	
if(!ZStyle.currentStyle(a,'left').unit)a.style.left='0px';if(!ZStyle.currentStyle(a,'top').unit)a.style.top='0px';if($def(b.viewportHeight)&&(ZStyle.currentStyle(a,'paddingTop').value ||ZStyle.currentStyle(a,'paddingBottom').value)){throw "There are paddings on the element for which you want to tween the viewport. Tweening can't work with paddings. Try to put the paddings in an inner div.";}
if('viewportHeight' in b){l['offsetHeight']=ZStyle.currentStyle(a,'offsetHeight');}
for(var s in b){var t=(b[s]+'').trim();var u=t.length>=2?t.substr(0,2):'';if(u=='+='||u=='-='||u=='%='||u=='/='){u=t.substr(0,2);t=t.substr(2);}else u='';if(!u&&t.indexOf('-',1)>=0){var v=t.split('-');t=v[1];e[s]=ZStyle.parseStyle(v[0]);ZStyle.setStyle(a,s,e[s]);}
t=ZStyle.parseStyle(t,s);var w=ZStyle.currentStyle(a,s,l);var x=w.value;if(u){if(u=='+=')t.value=x+t.value;if(u=='-=')t.value=x-t.value;if(u=='*=')t.value=x * t.value;if(u=='/=')t.value=Math.round(x/t.value);}
t.start=x;t.end=t.value;t.name=s;b[s]=t;if(w.unit==='pt'||t.unit==='pt')throw "ZTween doens't work with point units, please work with pixels for "+s;if(s==='viewportWidth' &&(ZStyle.currentStyle(a,'paddingLeft').value ||ZStyle.currentStyle(a,'paddingRight').value)){throw "There are left or right paddings on the element you want to tween the viewport off. Tweening can't work with paddings.";}
if(s==='viewportHeight' &&(ZStyle.currentStyle(a,'paddingTop').value ||ZStyle.currentStyle(a,'paddingBottom').value)){throw "There are top or bottom paddings on the element you want to tween the viewport off. Tweening can't work with paddings.";}}}
this.play=function n(s){if(!f)g=0;if(g>=h)return;this.timelineStopped=false;var t=this;if(window.ZTimeline&&ZTimeline.current){this.timeline=ZTimeline.current;stopFunc=function(){t.timelineStopped=true;};this.timeline.onStop(stopFunc);}
var v=(t.timeline?ZTimeline.addListener:setInterval)(function(){if(!t.timelineStopped){g+=1;p(g);}
if(t.timelineStopped||g>=h||k){t.timeline?ZTimeline.removeListener(arguments.callee):clearInterval(v);if(t.timeline)$dehandle(t.timeline,'end',stopFunc);if(s)s();}},this.rate);}
this.play.zTimelineNotifierIndex=0;this.frame=function(){return g;}
function p(s){for(var t in b){var u=b[t];q(u,s);}}
function q(s,t){var u=s.name;var v=ZStyle.currentStyle(a,u,l);var w=h-t;var x;if(v.value instanceof Array){x=[];for(var y=0;y<v.value.length;y++){x[y]=r(u,s.start[y],s.end[y],t);}}
else{var z=s.end-v.value;x=r(u,s.start,s.end,t);}
try{ZStyle.setStyle(a,u,{value:x,unit:v.unit},l);}catch(err){alert('Kon '+u+' niet instellen. Wellicht moet je eerst een beginwaarde in de html/css instellen.');k=err;}}
function r(s,t,u,v){var w=u-t;var x=i[v] * w+t;if(!ZStyle.allowFloats[s])x=Math.round(x);if(u>t)return Math.min(Math.max(x,t),u);return Math.min(Math.max(x,u),t);}}
ZTween.PowerInterpolator=function(a){this.calcFrames=function(c){var d=[];var e=Math.pow(c,a);for(var f=0;f<=c;f++){d[f]=Math.pow(f,a)/e;}
return d;}}
ZTween.BounceInterpolator=function(a,b,c){this.calcFrames=function(e){var f=[];var g=(!g&&g!==0)?15:g;g=Math.floor(e*b);c=(!c&&c!==0)?.1:c;var h=Math.pow(e-g,a);var i=0;for(;i<=e-g;i++){f[i]=Math.pow(i,a)/h;}
for(var j=0,k=1;i<e;i++,j++){f[i]=1-(k/g*c);if(j<g/2)k++;else k--;}
f[e]=1;return f;}}
ZTween.bounce=new ZTween.BounceInterpolator(2,.2,.2);ZTween.speedUp=new ZTween.PowerInterpolator(2);ZTween.slowDown=new ZTween.PowerInterpolator(.5);Z.prototype.tween=function(a,b,c,d){new ZTween(this.elm,a,b,c).play(d);}.execOnZTimeframe(3);Z.prototype.wipe=function(a,b,c,d,e){if(!c)c={};c.viewportHeight=a?0:100;if(a!=$shown(this)){if(e)e();return;}
this.style('height',a?'100%':'0px');this.style('overflow','hidden');this.show();var f=this;this.tween(c,b,d||ZTween.speedUp,function(){if(a)f.hide();if(e)e();});}.execOnZTimeframe(4);ZTemplate=function(a){this.id=a;this.elm=$(a,true);this.elm.normalize();this.paths={};this.namePaths=[];this.forLabels=[];this.precompile();this.compile();}
ZTemplate.instances={};ZTemplate.get=function(a){var b=ZTemplate.instances[a];if(!b)return ZTemplate.instances[a]=new ZTemplate(a);return b;}
ZTemplate.fillVars=function(a,b){for(var c in b){a['_'+c].text(b[c]);}}
ZTemplate.prototype={_:1,_replaceNamesViaHtml:ZUtil.isIE6()||ZUtil.isIE7(),compile:function(){var a=this.paths;var b=this.namePaths;var c=this.forLabels;var d=function e(f,g){if(!f.getAttribute)return;var h;if(h=f.getAttribute('_id')){if(g)a[h]=g.toArray();Z(f).addClass(h);f.z=null;}
if(f.name&&g){b.push(g.toArray());}
if(f.htmlFor&&f.tagName==='LABEL'){c.push(g.toArray());}
for(var i=0;i<f.childNodes.length;i++){e(f.childNodes[i],new ZTemplate.Path(g,i));}}(this.elm,null);},precompile:function(){if(this.elm.getAttribute('z_use_shortcuts')=='false')return;this.elm.innerHTML=this._replaceVars(this._replaceVars(this.elm.innerHTML,'$','span'),'#','div');},_replaceVars:function(a,b,c){var d=new RegExp('\\'+b+'[\\w_]+\\'+ b);var e=0;while(e++<1000){var f=d.exec(a);if(!f)break;a=a.slice(0,f.index)+'<'+c+' _id="' +f[0].slice(1,f[0].length-1)+'"></'+c+'>'+a.slice(f.index+f[0].length);}
if(e>=1000)throw 'Overflow in template: too many variables.';return a;},apply:function(a,b){var c=this.elm.cloneNode(true);c.id=$ifnot(b,'');c.className=c.getAttribute('_class');var d=Z(c);d.template=this;if(this.elm.id)d.addClass(this.elm.id);d.elms={};var e=null;var f={};for(var g=0;g<this.namePaths.length;g++){if(!e)e=d.getTemplatePrefix();var h=this.namePaths[g];var i=this._walkPath(c,h,f);if(i.type=='radio'&&this._replaceNamesViaHtml){i=this._replaceName(i,e+i.name);this._walkPath(c,h,f,i);}
else i.name=e+i.name;}
for(var b in this.paths){var h=this.paths[b];var i=this._walkPath(c,h,f);d['_'+b]=Z(i);d['$'+b]=i;}
for(var g=0;g<this.forLabels.length;g++){var h=this.forLabels[g];var i=this._walkPath(c,h,f);var j=d['_'+i.htmlFor];if(!j)continue;if(!j.elm.id)j.elm.id=$generateID();i.htmlFor=j.elm.id;}
if(a)ZTemplate.fillVars(d,a);d.templateNamePrefix=e?e:'';return d;},_replaceName:function(a,b){var c='<input type="radio" name="'+b+'" />';var d=document.createElement('span');d.innerHTML=c;for(var e=0,f=d.childNodes;e<f.length;e++)if(f[e].nodeType==1)d=f[e];for(var e=0;e<a.attributes.length;e++){var g=a.attributes[e];if(!g.specified||g.name=='type'||g.name=='name'||g.name=='z')continue;d.setAttribute(g.name,g.value);if(g.name=='class')d.className=g.value;}
a.parentNode.insertBefore(d,a);a.parentNode.removeChild(a);return d;},_walkPath:function(a,b,c,d){var e=a;var f='';for(var g=0;g<b.length;g++){var h=b[g];f+=h+'_';var i=c[f];e=i?i:(c[f]=e.childNodes[h]);}
if(d)c[f]=d;return e;}}
ZTemplate.Path=function(a,b){this.parent=a;this.index=b;this.toArray=function(){var d=[];var e=this;while(e!=null){d.push(e.index);e=e.parent;}
return d.reverse();}}
ZTemplate.apply=function(a,b,c,d){var e=ZTemplate.get(a);if(!e)throw 'ZTemplate'+a+" doesn't exist.";var f=e.apply(d);f.data=c;if(b)$(b).appendChild(f.elm);return f;}
ZTemplate.create=function(a,b,c){if($(b))return ZTemplate.get(b);var d=Z.create('div').addClass('z_hidden').html(a);d.elm.id=b||$generateID();Z(document.body).append(d,true);if(c)ZUtil.addCss(c,true);d.elm.z=null;return ZTemplate.get(d.elm.id);}

