/*
 Coati library
 Lightweight, versatile JavaScript library to aid in cross-browser-compatible web sites.
 (c) 2006 - 2012 by Yves Goergen
 Last update: 2012-11-16
 Website: http://unclassified.de
 Licence: GNU General Public License (GPL) Version 3
*/
var coati=function(){var m={},t=!0,x=0,i={},r={setConfigValue:function(c,b){m[c]=b},getConfigValue:function(c,b){var d=m[c];f(d)||(d=b);return d},setErrorMessages:function(c){t=!!c;x=0},isSet:function(c){return typeof c!="undefined"&&c!=null},isNumber:function(c){return typeof c=="number"},isBoolean:function(c){return typeof c=="boolean"},isString:function(c){return typeof c=="string"},isArray:function(c){return typeof c=="object"&&c instanceof Array},isObject:function(c){return typeof c=="object"},
isFunction:function(c){return typeof c=="function"},isNumeric:function(c){return w(c)||s(c)&&c.search(/^-?[0-9]+(.[0-9]+)?$/)!=-1},isEven:function(c){return w(c)&&c%2==0},isOdd:function(c){return w(c)&&c%2==1},isTrue:function(c){if(!f(c))return!1;if(s(c))return q.trim(c)!=""&&q.trim(c)!="0"&&q.trim(c).toLowerCase()!="false";if(z(c))return c!=null;if(y(c))return c.length>0;if(w(c))return c!=0;if(C(c))return c;return!1},dump:function(c){function b(c,g){if(g>5)return"{recursion}";for(var j="\n",l=0;l<
g;l++)j+="    ";var h="";if(f(c))if(w(c))h+=c.toString();else if(C(c))h+=c.toString();else if(s(c))h+='"'+c.toString().replace(/"/g,'\\"')+'"';else if(y(c)){h+="[";for(l=0;l<c.length;l++){h+=(l?",":"")+j+"    ";if(h.length>500&&h.indexOf("{toolong}")==-1){h+="{toolong}";break}h+=l+": ";try{h+=b(c[l],g+1)}catch(k){h+="{error}"}}h+=(l?j:" ")+"]"}else if(z(c)){h+="{";l=0;for(var a in c){h+=(l++?",":"")+j+"    ";if(h.length>500&&h.indexOf("{toolong}")==-1){h+="{toolong}";break}h+=a+": ";try{h+=b(c[a],
g+1)}catch(O){h+="{error}"}}h+=(l?j:" ")+"}"}else h+=B(c)?"function":"unknown";else h+="undefined";return h}return b(c,0)},errorMessage:function(c,b){if(t&&c!=""&&!(x>=3)){f(b)||(b="");for(var d="",g=0;g<9+b.length*0.85;g++)d+=String.fromCharCode(175);x++;alert((b?"Context: "+b+"\n"+d+"\n":"")+c);x--}},formatException:function(c){try{var b=String.fromCharCode(160);b=b+b+b+b+b+b+b+b;var d="";d+="Exception: "+c.name+"\n";d+="Message: "+c.message+"\n";c.fileName&&(d+="Code: "+c.fileName+":"+c.lineNumber+
"\n");c.stack&&(d+="Stack:\n"+b+q.trim(c.stack).replace(/\r/g,"").replace(/^((?:.*?\n){25}).*$/,"$1").replace(/(^|\n)(.{150}).*?(?=\n|$)/g,"$1$2").replace(/\n/g,"\n"+b)+"\n");return d}catch(g){return g.stack?"Error formatting exception: "+g+"\n\nInner exception: "+c:"Error formatting exception:\n"+coati.dump(g)+"\nInner exception:\n"+coati.dump(c)}},includeScriptAsync:function(c){var b=document.createElement("script");b.type="text/javascript";b.src=c;document.body.appendChild(b)},includeScript:function(){},
defer:function(c,b,d){var g=o.findValue(i,c);d&&g&&(clearTimeout(g),i[g]=void 0);g=setTimeout(c,b);i[g]=c},getURLDirectoryName:function(c){return c.replace(/([^/]*)$/,"")},getURLFileName:function(c){return c.replace(/^(.*\/)([^/]*)$/,"$2")},formatNumber:function(c,b){if(isNaN(c))return c;if(f(b)){var d=Math.pow(10,b);c=Math.round(c*d)/d}d=c+"";if(b>0)for(d.indexOf(".")==-1&&(d+=".");d.length-d.indexOf(".")-1<b;)d+="0";return d.replace(/\./,coati.getConfigValue("i18n.decimal_separator","."))},parseNumber:function(c){c=
c.replace(coati.getConfigValue("i18n.decimal_separator","."),".");return+c},browser:function(){return{ieVersion:function(){var c=document.documentElement.style;if(c.scrollbar3dLightColor!=void 0)return c.opacity!=void 0?9:c.msBlockProgression!=void 0?8:c.msInterpolationMode!=void 0?7:c.textOverflow!=void 0?6:5.5;return 0},ie:function(){return coati.browser.ieVersion()>0},transition:function(){if(f(document.body.style.MozTransition))return"MozTransition";else if(f(document.body.style.WebkitTransition))return"WebkitTransition";
else if(f(document.body.style.OTransition))return"OTransition"},setCookie:function(c,b,d,g,f,l){var h;d&&(h=new Date,h.setTime(h.getTime()+d*1E3));document.cookie=c+"="+encodeURIComponent(b)+(d?";expires="+h.toGMTString():"")+";path="+(g||"/")+(f?";domain="+f:"")+(l?";secure":"")},deleteCookie:function(c,b,d,g){document.cookie=c+"=;expires=0;path="+(b||"/")+(d?";domain="+d:"")+(g?";secure":"")},getCookie:function(c){return(c=RegExp("(^|;)[ ]*"+c+"=([^;]*)").exec(document.cookie))?decodeURIComponent(c[2]):
void 0}}}(),array:function(){return{indexOf:function(c,b,d){if(!f(c))return-1;f(d)||(d=0);d<0&&(d+=c.length);for(d<0&&(d=0);d<c.length;d++)if(c[d]===b)return d;return-1},lastIndexOf:function(c,b,d){if(!f(c))return-1;var g=c.length;f(d)||(d=g-1);d<0&&(d+=g);for(d>g-1&&(d=g-1);d>=0;d--)if(c[d]===b)return d;return-1},contains:function(c,b){if(!f(c))return!1;for(var d=0;d<c.length;d++)if(c[d]===b)return!0;return!1},each:function(c,b){if(f(c))for(var d=0;d<c.length;d++)b(c[d],d)},flatten:function(c){if(f(c)){for(var b=
[],d=0;d<c.length;d++)b=b.concat(c[d]instanceof Array?o.flatten(c[d]):c[d]);return b}},map:function(c,b){if(f(c)){for(var d=Array(c.length),g=0;g<c.length;g++)d[g]=b(c[g],g);return d}},filter:function(c,b){if(f(c)){for(var d=[],g=0;g<c.length;g++)b(c[g],g)&&d.push(c[g]);return d}},remove:function(c,b){return o.filter(c,function(c){return c!=b})},removeAt:function(c,b){if(f(c))return b<0&&(b+=c.length),o.filter(c,function(c,g){return b!=g})},uniq:function(c){if(f(c)){for(var b=[],d=0;d<c.length;d++)p(b,
c[d])||b.push(c[d]);return b}},clone:function(c){if(f(c)){for(var b=[],d=0;d<c.length;d++)b[d]=c[d];return b}},none:function(c,b){return!o.any(c,b)},any:function(c,b){if(!f(c))return!1;for(var d=0;d<c.length;d++)if(c[d](b))return!0;return!1},all:function(c,b){if(!f(c))return!1;for(var d=0;d<c.length;d++)if(!c[d](b))return!1;return!0},findValue:function(c,b){if(f(c))for(var d in c)if(c[d]===b)return d},containsValue:function(c,b){return f(o.findValue(c,b))}}}(),string:function(){return{contains:function(c,
b){return c.indexOf(b)!=-1},trimStart:function(c,b){if(f(b)){for(var d=0;d<c.length&&q.contains(b,c.charAt(d));d++);return c.substr(d)}return c.replace(/^\s+/,"")},trimEnd:function(c,b){if(f(b)){for(var d=c.length-1;d>=0&&q.contains(b,c.charAt(d));d--);return c.substr(0,d+1)}return c.replace(/\s+$/,"")},trim:function(c,b){return q.trimEnd(q.trimStart(c,b),b)},startsWith:function(c,b){if(!s(b))return!1;return c.substr(0,b.length)==b},endsWith:function(c,b){if(!s(b))return!1;return c.substr(c.length-
b.length,b.length)==b},pad:function(c,b,d,g){for(f(d)||(d=" ");c.length<b;)g?c=d+c:c+=d;return c},repeat:function(c,b){for(var d="";b--;)d+=c;return d},escapeXml:function(c,b){c=c.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");b&&(c=c.replace(/"/g,"&quot;").replace(/'/g,"&#39;"));return c},escapeRegex:function(c){return c.replace(/([$^*+.?\\()/|\[\]{}])/g,"\\$1")},escapeRegexCC:function(c){return c.replace(/([-\\^\[\]])/g,"\\$1")},encodeUri:function(c){return encodeURIComponent(c).replace(/%20/g,
"+").replace(/%2C/g,",")},toCamelCase:function(c,b){for(var d=c.split(b||"-"),g=d[0],f=1;f<d.length;f++)g+=d[f].charAt(0).toUpperCase()+d[f].substr(1);return g}}}(),dom:function(){function c(a){if(a.data)return a.data;if(a.which)return a.which;return a.keyCode}var b=void 0,d=0,g,j=[],l=!1,h=!1,i={top:function(a){a=n(a);if(!f(a))return 0;for(var c=a.offsetTop;a=a.offsetParent;)c+=a.offsetTop;return c},left:function(a){a=n(a);if(!f(a))return 0;for(var c=a.offsetLeft;a=a.offsetParent;)c+=a.offsetLeft;
return c},bottom:function(a){a=n(a);return k.top(a)+k.height(a)},right:function(a){a=n(a);return k.left(a)+k.width(a)},width:function(a){a=n(a);if(!f(a))return 0;return a.offsetWidth},height:function(a){a=n(a);if(!f(a))return 0;return a.offsetHeight},resizeVert:function(a,c,b){a=n(a);if(f(a)){c=a.clientHeight+c;var d=0;a.tagName.toLowerCase()=="textarea"&&(d=60);c<d&&(c=d);c>1E3&&(c=1E3);d=c-a.clientHeight;a.style.height=c+"px";b==!0&&window.scrollBy(0,d)}},moveTo:function(a,c,b){a=n(a);if(f(a))a.style.left=
c+"px",a.style.top=b+"px"},moveBy:function(a,c,b){a=n(a);if(f(a))a.style.left=parseInt(a.style.left)+c+"px",a.style.top=parseInt(a.style.top)+b+"px"},resizeTo:function(a,c,b){a=n(a);if(f(a))a.style.width=c+"px",a.style.height=b+"px"},resizeBy:function(a,c,b){a=n(a);if(f(a))a.style.width=parseInt(a.style.width)+c+"px",a.style.height=parseInt(a.style.height)+b+"px"},unsetSize:function(a){a=n(a);if(f(a))a.style.width="",a.style.height=""},windowClientWidth:function(){if(document.documentElement.clientWidth>
0)return document.documentElement.clientWidth;if(f(document.body.clientWidth))return document.body.clientWidth;if(f(window.innerWidth))return window.innerWidth},windowClientHeight:function(){if(document.documentElement.clientHeight>0)return document.documentElement.clientHeight;if(f(document.body.clientHeight))return document.body.clientHeight;if(f(window.innerHeight))return window.innerHeight},toggleVisible:function(a,c){var b;a=n(a);if(!f(a))return-1;b=f(c)?c?"":"none":a.style.display==""?"none":
"";a.style.display=b;return b==""?1:-1},show:function(a){return k.toggleVisible(a,!0)},hide:function(a){return k.toggleVisible(a,!1)},visible:function(a){a=n(a);if(!f(a))return!1;return a.style.display!="none"},toggleEnabled:function(a,c){var b;a=n(a);if(!f(a))return!1;b=f(c)?!c:!a.disabled;a.disabled=b;return!b},enable:function(a){return k.toggleEnabled(a,!0)},disable:function(a){return k.toggleEnabled(a,!1)},enabled:function(a){a=n(a);if(!f(a))return!1;return!a.disabled},disableAsync:function(a){a=
n(a);window.setTimeout(function(){if(a)a.blur(),a.disabled=!0},50)},toggleSelected:function(a){a=n(a);if(k.hasClass(a,"selected"))return k.removeClass(a,"selected"),!1;k.addClass(a,"selected");return!0},scrollX:function(a){if(f(window.pageXOffset))return f(a)?(window.scrollTo(a,k.scrollY()),a):window.pageXOffset;return document.compatMode=="CSS1Compat"?f(a)?document.documentElement.scrollLeft=a:document.documentElement.scrollLeft:f(a)?document.body.scrollLeft=a:document.body.scrollLeft},scrollY:function(a){if(f(window.pageYOffset))return f(a)?
(window.scrollTo(k.scrollX(),a),a):window.pageYOffset;return document.compatMode=="CSS1Compat"?f(a)?document.documentElement.scrollTop=a:document.documentElement.scrollTop:f(a)?document.body.scrollTop=a:document.body.scrollTop},scrollDownBy:function(a){a=n(a);window.scrollBy(0,k.height(a))},scrollUpBy:function(a){a=n(a);window.scrollBy(0,-k.height(a))},setAnchorScrollOffset:function(a){d=a},scrollToAnchor:function(){try{clearTimeout(b)}catch(a){}var c=window.location.href,d=c.lastIndexOf("#");d>0&&
c.substring(d+1,c.length)},scrollToObject:function(a){a=n(a);f(a)&&(a=k.top(a)-7+d,window.scrollTo(0,a))},autoScrollToAnchor:function(){k.addEvent(window,"load",k.scrollToAnchor);b=setTimeout(k.scrollToAnchor,1E3)},toggleVisibleScroll:function(a){var c;a=n(a);if(f(a))return a.style.display==""?(window.scrollBy(0,-k.height(a)),c="none",a.style.display=c):(c="",a.style.display=c,window.scrollBy(0,k.height(a))),c==""?1:-1},setImageCond:function(a,c,b,d){n(a).src=c?b:d},hasClass:function(a,c){a=n(a);
if(!f(a)||!f(a.className))return!1;var b=a.className.split(" "),d=c.split(" ");d=o.filter(d,function(a){return!p(b,a)});return d.length==0},getClasses:function(a){a=n(a);if(!f(a)||!f(a.className))return"";return a.className.split(" ")},addClass:function(a,c){a=n(a);if(f(a)&&f(a.className)){var b=a.className.split(" "),d=c.split(" ");v(d,function(a){a.length>0&&!p(b,a)&&b.push(a)});a.className=b.join(" ")}},removeClass:function(a,c){a=n(a);if(f(a)&&f(a.className)){var b=a.className.split(" "),d=c.split(" ");
b=o.filter(b,function(a){return!p(d,a)});a.className=b.join(" ")}},toggleClass:function(a,c,b){a=n(a);f(a)&&f(a.className)&&(c=c.split(" "),v(c,function(c){b>0||!f(b)&&!k.hasClass(a,c)?k.addClass(a,c):k.removeClass(a,c)}))},addPageStyle:function(a){var c=document.createElement("style");c.setAttribute("type","text/css");try{c.appendChild(document.createTextNode(a))}catch(b){coati.errorMessage(coati.formatException(b),"coati_dom.addPageStyle")}document.getElementsByTagName("head")[0].appendChild(c)},
getEffectiveStyle:function(a,c){a=n(a);if(f(a)){if(window.getComputedStyle)return window.getComputedStyle(a,null).getPropertyValue(c);if(a.currentStyle)return a.currentStyle[q.toCamelCase(c)];errorMessage("Browser does not support retrieval of effective style","coati.dom.getEffectiveStyle")}},getOpacity:function(a){a=n(a);if(f(a)){if(a.filters&&a.filters.alpha&&w(a.filters.alpha.opacity))return a.filters.alpha.opacity/100;if(f(a.style.opacity)&&a.style.opacity!="")return a.style.opacity;return 1}},
setOpacity:function(a,c){a=n(a);if(f(a))if(f(a.style.opacity))a.style.opacity=c;else if(f(a.style.filter))a.style.filter=c===1?"":"Alpha(opacity="+c*100+")"},findParentByName:function(a,c){a=n(a);if(f(a)){for(;a.nodeName.toLowerCase()!=c;){if(!a.parentNode)return;a=a.parentNode}return a}},findParentByClass:function(a,c){a=n(a);if(f(a)){for(;!k.hasClass(a,c);){if(!a.parentNode)return;a=a.parentNode}return a}},select:function(a,c){if(!s(a))return a;var b=k.selectAll(a,c);if(f(b)&&b.length>=1)return b[0]},
selectAll:function(a,c){if(!s(a))return a;s(c)&&(c=document.getElementById(c));f(c)||(c=document);a=q.trim(a);var b;if(!f(c)&&(b=a.match(/^#([-_0-9A-Za-z]+)$/)))return[document.getElementById(b[1])];if(c.getElementsByClassName&&(b=a.match(/^\.([-_0-9A-Za-z]+)$/)))return c.getElementsByClassName(b[1]);if(y(c)){for(var d=[],g=0;g<c.length;g++)d=d.concat(arguments.callee(a,c[g]));return o.uniq(d)}g=[];for(var h=[];a.length>0;){h.length>0&&(b=a.match(/^\s*,\s*/),f(b)&&(g.push(h),h=[],a=a.substr(b[0].length)));
d="";if(h.length>0)if(b=a.match(/^(\s*[>+~]\s*|\s+)/),f(b))d=q.trim(b[1]),a=a.substr(b[0].length);else return!1;var l="";b=a.match(/^([-_0-9A-Za-z]+|\*)/);f(b)&&(l=b[1].toLowerCase(),a=a.substr(b[0].length));var j=[];do b=a.match(/^#([-_0-9A-Za-z]+)/),f(b)&&(a="[id="+b[1]+"]"+a.substr(b[0].length)),b=a.match(/^\.([-_0-9A-Za-z]+)/),f(b)&&(a="[class~="+b[1]+"]"+a.substr(b[0].length)),b=a.match(/^\[([-_0-9A-Za-z]+)(?:(=|~=|\|=|\^=|\$=|\*=)(?:([^'"][^\]]*)|'((?:[^']|\\')*)'|"((?:[^"]|\\")*)"))?\]/),f(b)?
function(){var c=b[1],d=b[2],g="";f(b[3])&&b[3]!=""?g=b[3]:f(b[4])&&b[4]!=""?g=b[4].replace(/\\'/g,"'"):f(b[5])&&b[5]!=""&&(g=b[5].replace(/\\"/g,'"'));a=a.substr(b[0].length);var h;d=="="?h=RegExp("^"+q.escapeRegex(g)+"$"):d=="~="?h=RegExp("(^|\\s)"+q.escapeRegex(g)+"(\\s|$)"):d=="|="?h=RegExp("^"+q.escapeRegex(g)+"(-|$)"):d=="^="?h=RegExp("^"+q.escapeRegex(g)):d=="$="?h=RegExp(q.escapeRegex(g)+"$"):d=="*="&&(h=RegExp(q.escapeRegex(g)));j.push(function(a){return a.attributes&&a.attributes[c]&&(f(h)&&
h.test(a.attributes[c].value)||!f(h)&&a.attributes[c].specified)})}():(b=a.match(/^:first-child/),f(b)?(a=a.substr(b[0].length),j.push(function(a){for(var b=a.parentNode.childNodes,c=0;c<b.length;c++)if(b[c].nodeType==1)return b[c]==a})):(b=a.match(/^:last-child/),f(b)?(a=a.substr(b[0].length),j.push(function(a){for(var b=a.parentNode.childNodes,c=b.length-1;c>=0;c--)if(b[c].nodeType==1)return b[c]==a})):(b=a.match(/^:first-of-type/),f(b)?(a=a.substr(b[0].length),j.push(function(a){for(var b=a.parentNode.childNodes,
c=0;c<b.length;c++)if(b[c].nodeType==1&&b[c].tagName.toLowerCase()==a.tagName.toLowerCase())return b[c]==a})):(b=a.match(/^:last-of-type/),f(b)?(a=a.substr(b[0].length),j.push(function(a){for(var b=a.parentNode.childNodes,c=b.length-1;c>=0;c--)if(b[c].nodeType==1&&b[c].tagName.toLowerCase()==a.tagName.toLowerCase())return b[c]==a})):(b=a.match(/^:only-child/),f(b)?(a=a.substr(b[0].length),j.push(function(a){a=a.parentNode.childNodes;for(var b=0,c=0;c<a.length;c++)a[c].nodeType==1&&b++;return b==1})):
(b=a.match(/^:only-of-type/),f(b)?(a=a.substr(b[0].length),j.push(function(a){for(var b=a.parentNode.childNodes,c=0,d=0;d<b.length;d++)b[d].nodeType==1&&b[d].tagName.toLowerCase()==a.tagName.toLowerCase()&&c++;return c==1})):(b=a.match(/^:empty/),f(b)?(a=a.substr(b[0].length),j.push(function(a){return a.childNodes.length==0})):(b=a.match(/^:enabled/),f(b)?(a=a.substr(b[0].length),j.push(function(a){return!a.disabled})):(b=a.match(/^:disabled/),f(b)?(a=a.substr(b[0].length),j.push(function(a){return a.disabled})):
(b=a.match(/^:checked/),f(b)?(a=a.substr(b[0].length),j.push(function(a){return a.checked})):(b=a.match(/^:contains\((?:([^'"][^\]]*)|'((?:[^']|\\')*)'|"((?:[^"]|\\")*)")\)/),f(b)&&function(){var c="";f(b[1])&&b[1]!=""?c=b[1]:f(b[2])&&b[2]!=""?c=b[2].replace(/\\'/g,"'"):f(b[3])&&b[3]!=""&&(c=b[3].replace(/\\"/g,'"'));a=a.substr(b[0].length);j.push(function(a){return(f(a.innerText)?a.innerText:a.textContent).indexOf(c)!=-1})}())))))))))));while(f(b));if(l==""&&j.length==0)return!1;l==""&&(l="*");h.push({comb:d,
element:l,specs:j})}h.length>0&&g.push(h);var k=function(a,b){if(b.length===1)return!0;pe=b[b.length-1];b=b.slice(0,-1);e=b[b.length-1];if(pe.comb===""){for(;a.parentNode&&(!(e.element==="*"||a.parentNode.nodeName.toLowerCase()===e.element)||!o.all(e.specs,a.parentNode)||!k(a.parentNode,b));)a=a.parentNode;return!!a.parentNode}if(pe.comb===">")return a.parentNode&&(e.element==="*"||a.parentNode.nodeName.toLowerCase()===e.element)&&o.all(e.specs,a.parentNode)&&k(a.parentNode,b);if(pe.comb==="~"){for(;a.previousSibling&&
!(a.previousSibling.nodeType===1&&(e.element==="*"||a.previousSibling.nodeName.toLowerCase()===e.element)&&o.all(e.specs,a.previousSibling)&&k(a.previousSibling,b));)a=a.previousSibling;return!!a.previousSibling}if(pe.comb==="+"){for(;a.previousSibling&&a.previousSibling.nodeType!==1;)a=a.previousSibling;return a.previousSibling&&a.previousSibling.nodeType===1&&(e.element==="*"||a.previousSibling.nodeName.toLowerCase()===e.element)&&o.all(e.specs,a.previousSibling)&&k(a.previousSibling,b)}return!1};
l=[];for(var i=0;i<g.length;i++){h=g[i];var m=h[h.length-1];d=c.getElementsByTagName(m.element);d=o.filter(d,function(a){return o.all(m.specs,a)&&k(a,h)});l=l.concat(d)}return o.uniq(l)},addEvent:function(a,b,c,d){if(!d){if(b=="textchanged")return[k.addEvent(a,"input",c,!0),k.addEvent(a,"propertychange",c,!0)];if(b=="transitionend")return[k.addEvent(a,"transitionend",c,!0),k.addEvent(a,"webkitTransitionEnd",c,!0),k.addEvent(a,"oTransitionEnd",c,!0)]}d=function(a){a=a||event;if(!a.target&&a.srcElement)a.target=
a.srcElement;if(f(a.button))if(coati.browser.ie())if(a.button&1)a.mouseButton=0;else if(a.button&2)a.mouseButton=2;else{if(a.button&4)a.mouseButton=1}else a.mouseButton=a.button;var b;b=c(a);if(b===!1)return a.cancelBubble=!0,a.stopPropagation&&a.stopPropagation(),a.returnValue=!1,a.preventDefault&&a.preventDefault(),!1;if(s(b))return a.returnValue=b;return!0};var g=b;b=="domload"&&(b="DOMContentLoaded",g="load");a=n(a);if(f(a))return a.addEventListener?a.addEventListener(b,d,!1):a.attachEvent?a.attachEvent("on"+
g,d):a["on"+g]=d,{o:a,n:b,cn:g,f:d}},removeEvent:function(a){y(a)||(a=[a]);a=o.flatten(a);v(a,function(a){a.o.addEventListener?a.o.removeEventListener(a.n,a.f,!1):a.o.attachEvent?a.o.detachEvent("on"+a.cn,a.f):a.o["on"+a.cn]=void 0})},addHistoryChangedHandler:function(a){j.push(a);if(j.length==1)g=window.location.hash,setInterval(function(){if(window.location.hash!=g)g=window.location.hash,k.onHistoryChanged()},100)},onHistoryChanged:function(){v(j,function(a){a()})},whenDomLoaded:function(a){l?a():
k.addEvent(window,"domload",a)},isDomLoaded:function(){return l},setDomLoaded:function(){l=!0},whenPageLoaded:function(a){h?a():k.addEvent(window,"load",a)},isPageLoaded:function(){return h},setPageLoaded:function(){h=!0},keyNames:{8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",45:"Insert",46:"Delete",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",
56:"8",57:"9",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",91:"WinLeft",92:"WinRight",93:"AppMenu",96:"Num0",97:"Num1",98:"Num2",99:"Num3",100:"Num4",101:"Num5",102:"Num6",103:"Num7",104:"Num8",105:"Num9",106:"Multiply",107:"Add",109:"Subtract",111:"Divide",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",
144:"NumLock",145:"ScrollLock",170:"Search",172:"Web",180:"Mail"},addKeyEvent:function(a,b,c){return k.addEvent(a,"keydown",function(a){try{if(k.isKeyName(a,b))return c(a)}catch(d){coati.errorMessage("Exception caught while processing the key event handler for "+b+":\n"+coati.formatException(d))}})},addGlobalKeyEvent:function(a,b){return k.addKeyEvent(document,a,b)},removeKeyEvent:function(a){k.removeEvent(a)},keyCodeFromName:function(a){for(var b in i.keyNames)if(i.keyNames[b]==a)return b;return 0},
keyNameFromCode:function(a){if(a in i.keyNames)return i.keyNames[a];return""},isKeyName:function(a,b){var d=!1,g=!1,h=!1,l=!1;do d=!1,q.startsWith(b,"Alt+")&&(g=!0,b=b.substr(4),d=!0),q.startsWith(b,"Ctrl+")&&(h=!0,b=b.substr(5),d=!0),q.startsWith(b,"Shift+")&&(l=!0,b=b.substr(6),d=!0);while(d);if(g^a.altKey)return!1;if(h^a.ctrlKey)return!1;if(l^a.shiftKey)return!1;return c(a)==k.keyCodeFromName(b)},getKeyName:function(a){var b="";a.ctrlKey&&(b+="Ctrl+");a.shiftKey&&(b+="Shift+");a=c(a);var d=k.keyNameFromCode(a);
b+=d?d:"<"+a+">";return b},insertText:function(a,b,c){s(a)&&(a=n(a));if(a.selectionStart>=0){var d=a.selectionStart,g=a.selectionEnd,h=g-d,l=a.scrollTop,j=a.scrollLeft;if(f(c)){for(;g-d>1&&a.value.substr(d,1).match(/\s/);)d--;for(;g-d>1&&a.value.substr(g-1,1).match(/\s/);)g--}var k=a.value.substring(0,d),i=a.value.substring(d,g),m=a.value.substring(g,a.textLength);h>0?f(c)?i.substring(0,b.length)==b&&i.substring(i.length-c.length,i.length)==c?(i=i.substring(b.length,i.length-c.length),g-=b.length+
c.length):(i=b+i+c,g+=b.length+c.length):(i=b,d=g=d+b.length):(i=b+(f(c)?c:""),d=g=d+b.length);a.value=k+i+m;a.selectionStart=d;a.selectionEnd=g;a.focus();a.scrollTop=l;a.scrollLeft=j}else alert("Your browser does not support this operation.")},insertLineStart:function(a,b){s(a)&&(a=n(a));if(a.selectionStart>=0){for(var c=a.selectionStart,d=a.selectionEnd,g=a.scrollTop,h=a.scrollLeft;d-c>1&&a.value.substr(d-1,1)=="\n";)d--;for(;c>0;c--)if(a.value.charCodeAt(c)==10){c++;break}for(;d<a.value.length-
1;d++)if(a.value.charCodeAt(d)==10)break;var l=a.value.substring(0,c),f=a.value.substring(c,d),j=a.value.substring(d,a.textLength),k=f.length;f=f.replace(/\n(?!$)/g,"\n"+b);k=f.length-k;k+=b.length;a.value=l+b+f+j;a.selectionStart=c;a.selectionEnd=d+k;a.focus();a.scrollTop=g;a.scrollLeft=h}else alert("Your browser does not support this operation.")}};return i}(),fx:function(){function c(){j.length==1&&k.addEvent(window,"popstate",function(b){if(b.state&&b.state.coati=="image-zoom")for(var c=0;c<j.length;c++)if(j[c].url==
b.state.url){j[c].action(void 0,!0);break}})}var b,d,g,j=[];return{makeTextAutoHeight:function(b,c,d){c=c||3;d=d||15;s(b)&&(b=n(b));var a=document.createElement("div");a.style.position="relative";a.style.width=k.width(b)+"px";b.parentNode.replaceChild(a,b);b.style.boxSizing="border-box";b.style.MozBoxSizing="border-box";b.style.MsBoxSizing="border-box";b.style.WebkitBoxSizing="border-box";b.style.height="100%";b.style.position="absolute";b.style.width="100%";b.style.resize="none";a.appendChild(b);
var g=k.getEffectiveStyle(b,"line-height");g=g&&g.match(/px/)?parseInt(g):0;var f=document.createElement("div");f.style.boxSizing="border-box";f.style.MozBoxSizing="border-box";f.style.MsBoxSizing="border-box";f.style.WebkitBoxSizing="border-box";f.style.width="100%";f.style.whiteSpace="pre-wrap";f.style.visibility="hidden";g?(f.style.minHeight=c*g+1+"px",f.style.maxHeight=d*g+1+"px"):(f.style.minHeight=c*1.4+"em",f.style.maxHeight=d*1.4+"em");a.appendChild(f);var j=function(a,c){var d=k.getEffectiveStyle(b,
a);c&&(d=parseInt(d)+c+"px");f.style[q.toCamelCase(a)]=d};c=function(){var a=b.value;a=a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\r/g,"");var c=a.substr(a.length-1)=="\n";coati.browser.ie()&&(a=a.replace(/\n/g,"<br />").replace(/  /g,"&nbsp; ").replace(/  /g,"&nbsp; "));c&&(a+=".");f.innerHTML=a;j("padding-top",1);j("padding-right",1);j("padding-bottom",1);j("padding-left",1);j("border-top-width");j("border-right-width");j("border-bottom-width");j("border-left-width");
j("border-top-style");j("border-right-style");j("border-bottom-style");j("border-left-style");j("font-family");j("font-size");j("font-style");j("line-height")};k.addEvent(b,"textchanged",c);c()},makeImageZoomable:function(l,h,i,a,m){function n(a,c){if(!f(d)&&!f(g)&&!f(b)){var j=document.createElement("img");d=j;k.addEvent(j,"load",q);k.addEvent(j,"error",A);l.style.cursor="wait";j.src=h;if(history.pushState){c||history.pushState({coati:"image-zoom",url:h},"");var i=k.addEvent(window,"popstate",function(a){if(!f(a.state)||
a.state.coati!="image-zoom")k.removeEvent(i),p()})}}}function A(){l.style.cursor="pointer";d=void 0;alert(coati.getConfigValue("zoomableimage.loaderror","Error loading this image."))}function q(){l.style.cursor="pointer";o=parseInt(coati.dom.getEffectiveStyle(l,"padding-top"));var c=d.style;c.boxShadow="0 2px 8px rgba(0, 0, 0, 0.5)";c.border="solid "+o+"px #f6f6f6";var h=document.createElement("div"),j=h.style;j.position="fixed";j.zIndex="900";j.top=0;j.left=0;j.width="1000%";j.height="10000%";j.backgroundColor=
r.getConfigValue("imagezoom.backcolor","#808080");if(f(j.WebkitTapHighlightColor))j.WebkitTapHighlightColor="rgba(0,0,0,0)";k.setOpacity(h,0);document.body.appendChild(h);b=h;s=k.left(l);t=k.top(l);w=k.width(l)-2*o;x=k.height(l)-2*o;c.position="absolute";c.zIndex="901";c.left=s+"px";c.top=t+"px";c.width=w+"px";c.height=x+"px";document.body.appendChild(d);k.addEvent(d,"click",G);k.addEvent(h,"click",G);var n=i,A=a,p=k.windowClientWidth(),K=k.windowClientHeight(),L=10;p<500&&(L=0);n=Math.min(i,p-(30+
2*L));A=n/i*a;A=Math.min(A,K-95);n=A/a*i;var J=k.scrollX()+p/2-n/2-15||0,z=k.scrollY()+K*0.47-A/2-15||0;z<10&&(z=10);if(v){g=document.createElement("div");var E=g.style;E.visibility="hidden";E.position="absolute";E.zIndex="901";E.width=n+"px";E.left=J+15+"px";E.top=z+15+A+10+"px";g.innerHTML=m;document.body.appendChild(g);k.addEvent(g,"click",G)}if(p=coati.browser.transition())c[p]="left 0.3s, top 0.3s, width 0.3s, height 0.3s, border-width 0.3s, opacity 0.3s",j[p]="opacity 0.3s",u=!0;y.push(k.addGlobalKeyEvent("Escape",
G));var B;p=function(){B&&k.removeEvent(B);if(v)E.visibility=""};if(u)coati.defer(function(){c.left=J+"px";c.top=z+"px";c.width=n+"px";c.height=A+"px";c.borderWidth="15px";if(v)c.borderBottomWidth=10+k.height(g)+15+"px";j.opacity=I},50),B=k.addEvent(d,"transitionend",p);else if(new coati.animation({o:d,type:"left",end:J,duration:150,play:!0}),new coati.animation({o:d,type:"top",end:z,duration:150,play:!0}),new coati.animation({o:d,type:"width",end:n,duration:150,play:!0}),new coati.animation({o:d,
type:"height",end:A,duration:150,play:!0,onfinished:p}),coati.browser.ie()&&coati.browser.ieVersion()<9?k.setOpacity(h,I):new coati.animation({o:h,type:"opacity",end:I,duration:150,play:!0}),c.borderWidth="15px",v)c.borderBottomWidth=10+k.height(g)+15+"px"}function G(){history.pushState?history.back():p()}function p(){k.removeEvent(y);f(g)&&(g.parentNode.removeChild(g),g=void 0);if(f(d)&&f(b))if(u){var a=d.style;a.left=s+"px";a.top=t+"px";a.width=w+"px";a.height=x+"px";a.borderWidth=o+"px";b.style.opacity=
0;k.addEvent(d,"transitionend",function(){d&&d.parentNode&&(d.parentNode.removeChild(d),d=void 0);b&&b.parentNode&&(b.parentNode.removeChild(b),b=void 0)})}else new coati.animation({o:b,type:"opacity",start:I,end:0,duration:150,play:!0}),new coati.animation({o:d,type:"left",end:s,duration:150,play:!0}),new coati.animation({o:d,type:"top",end:t,duration:150,play:!0}),new coati.animation({o:d,type:"width",end:w,duration:150,play:!0}),new coati.animation({o:d,type:"height",end:x,duration:150,play:!0,
onfinished:function(){d.parentNode.removeChild(d);d=void 0;b.parentNode.removeChild(b);b=void 0}})}var v=f(m)&&m!="";l.style.cursor="pointer";k.addEvent(l,"click",n);j.push({url:h,action:n});c();var o,s,t,w,x,u,y=[],I=0.8},slideshow:function(b,c){function d(){n=(m+1)%i.length;k.show(i[n]);j?(coati.defer(function(){i[m].style.opacity=0;i[n].style.opacity=1},50),p=k.addEvent(i[n],"transitionend",a),setTimeout(g,1500)):(new coati.animation({o:i[m],type:"opacity",start:1,end:0,play:!0}),new coati.animation({o:i[n],
type:"opacity",start:0,end:1,play:!0,onfinished:a}))}function a(){p&&(k.removeEvent(p),p=void 0);k.hide(i[m]);m=n;setTimeout(d,c*1E3)}function g(){p&&a()}var j=coati.browser.transition(),i=[],m=0,n,p;f(c)||(c=6);b=$(b);for(var q=0;q<b.childNodes.length;q++){var o=b.childNodes[q];o.nodeType==1&&o.nodeName.toLowerCase()=="div"&&(i.length>0&&(k.hide(o),k.setOpacity(o,0)),j&&(o.style[j]="opacity 1s"),i.push(o))}setTimeout(d,c*1E3)}}}(),webrequest:function(){return{asyncRequest:function(c,b,d,g,j){b=b.toUpperCase();
if(b!="GET"&&b!="POST")return coati.errorMessage("parameter method is invalid: "+b,"asyncRequest"),!1;var l="";if(z(d))for(var h in d)C(d[h])||w(d[h])||s(d[h])?l+=(l!=""?"&":"")+h+"="+encodeURIComponent(d[h]):y(d[h])&&v(d[h],function(a){l+=(l!=""?"&":"")+h+"[]="+encodeURIComponent(a)});else if(s(d))l=d;else if(!f(d))return b=="POST"?coati.errorMessage("parameter data is unset but POST method was requested","asyncRequest"):coati.errorMessage("parameter data is invalid","asyncRequest"),!1;d=!1;if(window.XMLHttpRequest)try{d=
new XMLHttpRequest}catch(i){}else if(window.ActiveXObject)try{d=new ActiveXObject("Msxml2.XMLHTTP")}catch(a){try{d=new ActiveXObject("Microsoft.XMLHTTP")}catch(k){}}if(!d)return coati.errorMessage("Browser does not support any kind of XMLHttpRequest object","asyncRequest"),!1;g=function(a,b,c,d){if(!B(b))return coati.errorMessage("parameter eventHandler is not a function","asyncRequest, makeRequestHandler"),!1;if(f(d)&&!B(d))return coati.errorMessage("parameter errorHandler is not a function","asyncRequest, makeRequestHandler"),
!1;return function(){if(a.readyState==4)if(a.status==200)try{b(a)}catch(g){coati.errorMessage("Exception caught while processing the server response:\n"+coati.formatException(g))}else if(f(d))try{d(a)}catch(h){coati.errorMessage("Exception caught while processing the server error response:\n"+coati.formatException(h))}else coati.errorMessage("Server responded with error code "+a.status+" ("+a.statusText+")\nURL: "+c)}}(d,g,c,j);if(g==!1)return coati.errorMessage("handler factory did not return a function",
"asyncRequest"),!1;d.open(b,c,!0);d.onreadystatechange=g;l!=""&&d.setRequestHeader("Content-Type","application/x-www-form-urlencoded");d.send(l);return!0},asyncGet:function(c,b,d){return coati.webrequest.asyncRequest(c,"GET",null,b,d)},asyncPost:function(c,b,d,g){return coati.webrequest.asyncRequest(c,"POST",b,d,g)},getErrorType:function(c){if(c!=null&&(c=c.getElementsByTagName("error")[0]))return c.getAttribute("type")},getErrorValue:function(c){return coati.webrequest.getValue(c,"error")},getResultValue:function(c){return coati.webrequest.getValue(c,
"result")},getValue:function(c,b,d,g){if(c!=null)if(f(d)||(d=!1),f(g)||(g=!1),c=c.getElementsByTagName(b),c.length==1&&!d||c.length>0&&g)return c[0].firstChild?c[0].firstChild.nodeValue:"";else if(c.length>0||d){d=[];for(g=0;g<c.length;g++)d.push(c[g].firstChild?c[g].firstChild.nodeValue:"");return d}}}}(),color:function(){var c={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",
blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",
darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",
ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",
magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",
palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",
tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};return{parse:function(b,d){if(z(b)&&w(b.R)&&w(b.G)&&w(b.B)){if(d)return{R:Math.round(b.R),G:Math.round(b.G),B:Math.round(b.B)};return b}if(s(b)){var g;if(g=b.match(/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i))return{R:parseInt(g[1],16),G:parseInt(g[2],16),B:parseInt(g[3],16)};if(g=b.match(/^#?([0-9a-f])([0-9a-f])([0-9a-f])$/i))return{R:parseInt(g[1]+
g[1],16),G:parseInt(g[2]+g[2],16),B:parseInt(g[3]+g[3],16)};if(g=b.match(/^rgb\s*\(\s*([0-9]{1,3})\s*%\s*,\s*([0-9]{1,3})\s*%\s*,\s*([0-9]{1,3})\s*%\s*\)$/i))return coati.color.parse({R:+g[1]*2.55,G:+g[2]*2.55,B:+g[3]*2.55},d);if(g=b.match(/^rgb\s*\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)$/i))return{R:+g[1],G:+g[2],B:+g[3]};if(g=b.match(/^hsl\s*\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*%\s*,\s*([0-9]{1,3})\s*%\s*\)$/i))return coati.color.hsl2rgb({H:+g[1],S:+g[2]/100,L:+g[3]/100});
if(c[b.toLowerCase()])return coati.color.parse(c[b.toLowerCase()])}if(w(b)&&b>=0&&b<=16777215)return{R:b&255,G:(b&65280)>>8,B:(b&16711680)>>16}},systemColor:function(){},name:function(b){b=coati.color.toHtml(b);if(f(b))return o.findValue(c,b)},toCss:function(b){b=coati.color.parse(b,!0);if(f(b))return"rgb("+b.R+", "+b.G+", "+b.B+")"},toHtml:function(b){b=coati.color.parse(b,!0);if(f(b))return("#"+Math.min(Math.max(b.R,0),255).toString(16).pad(2,"0",!0)+Math.min(Math.max(b.G,0),255).toString(16).pad(2,
"0",!0)+Math.min(Math.max(b.B,0),255).toString(16).pad(2,"0",!0)).toLowerCase()},toInt:function(b){b=coati.color.parse(b,!0);if(f(b))return(b.B<<16)+(b.G<<8)+b.R},rgb2hsl:function(b){b=coati.color.parse(b);if(f(b)){var c={},g=b.R/255,j=b.G/255;b=b.B/255;var l=Math.min(g,j,b),h=Math.max(g,j,b);c.L=(h+l)/2;if(h==l)c.H=0;else if(h==g)c.H=60*(j-b)/(h-l)%360;else if(h==j)c.H=(60*(b-g)/(h-l)+120)%360;else if(h==b)c.H=(60*(g-j)/(h-l)+240)%360;c.H<0&&(c.H+=360);c.S=h==l?0:c.L<=0.5?(h-l)/(2*c.L):(h-l)/(2-
2*c.L);return c}},hsl2rgb:function(b){var c={},g=b.L<0.5?b.L*(1+b.S):b.L+b.S-b.L*b.S,f=2*b.L-g;b=b.H/360;var l={R:b+1/3,G:b,B:b-1/3};v(["R","G","B"],function(b){l[b]<0&&l[b]++;l[b]>1&&l[b]--;c[b]=l[b]<1/6?f+(g-f)*6*l[b]:l[b]<0.5?g:l[b]<2/3?f+(g-f)*6*(2/3-l[b]):f;c[b]*=255});return c},isHsl:function(b){return z(b)&&w(b.H)&&w(b.S)&&w(b.L)},blend:function(b,c,g){var j=coati.color.isHsl(b);j&&(b=coati.color.hsl2rgb(b));coati.color.isHsl(c)&&(c=coati.color.hsl2rgb(c));b=coati.color.parse(b);c=coati.color.parse(c);
g=Math.min(Math.max(g,0),1);if(f(b)&&f(c))return b={R:b.R+(c.R-b.R)*g,G:b.G+(c.G-b.G)*g,B:b.B+(c.B-b.B)*g},j?coati.color.rgb2hsl(b):b},complementary:function(b){var c=coati.color.isHsl(b);c||(b=coati.color.rgb2hsl(b));b.H=(b.H+180)%360;return!c?coati.color.hsl2rgb(b):b},lighten:function(b,c){var g=coati.color.isHsl(b);g||(b=coati.color.rgb2hsl(b));b.L+=c*(1-b.L);return!g?coati.color.hsl2rgb(b):b},darken:function(b,c){var g=coati.color.isHsl(b);g||(b=coati.color.rgb2hsl(b));b.L*=1-c;return!g?coati.color.hsl2rgb(b):
b},grey:function(b){var c=coati.color.isHsl(b);c&&(b=coati.color.hsl2rgb(b));b=coati.color.parse(b,!0);if(f(b))return b=b.R*0.3+b.G*0.59+b.B*0.11,b={R:b,G:b,B:b},c?coati.color.rgb2hsl(b):b}}}(),animation:function(c){function b(){var b=h;y(b)&&(b=b[0]);if(!f(a)&&f(b))switch(i){case "height":a=k.height(b);break;case "left":a=k.left(b);break;case "opacity":a=k.getOpacity(b);break;case "scroll-h":a=h.scrollLeft;break;case "scroll-v":a=h.scrollTop;break;case "top":a=k.top(b);break;case "width":a=k.width(b);
break;case "background-color":case "border-bottom-color":case "border-left-color":case "border-right-color":case "border-top-color":case "color":a=k.getEffectiveStyle(b,i);break;case "border-bottom-width":case "border-left-width":case "border-right-width":case "border-top-width":case "bottom":case "font-size":case "letter-spacing":case "line-height":case "margin-bottom":case "margin-left":case "margin-right":case "margin-top":case "max-height":case "max-width":case "min-height":case "min-width":case "padding-bottom":case "padding-left":case "padding-right":case "padding-top":case "right":a:{b=
k.getEffectiveStyle(b,i);var c=b.match(/([0-9.]+)(px|pt)/);if(c)switch(c[2]){case "px":a=+c[1];break a}a=b==="normal"?0:void 0}}!p(i,"color")&&n&&(m+=a);p(i,"color")&&(a=coati.color.parse(a),m=coati.color.parse(m))}function d(){var b=0;b=D/o;if(r==="sine")b=Math.sin(1.5*Math.PI+b*Math.PI),b=(b+1)/2;else if(r==="exp")b=Math.pow(b,Math.pow(2,t));else if(r==="sexp"){var c=Math.pow(2,t);b=b<=0.5?Math.pow(b*2,c)/2:1-Math.pow(1-(b-0.5)*2,c)/2}var d;d=p(i,"color")?coati.color.blend(a,m,b):i==="opacity"?
a+(m-a)*b:Math.round(a+(m-a)*b);b=y(h)?h:[h];v(b,function(a){switch(i){case "opacity":k.setOpacity(a,d);break;case "scroll-h":a.scrollLeft=d;break;case "scroll-v":a.scrollTop=d;break;case "background-color":case "border-bottom-color":case "border-left-color":case "border-right-color":case "border-top-color":case "color":a.style[q.toCamelCase(i)]=coati.color.toCss(d);break;case "border-bottom-width":case "border-left-width":case "border-right-width":case "border-top-width":case "bottom":case "font-size":case "height":case "left":case "letter-spacing":case "line-height":case "margin-bottom":case "margin-left":case "margin-right":case "margin-top":case "max-height":case "max-width":case "min-height":case "min-width":case "padding-bottom":case "padding-left":case "padding-right":case "padding-top":case "right":case "top":case "width":a.style[q.toCamelCase(i)]=
d+"px"}})}function g(){D+=1E3/s;if(D>=o)C=void 0,u.finish(!1),B(u.onfinished)&&coati.defer(function(){u.onfinished(u)},1),z(u.next)&&"play"in u.next&&coati.defer(u.next.play,1);else if(F=o<=0?0:D/o,d(),C=setTimeout(g,1E3/s),B(u.onstep))u.onstep(u)}var j=[],l=[],h,i="",a,m,n=!1,o=1E3,s=40,r="sexp",t=1,w=!1,x=[],D=0,C,H=!1,F=0,u={onfinished:void 0,onstep:void 0,next:void 0,progress:function(){return F},playing:function(){return H},setDefaults:function(c){"o"in c&&!p(j,"o")&&(h=M(c.o),h.length==1&&(h=
h[0]));if("type"in c&&!p(j,"type"))i=c.type;if("rel"in c&&!p(j,"rel"))n=c.rel;if("end"in c&&!p(j,"end"))m=c.end,p(j,"start")||(alert(1),a=void 0);if("start"in c&&!p(j,"start"))a=c.start;if("duration"in c&&!p(j,"duration"))o=c.duration;if("method"in c&&!p(j,"method"))r=c.method;if("param"in c&&!p(j,"param"))t=c.param;if("fps"in c&&!p(j,"fps"))u.fps=c.fps;b();v(l,function(a){a.setDefaults(c)})},attach:function(b){var c={o:h,type:i,duration:o,method:r,param:t,fps:u.fps};if(p(j,"start"))c.start=a;if(p(j,
"end"))c.end=m;if(p(j,"rel"))c.rel=n;y(b)||(b=[b]);v(b,function(a){a.setDefaults(c);l.push(a)});return u},setDuration:function(a){o=a;j.push("duration");v(l,function(b){b.setDuration(a)})},setMethod:function(a,b){r=a;t=b;j.push("method");j.push("param");v(l,function(c){c.setMethod(a,b)})},setFPS:function(a){s=a;j.push("fps");v(l,function(b){b.setFPS(a)})},play:function(){u.reset();u.resume()},halt:function(){clearTimeout(C);H=!1;v(l,function(a){a.halt()})},resume:function(){if(o<=0)return!1;if(s<
1)return!1;H=!0;g();v(l,function(a){a.play()})},reset:function(){F=D=0;d();v(l,function(a){a.reset()})},finish:function(a){D=o;F=1;d();H=!1;(!f(a)||a!==!1)&&v(l,function(a){a.finish()})},reverse:function(){var b=a;a=m;m=b;D=o-D;F=1-F;v(l,function(a){a.reverse()})},getObject:function(){return h}};if(y(c)){var N=c.shift();x=c;c=N}"o"in c&&(j.push("o"),h=M(c.o),h.length==1&&(h=h[0]));if("type"in c)j.push("type"),i=c.type;if("start"in c)j.push("start"),a=c.start;if("end"in c)j.push("end"),m=c.end;if("rel"in
c)j.push("rel"),n=c.rel;if("duration"in c)j.push("duration"),o=c.duration;if("method"in c)j.push("method"),r=c.method;if("param"in c)j.push("param"),t=c.param;if("fps"in c)j.push("fps"),s=c.fps;if("play"in c)w=c.play;if("onfinished"in c)u.onfinished=c.onfinished;if("onstep"in c)u.onstep=c.onstep;if("next"in c)u.next=c.next;b();v(x,function(a){u.attach(new coati.animation(a))});w&&u.play();return u},form:function(c){function b(b){switch(b.nodeName.toLowerCase()){case "input":switch(b.type){case "button":case "hidden":case "password":case "submit":case "text":case "textarea":return b.value;
case "checkbox":if(b.checked)return b.value;return"";case "radio":if(b.checked)return b.value}break;case "textarea":return b.value;case "select":if(b.multiple){for(var c=[],d=0;d<b.options.length;d++)b.options[d].selected&&c.push(b.options[d].value);return c}return b.value}}c=n(c);var d={getFieldElement:function(b){for(var d=0;d<c.elements.length;d++){var f=c.elements[d];if(f.name==b)return f}if(b=="submit")for(d=0;d<c.elements.length;d++)if(f=c.elements[d],f.tagName.toLowerCase()=="input"&&f.type.toLowerCase()==
"submit")return f},getValue:function(d){for(var j=0;j<c.elements.length;j++){var i=c.elements[j];if(i.name==d&&(i=b(i),f(i)))return i}},getData:function(d){for(var j={},i=0;i<c.elements.length;i++){var h=c.elements[i];h.name!=""&&!p(d,h.name)&&(f(j[h.name])?y(j[h.name])?j[h.name].push(b(h)):j[h.name]=[j[h.name],b(h)]:j[h.name]=b(h))}return j},getDataString:function(b){b=d.getData(b);var c="",f;for(f in b){var h=b[f];C(h)||w(h)||s(h)?c+=(c!=""?"&":"")+f+"="+encodeURIComponent(h):y(h)&&v(h,function(b){c+=
(c!=""?"&":"")+f+"="+encodeURIComponent(b)})}return c},setValue:function(b,d){for(var f=0;f<c.elements.length;f++){var h=c.elements[f];if(h.name==b){switch(h.nodeName.toLowerCase()){case "input":switch(h.type){case "button":case "hidden":case "password":case "submit":case "text":case "textarea":h.value=d;break;case "checkbox":h.checked=coati.isTrue(d);break;case "radio":h.checked=h.value==d}break;case "textarea":h.value=d;break;case "select":if(h.multiple)for(f=0;f<h.options.length;f++)h.options[f].selected=
p(d,h.options[f].value);else h.value=d}return}}if(b=="submit")for(f=0;f<c.elements.length;f++)if(h=c.elements[f],h.tagName.toLowerCase()=="input"&&h.type.toLowerCase()=="submit"){h.value=d;break}},removeAllOptions:function(b){b=d.getFieldElement(b);if(b.nodeName.toLowerCase()=="select")for(;b.hasChildNodes();)b.removeChild(b.firstChild)},addOption:function(b,c,f){b=d.getField(b);if(b.nodeName.toLowerCase()=="select"){var h=document.createElement("option"),i=document.createAttribute("value");i.nodeValue=
c;h.setAttributeNode(i);h.appendChild(document.createTextNode(f));b.appendChild(h)}},addSubmitHandler:function(b){coati.dom.addEvent(c,"submit",function(d){d=b(d,c);if(!f(d))return!0;return d})},addFieldHandler:function(b,d,i,h){f(h)||(h=!0);for(var m=new coati.popup("popup-error"),a=0;a<c.elements.length;a++)if(c.elements[a].name==b){var n=c.elements[a],o=function(a){a=d(a,n,c);return s(a)&&a!=""?(k.addClass(n,"checkError"),a!=""&&m.popup(n,a,3),n.focus(),!1):(k.removeClass(n,"checkError"),m.hide(),
!0)};if(i)k.addEvent(c,"submit",o);else{k.addEvent(n,"keyup",o);k.addEvent(n,"click",o);k.addEvent(n,"change",o);h&&setTimeout(function(){o(null,n)},200);var p=k.findParentByName(n,"label");p&&k.addEvent(p,"click",o)}}}};return d},popup:function(c){var b,d=0,f=0,i=!0,l,h={move:function(c,a){d=c;f=a;b.style.left=d+"px";b.style.top=f+"px"},moveBelow:function(b){h.move(k.left(b)+8,k.bottom(b)-4)},show:function(){l&&clearTimeout(l);i=!0;b.style.display=""},hide:function(){l&&(clearTimeout(l),l=void 0);
i=!1;new coati.animation({o:b,type:"opacity",start:1,end:0,play:!0,onfinished:h.hideFast})},hideFast:function(){l&&(clearTimeout(l),l=void 0);i=!1;b.style.display="none";k.setOpacity(b,1)},hideTimeout:function(b){l&&(clearTimeout(l),l=void 0);l=setTimeout(h.hide,b*1E3)},popup:function(b,a,c){h.hideFast();h.setText(a);h.moveBelow(b);h.show();h.hideTimeout(c)},visible:function(){return i},setText:function(c){b.innerHTML=c;c==""&&h.hide()}};b=document.createElement("div");b.style.position="absolute";
k.addClass(b,"coati-popup");k.addClass(b,c);h.hideFast();coati.dom.whenDomLoaded(function(){document.body.appendChild(b)});return h}},f=r.isSet,w=r.isNumber,C=r.isBoolean,s=r.isString,y=r.isArray,z=r.isObject,B=r.isFunction,o=r.array,p=r.array.contains,v=r.array.each,q=r.string,k=r.dom,n=r.dom.select,M=r.dom.selectAll;return r}();$=coati.dom.select;$$=coati.dom.selectAll;coati.dom.whenDomLoaded(function(){coati.dom.setDomLoaded()});coati.dom.whenPageLoaded(function(){coati.dom.setPageLoaded()});function updateContentHeight(){var m=coati.dom.height("#page-header");$("#page-content").style.paddingTop=m+16+"px"}coati.dom.whenDomLoaded(updateContentHeight);var activeTab={},tabHeaders={},tabPages={};
function activateTab(m,t){activeTab[m]&&(coati.dom.hide(tabPages[m][activeTab[m]]),coati.dom.removeClass(tabHeaders[m][activeTab[m]],"selected"));activeTab[m]=t;activeTab[m]&&(coati.dom.show(tabPages[m][activeTab[m]]),coati.dom.addClass(tabHeaders[m][activeTab[m]],"selected"));updateContentHeight()}
function initializeTabs(m){tabHeaders[m]={};tabPages[m]={};var t;coati.array.each($$("#"+m+" a"),function(x){var i=x.getAttribute("data-tabpage");t||(t=i);tabHeaders[m][i]=x;tabPages[m][i]=$("#"+i);coati.dom.addKeyEvent(x,"Enter",function(r){activeTab[m]!=i?activateTab(m,i):activateTab(m,void 0);r.target.blur()});coati.dom.addEvent(x,"mousedown",function(r){r.button==0&&(activeTab[m]!=i?activateTab(m,i):activateTab(m,void 0),r.target.blur())});coati.dom.hide(tabPages[m][i])});activateTab(m,t)}
function filterOpChanged(m){var t=m.getAttribute("data-column");m.value=="between"?coati.dom.show("#input_"+t+"_value2"):coati.dom.hide("#input_"+t+"_value2");m.value=="isnull"?coati.dom.hide("#input_"+t+"_value"):coati.dom.show("#input_"+t+"_value")}function removeFilterColumn(m){(m=$("#filter_row_"+m))&&m.parentNode.removeChild(m)}var trdict={};
function addFilterColumn(m,t){if(!$("#filter_row_"+m)){var x=trdict["coltype:"+m],i="";i+='<tr class="va" id="filter_row_'+m+'">';i+="<td>";i+='<a href="javascript:undefined" onclick="removeFilterColumn(\''+m+'\')" title="'+trdict["remove column"]+'">'+trdict["icon.delete"]+"</a>";i+='<span title="'+t+'">'+trdict["column:"+m]+'<input type="hidden" name="filtercol[]" value="'+m+'"></span>';i+="</td>";i+='<td><label><input type="checkbox" name="'+m+'_not" value="1">'+trdict.not+"</label></td>";i+='<td><select name="'+
m+'_op" id="filterop_'+m+'" onchange="filterOpChanged(this)" data-column="'+m+'">';switch(x){case "int":i+='<option value="eq">=</option>';i+='<option value="lt">&lt;</option>';i+='<option value="lte">&#x2264;</option>';i+='<option value="gt">&gt;</option>';i+='<option value="gte">&#x2265;</option>';i+='<option value="ne">&#x2260;</option>';i+='<option value="between">'+trdict["op:between"]+"</option>";i+='<option value="isnull">'+trdict["op:isnull"]+"</option>";break;case "datetime":i+='<option value="eq">=</option>';
i+='<option value="lt">&lt;</option>';i+='<option value="lte">&#x2264;</option>';i+='<option value="gt">&gt;</option>';i+='<option value="gte">&#x2265;</option>';i+='<option value="ne">&#x2260;</option>';i+='<option value="between">'+trdict["op:between"]+"</option>";i+='<option value="inday">'+trdict["op:inday"]+"</option>";i+='<option value="inmonth">'+trdict["op:inmonth"]+"</option>";i+='<option value="inyear">'+trdict["op:inyear"]+"</option>";i+='<option value="isnull">'+trdict["op:isnull"]+"</option>";
break;case "bool":i+='<option value="eq">'+trdict.set+"</option>";i+='<option value="isnull">'+trdict["op:isnull"]+"</option>";break;case "string":i+='<option value="eq">=</option>',i+='<option value="lt">&lt;</option>',i+='<option value="lte">&#x2264;</option>',i+='<option value="gt">&gt;</option>',i+='<option value="gte">&#x2265;</option>',i+='<option value="ne">&#x2260;</option>',i+='<option value="between">'+trdict["op:between"]+"</option>",i+='<option value="contains">'+trdict["op:contains"]+
"</option>",i+='<option value="startswith">'+trdict["op:startswith"]+"</option>",i+='<option value="endswith">'+trdict["op:endswith"]+"</option>",i+='<option value="isnull">'+trdict["op:isnull"]+"</option>"}i+="</select></td>";i+="<td>";switch(x){case "int":i+='<span id="input_'+m+'_value">';i+='<input type="text" name="'+m+'_value" size="20"> ';i+='<span id="input_'+m+'_value2">';i+=trdict["op:between-and"]+' <input type="text" name="'+m+'_value2" size="20">';i+="</span>";i+="</span>";break;case "datetime":i+=
'<span id="input_'+m+'_value">';i+='<input type="text" name="'+m+'_value" size="20"> ';i+='<span id="input_'+m+'_value2">';i+=trdict["op:between-and"]+' <input type="text" name="'+m+'_value2" size="20">';i+="</span>";i+="</span>";break;case "bool":i+='<input type="hidden" name="'+m+'_value" value="1">';break;case "string":i+='<span id="input_'+m+'_value">',i+='<input type="text" name="'+m+'_value" size="35"> ',i+='<span id="input_'+m+'_value2">',i+=trdict["op:between-and"]+' <input type="text" name="'+
m+'_value2" size="15">',i+="</span>",i+="</span>"}i+="</td>";i+='<td><label><input type="checkbox" name="'+m+'_disabled" value="1">'+trdict.disabled+"</label></td>";i+="</tr>";$("#filter-table").innerHTML+=i;filterOpChanged($("#filterop_"+m))}activateTab("addColumnsTab","filterTab")};
