// dynamic-lib: JavaScript function library for easy DOM, AJAX and more
// (c) Yves Goergen, http://beta.unclassified.de/code/html-css-js/dynamic-lib/
// See the website for licensing details.

var runtimeConfigStore={};setErrorMessages(true);function setErrorMessages(show){setConfigValue('showErrorMessages',show?true:false);setConfigValue('showErrorMessages.counter',0);}function errorMessage(msg,context){if(getConfigValue('showErrorMessages',false)&&msg!=""){if(getConfigValue('showErrorMessages.counter',0)>=3)return;if(!isSet(context))context="";var AFn="";for(var i=0;i<9+(context.length*0.85);i++)AFn+=String.fromCharCode(0xAF);setConfigValue('showErrorMessages.counter',getConfigValue('showErrorMessages.counter',0)+1);alert((context?"Context: "+context+"\n"+AFn+"\n":"")+msg);setConfigValue('showErrorMessages.counter',getConfigValue('showErrorMessages.counter',0)-1);}}function formatException(ex){try{var nbsp=String.fromCharCode(160);var nbsp8=nbsp+nbsp+nbsp+nbsp+nbsp+nbsp+nbsp+nbsp;var msg="";msg+="Exception: "+ex.name+"\n";msg+="Message: "+ex.message+"\n";if(ex.fileName)msg+="Code: "+ex.fileName+":"+ex.lineNumber+"\n";if(ex.stack)msg+="Stack:\n"+nbsp8+ex.stack.trim().replace(/\r/g,"").replace(/^((?:.*?\n){25}).*$/,"$1").replace(/(^|\n)(.{150}).*?(?=\n|$)/g,"$1$2").replace(/\n/g,"\n"+nbsp8)+"\n";return msg;}catch(ex2){if(ex2.stack)return "Error formatting exception: "+ex2+"\n\nInner exception: "+ex;else return "Error formatting exception:\n"+inspectObject(ex2,false,true)+"\nInner exception:\n"+inspectObject(ex,false,true);}}function isSet(o){return typeof o!="undefined"&&o!=null;}function isString(o){return typeof o=="string";}function isObject(o){return typeof o=="object";}function isArray(o){return typeof o=="object"&&o instanceof Array;}function isFunction(o){return typeof o=="function";}function isNumber(o){return typeof o=="number";}function isBoolean(o){return typeof o=="boolean";}function isNumeric(o){return isNumber(o)||isString(o)&&o.search(/^-?[0-9]+(.[0-9]+)?$/)!=-1;}function isEven(x){return isNumber(x)&&x%2==0;}function isOdd(x){return isNumber(x)&&x%2==1;}function isTrue(x){if(!isSet(x))return false;if(isString(x))return x.trim()!=""&&x.trim()!="0"&&x.trim().toLowerCase()!="false";if(isObject(x))return x!=null;if(isArray(x))return x.length>0;if(isNumber(x))return x!=0;if(isBoolean(x))return x;return false;}function includeSource(url){var script=document.createElement("script");script.setAttribute("type","text/javascript");script.setAttribute("src",url);document.getElementsByTagName("head")[0].appendChild(script);}function evalCode(code){try{eval(code);}catch(ex){errorMessage("Exception caught while eval'ing code:\n"+formatException(ex),"evalCode");}}function defer(f,t,clr){if(!this.memory)this.memory={};var id=this.memory.findValue(f);if(clr&&id){clearTimeout(id);this.memory[id]=undefined;}id=setTimeout(f,t);this.memory[id]=f;}function getLocalTimezone(){var localclock=new Date();return-localclock.getTimezoneOffset();}function getURLDirectoryName(url){return url.replace(/([^/]*)$/,"");}function getURLFileName(url){return url.replace(/^(.*\/)([^/]*)$/,"$2");}function formatNumber(num,dec){if(isNaN(num))return num;if(!isSet(dec))dec=0;var factor=Math.pow(10,dec);num=Math.round(num*factor)/factor;var str=num+"";if(dec>0){if(str.indexOf(".")==-1)str+=".";while(str.length-str.indexOf(".")-1<dec)str+="0";}return str.replace(/\./,",");}function setConfigValue(name,value){runtimeConfigStore[name]=value;}function getConfigValue(name,def){var value=runtimeConfigStore[name];if(!isSet(value))value=def;return value;}if(!Array.prototype.indexOf){Array.prototype.indexOf=function(o,s){if(!isSet(s))s=0;if(s<0)s+=this.length;if(s<0)s=0;for(;s<this.length;s++)if(this[s]===o)return s;return-1;};}if(!Array.prototype.lastIndexOf){Array.prototype.lastIndexOf=function(o,s){var l=this.length;if(!isSet(s))s=l-1;if(s<0)s+=l;if(s>l-1)s=l-1;for(;s>=0;s--)if(this[s]===o)return s;return-1;};}Array.prototype.contains=function(o){for(var i=0;i<this.length;i++)if(this[i]===o)return true;return false;};Array.prototype.each=function(f){for(var i=0;i<this.length;i++)if(i in this)f(this[i],i);};Array.prototype.flatten=function(){var a=[];for(var i=0;i<this.length;i++)if(i in this)a=a.concat(this[i]instanceof Array?this[i].flatten():this[i]);return a;};if(!Array.prototype.map){Array.prototype.map=function(f){var a=new Array(this.length);for(var i=0;i<this.length;i++)if(i in this)a[i]=f(this[i],i);return a;};}Array.prototype.filter=function(f){var out=[];for(var i=0;i<this.length;i++)if(i in this&&f(this[i],i))out.push(this[i]);return out;};Array.prototype.remove=function(o){return this.filter(function(x){return x!=o});};Array.prototype.removeAt=function(n){if(n<0)n+=this.length;return this.filter(function(x,i){return n!=i});};Array.prototype.uniq=function(){var out=[];for(var i=0;i<this.length;i++)if(i in this&&!out.contains(this[i]))out.push(this[i]);return out;};Array.prototype.clone=function(){var out=[];for(var i=0;i<this.length;i++)if(i in this)out[i]=this[i];return out;};Array.prototype.none=function(arg){for(var i=0;i<this.length;i++)if(i in this&&this[i](arg))return false;return true;};Array.prototype.any=function(arg){for(var i=0;i<this.length;i++)if(i in this&&this[i](arg))return true;return false;};Array.prototype.all=function(arg){for(var i=0;i<this.length;i++)if(i in this&&!this[i](arg))return false;return true;};Object.prototype.findValue=function(o){for(var prop in this)if(this[prop]===o)return prop;};Object.prototype.containsValue=function(o){return this.findValue(o)!==false?true:false;};String.prototype.contains=function(str){return this.indexOf(str)!=-1;};String.prototype.trimStart=function(c){if(isSet(c)){for(var i=0;i<this.length&&c.contains(this.charAt(i));i++){}return this.substr(i);}return this.replace(/^\s+/,"");};String.prototype.trimEnd=function(c){if(isSet(c)){for(var i=this.length-1;i>=0&&c.contains(this.charAt(i));i--){}return this.substr(0,i+1);}return this.replace(/\s+$/,"");};String.prototype.trim=function(c){return this.trimStart(c).trimEnd(c);};String.prototype.startsWith=function(str){if(!isString(str))return false;return this.substr(0,str.length)==str;};String.prototype.endsWith=function(str){if(!isString(str))return false;return this.substr(this.length-str.length,str.length)==str;};String.prototype.pad=function(minLength,ch,atBegin){var out=this;if(!isSet(ch))ch=" ";while(out.length<minLength)if(atBegin)out=ch+out;else out+=ch;return out;};String.prototype.repeat=function(n){var a="";while(n--)a+=this;return a;};String.prototype.escapeXml=function(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");};String.prototype.escapeRegex=function(){return this.replace(/([$^*+.?\\()/|\[\]{}])/g,"\\$1");};String.prototype.escapeRegexCC=function(){return this.replace(/([-\\^\[\]])/g,"\\$1");};String.prototype.encodeUri=function(){return encodeURIComponent(this).replace(/%20/g,"+").replace(/%2C/g,",");};String.prototype.toCamelCase=function(sep){sep=sep||"-";var parts=this.split(sep);var ret=parts[0];for(var i=1;i<parts.length;i++)ret+=parts[i].charAt(0).toUpperCase()+parts[i].substr(1);return ret;};function getCookie(n){var vars=document.cookie.split(";");for(var i=0;i<vars.length;i++){var parts=vars[i].trim().split("=");if(parts[0]==n&&isString(parts[1]))return decodeURIComponent(parts[1].replace(/\+/," "));}return undefined;}function setCookie(n,v,lifetime,path){var addStr="";if(lifetime){var time=new Date();time.setTime(time.getTime()+lifetime*86400*1000);addStr+="; expires="+time.toGMTString();}if(path){addStr+="; path="+path;}document.cookie=n+"="+encodeURIComponent(v)+addStr;}function openPopup(url,n,w,h){var win=window.open(url,n,"width="+w+", height="+h+", resizable=yes, dependent=yes, scrollbars=yes");if(!win){alert(getConfigValue("popupblockernote","Please deactivate your popup blocker to see the popup window."));}else{win.focus();try{DOMKeyEvents.add(win,"Escape",win.close);}catch(ex){}}}function openPopupLink(link,n,w,h){openPopup(link.href,n,w,h);return false;}var DOM=function(){var scrollTimeout=false;var scrollOffset=0;var prevLocationHash;var historyChangedHandlers=[];var thisModule={top:function(o){o=$(o);if(!isSet(o))return 0;var top=o.offsetTop;while(o=o.offsetParent)top+=o.offsetTop;return top;},left:function(o){o=$(o);if(!isSet(o))return 0;var left=o.offsetLeft;while(o=o.offsetParent)left+=o.offsetLeft;return left;},bottom:function(o){o=$(o);return thisModule.top(o)+thisModule.height(o);},right:function(o){o=$(o);return thisModule.left(o)+thisModule.width(o);},width:function(o){o=$(o);if(!isSet(o))return 0;return o.offsetWidth;},height:function(o){o=$(o);if(!isSet(o))return 0;return o.offsetHeight;},resizeVert:function(o,cy,negative){o=$(o);if(!isSet(o))return;var newCy=o.clientHeight+cy;var minCy=0;var maxCy=1000;if(o.tagName.toLowerCase()=="textarea")minCy=60;if(newCy<minCy)newCy=minCy;if(newCy>maxCy)newCy=maxCy;var diffY=newCy-o.clientHeight;o.style.height=newCy+"px";if(negative==true)window.scrollBy(0,diffY);},moveTo:function(o,x,y){o=$(o);if(!isSet(o))return;o.style.left=x+"px";o.style.top=y+"px";},moveBy:function(o,dx,dy){o=$(o);if(!isSet(o))return;o.style.left=(parseInt(o.style.left)+dx)+"px";o.style.top=(parseInt(o.style.top)+dy)+"px";},resizeTo:function(o,w,h){o=$(o);if(!isSet(o))return;o.style.width=w+"px";o.style.height=h+"px";},resizeBy:function(o,dx,dy){o=$(o);if(!isSet(o))return;o.style.width=(parseInt(o.style.width)+dx)+"px";o.style.height=(parseInt(o.style.height)+dy)+"px";},unsetSize:function(o){o=$(o);if(!isSet(o))return;o.style.width="";o.style.height="";},windowClientWidth:function(){if(isSet(window.innerWidth))return window.innerWidth;if(document.documentElement.clientWidth>0)return document.documentElement.clientWidth;if(isSet(document.body.clientWidth))return document.body.clientWidth;return undefined;},windowClientHeight:function(){if(isSet(window.innerHeight))return window.innerHeight;if(document.documentElement.clientHeight>0)return document.documentElement.clientHeight;if(isSet(document.body.clientHeight))return document.body.clientHeight;return undefined;},toggleVisible:function(o,state){o=$(o);if(!isSet(o))return-1;if(!isSet(state))newstate=(o.style.display=="")?"none":"";else newstate=state?"":"none";o.style.display=newstate;return newstate==""?1:-1;},show:function(o){return thisModule.toggleVisible(o,true);},hide:function(o){return thisModule.toggleVisible(o,false);},visible:function(o){o=$(o);if(!isSet(o))return false;return o.style.display!="none";},toggleEnabled:function(o,state){o=$(o);if(!isSet(o))return false;if(state==null)newstate=!o.disabled;else newstate=!state;o.disabled=newstate;return!newstate;},enable:function(o){return thisModule.toggleEnabled(o,true);},disable:function(o){return thisModule.toggleEnabled(o,false);},enabled:function(o){o=$(o);if(!isSet(o))return false;return!o.disabled;},disableAsync:function(o){o=$(o);window.setTimeout(function(){if(o){o.blur();o.disabled=true;}},50);},toggleSelected:function(o){o=$(o);if(thisModule.hasClass(o,"selected")){thisModule.removeClass(o,"selected");return false;}thisModule.addClass(o,"selected");return true;},scrollX:function(v){if(isSet(window.pageXOffset))if(isSet(v)){window.scrollTo(v,thisModule.scrollY());return v;}else return window.pageXOffset;if(document.compatMode=="CSS1Compat")if(isSet(v))return document.documentElement.scrollLeft=v;else return document.documentElement.scrollLeft;else if(isSet(v))return document.body.scrollLeft=v;else return document.body.scrollLeft;},scrollY:function(v){if(isSet(window.pageYOffset))if(isSet(v)){window.scrollTo(thisModule.scrollX(),v);return v;}else return window.pageYOffset;if(document.compatMode=="CSS1Compat")if(isSet(v))return document.documentElement.scrollTop=v;else return document.documentElement.scrollTop;else if(isSet(v))return document.body.scrollTop=v;else return document.body.scrollTop;},scrollDownBy:function(o){o=$(o);window.scrollBy(0,thisModule.height(o));},scrollUpBy:function(o){o=$(o);window.scrollBy(0,-thisModule.height(o));},setAnchorScrollOffset:function(y){scrollOffset=y;},scrollToAnchor:function(){try{clearTimeout(scrollTimeout);}catch(ex){}var url=window.location.href;var id="";var id_pos=url.lastIndexOf("#");if(id_pos>0)id=url.substring(id_pos+1,url.length);else  if(id!=""){var o=$(id);if(!isSet(o))return;var top=thisModule.top(o)-7+scrollOffset;window.scrollTo(0,top);}},scrollToObject:function(o){o=$(o);if(!isSet(o))return;var top=thisModule.top(o)-7+scrollOffset;window.scrollTo(0,top);},autoScrollToAnchor:function(){DOMEvents.add(window,"load",thisModule.scrollToAnchor);scrollTimeout=setTimeout(thisModule.scrollToAnchor,1000);},toggleVisibleScroll:function(o){o=$(o);if(!isSet(o))return;if(o.style.display==""){window.scrollBy(0,-thisModule.height(o));newstate="none";o.style.display=newstate;}else{newstate="";o.style.display=newstate;window.scrollBy(0,thisModule.height(o));}return(newstate==""?1:-1);},setImageCond:function(o,cond,trueimg,falseimg){$(o).src=cond?trueimg:falseimg;},hasClass:function(o,n){o=$(o);if(!isSet(o)||!isSet(o.className))return false;var cn=o.className.split(" ");var req=n.split(" ");req=req.filter(function(x){return!cn.contains(x);});return req.length==0;},getClasses:function(o){o=$(o);if(!isSet(o)||!isSet(o.className))return "";return o.className.split(" ");},addClass:function(o,n){o=$(o);if(!isSet(o)||!isSet(o.className))return;var cn=o.className.split(" ");var req=n.split(" ");req.each(function(x){if(x.length>0&&!cn.contains(x))cn.push(x);});o.className=cn.join(" ");},removeClass:function(o,n){o=$(o);if(!isSet(o)||!isSet(o.className))return;var cn=o.className.split(" ");var req=n.split(" ");cn=cn.filter(function(x){return!req.contains(x);});o.className=cn.join(" ");},toggleClass:function(o,n,state){o=$(o);if(!isSet(o)||!isSet(o.className))return;var req=n.split(" ");req.each(function(n){if(state>0||!isSet(state)&&!thisModule.hasClass(o,n))thisModule.addClass(o,n);else thisModule.removeClass(o,n);});},addPageStyle:function(css){var style=document.createElement("style");style.setAttribute("type","text/css");try{style.appendChild(document.createTextNode(css));}catch(ex){errorMessage(formatException(ex),"DOM.addPageStyle");}document.getElementsByTagName("head")[0].appendChild(style);},getEffectiveStyle:function(o,n){o=$(o);if(!isSet(o))return undefined;if(document.defaultView&&document.defaultView.getComputedStyle)return document.defaultView.getComputedStyle(o,"").getPropertyValue(n);if(o.currentStyle)return o.currentStyle[n.toCamelCase()];errorMessage("Browser does not support retrieval of effective style","DOM.getEffectiveStyle");},getOpacity:function(o){o=$(o);if(!isSet(o))return undefined;if(o.filters&&o.filters.alpha&&isNumber(o.filters.alpha.opacity))return o.filters.alpha.opacity/100;if(isSet(o.style.opacity)&&o.style.opacity!="")return o.style.opacity;return 1;},setOpacity:function(o,opacity){o=$(o);if(!isSet(o))return;if(isSet(o.style.opacity))o.style.opacity=opacity;else if(isSet(o.style.filter))o.style.filter=(opacity===1)?"":"Alpha(opacity="+(opacity*100)+")";},findParentByName:function(o,n){o=$(o);if(!isSet(o))return undefined;while(o.nodeName.toLowerCase()!=n){if(!o.parentNode)return undefined;o=o.parentNode;}return o;},findParentByClass:function(o,n){o=$(o);if(!isSet(o))return undefined;while(!thisModule.hasClass(o,n)){if(!o.parentNode)return undefined;o=o.parentNode;}return o;},addHistoryChangedHandler:function(h){historyChangedHandlers.push(h);if(historyChangedHandlers.length==1){prevLocationHash=window.location.hash;setInterval(function(){if(window.location.hash!=prevLocationHash){prevLocationHash=window.location.hash;thisModule.onHistoryChanged();}},100);}},onHistoryChanged:function(){historyChangedHandlers.each(function(h){h();});}}; return thisModule;}();$=function(id){if(isString(id))return document.getElementById(id.trimStart("#"));return id;};var DOMEvents=function(){var pageLoaded=false;function findEvent(e){e=e||event;if(!e.target&&e.srcElement)e.target=e.srcElement;if(isSet(e.button)){if (/*@cc_on!@*/false){if(e.button&1)e.mouseButton=0;else if(e.button&2)e.mouseButton=2;else if(e.button&4)e.mouseButton=1;}else e.mouseButton=e.button;}return e;}var thisModule={add:function(o,n,handler){if(n=="textchanged")return[this.add(o,"input",handler),this.add(o,"propertychange",handler)];var wrappedHandler=function(e){e=findEvent(e);var res;try{res=handler(e);}catch(ex){errorMessage(formatException(ex),"Event handler function");}if(res===false){e.cancelBubble=true;if(e.stopPropagation)e.stopPropagation();  e.returnValue=false;if(e.preventDefault)e.preventDefault();return false;}return true;};var cn=n;if(n=="domload"){n="DOMContentLoaded";cn="load";}o=$(o);if(!isSet(o))return;if(o.addEventListener)o.addEventListener(n,wrappedHandler,false);else if(o.attachEvent)o.attachEvent("on"+cn,wrappedHandler);else o["on"+cn]=wrappedHandler; return{"o":o,"n":n,"cn":cn,"f":wrappedHandler};},remove:function(h){if(!isArray(h))h=[h];h.flatten().each(function(h){if(h.o.addEventListener)h.o.removeEventListener(h.n,h.f,false);else if(h.o.attachEvent)h.o.detachEvent("on"+h.cn,h.f);else h.o["on"+h.cn]=undefined;});},whenLoaded:function(fn){if(pageLoaded)fn();else this.add(window,"load",fn);},isLoaded:function(){return pageLoaded;}};  thisModule.whenLoaded(function(){pageLoaded=true;});return thisModule;}();var DOMKeyEvents=function(){function findKeyCode(e){if(e.data)return e.data;if(e.which)return e.which;return e.keyCode;}this.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"};return{add:function(o,keyName,handler){var my_this=this;return DOMEvents.add(o,"keydown",function(e){try{if(my_this.isKeyName(e,keyName))return handler(e);}catch(ex){errorMessage("Exception caught while processing the key event handler for "+keyName+":\n"+formatException(ex));}});},addGlobal:function(keyName,handler){return this.add(document,keyName,handler);},remove:function(h){DOMEvents.remove(h);},altPressed:function(e){return e.altKey;},ctrlPressed:function(e){return e.ctrlKey;},shiftPressed:function(e){return e.shiftKey;},keyCodeFromName:function(n){for(var c in keyNames)if(keyNames[c]==n)return c;return 0;},keyNameFromCode:function(c){if(keyNames.containsKey(c))return keyNames[c];return "";},isKeyName:function(e,n){var modifier=false;var modAlt=false;var modCtrl=false;var modShift=false;do{modifier=false;if(n.startsWith("Alt+")){modAlt=true;n=n.substr(4);modifier=true;}if(n.startsWith("Ctrl+")){modCtrl=true;n=n.substr(5);modifier=true;}if(n.startsWith("Shift+")){modShift=true;n=n.substr(6);modifier=true;}}while(modifier);if(modAlt ^ this.altPressed(e))return false;if(modCtrl ^ this.ctrlPressed(e))return false;if(modShift ^ this.shiftPressed(e))return false;return findKeyCode(e)==this.keyCodeFromName(n);},getKeyName:function(e){var n="";if(this.ctrlPressed(e))n+="Ctrl+";if(this.shiftPressed(e))n+="Shift+";var keyCode=findKeyCode(e);var singleName=this.keyNameFromCode(keyCode);if(singleName)n+=singleName;else n+="<"+keyCode+">";return n;}}}();$=function(q,o){if(!isString(q))return q;var a=$$(q,o);if(isArray(a)&&a.length>=1)return a[0];};$$=function(q,o){if(!isString(q))return q;if(!isSet(o)&&(m=q.match(/^#([-_0-9A-Za-z]+)$/)))return[document.getElementById(m[1])];if(isArray(o)){var nodes=[];for(var oi=0;oi<o.length;oi++)nodes=nodes.concat(arguments.callee(q,o[oi]));return nodes.uniq();}if(isString(o))o=document.getElementById(o);if(!isSet(o))o=document;q=q.trim();var groups=[];var elements=[];while(q.length>0){if(elements.length>0){var m=q.match(/^\s*,\s*/);if(isSet(m)){groups.push(elements);elements=[];q=q.substr(m[0].length);}}var comb="";if(elements.length>0){var m=q.match(/^(\s*[>+~]\s*|\s+)/);if(isSet(m)){comb=m[1].trim();q=q.substr(m[0].length);}else return false;}var element="";var m=q.match(/^([-_0-9A-Za-z]+|\*)/);if(isSet(m)){element=m[1].toLowerCase();q=q.substr(m[0].length);}var specs=[];do{m=q.match(/^#([-_0-9A-Za-z]+)/);if(isSet(m))q="[id="+m[1]+"]"+q.substr(m[0].length);  m=q.match(/^\.([-_0-9A-Za-z]+)/);if(isSet(m))q="[class~="+m[1]+"]"+q.substr(m[0].length);  m=q.match(/^\[([-_0-9A-Za-z]+)(?:(=|~=|\|=|\^=|\$=|\*=)(?:([^'"][^\]]*)|'((?:[^']|\\')*)'|"((?:[^"]|\\")*)"))?\]/);if(isSet(m)){(function(){var attrName=m[1];var op=m[2];var val="";if(isSet(m[3])&&m[3]!="")val=m[3];else if(isSet(m[4])&&m[4]!="")val=m[4].replace(/\\'/g,"'");else if(isSet(m[5])&&m[5]!="")val=m[5].replace(/\\"/g,'"');q=q.substr(m[0].length);var regex;if(op=="=")regex=new RegExp("^"+val.escapeRegex()+"$");else if(op=="~=")regex=new RegExp("(^|\\s)"+val.escapeRegex()+"(\\s|$)");else if(op=="|=")regex=new RegExp("^"+val.escapeRegex()+"(-|$)");else if(op=="^=")regex=new RegExp("^"+val.escapeRegex());else if(op=="$=")regex=new RegExp(val.escapeRegex()+"$");else if(op=="*=")regex=new RegExp(val.escapeRegex());specs.push(function(node){return node.attributes&&node.attributes[attrName]&&(isSet(regex)&&regex.test(node.attributes[attrName].value)||!isSet(regex)&&node.attributes[attrName].specified);});})();continue;}m=q.match(/^:first-child/);if(isSet(m)){q=q.substr(m[0].length);specs.push(function(node){var pcn=node.parentNode.childNodes;for(var i=0;i<pcn.length;i++)if(pcn[i].nodeType==1)return pcn[i]==node;});continue;}m=q.match(/^:last-child/);if(isSet(m)){q=q.substr(m[0].length);specs.push(function(node){var pcn=node.parentNode.childNodes;for(var i=pcn.length-1;i>=0;i--)if(pcn[i].nodeType==1)return pcn[i]==node;});continue;}m=q.match(/^:first-of-type/);if(isSet(m)){q=q.substr(m[0].length);specs.push(function(node){var pcn=node.parentNode.childNodes;for(var i=0;i<pcn.length;i++)if(pcn[i].nodeType==1&&pcn[i].tagName.toLowerCase()==node.tagName.toLowerCase())return pcn[i]==node;});continue;}m=q.match(/^:last-of-type/);if(isSet(m)){q=q.substr(m[0].length);specs.push(function(node){var pcn=node.parentNode.childNodes;for(var i=pcn.length-1;i>=0;i--)if(pcn[i].nodeType==1&&pcn[i].tagName.toLowerCase()==node.tagName.toLowerCase())return pcn[i]==node;});continue;}m=q.match(/^:only-child/);if(isSet(m)){q=q.substr(m[0].length);specs.push(function(node){var pcn=node.parentNode.childNodes;var c=0;for(var i=0;i<pcn.length;i++)if(pcn[i].nodeType==1)c++;return c==1;});continue;}m=q.match(/^:only-of-type/);if(isSet(m)){q=q.substr(m[0].length);specs.push(function(node){var pcn=node.parentNode.childNodes;var c=0;for(var i=0;i<pcn.length;i++)if(pcn[i].nodeType==1&&pcn[i].tagName.toLowerCase()==node.tagName.toLowerCase())c++;return c==1;});continue;}m=q.match(/^:empty/);if(isSet(m)){q=q.substr(m[0].length);specs.push(function(node){return node.childNodes.length==0;});continue;}m=q.match(/^:enabled/);if(isSet(m)){q=q.substr(m[0].length);specs.push(function(node){return!node.disabled;});continue;}m=q.match(/^:disabled/);if(isSet(m)){q=q.substr(m[0].length);specs.push(function(node){return node.disabled;});continue;}m=q.match(/^:checked/);if(isSet(m)){q=q.substr(m[0].length);specs.push(function(node){return node.checked;});continue;}m=q.match(/^:contains\((?:([^'"][^\]]*)|'((?:[^']|\\')*)'|"((?:[^"]|\\")*)")\)/);if(isSet(m)){(function(){var val="";if(isSet(m[1])&&m[1]!="")val=m[1];else if(isSet(m[2])&&m[2]!="")val=m[2].replace(/\\'/g,"'");else if(isSet(m[3])&&m[3]!="")val=m[3].replace(/\\"/g,'"');q=q.substr(m[0].length);specs.push(function(node){return(isSet(node.innerText)?node.innerText:node.textContent).indexOf(val)!=-1;});})();continue;}}while(isSet(m));if(element==""&&specs.length==0)return false;if(element=="")element="*";elements.push({"comb":comb,"element":element,"specs":specs});} if(elements.length>0)groups.push(elements);var checkNode=function(node,elements){if(elements.length===1)return true;pe=elements[elements.length-1];elements=elements.slice(0,-1);e=elements[elements.length-1];if(pe.comb===""){while(node.parentNode&&!((e.element==="*"||node.parentNode.nodeName.toLowerCase()===e.element)&&e.specs.all(node.parentNode)&&checkNode(node.parentNode,elements)))node=node.parentNode;return!!node.parentNode;}if(pe.comb===">"){return(node.parentNode&&(e.element==="*"||node.parentNode.nodeName.toLowerCase()===e.element)&&e.specs.all(node.parentNode)&&checkNode(node.parentNode,elements));}if(pe.comb==="~"){while(node.previousSibling&&!(node.previousSibling.nodeType===1&&(e.element==="*"||node.previousSibling.nodeName.toLowerCase()===e.element)&&e.specs.all(node.previousSibling)&&checkNode(node.previousSibling,elements)))node=node.previousSibling;return!!node.previousSibling;}if(pe.comb==="+"){while(node.previousSibling&&node.previousSibling.nodeType!==1)node=node.previousSibling;return(node.previousSibling&&node.previousSibling.nodeType===1&&(e.element==="*"||node.previousSibling.nodeName.toLowerCase()===e.element)&&e.specs.all(node.previousSibling)&&checkNode(node.previousSibling,elements));}return false;};var foundNodes=[];for(var gi=0;gi<groups.length;gi++){var elements=groups[gi];var e0=elements[elements.length-1];var nodes=o.getElementsByTagName(e0.element);nodes.filter=Array.prototype.filter;nodes=nodes.filter(function(node){return e0.specs.all(node)&&checkNode(node,elements);});foundNodes=foundNodes.concat(nodes);}return foundNodes.uniq();};var WebRequest=function(){return{asyncRequest:function(url,method,data,eventHandler,errorHandler){function makeRequestHandler(request,eventHandler,url,errorHandler){if(!isFunction(eventHandler)){errorMessage("parameter eventHandler is not a function","asyncRequest, makeRequestHandler");return false;}if(isSet(errorHandler)&&!isFunction(errorHandler)){errorMessage("parameter errorHandler is not a function","asyncRequest, makeRequestHandler");return false;}return function(){if(request.readyState==4){if(request.status==200){try{eventHandler(request);}catch(ex){errorMessage("Exception caught while processing the server response:\n"+formatException(ex));}}else{if(isSet(errorHandler)){try{errorHandler(request);}catch(ex){errorMessage("Exception caught while processing the server error response:\n"+formatException(ex));}}else{errorMessage("Server responded with error code "+request.status+" ("+request.statusText+")\n"+"URL: "+ url);}}}}}method=method.toUpperCase();if(method!="GET"&&method!="POST"){errorMessage("parameter method is invalid: "+method,"asyncRequest");return false;}var dataToSend="";if(isObject(data))for(var property in data){if(isBoolean(data[property])||isNumber(data[property])||isString(data[property]))dataToSend+=(dataToSend!=""?"&":"")+property+"="+encodeURIComponent(data[property]);else if(isArray(data[property]))data[property].each(function(o){dataToSend+=(dataToSend!=""?"&":"")+property+"[]="+encodeURIComponent(o);});}else if(isString(data))dataToSend=data;else if(!isSet(data))if(method=="POST"){errorMessage("parameter data is unset but POST method was requested","asyncRequest");return false;}else{errorMessage("parameter data is invalid","asyncRequest");return false;}var request=false;if(window.XMLHttpRequest)try{request=new XMLHttpRequest();}catch(ex){}else if(window.ActiveXObject)try{request=new ActiveXObject("Msxml2.XMLHTTP");}catch(ex){try{request=new ActiveXObject("Microsoft.XMLHTTP");}catch(ex){}}if(!request){errorMessage("Browser does not support any kind of XMLHttpRequest object","asyncRequest");return false;}var handler=makeRequestHandler(request,eventHandler,url,errorHandler);if(handler==false){errorMessage("handler factory did not return a function","asyncRequest");return false;}request.open(method,url,true);request.onreadystatechange=handler;if(dataToSend!="")request.setRequestHeader('Content-Type','application/x-www-form-urlencoded');request.send(dataToSend);return true;},asyncGet:function(url,eventHandler,errorHandler){return this.asyncRequest(url,"GET",null,eventHandler,errorHandler);},asyncPost:function(url,data,eventHandler,errorHandler){return this.asyncRequest(url,"POST",data,eventHandler,errorHandler);},getErrorType:function(xml){if(xml==null)return undefined;var n=xml.getElementsByTagName("error")[0];if(n)return n.getAttribute("type");},getErrorValue:function(xml){return this.getValue(xml,"error");},getResultValue:function(xml){return this.getValue(xml,"result");},getValue:function(xml,name,forceArray,onlyFirst){if(xml==null)return undefined;if(!isSet(forceArray))forceArray=false;if(!isSet(onlyFirst))onlyFirst=false;var n=xml.getElementsByTagName(name);if(n.length==1&&!forceArray||n.length>0&&onlyFirst){return n[0].firstChild?n[0].firstChild.nodeValue:"";}else if(n.length>0||forceArray){var a=new Array();for(var i=0;i<n.length;i++){a.push(n[i].firstChild?n[i].firstChild.nodeValue:"");}return a;}}}}();function DragController(){var cursorX=0;var cursorY=0;var origLeft=0;var origTop=0;var origRight=0;var origBottom=0;var origCursor="";var mode="";var dragging=false;var attachedObject=undefined;var events=undefined;var boundsContainer=undefined;var minimumSize=undefined;var startdragHandlers=new Array();var moveHandlers=new Array();var dropHandlers=new Array();var snapToObjects=new Array();var allowResize=false;var allowResizeDiag=true;var resizeMargin=15;var snapDistance=10;var bringToFront=false;var keepInFront=false;var dc_this=this;function getPos(e){var x=e.clientX;var y=e.clientY;x+=DOM.scrollX();y+=DOM.scrollY();return[x,y];}function storePos(e){var p=getPos(e);cursorX=p[0];cursorY=p[1];}this.setMode=function(m){mode=m;if(mode=="")attachedObject.style.cursor="move";else attachedObject.style.cursor=mode+"-resize";};this.setResizeable=function(b){allowResize=b;};this.attach=function(o){if(isSet(attachedObject)){this.detach();}attachedObject=$(o);origCursor=attachedObject.style.cursor;this.setMode("");events={};events.md=DOMEvents.add(attachedObject,"mousedown",function(e){if(e.mouseButton!=0)return true;origLeft=DOM.left(attachedObject);origTop=DOM.top(attachedObject);origRight=DOM.right(attachedObject);origBottom=DOM.bottom(attachedObject);function prepareStartdragHandler(){return{"left":origLeft,"top":origTop,"right":origRight,"bottom":origBottom,"mode":mode};}var deny=false;startdragHandlers.each(function(f){if(!f(prepareStartdragHandler()))deny=true;});if(!deny){storePos(e);dragging=true;if(bringToFront)attachedObject.style.zIndex=999;}return false;});events.mma=DOMEvents.add(attachedObject,"mousemove",function(e){if(allowResize&&!dragging){var p=getPos(e);var x=p[0]-DOM.left(attachedObject);var y=p[1]-DOM.top(attachedObject);var w=DOM.width(attachedObject);var h=DOM.height(attachedObject);if(allowResizeDiag&&x<resizeMargin&&y<resizeMargin)dc_this.setMode("nw");else if(allowResizeDiag&&x<resizeMargin&&y>h-resizeMargin)dc_this.setMode("sw");else if(allowResizeDiag&&x>w-resizeMargin&&y<resizeMargin)dc_this.setMode("ne");else if(allowResizeDiag&&x>w-resizeMargin&&y>h-resizeMargin)dc_this.setMode("se");else if(x<resizeMargin)dc_this.setMode("w");else if(x>w-resizeMargin)dc_this.setMode("e");else if(y<resizeMargin)dc_this.setMode("n");else if(y>h-resizeMargin)dc_this.setMode("s");else dc_this.setMode("");}return true;});events.mmd=DOMEvents.add(document,"mousemove",function(e){if(!dragging)return;var cursorX_old=cursorX;var cursorY_old=cursorY;storePos(e);var dx=cursorX-cursorX_old;var dy=cursorY-cursorY_old;var aLeft=DOM.left(attachedObject);var aTop=DOM.top(attachedObject);var aRight=DOM.right(attachedObject);var aBottom=DOM.bottom(attachedObject);var moveH=0;var moveV=0;var resizeH=0;var resizeV=0;if(mode==""){moveH=dx;moveV=dy;}else if(mode=="n"){moveV=dy;resizeV=-dy;}else if(mode=="ne"){moveV=dy;resizeH=dx;resizeV=-dy;}else if(mode=="e"){resizeH=dx;}else if(mode=="se"){resizeH=dx;resizeV=dy;}else if(mode=="s"){resizeV=dy;}else if(mode=="sw"){moveH=dx;resizeH=-dx;resizeV=dy;}else if(mode=="w"){moveH=dx;resizeH=-dx;}else if(mode=="nw"){moveH=dx;moveV=dy;resizeH=-dx;resizeV=-dy;}aLeft+=moveH;aTop+=moveV;aRight+=moveH+resizeH;aBottom+=moveV+resizeV;snapToObjects.each(function(other){var offsetH=0;var offsetV=0;       var otherLeft=DOM.left(other);var otherTop=DOM.top(other);var otherRight=DOM.right(other);var otherBottom=DOM.bottom(other);if(Math.abs(aLeft-otherRight)<snapDistance&&!(aBottom<otherTop-snapDistance||aTop>otherBottom+snapDistance)){offsetH=otherRight-aLeft;}if(Math.abs(aTop-otherBottom)<snapDistance&&!(aRight<otherLeft-snapDistance||aLeft>otherRight+snapDistance)){offsetV=otherBottom-aTop;}if(Math.abs(aRight-otherLeft)<snapDistance&&!(aBottom<otherTop-snapDistance||aTop>otherBottom+snapDistance)){offsetH=otherLeft-aRight;}if(Math.abs(aBottom-otherTop)<snapDistance&&!(aRight<otherLeft-snapDistance||aLeft>otherRight+snapDistance)){offsetV=otherTop-aBottom;}if(offsetH!=0){moveH+=offsetH;cursorX+=offsetH;aLeft+=offsetH;aRight+=offsetH;}if(offsetV!=0){moveV+=offsetV;cursorY+=offsetV;aTop+=offsetV;aBottom+=offsetV;}});function prepareMoveHandler(){return{"left":aLeft,"top":aTop,"right":aRight,"bottom":aBottom,"moveH":moveH,"moveV":moveV,"resizeH":resizeH,"resizeV":resizeV,"mode":mode};}function processMoveHandler(ret){if(isObject(ret)&&isNumber(ret.left)&&ret.left!=aLeft){cursorX+=ret.left-aLeft;moveH+=ret.left-aLeft;if(mode!="")resizeH-=ret.left-aLeft;aLeft=ret.left;}if(isObject(ret)&&isNumber(ret.top)&&ret.top!=aTop){cursorY+=ret.top-aTop;moveV+=ret.top-aTop;if(mode!="")resizeV-=ret.top-aTop;aTop=ret.top;}if(isObject(ret)&&isNumber(ret.right)&&ret.right!=aRight){cursorX+=ret.right-aRight;if(mode=="")moveH+=ret.right-aRight;else resizeH+=ret.right-aRight;aRight=ret.right;}if(isObject(ret)&&isNumber(ret.bottom)&&ret.bottom!=aBottom){cursorY+=ret.bottom-aBottom;if(mode=="")moveV+=ret.bottom-aBottom;else resizeV+=ret.bottom-aBottom;aBottom=ret.bottom;}}moveHandlers.each(function(f){processMoveHandler(f(prepareMoveHandler()));});if(isSet(boundsContainer)){var bLeft=DOM.left(boundsContainer);var bTop=DOM.top(boundsContainer);var bRight=DOM.right(boundsContainer);var bBottom=DOM.bottom(boundsContainer);var f=function(data){if(data.right-data.left<bRight-bLeft){if(data.left<bLeft)data.left=bLeft;if(data.right>bRight)data.right=bRight;}else{if(data.left>bLeft)data.left=bLeft;if(data.right<bRight)data.right=bRight;}if(data.bottom-data.top<bBottom-bTop){if(data.top<bTop)data.top=bTop;if(data.bottom>bBottom)data.bottom=bBottom;}else{if(data.top>bTop)data.top=bTop;if(data.bottom<bBottom)data.bottom=bBottom;}return data;};processMoveHandler(f(prepareMoveHandler()));}if(mode!=""){var minWidth=0;var minHeight=0;if(isSet(minimumSize)){minWidth=minimumSize.width;minHeight=minimumSize.height;}var f=function(data){if(["nw","w","sw"].contains(data.mode)&&data.right-data.left<minWidth)data.left=data.right-minWidth;if(["ne","e","se"].contains(data.mode)&&data.right-data.left<minWidth)data.right=data.left+minWidth;if(["nw","n","ne"].contains(data.mode)&&data.bottom-data.top<minHeight)data.top=data.bottom-minHeight;if(["sw","s","se"].contains(data.mode)&&data.bottom-data.top<minHeight)data.bottom=data.top+minHeight;return data;};processMoveHandler(f(prepareMoveHandler()));}DOM.moveBy(attachedObject,moveH,moveV);DOM.resizeBy(attachedObject,resizeH,resizeV);return false;});events.mu=DOMEvents.add(document,"mouseup",function(e){if(dragging){dragging=false;if(keepInFront){var zIndex=getConfigValue("DragController.zIndex",9)+1;attachedObject.style.zIndex=zIndex;setConfigValue("DragController.zIndex",zIndex)}else if(bringToFront)attachedObject.style.zIndex="";function prepareDropHandler(){return{"left":DOM.left(attachedObject),"top":DOM.top(attachedObject),"right":DOM.right(attachedObject),"bottom":DOM.bottom(attachedObject),"mode":mode};}dropHandlers.each(function(f){if(f(prepareDropHandler())==false){DOM.moveTo(attachedObject,origLeft,origTop);DOM.resizeTo(attachedObject,origRight-origLeft,origBottom-origTop);return;}});}});};this.detach=function(){if(!isSet(events))return;DOMEvents.remove(events.md);DOMEvents.remove(events.mma);DOMEvents.remove(events.mmd);DOMEvents.remove(events.mu);events=undefined;attachedObject.style.cursor=origCursor;attachedObject=undefined;};this.setBoundsContainer=function(o){boundsContainer=o;};this.unsetBoundsContainer=function(){boundsContainer=undefined;};this.setMinimumSize=function(w,h){minimumSize={"width":w,"height":h};};this.unsetMinimumSize=function(){minimumSize=undefined;};this.setBringToFront=function(b){bringToFront=b;};this.setKeepInFront=function(b){keepInFront=b;};this.centerTo=function(x,y){if(!isSet(boundsContainer))return;if(!isSet(attachedObject))return;var aLeft=DOM.left(attachedObject)-DOM.left(boundsContainer);var aTop=DOM.top(attachedObject)-DOM.top(boundsContainer);if(isSet(x)){var bcCenterX=Math.round(DOM.width(boundsContainer)/2);aLeft=bcCenterX-x;}if(isSet(y)){var bcCenterY=Math.round(DOM.height(boundsContainer)/2);aTop=bcCenterY-y;}var aWidth=DOM.width(attachedObject);var aHeight=DOM.height(attachedObject);var aRight=aLeft+aWidth;var aBottom=aTop+aHeight;var bLeft=0;var bTop=0;var bRight=DOM.width(boundsContainer);var bBottom=DOM.height(boundsContainer);if(aWidth<bRight-bLeft){if(aLeft<bLeft)aLeft=bLeft;if(aRight>bRight)aLeft=bRight-aWidth;}else{if(aLeft>bLeft)aLeft=bLeft;if(aRight<bRight)aLeft=bRight-aWidth;}if(aHeight<bBottom-bTop){if(aTop<bTop)aTop=bTop;if(aBottom>bBottom)aTop=bBottom-aHeight;}else{if(aTop>bTop)aTop=bTop;if(aBottom<bBottom)aTop=bBottom-aHeight;}DOM.moveTo(attachedObject,aLeft,aTop);};this.addStartdragHandler=function(f){if(!startdragHandlers.contains(f))startdragHandlers.push(f);};this.removeStartdragHandler=function(f){if(startdragHandlers.contains(f))startdragHandlers.remove(f);};this.addMoveHandler=function(f){if(!moveHandlers.contains(f))moveHandlers.push(f);};this.removeMoveHandler=function(f){if(moveHandlers.contains(f))moveHandlers.remove(f);};this.addDropHandler=function(f){if(!dropHandlers.contains(f))dropHandlers.push(f);};this.removeDropHandler=function(f){if(dropHandlers.contains(f))dropHandlers.remove(f);};this.addSnapTo=function(o){if(!snapToObjects.contains(o))snapToObjects.push(o);};this.removeSnapTo=function(o){if(snapToObjects.contains(o))snapToObjects.remove(o);};}function Animation(s){this.onfinished=undefined;this.onstep=undefined;this.next=undefined;this.playing=false;this.progress=0; var ownSpecs=[];var me=this;var attachedAnims=[]; var o;var animType="";var startVal;var endVal;var endRelative=false;var duration=1000;var fps=40;var method="sexp";var methodParam=1;var autoPlay=false;var additionalSpecs=[];if(isArray(s)){var firstS=s.shift();additionalSpecs=s;s=firstS;}if("o" in s){ownSpecs.push("o");o=$$(s.o);if(o.length==1)o=o[0];}if("type" in s){ownSpecs.push("type");animType=s.type;}if("start" in s){ownSpecs.push("start");startVal=s.start;}if("end" in s){ownSpecs.push("end");endVal=s.end;}if("rel" in s){ownSpecs.push("rel");endRelative=s.rel;}if("duration" in s){ownSpecs.push("duration");duration=s.duration;}if("method" in s){ownSpecs.push("method");method=s.method;}if("param" in s){ownSpecs.push("param");methodParam=s.param;}if("fps" in s){ownSpecs.push("fps");fps=s.fps;}autoPlay=s.play||autoPlay;this.onfinished=s.onfinished||this.onfinished;this.onstep=s.onstep||this.onstep;this.next=s.next||this.next;findStartEnd();var timePassed=0;var timeoutHandle;var playingVar=false;function cssToPx(s){var m=s.match(/([0-9.]+)(px|pt)/);if(m)switch(m[2]){case "px":return+m[1];}if(s==="normal")return 0;}function findStartEnd(){var _o=o;if(isArray(_o))_o=_o[0];if(!isSet(startVal)&&isSet(_o)){switch(animType){case "height":startVal=DOM.height(_o);break;case "left":startVal=DOM.left(_o);break;case "opacity":startVal=DOM.getOpacity(_o);break;case "scroll-h":startVal=o.scrollLeft;break;case "scroll-v":startVal=o.scrollTop;break;case "top":startVal=DOM.top(_o);break;case "width":startVal=DOM.width(_o);break;case "background-color":case "border-bottom-color":case "border-left-color":case "border-right-color":case "border-top-color":case "color":startVal=DOM.getEffectiveStyle(_o,animType);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":startVal=cssToPx(DOM.getEffectiveStyle(_o,animType));break;}}if(!animType.contains("color")&&endRelative)endVal+=startVal; if(animType.contains("color")){startVal=Color.parse(startVal);endVal=Color.parse(endVal);}}this.setDefaults=function(d){if("o" in d&&!ownSpecs.contains("o")){o=$$(d.o);if(o.length==1)o=o[0];}if("type" in d&&!ownSpecs.contains("type"))animType=d.type;if("rel" in d&&!ownSpecs.contains("rel"))endRelative=d.rel;if("end" in d&&!ownSpecs.contains("end")){endVal=d.end;if(!ownSpecs.contains("start")){alert(1);startVal=undefined;}}if("start" in d&&!ownSpecs.contains("start"))startVal=d.start;if("duration" in d&&!ownSpecs.contains("duration"))duration=d.duration;if("method" in d&&!ownSpecs.contains("method"))method=d.method;if("param" in d&&!ownSpecs.contains("param"))methodParam=d.param;if("fps" in d&&!ownSpecs.contains("fps"))this.fps=d.fps;findStartEnd();attachedAnims.each(function(a){a.setDefaults(d);});};this.attach=function(a){var defaults={o:o,type:animType,duration:duration,method:method,param:methodParam,fps:me.fps};if(ownSpecs.contains("start"))defaults.start=startVal;if(ownSpecs.contains("end"))defaults.end=endVal;if(ownSpecs.contains("rel"))defaults.rel=endRelative;if(!isArray(a))a=[a];a.each(function(a){a.setDefaults(defaults);attachedAnims.push(a);});return this;};this.setDuration=function(d){duration=d;ownSpecs.push("duration");attachedAnims.each(function(a){a.setDuration(d);});};this.setMethod=function(m,p){method=m;methodParam=p;ownSpecs.push("method");ownSpecs.push("param");attachedAnims.each(function(a){a.setMethod(m,p);});};this.setFPS=function(f){fps=f;ownSpecs.push("fps");attachedAnims.each(function(a){a.setFPS(f);});};this.play=function(){me.reset();me.resume();};this.halt=function(){clearTimeout(timeoutHandle);me.playing=playingVar=false;attachedAnims.each(function(a){a.halt();});};this.resume=function(){if(duration<=0)return false;if(fps<1)return false;me.playing=playingVar=true;doAnimate();attachedAnims.each(function(a){a.play();});};this.reset=function(){me.progress=timePassed=0;doSet();attachedAnims.each(function(a){a.reset();});};this.finish=function(cascade){timePassed=duration;me.progress=1;doSet();me.playing=playingVar=false;if(!isSet(cascade)||cascade!==false)attachedAnims.each(function(a){a.finish();});};this.reverse=function(){var x=startVal;startVal=endVal;endVal=x;timePassed=duration-timePassed;me.progress=1-me.progress;attachedAnims.each(function(a){a.reverse();});};this.getObject=function(){return o;};function doSet(){var pos=0;var time=timePassed/duration;if(method=="sine"){pos=Math.sin(1.5*Math.PI+time*Math.PI);pos=(pos+1)/2;}else if(method=="exp"){pos=Math.pow(time,Math.pow(2,methodParam));}else if(method=="sexp"){var exp=Math.pow(2,methodParam);if(time<=0.5)pos=Math.pow(time*2,exp)/2;else pos=1-Math.pow(1-(time-0.5)*2,exp)/2;}else{pos=time;}var v;if(animType.contains("color"))v=Color.blend(startVal,endVal,pos);else if(animType==="opacity")v=startVal+(endVal-startVal)*pos;else v=Math.round(startVal+(endVal-startVal)*pos);var a=isArray(o)?o:[o];a.each(function(o){switch(animType){case "opacity":DOM.setOpacity(o,v);break;case "scroll-h":o.scrollLeft=v;break;case "scroll-v":o.scrollTop=v;break;case "background-color":case "border-bottom-color":case "border-left-color":case "border-right-color":case "border-top-color":case "color":o.style[animType.toCamelCase()]=Color.toCSS(v);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":o.style[animType.toCamelCase()]=v+"px";break;}});};function doAnimate(){timePassed+=1000/fps;if(timePassed>=duration){timeoutHandle=undefined;me.finish(false);if(isFunction(me.onfinished))defer(function(){me.onfinished(me);},1);if(isObject(me.next)&&me.next instanceof Animation)defer(me.next.play,1);return;}me.progress=(duration<=0)?0:timePassed/duration;doSet();timeoutHandle=setTimeout(doAnimate,1000/fps);if(isFunction(me.onstep))me.onstep(me);};additionalSpecs.each(function(s){me.attach(new Animation(s));});if(autoPlay)this.play();}Color=function(){var namedColors={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(x,r){if(isObject(x)&&isNumber(x.R)&&isNumber(x.G)&&isNumber(x.B)){if(r)return{R:Math.round(x.R),G:Math.round(x.G),B:Math.round(x.B)};return x;}if(isString(x)){var m;if(m=x.match(/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i))return{R:parseInt(m[1],16),G:parseInt(m[2],16),B:parseInt(m[3],16)};if(m=x.match(/^#?([0-9a-f])([0-9a-f])([0-9a-f])$/i))return{R:parseInt(m[1]+m[1],16),G:parseInt(m[2]+m[2],16),B:parseInt(m[3]+m[3],16)};if(m=x.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 this.parse({R:+m[1]*2.55,G:+m[2]*2.55,B:+m[3]*2.55},r); if(m=x.match(/^rgb\s*\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)$/i))return{R:+m[1],G:+m[2],B:+m[3]};if(m=x.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 this.hsl2rgb({H:+m[1],S:+m[2]/100,L:+m[3]/100});if(namedColors[x.toLowerCase()])return this.parse(namedColors[x.toLowerCase()]);}if(isNumber(x)&&x>=0&&x<=0xFFFFFF){return{R:x&0xFF,G:(x&0xFF00)>>8,B:(x&0xFF0000)>>16};}},systemColor:function(n){},name:function(c){c=this.toHTML(c);if(isSet(c))return namedColors.findValue(c);},toCSS:function(c){c=this.parse(c,true);if(isSet(c))return "rgb("+c.R+", "+c.G+", "+c.B+")";},toHTML:function(c){c=this.parse(c,true);if(isSet(c))return("#"+Math.min(Math.max(c.R,0),255).toString(16).pad(2,"0",true)+Math.min(Math.max(c.G,0),255).toString(16).pad(2,"0",true)+Math.min(Math.max(c.B,0),255).toString(16).pad(2,"0",true)).toUpperCase();},toInt:function(c){c=this.parse(c,true);if(isSet(c))return(c.B<<16)+(c.G<<8)+c.R;},rgb2hsl:function(rgb){rgb=this.parse(rgb);if(!isSet(rgb))return undefined;var hsl={};var r=rgb.R/255;var g=rgb.G/255;var b=rgb.B/255;var min=Math.min(r,g,b);var max=Math.max(r,g,b);hsl.L=(max+min)/2;if(max==min)hsl.H=0;else if(max==r)hsl.H=(60*(g-b)/(max-min))%360;else if(max==g)hsl.H=(60*(b-r)/(max-min)+120)%360;else if(max==b)hsl.H=(60*(r-g)/(max-min)+240)%360;if(hsl.H<0)hsl.H+=360;if(max==min)hsl.S=0;else if(hsl.L<=0.5)hsl.S=(max-min)/(2*hsl.L);else hsl.S=(max-min)/(2-2*hsl.L);return hsl;},hsl2rgb:function(hsl){var rgb={};if(hsl.L<0.5)var q=hsl.L*(1+hsl.S);else var q=hsl.L+hsl.S-hsl.L*hsl.S;var p=2*hsl.L-q;var h=hsl.H/360;var t={R:h+1/3,G:h,B:h-1/3};["R","G","B"].each(function(C){if(t[C]<0)t[C]++;if(t[C]>1)t[C]--;if(t[C]<1/6)rgb[C]=p+((q-p)*6*t[C]);else if(t[C]<1/2)rgb[C]=q;else if(t[C]<2/3)rgb[C]=p+((q-p)*6*(2/3-t[C]));else rgb[C]=p;rgb[C]*=255;});return rgb;},isHSL:function(x){return isObject(x)&&isNumber(x.H)&&isNumber(x.S)&&isNumber(x.L);},blend:function(c1,c2,ratio){var wasHSL1=this.isHSL(c1);if(wasHSL1)c1=this.hsl2rgb(c1);if(this.isHSL(c2))c2=this.hsl2rgb(c2);c1=this.parse(c1);c2=this.parse(c2);ratio=Math.min(Math.max(ratio,0),1);if(isSet(c1)&&isSet(c2)){var c={R:c1.R+(c2.R-c1.R)*ratio,G:c1.G+(c2.G-c1.G)*ratio,B:c1.B+(c2.B-c1.B)*ratio};return wasHSL1?this.rgb2hsl(c):c;}},complementary:function(c){var wasHSL=this.isHSL(c);if(!wasHSL)c=this.rgb2hsl(c);c.H=(c.H+180)%360;return!wasHSL?this.hsl2rgb(c):c;},lighten:function(c,l){var wasHSL=this.isHSL(c);if(!wasHSL)c=this.rgb2hsl(c);c.L+=l*(1-c.L);return!wasHSL?this.hsl2rgb(c):c;},darken:function(c,l){var wasHSL=this.isHSL(c);if(!wasHSL)c=this.rgb2hsl(c);c.L*=1-l;return!wasHSL?this.hsl2rgb(c):c;},grey:function(c){var wasHSL=this.isHSL(c);if(wasHSL)c=this.hsl2rgb(c);c=this.parse(c,true);if(isSet(c)){var g=c.R*0.3+c.G*0.59+c.B*0.11;c={R:g,G:g,B:g};return wasHSL?this.rgb2hsl(c):c;}}}}();var UIEffects=function(){var thisModule={createShadow:function(s){var o,radius=5,offsetX=0,offsetY,maxOpac=0.8,color="#000000",fixed=false;if("o" in s)o=$(s.o);if("radius" in s)radius=s.radius;if("offsetX" in s)offsetX=s.offsetX;if("offsetY" in s)offsetY=s.offsetY;if("maxOpac" in s)maxOpac=s.maxOpac;if("color" in s)color=s.color;if("fixed" in s)fixed=s.fixed;if(!isSet(offsetY))offsetY=Math.round(radius/4);var top=DOM.top(o);var left=DOM.left(o);var bottom=DOM.bottom(o);var right=DOM.right(o);var radiusx2=radius*2;var html=[];var isIE=isSet(document.body.style.filter)&&isSet(document.body.style.behavior)&&!isSet(window.opera);if(!isIE&&fixed){fixed=false;top+=DOM.scrollY();bottom+=DOM.scrollY();left+=DOM.scrollX();right+=DOM.scrollX();}function createPixel(x,y,w,h,opac){if(opac<0.05)return;  opac=Math.pow(opac,1.5);    html.push("<div style=\"position:"+(fixed?"fixed":"absolute")+";left:"+x+"px;top:"+y+"px;width:"+w+"px;height:"+h+"px;background-color:"+color+";opacity:"+opac+";"+(isIE?"filter:Alpha(opacity="+(opac*100)+");":"")+"\"></div>");}function geomMean(a,b,div){return Math.pow(Math.pow(Math.abs(a)/div,3)+Math.pow(Math.abs(b)/div,3),1/3);}for(var x=left-radius+offsetX;x<left+radius+offsetX;x++)for(var y=top-radius+offsetY;y<top+radius+offsetY;y++)if(!(x>=left&&x<right&&y>=top&&y<bottom))createPixel(x,y,1,1,(1-geomMean(left+radius+offsetX-x,top+radius+offsetY-y,radiusx2))*maxOpac);for(var x=right-radius+offsetX;x<right+radius+offsetX;x++)for(var y=top-radius+offsetY;y<top+radius+offsetY;y++)if(!(x>=left&&x<right&&y>=top&&y<bottom))createPixel(x,y,1,1,(1-geomMean(right-radius+offsetX-x,top+radius+offsetY-y,radiusx2))*maxOpac);for(var x=left-radius+offsetX;x<left+radius+offsetX;x++)for(var y=bottom-radius+offsetY;y<bottom+radius+offsetY;y++)if(!(x>=left&&x<right&&y>=top&&y<bottom))createPixel(x,y,1,1,(1-geomMean(left+radius+offsetX-x,bottom-radius+offsetY-y,radiusx2))*maxOpac);for(var x=right-radius+offsetX;x<right+radius+offsetX;x++)for(var y=bottom-radius+offsetY;y<bottom+radius+offsetY;y++)if(!(x>=left&&x<right&&y>=top&&y<bottom))createPixel(x,y,1,1,(1-geomMean(right-radius+offsetX-x,bottom-radius+offsetY-y,radiusx2))*maxOpac);for(var y=top-radius+offsetY;y<top+radius+offsetY;y++)if(!(y>=top&&y<bottom))createPixel(left+offsetX+radius,y,right-left-radiusx2,1,(1-(top+radius+offsetY-y)/radiusx2)*maxOpac);for(var y=bottom-radius+offsetY;y<bottom+radius+offsetY;y++)if(!(y>=top&&y<bottom))createPixel(left+offsetX+radius,y,right-left-radiusx2,1,((bottom+radius+offsetY-y)/radiusx2)*maxOpac);for(var x=left-radius+offsetX;x<left+radius+offsetX;x++)if(!(x>=left&&x<right))createPixel(x,top+offsetY+radius,1,bottom-top-radiusx2,(1-(left+radius+offsetX-x)/radiusx2)*maxOpac);for(var x=right-radius+offsetX;x<right+radius+offsetX;x++)if(!(x>=left&&x<right))createPixel(x,top+offsetY+radius,1,bottom-top-radiusx2,((right+radius+offsetX-x)/radiusx2)*maxOpac);var div=document.createElement("div");div.innerHTML=html.join("");document.body.appendChild(div);return div;},removeShadow:function(pixels){if(isArray(pixels))pixels.each(function(p){p.parentNode.removeChild(p);});if(pixels.parentNode)pixels.parentNode.removeChild(pixels);},createBackgroundLayer:function(color,opac){var layer=document.createElement("div");layer.style.position="fixed";layer.style.top=0;layer.style.left=0;layer.style.width="100%";layer.style.height="100%";layer.style.backgroundColor=color;DOM.setOpacity(layer,opac);document.body.appendChild(layer);return layer;},showImageLayer:function(s,imgList,index){if(arguments.callee.active)return false;var imgUrl,w,h,useShadow=true,borderWidth,borderColor="white",backOpac=0.6,backColor="black",fadeImg=true,text,closeText,noSwitchAnim;var compatMode=!(isSet(document.body.style.filter)&&isSet(document.body.style.behavior)&&!isSet(window.opera));if(compatMode)fadeImg=false;if(!isSet(index))index=0;if(imgList){s.url=imgList[index].url;s.w=imgList[index].w;s.h=imgList[index].h;s.text=imgList[index].text;}if("url" in s)imgUrl=s.url;if("w" in s)w=s.w;if("h" in s)h=s.h;if("shadow" in s)useShadow=s.shadow;if("borderWidth" in s)borderWidth=s.borderWidth;if("borderColor" in s)borderColor=s.borderColor;if("backOpac" in s)backOpac=s.backOpac;if("backColor" in s)backColor=s.backColor;if("fadeImg" in s)fadeImg=s.fadeImg;if("text" in s)text=s.text;if("closeText" in s)closeText=s.closeText;if("noSwitchAnim" in s)noSwitchAnim=s.noSwitchAnim;if(w<=0||h<=0)return false;var layer=thisModule.createBackgroundLayer(backColor,0);if(!isSet(layer))return false;var x=DOM.width(layer)/2-w/2;var y=DOM.height(layer)/2-h/2;var autoBorderWidth=false;if(!isSet(borderWidth)){borderWidth=10+Math.round(Math.sqrt(w*h)/35);autoBorderWidth=true;}if(!isSet(closeText))closeText=getConfigValue("clicktoclosetext","Click or press ‹Esc› to close");closeText="<span style=\"font-size: 0.85em;\">"+closeText+"</span>";if(imgList.length>1)text+=" ("+(index+1)+"/"+imgList.length+")";text=(text?text+"<br />":"")+closeText;arguments.callee.active=true;var switching=false;function showProgressImage(centerX,centerY){var progWidth=getConfigValue("UIEffects.progressImage.width",12);var progHeight=getConfigValue("UIEffects.progressImage.height",12);var progSrc=getConfigValue("UIEffects.progressImage.src");var progImg;if(progSrc){progImg=document.createElement("img");progImg.style.position="fixed";progImg.style.left=Math.round(centerX-progWidth/2)+"px";progImg.style.top=Math.round(centerY-progHeight/2)+"px";progImg.style.zIndex=99999;progImg.setAttribute("src",progSrc);document.body.appendChild(progImg);}return progImg;}var img=document.createElement("img");img.style.position="fixed";img.style.top=(y-20-10-borderWidth)+"px";img.style.left=(x-borderWidth)+"px";img.style.width=w+"px";img.style.height=h+"px";img.style.border="solid "+borderWidth+"px "+borderColor;var progImg=showProgressImage(DOM.width(layer)/2,y-20+borderWidth+h-10-borderWidth/2);DOM.hide(progImg);if(progImg)DOMEvents.add(img,"load",function(){document.body.removeChild(progImg);});img.setAttribute("src",imgUrl);if(fadeImg)DOM.setOpacity(img,0);else DOM.hide(img);document.body.appendChild(img);var div=document.createElement("div");div.style.position="fixed";div.style.top=(y-20+h+borderWidth)+"px";div.style.left="0px";div.style.width="100%";div.style.textAlign="center";div.style.color="white";div.style.fontSize="1.2em";div.style.cursor="default";div.style.textShadow="0 0 5px black, 0 0 2px black";div.innerHTML=text;if(fadeImg)DOM.setOpacity(div,0);else DOM.hide(div);document.body.appendChild(div);var shadowObj;var aniLayer_Finished=function(o){DOM.show(progImg);DOM.show(img);DOM.show(div);if(useShadow)shadowObj=thisModule.createShadow({o:img,radius:8,fixed:true});};var aniLayer=new Animation({o:layer,type:"opacity",start:0,end:backOpac,duration:150,onfinished:aniLayer_Finished});if(fadeImg)aniLayer.attach(new Animation({o:[img,div],start:0,end:1}));var thisFunction=arguments.callee;var clickHandler=function(e){if(switching)return false;if(!DOM.visible(div))return true; aniLayer.halt();if(useShadow)thisModule.removeShadow(shadowObj);if(!fadeImg){DOM.hide(div);document.body.removeChild(img);document.body.removeChild(div);}var aniLayer_Finished2=function(o){document.body.removeChild(layer);if(fadeImg){document.body.removeChild(img);document.body.removeChild(div);}DOMKeyEvents.remove(keyEvents);thisFunction.active=false;};aniLayer.reverse();aniLayer.onfinished=aniLayer_Finished2;aniLayer.resume();return false;};DOMEvents.add(layer,"click",clickHandler);DOMEvents.add(img,"click",clickHandler);DOMEvents.add(div,"click",clickHandler);var keyEvents=[];keyEvents.push(DOMKeyEvents.addGlobal("Escape",clickHandler));var ff=function(){return false;};keyEvents.push(DOMKeyEvents.addGlobal("Up",ff));keyEvents.push(DOMKeyEvents.addGlobal("Down",ff));keyEvents.push(DOMKeyEvents.addGlobal("Home",ff));keyEvents.push(DOMKeyEvents.addGlobal("End",ff));var newZIndex=2;function switchImage(forward){if(switching)return;if(forward&&index>=imgList.length-1)return;if(!forward&&index<=0)return;switching=true;index+=forward?1:-1;s.url=imgList[index].url;s.w=imgList[index].w;s.h=imgList[index].h;s.text=imgList[index].text;var oldY=y;x=DOM.width(layer)/2-s.w/2;y=DOM.height(layer)/2-s.h/2;var progImg=showProgressImage(DOM.left(img)+DOM.width(img)/2,DOM.bottom(img)-borderWidth/2);if(autoBorderWidth)borderWidth=10+Math.round(Math.sqrt(s.w*s.h)/35);var newOffsetX=200;if(noSwitchAnim)newOffsetX=0;var oldImg=img;img=document.createElement("img");img.style.position="fixed";img.style.top=(y-20-10-borderWidth)+"px";img.style.left=(x-borderWidth+(forward?1:-1)*newOffsetX)+"px";img.style.width=s.w+"px";img.style.height=s.h+"px";img.style.border="solid "+borderWidth+"px "+borderColor;img.style.zIndex=newZIndex++;img.setAttribute("src",s.url);DOM.setOpacity(img,0);document.body.appendChild(img);DOMEvents.add(img,"click",clickHandler);DOMEvents.add(img,"load",function(e){if(useShadow)thisModule.removeShadow(shadowObj);if(progImg)document.body.removeChild(progImg);function transFinished(){document.body.removeChild(oldImg);if(useShadow)shadowObj=thisModule.createShadow({o:img,radius:8,fixed:true});switching=false;}text=s.text+" ("+(index+1)+"/"+imgList.length+")<br />"+closeText;div.innerHTML=text;if(!noSwitchAnim){if(compatMode){new Animation({o:oldImg,type:"opacity",start:1,end:0,method:"exp",param:1,duration:200,fps:15,play:true});new Animation({o:oldImg,type:"left",end:(forward?1:-1)*-400,rel:true,method:"exp",param:1,duration:200,fps:15,play:true});defer(function(){DOM.setOpacity(img,1);new Animation({o:img,type:"left",end:(forward?1:-1)*-newOffsetX,rel:true,method:"exp",param:-1,duration:300,fps:25,play:true,onfinished:transFinished});},200);}else{new Animation({o:oldImg,type:"opacity",start:1,end:0,method:"exp",param:1,duration:200,play:true});new Animation({o:oldImg,type:"left",end:(forward?1:-1)*-newOffsetX*2,rel:true,method:"exp",param:1,duration:200,play:true});defer(function(){new Animation({o:img,type:"opacity",start:0,end:1,rel:false,method:"exp",param:-2,duration:150,play:true,onfinished:transFinished});new Animation({o:img,type:"left",end:(forward?1:-1)*-newOffsetX,rel:true,method:"exp",param:-1,duration:150,play:true});},100);}new Animation({o:div,type:"top",end:oldY-y,rel:true,duration:300,play:true});}else{DOM.setOpacity(img,1);div.style.top=(y-20+s.h+borderWidth)+"px";transFinished();}});}function onkeyleft(e){switchImage(false);return false;}function onkeyright(e){switchImage(true);return false;}keyEvents.push(DOMKeyEvents.addGlobal("Left",onkeyleft));keyEvents.push(DOMKeyEvents.addGlobal("Right",onkeyright));keyEvents.push(DOMKeyEvents.addGlobal("PageUp",onkeyleft));keyEvents.push(DOMKeyEvents.addGlobal("PageDown",onkeyright));aniLayer.play();return true;},convertToImageLayerLink:function(o,opts){if(!isSet(opts))opts={};o=$$(o);var imgList=[];o.each(function(o){var text="";if(isSet(o.getAttribute("imgalt"))){text=o.getAttribute("imgalt");}else{var imgNode=$("img",o);if(imgNode)text=imgNode.alt;}imgList.push({url:o.href,w:+o.getAttribute("imgwidth"),h:+o.getAttribute("imgheight"),text:text});});o.each(function(o,index){DOMEvents.add(o,"click",function(e){o.blur();return!thisModule.showImageLayer(opts,imgList,index);});});}};return thisModule;}();function DOMEditorClass(){this.encloseText=function(o,t_open,t_close,cursorpos){o=$(o);var is_ie=(navigator.appName=="Microsoft Internet Explorer");if(is_ie&&document.selection&&document.selection.createRange().duplicate().text.length){var seltext=document.selection.createRange().duplicate().text;if(seltext.substring(0,t_open.length)==t_open&&seltext.substring(seltext.length-t_close.length,seltext.length)==t_close){document.selection.createRange().duplicate().text=seltext.substring(t_open.length,seltext.length-t_close.length);}else{document.selection.createRange().duplicate().text=t_open+seltext+t_close;}}else if(o.selectionEnd&&(o.selectionEnd-o.selectionStart>0)){var start_selection=o.selectionStart;var end_selection=o.selectionEnd;var new_endsel;var scroll_top=o.scrollTop;var scroll_left=o.scrollLeft;var start=o.value.substring(0,start_selection);var seltext=o.value.substring(start_selection,end_selection);var end=o.value.substring(end_selection,o.textLength);if(seltext.substring(0,t_open.length)==t_open&&seltext.substring(seltext.length-t_close.length,seltext.length)==t_close){seltext=seltext.substring(t_open.length,seltext.length-t_close.length);new_endsel=end_selection-t_open.length-t_close.length;}else{seltext=t_open+seltext+t_close;new_endsel=end_selection+t_open.length+t_close.length;}o.value=start+seltext+end;o.selectionStart=start_selection;o.selectionEnd=new_endsel;o.scrollTop=scroll_top;o.scrollLeft=scroll_left;}else{this.insertText(o,t_open+t_close);if(cursorpos<=1)o.selectionEnd-=t_close.length;if(cursorpos<=0)o.selectionEnd-=t_open.length;}};this.insertText=function(o,what,replace){o=$(o);if(replace==null)replace=0;if(o.createTextRange){o.focus();document.selection.createRange().duplicate().text=what;o.focus();}else if(o.selectionStart>=0){var start_selection=o.selectionStart;var end_selection=o.selectionEnd;var scroll_top=o.scrollTop;var scroll_left=o.scrollLeft;var start=o.value.substring(0,start_selection-replace);var end=o.value.substring(end_selection,o.textLength);o.value=start+what+end;o.selectionStart=o.selectionEnd=start_selection-replace+what.length;o.focus();o.scrollTop=scroll_top;o.scrollLeft=scroll_left;}else{o.value+=what;o.focus();}};}DOM.Editor=new DOMEditorClass();function HTMLForm(o){var obj=$(o);function getValueFromNode(o){switch(o.nodeName.toLowerCase()){case "input":switch(o.type){case "button":case "hidden":case "password":case "submit":case "text":case "textarea":return o.value;case "checkbox":if(o.checked)return o.value;return "";case "radio":if(o.checked)return o.value;return undefined;}return undefined;case "textarea":return o.value;case "select":if(o.multiple){var v=[];for(var i=0;i<o.options.length;i++)if(o.options[i].selected)v.push(o.options[i].value);return v;}return o.value;}return undefined;};this.getDataArray=function(){var arr={};for(var i=0;i<obj.elements.length;i++){var el=obj.elements[i];if(el.name!=""){if(!isSet(arr[el.name])){arr[el.name]=getValueFromNode(el);}else{if(!isArray(arr[el.name]))arr[el.name]=[arr[el.name],getValueFromNode(el)];else arr[el.name].push(getValueFromNode(el));}}}return arr;};this.getData=function(){var data=this.getDataArray();var str="";for(var property in data){if(["boolean","number","string"].contains(typeof data[property]))str+=(str!=""?"&":"")+property+"="+encodeURIComponent(data[property]);else if(isArray(data[property]))data[property].each(function(i){str+=(str!=""?"&":"")+property+"="+encodeURIComponent(i);});}return str;};this.getValue=function(n){for(var i=0;i<obj.elements.length;i++){var el=obj.elements[i];if(el.name==n){var v=getValueFromNode(el);if(isSet(v))return v;}}return undefined;};this.getField=function(n){for(var i=0;i<obj.elements.length;i++){var el=obj.elements[i];if(el.name==n)return el;}if(n=="submit"){for(var i=0;i<obj.elements.length;i++){var el=obj.elements[i];if(el.tagName.toLowerCase()=="input"&&el.type.toLowerCase()=="submit")return el;}}return undefined;};this.setValue=function(n,newval){for(var i=0;i<obj.elements.length;i++){if(obj.elements[i].name==n){switch(obj.elements[i].nodeName.toLowerCase()){case "input":switch(obj.elements[i].type){case "button":case "hidden":case "password":case "submit":case "text":case "textarea":obj.elements[i].value=newval;break;case "checkbox":obj.elements[i].checked=isTrue(newval);break;case "radio":obj.elements[i].checked=(obj.elements[i].value==newval);break;}break;case "textarea":obj.elements[i].value=newval;break;case "select":if(obj.elements[i].multiple){for(var o=0;o<obj.elements[i].options.length;o++){obj.elements[i].options[o].selected=newval.contains(obj.elements[i].options[o].value);}}else{obj.elements[i].value=newval;}break;}return;}}if(n=="submit"){for(var i=0;i<obj.elements.length;i++){var el=obj.elements[i];if(el.tagName.toLowerCase()=="input"&&el.type.toLowerCase()=="submit"){el.value=newval;return;}}}};this.removeAllOptions=function(n){var select=this.getField(n);while(select.hasChildNodes())select.removeChild(select.firstChild);};this.addOption=function(n,val,text){var select=this.getField(n);var option=document.createElement("option");var valueAttr=document.createAttribute("value");valueAttr.nodeValue=val;option.setAttributeNode(valueAttr);option.appendChild(document.createTextNode(text));select.appendChild(option);};this.addFieldHandler=function(n,ckfn,msg,immediately){if(!isSet(immediately))immediately=true;var info=new InfoLabel("red");var thisform=this;for(var i=0;i<obj.elements.length;i++){if(obj.elements[i].name==n){var field=obj.elements[i];var handler=function(event){var res=ckfn(event,field,thisform);if(res==true||!isSet(res)){DOM.removeClass(field,"checkError");info.hide();}else if(!isString(res)&&res==false){DOM.addClass(field,"checkError");if(msg!="")info.popup(field,msg,3);}else if(isString(res)){DOM.addClass(field,"checkError");if(res!="")info.popup(field,res,3);}};DOMEvents.add(field,"keyup",handler);DOMEvents.add(field,"click",handler);DOMEvents.add(field,"change",handler);if(immediately)setTimeout(function(){handler(null,field);},200);var label=DOM.findParentByName(field,"label");if(label)DOMEvents.add(label,"click",handler);}}};this.addFieldSubmitHandler=function(n,ckfn,msg){var info=new InfoLabel("red");var thisform=this;for(var i=0;i<obj.elements.length;i++){if(obj.elements[i].name==n){var field=obj.elements[i];var handler=function(event){var res=ckfn(event,field,thisform);if(res==true||!isSet(res)){DOM.removeClass(field,"checkError");info.hide();return true;}else if(!isString(res)&&res==false){DOM.addClass(field,"checkError");if(msg!="")info.popup(field,msg,3);field.focus();return false;}else if(isString(res)){DOM.addClass(field,"checkError");if(res!="")info.popup(field,res,3);field.focus();return false;}};DOMEvents.add(obj,"submit",handler);}}};this.addSubmitHandler=function(ckfn){var thisform=this;var handler=function(event){var res=ckfn(event,thisform);if(!isSet(res)){return true;}return res;};DOMEvents.add(obj,"submit",handler);};}function InfoLabel(c,id){var visible=true;var x=0;var y=0;var yOffset=0;var node;var text="";var hideTimeoutHandle=false;var fadeOut=false;var initialised=false;this.move=function(newX,newY){x=newX;y=newY;node.style.left=x+"px";node.style.top=y+"px";};this.setYOffset=function(dy){yOffset=dy;};this.moveBelow=function(obj){this.move(DOM.left(obj)+8,DOM.bottom(obj)-4+yOffset);};this.setFadeOut=function(b){fadeOut=b;};this.show=function(){if(hideTimeoutHandle)clearTimeout(hideTimeoutHandle);visible=true;node.style.display="";};this.hide=function(){hideTimeoutHandle=false;visible=false;if(initialised&&fadeOut)new Animation({o:node,type:"opacity",start:1,end:0,play:true});else node.style.display="none";};this.hideTimeout=function(sec){if(hideTimeoutHandle){clearTimeout(hideTimeoutHandle);}hideTimeoutHandle=setTimeout(this.hide,sec*1000);};this.popup=function(obj,text,sec){this.moveBelow(obj);this.setText(text);this.show();this.hideTimeout(sec);};this.isVisible=function(){return visible;};this.setText=function(newText){text=newText;node.firstChild.innerHTML=text;if(text==""){this.hide();}};if(!isSet(id)||id==""){var i;for(i=1;$("auto_infolabel_"+i);i++);id="auto_infolabel_"+i;}var imgpath=getConfigValue("infolabel.imgpath","");node=document.createElement("div");node.setAttribute("id",id);node.style.position="absolute";DOM.addClass(node,"infolabel");if(!c)c="grey";DOM.addClass(node,c);node.style.background="url("+imgpath+"infolabel_"+c+".png) no-repeat top left";node.style.paddingTop="5px";this.hide();innerNode=document.createElement("div");switch(c){case "red":innerNode.style.borderBottom="solid 1px #FF5013";innerNode.style.borderRight="solid 1px #FF5013";break;case "yellow":innerNode.style.borderBottom="solid 1px #FED100";innerNode.style.borderRight="solid 1px #FED100";break;case "green":innerNode.style.borderBottom="solid 1px #4BFF13";innerNode.style.borderRight="solid 1px #4BFF13";break;case "blue":innerNode.style.borderBottom="solid 1px #215BFF";innerNode.style.borderRight="solid 1px #215BFF";break;default:innerNode.style.borderBottom="solid 1px #8D8D8D";innerNode.style.borderRight="solid 1px #8D8D8D";break;}innerNode.style.padding="0px 3px 0px 4px";innerNode.style.font="8pt/11pt Tahoma, sans-serif";node.appendChild(innerNode);DOMEvents.whenLoaded(function(){document.body.appendChild(node);});initialised=true;}function CheckBox(id){var labelNode=undefined;var imageNode=undefined;var activeNode=undefined;var state=0;var supportTriState=false;var imgpath=getConfigValue("form.checkbox.imgpath","");var node=$(id);imageNode=node;activeNode=node;while(isSet(node)&&node.nodeName.toLowerCase()!="label"){node=node.parentNode;}if(isSet(node)&&node.nodeName.toLowerCase()=="label"){labelNode=node;activeNode=node;}DOM.addClass(imageNode,"FormCheckBox");DOMEvents.add(activeNode,"click",function(){state--;if(state<0){if(!supportTriState)state=1;else state=2;}UpdateImage();});function UpdateImage(){if(state==0)imageNode.src=imgpath+"checkbox_0.png";else if(state==1)imageNode.src=imgpath+"checkbox_1.png";else if(state==2)imageNode.src=imgpath+"checkbox_2.png";}this.getState=function(){return state;};this.setState=function(newState){state=newState;UpdateImage();};this.setSupportTriState=function(b){supportTriState=b;};UpdateImage();}function Listbox(id){var visible=true;var x=0;var y=0;var items=null;var node=null;var initialText="";this.bindTo=function(o){o=$(o);this.move(DOM.left(o)-1,DOM.bottom(o)+1);this.setInitialText(o.value);};this.move=function(newX,newY){x=newX;y=newY;node.style.left=x+"px";node.style.top=y+"px";};this.show=function(){this.visible=true;node.style.display="";};this.hide=function(){this.visible=false;node.style.display="none";};this.isVisible=function(){return this.visible;};this.setItems=function(items){if(!isSet(items))items=new Array();this.items=items;node.scrollTop=0;while(node.hasChildNodes())node.removeChild(node.firstChild);for(var i=0;i<items.length;i++){var option=document.createElement("option");var text=document.createTextNode(items[i]);option.appendChild(text);node.appendChild(option);}if(items.length>0)node.setAttribute("size",Math.max(Math.min(items.length,8),2));else this.hide();};this.showItems=function(items){this.setItems(items);if(items&&items.length>0)this.show();};this.setInitialText=function(text){initialText=text;};this.getSelectedIndex=function(){var selIndex=-1;var itemCount=node.childNodes.length;for(var i=0;i<itemCount;i++)if(node.childNodes[i].selected){selIndex=i;break;}return selIndex;};this.getSelectedText=function(){var selIndex=this.getSelectedIndex();if(selIndex>-1){if(typeof node.childNodes[selIndex].innerText!="undefined")return node.childNodes[selIndex].innerText;return node.childNodes[selIndex].value;}return initialText;};this.selectPrev=function(){var selIndex=this.getSelectedIndex();var itemCount=node.childNodes.length;if(selIndex>0&&itemCount>0){node.childNodes[selIndex].selected=false;node.childNodes[selIndex-1].selected=true;}else if(selIndex==0&&itemCount>0)node.childNodes[selIndex].selected=false;};this.selectNext=function(){var selIndex=this.getSelectedIndex();var itemCount=node.childNodes.length;if(selIndex<itemCount-1&&itemCount>0){if(selIndex>-1)node.childNodes[selIndex].selected=false;node.childNodes[selIndex+1].selected=true;}};this.handleKey=function(event){if(DOM.isKeyName(event,"Up")){listbox.selectPrev();return true;}if(DOM.isKeyName(event,"Down")){listbox.selectNext();return true;}if(DOM.isKeyName(event,"PageUp")){for(var i=0;i<7;i++)listbox.selectPrev();return true;}if(DOM.isKeyName(event,"PageDown")){for(var i=0;i<7;i++)listbox.selectNext();return true;}return false;};if(!isSet(id)||id==""){var i;for(i=1;$("auto_listbox_"+i);i++);id="auto_listbox_"+i;}node=document.createElement("select");node.setAttribute("id",id);node.setAttribute("style","position: absolute; top: "+y+"px; left: "+x+"px;");this.hide();DOM.whenLoaded(function(){document.body.appendChild(node);});}function inspectObject(obj,withFuncs,silent){function addValue(prop,v,linked){if(prop)prop+=" = ";var msg="";try{if(linked)msg+="~ ";if(typeof v=="undefined")msg+=prop+"undefined\n";else if(typeof v=="number")msg+=prop+v.toString()+"\n";else if(typeof v=="boolean")msg+=prop+v.toString()+"\n";else if(typeof v=="string")msg+=prop+"\""+v.toString().replace(/ /g,"\xA0")+"\"\n";else if(typeof v=="function")if(withFuncs)msg+=prop+v.toString().replace(/ /g,"\xA0")+"\n";else msg+=prop+"(function)\n";else{try{msg+=prop+"("+typeof v+") "+v.toString().replace(/ /g,"\xA0")+"\n";}catch(ex){msg+=prop+"("+typeof v+") "+v+"\n";}}}catch(ex){try{msg+=prop+"(error) "+v+"\n";}catch(ex2){msg+=prop+"(error)\n";}}return msg;}var msg="";msg+=addValue("",obj)+"\n";for(var prop in obj){var linked = /*obj.hasOwnProperty &&*/!obj.hasOwnProperty(prop);msg+=addValue(prop,obj[prop],linked);}if(!silent){if(!isSet(this.callCounter))this.callCounter=0;this.callCounter++;var wnd=window.open("about:blank","","width=500, height=550, location=no, menubar=no, resizable=yes, scrollbars=yes, status=no, toolbar=no, top=20, left=20");if(wnd){wnd.document.close();wnd.document.open("text/html","replace");wnd.document.write("<html><head><title>Object Inspector #"+this.callCounter+"</title></head><body><pre>"+msg+"</pre></body></html>");wnd.document.close();}else{alert("inspectObject() failed, disable your popup blocker.");}}return msg;}
