/* Pflichtkommentar */
/*
[TextFormatJs]
[CalendarJs]
*/
/* JsInclude file=jquery.min.js */
/*
 * jQuery JavaScript Library v1.3.2
 * http://jquery.com/
 *
 * Copyright (c) 2009 John Resig
 * Dual licensed under the MIT and GPL licenses.
 * http://docs.jquery.com/License
 *
 * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
 * Revision: 6246
 */
(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F<J;F++){var G=M[F];if(G.selected){K=o(G).val();if(H){return K}L.push(K)}}return L}return(E.value||"").replace(/\r/g,"")}return g}if(typeof K==="number"){K+=""}return this.each(function(){if(this.nodeType!=1){return}if(o.isArray(K)&&/radio|checkbox/.test(this.type)){this.checked=(o.inArray(this.value,K)>=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G<E;G++){L.call(K(this[G],H),this.length>1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H<I;H++){if((G=arguments[H])!=null){for(var F in G){var K=J[F],L=G[F];if(J===L){continue}if(E&&L&&typeof L==="object"&&!L.nodeType){J[F]=o.extend(E,K||(L.length!=null?[]:{}),L)}else{if(L!==g){J[F]=L}}}}}return J};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,q=document.defaultView||{},s=Object.prototype.toString;o.extend({noConflict:function(E){l.$=p;if(E){l.jQuery=y}return o},isFunction:function(E){return s.call(E)==="[object Function]"},isArray:function(E){return s.call(E)==="[object Array]"},isXMLDoc:function(E){return E.nodeType===9&&E.documentElement.nodeName!=="HTML"||!!E.ownerDocument&&o.isXMLDoc(E.ownerDocument)},globalEval:function(G){if(G&&/\S/.test(G)){var F=document.getElementsByTagName("head")[0]||document.documentElement,E=document.createElement("script");E.type="text/javascript";if(o.support.scriptEval){E.appendChild(document.createTextNode(G))}else{E.text=G}F.insertBefore(E,F.firstChild);F.removeChild(E)}},nodeName:function(F,E){return F.nodeName&&F.nodeName.toUpperCase()==E.toUpperCase()},each:function(G,K,F){var E,H=0,I=G.length;if(F){if(I===g){for(E in G){if(K.apply(G[E],F)===false){break}}}else{for(;H<I;){if(K.apply(G[H++],F)===false){break}}}}else{if(I===g){for(E in G){if(K.call(G[E],E,G[E])===false){break}}}else{for(var J=G[0];H<I&&K.call(J,H,J)!==false;J=G[++H]){}}}return G},prop:function(H,I,G,F,E){if(o.isFunction(I)){I=I.call(H,F)}return typeof I==="number"&&G=="curCSS"&&!b.test(E)?I+"px":I},className:{add:function(E,F){o.each((F||"").split(/\s+/),function(G,H){if(E.nodeType==1&&!o.className.has(E.className,H)){E.className+=(E.className?" ":"")+H}})},remove:function(E,F){if(E.nodeType==1){E.className=F!==g?o.grep(E.className.split(/\s+/),function(G){return !o.className.has(F,G)}).join(" "):""}},has:function(F,E){return F&&o.inArray(E,(F.className||F).toString().split(/\s+/))>-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+"></"+T+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!O.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!O.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!O.indexOf("<td")||!O.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!O.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!o.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/<tbody/i.test(S),N=!O.indexOf("<table")&&!R?L.firstChild&&L.firstChild.childNodes:Q[1]=="<table>"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E<F;E++){if(H[E]===G){return E}}return -1},merge:function(H,E){var F=0,G,I=H.length;if(!o.support.getAll){while((G=E[F++])!=null){if(G.nodeType!=8){H[I++]=G}}}else{while((G=E[F++])!=null){H[I++]=G}}return H},unique:function(K){var F=[],E={};try{for(var G=0,H=K.length;G<H;G++){var J=o.data(K[G]);if(!E[J]){E[J]=true;F.push(K[G])}}}catch(I){F=K}return F},grep:function(F,J,E){var G=[];for(var H=0,I=F.length;H<I;H++){if(!E!=!J(F[H],H)){G.push(F[H])}}return G},map:function(E,J){var F=[];for(var G=0,H=E.length;G<H;G++){var I=J(E[G],G);if(I!=null){F[F.length]=I}}return F.concat.apply([],F)}});var C=navigator.userAgent.toLowerCase();o.browser={version:(C.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(C),opera:/opera/.test(C),msie:/msie/.test(C)&&!/opera/.test(C),mozilla:/mozilla/.test(C)&&!/(compatible|webkit)/.test(C)};o.each({parent:function(E){return E.parentNode},parents:function(E){return o.dir(E,"parentNode")},next:function(E){return o.nth(E,2,"nextSibling")},prev:function(E){return o.nth(E,2,"previousSibling")},nextAll:function(E){return o.dir(E,"nextSibling")},prevAll:function(E){return o.dir(E,"previousSibling")},siblings:function(E){return o.sibling(E.parentNode.firstChild,E)},children:function(E){return o.sibling(E.firstChild)},contents:function(E){return o.nodeName(E,"iframe")?E.contentDocument||E.contentWindow.document:o.makeArray(E.childNodes)}},function(E,F){o.fn[E]=function(G){var H=o.map(this,F);if(G&&typeof G=="string"){H=o.multiFilter(G,H)}return this.pushStack(o.unique(H),E,G)}});o.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(E,F){o.fn[E]=function(G){var J=[],L=o(G);for(var K=0,H=L.length;K<H;K++){var I=(K>0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}});
/*
 * Sizzle CSS Selector Engine - v0.9.3
 *  Copyright 2009, The Dojo Foundation
 *  Released under the MIT, BSD, and GPL Licenses.
 *  More information: http://sizzlejs.com/
 */
(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa<ab.length;aa++){if(ab[aa]===ab[aa-1]){ab.splice(aa--,1)}}}}}return ab};F.matches=function(T,U){return F(T,null,null,U)};F.find=function(aa,T,ab){var Z,X;if(!aa){return[]}for(var W=0,V=I.order.length;W<V;W++){var Y=I.order[W],X;if((X=I.match[Y].exec(aa))){var U=RegExp.leftContext;if(U.substr(U.length-1)!=="\\"){X[1]=(X[1]||"").replace(/\\/g,"");Z=I.find[Y](X,T,ab);if(Z!=null){aa=aa.replace(I.match[Y],"");break}}}}if(!Z){Z=T.getElementsByTagName("*")}return{set:Z,expr:aa}};F.filter=function(ad,ac,ag,W){var V=ad,ai=[],aa=ac,Y,T,Z=ac&&ac[0]&&Q(ac[0]);while(ad&&ac.length){for(var ab in I.filter){if((Y=I.match[ab].exec(ad))!=null){var U=I.filter[ab],ah,af;T=false;if(aa==ai){ai=[]}if(I.preFilter[ab]){Y=I.preFilter[ab](Y,aa,ag,ai,W,Z);if(!Y){T=ah=true}else{if(Y===true){continue}}}if(Y){for(var X=0;(af=aa[X])!=null;X++){if(af){ah=U(af,Y,X,aa);var ae=W^!!ah;if(ag&&ah!=null){if(ae){T=true}else{aa[X]=false}}else{if(ae){ai.push(af);T=true}}}}}if(ah!==g){if(!ag){aa=ai}ad=ad.replace(I.match[ab],"");if(!T){return[]}break}}}if(ad==V){if(T==null){throw"Syntax error, unrecognized expression: "+ad}else{break}}V=ad}return aa};var I=F.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(T){return T.getAttribute("href")}},relative:{"+":function(aa,T,Z){var X=typeof T==="string",ab=X&&!/\W/.test(T),Y=X&&!ab;if(ab&&!Z){T=T.toUpperCase()}for(var W=0,V=aa.length,U;W<V;W++){if((U=aa[W])){while((U=U.previousSibling)&&U.nodeType!==1){}aa[W]=Y||U&&U.nodeName===T?U||false:U===T}}if(Y){F.filter(T,aa,true)}},">":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){var W=Y.parentNode;Z[V]=W.nodeName===U?W:false}}}else{for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){Z[V]=X?Y.parentNode:Y.parentNode===U}}if(X){F.filter(U,Z,true)}}},"":function(W,U,Y){var V=L++,T=S;if(!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("parentNode",U,V,W,X,Y)},"~":function(W,U,Y){var V=L++,T=S;if(typeof U==="string"&&!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("previousSibling",U,V,W,X,Y)}},find:{ID:function(U,V,W){if(typeof V.getElementById!=="undefined"&&!W){var T=V.getElementById(U[1]);return T?[T]:[]}},NAME:function(V,Y,Z){if(typeof Y.getElementsByName!=="undefined"){var U=[],X=Y.getElementsByName(V[1]);for(var W=0,T=X.length;W<T;W++){if(X[W].getAttribute("name")===V[1]){U.push(X[W])}}return U.length===0?null:U}},TAG:function(T,U){return U.getElementsByTagName(T[1])}},preFilter:{CLASS:function(W,U,V,T,Z,aa){W=" "+W[1].replace(/\\/g,"")+" ";if(aa){return W}for(var X=0,Y;(Y=U[X])!=null;X++){if(Y){if(Z^(Y.className&&(" "+Y.className+" ").indexOf(W)>=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return U<T[3]-0},gt:function(V,U,T){return U>T[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W<T;W++){if(Y[W]===Z){return false}}return true}}}},CHILD:function(T,W){var Z=W[1],U=T;switch(Z){case"only":case"first":while(U=U.previousSibling){if(U.nodeType===1){return false}}if(Z=="first"){return true}U=T;case"last":while(U=U.nextSibling){if(U.nodeType===1){return false}}return true;case"nth":var V=W[2],ac=W[3];if(V==1&&ac==0){return true}var Y=W[0],ab=T.parentNode;if(ab&&(ab.sizcache!==Y||!T.nodeIndex)){var X=0;for(U=ab.firstChild;U;U=U.nextSibling){if(U.nodeType===1){U.nodeIndex=++X}}ab.sizcache=Y}var aa=T.nodeIndex-ac;if(V==0){return aa==0}else{return(aa%V==0&&aa/V>=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V<T;V++){U.push(X[V])}}else{for(var V=0;X[V];V++){U.push(X[V])}}}return U}}var G;if(document.documentElement.compareDocumentPosition){G=function(U,T){var V=U.compareDocumentPosition(T)&4?-1:U===T?0:1;if(V===0){hasDuplicate=true}return V}}else{if("sourceIndex" in document.documentElement){G=function(U,T){var V=U.sourceIndex-T.sourceIndex;if(V===0){hasDuplicate=true}return V}}else{if(document.createRange){G=function(W,U){var V=W.ownerDocument.createRange(),T=U.ownerDocument.createRange();V.selectNode(W);V.collapse(true);T.selectNode(U);T.collapse(true);var X=V.compareBoundaryPoints(Range.START_TO_END,T);if(X===0){hasDuplicate=true}return X}}}}(function(){var U=document.createElement("form"),V="script"+(new Date).getTime();U.innerHTML="<input name='"+V+"'/>";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="<a href='#'></a>";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="<p class='TEST'></p>";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="<div class='test e'></div><div class='test'></div>";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1&&!ac){T.sizcache=Y;T.sizset=W}if(T.nodeName===Z){X=T;break}T=T[U]}ad[W]=X}}}function S(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1){if(!ac){T.sizcache=Y;T.sizset=W}if(typeof Z!=="string"){if(T===Z){X=true;break}}else{if(F.filter(Z,[T]).length>0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z<U;Z++){F(T,V[Z],W)}return F.filter(X,W)};o.find=F;o.filter=F.filter;o.expr=F.selectors;o.expr[":"]=o.expr.filters;F.selectors.filters.hidden=function(T){return T.offsetWidth===0||T.offsetHeight===0};F.selectors.filters.visible=function(T){return T.offsetWidth>0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F<E.length){o.event.proxy(G,E[F++])}return this.click(o.event.proxy(G,function(H){this.lastToggle=(this.lastToggle||0)%F;H.preventDefault();return E[this.lastToggle++].apply(this,arguments)||false}))},hover:function(E,F){return this.mouseenter(E).mouseleave(F)},ready:function(E){B();if(o.isReady){E.call(document,o)}else{o.readyList.push(E)}return this},live:function(G,F){var E=o.event.proxy(F);E.guid+=this.selector+G;o(document).bind(i(G,this.selector),this.selector,E);return this},die:function(F,E){o(document).unbind(i(F,this.selector),E?{guid:E.guid+this.selector+F}:null);return this}});function c(H){var E=RegExp("(^|\\.)"+H.type+"(\\.|$)"),G=true,F=[];o.each(o.data(this,"events").live||[],function(I,J){if(E.test(J.type)){var K=o(H.target).closest(J.data)[0];if(K){F.push({elem:K,fn:J})}}});F.sort(function(J,I){return o.data(J.elem,"closest")-o.data(I.elem,"closest")});o.each(F,function(){if(this.fn.call(this.elem,H,this.fn.data)===false){return(G=false)}});return G}function i(F,E){return["live",F,E.replace(/\./g,"`").replace(/ /g,"|")].join(".")}o.extend({isReady:false,readyList:[],ready:function(){if(!o.isReady){o.isReady=true;if(o.readyList){o.each(o.readyList,function(){this.call(document,o)});o.readyList=null}o(document).triggerHandler("ready")}}});var x=false;function B(){if(x){return}x=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);o.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);o.ready()}});if(document.documentElement.doScroll&&l==l.top){(function(){if(o.isReady){return}try{document.documentElement.doScroll("left")}catch(E){setTimeout(arguments.callee,0);return}o.ready()})()}}}o.event.add(l,"load",o.ready)}o.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(F,E){o.fn[E]=function(G){return G?this.bind(E,G):this.trigger(E)}});o(l).bind("unload",function(){for(var E in o.cache){if(E!=1&&o.cache[E].handle){o.event.remove(o.cache[E].handle.elem)}}});(function(){o.support={};var F=document.documentElement,G=document.createElement("script"),K=document.createElement("div"),J="script"+(new Date).getTime();K.style.display="none";K.innerHTML='   <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var H=K.getElementsByTagName("*"),E=K.getElementsByTagName("a")[0];if(!H||!H.length||!E){return}o.support={leadingWhitespace:K.firstChild.nodeType==3,tbody:!K.getElementsByTagName("tbody").length,objectAll:!!K.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!K.getElementsByTagName("link").length,style:/red/.test(E.getAttribute("style")),hrefNormalized:E.getAttribute("href")==="/a",opacity:E.style.opacity==="0.5",cssFloat:!!E.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};G.type="text/javascript";try{G.appendChild(document.createTextNode("window."+J+"=1;"))}catch(I){}F.insertBefore(G,F.firstChild);if(l[J]){o.support.scriptEval=true;delete l[J]}F.removeChild(G);if(K.attachEvent&&K.fireEvent){K.attachEvent("onclick",function(){o.support.noCloneEvent=false;K.detachEvent("onclick",arguments.callee)});K.cloneNode(true).fireEvent("onclick")}o(function(){var L=document.createElement("div");L.style.width=L.style.paddingLeft="1px";document.body.appendChild(L);o.boxModel=o.support.boxModel=L.offsetWidth===2;document.body.removeChild(L).style.display="none"})})();var w=o.support.cssFloat?"cssFloat":"styleFloat";o.props={"for":"htmlFor","class":"className","float":w,cssFloat:w,styleFloat:w,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};o.fn.extend({_load:o.fn.load,load:function(G,J,K){if(typeof G!=="string"){return this._load(G)}var I=G.indexOf(" ");if(I>=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("<div/>").append(M.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H<F;H++){var E=o.data(this[H],"olddisplay");this[H].style.display=E||"";if(o.css(this[H],"display")==="none"){var G=this[H].tagName,K;if(m[G]){K=m[G]}else{var I=o("<"+G+" />").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H<F;H++){this[H].style.display=o.data(this[H],"olddisplay")||""}return this}},hide:function(H,I){if(H){return this.animate(t("hide",3),H,I)}else{for(var G=0,F=this.length;G<F;G++){var E=o.data(this[G],"olddisplay");if(!E&&E!=="none"){o.data(this[G],"olddisplay",o.css(this[G],"display"))}}for(var G=0,F=this.length;G<F;G++){this[G].style.display="none"}return this}},_toggle:o.fn.toggle,toggle:function(G,F){var E=typeof G==="boolean";return o.isFunction(G)&&o.isFunction(F)?this._toggle.apply(this,arguments):G==null||E?this.each(function(){var H=E?G:o(this).is(":hidden");o(this)[H?"show":"hide"]()}):this.animate(t("toggle",3),G,F)},fadeTo:function(E,G,F){return this.animate({opacity:G},E,F)},animate:function(I,F,H,G){var E=o.speed(F,H,G);return this[E.queue===false?"each":"queue"](function(){var K=o.extend({},E),M,L=this.nodeType==1&&o(this).is(":hidden"),J=this;for(M in I){if(I[M]=="hide"&&L||I[M]=="show"&&!L){return K.complete.call(this)}if((M=="height"||M=="width")&&this.style){K.display=o.css(this,"display");K.overflow=this.style.overflow}}if(K.overflow!=null){this.style.overflow="hidden"}K.curAnim=o.extend({},I);o.each(I,function(O,S){var R=new o.fx(J,K,O);if(/toggle|show|hide/.test(S)){R[S=="toggle"?L?"show":"hide":S](I)}else{var Q=S.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),T=R.cur(true)||0;if(Q){var N=parseFloat(Q[2]),P=Q[3]||"px";if(P!="px"){J.style[O]=(N||1)+P;T=((N||1)/R.cur(true))*T;J.style[O]=T+P}if(Q[1]){N=((Q[1]=="-="?-1:1)*N)+T}R.custom(T,N,P)}else{R.custom(T,S,"")}}});return true})},stop:function(F,E){var G=o.timers;if(F){this.queue([])}this.each(function(){for(var H=G.length-1;H>=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J<K.length;J++){if(!K[J]()){K.splice(J--,1)}}if(!K.length){clearInterval(n);n=g}},13)}},show:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());o(this.elem).show()},hide:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(H){var G=e();if(H||G>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})();

/* JsInclude file=ba_forms.js */

/**
 * Schickt das übergebene Event an den Server
 * @param event
 * @return false - es werden keine weiteren Handler ausgeführt
 */
function ajaxEventCallback (event, ele) {
	var args = new Array();
	
	if (!ele) {
		ele = this;
	}
	args[args.length]="id="+ele.id;
	args[args.length]="event="+event;

	if (pb && pb.e && pb.e.x && pb.e.y) {
		args[args.length]= "xPos="+pb.e.x;
		args[args.length]= "yPos="+pb.e.y;
	} else {
		args[args.length]= "xPos="+0;
		args[args.length]= "yPos="+0;
	}
	
	try {
		if(event == 'click') {
			var clickXY = getClickXY(ele.id);
		
			if(clickXY.length > 1) {
				args[args.length]= "xPosClick="+clickXY[0];
				args[args.length]= "yPosClick="+clickXY[1];
			}
		}
	} catch (e) {
//		alert(e);
	}
	
	if ((ele.nodeName == "INPUT") && ("checkbox" == ele.getAttribute ("type") || "radio" == ele.getAttribute ("type"))) {
		args[args.length]= "-value="+ele.checked;
	} else if (ele.nodeName == "SELECT") {
		var id = ele.id;
		var val = $('#'+id).val() || [];
		var value = val;
		if (typeof (val) != 'string') {  
			value = val.join(",");
		}
/*
		var value = "";
		var opts = ele.options;
		for (var o = 0; o < opts.length; o++) {
			var opt = opts[o];
			
			if (opt.selected) {
				if (value.length > 0) {
					value += ",";
				}
				value += opt.value;
			}
		}
*/
		args[args.length]= "-value="+value;
	} else if (ele.value) {
		args[args.length]= "-value="+ele.value;
	} else {
		args[args.length]= "-value=";
	}
	
	var confirmMsg = $(ele).attr("confirm-message");
	if (confirmMsg) {
		ignoreBaMenuOpen = true;
		if (!confirm (confirmMsg)) {
			//			debugWindow ('confirm DONE');
			return (false);
		}
	}
	
	sendRequestParams ("ajaxEvent", args);
	
	// Andere Radiobuttons über Deselektierung informieren
	if((ele.nodeName == "INPUT") && ("radio" == ele.getAttribute ("type") && ele.checked)) {
		toggleRadios(event, ele);
	}

	
	return (true);
}

/**
 * Diese Methode versucht für ein übergebenes Element
 * die tatsächliche Position des "Clicks" herauszufinden.
 * Sie wurde für Buttons entwickelt, daher ist sie
 * für andere Anwendungen mit vorsicht zu genießen.
 * @param elementid
 * @return
 */
function getClickXY(elementid) {
	var ele = $('#'+elementid);
	if(!ele)
		ele = $(elementid);
	
	var position = ele.position();
	var xPos = parseInt(position.left);
	var yPos = parseInt(position.top);
	var height = parseInt(ele.height());
	var width = parseInt(ele.width());
	
	var ww;		// WindowWidth
	var wh;		// WindowHeight
	var sbx;	// ScrollBarX
	var sby;	// ScrollBarY
	var mybody = document.body;
	if ($.browser.msie) {
		wh = parseInt( mybody.offsetHeight );
		sby = mybody.scrollTop;
		ww = parseInt( mybody.offsetWidth );
		sbx = mybody.scrollLeft;
	} else {
		ww = parseInt( window.innerWidth );
		wh = parseInt( window.innerHeight );
		sbx = window.pageXOffset;
		sby = window.pageYOffset;
	}
	
//	debugWindow ("pb.e.x="+pb.e.x+", pb.e.y="+pb.e.y);
//	debugWindow ("xPos="+xPos+", yPos="+yPos+", width="+width+", height="+height);
//	debugWindow ("ww="+ww+", wh="+wh+", sbx="+sbx+", sby="+sby);

	var pos = new Array();
	
	pos[0] = xPos-sbx;
	pos[1] = yPos-sby;
	
	return pos;
}

/**
 * Sendet für alle Radiobuttons, die den gleichen Namen wie
 * der übergebene Button haben einen "click". Dies simuliert,
 * dass bei Auswahl eines Radiobuttons alle anderen abgewählt werden.  
 * @param selectedRadio - ausgewählter Button
 * @return false
 */
function toggleRadios(event, selectedRadio) {
	var id = selectedRadio.getAttribute("id");
	var name = selectedRadio.getAttribute("name");
	if(name) {
		var elements = document.getElementsByName(name);
		for(var i = 0; i < elements.length; i++) {
			var e = elements[i];
			if(id != e.getAttribute("id")) {
				ajaxEventCallback(event, e);
			}
		}
	}
	// TODO
}

var baMenuID = null;
var baMenuTimer = null;
var ignoreBaMenuOpen = false;

function ShowBaMenu (_id, vis) {
//	debugWindow ('ShowBaMenu ('+_id+', '+vis+')');
	var ele = document.getElementById (_id);
	if (vis == 1) {
		// Aus nicht näher bekannten Gründen möchte der IE das DropDown-Menu noch einmal kurz aufblinken lassen.
		// Da wir das nicht möchten, versuchen wir es zu verhindern.
		if (ignoreBaMenuOpen && $.browser.msie) {
//			debugWindow ('ShowBaMenu IGNORED');
			ignoreBaMenuOpen = false;
			return;
		}
		if (baMenuTimer != null) {
			window.clearTimeout(baMenuTimer);
			baMenuTimer=null;
		}
		if (baMenuID != null) {
			var oldMenu = document.getElementById (baMenuID);
			if (ele != oldMenu) {
				HideBaMenu ();
			}
		}
		var mEle = $('#'+_id);
		var dis = mEle.css('display');
		if (!dis) dis="none";
		if (dis == "none") {
			// Hier eine anständige Position für das Menü berechen
			var left = pb.e.x -2;
			var top = pb.e.y -2;
			
//			Auskommentiert wegen #13729
//			if ($.browser.msie) {
//				left += document.body.scrollLeft;
//				top  += document.body.scrollTop;
//			}
			var eleHeight = mEle.height()+10;
			if (($(window).height() + $(document).scrollTop()) < (top + eleHeight)) {
				top -= (eleHeight);
			}

			mEle.css('left', left).css('top', top).toggle ();
		}

	} else {
		var dis = $('#'+_id).css('display');
		if (!dis) dis="none";
		if ( (baMenuTimer==null) && (dis != "none") ) {
			baMenuID = _id;
			baMenuTimer=window.setTimeout("HideBaMenu ()",200);
		}
	}
}



function HideBaMenu () {
//	debugWindow ('HideBaMenu ('+baMenuID+')');
	$('#'+baMenuID).toggle ();
	baMenuTimer=null;
	baMenuID = null;
}

function menuEntryToggle (ele) {
	baMenuID = ele.getAttribute ("menuID");
	HideBaMenu ();
	
	ajaxEventCallback ('click', ele.parentNode);
	return (false);
}


function menuLinkToggle (ele) {
	baMenuID = ele.getAttribute ("menuID");
	HideBaMenu ();

	return true;
}



function hoverIn (ele) {
	ele.style.backgroundColor = StyleDefinitions.getColorDef ("GuiBaTableRowHighlightBackground");
}

function hoverOut (ele) {
	ele.style.backgroundColor = "";
}

function hoverStatusTitle(ele) { window.status = ele.getAttribute('title'); }

function hoverResetStatus() { window.status = ""; return true; }

function nop() {  }


/* JsInclude file=styledefs.js */
/* DO NOT CHANGE ANYTHING BELOW THIS LINE */
/* This file is generated from inputFile WEB-INF/properties/styles.properties */

var StyleDefinitionsClass = function() {
	this.fontDefs=new Array();
	this.colorDefs=new Array();
	this.imageSize=new Array();
	this.fontFaktor=1.0;
	this.fontUnit="pt";

	/* Font Definitions */
	this.fontDefs["DefaultFont"]="Verdana, Arial,  helvetica, sans-serif";
	this.fontDefs["FontFaktor.Linux"]="1.3";
	this.fontDefs["FontFaktor.Mac"]="1.3";
	this.fontDefs["FontFaktor.Windows"]="1";
	this.fontDefs["FontProperty.Chart.Axis.Scale"]="plain";
	this.fontDefs["FontProperty.Chart.Axis.Title"]="plain";
	this.fontDefs["FontProperty.Chart.Axis.Value"]="plain";
	this.fontDefs["FontProperty.Chart.Legend"]="plain";
	this.fontDefs["FontProperty.Chart.PIE.Value"]="plain";
	this.fontDefs["FontProperty.Chart.Title"]="plain";
	this.fontDefs["FontSize.Chart.Axis.Scale"]=8.0;
	this.fontDefs["FontSize.Chart.Axis.Title"]=8.0;
	this.fontDefs["FontSize.Chart.Axis.Value"]=8.0;
	this.fontDefs["FontSize.Chart.Cockpit.Axis.Title"]=12.0;
	this.fontDefs["FontSize.Chart.Legend"]=10.0;
	this.fontDefs["FontSize.Chart.PIE.Value"]=8.0;
	this.fontDefs["FontSize.Chart.Title"]=10.0;
	this.fontDefs["FontSizeHuge"]=12.0;
	this.fontDefs["FontSizeLarge"]=9.0;
	this.fontDefs["FontSizeLoginNormal.Linux"]=9.0;
	this.fontDefs["FontSizeLoginNormal.Windows"]=9.0;
	this.fontDefs["FontSizeLoginSmall.Linux"]=8.0;
	this.fontDefs["FontSizeLoginSmall.Windows"]=8.0;
	this.fontDefs["FontSizeNano"]=6.0;
	this.fontDefs["FontSizeNormal"]=9.0;
	this.fontDefs["FontSizeSmall"]=8.0;
	this.fontDefs["FontSizeTiny"]=8.0;

	/* Color Definitions */
	this.colorDefs["AbsenceAbgelehnt"]="#FF9BA4";
	this.colorDefs["AbsenceAbsence"]="#F5A3E6";
	this.colorDefs["AbsenceAbwesenheit"]="#F5A3E6";
	this.colorDefs["AbsenceAccept"]="#ACD7A6";
	this.colorDefs["AbsenceBeantragt"]="#C3A5D6";
	this.colorDefs["AbsenceDeleted"]="#ff00ff";
	this.colorDefs["AbsenceDenial"]="#FF9BA4";
	this.colorDefs["AbsenceGenehmigt"]="#ACD7A6";
	this.colorDefs["AbsenceGeplant"]="#FFF0C6";
	this.colorDefs["AbsenceInBearbeitung"]="#C3A5D6";
	this.colorDefs["AbsenceNormal"]="#4040ff";
	this.colorDefs["AbsenceOverviewFree"]="#DBEAF5";
	this.colorDefs["AbsenceOverviewFreeDark"]="#CBDAF5";
	this.colorDefs["AbsenceOverviewProject"]="#485A85";
	this.colorDefs["AbsenceOverviewWork"]="#BDF5EA";
	this.colorDefs["AbsenceOverviewWorkDark"]="#BDF5EA";
	this.colorDefs["AbsencePlan"]="#FFF0C6";
	this.colorDefs["AbsenceProgress"]="#C3A5D6";
	this.colorDefs["AbsenceRequest"]="#C3A5D6";
	this.colorDefs["ActivatFieldBackground"]="#FFFFFF";
	this.colorDefs["ActivatFieldDisabledBackground"]="#E2E2E2";
	this.colorDefs["Alert"]="#FF5868";
	this.colorDefs["AlertBackground"]="#FF9999";
	this.colorDefs["ArchiveProject"]="#666666";
	this.colorDefs["BackgroundBlue"]="#FFCC43";
	this.colorDefs["BackgroundGreen"]="#ACD7A6";
	this.colorDefs["BackgroundGreyDark"]="#333333";
	this.colorDefs["BackgroundGreyLight"]="#EEEEEE";
	this.colorDefs["BackgroundLikeTableBorder"]="#CCCCCC";
	this.colorDefs["BackgroundLikeTableHeader"]="#B0B0B0";
	this.colorDefs["BackgroundRed"]="#FF9999";
	this.colorDefs["BackgroundYellow"]="#FFF0C6";
	this.colorDefs["Black"]="#000000";
	this.colorDefs["ButtonActive"]="#FFFFFF";
	this.colorDefs["ButtonActiveBackground"]="#475C87";
	this.colorDefs["ButtonDisabled"]="#000000";
	this.colorDefs["ButtonDisabledBackground"]="#E2E2E2";
	this.colorDefs["COLOR_0000FF"]="#0000FF";
	this.colorDefs["COLOR_008000"]="#008000";
	this.colorDefs["COLOR_00FF00"]="#00FF00";
	this.colorDefs["COLOR_00FFFF"]="#00FFFF";
	this.colorDefs["COLOR_2F4D8D"]="#2F4D8D";
	this.colorDefs["COLOR_376CCA"]="#376CCA";
	this.colorDefs["COLOR_3DCD3C"]="#3DCD3C";
	this.colorDefs["COLOR_404040"]="#404040";
	this.colorDefs["COLOR_404080"]="#404080";
	this.colorDefs["COLOR_526B9A"]="#526B9A";
	this.colorDefs["COLOR_707070"]="#707070";
	this.colorDefs["COLOR_75BD6B"]="#75BD6B";
	this.colorDefs["COLOR_7A7A7A"]="#7A7A7A";
	this.colorDefs["COLOR_82A8EE"]="#82A8EE";
	this.colorDefs["COLOR_888888"]="#888888";
	this.colorDefs["COLOR_9CCBFF"]="#9CCBFF";
	this.colorDefs["COLOR_A0A0A0"]="#A0A0A0";
	this.colorDefs["COLOR_A0B0FF"]="#A0B0FF";
	this.colorDefs["COLOR_AAAAAA"]="#AAAAAA";
	this.colorDefs["COLOR_ABSENCE"]="#ACD7A6";
	this.colorDefs["COLOR_ADC7FE"]="#ADC7FE";
	this.colorDefs["COLOR_C0C0C0"]="#C0C0C0";
	this.colorDefs["COLOR_C0D0FF"]="#C0D0FF";
	this.colorDefs["COLOR_C0FFD0"]="#C0FFD0";
	this.colorDefs["COLOR_CCCCCC"]="#CCCCCC";
	this.colorDefs["COLOR_CCE5FD"]="#CCE5FD";
	this.colorDefs["COLOR_D7E4FF"]="#D7E4FF";
	this.colorDefs["COLOR_D92F2F"]="#D92F2F";
	this.colorDefs["COLOR_D9FFDF"]="#D9FFDF";
	this.colorDefs["COLOR_DDDDDD"]="#DDDDDD";
	this.colorDefs["COLOR_DDDDFF"]="#DDDDFF";
	this.colorDefs["COLOR_E0E0DE"]="#E0E0DE";
	this.colorDefs["COLOR_E2E2E2"]="#E2E2E2";
	this.colorDefs["COLOR_E8E8E8"]="#E2E2E2";
	this.colorDefs["COLOR_EDE98A"]="#EDE98A";
	this.colorDefs["COLOR_F0F0F0"]="#FFFFFF";
	this.colorDefs["COLOR_F2E0C0"]="#F2E0C0";
	this.colorDefs["COLOR_F5A3E6"]="#F5A3E6";
	this.colorDefs["COLOR_FF00FF"]="#FF00FF";
	this.colorDefs["COLOR_FF2121"]="#FF2121";
	this.colorDefs["COLOR_FF5868"]="#FF5868";
	this.colorDefs["COLOR_FF9900"]="#FF9900";
	this.colorDefs["COLOR_FFC0D0"]="#FFC0D0";
	this.colorDefs["COLOR_FFCC43"]="#FFCC43";
	this.colorDefs["COLOR_FFDDA0"]="#FFDDA0";
	this.colorDefs["COLOR_FFE0E0"]="#FFE0E0";
	this.colorDefs["COLOR_FFFF33"]="#FFFF33";
	this.colorDefs["COLOR_FFFF99"]="#FFFF99";
	this.colorDefs["COLOR_FFFFDD"]="#FFFFDD";
	this.colorDefs["COLOR_FFFFFF"]="#FFFFFF";
	this.colorDefs["COLOR_OVERFLOW_FULL"]="#FF0000";
	this.colorDefs["COLOR_OVERFLOW_PARTIAL"]="#FE8800";
	this.colorDefs["COLOR_STAFF"]="#DDDDFF";
	this.colorDefs["CalendarDayAbsence"]="#F5A3E6";
	this.colorDefs["CalendarDayAccept"]="#ACD7A6";
	this.colorDefs["CalendarDayDenial"]="#FF9BA4";
	this.colorDefs["CalendarDayDenialNoLink"]="#FF9BA4";
	this.colorDefs["CalendarDayFreeDay"]="#DBEAF5";
	this.colorDefs["CalendarDayNormal"]="#FFFFFF";
	this.colorDefs["CalendarDayPlan"]="#FFF0C6";
	this.colorDefs["CalendarDayPlanNoLink"]="#FFF0C6";
	this.colorDefs["CalendarDayProgress"]="#C3A5D6";
	this.colorDefs["CalendarDayRequest"]="#C3A5D6";
	this.colorDefs["CalendarWeekVisualizer_DEFAULT_EVENT_BG_COLOR"]="#FFFFFF";
	this.colorDefs["CalendarWeekVisualizer_DEFAULT_EVENT_FG_COLOR"]="#000000";
	this.colorDefs["CalendarWeekVisualizer_DEFAULT_MARK_COLOR"]="#FF5868";
	this.colorDefs["Chart.Axis.Scale"]="#000000";
	this.colorDefs["Chart.Axis.Title"]="#000000";
	this.colorDefs["Chart.Axis.Value"]="#000000";
	this.colorDefs["Chart.Blue"]="#5F7AB4";
	this.colorDefs["Chart.Common.1"]="#778691";
	this.colorDefs["Chart.Common.10"]="#8b9aa5";
	this.colorDefs["Chart.Common.11"]="#c3b48a";
	this.colorDefs["Chart.Common.12"]="#8769b4";
	this.colorDefs["Chart.Common.13"]="#709b6a";
	this.colorDefs["Chart.Common.14"]="#c35f69";
	this.colorDefs["Chart.Common.15"]="#9faeb9";
	this.colorDefs["Chart.Common.16"]="#d7c89e";
	this.colorDefs["Chart.Common.17"]="#9b7dc8";
	this.colorDefs["Chart.Common.18"]="#84af7e";
	this.colorDefs["Chart.Common.19"]="#d7737d";
	this.colorDefs["Chart.Common.2"]="#9b3741";
	this.colorDefs["Chart.Common.20"]="#b3c2cd";
	this.colorDefs["Chart.Common.21"]="#ebdcb2";
	this.colorDefs["Chart.Common.22"]="#af91dc";
	this.colorDefs["Chart.Common.23"]="#98c392";
	this.colorDefs["Chart.Common.24"]="#eb8791";
	this.colorDefs["Chart.Common.25"]="#c7d6e1";
	this.colorDefs["Chart.Common.26"]="#FFF0C6";
	this.colorDefs["Chart.Common.27"]="#C3A5D6";
	this.colorDefs["Chart.Common.28"]="#ACD7A6";
	this.colorDefs["Chart.Common.29"]="#FF9BA4";
	this.colorDefs["Chart.Common.3"]="#487342";
	this.colorDefs["Chart.Common.30"]="#DBEAF5";
	this.colorDefs["Chart.Common.31"]="#CC4653";
	this.colorDefs["Chart.Common.32"]="#C3A5D6";
	this.colorDefs["Chart.Common.33"]="#5F7AB4";
	this.colorDefs["Chart.Common.34"]="#75BD6B";
	this.colorDefs["Chart.Common.35"]="#FFCC43";
	this.colorDefs["Chart.Common.4"]="#5f418c";
	this.colorDefs["Chart.Common.5"]="#9b8c62";
	this.colorDefs["Chart.Common.6"]="#afa076";
	this.colorDefs["Chart.Common.7"]="#7355a0";
	this.colorDefs["Chart.Common.8"]="#5c8756";
	this.colorDefs["Chart.Common.9"]="#af4b55";
	this.colorDefs["Chart.Green"]="#75BD6B";
	this.colorDefs["Chart.Investment.BaseLine"]="#5F7AB4";
	this.colorDefs["Chart.Investment.Guessed"]="#FFCC43";
	this.colorDefs["Chart.Investment.Is"]="#CC4653";
	this.colorDefs["Chart.Investment.Plan"]="#75BD6B";
	this.colorDefs["Chart.Investment.RestGuessed"]="#C3A5D6";
	this.colorDefs["Chart.Legend"]="#000000";
	this.colorDefs["Chart.Line.Color_1"]="#FF586F";
	this.colorDefs["Chart.Line.Color_2"]="#5F7AB4";
	this.colorDefs["Chart.Line.Color_3"]="#75BD6B";
	this.colorDefs["Chart.Line.Color_4"]="#FFCC43";
	this.colorDefs["Chart.Line.Color_5"]="#FF55FF";
	this.colorDefs["Chart.Line.Color_6"]="#55FFFF";
	this.colorDefs["Chart.Magenta"]="#FF55FF";
	this.colorDefs["Chart.PIE.Value"]="#000000";
	this.colorDefs["Chart.Pie.Color_1"]="#FF586F";
	this.colorDefs["Chart.Pie.Color_2"]="#5F7AB4";
	this.colorDefs["Chart.Pie.Color_3"]="#75BD6B";
	this.colorDefs["Chart.Pie.Color_4"]="#FFCC43";
	this.colorDefs["Chart.Pie.Color_5"]="#FF55FF";
	this.colorDefs["Chart.Pie.Color_6"]="#55FFFF";
	this.colorDefs["Chart.Progress.Color_1"]="#FF586F";
	this.colorDefs["Chart.Progress.Color_2"]="#5F7AB4";
	this.colorDefs["Chart.Progress.Color_3"]="#75BD6B";
	this.colorDefs["Chart.Progress.Color_4"]="#FFCC43";
	this.colorDefs["Chart.Progress.Color_5"]="#FF55FF";
	this.colorDefs["Chart.Progress.Color_6"]="#55FFFF";
	this.colorDefs["Chart.Red"]="#FF586F";
	this.colorDefs["Chart.Title"]="#000000";
	this.colorDefs["Chart.Turquoise"]="#55FFFF";
	this.colorDefs["Chart.Yellow"]="#FFCC43";
	this.colorDefs["CheckboxActive"]="#000000";
	this.colorDefs["CheckboxActiveBackground"]="#FFFFFF";
	this.colorDefs["CheckboxDisabled"]="#000000";
	this.colorDefs["CheckboxDisabledBackground"]="#E2E2E2";
	this.colorDefs["ConflictStateDeleted"]="#FF0000";
	this.colorDefs["ContactHasAccount"]="#0000FF";
	this.colorDefs["ContentLeftBorder"]="#485a85";
	this.colorDefs["ContentScrollBarBase"]="#ADC2ED";
	this.colorDefs["ContentScrollBarFace"]="#485a85";
	this.colorDefs["ContentScrollBarTrack"]="#D9D6F3";
	this.colorDefs["Controlling.Baseline.NegativeDelta"]="#FF5868";
	this.colorDefs["DEFAULT_REPORT_BACKGROUND_COLOR"]="#ffffff";
	this.colorDefs["DMS_Border"]="#808080";
	this.colorDefs["DMS_Disabled"]="#808080";
	this.colorDefs["DMS_DocumentDetailBackground"]="#FFFFFF";
	this.colorDefs["DMS_DocumentDetailBorder"]="#808080";
	this.colorDefs["DMS_DragDropBackground"]="#FFFFFF";
	this.colorDefs["DMS_DragDropBorder"]="#FFFFFF";
	this.colorDefs["DMS_DragDropShowitBackground"]="#FF0000";
	this.colorDefs["DMS_DragDropShowitBorder"]="#FFB2B2";
	this.colorDefs["DMS_FloatMenuBackground"]="#999999";
	this.colorDefs["DMS_FolderContentBackground"]="#EEEEEE";
	this.colorDefs["DMS_FolderListEntryBackground"]="#FFCCCC";
	this.colorDefs["DMS_Highlight"]="#B2B2FF";
	this.colorDefs["DMS_MoveFrmEntryDisabled"]="#FFCCCC";
	this.colorDefs["DMS_Search_RevEntryBorder"]="#808080";
	this.colorDefs["DarkGray"]="#333333";
	this.colorDefs["DefaultCalendar"]="#0000FF";
	this.colorDefs["DefaultFontColor"]="#000000";
	this.colorDefs["DevelToolsLink"]="#FFFF00";
	this.colorDefs["ElementDisabled"]="#808080";
	this.colorDefs["FakturaPorjectSearchFixed"]="#0000FF";
	this.colorDefs["FieldActive"]="#000000";
	this.colorDefs["FieldActiveBackground"]="#FFFFFF";
	this.colorDefs["FieldDisabled"]="#000000";
	this.colorDefs["FieldDisabledBackground"]="#E2E2E2";
	this.colorDefs["FieldErrorBackground"]="#FF9999";
	this.colorDefs["FieldErrorDisabledOption"]="#333333";
	this.colorDefs["FieldPassive"]="#999999";
	this.colorDefs["FloatMenuBackground"]="#FFFFFF";
	this.colorDefs["ForecastDash"]="#000000 ";
	this.colorDefs["ForecastLegendBackground_1"]="#ACD7A6";
	this.colorDefs["ForecastLegendBackground_2"]="#FF0000";
	this.colorDefs["ForecastLegendBackground_3"]="#FE8800";
	this.colorDefs["ForecastLegendBackground_4"]="#DBEAF5";
	this.colorDefs["ForecastLegendBorder"]="#000000";
	this.colorDefs["FormBackground"]="#E2E2E2";
	this.colorDefs["FormBorder"]="#7A7A7A";
	this.colorDefs["FormConfirm"]="#FF5868";
	this.colorDefs["FormEingabe"]="#75BD6B";
	this.colorDefs["FormFilter"]="#485a85";
	this.colorDefs["FormOutput"]="#FFCC43";
	this.colorDefs["FormToolbar"]="#A3B5DC";
	this.colorDefs["GanttBackgroundColor_1"]="#F0F0FF";
	this.colorDefs["GanttBackgroundColor_2"]="#FFFFFF";
	this.colorDefs["GanttBackgroundColor_3"]="#F0F0FF";
	this.colorDefs["GanttBackgroundColor_4"]="#FFFFFF";
	this.colorDefs["GanttDefaultLineColor"]="#606060";
	this.colorDefs["GanttLineBorder"]="#808080";
	this.colorDefs["GanttLineInfoBackground"]="#FFFFFF";
	this.colorDefs["GanttTextMainBackground"]="#FFFFFF";
	this.colorDefs["GanttTextMainBorder"]="#DDDDDD";
	this.colorDefs["GanttTimeLineBack"]="#DDDDDD";
	this.colorDefs["GanttTimeLineMain"]="#FFFFFF";
	this.colorDefs["GanttTimeLinePast"]="#AAAAAA";
	this.colorDefs["GanttTimeLineToday"]="#000000";
	this.colorDefs["Gray"]="#808080";
	this.colorDefs["GuiBaTableBorder"]="#CCCCCC";
	this.colorDefs["GuiBaTableRowHighlightBackground"]="#DDDDFF";
	this.colorDefs["GuiButtonLinkColor"]="#475C87";
	this.colorDefs["GuiEmailLinkColor"]="#0000FF";
	this.colorDefs["HolidayAbwesend"]="#CC3333";
	this.colorDefs["Ibbs_TV"]="#0000FF";
	this.colorDefs["ImageLegendItemBorder"]="#000000";
	this.colorDefs["InternalMessage"]="#c0c0c0";
	this.colorDefs["InternalMessageRow"]="#FFFFFF";
	this.colorDefs["JRowBackground"]="#808080";
	this.colorDefs["JTableBackgroundColorUngerade"]="#ffffff";
	this.colorDefs["JUnderlineBorder"]="#808080";
	this.colorDefs["KnowledgeName"]="#0000FF";
	this.colorDefs["KnowledgeSearchGreen"]="#008000";
	this.colorDefs["KnowledgeSearchOrange"]="#ff9900";
	this.colorDefs["KnowledgeSearchRed"]="#ff0000";
	this.colorDefs["LegendeBorder"]="#000000";
	this.colorDefs["LightGray"]="#EEEEEE";
	this.colorDefs["ListBoxEntryDisabled"]="#808080";
	this.colorDefs["LoginBackground"]="#a3b5dc";
	this.colorDefs["LoginDark"]="#3E5C90";
	this.colorDefs["LoginInfo"]="#FFFFFF";
	this.colorDefs["LoginLabel"]="#000000";
	this.colorDefs["LoginLabelEn"]="#3E5C90";
	this.colorDefs["LoginLight"]="#a3b5dc";
	this.colorDefs["LoginMediumDark"]="#5872A0";
	this.colorDefs["LoginMediumLight"]="#6A84B5";
	this.colorDefs["LoginTabDe"]="#305DA0";
	this.colorDefs["LoginTabDisabled"]="#8399c5";
	this.colorDefs["LoginTabEn"]="#3E5C90";
	this.colorDefs["MSFormLine"]="#0000DD";
	this.colorDefs["MSFormLineAbsenceBackground"]="#00FFCC";
	this.colorDefs["MSFormLineDefaultBackground"]="#FFFFFF";
	this.colorDefs["MSFormLineHolidayBackground"]="#CCCCCC";
	this.colorDefs["MSFormLineNormalBackground"]="#FFFFFF";
	this.colorDefs["MSFormLineSaturdayBackground"]="#E2E2E2";
	this.colorDefs["MSFormLineSundayBackground"]="#E2E2E2";
	this.colorDefs["MSFormLineVacationPermittedBackground"]="#33CC00";
	this.colorDefs["MSFormLineVacationRequestedBackground"]="#FFFF00";
	this.colorDefs["MaskeFlashBackground"]="#FFFFFF";
	this.colorDefs["MenuButtonBarBorder"]="#CCCCCC";
	this.colorDefs["MenuButtonBarDropBackground"]="#FFFFFF";
	this.colorDefs["MenuButtonBarTopBorder"]="#EEEEEE";
	this.colorDefs["MenuButtonDropHighlight"]="#DDDDFF";
	this.colorDefs["MenuepunktSelectedBackground"]="#CCDCFE";
	this.colorDefs["MessageBackground"]="#FFDEE1";
	this.colorDefs["MessagesMessage"]="#000000";
	this.colorDefs["MessagesMessageError"]="#FF5868";
	this.colorDefs["MessagesMessageWarning"]="#FF5868";
	this.colorDefs["Milestone"]="#000000";
	this.colorDefs["MilestoneBackground"]="#FFFFFF";
	this.colorDefs["MilestoneToday"]="#888888";
	this.colorDefs["MilestoneTrendLine"]="#800000";
	this.colorDefs["MilestoneTrendTimeLine"]="#CCCCCC";
	this.colorDefs["MilestoneTrendTimeLineText"]="#000000";
	this.colorDefs["MilestoneTriangle"]="#EEEEEE";
	this.colorDefs["NavigationBackground"]="#a3b5dc";
	this.colorDefs["NavigationBackground_1"]="#5D6F9E";
	this.colorDefs["NavigationBackground_2"]="#C7D4F1";
	this.colorDefs["NavigationBackground_3"]="#C7D4F1";
	this.colorDefs["NavigationBorder"]="#607095";
	this.colorDefs["NavigationLeftBackground"]="#485a85";
	this.colorDefs["NavigationSelectedBackground"]="#CCDCFE";
	this.colorDefs["Navigation_1"]="#FFFFFF";
	this.colorDefs["Navigation_2"]="#485a85";
	this.colorDefs["Navigation_3"]="#485a85";
	this.colorDefs["NetworkArrowColor"]="#000000";
	this.colorDefs["NetworkBackground"]="#FFFFFF";
	this.colorDefs["NetworkCriticalArrowColor"]="#FF0000";
	this.colorDefs["NetworkLineColor"]="#666666";
	this.colorDefs["OrderReport_BodyBorderColor"]="#000000";
	this.colorDefs["OrderReport_CaptionBackgroundColor"]="#B0B0B0";
	this.colorDefs["OrderReport_DottedBorderColor"]="#AAAAAA";
	this.colorDefs["OrderReport_HeaderBackgroundColor"]="#D1E3EE";
	this.colorDefs["OrderReport_HeaderBorderColor"]="#E0E0E0";
	this.colorDefs["OvertimeActual"]="#3E9E07";
	this.colorDefs["OvertimeLeft"]="#FF0000";
	this.colorDefs["OvertimeNormal"]="#000000";
	this.colorDefs["OvertimeOpen"]="#FF0000";
	this.colorDefs["OvertimePrevious"]="#444444";
	this.colorDefs["PORTLET_BACKGROUND"]="#FFFFFF";
	this.colorDefs["PORTLET_FOOTER_COLOR"]="#485a85";
	this.colorDefs["PORTLET_HEADER_BACKGROUND"]="#a3b5dc";
	this.colorDefs["PORTLET_HEADER_COLOR"]="#FFFFFF";
	this.colorDefs["PORTLET_STATUS_BACKGROUND"]="#a3b5dc";
	this.colorDefs["PO_prj_state_label"]="#2F4D8D";
	this.colorDefs["ParticipationRowBackground"]="#b2b2ff";
	this.colorDefs["PersonalProjectList"]="#425A94";
	this.colorDefs["PersonalProjectListBackground"]="#FFFFFF";
	this.colorDefs["PlanActionEstimated"]="#808080";
	this.colorDefs["Planner.Calculated"]="#000000";
	this.colorDefs["Planner.UserEntered"]="#0000FF";
	this.colorDefs["PlannerBlockDefault"]="#485A85";
	this.colorDefs["PlannerBlockFixedDefault"]="#A0A0A0";
	this.colorDefs["PlannerBlockFixedMilestone"]="#555555";
	this.colorDefs["PlannerBlockFixedSammel"]="#000000";
	this.colorDefs["PlannerBlockMilestone"]="#00AA00";
	this.colorDefs["PlannerBlockProgress1"]="#40C040";
	this.colorDefs["PlannerBlockProgress1Fixed"]="#6A6A6A";
	this.colorDefs["PlannerBlockProgress2"]="#C04040";
	this.colorDefs["PlannerBlockProgress2Fixed"]="#6A6A6A";
	this.colorDefs["PlannerBlockSammel"]="#000000";
	this.colorDefs["PlannerGanttCritical"]="#FF0000";
	this.colorDefs["PlannerReportEstimated"]="#FF0000";
	this.colorDefs["PlannerReportMilstone"]="#0000FF";
	this.colorDefs["PortletFooterInnerBorder"]="#FFFFFF";
	this.colorDefs["PortletHeaderInnerBorder"]="#5f6f9f";
	this.colorDefs["PortletHeaderOuterBorder"]="#FFFFFF";
	this.colorDefs["PrjBlattProgressFortschritt100"]="#808080";
	this.colorDefs["PrjBlattProgressObjektiv"]="#0000A0";
	this.colorDefs["PrjBlattProgressRowBackground"]="#dddddd";
	this.colorDefs["PrjBlattProgressSubjektiv"]="#0080C0";
	this.colorDefs["PrjBlattRowBackground"]="#FFFFFF";
	this.colorDefs["ProjectGanttBlock"]="#808080";
	this.colorDefs["ProjectGanttBlockLink"]="#485A85";
	this.colorDefs["ProjectSheet.IndicatorBackground_1"]="#a0a0a0";
	this.colorDefs["ProjectSheet.IndicatorBackground_2"]="#336699";
	this.colorDefs["ProjectSheet.IndicatorBackground_3"]="#9ca9ce";
	this.colorDefs["ProjectSheet.IndicatorBackground_4"]="#FF9BA4";
	this.colorDefs["ProjectSheet.IndicatorBackground_5"]="#E2E2E2";
	this.colorDefs["ProjectSheet.IndicatorBackground_6"]="#E2E2E2";
	this.colorDefs["ProjectSheet.IndicatorColor_1"]="#000000";
	this.colorDefs["ProjectSheet.IndicatorColor_2"]="#FFFFFF";
	this.colorDefs["ProjectSheet.IndicatorColor_3"]="#000000";
	this.colorDefs["ProjectSheet.IndicatorColor_4"]="#000000";
	this.colorDefs["ProjectSheet.IndicatorColor_5"]="#E2E2E2";
	this.colorDefs["ProjectSheet.IndicatorColor_6"]="#000000";
	this.colorDefs["REPORT_BACKGROUND_COLOR"]="#B0B0B0";
	this.colorDefs["Red"]="#FF0000";
	this.colorDefs["RefreshLayerContentInfoBorder"]="#008000";
	this.colorDefs["RefreshLayerContentInfoDivBackground"]="#FF0000";
	this.colorDefs["Release"]="#485a85";
	this.colorDefs["ReportHtml_BrBackground"]="#FFFFFF";
	this.colorDefs["ReportHtml_DefaultBorder"]="#000000";
	this.colorDefs["ReportHtml_DefaultCaptionBackground"]="#B0B0B0";
	this.colorDefs["ReportHtml_DefaultTrBackground"]="#FFFFFF";
	this.colorDefs["ReportHtml_GrayBackground"]="#DDDDDD";
	this.colorDefs["ReportHtml_ReportColor"]="#000000";
	this.colorDefs["ReportHtml_ReportFooterBackground"]="#DDDDDD";
	this.colorDefs["ReportHtml_ReportFooterSpacingBackground"]="#FFFFFF";
	this.colorDefs["ReportHtml_ReportHeaderBackground"]="#DDDDDD";
	this.colorDefs["ReportHtml_ReportHeaderColor"]="#333333";
	this.colorDefs["ReportHtml_ReportHeaderSpacingBackground"]="#FFFFFF";
	this.colorDefs["ReportPdf_DefaultBorder"]="#000000";
	this.colorDefs["ReportPdf_DefaultCaptionBackground"]="#B0B0B0";
	this.colorDefs["ReportPdf_DefaultTrBackground"]="#FFFFFF";
	this.colorDefs["ReportPdf_GrayBackground"]="#DDDDDD";
	this.colorDefs["ReportPdf_ReportColor"]="#000000";
	this.colorDefs["ReportPdf_ReportFooterBackground"]="#DDDDDD";
	this.colorDefs["ReportPdf_ReportFooterBorder"]="#000000";
	this.colorDefs["ReportPdf_ReportHeaderBackground"]="#DDDDDD";
	this.colorDefs["ReportPdf_ReportHeaderBorder"]="#000000";
	this.colorDefs["ReportPdf_ReportHeaderColor"]="#333333";
	this.colorDefs["ReportPdf_ReportHeaderNoBorder"]="#FFFFFF";
	this.colorDefs["ReportRowBackground"]="#B0B0B0";
	this.colorDefs["Report_DefaultBackground"]="#FFFFFF";
	this.colorDefs["Report_DefaultBorder"]="#000000";
	this.colorDefs["Report_DefaultCaptionBackground"]="#B0B0B0";
	this.colorDefs["Report_DefaultColor"]="#000000";
	this.colorDefs["Report_DefaultTrBackground"]="#FFFFFF";
	this.colorDefs["Report_GrayBackground"]="#DDDDDD";
	this.colorDefs["Report_ReportFooterBackground"]="#DDDDDD";
	this.colorDefs["Report_ReportHeaderBackground"]="#DDDDDD";
	this.colorDefs["ReservationBody"]="#E2E2E2";
	this.colorDefs["ReservationFuture"]="#DBEAF5";
	this.colorDefs["ReservationOpen"]="#FFFFFF";
	this.colorDefs["ReservationRetroactive"]="#FFFFFF";
	this.colorDefs["SQLColumnLink"]="#000000";
	this.colorDefs["SQLHeaderBorder"]="#808080";
	this.colorDefs["SelectedProjectParticipation"]="#0000FF";
	this.colorDefs["SelectedStaffBackground"]="#FF0000";
	this.colorDefs["SelectedStaffColor"]="#FFFF00";
	this.colorDefs["SessionDumpBackgroundColor"]="#E2E2E2";
	this.colorDefs["SessionDumpHeader"]="#FFE0E0";
	this.colorDefs["Severity.Background.0"]="#FFFFFF";
	this.colorDefs["Severity.Background.1"]="#FFF0C6";
	this.colorDefs["Severity.Background.2"]="#FF9BA4";
	this.colorDefs["Severity.Background.Error"]="#FF9BA4";
	this.colorDefs["Severity.Background.Info"]="#FFFFFF";
	this.colorDefs["Severity.Background.Warn"]="#FFF0C6";
	this.colorDefs["Severity.Foreground.0"]="#000000";
	this.colorDefs["Severity.Foreground.1"]="#000000";
	this.colorDefs["Severity.Foreground.2"]="#000000";
	this.colorDefs["Severity.Foreground.Error"]="#000000";
	this.colorDefs["Severity.Foreground.Info"]="#000000";
	this.colorDefs["Severity.Foreground.Warn"]="#000000";
	this.colorDefs["StaffEntering"]="#3E9E07";
	this.colorDefs["StaffLeaving"]="#FF5868";
	this.colorDefs["StatReportHeaderBackground"]="#a3b5dc";
	this.colorDefs["StatReportStateBackground"]="#485a85";
	this.colorDefs["SystemDark"]="#485a85";
	this.colorDefs["SystemLight"]="#CCDCFE";
	this.colorDefs["SystemMedium"]="#a3b5dc";
	this.colorDefs["SystemMediumDark"]="#475C87";
	this.colorDefs["SystemMediumLight"]="#7799E1";
	this.colorDefs["TabBackground"]="#CCCCCC";
	this.colorDefs["TabBackgroundSelected"]="#E2E2E2";
	this.colorDefs["TabBodyTopBorder"]="#B0B0B0";
	this.colorDefs["TabBorder"]="#7A7A7A";
	this.colorDefs["TabFlag"]="#444444";
	this.colorDefs["TabFlagSelected"]="#000000";
	this.colorDefs["TabelLayoutBorder"]="#485a85";
	this.colorDefs["TableBackground"]="#DDDDDD";
	this.colorDefs["TableCaptionWorktimeTopBorderColor"]="#FFFFFF";
	this.colorDefs["TableHeaderBackground"]="#B0B0B0";
	this.colorDefs["TableHeaderBackgroundColor"]="#B0B0B0";
	this.colorDefs["TableHeaderForegroundColor"]="#333333";
	this.colorDefs["TableHeaderRowHighlight"]="#DDDDFF";
	this.colorDefs["TaskViewMilestone"]="#0000FF";
	this.colorDefs["Task_OverbookedBackground"]="#FF9999";
	this.colorDefs["Task_OverbookedWarningForeground"]="#FFFFFF";
	this.colorDefs["Task_Resource_Background"]="#F6F1D9";
	this.colorDefs["Task_Resource_Foreground"]="#808080";
	this.colorDefs["Task_WithoutPeriodRelevanceBackground"]="#EEEEEE";
	this.colorDefs["Task_WithoutPeriodRelevanceForeground"]="#808080";
	this.colorDefs["Tasks_TaskDiff"]="#FF0000";
	this.colorDefs["Tasks_TaskName"]="#0000FF";
	this.colorDefs["Tasks_TaskPropertiesMilestone"]="#0000FF";
	this.colorDefs["Tasks_TaskPropertiesNormal"]="#000000";
	this.colorDefs["Tasks_TaskPropertiesWarning"]="#FF9900";
	this.colorDefs["Tasks_TaskPropertiesWarningError"]="#FFFFFF";
	this.colorDefs["Tasks_TaskPropertiesWarningErrorIE"]="#000000";
	this.colorDefs["Tasks_TaskRightBlue"]="#0000FF";
	this.colorDefs["Tasks_TaskRightRed"]="#FF0000";
	this.colorDefs["TestGanttElementBackground"]="#FFFFFF";
	this.colorDefs["TestGanttElementDefaultBackground"]="#0000FF";
	this.colorDefs["TestGanttElementTyp1Background"]="#000000";
	this.colorDefs["TestGanttElementTyp2Background"]="#008000";
	this.colorDefs["TestTestLink"]="#0000FF";
	this.colorDefs["TitleBorder"]="#485a85";
	this.colorDefs["TitleFavoriteBackground"]="#a3b5dc";
	this.colorDefs["TitleLeftBackground"]="#FFFFFF";
	this.colorDefs["TitleRightBackground"]="#a3b5dc";
	this.colorDefs["TitleUserData"]="#666666";
	this.colorDefs["Tree_DragTargetBackground"]="#FFFFFF";
	this.colorDefs["Tree_TreeNodeBackground"]="#FFFFFF";
	this.colorDefs["Tree_TreeNodeHighlight"]="#DDDDFF";
	this.colorDefs["Tree_TreeRootBackground"]="#FFFFFF";
	this.colorDefs["Tree_TreeTableColBackground"]="#B2B2FF";
	this.colorDefs["Tree_TreeTableContentBackground"]="#CCCCCC";
	this.colorDefs["Tree_TreeTableRowHighlight"]="#DDDDFF";
	this.colorDefs["VoucherHeaderBackground"]="#DDDDDD";
	this.colorDefs["WaitLogo"]="#485a85";
	this.colorDefs["WaitLogoBackground"]="#E3F2E1";
	this.colorDefs["WaitLogoBorder"]="#75BD6B";
	this.colorDefs["WeekCalendar_Border"]="#A0A0A0";
	this.colorDefs["WeekCalendar_Break_Background"]="#DBEAF5";
	this.colorDefs["WeekCalendar_Event_Background"]="#B0B070";
	this.colorDefs["WeekCalendar_Free_Background"]="#CBDAE5";
	this.colorDefs["WeekCalendar_HourLabelWt_Background"]="#E6E6CD";
	this.colorDefs["WeekCalendar_HourLabel_Background"]="#DBEAF5";
	this.colorDefs["WeekCalendar_NoWork_Background"]="#DBEAF5";
	this.colorDefs["WeekCalendar_WeEvent_Background"]="#9BAAB5";
	this.colorDefs["WeekCalendar_WeekEndBreak_Background"]="#DBEAF5";
	this.colorDefs["WeekCalendar_WeekEndWtBreak_Background"]="#DBEAF5";
	this.colorDefs["WeekCalendar_Work_Background"]="#E6E6CD";
	this.colorDefs["WeekCalendar_WtEvent_Background"]="#FFE5A1";
	this.colorDefs["WeekCalendar_X_Background"]="#FFFFFF";
	this.colorDefs["WeekProfile"]="#9ca9ce";
	this.colorDefs["WeekendColor"]="#DBEAF5";
	this.colorDefs["WelcomeTableBorder"]="#d1daed";
	this.colorDefs["WelcomeTableHeaderBackground"]="#FFFFFF";
	this.colorDefs["WelcomeTableRoleBackground"]="#e8ebf1";
	this.colorDefs["WelcomeTableRoleBorder"]="#d4d4d4";
	this.colorDefs["WelcomeTasksProjectColor"]="#000000";
	this.colorDefs["WelcomeTasksTabContentBackground"]="#FFFFFF";
	this.colorDefs["WelcomeTasksTabHeadBackground"]="#e8ebf1";
	this.colorDefs["White"]="#FFFFFF";
	this.colorDefs["WtCalendar_AbwesendBackground"]="#CC3333";
	this.colorDefs["WtCalendar_ActiveBorder"]="#FFCC43";
	this.colorDefs["WtCalendar_Background"]="#FFFFFF";
	this.colorDefs["WtCalendar_BeantragtBackground"]="#FFFF00";
	this.colorDefs["WtCalendar_CurrKW"]="#7799E1";
	this.colorDefs["WtCalendar_CurrentBackground"]="#FFCC43";
	this.colorDefs["WtCalendar_Dark"]="#4682B4";
	this.colorDefs["WtCalendar_FinishedBackground"]="#B0B0B0";
	this.colorDefs["WtCalendar_FreeBackground"]="#DBEAF5";
	this.colorDefs["WtCalendar_GenehmigtBackground"]="#33CC00";
	this.colorDefs["WtCalendar_Ignore"]="#707070";
	this.colorDefs["WtCalendar_IgnoreBackground"]="#F0F0F0";
	this.colorDefs["WtCalendar_Inner"]="#000000";
	this.colorDefs["WtCalendar_InnerBackground"]="#5F7AB4";
	this.colorDefs["WtCalendar_InnerBorder"]="#4682B4";
	this.colorDefs["WtCalendar_Outside"]="#999999";
	this.colorDefs["WtCalendar_OutsideBackground"]="#FFFFFF";
	this.colorDefs["WtCalendar_SaBackground"]="#DBEAF5";
	this.colorDefs["WtCalendar_SelectedBackground"]="#DBEAF5";
	this.colorDefs["WtCalendar_SoBackground"]="#DBEAF5";
	this.colorDefs["WtCalendar_StundenBackground"]="#C9D6F3";
	this.colorDefs["WtCalendar_TitleCenter"]="#FFFFFF";
	this.colorDefs["WtCalendar_TitleCenterBackground"]="#4682B4";
	this.colorDefs["WtCalendar_TitleLeftBackground"]="#4682B4";
	this.colorDefs["WtCalendar_TitleRightBackground"]="#4682B4";
	this.colorDefs["WtCalendar_WeekFinished"]="#FFFFFF";
	this.colorDefs["WtCalendar_WeekendBackground"]="#DBEAF5";
	this.colorDefs["baseline_alert"]="#FF5868";
	this.colorDefs["baseline_green"]="#75BD6B";
	this.colorDefs["baseline_red"]="#FF5868";
	this.colorDefs["test"]="#FF5868";
	/* Image Definitions */
	this.imageSize["DefaultPDFIconImageSize"]=9;
	this.imageSize["DefaultPDFIconImageSize.A1"]=8;
	this.imageSize["DefaultPDFIconImageSize.A2"]=8;
	this.imageSize["DefaultPDFIconImageSize.A3"]=12;
	this.imageSize["DefaultPDFIconImageSize.A4"]=9;
	this.imageSize["PhotoPictureSizeHeight"]=150;
	this.imageSize["PhotoPictureSizeWidth"]=120;
}

StyleDefinitionsClass.prototype.getFontDef = function(name) {
	var start = name.substr(0,8);
	if (start == "FontSize") {
		var dSize = this.fontDefs[name];
		var realSize = dSize * this.fontFaktor;
		return (realSize+this.fontUnit);
	}
	return ('');
}
StyleDefinitionsClass.prototype.getColorDef = function(name) {
	return (this.colorDefs[name]);
}

StyleDefinitionsClass.prototype.getImageSize = function(name) {
	return (this.imageSize[name]);
}

var StyleDefinitions = new StyleDefinitionsClass();


/* JsInclude file=ajax.js */
var AJAX_READY_STATE_UNINITIALIZED	= 0;
var AJAX_READY_STATE_LOADING		= 1;
var AJAX_READY_STATE_LOADED			= 2;
var AJAX_READY_STATE_INTERACTIVE	= 3;
var AJAX_READY_STATE_READY			= 4;

var http_requests = new Array ();
var outstandingRequests = 0;
var postAjaxFunction = null;
var __ajax_adresse__ = __ajaxservlet__; //__ajax_adresse__.substr(0, __ajax_adresse__.lastIndexOf('/')+1)+"ajax";
var executeForm;

var handleFunctions = new Array ();
handleFunctions["DisableField"]		= "disableField";
handleFunctions["EnableField"]		= "enableField";
handleFunctions["HideElement"]		= "hideElement";
handleFunctions["ShowElement"]		= "showField";
handleFunctions["FillListbox"]		= "fillListbox";
handleFunctions["SelectListbox"]	= "selectListbox";
handleFunctions["FillTextField"]	= "fillTextField";
handleFunctions["FillCheckbox"]		= "fillCheckbox";
handleFunctions["HtmlContent"]		= "fillHtmlContent";
handleFunctions["Alert"]			= "showAlert";
handleFunctions["Confirm"]			= "showConfirm";
handleFunctions["Execute"]			= "executeJs";
handleFunctions["SetMandatory"]		= "SetMandatory";
handleFunctions["ShowErrorOnField"]	= "ShowErrorOnField";
handleFunctions["ExecuteForm"]		= "ExecuteForm";
handleFunctions["ShowErrorForMask"]	= "ShowErrorForMask";
handleFunctions["ShowWarningForMask"]= "ShowWarningForMask";
handleFunctions["ShowGlobalForMask"]= "ShowGlobalForMask";
handleFunctions["RedirectMask"]		= "redirectMask";
handleFunctions["SetPortletPosition"]= "setPortletPosition";
handleFunctions["FillFilterFields"]= "fillFilterFields";
handleFunctions["SetColor"]			= "setColor";
handleFunctions["SetImage"]			= "setImage";
handleFunctions["ReadonlyField"]	= "setReadonly";
handleFunctions["SetIcon"]			= "setIcon";
handleFunctions["FillFieldByName"]	= "fillFieldByName";
handleFunctions["SetFocus"]			= "setFocus";
handleFunctions["RemoveById"]		= "removeById";
handleFunctions["SetText"]			= "setText";
handleFunctions["SetWidgetValue"]	= "setWidgetValue";
handleFunctions["SetWidgetRequired"]= "setWidgetRequired";
handleFunctions["SetWidgetError"]	= "setWidgetError";
handleFunctions["ReqWidgetFocus"]	= "reqWidgetFocus";
handleFunctions["ReturnValue"]		= "returnValue";
handleFunctions["AddCssClass"]		= "addCssClass";
handleFunctions["RemoveCssClass"]	= "removeCssClass";
handleFunctions["HideWaitLogo"]		= "hideWaitLogo";

var __confirmResult__;
var __returnValue__;

/*
function alert(text) {
	debugWindow(text);
}
*/
/** Debugmeldungen ausgeben */
function debugWindow(text) {
	var e ;
	e = document.getElementById("debugconsole") ;
	if ( e ) {
		e.appendChild(document.createElement("br"));
		e.appendChild(document.createTextNode(text));
	}
}

function sendRequest (method) {
	var args = new Array ();
/*	
	for (i = 1; i < sendRequest.arguments.length; i++) {
		args[args.length] = sendRequest.arguments[i];
	}
*/
	for (var i = 1; i < arguments.length; i++) {
		args[args.length] = arguments[i];
	}
	
	_sendAsyncRequest (method, true, args);
}

function sendRequestParams (method,args) {
	_sendAsyncRequest (method, true, args);
}


function sendAsyncRequest (method, async) {
	var args = new Array ();
	
	for (var i = 2; i < arguments.length; i++) {
		args[args.length] = arguments[i];
	}
/*
	for (i = 2; i < sendAsyncRequest.arguments.length; i++) {
		args[args.length] = sendAsyncRequest.arguments[i];
	}
*/	
	_sendAsyncRequest (method, async, args);
}

/**
 * Schickt einen Ajax-Request synchron an den Server
 * Parameter: method async
 */
function sendSynchronRequest(method, args) {
	_sendAsyncRequest(method,false,args);
}

/** Überprüft ob Nativ-Ajax zur verfügung steht */
function isNativeAjax() {
	return (true);
	
//	var http_request;
//	var hasNativeAjaxSupport;
//	if (window.XMLHttpRequest) { // Mozilla, Safari,...
//		http_request = new XMLHttpRequest();
//		hasNativeAjaxSupport = true;
//	} else if (window.ActiveXObject) { // IE
//		try {
//			http_request = new ActiveXObject("Msxml2.XMLHTTP");
//			hasNativeAjaxSupport = true;
//		} catch (e) {
//			try {
//				http_request = new ActiveXObject("Microsoft.XMLHTTP");
//				hasNativeAjaxSupport = true;
//			} catch (e) { 
//				hasNativeAjaxSupport = false; 
//			}
//		}
//	} else {
//		hasNativeAjaxSupport = false;
//		
//	}	
//	return hasNativeAjaxSupport;
}


/**
 * Schickt einen Ajax-Request synchron oder asynchron an den Server
 * Parameter: method async
 */
function _sendAsyncRequest (method, async, args) {
	var responseIndex;
	var http_request;
	var ajaxDelegator;
	var hasNativeAjaxSupport = true;
	
	if (window.XMLHttpRequest) { // Mozilla, Safari,...
		http_request = new XMLHttpRequest();
		hasNativeAjaxSupport = true;
	} else if (window.ActiveXObject) { // IE
		try {
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
			hasNativeAjaxSupport = true;
		} catch (e) {
			try {
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
				hasNativeAjaxSupport = true;
			} catch (e) { 
				hasNativeAjaxSupport = false; 
			}
		}
	} else {
		hasNativeAjaxSupport = false;
	}	
	
	debugWindow("Nativ-Ajax:"+hasNativeAjaxSupport+" Method="+method+" async="+async+" args="+args );
	if ( hasNativeAjaxSupport ) {
		ajaxDelegator = new AjaxNative(http_request);

		if (postAjaxFunction) {
			http_request.postAjaxFunction = postAjaxFunction;
			postAjaxFunction = null;
		}
		
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/xml');
		}
	
		var responseIndex = addRequest (ajaxDelegator);
	
		if ( async) {
			http_request.onreadystatechange = new Function( "", "responseAction(" + responseIndex + ")" );
		}
	
		var content = "";
		var encoding = "UTF-8";
	
		var head = "<?xml version=\"1.0\" encoding=\""+encoding+"\"?><AjaxRequest method=\""+method+"\" session=\""+__session__+"\">";
		for (var i = 0; i < args.length; i++) {
			var arg = args[i];
			var optional = (arg.indexOf ("-") == 0);
			var idx = arg.indexOf ("=");
			if (idx == -1) {
				if (!optional) {
					content += "<"+arg+"/>\n";
				}
			} else {
				var ele = arg.substring(0,idx);
				if (optional) {
					ele = ele.substring(1);
				}
				var value = arg.substring(idx+1);
				if (!(optional && (value.length == 0))) {
					content += "<"+ele+">"+getValueAsCDATA(value)+"</"+ele+">\n";
				}
			}
		}
	
		var tail = "</AjaxRequest>";
		var requestContent = head+content+tail;
	 	//	debug
		// debugWindow(requestContent);
	
		try {
			document.getElementsByTagName("BODY")[0].style.cursor = "wait";
			outstandingRequests++;
		} catch (e) {}
		
		http_request.open('POST', __ajax_adresse__, async);
//		http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
		http_request.setRequestHeader('Content-Type', 'text/xml; charset=UTF-8');
		http_request.send(requestContent);
	
		if ( !async) {
			responseAction(responseIndex);
		}

	}
}

function responseAction (i) {
	var ajaxDelegator;
	var http_request;

	ajaxDelegator = http_requests[i];
	if ( ajaxDelegator ) {
		http_request = ajaxDelegator.http_request;
		if ( http_request && http_request.readyState == AJAX_READY_STATE_READY && http_request.status == 200) {

			ajaxDelegator.rmRequest (i);
			ajaxDelegator.handleResponse ();
			
			if (http_request.postAjaxFunction) {
				eval (http_request.postAjaxFunction);
			}
			
			try {
				outstandingRequests--;
				if (outstandingRequests <= 0) {
					outstandingRequests = 0;
					document.getElementsByTagName("BODY")[0].style.cursor = "auto";
				}
			} catch (e) {}
			
			ajaxDelegator.http_request  = null;
		}
	}
}

/* Debug */
function docToString (node, indent) {
	var nodeName = node.nodeName;
	
	var msg = getIndent (indent)+"<"+nodeName+">\n";
	
	var children = node.childNodes;
	for (var i = 0; i < children.length; i++) {
		var child = children[i];
		var value = "";
		if (child.hasChildNodes()) {
			value = docToString(child, indent+1);
		} else if (child.nodeValue) {
			value = getIndent (indent+1)+child.nodeValue;
		}
		msg += value;
	}
	msg += "\n</"+nodeName+">";
	return (msg);
}

function getIndent (indent) {
	var msg = "";
	for (j = 0; j < indent; j++) {
		msg += "     ";
	}
	return (msg);
}

function getValueAsCDATA(value) {
	var v
	v = "<![CDATA["+value.replace("]]>","]]&gt;")+"]]>";
	return v;
}


function addRequest (delegators) {
	var len = http_requests.length;
	
	for (var i = 0; i < len; i++) {
		if (http_requests[i] == null) {
			http_requests[i] = delegators;
			return (i);
		}
	}
	http_requests[len] = delegators;
	return (len);
}

/*  ********************************************** */



function disableField (ajaxDelegator,responseNode) {
	var ele = document.getElementById (responseNode.getAttribute("id"));
 	_disableField (ele);
 }

function _disableField (ele) {
	if ( ele ) {
		
		if ( ele.type == 'hidden') {
			// Can't disable hidden fields
		} else if ( ele.type == 'text') {
			_disableFieldInternal(ele);
//			ele.style.backgroundColor= StyleDefinitions.getColorDef ("FieldDisabledBackground");
//			ele.style.color= StyleDefinitions.getColorDef ("FieldDisabled");
			ele.readOnly=true;
			ele.disabled='disabled';
		} else if ( ele.type == 'button') {
			ele.disabled='disabled';	
		} else if ( ele.type == 'checkbox') {
			_disableFieldInternal(ele);
//			ele.style.backgroundColor= StyleDefinitions.getColorDef ("CheckboxDisabledBackground");
//			ele.style.color= StyleDefinitions.getColorDef ("CheckboxDisabled");
			ele.readOnly=true;
			ele.disabled='disabled';
		} else if (ele.type == 'select-one') {
			_disableFieldInternal(ele);
//			ele.style.backgroundColor= StyleDefinitions.getColorDef ("FieldDisabledBackground");
//			ele.style.color= StyleDefinitions.getColorDef ("FieldDisabled");
			ele.disabled='disabled';
		} else if ( ele.nodeName == 'textarea') {
			_disableFieldInternal(ele);
//			ele.style.backgroundColor= StyleDefinitions.getColorDef ("FieldDisabledBackground");
//			ele.style.color= StyleDefinitions.getColorDef ("FieldDisabled");
			ele.readOnly=true;
		}
	}
}

function enableField (ajaxDelegator,responseNode) {
	var ele = document.getElementById (responseNode.getAttribute("id"));
	_enableField (ele);
}

function _enableField (ele) {
	if ( ele ) {
	
		if ( ele.type == 'hidden') {
			// Can't disable hidden fields
		} else if ( ele.type == 'text') {
			_enableFieldInternal(ele);
//			ele.style.backgroundColor= StyleDefinitions.getColorDef ("FieldActiveBackground");
			ele.readOnly=false;
			ele.disabled='';
		} else if ( ele.type == 'button') {
			ele.style.backgroundColor= StyleDefinitions.getColorDef ("ButtonActiveBackground");
			ele.style.color= StyleDefinitions.getColorDef ("ButtonActive");
			ele.disabled='';
		} else if ( ele.type == 'checkbox') {
			//ele.style.backgroundColor= StyleDefinitions.getColorDef ("CheckboxActiveBackground");
			_enableFieldInternal(ele);
			ele.readOnly=false;
			ele.disabled='';
		} else if (ele.type == 'select-one') {
			//ele.style.backgroundColor= StyleDefinitions.getColorDef ("FieldActiveBackground");
			_enableFieldInternal(ele);
			ele.disabled='';
		} else if ( ele.nodeName == 'textarea') {
			//ele.style.backgroundColor= StyleDefinitions.getColorDef ("FieldActiveBackground");
			_enableFieldInternal(ele);
			ele.readOnly=false;
		}
	}
}

function _enableFieldInternal(ele) {
	var id=ele.getAttribute("id");
	$("#"+id).removeClass('DisableField');
	$("#"+id).addClass('EnableField');
	
}

function _disableFieldInternal(ele) {
	var id=ele.getAttribute("id");
	$("#"+id).removeClass('EnableField');
	$("#"+id).addClass('DisableField');
}


function hideElement (ajaxDelegator,child) {
//	alert ("hideElement ()");
	var id = child.getAttribute("id");
	var ele = document.getElementById (id);
	if ( ele ) {
		ele.style.display = "none";
	}
}

// Entfernt das mit id angegebene Element aus dem DomTree
function removeById (ajaxDelegator,child) {
//	alert ("removeById ()");
	var id = child.getAttribute("id");
	var ele = document.getElementById (id);
	if (ele) {
		ele.parentNode.removeChild(ele);
	}
}

function showField (ajaxDelegator,child) {
//	alert ("showField ()");
	var id = child.getAttribute("id");
	var ele = document.getElementById (id);
	if ( ele ) {
		ele.style.display = "";
	}
}

function setFocus (ajaxDelegator,child) {
//	alert ("setFocus ()");
	var id = child.getAttribute("id");
	var ele = document.getElementById (id);
	if (ele) {
		ele.focus ();
	}
}

function fillTextField (ajaxDelegator,node) {
//	alert ("fillTextField ()");
	var id = node.getAttribute("id");
	var field = document.getElementById (id);
	var child;

//	var msg = "fillTextField: id="+id+", field="+field+"\n";
	if (field) {
		var text = "";
		text = node.getAttribute("text");
//		msg += "1 text="+text+"\n";

		if (!text && node.hasChildNodes()) {
			var textNode = node.firstChild;
			text = textNode.nodeValue;
//			msg += "2 text="+text+"\n";
		}

		if ( field.nodeName=="input" || field.nodeName=="INPUT" ) {
//			msg += "3 input\n";
			field.value = text;
			var type = field.getAttribute("type");
			if (type) {
				type = type.toLowerCase ();
				if (type == "hidden") {
					var spawn = document.getElementById ("_"+id+"_spawn");
					if (spawn) {
						child = spawn.firstChild;
						if (!child) {
							spawn.appendChild(document.createTextNode(text));
						} else {
							spawn.replaceChild(document.createTextNode(text ), child);
						}
					}
				}
			}
		} else if ( field.nodeName=="textarea" || field.nodeName=="TEXTAREA" ) {
//			msg += "4 textarea";
			field.value = text;
//			if (field.value) {
//				msg += " - 4.1";
//				field.value = text;
//			} else {
//				msg += " - 4.2";
//				child = field.firstChild;
//				if (!child) {
//					msg += " - 4.2.1";
//					field.appendChild(document.createTextNode(text));
//				} else {
//					msg += " - 4.2.2";
//					field.replaceChild(document.createTextNode(text ), child);
//				}
//			}
//			msg += " - 4 DONE\n";
		} else {
//			msg +="5 sonstwas\n";
			child = field.firstChild;
			if ( !child ) {
				field.appendChild(document.createTextNode(text ));
			} else {
				field.replaceChild(document.createTextNode(text ), child);
			}
		}
	}
//	debugWindow (msg);
}

function fillFilterFields (ajaxDelegator,node) {
//	alert ("fillFilterFields ()");
	var id = node.getAttribute("id");
	var filter = document.getElementById (id);
	var child;
	
	if (filter) {
		var sFields = filter.getElementsByTagName ("SELECT");
		var iFields = filter.getElementsByTagName ("INPUT");

		var children = node.childNodes;
		for (var f = 0; f < children.length; f++) {
			var child = children[f];
			if (child.nodeName == "FilterField") {
				var fieldName = child.getAttribute ("name");
				var fieldValue = child.getAttribute ("value");
				var fieldType = child.getAttribute ("type");
				
//				alert ("FilterField name="+fieldName+", type="+fieldType+", value="+fieldValue);
				
				var fields;
				if (fieldType == "S") {
					fields = sFields;
				} else {
					fields = iFields;
				}
				
				for (var i = 0; i < fields.length; i++) {
					var field = fields[i];
					if ((field.name == ("K"+fieldType+"_"+fieldName)) || (field.name == ("M"+fieldType+"_"+fieldName))) {
						if (fieldType == "S") {
							if (fieldValue.indexOf (',') > 0) {
								var values = fieldValue.split (',');
								
//								alert (values+"\nlen="+values.length);
								var opts = field.options;
								for (var v = 0; v < values.length; v++) {
									for (var o = 0; o < opts.length; o++) {
										if (values[v] == opts[o].value) {
											opts[o].selected = true;
											break;
										}
									}
								}
							} else {
								field.value = fieldValue;
							}
							if (field.onchange) {
								field.onchange();
							}
						} else if (fieldType == "B") {
							field.checked = (fieldValue == "1"); 
						} else {
							field.value = fieldValue;
						}
					} 
				}
			}
		}
	}
}

function setColor (ajaxDelegator,node) {
	var id = node.getAttribute("id");
	var field = document.getElementById (id);
	var child;
	
	if (field) {
		var color = "";
		if (node.hasChildNodes()) {
			var textNode = node.firstChild;
			color = textNode.nodeValue;
		}
		field.style.color = color;
	}
}

function setImage (ajaxDelegator,node) {
	var id = node.getAttribute("id");
	var img = document.getElementById (id);
	
	if (img) {
		if (node.hasChildNodes()) {
			var textNode = node.firstChild;
			var imageName = textNode.nodeValue;
			img.onload = "";
			img.src = __imageadresse__+imageName;
		}
	}
}

function setIcon (ajaxDelegator,node) {
	var id = node.getAttribute("id");
	var img = document.getElementById (id);
	
	if (img) {
		var src = node.getAttribute("src");
		var hint = node.getAttribute("hint");
		debugWindow("setIcon id="+id+", src="+src+", hint="+ hint);
		if (src.length > 0) {
			img.src = __imageadresse__+src;
		}
		if (hint.length > 0) {
			img.title = hint;
		}
	}
}

function setReadonly (ajaxDelegator,node) {
	var id = node.getAttribute("id");
	var ro = node.getAttribute("readOnly");
	var ele = document.getElementById (id);
	
	if (ele) {
		ele.readOnly = (ro == "true");
	}
}

function addCssClass (ajaxDelegator,node) {
	var id = node.getAttribute("id");
	var cssClass = node.getAttribute("cssClass");

	$("#"+id).addClass (cssClass);
}

function removeCssClass (ajaxDelegator,node) {
	var id = node.getAttribute("id");
	var cssClass = node.getAttribute("cssClass");
	
	$('#'+id).removeClass (cssClass);
}

function showAlert (ajaxDelegator,node) {
//	alert ("showAlert");
	var _node = node;
	var text = "Unbekannte Nachricht";
	if (_node.hasChildNodes()) {
		var textNode = _node.firstChild;
		text = textNode.nodeValue;
	}
	alert (text);
}

function showConfirm (ajaxDelegator,node) {
//	alert ("showConfirm");
	var _node = node;
	
	var text = "Unbekannte Nachricht";
	if (_node.hasChildNodes()) {
		var textNode = _node.firstChild;
		text = textNode.nodeValue;
	}
	
	__confirmResult__ = confirm (text);
}

function dummy () {
}

function returnValue (ajaxDelegator,node) {
	var _node = node;
	
	__returnValue__ = null;
	if (_node.hasChildNodes()) {
		var textNode = _node.firstChild;
		__returnValue__ = textNode.nodeValue;
	}
}


function executeJs (ajaxDelegator,node) {
//	alert ("executeJs ()");
	var code = "dummy ();";
	if (node.hasChildNodes()) {
//		var code = "";
		var textNode = node.firstChild;
		if (textNode != null) {
			code = "";
		}
		while (textNode != null) {
			code += textNode.nodeValue;
			textNode = textNode.nextSibling;
		}
	}
//	ajax_debugLog("executeJs: "+code);
	eval (code);
}

function redirectMask (ajaxDelegator,node) {
	
	var url  = node.getAttribute("url");
	var waitlogo = node.getAttribute("show_wait_logo");
	try {
		if(waitlogo) {
			shownewwait();
		}
	} catch (e) {}
		
	document.location = url;
}

function ShowErrorForMask(ajaxDelegator,child) {
	showMessageForMask("error_mask",child);
}

function ShowWarningForMask(ajaxDelegator,child) {
	showMessageForMask("warning_mask",child);
}

function ShowGlobalForMask(ajaxDelegator,child) {
	showMessageForMask("global_message_mask",child);
}

function setPortletPosition(ajaxDelegator,node) {
	var id;
	var ele;

	id  = node.getAttribute("id");
	ele = document.getElementById (id);
	if ( ele ) {
		var x = node.getAttribute("x");
		var y = node.getAttribute("y");
		var w = node.getAttribute("w");
		var h = node.getAttribute("h");
		var open = node.getAttribute("open");
		var visible = node.getAttribute("visible");
		
		var p = pb.elements[id];

		if ((x == "-1") || (y == "-1") || (w == "-1") || (h == "-1")) {
			p._show ();
			return
		}
		
//		alert ("setPortletPosition id="+id+", p="+p);
//		window.status = "setPortletPosition id="+id+", p="+p+" setPositionSize";
		p.setPositionSize (x, y, w, h);
		if (open == "true") {
//		alert ("setPortletPosition id="+id+", p="+p+" _maximize");
			p._maximize ();
		} else {
//		alert ("setPortletPosition id="+id+", p="+p+" _minimize");
			p._minimize ();
		}
		if (visible == "true") {
//		alert ("setPortletPosition id="+id+", p="+p+" show");
			p._show ();
		} else {
//		alert ("setPortletPosition id="+id+", p="+p+" hide");
			p._hide ();
		}
//		alert ("setPortletPosition id="+id+", p="+p+" DONE");
//		pb.elements[id].setFlag (x, y, w, h, open, visible);
	}
}

function fillListbox (ajaxDelegator,responseNode) {
//	alert ("fillListbox ()");
	var node = responseNode;
	var id = node.getAttribute("id");
	var lb = document.getElementById (id);
	
	try {
		while (lb.length > 0) {
			lb.options[lb.length-1] = null;
		}
	} catch (e) { }
	
	var children = node.childNodes;
	for (var i = 0; i < children.length; i++) {
		var child = children[i];
		var nodeName = child.nodeName;
		if (nodeName == "Element") {
			var key = child.getAttribute ("key");
			if ( key=='null' || key == null || key == undefined) {
				key ='';
			}

			var clazz = child.getAttribute ("class");
			var selected = child.getAttribute ("selected");
			var disabled = child.getAttribute ("disabled");
			var text = "";
			if (child.hasChildNodes()) {
				var textNode = child.firstChild;
				text = textNode.nodeValue;
			}
			var opt = new Option(text, key);
			opt.title = text;
			if (clazz && (clazz.length > 0)) {
				opt.className = clazz;
			}
			lb.options[lb.length] = opt;
			if (selected == 'true') {
				opt.selected = true;
//				lb.selectedIndex = lb.length -1;
			}
			if (disabled == 'true') {
				opt.disabled = true;
			}
		}
	}

}

function selectListbox (ajaxDelegator,responseNode) {
//	alert ("selectListbox ()");
	var node = responseNode;
	var id = node.getAttribute("id");
	var lb = document.getElementById (id);

	if (lb) {
		var opt = lb.options;
		if (node.hasChildNodes()) {
			var textNode = node.firstChild;
			var val = textNode.nodeValue;
		} else {
			var val= "";
		}
			
		for (var i = 0; i < opt.length; i++) {
			if (opt[i].value == val) {
				lb.selectedIndex = i;
				if (lb.onchange && ajaxDelegator.disableonchange==false) {
					lb.onchange();
				}
				break;
			}
		}
	}
}

function fillCheckbox (ajaxDelegator,responseNode) {
//	alert ("fillCheckbox ()");
	var node = responseNode;
	var id = node.getAttribute("id");
	var cb = document.getElementById (id);
	
	var select = node.getAttribute("select");
	if (select == "true") {
		cb.checked = true;
	} else {
		cb.checked = false;
	}
}

function fillHtmlContent (ajaxDelegator,responseNode) {
	var node = responseNode;
	var id = node.getAttribute("id");
	var replace = node.getAttribute("replace");
	var TYPE_ELEMENT=1;
	var TYPE_CDATA=4;
	var html = "";

	if ("true" == replace) {
		var replaceElement = document.getElementById (id);
		var children = node.childNodes;
		for (var i = 0; i < children.length; i++) {
			var child = children[i];
			if (child.nodeType == TYPE_CDATA) {
				html += child.nodeValue;
			}
		}
		var tmp = document.createElement("div");
		tmp.innerHTML = html;
		var children = tmp.childNodes;
		var el = "";
		for (var i = 0; i < children.length; i++) {
			var child = children[i];
			if (child.nodeType == TYPE_ELEMENT) {
				el = child;
				break;
			}
		}
		var parent = replaceElement.parentNode;
		parent.replaceChild (el, replaceElement);
		if (replaceElement.parentNode) {
			replaceElement = replaceElement.parentNode;
		}
		if (replaceElement.parentNode) {
			replaceElement = replaceElement.parentNode;
		}
		if (replaceElement && replaceElement.style) {
			replaceElement.style.cursor="default";
		}
	} else {
		var outerElement = document.getElementById (id);
		var children = node.childNodes;
		for (var i = 0; i < children.length; i++) {
			var child = children[i];
			if (child.nodeType == TYPE_CDATA) {
				html += child.nodeValue;
			}
		}
		outerElement.innerHTML = html;
		outerElement.parentNode.parentNode.style.cursor="default";
	}
}

function SetMandatory(ajaxDelegator,responseNode) {
	var node;
	var id;
	var s;
	var eleSpan;
	var eleField;
	
	node = responseNode;
	id  = node.getAttribute("id");
	mandatory = node.getAttribute("mandatory");
	_setMandatory (id, mandatory)
/*
	eleSpan = document.getElementById ("mandatory_"+id);
	if ( eleSpan ) {
		if ( "true" == node.getAttribute("mandatory") ) {
			s = "*";	
		} else {
			s = " ";
		}
		for(i=0; i < eleSpan.childNodes.length; i ++ ) {
			eleSpan.removeChild(eleSpan.childNodes[i]);
		}
		eleSpan.appendChild(document.createTextNode(s));
	}
	
	eleField = document.getElementById (id);
	if ( eleField && ( eleField.name.length > 0 && eleField.name.charAt(2)=='_' )) {
		if ( "true" == node.getAttribute("mandatory") ) {
			s = 'M';
		} else {
			s = 'K';
		}
		eleField.name = s+eleField.name.substring(1, eleField.name.length);
	}
*/
}

function _setMandatory(id, mandatory) {
	eleSpan = document.getElementById ("mandatory_"+id);
	if ( eleSpan ) {
		if ( "true" == mandatory ) {
			s = "*";	
		} else {
			s = " ";
		}
		for(i=0; i < eleSpan.childNodes.length; i ++ ) {
			eleSpan.removeChild(eleSpan.childNodes[i]);
		}
		eleSpan.appendChild(document.createTextNode(s));
	}
	
	eleField = document.getElementById (id);
	if ( eleField && ( eleField.name.length > 0 && eleField.name.charAt(2)=='_' )) {
		if ( "true" == mandatory ) {
			s = 'M';
		} else {
			s = 'K';
		}
		eleField.name = s+eleField.name.substring(1, eleField.name.length);
	}
}

function ShowErrorOnField(ajaxDelegator,responseNode) {
	var node;
	var id;
	var spanElement;
	var iconElement;
	var msg;
	
	node = responseNode;
	id  = node.getAttribute("id");
	var idEle = document.getElementById(id);
	if ( !idEle ) {
		var list = jQuery('*[error-id]',document);
		for(var i=0; i < list.length;i++) {
			var e=list[i].getAttribute("error-id");
			if ( id == e ) {
				idEle = list[i];
				id = idEle.getAttribute("id"); 
				break;
			}
		}
			
		
	}
	
	if (idEle) {
		msg = node.getAttribute("message");
		if (msg.length > 0) {
			$("#"+id).attr('title', msg).addClass('fieldError');
		} else {
			$("#"+id).attr('title', '').removeClass('fieldError');
		}
	} else {
		spanElement = document.getElementById("error_span_"+id);
		if ( spanElement ) {
			msg = node.getAttribute("message");
			spanElement.style.display=( msg.length==0 ) ? 'none' : 'inline';
			iconElement = document.getElementById("error_icon_"+id);
			if ( iconElement ) {
				iconElement.title=msg;
				iconElement.alt=msg;
			}
		}
	}
}

function ExecuteForm(ajaxDelegator,child) {
	executeForm = true;
}

function fillFieldByName (ajaxDelegator,node) {
//	alert ("fillFieldByName ()");
	var fieldName = node.getAttribute("fieldName");
	var fieldValue = node.getAttribute("fieldValue");
	if (!fieldValue && node.hasChildNodes()) {
		var textNode = node.firstChild;
		fieldValue = textNode.nodeValue;
	}
//	debugWindow("fillFieldByName: fieldName="+fieldName+", fieldValue="+fieldValue);
	var fields = document.getElementsByName(fieldName);
	
//	debugWindow("fillFieldByName: fields="+fields);
	if (fields) {
		var field;
		
//		debugWindow("fillFieldByName: fields.length="+fields.length);
		if (fields.length == 1) {
			field = fields[0];
			if (field.type == 'checkbox') {
				/* wenn die Checkbox nur einmal auftaucht dann bitte auch selektieren */
				field.checked = (fieldValue == '1');
			} else {
				if (field.type == 'select') {
					var opt = new Option("", formEle);
					opt.setAttribute ("style", "display:hidden");
					field.options[lb.length] = opt;
				}
				field.value = fieldValue;
			}
		} else if (fields.length > 1) {
			var i;
			for (i = 0; i < fields.length; i++) {
				field = fields[i];
				if (field.type == 'checkbox') {
					field.checked = (fieldValue == '1');
				}
			}
		}
	}
}


function showMessageForMask(id,node){
	_showMessageForMask(id, 'toolbar_content', node);
	_showMessageForMask(id+"_bottom", 'bottom_toolbar_content', node);
}

function _showMessageForMask(id, contentID, node){
	var message, i;
	
	var e = document.getElementById(id);
	if ( e ) {
		message = node.getAttribute("message");

		e.style.display=( message.length==0 ) ? 'none' : 'block';

		for(i=0; i < e.childNodes.length; i++ ) {
			e.removeChild(e.childNodes[i]);
		}
		e.appendChild(document.createTextNode(message));
		
		if (message.length > 0) {
			var tb = document.getElementById(contentID);
			if (tb && tb.style) {
				tb.style.display= (pb.ie ? "block" : "table-row");
			}
		}
		var disableTimer = node.getAttribute("disableTimer");
		if (disableTimer && "true" == disableTimer) {
		} else {
			toolbar.setToolbarMessageTimer(id);
		}
	}
}


var AjaxNative = function(http_request) {
	this.http_request = http_request;
	this.disableonchange = false;
}

AjaxNative.prototype.rmRequest = function (i) {
	http_requests[i] = null;
}

AjaxNative.prototype.handleResponse = function () {
	var node;
	node = this.http_request.responseXML;
	node = node.getElementsByTagName('AjaxResponse').item(0);
	// ob die onchange events unterdrückt werden sollen um kaskadierungen zu vermeiden
	this.disableonchange = false;
	if (node && node.getAttribute('disableonchange') ) {
		this.disableonchange = node.getAttribute('disableonchange') == 'true';
	}

	var children = node.childNodes;
	for (var i = 0; i < children.length; i++) {
		var child = children[i];
		var nodeName = child.nodeName;
		if (nodeName != "#text") {
			try {
				var fnc = handleFunctions [ nodeName ];
				if (fnc) {
					eval (fnc+"(this,child)");
				} else {
					debugWindow ("AjaxFunction "+nodeName+" not defined !");
				}
			} catch (e) { debugWindow ("ERROR: ["+nodeName+"] "+e); }
//		} else {
//			handleResponse (child);
		}
	}
//	alert ("handleResponse DONE");
	// Bug #14639 eingebaut / Bug #15105 wieder ausgebaut
//	setTabIndex ();
}

/**
* Conveniencemethode für sendRequestForPopupWithParams(String, String[]).
* Ruft die Methode mit einem neuen, leeren Array auf.
* @param requestHandlerName - Name der Ajax-Propertiesinstanz
* @return <code>false</code>
* 
*/
function sendRequestForPopup(requestHandlerName) {
	return sendRequestForPopupWithParams(requestHandlerName, new Array());
}

/**
 * Versucht ein offenes Popup zu schließen. Es wird
 * der Name des Popups erwartet.
 * @param popupName - popupname
 * @return void
 */
function closePopup(popupName) {
	if(pb) {
		var p = pb.elements[popupName];
		if (p) {
			p._close ();
		}
	}
}

/**
* Sendet ein Request an einen AjaxRequestHandler ab, mit dem Ziel
* ein Popup anzuzeigen. Als Name des RequestHandlers wird der erste
* Parameter genutzt. Der zweite Parameter erwartet ein Array mit 
* Parametern für den Ajax-Aufruf. <br/>
* Dem Array werden zusätzlich folgende
* Informationen mitgegeben:<br/>
* <ul>
* <li>xPos=200</li>
* <li>yPos=200</li>
* <li>action=show</li>
* </ul>
* @param requestHandlerName - Name der Ajax-Propertiesinstanz
* @param args - Array mit Parametern
* @return <code>false</code>
* 
*/
function sendRequestForPopupWithParams(requestHandlerName, args) {
	args[args.length]="xPos=200";
	args[args.length]="yPos=200";
	args[args.length]="action=show";

	sendRequestParams(requestHandlerName, args);
	formSent=false;
	
	return false;
}

function setWidgetValue(ajaxDelegator,responseNode) {
	var id;
	var ele;
	
	id  = responseNode.getAttribute("id");
	var value = responseNode.getAttribute("value");
	
	$("#"+id).each(function() {
		var v = $(this);
		var e = document.getElementById(id);
		if (e.nodeName == 'SPAN' ) {
			v.text(value);
		} else if ( "checkbox" == e.type ) {
			e.checked = 'true' == value;
		} else if ( "select-multiple" == e.type ) {
//			debugWindow ("setWidgetValue: id="+id+", value="+value);
//			$('#'+id).val(value.split(','));
			
			var vArr = value.split(',');
			var opt = e.options;
			for (var i = 0; i < opt.length; i++) {
				opt.selected = false;
			}
			for (var i = 0; i < opt.length; i++) {
				for (var j = 0; j < vArr.length; j++) {
					if (opt[i].value == vArr[j]) {
//						debugWindow ('select '+vArr[j]);
						opt.selected = true;
						break;
					}
				}
			}

		} else {
			v.val(value);
		}
	});
}

function setWidgetRequired(ajaxDelegator,responseNode) {
	var id;
	var eleSpan;
	
	node = responseNode;
	id  = responseNode.getAttribute("id");
	var val = ( "true" == responseNode.getAttribute("value") ) ? "*" : "";
	eleSpan = document.getElementById (id);
	
	if ( eleSpan ) {
		for(i=0; i < eleSpan.childNodes.length; i ++ ) {
			eleSpan.removeChild(eleSpan.childNodes[i]);
		}
		eleSpan.appendChild(document.createTextNode(val));
	}
}

function setWidgetError(ajaxDelegator,responseNode) {
	var id;
//	var eleSpan;
	
	node = responseNode;
	id  = responseNode.getAttribute("id");
	var val = responseNode.getAttribute("value");
	
	id = id.substr(1);
	var ele = $("#"+id+".baInput");
	if (ele.length == 0) {
		ele = $("#"+id+".baSelect");
	}
	if (val.length > 0) {
		ele.attr('alt', val).attr('title', val).addClass('fieldError');
	} else {
		ele.attr('alt', '').attr('title', '').removeClass('fieldError');
	}

//	eleSpan = document.getElementById (id);
	
//	if ( eleSpan ) {
/*
		if (val.length > 0) {
			$("#i"+id).attr('alt', val).attr('title', val).css('display', 'inline');
		} else {
			$("#i"+id).css('display', 'none');
		}
*/
//		for(i=0; i < eleSpan.childNodes.length; i ++ ) {
//			eleSpan.removeChild(eleSpan.childNodes[i]);
//		}
//		if (val.length > 0) {
//			var img = document.createElement("img");
//			img.setAttribute ("src", __imageadresse__+"ausrufez.gif");
//			img.setAttribute ("alt", val);
//			img.setAttribute ("title", val);
//			img.setAttribute ("class", "error");
//			eleSpan.appendChild(img);
//		}
//	}
}

/**
 * Focus auf das angegebene Widget setzen
 * @param ajaxDelegator
 * @param child
 * @return
 */
function reqWidgetFocus (ajaxDelegator,child) {
	try {
		var id = child.getAttribute("id");
		var ele = document.getElementById (id);
		if (ele) {
			ele.focus ();
			if ($.browser.msie) {
				ele.focus ();
				ele.focus ();
			}
		}
	} catch (e) { /* ignore */ }
}

/* JsInclude file=ajax-application.js */
/**
 * Setzt einen Wert in der aktuellen Session per AJAX
 * @param key - Schlüssel
 * @param value - Wert
 * @return void
 */
function ajax_setSessionValue(key, value) {
	sendRequestParams("setSessionValue", ["key="+key, "value="+value, "ifNull=false"]);
}

/**
 * Setzt einen Wert in der aktuellen Session per AJAX, wenn dieser noch
 * nicht registriert wurde bzw null ist.
 * @param key - Schlüssel
 * @param value - Wert
 * @return void
 */
function ajax_setSessionValueIfNull(key, value) {
	sendRequestParams("setSessionValue", ["key="+key, "value="+value, "ifNull=true"]);
}


function ajax_action(id) {
	sendRequest("action", "id="+id);
	return true;
}

function ajax_searchProjects (id, action, projectFieldId) {

	if ( checkMandatoryId(id) && checkMandatoryId(projectFieldId) ) {
		var ele = document.getElementById (id);
		var projectEle = document.getElementById (projectFieldId);
		var selectedProject = "-selected-project="+projectEle.value;
		var with_archive = "with-archive="+ele.checked;
		sendRequest ("searchProjects", "id="+projectFieldId, "action="+action, with_archive, selectedProject, "leerzeile", "leervalue");
	}
}

function ajax_searchMultiProjects (id, action, projectFieldId) {

	if ( checkMandatoryId(id) && checkMandatoryId(projectFieldId) ) {
		var ele = document.getElementById (id);
		var projectEle = document.getElementById (projectFieldId);
		var selectedProject = "-selected-project=";
		try {
			var eleOpts = projectEle.options;
			var optLen = eleOpts.length;
			if (optLen > 0) {
				for (var i = 0; i < optLen; i++) {
					var opt = eleOpts[i];
					if (opt.selected) {
						selectedProject += opt.value +";";
					}
				}
			}
		} catch (e) { }

		var with_archive = "with-archive="+ele.checked;
		sendRequest ("searchProjects", "id="+projectFieldId, "action="+action, with_archive, selectedProject);
	}
}

function ajax_setPrjProperties (id, action) {

	if ( checkMandatoryId(id)) {
		var ele = document.getElementById (id);
		sendRequest ("setPrjProperties", "checked="+ele.checked, "action="+action, "fieldid="+id);
	}
}
function ajax_changeProjectIndicator (id) {
	sendRequest ("changeProjectIndicator", "status="+id);
}

/**
 * Löschen von Sätzen aus der Benutzergruppenhistorie. Verwendet in:
 * benutzergruppe.xml und permission_history.xml
 * 
 * @param Maskenname
 */
function ajax_userHistoryRemove (id) {
	sendRequest ("userHistoryRemove", "maskname="+id);
}


function ajax_showProgressInfoPopUp (eID, id, taskID, resId) {
	var args = new Array();
	
	var p = pb.elements[id];
	if (p) {
		p._close ();
	}

	var ID = "id="+id;
	var eleID = "eleID="+eID;
	var currTaskID = "taskID="+taskID;
	var currResID = "resourceID="+resId;
	var xPos = "xPos="+pb.e.x;
	var yPos = "yPos="+pb.e.y;

	args[args.length]=ID;
	args[args.length]=eleID;
	args[args.length]=currTaskID;
	args[args.length]=currResID;
	args[args.length]=xPos;
	args[args.length]=yPos;

	sendSynchronRequest ("showProgressInfoPopUp", args);
// sendRequestParams ("showProgressInfoPopUp", args);
}


function ajax_showCostInvestInfoPopUp (_pk, _id, _type) {
	var args = new Array();
	
	var p = pb.elements[id];
	if (p) {
		p._close ();
	}

	var pk = "pk="+_pk;
	var id = "id=costInvestPopup";
	var type = "type="+_type;
	var xPos = "xPos="+pb.e.x;
	var yPos = "yPos="+pb.e.y;

	args[args.length]=pk;
	args[args.length]=id;
	args[args.length]=type;
	args[args.length]=xPos;
	args[args.length]=yPos;
	args[args.length]="action=show";

	sendSynchronRequest ("showCostInvestInfoPopUp", args);
}


function ajax_showResourceWorkPopUp (eID, id, resId) {
	var args = new Array();
	
	var p = pb.elements[id];
	if (p) {
		p._close ();
	}

	var ID = "id="+id;
	var eleID = "eleID="+eID;
	var currResID = "resourceID="+resId;
	var xPos = "xPos="+pb.e.x;
	var yPos = "yPos="+pb.e.y;

	args[args.length]=ID;
	args[args.length]=eleID;
	args[args.length]=currResID;
	args[args.length]=xPos;
	args[args.length]=yPos;

	// alert("ajax_showResourceWorkPopUp ID="+ID+" eleID="+eleID+"
	// currResID="+currResID);

	sendSynchronRequest ("showResourceWorkPopUp", args);
// sendRequestParams ("showResourceWorkPopUp", args);
}

function ajax_searchWorktimeTasks (ele, ticketFieldID, taskFieldId, accountableId, stundenId, worktimeId, serviceId, remarkId, ownTasksOnly, allTasks, allowParent) {
	var ticketEle = document.getElementById(ticketFieldID);
	if (ticketEle && (ticketEle.value != "")) {
		return;
	}
	var projectId = "-projectId="+ele.value;
	var taskEle = document.getElementById ("task_id");
	var selectedTask = "-taskId="+taskEle.value;
	var accountable = "-accountableId="+accountableId;
	var _stundenId = document.getElementById (stundenId);
	var stdId = "-stundenId="+_stundenId.value;
	var worktime = "-worktimeId="+worktimeId;
	var service = "-serviceId="+serviceId;
	var remark = "remarkId="+remarkId;
	var sOwnTasksOnly = "ownTasksOnly="+getBoolean(ownTasksOnly);
	var sAllTasks = "allTasks="+getBoolean (allTasks);;
	var sAllowParent = "allowParent="+getBoolean(allowParent);
	var sAllowMandatory = "allowMandatory=true";
	var sEnableParent = "enableParent=false";

	sendRequest ("searchTasks", "id="+taskFieldId, projectId, selectedTask, accountable, worktime, service, remark, sOwnTasksOnly, sAllTasks, sAllowParent, sAllowMandatory, sEnableParent, "leerzeile", stdId);
}

function ajax_searchTasks (ele, taskFieldId, accountableId, worktimeId, serviceId, ownTasksOnly, allTasks, allowParent) {
	var projectId = "-projectId="+ele.value;
	var taskEle = document.getElementById (taskFieldId);
	var selectedTask = "-taskId="+taskEle.value;
	var accountable = "-accountableId="+accountableId;
	var worktime = "-worktimeId="+worktimeId;
	var service = "-serviceId="+serviceId;
	var sOwnTasksOnly = "ownTasksOnly="+getBoolean(ownTasksOnly);
	var sAllTasks = "allTasks="+getBoolean(allTasks);
	var sAllowParent = "allowParent="+getBoolean(allowParent);
	var sAllowMandatory = "allowMandatory=false";
	var sEnableParent = "enableParent=false";

	sendRequest ("searchTasks", "id="+taskFieldId, projectId, selectedTask, accountable, worktime, service, sOwnTasksOnly, sAllTasks, sAllowParent, sAllowMandatory, sEnableParent, "leerzeile");
}

function ajax_searchAllTasks (projectEle, taskFieldId, ownTasksOnly, allowParent) {
// var projectEle = document.getElementById(projectFieldID);
	var projectId = "-projectId="+projectEle.value;
	var taskEle = document.getElementById (taskFieldId);
	var selectedTask = "-taskId="+taskEle.value;
	var accountable = "-accountableId=";
	var worktime = "-worktimeId=";
	var service = "-serviceId=";
	var sOwnTasksOnly = "ownTasksOnly="+getBoolean(ownTasksOnly);
	var sAllTasks = "allTasks=true";
	var sAllowParent = "allowParent="+getBoolean(allowParent);
	var sAllowMandatory = "allowMandatory=false";
	var sEnableParent = "enableParent=true";
// alert(selectedTask);
	sendRequest ("searchTasks", "id="+taskFieldId, projectId, selectedTask, accountable, worktime, service, sOwnTasksOnly, sAllTasks, sAllowParent, sAllowMandatory, sEnableParent, "leerzeile");
}

function ajax_searchPredecessorTasks (ele, taskFieldId, selectedTaskId) {
	var projectId = "-projectId="+ele.value;
	var taskEle = document.getElementById (selectedTaskId);
	var selectedTask = "selectedTaskId="+taskEle.value;

	sendRequest ("searchPredecessorTasks", "id="+taskFieldId, projectId, selectedTask);
}

function ajax_loadPredecessors(projectLBID, taskLBID, currentTask) {
	var d = document.getElementById(projectLBID);
	if (d)
		sendRequest("loadPredecessors", "projectID="+d.value, "listboxId="+taskLBID, "task="+currentTask);
}

function ajax_searchPrjMemberTasks (ele, task_name, task_id_name) {
	var projectId = "-projectId="+ele.value;
	var taskId = "selected_task_id=";
	if (task_id_name) {
		var eleTaskID = document.getElementById(task_id_name);
		if (eleTaskID && eleTaskID.value) {
			taskId += eleTaskID.value;
		}
	}
	sendRequest ("searchPrjMemberTasks", "id="+task_name, projectId, taskId);
}

function ajax_worktimeForTask (ele, ticketFieldID, workFieldId, stateFieldId) {
	var ticketEle = document.getElementById(ticketFieldID);
	if (ticketEle && (ticketEle.value != "")) {
		return;
	}
	var taskId = "-taskId="+ele.value;
	var state = "-stateId="+stateFieldId;
	var eleTaskID;
	eleTaskID = document.getElementById("task_id");
	if ( eleTaskID ) {
		eleTaskID.value = ele.value;
	}
	var workID =  document.getElementById("stunden_id");
	if (workID) {
		workID = "-workID="+workID.value;
	}
	sendRequest ("worktimeForTask", "workFieldId="+workFieldId, taskId, state, workID);
}

function ajax_staffCalendarShowKW (id, workingHoursWeekly ) {
	var ele;
	var stdStaffCalendar;
	if ( checkMandatoryId(id) && checkId(workingHoursWeekly) ) {
		ele = document.getElementById (id);
		stdStaffCalendar = "staff_calendar="+ele.value;
		sendRequest ("staffCalendarShowHours", "id="+workingHoursWeekly, stdStaffCalendar);
	}
}

function ajax_fillExternalDepartment(id,department,departmentSub ) {
	var type;
	var departmentId;
	var departmentSubId;

	if ( document.getElementById(id) ) {
		type = document.getElementById(id).value;
	} else {
		type = 0;
	}
	
	if (  document.getElementById("customer") && document.getElementById("customer_sub") ) {
		departmentId = document.getElementById("ajax_customer_id").value;
		departmentSubId= document.getElementById("ajax_customer_sub_id").value;

		sendRequest (
			"fillExternalDepartment", 
			"type="+type, 
			"department="+	department, 
			"departmentSub="+departmentSub,
			"departmentId="+departmentId,
			"departmentSubId="+departmentSubId
		);
	}
}

// Anzeige der zum ausgewaehlten UB gehörigen Mitarbeiter
function ajax_showDepartmentMember(cb_ub_filter,lb_ub_Filter) {
	var ele;
	var ub_ele;
	
	ele = document.getElementById (cb_ub_filter);
	ub_ele = document.getElementById (lb_ub_Filter);
	sendRequest ("showDepartmentMember", "cb_ub_filter="+ele.checked,"lb_ub_Filter="+ub_ele.value);
}

// Projekt-Basisdaten: wird aufgerufen, wenn die Projektart geändert wird
function ajax_showProjectTypeProperties (typeId,lb_ub_Filter) {
	var ele;
	var ub_ele;

	if ( checkMandatoryId(typeId))  {
		ele = document.getElementById (typeId);
		ub_ele = document.getElementById (lb_ub_Filter);
		sendRequest ("showProjectTypeProperties", "typeId="+ele.value,"lb_ub_Filter="+ub_ele.value);
	}
}
// Projektplanunk Kosten/Investitionen: Kostenart zum Sammelbelegtyp anzeigen
function ajax_showCollectiveTypeById (cost_type) {
	var ele;

	if ( checkMandatoryId(cost_type))  {
		ele = document.getElementById (cost_type);
		sendRequest ("showCollectiveTypeById", "collectiveId="+ele.value);
	}
}

// Projekt-Basisdaten: wird aufgerufen, wenn der Projektstatus geändert wird
function ajax_showProjectStateProperties (stateId) {
	var ele;

	if ( checkMandatoryId(stateId))  {
		ele = document.getElementById (stateId);
		sendRequest ("showProjectStateProperties", "stateId="+ele.value);
	}
}
// Projekt-Basisdaten: wird aufgerufen, wenn der Unternehmensbereich geändert
// wird
function ajax_showProjectDepartmentProperties(typeId,lb_ub_Filter) {
	var ele;
	var ub_ele;

	if ( checkMandatoryId(typeId))  {
		ele = document.getElementById (typeId);
		ub_ele = document.getElementById (lb_ub_Filter);
		sendRequest ("showProjectDepartmentProperties", "typeId="+ele.value,"lb_ub_Filter="+ub_ele.value);
	}
}
// Belegerfassung: wird aufgerufen, wenn das Projekt (neu und ändern) ausgwählt
// wird
function ajax_showProjectCurrency (projectId) {
	var ele;
	var ub_ele;

	if ( checkMandatoryId(projectId))  {
		ele = document.getElementById (projectId);
		sendRequest ("showProjectCurrency", "projectId="+ele.value);
	}
}

// Projekt-Reports: Ändern der Werte-Listbox
function ajax_handleReportColListbox(column) {
		// alert("handleReportColListbox");
		var ele = document.getElementById (column);
		sendRequest ("handleReportColListbox", "column="+ele.value);
}

// Projekt-Reports: Ändern der Operator-Listbox
function ajax_handleReportOperatorListbox(operator) {
		// alert("handleReportOperatorListbox");
		var ele = document.getElementById (operator);
		sendRequest ("handleReportOperatorListbox", "calc_operator="+ele.value);
}

// Projekt-Reports: Anzeige der zur Vorlage gehörigen Eigenschaften
function ajax_showTemplateProperties (reportId, isCreate) {
	var ele;
	var ub_ele;

	if ( checkMandatoryId(reportId))  {
		ele = document.getElementById (reportId);
// alert("reportId="+ele.value + "isCreate="+isCreate);
		sendRequest ("showTemplateProperties", "reportId="+ele.value, "isCreate="+isCreate);
	}
}
// Aufträge: wird aufgerufen, wenn die Kategorie geändert wird (order_create und
// order_properties)
function ajax_handleOrderCategory (category_Filter) {
	var ele;
	if ( checkMandatoryId(category_Filter))  {
		ele = document.getElementById (category_Filter);
		sendRequest ("handleOrderCategory", "category_Filter="+ele.value);
	}
}

function ajax_fillExternalDepartmentChange(department,departmentSub ) {
	var type;
	var departmentId;
	var departmentSubId;

	departmentId = document.getElementById(department).value;
	departmentSubId= document.getElementById(departmentSub).value
	
	document.getElementById("ajax_customer_id").value = departmentId;
	document.getElementById("ajax_customer_sub_id").value = departmentSubId;
	
	sendRequest (
		"fillExternalDepartmentSub", 
		"department="+department,
		"departmentSub="+departmentSub,
		"departmentId="+departmentId,
		"departmentSubId="+departmentSubId
	);
}


function ajax_setPortletPosition (id, projectID, x, y, w, h, o, v) {
	var _ProjectID = "-projectID="+projectID;
	var xPos = "x_pos="+x;
	var yPos = "y_pos="+y;
	var width = "width="+w;
	var height = "height="+h;
	var open = "open="+o;
	var visible = "visible="+v;

	if ( checkMandatoryId(id) ) {
		sendRequest ("setPortletPosition", "action=setPortletPosition", "id="+id, _ProjectID, xPos, yPos, width, height, open, visible);
	}
}

function ajax_getPortletPosition (id, projectID) {
	if ( checkMandatoryId(id) ) {
		var _ProjectID = "-projectID="+projectID;

		var ele = document.getElementById (id);
		if (ele) {
			sendRequest ("getPortletPosition", "action=getPortletPosition", "id="+id, _ProjectID);
		}
	}
}

function ajax_fillTabPortlet (id, na, n, w ) {
	var what = "what="+w;
	var name = "name="+na;
	var nr = "nr="+n;

	if ( checkMandatoryId(id) ) {
		/* Bug 12572 */
// if ( FF2 ) {
// sendSynchronRequest ("fillTabPortlet", ["id="+id, name, nr, what]);
// } else {
			sendRequest ("fillTabPortlet", "id="+id, name, nr, what);
// }
	}
}

function ajax_showMessages () {
	/* Bug 12572 */
// if ( FF2 ) {
// sendSynchronRequest ("showMessages", ["portletId=message",
// "action=showMessages"]);
// } else {
		sendRequest ("showMessages", "portletId=message", "action=showMessages");
// }
}

function ajax_showNewsticker () {
	/* Bug 12572 */
// if ( FF2 ) {
// sendSynchronRequest ("showNewsticker", ["portletId=news"]);
// } else {
		sendRequest ("showNewsticker", "portletId=news");
// }
}

function ajax_showBookmarks () {
	/* Bug 12572 */
// if ( FF2 ) {
// sendSynchronRequest ("showBookmarks", ["portletId=bookmark",
// "action=showBookmarks"]);
// } else {
		sendRequest ("showBookmarks", "portletId=bookmark", "action=showBookmarks");
// }
}

function ajax_deleteBookmark (id) {
	sendRequest ("deleteBookmark", "portletId=bookmark", "id="+id, "action=deleteBookmark");
}

function ajax_editBookmark (id) {
	sendRequest ("editBookmark", "portletId=bookmark", "id="+id, "action=editBookmark");
}
function ajax_saveBookmark (id) {
	var value = "-value";
	if (id) {
		try {
			var ele = document.getElementById ("ed_"+id);
			value = "-value="+ele.value;
		} catch (e) { }
	}
	
	sendRequest ("saveBookmark", "portletId=bookmark", "id="+id, value, "action=saveBookmark");
}

function ajax_showTasks () {
	/* Bug 12572 */
// if ( FF2 ) {
// sendSynchronRequest ("showTasks", ["portletId=tasks"]);
// } else {
		sendRequest ("showTasks", "portletId=tasks");
// }
}

function ajax_showAssignments () {
	/* Bug 12572 */
// if ( FF2 ) {
// sendSynchronRequest ("showAssignments", ["portletId=assignments"]);
// } else {
		sendRequest ("showAssignments",  "portletId=assignments");
// }
}

function ajax_showTickets () {
	/* Bug 12572 */
// if ( FF2 ) {
// sendSynchronRequest ("showTickets", ["portletId=tickets"]);
// } else {
		sendRequest ("showTickets", "portletId=tickets");
// }
}

function ajax_showSortedMessages (column) {
	sendRequest ("showMessages", "portletId=message", "column="+column, "action=showMessages");
}

function ajax_showProjects () {
	/* Bug 12572 */
// if ( FF2 ) {
// sendSynchronRequest ("showProjects", ["portletId=welcome",
// "action=showProjects"]);
// } else {
		sendRequest ("showProjects", "portletId=welcome", "action=showProjects");
// }
}

function ajax_showTodos () {
	/* Bug 12572 */
// if ( FF2 ) {
// sendSynchronRequest ("showTodos", ["portletId=todos", "action=showTodos"]);
// } else {
		sendRequest ("showTodos", "portletId=todos", "action=showTodos");
// }
}

function ajax_showSortedProjects (column) {
	sendRequest ("showProjects", "portletId=welcome", "column="+column, "action=showProjects");
}

function ajax_showSortedTickets (column) {
	sendRequest ("showTickets", "portletId=tickets", "column="+column, "action=showTickets");
}

function ajax_setTicketFinished (ele) {
	sendRequest ("showTickets", "portletId=tickets", "participantID="+ele.name, "action=setTicketFinished");
}

function ajax_toggleTicketStopWatch (id) {
	sendRequest ("toggleStopWatch", "portletId=tickets", "participantID="+id, "action=toggleTicketStopWatch", "xPos="+pb.e.x, "yPos="+pb.e.y);
}

function ajax_toggleTaskStopWatch (id) {
	sendRequest ("toggleStopWatch", "portletId=TasksPortlet", "planResourceID="+id, "action=toggleTaskStopWatch", "xPos="+pb.e.x, "yPos="+pb.e.y);
}

function ajax_toggleOrderStopWatch (id) {
	sendRequest ("toggleStopWatch", "portletId=AssignmentsPortlet", "planTaskID="+id, "action=toggleOrderStopWatch", "xPos="+pb.e.x, "yPos="+pb.e.y);
}

function ajax_showMessage (id) {
	sendRequest ("showMessage", "portletId=message", "msg_id="+id, "action=showMessage");
}
function ajax_deleteMessage (id) {
	sendRequest ("deleteMessage", "portletId=message", "msg_id="+id, "action=deleteMessage");
}
function ajax_deleteAllMessages () {
	sendRequest ("deleteMessage", "portletId=message", "action=deleteAllMessages");
}
function ajax_showAbsences (column) {
	sendRequest ("showAbsences", "portletId=absences", "action=showAbsences");
}
function ajax_showSortedAbsences (column) {
	sendRequest ("showAbsences", "portletId=absences", "column="+column, "action=showAbsences");
}

/*
 * function ajax_toggleMilestone (p, n, s) {
 * ajax_toggleCheckBoxFunction("toggleMilestone", p, n, s); }
 */
function ajax_toggleMilestone(ele ) {
	ajax_toggleCheckBoxFunction("toggleMilestone", "KT_trend_", ele.name, ele.checked);
}
function ajax_toggleMessage(ele ) {
	var prefix = "prefix=KT_msg_";
	var name = "name="+ele.name;
	var selected = "selected="+ele.checked;
	var portlet = "portletId=message";
	var action = "action=toggleMessage";

	sendRequest ("toggleMessage", prefix, name, selected, portlet, action);
// ajax_toggleCheckBoxFunction("toggleMessage", "KT_msg_", ele.name,
// ele.checked);
}


function ajax_toggleCheckBoxFunction (functionName, p, n, s) {
	var prefix = "prefix="+p;
	var name = "name="+n;
	var selected = "selected="+s;

	sendRequest (functionName, prefix, name, selected);
}

var toggleStopWatchLoaded = false;
function ajax_toggleGuiStopWatch () {
	sendRequest ("toggleStopWatch", "action=guiStopWatch");
}

function ajax_toggleStopWatch (dateEle, vonEle, bisEle, durationEle, ticketEle, projectEle, taskEle, activityEle) {
	var dateId		=	_ajax_getId ("date",		dateEle);
	var vonId		=	_ajax_getId ("von",		vonEle);
	var bisId		=	_ajax_getId ("bis",		bisEle);
	var durationId	=	_ajax_getId ("duration",	durationEle);
	var ticketId	=	_ajax_getId ("ticket",	ticketEle);
	var ticketVal	=	_ajax_getSelectedValue ("ticket",		ticketEle);
	var projectId	=	_ajax_getId ("project",	projectEle);
	var projectVal	=	_ajax_getSelectedValue ("project",	projectEle);
	var taskId		=	_ajax_getId ("task",		taskEle);
	var taskVal		=	_ajax_getSelectedValue ("task",		taskEle);
	var activityId	=	_ajax_getId ("activity",	activityEle);
	var activityVal	=	_ajax_getSelectedValue ("activity",	activityEle);
	var loaded		=	"loaded="+toggleStopWatchLoaded;

	sendRequest ("toggleStopWatch", dateId, vonId, bisId, durationId, ticketId, ticketVal, projectId, projectVal, taskId, taskVal, activityId, activityVal, loaded);
	toggleStopWatchLoaded = true;
}


function ajax_toggleFacturaCheckbox(ele ) {
	ajax_toggleCheckBoxFunction("toggleFacturaCheckbox", "KT_abrechnen", ele.name, ele.checked);
}

function ajax_toggleEmailBookmarkCheckbox(ele ) {
	ajax_toggleCheckBoxFunction("toggleEmailBookmarkCheckbox", "KT_email_", ele.name, ele.checked);
}


function ajax_searchStaff (staffLbId, mode, startKwId, startYearId, startDateId, endKwId, endYearId, endDateId) {
// alert ("searchStaff staffLbId="+staffLbId+", mode="+mode+",
// startKwId="+startKwId+", startYearId="+startYearId+",
// startDateId="+startDateId+", endKwId="+endKwId+", endYearId="+endYearId+",
// endDateId="+endDateId);

	var staffLb = "staffLbId="+staffLbId;
	var _mode = "mode="+mode;
	
	var staffId = "-staffId";
	try {
		var eleOpts = document.getElementById (staffLbId).options;
		var optLen = eleOpts.length;
		if (optLen > 0) {
			staffId = "staffId=";
			for (var i = 0; i < optLen; i++) {
				var opt = eleOpts[i];
				if (opt.selected) {
					staffId += opt.value +";";
				}
			}
		}
	} catch (e) { }
	
	var startKw = "-startKw";
	if (startKwId) {
		try {
			var ele = document.getElementById (startKwId);
			startKw = "-startKw="+ele.value;
		} catch (e) { }
	}
	
	var startYear = "startYear";
	if (startYearId) {
		try {
			var ele = document.getElementById (startYearId);
			startYear = "startYear="+ele.value;
		} catch (e) { }
	}
	
	var _startDateId="-startDateId";
	var startDate = "-startDate";
	if (startDateId) {
		_startDateId="-startDateId="+startDateId;
		try {
			var ele = document.getElementById (startDateId);
			startDate = "-startDate="+ele.value;
		} catch (e) { }
	}
	
	var endKw = "-endKw";
	if (endKwId) {
		try {
			var ele = document.getElementById (endKwId);
			endKw = "-endKw="+ele.value;
		} catch (e) { }
	}
	
	var endYear = "endYear";
	if (endYearId) {
		try {
			var ele = document.getElementById (endYearId);
			endYear = "endYear="+ele.value;
		} catch (e) { }
	}
	
	var _endDateId="-endDateId";
	var endDate = "-endDate";
	if (endDateId) {
		_endDateId="-endDateId="+endDateId;
		try {
			var ele = document.getElementById (endDateId);
			endDate = "-endDate="+ele.value;
		} catch (e) { }
	}
	
// alert ("searchStaff "+staffLb+", "+_mode+", "+startKw+", "+startYear+",
// "+_startDateId+", "+startDate+", "+endKw+", "+endYear+", "+_endDateId+",
// "+endDate);
	sendRequest ("searchStaff", staffLb, staffId, _mode, startKw, startYear, _startDateId, startDate, endKw, endYear, _endDateId, endDate);
}

function ajax_searchAbsenceMultiListbox (modeLbId, upmLbId, timespanId, startDateId, endDateId) {
// alert ("searchAbsenceMultiListbox modeLbId="+modeLbId+", upmLbId="+upmLbId+",
// timespanId="+timespanId+", startDateId="+startDateId+",
// endDateId="+endDateId);

	var mode = "mode=";
	try {
		var ele = document.getElementById (modeLbId);
		mode = "mode="+ele.value;
	} catch (e) { }

	var upmLbSelected = "-upmLbSelected=";
	var upmOpts = document.getElementById (upmLbId).options;
	var optLen = upmOpts.length;
	for (var i = 0; i < optLen; i++) {
		var opt = upmOpts[i];
		if (opt.selected) {
			upmLbSelected += opt.value +";";
		}
	}
	
	var _upmLbId = "upmLbId="+upmLbId;

	var timespan = "timespan";
	if (timespanId) {
		try {
			var ele = document.getElementById (timespanId);
			timespan = "timespan="+ele.value;
		} catch (e) { }
	}

	var _startDateId="startDateId";
	var startDate = "-startDate";
	if (startDateId) {
		_startDateId="startDateId="+startDateId;
		try {
			var ele = document.getElementById (startDateId);
			startDate = "-startDate="+ele.value;
		} catch (e) { }
	}
	
	var _endDateId="endDateId";
	var endDate = "-endDate";
	if (endDateId) {
		_endDateId="endDateId="+endDateId;
		try {
			var ele = document.getElementById (endDateId);
			endDate = "-endDate="+ele.value;
		} catch (e) { }
	}
	
// alert ("searchAbsenceMultiListbox "+mode+", "+upmLbId+", "+upmLbSelected+",
// "+timespan+", "+_startDateId+", "+startDate+", "+_endDateId+", "+endDate);
	sendRequest ("searchAbsenceMultiListbox", mode, _upmLbId, upmLbSelected, timespan, _startDateId, startDate, _endDateId, endDate);
}

/**
 * Füllt die Mitarbeiter-Listbox für die Anzeige in der Startseiten-Portlet
 * Konfiguration
 * 
 * @param modeLbId
 * @param upmLbId
 * @param timespanId
 * @param startDateId
 * @param endDateId
 * @return
 */
function ajax_searchAbsenceStaffListbox (endDateId) {
// alert ("ajax_searchAbsenceStaffListbox timespanId="+timespanId+",
// startDateId="+startDateId+", endDateId="+endDateId);
	formSent = false; 
	if (!ajax_validation(document.getElementById('absence_days').form,true)) return (true); 
	formSent = false; 
	
	var mode = "mode=ub";
	var _upmLbId = "departments";
	var upmLbId = "upmLbId="+_upmLbId;
	var timespan = "timespan=11"; // Tage ab heute (siehe
									// AbsenceConstants.ABSENCE_GUI_VIEW_DAYS)
// var startDateId="-startDateId";
	// var startDate = "-startDate";
	var _endDateId="absence_days";
	
	var upmLbSelected = "-upmLbSelected=";
	var upmOpts = document.getElementById (_upmLbId).options;
	var optLen = upmOpts.length;
	for (var i = 0; i < optLen; i++) {
		var opt = upmOpts[i];
		if (opt.selected) {
			upmLbSelected += opt.value +";";
		}
	}
	
	var endDate = "-endDate";
	if (_endDateId) {
		try {
			var ele = document.getElementById (_endDateId);
			endDate = "-endDate="+ele.value;
		} catch (e) { }
	}
	
// alert ("searchAbsenceMultiListbox "+mode+", "+upmLbId+", "+upmLbSelected+",
// "+timespan+", "+_startDateId+", "+startDate+", "+_endDateId+", "+endDate);
	sendRequest ("searchAbsenceMultiListbox", mode, upmLbId, upmLbSelected, timespan, endDate);
}

/**
 * Serverseite Validierung ausführen. allerdings nur dann, wenn Nativ-Ajax
 * genutzt wird. - ruft intern sendOnce auf.
 */
function ajax_validation(form,disableProgress) {
	var s;
	var e;
	var args;


// if ( isNativeAjax() && __session__ != '0' ) {
	if ( __session__ != '0' ) {
		if ( !formSent ) {
	
			// suche das Memofeld im Formular, das den FCK benutzt und Pflicht
			// ist
 			var iframeList = document.getElementsByTagName("iframe");
 			
 			
 			/*
			 * In diesem Teil werden Memofelder mit FCK-Support abgearbeitet. In
			 * der momentanen FCK-Version (2.6.4) wird der Editor durch zwei
			 * ineinander verschachtelte IFrames simuilert, wobei das obere als
			 * ID die ID des Memos + "___Frame" hat, das innere jedoch keine ID.
			 * Unabhängig davon werden zunächst alle IFrames gesucht und
			 * anschließend die herausgefiltert, die mit "fck_" beginnen (siehe
			 * form.xls). Zu diesen Frames werden die passenden MemoIDs
			 * gebildet. Anschließend wird im gefundenen IFrame nach dem inneren
			 * IFrame gesucht. Aus diesem inneren IFrame wird der
			 * innerHTML-Inhalt des Bodys genommen und dem zugehörigen Memofeld
			 * als Value übergeben. Somit kann in der ajax-Validation der Inhalt
			 * des FCK geprüft werden.
			 * 
			 * In der aktuellen Version besteht leerer Inhalt des FCKs aus <p><br><p/>.
			 * Eine entsprechende Prüfung wurde in die Klasse ValidateInput
			 * eingebaut.
			 */
 			if(iframeList && iframeList.length) {
 				for(var i = 0; i < iframeList.length; i++) {
 					if(iframeList[i].id.substring(0,4) == "fck_") {
 						var memoName = iframeList[i].id.substring(0,(iframeList[i].id.length - ("___Frame".length)))
 						
 						// Textarea entfernen
 						var memo = document.getElementById(memoName);
 						if(memo) {
 							// Lese den Inhalt des oberen IFrames
 							var firstIframeLevelDocument = getIframeDocument(iframeList[i]);
 							
 							if(firstIframeLevelDocument) {
 								// suche das innere IFrame
 								var innerIframes = firstIframeLevelDocument.getElementsByTagName("iframe");
 								
 								// Es darf nur ein IFrame geben, andernfalls
								// wurde der FCK geändert und der
 								// Code sollte geprüft werden (siehe alert()).
 								if(innerIframes && innerIframes.length == 1) {
 									memo.value = getIframeDocument(innerIframes[0]).body.innerHTML;
 								} else {
 									alert("Warning: It seems that fck structurer has changed! Please contact your admin!");
 								}
 							}
 						} 
 					} 
 				}
 			
 			}
			
			formSent = true;
			executeForm =false;
			
			e = new Array();
			args = new Array();
			for(var i=0; i < form.elements.length; i ++ ) {
				var formelement = form.elements[i];
				if ( formelement.name != '' && formelement.type!='submit' && formelement.type != 'hidden' && !(formelement.disabled == 'disabled' || formelement.disabled )) {
					args.push(formelement.name+"="+formelement.value);
				}
			}
			args[args.length]="formular="+form.id;
			sendSynchronRequest ("ValidationHandler",args);	
			
			if ( executeForm ) {
				if ( !disableProgress ) {	
					startwait();
				}
				return true;
			}
			formSent = false;
		} 
		return false;
	} else {
		if ( !disableProgress ) {	
			return sendOnce(form);
		} else {
			return true;
		}
	}
}
 

function ajax_FieldValidation(params) {
	var s;
	var e;
	var args;

	executeForm =false;
	
	e = new Array();
	args = new Array();
	var formID = null;
	for (var i = 0; i < params.length; i++) {
		var param = params[i];
		param = (typeof(param)=='object'?param:document.getElementById(param));
		args[args.length]=param.name+"="+param.value;
		if (formID == null) {
			formID = param.form.id;
		}
	}
	
	args[args.length]="formular="+formID;
	sendSynchronRequest ("ValidationHandler",args);	
	
	return (executeForm);
}


/**
 * Serverseite Validierung für Popups ausführen. allerdings nur dann, wenn
 * Nativ-Ajax genutzt wird. - ruft intern sendOnce auf.
 */
function ajax_popupValidation(form) {
	var s;
	var e;
	var args;

// if ( isNativeAjax() && __session__ != '0' ) {
	if ( __session__ != '0' ) {
		executeForm =false;
		
		e = new Array();
		args = new Array();
		for(var i=0; i < form.elements.length; i ++ ) {
			if ( form.elements[i].type!='submit' && form.elements[i].type != 'hidden' && !(form.elements[i].disabled == 'disabled' || form.elements[i].disabled )) {
				args[args.length]=form.elements[i].name+"="+form.elements[i].value;
			}
		}
		args[args.length]="formular="+form.id;
		sendSynchronRequest ("ValidationHandler",args);	
		
		if ( executeForm ) {
			return true;
		}

		return false;
	} else {
		return true;
	}
}

function ajax_synchronizeTaskId (task_name, task_id_name) {
	var eleTask = document.getElementById(task_name);
	var eleTaskID = document.getElementById(task_id_name);
	if ( eleTask && eleTaskID ) {
		eleTaskID.value = eleTask.value;
	}
	// No Request
}


function _ajax_getId (name, ele) {
	if (ele == null) {
		return ("-"+name+"Id");
	}
	return (name+"Id="+ele.id);
}

function _ajax_getValue (name, ele) {
	if (ele == null) {
		return ("-"+name+"Value");
	}
	if (ele.value && ele.value.length > 0) {
		return (name+"Value="+ele.value);
	} else {
		return ("-"+name+"Value");
	}
}

function _ajax_getSelectedValue (name, ele) {
	if (ele == null) {
		return ("-"+name+"Value");
	}
	var value = null;
	try {
		if (ele.selectedIndex < 0) {
			return ("-"+name+"Value");
		}
// alert ("ele.options[ele.selectedIndex]="+ele.options[ele.selectedIndex]);
		value = ele.options[ele.selectedIndex].value;
// alert ("value="+value);
	} catch (e) {
		alert (e);
	}
	if (value && value.length > 0) {
		return (name+"Value="+value);
	} else {
		return ("-"+name+"Value");
	}
}

function checkMandatoryId(id ) {
	var ok;
	ok = checkId(id);
	if ( !ok ) {
		alert("ID "+id+" existiert nicht ");
	}
	return ok;
}
	

function checkId(id ) {
	var ok;
	if ( document.getElementById (id) ) {
		ok = true;
	} else {
		ok = false;
	}
	return ok;
}

function getBoolean (val) {
	return ((val == true || val == "true") ? "true":"false");
}

function ajax_toggleListbox(element) {
	var ele;
	if (element.value == 3) {
		// Profil-Filter aktivieren
		ele=document.getElementById("profile_Filter");
		ele.style.backgroundColor= StyleDefinitions.getColorDef ("FieldActiveBackground");
		ele.disabled='';
	} else {
		// Profil-Filter deaktivieren
		ele=document.getElementById("profile_Filter");
		ele.style.backgroundColor= StyleDefinitions.getColorDef ("FieldDisabledBackground");
		ele.style.color= StyleDefinitions.getColorDef ("FieldDisabled");
		ele.disabled='disabled';
	}
	
	if (element.value == 3 || element.value == 4) {
		// Wissensfilter deaktivieren
		ele=document.getElementById("kn_Filter");
		ele.style.backgroundColor= StyleDefinitions.getColorDef ("FieldDisabledBackground");
		ele.style.color= StyleDefinitions.getColorDef ("FieldDisabled");
		ele.disabled='disabled';
	} else {
		// Wissensfilter aktivieren
		ele=document.getElementById("kn_Filter");
		ele.style.backgroundColor= StyleDefinitions.getColorDef ("FieldActiveBackground");
		ele.disabled='';
	}
}

function ajax_submitKnowledgeProfile(profileId, knowledgeId) {
 	var lb = document.getElementById(knowledgeId);
 	var qualityId = "qualityId="+lb.value;
	sendRequest ("submitKnowledgeProfile", "profileId="+profileId, "knowledgeId="+knowledgeId, qualityId);
}

function ajax_showPredecessorPopUp (eID, id, taskID) {
	var args = new Array();
	
	var p = pb.elements[id];
	if (p) {
		p._close ();
	}

	var ID = "id="+id;
	var eleID = "eleID="+eID;
	var currTaskID = "taskID="+taskID;
	var xPos = "xPos="+pb.e.x;
	var yPos = "yPos="+pb.e.y;

	args[args.length]=ID;
	args[args.length]=eleID;
	args[args.length]=currTaskID;
	args[args.length]=xPos;
	args[args.length]=yPos;

	sendSynchronRequest ("taskPredecessorHandler", args);
// sendRequestParams ("taskPredecessorHandler", args);
}

function ajax_addPredecessor (fieldEle, id, taskID) {
	var s;
	var e;
	var args;
	var form = fieldEle.form;
	
	args = new Array();

	var ID = "id="+id;
	var currTaskID = "taskID="+taskID;
	var projectID = "projectID="+document.getElementById ("newpredproject").value;
	var predecessorTaskId = "predecessorTaskId="+document.getElementById ("newpredecessor").value;
	var offset = "-offset="+document.getElementById ("predecessor_offset").value;
// var link = "link="+document.getElementById ("predecessor_linked").checked;

	args[args.length]=ID;
	args[args.length]=currTaskID;
	args[args.length]=projectID;
	args[args.length]=predecessorTaskId;
	args[args.length]=offset;
// args[args.length]=link;

	sendRequestParams ("addPredecessor",args);	
}

function ajax_delPredecessors (fieldEle, id, taskID) {
	var s;
	var e;
	var args;
	var form = fieldEle.form;
	
	args = new Array();
// alert ("ajax_delPredecessor ("+fieldEle.name+", "+id+", "+taskID+")");
	for(i=0; i < form.elements.length; i ++ ) {
		ele = form.elements[i];
		if (ele.type == 'checkbox' && ele.checked) {
			args[args.length]=ele.name+"="+ele.checked;
		}
	}

	var ID = "id="+id;
	var currTaskID = "taskID="+taskID;

	args[args.length]=ID;
	args[args.length]=currTaskID;

	sendRequestParams ("delPredecessor", args);
}

function ajax_SelectProjectEffort(fieldFirmID, fieldEle,effortName,effortUnit) {
	var args;
	var e;
	
	args = new Array();
	e = document.getElementById(fieldFirmID);
	if ( e ) {
		args[args.length]="firm_id="+e.value;
	}
	args[args.length]="release_rule="+fieldEle.value;
	args[args.length]="field_name_effort="+effortName;
	args[args.length]="field_name_effort_unit="+effortUnit;
	
	sendRequestParams ("SelectProjectEffort", args);
}


function ajax_SelectFieldsInPersonSearch(fieldName) {
	args = new Array();
	e = document.getElementById(fieldName);
	if ( e ) {
		args[args.length]="field="+e.value;
		sendRequestParams ("SelectFieldsInPersonSearch", args);
	}
}

function ajax_showIndirectCostPopUp (eID, id) {
	var args = new Array();
	
	var p = pb.elements["indirect_cost_pop_up"];
	if (p) {
		p._close ();
	}

	var ID = "id="+id;
	var eleID = "eleID="+eID;
	var xPos = "xPos="+pb.e.x;
	var yPos = "yPos="+pb.e.y;

	args[args.length]=ID;
	args[args.length]=eleID;
	args[args.length]=xPos;
	args[args.length]=yPos;

	sendSynchronRequest ("indirectCostHandler", args);
// sendRequestParams ("indirectCostHandler", args);
}

function ajax_SetMandatoryDefaultWtReleaseProject (releaseId, defaultId) {
	var args = new Array();
	var e = document.getElementById(releaseId);
	if ( e ) {
		args[args.length]="releaseValue="+e.value;
		args[args.length]="id="+defaultId;
		sendRequestParams ("setMandatoryDefaultWtReleaseProject", args);
	}
}

function ajax_searchIcc (ubFieldId, subUbFieldId, iccNumberId, iccNameId) {
	var args = new Array();

	var e = document.getElementById(ubFieldId);
	var ubValue = "";
	if ( e ) {
		ubValue = e.value;
	}
	args[args.length]="-ubValue="+ubValue;

	e = document.getElementById(subUbFieldId);
	var subUbValue = "";
	if ( e ) {
		subUbValue = e.checked ? "true":"false";
	}
	args[args.length]="-subUbValue="+subUbValue;

	args[args.length]="numberID="+iccNumberId;
	args[args.length]="nameID="+iccNameId;

	sendRequestParams ("searchIccByUb", args);
}

function ajax_searchWorktimeProjects (customerID, ticketID, projektID, taskID, mode,taetigkeit) {
	var args = new Array();

	var e = document.getElementById(customerID);
	var customerValue = "";
	if ( e ) {
		customerValue = e.value;
	}
	args[args.length]="mode="+mode;
	args[args.length]="customerID="+customerID;
	args[args.length]="ticketID="+ticketID;
	args[args.length]="projektID="+projektID;
	args[args.length]="taskID="+taskID;

	args[args.length]="-customerValue="+customerValue;

	e = document.getElementById(ticketID);
	var ticketValue = "";
	if ( e ) {
		ticketValue = e.value;
	}
	args[args.length]="-ticketValue="+ticketValue;

	e = document.getElementById(projektID);

	var projektValue = "";
	if ( e ) {
		projektValue = e.value;
	}
	args[args.length]="-projektValue="+projektValue;

	e = document.getElementById(taskID);
	var taskValue = "";
	if ( e ) {
		taskValue = e.value;
// alert ("taskID="+taskID+", taskValue="+taskValue);
	}
	args[args.length]="-taskValue="+taskValue;

	// bug 11012
	if ( taetigkeit ) {
		e = document.getElementById(taetigkeit);
		if ( e ) {
			args[args.length]="-worktimeActivityValue="+e.value;		
		}
	}


// sendRequestParams ("searchWorktimeProjects", args);
	sendSynchronRequest ("searchWorktimeProjects", args)
}

function ajax_setGanttDates (start, end, use) {
	var args = new Array();

	args[args.length]="-startDate="+start;
	args[args.length]="-endDate="+end;
	args[args.length]="use="+use;

	sendSynchronRequest ("setGanttDates", args)
}

function ajax_fill_project_template (templateField) {
	var ele = document.getElementById(templateField);

	sendRequest ("fillProjectTemplate", "templateValue="+ele.value);
}

function ajax_fillProjectCreateMask (templateField,isVirtual) {
	var ele = document.getElementById(templateField);
	var args = new Array();

	args[args.length]="templateValue="+ele.value;
	args[args.length]="isVirtual="+isVirtual;

	sendRequestParams ("fillProjectCreateMask",args);	
	// sendRequest ("fillProjectCreateMask", "templateValue="+ele.value);
}

function ajax_showPrjPortlet (request) {
	sendRequest ("showPrjPortlet", "portlet="+request);
}

function setNewForm(formID, maske) {
	var args = new Array();
	args[args.length]="formular="+formID;
	args[args.length]="formular-type=new";
	sendRequestParams ("setForm",args);	

}

function setForm (formID, maske) {
	
	var form = document.getElementById (formID);
	var args = new Array();

	// Alle Werte der Checkboxen sammeln
	var cbArgs = new Array();
	for(var i=0; i < form.elements.length; i ++ ) {
		if (form.elements[i].type == "checkbox") {
			var cbName = form.elements[i].name;
			if (!cbArgs[cbName]) {
				cbArgs[cbName] = new Array ();
			}
			var cbValues = cbArgs[cbName];
			if (form.elements[i].checked) {
				cbValues[cbValues.length] = form.elements[i].value;
			} else {
				// Wenn die CB nicht selektiert ist den FalseValue suchen
				var falseID = form.elements[i].id+"_false";
				var falseEle = document.getElementById (falseID);
				if (falseEle) {
					cbValues[cbValues.length] = falseEle.value;
				}
			}
		}
	}
	
	// Checkboxen in AjaxRequest schreiben
	for (var cbName in cbArgs) {
		var cbValues = cbArgs[cbName];
		args[args.length]=cbName+"="+cbValues;
	}
	
	for(var i=0; i < form.elements.length; i ++ ) {
		if ( form.elements[i].type!='submit' && form.elements[i].type != 'hidden' && !(form.elements[i].disabled == 'disabled' || form.elements[i].disabled )) {
			var value = form.elements[i].value;

			if (form.elements[i].type == "select-multiple" || form.elements[i].type == "select-one") {

				value = "";
				var opts = form.elements[i].options;
				for (var o = 0; o < opts.length; o++) {
					var opt = opts[o];

					if (opt.selected) {
						if (value.length > 0) {
							value += ",";
						}
						value += opt.value;
					}

				}
			} else if (form.elements[i].type == "checkbox") {
				continue;
// value = form.elements[i].checked ? "1":"0";
			}
			args[args.length]=form.elements[i].name+"="+value;
		}
	}

	args[args.length]="formular="+formID;
	args[args.length]="formular-type=old";
	
	sendRequestParams ("setForm",args);	
}

function ajax_getFormIcon(idPrefix) {
	var args = new Array();

	args[args.length]="formular="+idPrefix+"_form";
	args[args.length]="icon="+idPrefix+"_set";
	sendRequestParams ("getFormIcon",args);	
}

function loadForm (formID, maske) {
// alert ("loadForm (formID="+formID+", maske="+maske+")");

	var args = new Array();

	args[args.length]="formular="+formID;
	sendRequestParams ("loadForm", args);	
}

function ajax_openListboxPopup (listboxID, maske) {
	var args = new Array();
	
	var ele = document.getElementById(listboxID);
	var value = "";
	if (ele.selectedIndex && (ele.selectedIndex > 0)) {
		value = ele.options[ele.selectedIndex].value;
	}
	var xPos = "xPos="+pb.e.x;
	var yPos = "yPos="+pb.e.y;


	args[args.length]="listboxID="+listboxID;
	args[args.length]="-listboxValue="+value;
	args[args.length]="maske="+maske;
	args[args.length]=xPos;
	args[args.length]=yPos;

// alert ("ajax_openListboxPopup (listboxID="+listboxID+", maske="+maske+")
// value = "+value);
	sendRequestParams ("showPopUp", args);
	
	return (false);
}

function ajax_sendFilter (form, popupMaske, executeFunction) {
	var s;
	var e;
	var args;

	if ( __session__ != '0' ) {
		e = new Array();
		args = new Array();
		for(var i=0; i < form.elements.length; i ++ ) {
			if ( /* form.elements[i].type!='submit' && */ form.elements[i].type != 'hidden' && !(form.elements[i].disabled == 'disabled' || form.elements[i].disabled )) {
				args[args.length]=form.elements[i].name+"="+form.elements[i].value;
			}
		}
		args[args.length]="formular="+form.id;
		args[args.length]="popupMaske="+popupMaske;
		if(executeFunction) {
			args[args.length] = "executeFunction="+executeFunction;
		}
		
		sendRequestParams ("filterHandler",args);	
	}
	return false;
}

function ajax_setToolbarState (toolbarFixed) {
	var args = new Array();

	args[args.length]="toolbarFixed="+toolbarFixed;
	sendRequestParams ("setToolbarState", args);
	
	return (false);
}


function ajax_selectStaffLeader(staffListbox, bossField) {
	var e;
	e = document.getElementById(staffListbox);
	if ( e ){
		var args = new Array();
	
		args[args.length]="staffid="+e.value;
		args[args.length]="bossField="+bossField;
		sendRequestParams ("SelectStaffLeader", args);
	}
	return false;
}

function ajax_showEmailPopupInTableVisualizer (id, postHandlerClassName,subject) {
		var args = new Array();

		args[args.length]="action=show";
		var xPos = "xPos="+pb.e.x;
		var yPos = "yPos="+pb.e.y;

		args[args.length]=xPos;
		args[args.length]=yPos;

		var staffList="staffids="+id;
		args[args.length]=staffList;
		if ( subject) {
			args[args.length]="subject="+subject;
		}
		args[args.length]="-postHandlerClassName="+postHandlerClassName;
		sendRequestParams ("showEmailPopup", args);
		return false;
}


function ajax_showEmailPopup (formID, postHandlerClassName) {
	var ele = document.getElementById(formID);
	if ( ele ) {
		
		var args = new Array();

		args[args.length]="action=show";
		var xPos = "xPos="+pb.e.x;
		var yPos = "yPos="+pb.e.y;

		args[args.length]=xPos;
		args[args.length]=yPos;

		var staffList="staffids=";
		var first = true;
// var form = ele.form;
		var form = ele;
		for(var i=0; i < form.length;++i) {
			if (form.elements[i].type == "checkbox") {
				var e = form.elements[i];
				if (e.checked) {
					if (e.id == 'alle') {
						continue;
					}
					if (!first) {
						staffList += "@";
					}
					staffList += e.value;
					first = false;
				}
			}
		}

		args[args.length]=staffList;
		args[args.length]="-postHandlerClassName="+postHandlerClassName;
		sendRequestParams ("showEmailPopup", args);
	}
// alert(action);
	return (false);
}

function ajax_sendEmail (ele, postHandlerClassName) {
	if ( ele ) {
		var args = new Array();

		args[args.length]="action=send";
		args[args.length]="subject="+document.getElementsByName('KT_subject')[0].value;
		args[args.length]="message="+document.getElementsByName('KA_message')[0].value;
		args[args.length]="staffids="+document.getElementsByName('KT_staffids')[0].value;
		if (null != postHandlerClassName)
			args[args.length]="-postHandlerClassName="+postHandlerClassName;

		sendRequestParams ("showEmailPopup", args);
	}

// alert ("sendEmail");
// pb.elements[maske_name+'_email']._close ();
	
	return (false);
}

function ajax_fillStaffGroupEmail (staffFieldID, emailFieldID) {
	var args = new Array();
	args[args.length]="staffField="+staffFieldID;
	args[args.length]="staffID="+document.getElementById(staffFieldID).value;
	args[args.length]="emailField="+emailFieldID;
	args[args.length]="email="+document.getElementById(emailFieldID).value;
	
	sendRequestParams ("fillStaffGroupEmail", args);
}

function ajax_planCalculator (workFieldID, wageFieldID, costFieldID) {

	var args = new Array();
// args[args.length]="workFieldID="+workFieldID;
	args[args.length]="workValue="+document.getElementById(workFieldID).value;
// args[args.length]="wageFieldID="+wageFieldID;
	args[args.length]="wageValue="+document.getElementById(wageFieldID).value;
	args[args.length]="costFieldID="+costFieldID;
	
	sendRequestParams ("planCalculator", args);
	
	return;
}

function ajax_serviceSetCopyCB (fieldID) {
	var args = new Array();
	
	args[args.length]="fieldID="+fieldID;
	args[args.length]="value="+document.getElementById(fieldID).value;

	sendRequestParams ("serviceSetCopyCB", args);
	
	return;
}


function ajax_serviceSetCopyProperties (fieldName) {
	var args = new Array();
	
	// alert("fieldName="+fieldName);
	args[args.length]="fieldName="+fieldName;
	var value = document.getElementById(fieldName);
	if (value) {
		args[args.length]="value="+value.value;
		// alert("value.value="+value.value);
	}
	sendRequestParams ("serviceSetCopyProperties", args);
	
	return;
}

function ajax_proposalCalculator (fieldID) {
	var args = new Array();
	args[args.length]="fieldID="+fieldID;
	args[args.length]="value="+document.getElementById(fieldID).value;

	sendRequestParams ("proposalCalculator", args);
	
	return;
}

function ajax_setProposalDate (fieldID) {
	var args = new Array();
	args[args.length]="value="+document.getElementById(fieldID).value;

	sendRequestParams ("setProposalDate", args);
	
	return;
}

function ajax_setProposalPercent (fieldID) {
	var args = new Array();
	args[args.length]="value="+document.getElementById(fieldID).value;

	sendRequestParams ("setProposalPercent", args);
	
	return;
}

function ajax_showQuoteValues (quoteFieldID, dateFieldID, amountFieldID) {

	var args = new Array();
	args[args.length]="dateFieldID="+dateFieldID;
	args[args.length]="amountFieldID="+amountFieldID;
	args[args.length]="quoteID="+document.getElementById(quoteFieldID).value;
	
	sendRequestParams ("showQuoteValues", args);
	
	return;
}

function ajax_saveQuote (quoteID) {

	var args = new Array();
	args[args.length]="quoteID="+quoteID;
	
	sendRequestParams ("saveQuote", args);
	
	return;
}

function ajax_plannerGuessedPlan(field) {
	sendRequestParams("plannerGuessedPlan", ["name="  + field.id, "value=" + field.value, "checked=" + field.checked]);
}

function ajax_plannerPlanGuessed(field) {
	sendRequestParams("plannerPlanGuessed", ["name="  + field.id, "value=" + field.value]);
}

function ajax_ticketNewChange(field) {
	sendRequestParams("ticketNewChange", ["name="  + field.id, "value=" + field.value]);
}

function ajax_ticketSlaChange(slaID, typeID) {
	var sla = document.getElementById(slaID);
	var type = document.getElementById(typeID);
	sendRequestParams("ticketNewChange", ["name="  + slaID, "value=" + sla.value, "type=" + type.value]);
}

function ajax_ticketPartChange(field) {
	if (field) {
		sendRequestParams("ticketPartChange", ["name="  + field.id, "value=" + ( field.type == 'checkbox' ? field.checked : field.value )]);
	}
}

function ajax_ticketTaskCopy(field) {
	sendRequestParams("ticketTaskCopy", ["name="  + field.id, "value=" + field.value]);
}

function ajax_ticketCommentPopup() {
	sendRequestParams("ticketCommentPopup", [ "action=show" , "xPos="+pb.e.x, "yPos="+pb.e.y ]);
	return (false);
}

function ajax_ticketCommentStore(e) {
	var form = e.form;
	var args = new Array();
	for(var i=0; i < form.elements.length; i ++ ) {
		var a = form.elements[i];
		if ( a.type!='submit' && a.type != 'hidden' && !(a.disabled == 'disabled' || a.disabled )) {
			args[args.length]=a.name+"="+a.value;
		}
	}
	sendRequestParams("ticketCommentStore", args);
}

function ajax_ticketSearch(field) {
	var value;
	if (field.type == 'select-multiple') {
		var o = field.options;
		var l = o.length;
		value ='';
		for(var i=0; i<l; i++) {
			if (o[i].selected) {
				value = value + o[i].value + ",";
			}
		}
	} else {
		value = field.value;
	}
	sendRequestParams("ticketSearch", ["name="  + field.id, "value=" + value, "checked=" + field.checked]);
}

function ajax_PlannerGanttHint(id, elementid) {
	sendRequestParams("plannerGanttHint",[ "id="+id, "element="+elementid ]);
	return false;
}

function ajax_PlannerNetworkHint(id, elementid) {
	sendRequestParams("plannerNetworkHint",[ "id="+id, "element="+elementid ]);
	return false;
}

function ajax_AbsenceOverviewHint(id, elementid) {
	sendRequestParams("absenceOverviewHint",[ "id="+id, "element="+elementid ]);
	return false;
}


function ajax_investmentReport(field) {
	if (field) {
		var value;
		if (field.type == 'select-multiple') {
			var o = field.options;
			var l = o.length;
			value ='';
			for(var i=0; i<l; i++) {
				if (o[i].selected) {
					value = value + o[i].value + ",";
				}
			}
		} else if (field.type == 'checkbox') {
			value = field.checked;
		} else {
			value = field.value;
		}
		
		var id = field.id;
		if (!id) {
			id = field.name;
		}
		
		sendRequestParams("investmentReport", ["name="  + id, "value=" + value]);
	}
}

function ajax_toogleTab(maskName, tabName, tabID) {
	ajax_toogleTabInternal(maskName,tabName,tabID);
	ShowWaitLogoOnUnload();
}

function ajax_toogleTabInternal(maskName, tabName, tabID) {
	var args = new Array();
	args[args.length]="maskname="+maskName;
	args[args.length]="tabname="+tabName;
	args[args.length]="tabid="+tabID;
	sendSynchronRequest ("SelectTabHandler", args);
	return true;
}

function ajax_showGuessCalculator (guessFieldID, unit, taskID) {
	var args = new Array();

	var ele = document.getElementById(guessFieldID);
	if (ele) {
		args[args.length]="guessFieldID="+guessFieldID;
		args[args.length]="guessValue="+ele.value;
	}
	args[args.length]="action=show";
	args[args.length]="-taskID="+taskID;
	args[args.length]="unit="+unit;
	args[args.length]="xPos="+pb.e.x;
	args[args.length]="yPos="+pb.e.y;
	
	try {
		var clickXY = getClickXY(ele.id);
		
		if(clickXY.length > 1) {
			args[args.length]= "xPosClick="+clickXY[0];
			args[args.length]= "yPosClick="+clickXY[1];
		}
	} catch (e) {
		alert(e);
	}

	sendRequestParams ("showGuessCalculatorPopup", args);
}

function ajax_showGuessCalculatorGui (ressourceID, guessFieldName, unit) {
	var args = new Array();
	
	args[args.length]="ressourceID="+ressourceID;
	args[args.length]="guessFieldName="+guessFieldName;
	args[args.length]="action=show";
	args[args.length]="-taskID=";
	args[args.length]="unit="+unit;
	args[args.length]="xPos="+pb.e.x;
	args[args.length]="yPos="+pb.e.y;
	
	sendRequestParams ("showGuessCalculatorPopup", args);
}

function ajax_calcGuess (istID, remainID, guessID) {
	var eleIst = document.getElementById(istID);
	var eleRemain = document.getElementById(remainID);
	var eleGuess = document.getElementById(guessID);
	
	if (eleIst && eleRemain && eleGuess) {
		var ist = eleIst.value;
		var istEn = parseFloat(toEn (ist));
		var remain = eleRemain.value;
		var remainEn = parseFloat(toEn (remain));
		if (remainEn < 0) {
			eleRemain.value = "0"
			remainEn = 0;
		}
		var guessEn = istEn + remainEn;
		var guess = toLocal (guessEn);
// alert ("ist="+ist+", istEn="+istEn+", remain="+remain+",
// remainEn="+remainEn+", newGuess="+guessEn+", newGuessLocal="+guess);
		eleGuess.value = guess;
	}
}

function ajax_setGuess(portletID, guessFieldID, remainFieldID) {
	var eleGuess = document.getElementById(guessFieldID);
	var eleRemain = document.getElementById(remainFieldID);
	
// alert("guessFieldID="+guessFieldID+", remainFieldID="+remainFieldID+",
// eleGuess="+eleGuess+", eleRemain="+eleRemain)
	if (eleGuess && eleRemain) {
		eleGuess.value = eleRemain.value;
		if (eleGuess.onchange) {
			eleGuess.onchange();
		}
	}
	pb.elements[portletID]._close ();
}

function ajax_FillResourceReplaceMask(id,mode,isNewRessource,taskID) {
	var eAllTask;
	var args = new Array();
	var listbox;
	var b;
	var oldValue;
	
	oldValue = false; 
	eAllTask= document.getElementById("alltask");
	if ( eAllTask ) {
		if ("alltask" == taskID ) {
			if ( !eAllTask.checked ) {
				taskID ="cleartask"; 
				oldValue = false;
			} else {
				oldValue = true;
			}
		} else {
			oldValue = eAllTask.checked ;
		}
	}
	
	lisbox = document.getElementById(id);
	args[args.length]="ressource="+lisbox.value;
	args[args.length]="isnewressource="+isNewRessource;
	args[args.length]="mode="+mode;
	args[args.length]="task="+taskID;
	sendSynchronRequest ("FillResourceReplaceMask", args);

	eAllTask= document.getElementById("alltask");
	if ( eAllTask ) {
		eAllTask.checked=oldValue;
	}
}

function ajax_GuiTableChanged(ele) {
	var args = new Array();

	args[args.length]="id="+ele.id;
	args[args.length]="name="+ele.name;
	if ((ele.nodeName == "INPUT") && ("checkbox" == ele.getAttribute ("type"))) {
		args[args.length]="value="+ele.checked;
	} else if (ele.nodeName == "SELECT") {
		args[args.length]="selectedValue="+ele.value;
	} else {
		args[args.length]="value="+ele.value;
	}
	args[args.length]="action=valueChanged";
	
	sendRequestParams ("guiTableChanged", args);
}


function ajax_guiShowTree (id, doShow) {
	var args = new Array();
// var doShow;
	
	ele = document.getElementById("ti"+id);
	if (ele) {
// alert (ele.onclick+"\n"+"ajax_guiShowTree ('"+id+"', "+(doShow ?
// "false":"true")+");");
		doShow = ele.getAttribute("isOpen");
		if ("true" == doShow) {
			ele.setAttribute("isOpen", "false");
		} else {
			ele.setAttribute("isOpen", "true");
		}
	}
	args[args.length]="id="+id;
	args[args.length]="imgId=ti"+id;
	args[args.length]="showSubElements="+doShow;
	args[args.length]="action=toggleTree";
	
	
	sendRequestParams ("guiTableChanged", args);
}

function ajax_guiSetZoom (id) {
	var args = new Array();

	args[args.length]="id="+id;
	args[args.length]="action=setZoom";
	
	
	sendRequestParams ("guiTableChanged", args);
}

function ajax_guiSetTime (ele, mode) {
	var args = new Array();

	args[args.length]="id="+ele.id;
	args[args.length]="value="+ele.value;
	args[args.length]="mode="+mode;
	args[args.length]="action=setTime";
	
	sendRequestParams ("guiTableChanged", args);
}

function ajax_ShowReservationTimes(id) {
	var args;
	var listbox;
	
	lisbox = document.getElementById(id);
	args = new Array();
	args[args.length]="reservation_times="+lisbox.value;
	sendRequestParams ("ShowReservationTimes", args);
}

function ajax_SetMaskReadonly(id) {
	var args;
	var e;
	var listbox;
	listbox = document.getElementById(id);
	if ( listbox ) {
		if ( !( listbox.readOnly ||  listbox.disabled=='disabled' ) ) {
			args = new Array();
			args[args.length]="field="+id;
			sendSynchronRequest ("SetMaskReadonly", args);
		}
	}
}
		
function ajax_deleteWorktime (worktimeID) {
	sendRequestParams("deleteWorktime", ["worktimeID="  + worktimeID]);
}	
	
function ajax_saveWorktime (button) {
	var args;
	args = new Array();
	args[args.length]="action="+button;

	var ele = document.getElementById("icc");
	if (ele) {
		args[args.length]="iccID="+ele.value;
	}

	ele = document.getElementById("activity");
	if (ele) {
		args[args.length]="activityID="+ele.value;
	}

	ele = document.getElementById("bemerkung");
	if (ele) {
		args[args.length]="bemerkung="+ele.value;
	}

	ele = document.getElementById("accountable");
	if (ele) {
		args[args.length]="accountable="+ele.checked;
	}

	ele = document.getElementById("guess");
	if (ele) {
		args[args.length]="guess="+ele.value;
	}

	sendRequestParams ("saveWorktime", args);
}

// Projekt-Statusbericht bearbeiten.
// Parameter reportId: 1 oder 2 (kennzeichnet den entsprechenden Statusbericht)
function ajax_editStateReport (reportId) {
	var args = new Array();

	args[args.length]="action=show";
	var xPos = "xPos="+pb.e.x;
	var yPos = "yPos="+pb.e.y;

	args[args.length]=xPos;
	args[args.length]=yPos;
	args[args.length]="reportId="+reportId;
	// alert("ajax_editStateReport reportId="+reportId);
	
	sendRequestParams ("editStateReport", args);

	return (false);
}
function ajax_sendStateReport(ele) {
	if ( ele ) {
		var args = new Array();

		args[args.length]="action=send";
		var xPos = "xPos="+pb.e.x;
		var yPos = "yPos="+pb.e.y;
	
		args[args.length]=xPos;
		args[args.length]=yPos;
		args[args.length]="submit="+ele.name;
		var form = ele.form;
		_addFormValues (args, ele.form);

		args[args.length]="formular="+form.id;

		sendRequestParams ("editStateReport", args);
	}

	return (false);
}








function ajax_showTicketEmailPopup (formID) {
	var args = new Array();

	args[args.length]="action=show";
	var xPos = "xPos="+pb.e.x;
	var yPos = "yPos="+pb.e.y;

	args[args.length]=xPos;
	args[args.length]=yPos;

	sendRequestParams ("showTicketEmailPopup", args);

	return (false);
}
/** Popup für die benutzerbezogene Tabellenkonfiguration */
function ajax_tableConfigPopup(tableName,key) {
	var args = new Array();

	args[args.length]="action=show";
	args[args.length]="tableName="+tableName;
	var xPos = "xPos="+pb.e.x;
	var yPos = "yPos="+pb.e.y;

	args[args.length]=xPos;
	args[args.length]=yPos;
	if ( key ) {
		args[args.length]="key="+key;
	}

	// alert("ajax_tableConfigPopup tableName="+tableName);
	sendRequestParams ("tableConfigPopup", args);

	return (false);
}

/**
 * Kommunikation innerhalb der beiden Visualizer der benutzerbezogenen
 * Tabellenkonfiguration
 */
function ajax_tableConfig(action,pk,fieldName) {
	var args = new Array();

	var xPos = "xPos="+pb.e.x;
	var yPos = "yPos="+pb.e.y;
	args[args.length]="action="+action;
	args[args.length]="selected_pk="+pk;
	args[args.length]=xPos;
	args[args.length]=yPos;
	if ( fieldName ) {
		var e =document.getElementById(fieldName); 
		if (  e ) {
			args[args.length]="field_name="+e.value;
		}
	}

	// alert("ajax_tableConfig="+action+" pk="+pk+" fieldName="+fieldName);
	sendRequestParams ("tableConfigPopup", args);
	return (false);	
}

/** Close-hander für das Popup Bug 13311 */
function ajax_tableConfigClose() {
	var args = new Array();

	var xPos = "xPos="+pb.e.x;
	var yPos = "yPos="+pb.e.y;
	args[args.length]="action=closePortlet";
	args[args.length]=xPos;
	args[args.length]=yPos;

	sendRequestParams ("tableConfigPopup", args);
	return (false);	
}

/** Auf eine andere Benutzeransicht wechseln */
function ajax_chooseConfigView (id,key) {
	var args = new Array();
	args[args.length]="table_id="+id;
	if ( key ) {
		args[args.length]="key="+key;
	}
	sendRequestParams ("chooseConfigView",args );
}


function ajax_sendTicketEmail(ele) {
	if ( ele ) {
		var args = new Array();

		args[args.length]="action=send";
		args[args.length]="submit="+ele.name;
		var form = ele.form;
		for(var i=0; i < form.elements.length; i ++ ) {
			var formEle = form.elements[i];
			if ( formEle.type!='submit' && formEle.type != 'hidden' && !(formEle.disabled == 'disabled' || formEle.disabled )) {
				if (formEle.type == 'checkbox') {
					args[args.length]=formEle.id+"="+(formEle.checked?"1":"0");
				} else { 
					args[args.length]=formEle.id+"="+formEle.value;
				}
			}
		}
		args[args.length]="formular="+form.id;

		sendRequestParams ("showTicketEmailPopup", args);
	}

	return (false);
}

function ajax_showWeek (tdID, kw, year) {
		var args = new Array();

		args[args.length]="mode=week";
		args[args.length]="kw="+kw;
		args[args.length]="year="+year;
		
		var ele = document.getElementById("alltimes");
		if (ele) {
			args[args.length]="-alltimes="+ele.checked;
		}

		var ele = document.getElementById("alldays");
		if (ele) {
			args[args.length]="-alldays="+ele.checked;
		}

		sendRequestParams ("showCalendar", args);
		
		var tdEles = document.getElementById("month").getElementsByTagName("TD");
		for (var i = 0; i < tdEles.length; i++) {
			var tdEle = tdEles[i];
			if (tdEle.id.substring (0,3) == 'cw_') {
				tdEle.className = "cm_day_label cm_kw_label";
			}
		}
		document.getElementById(tdID).className = "cm_day_label cm_kw_label cm_curr_kw";
}

function ajax_showMonth (day, month, year) {
		var args = new Array();

		args[args.length]="mode=month";
		args[args.length]="day="+day;
		args[args.length]="month="+month;
		args[args.length]="year="+year;
		
		var ele = document.getElementById("alltimes");
		if (ele) {
			args[args.length]="-alltimes="+ele.checked;
		}

		var ele = document.getElementById("alldays");
		if (ele) {
			args[args.length]="-alldays="+ele.checked;
		}
		
		sendRequestParams ("showCalendar", args);
}

function ajax_showMonthWt (day, month, year) {
		var args = new Array();

		args[args.length]="mode=month-wt";
		args[args.length]="day="+day;
		args[args.length]="month="+month;
		args[args.length]="year="+year;
		
		sendRequestParams ("showCalendar", args);
}

function ajax_showMonthVoucher (day, month, year) {
		var args = new Array();

		args[args.length]="mode=month-voucher";
		args[args.length]="day="+day;
		args[args.length]="month="+month;
		args[args.length]="year="+year;
		
		sendRequestParams ("showCalendar", args);
}

function ajax_showMonthAbsence (day, month, year) {
	var args = new Array();
	
	args[args.length]="mode=month-absence";
	args[args.length]="day="+day;
	args[args.length]="month="+month;
	args[args.length]="year="+year;
	
	sendRequestParams ("showCalendar", args);
}

function ajax_showWeekWt (date, kw, year) {
		var args = new Array();

		args[args.length]="mode=week-wt";
		args[args.length]="date="+date;
		args[args.length]="kw="+kw;
		args[args.length]="year="+year;
		
		sendRequestParams ("showCalendar", args);
}

function ajax_stdVoucherExpenseChange(field) {
	sendSynchronRequest("voucherExpenseChange", ["name="  + field.id, "value=" + field.value]);
}

function ajax_showVoucherCalculator (prefix, date, voucherTypeID, voucherGrossAmountID, voucherNetAmountID, voucherInvoiceAmount, _distanceInKm, _milageAllowance, _fulltime, _timeFrom, _timeTo, _expenseID, voucherVat, voucherCurrency) {
	formSent = false;
	if (!ajax_validation(document.getElementById (prefix+date).form, true)) return;

	var args = new Array();

	var ele = document.getElementById(prefix+date);
	if (ele) {
		args[args.length]="dateID="+prefix+date;
		args[args.length]="dateValue="+ele.value;
	}

	ele = document.getElementById(prefix+voucherTypeID);
	if (ele) {
		args[args.length]="voucherTypeID="+prefix+voucherTypeID;
		args[args.length]="voucherTypeValue="+ele.value;
	}

	ele = document.getElementById(prefix+voucherGrossAmountID);
	if (ele) {
		args[args.length]="voucherGrossAmountID="+prefix+voucherGrossAmountID;
		args[args.length]="voucherGrossAmountValue="+ele.value;
	}

	ele = document.getElementById(prefix+voucherNetAmountID);
	if (ele) {
		args[args.length]="voucherNetAmountID="+prefix+voucherNetAmountID;
		args[args.length]="voucherNetAmountValue="+ele.value;
	}

	ele = document.getElementById(prefix+voucherInvoiceAmount);
	if (ele) {
		args[args.length]="voucherInvoiceAmountID="+prefix+voucherInvoiceAmount;
		args[args.length]="voucherInvoiceAmountValue="+ele.value;
	}

	ele = document.getElementById(prefix+_distanceInKm);
	if (ele) {
		args[args.length]="_distanceInKmID="+prefix+_distanceInKm;
		args[args.length]="_distanceInKmValue="+ele.value;
	}

	ele = document.getElementById(prefix+_milageAllowance);
	if (ele) {
		args[args.length]="_milageAllowanceID="+prefix+_milageAllowance;
		args[args.length]="_milageAllowanceValue="+ele.value;
	}

	ele = document.getElementById(prefix+_fulltime);
	if (ele) {
		args[args.length]="_fulltimeID="+prefix+_fulltime;
		args[args.length]="_fulltimeValue="+ele.value;
	}

	ele = document.getElementById(prefix+_timeFrom);
	if (ele) {
		args[args.length]="_timeFromID="+prefix+_timeFrom;
		args[args.length]="_timeFromValue="+ele.value;
	}

	ele = document.getElementById(prefix+_timeTo);
	if (ele) {
		args[args.length]="_timeToID="+prefix+_timeTo;
		args[args.length]="_timeToValue="+ele.value;
	}

	ele = document.getElementById(prefix+_expenseID);
	if (ele) {
		args[args.length]="_expenseIDID="+prefix+_expenseID;
		args[args.length]="_expenseIDValue="+ele.value;
	}

	ele = document.getElementById(prefix+voucherVat);
	if (ele) {
		args[args.length]="voucherVatID="+prefix+voucherVat;
		args[args.length]="voucherVatValue="+ele.value;
	}

	ele = document.getElementById(prefix+voucherCurrency);
	if (ele) {
		args[args.length]="voucherCurrencyID="+prefix+voucherCurrency;
		args[args.length]="voucherCurrencyValue="+ele.value;
	}

	args[args.length]="-prefix="+prefix;
	args[args.length]="action=show";
	args[args.length]="xPos="+pb.e.x;
	args[args.length]="yPos="+pb.e.y;

	sendRequestParams ("showVoucherCalculatorPopup", args);
}

function ajax_searchVoucherTasks (projectFieldID, taskFieldId) {
	var ele = document.getElementById(projectFieldID);
	if (ele) {
		var projectId = "-projectId="+ele.value;
	}
	var taskEle = document.getElementById (taskFieldId);
	var selectedTask = "-taskId="+taskEle.value;
	var sOwnTasksOnly = "ownTasksOnly=true";
// var sAllTasks = "allTasks="+getBoolean (allTasks);;
// var sAllowParent = "allowParent="+getBoolean(allowParent);
// var sAllowMandatory = "allowMandatory=true";
// var sEnableParent = "enableParent=false";

	sendRequest ("searchTasks", "id="+taskFieldId, projectId, selectedTask, sOwnTasksOnly, "leerzeile");
}

function ajax_deleteVoucher (voucherPK) {
	sendRequestParams("deleteVoucher", ["action=delete", "voucherID="  + voucherPK]);
}

function ajax_editVoucher (voucherPK, mode) {
	var args = new Array();

	args[args.length]="action=show";
	args[args.length]="-pk="+voucherPK;
	args[args.length]="xPos="+pb.e.x;
	args[args.length]="yPos="+pb.e.y;
	if (mode) {
		args[args.length]="mode="+mode;
	}

	sendRequestParams("editVoucherPopup", args);
}

function ajax_VoucherState (stateName) {
	var args = new Array();

	args[args.length]="action=setState";
	args[args.length]="stateName="+stateName;

	sendRequestParams("setVoucherState", args);
}

function ajax_VoucherStateWithEmail (stateName, messageID, popupID) {
	var args = new Array();

	args[args.length]="action=setState";
	args[args.length]="stateName="+stateName;
	args[args.length]="email=true";
	
	var ele = document.getElementById(messageID);
	args[args.length]="-message="+ele.value;
	
		// Popup schliessen
	pb.elements[popupID]._close ();
	

	sendRequestParams("setVoucherState", args);
}

function ajax_VoucherPayOff (doPayOff) {
	var args = new Array();

	if (doPayOff) {
		args[args.length]="action=payOff";
	} else {
		args[args.length]="action=undoPayOff";
	}

	sendRequestParams("voucherPayOff", args);
}

function ajax_toggleVoucherPayedOff (ele) {
	sendRequestParams("voucherPayOff", ["action=togglePayOff", "name="+ele.name, "checked="+ele.checked]);
}

function ajax_VoucherAssign (voucherCollectiveID, assignTask) {
	var args = new Array();

	args[args.length]="voucherCollectiveID="+voucherCollectiveID;
	if (assignTask) {
		args[args.length]="action=assignTask";
		var ele = document.getElementById(assignTask);
		if (ele) {
			args[args.length]="assignTask="+ele.value;
		}
	} else {
		args[args.length]="action=assign";
	}

	sendRequestParams("setVoucherAssign", args);
}

function ajax_saveVoucher (prefix, buttonEle, action, descEleID) {
	var args = new Array();

	if (action == "toggleVoucherType" && descEleID) {
		var descEle = document.getElementById(descEleID);
		if (descEle.value.length == 0) {
			var typeEle = buttonEle;

			value = "";
			if ( typeEle.selectedIndex >= 0 ) {
				index =typeEle.selectedIndex; 
				value = typeEle.options[index].firstChild.nodeValue;
			}
		
			descEle.value = value;
		}
	}
	
	args[args.length]="action="+action;
	args[args.length]="-prefix="+prefix;
	_addFormValues (args, buttonEle.form);
	
	// auch wenn dieses Feld disabled ist, wollen wir den Wert übergeben
	var voucherCurrency = prefix+"voucherCurrency";
	var ele = document.getElementById(voucherCurrency);
// if (ele.disabled == 'disabled' || ele.disabled) {
		if (ele) {
			args[args.length]="voucherCurrency="+ele.value;
		}
// }

	sendRequestParams("editVoucherPopup", args);
}

function _addFormValues (args, form) {
	for(var i=0; i < form.elements.length; i ++ ) {
		var formEle = form.elements[i];
		if (formEle.id && formEle.id.length > 0) {
			if ( formEle.type!='submit'  && !(formEle.disabled == 'disabled' || formEle.disabled )) {
				if (formEle.type == 'checkbox') {
					args[args.length]=formEle.id+"="+(formEle.checked?"1":"0");
				} else if (formEle.type == "select-multiple") {
					var value = "";
					var opts = formEle.options;
					for (var o = 0; o < opts.length; o++) {
						var opt = opts[o];
			
						if (opt.selected) {
							if (value.length > 0) {
								value += ",";
							}
							value += opt.value;
						}
					}
					args[args.length]=  formEle.id+"="+value;
				} else { 
					if (formEle.value.length > 0) {
						args[args.length]=formEle.id+"="+formEle.value;
					}
				}
			}
		}
	}
}

function ajax_saveVoucherCalcValues (buttonEle, portletId, action, prefix) {
	
	// über action entscheiden, welche Felder kopiert werden müssen
	if ("voucherCalcVat" == action) {
		document.getElementById(prefix+"voucherGrossAmount").value = document.getElementById(prefix+"voucherCalcGrossAmount").value;
		document.getElementById(prefix+"voucherNetAmount").value 	= document.getElementById(prefix+"voucherCalcNetAmount").value;
		document.getElementById(prefix+"voucherVat").value 		= document.getElementById(prefix+"voucherCalcTaxAmount").value;

		/*
		 * Währungsauswahl fliegt aus Taschenrechner raus (neue fachliche
		 * Forderung) 24.09.2008 dparnitzke
		 */
		// document.getElementById("voucherCurrency").value =
		// document.getElementById("voucherCalcCurrency").value;
	}
	if ("voucherCalcMilageAllowance" == action) {
		// Betrag kommt in Brutto & Netto
		document.getElementById(prefix+"voucherGrossAmount").value = document.getElementById(prefix+"voucherCalcMilageSumAmount").value;
		document.getElementById(prefix+"voucherNetAmount").value 	= document.getElementById(prefix+"voucherCalcMilageSumAmount").value;
		// KM und Pauschale kommt in die hidden Felder
		document.getElementById(prefix+"_distanceInKm").value 		= document.getElementById(prefix+"voucherCalcDistanceInKm").value;
		document.getElementById(prefix+"_milageAllowance").value 	= document.getElementById(prefix+"voucherCalcMilageAllowance").value;

		/*
		 * Währungsauswahl fliegt aus Taschenrechner raus (neue fachliche
		 * Forderung) 24.09.2008 dparnitzke
		 */
		// document.getElementById("voucherCurrency").value =
		// document.getElementById("voucherCalcCurrency").value;
	}
	if ("voucherCalcExpense" == action) {
		var args = new Array();
		var date = prefix+"date";
		var ele = document.getElementById(date);
		if (ele) {
			args[args.length]="dateID="+date;
			args[args.length]="dateValue="+ele.value;
		}

		var voucherCalcFullDay = prefix+"voucherCalcFullDay";
		ele = document.getElementById(voucherCalcFullDay);
		if (ele) {
			args[args.length]="voucherCalcFullDayID="+voucherCalcFullDay;
			if (ele.checked) {
				args[args.length]="voucherCalcFullDayValue=1";
			} else {
				args[args.length]="voucherCalcFullDayValue=0";
			}
		}

		var voucherCalcStartTime = prefix+"voucherCalcStartTime";
		ele = document.getElementById(voucherCalcStartTime);
		if (ele) {
			args[args.length]="voucherCalcStartTimeID="+voucherCalcStartTime;
			args[args.length]="voucherCalcStartTimeValue="+ele.value;
		}

		var voucherCalcEndTime = prefix+"voucherCalcEndTime";
		ele = document.getElementById(voucherCalcEndTime);
		if (ele) {
			args[args.length]="voucherCalcEndTimeID="+voucherCalcEndTime;
			args[args.length]="voucherCalcEndTimeValue="+ele.value;
		}

		var voucherCalcExpense = prefix+"voucherCalcExpense";
		ele = document.getElementById(voucherCalcExpense);
		if (ele) {
			args[args.length]="voucherCalcExpenseID="+voucherCalcExpense;
			args[args.length]="voucherCalcExpenseValue="+ele.value;
		}
		
		args[args.length]="action="+action;
		args[args.length]="-prefix="+prefix;
		sendSynchronRequest ("showVoucherCalculatorPopup", args);	
//		sendRequestParams ("showVoucherCalculatorPopup", args);	

	}
	
	// Popup schliessen
	pb.elements[portletId]._close ();
	
	// Net neu berechnen (macht auch facturierbar mit
	calcVoucherNet(prefix);
	
	// Focus auf Brutto setzen
	document.getElementById(prefix+'voucherGrossAmount').focus();
}

function ajax_toggleVoucherExpenseDestCountry(prefix, date, voucherCalcDestCountry) {
	if (!ajax_validation(document.getElementById (prefix+date).form, true)) return;
	
	var args = new Array();

	var ele = document.getElementById(prefix+date);
	if (ele) {
		args[args.length]="dateID="+prefix+date;
		args[args.length]="dateValue="+ele.value;
	}
	ele = document.getElementById(prefix+voucherCalcDestCountry);
	if (ele) {
		args[args.length]="voucherCalcDestCountryID="+prefix+voucherCalcDestCountry;
		args[args.length]="voucherCalcDestCountryValue="+ele.value;
	}
	args[args.length]="-prefix="+prefix;
	args[args.length]="action=toggleVoucherExpenseDestCountry";
	sendRequestParams ("showVoucherCalculatorPopup", args);	
}

function ajax_toggleVoucherExpenseFullDay(prefix, date, voucherCalcFullDay) {
	var args = new Array();

	var ele = document.getElementById(prefix+date);
	if (ele) {
		args[args.length]="dateID="+prefix+date;
		args[args.length]="dateValue="+ele.value;
	}
	ele = document.getElementById(prefix+voucherCalcFullDay);
	if (ele) {
		args[args.length]="voucherCalcFullDayID="+prefix+voucherCalcFullDay;
		if (ele.checked) {
			args[args.length]="voucherCalcFullDayValue=1";
		} else {
			args[args.length]="voucherCalcFullDayValue=0";
		}
	}
	args[args.length]="action=toggleVoucherExpenseFullDay";
	args[args.length]="-prefix="+prefix;
	sendRequestParams ("showVoucherCalculatorPopup", args);	
}

function ajax_toggleVoucherExpenseDuration(prefix, date, voucherCalcStartTime, voucherCalcEndTime) {
// if (!ajax_validation(document.getElementById
// (prefix+voucherCalcStartTime).form, true)) return;

	var args = new Array();

	var ele = document.getElementById(prefix+date);
	if (ele) {
		args[args.length]="dateID="+prefix+date;
		args[args.length]="dateValue="+ele.value;
	}
	
	ele = document.getElementById(prefix+voucherCalcStartTime);
	if (ele) {
		args[args.length]="voucherCalcStartTimeID="+prefix+voucherCalcStartTime;
		args[args.length]="voucherCalcStartTimeValue="+ele.value;
	}
	ele = document.getElementById(prefix+voucherCalcEndTime);
	if (ele) {
		args[args.length]="voucherCalcEndTimeID="+prefix+voucherCalcEndTime;
		args[args.length]="voucherCalcEndTimeValue="+ele.value;
	}
	args[args.length]="-prefix="+prefix;
	args[args.length]="action=toggleVoucherExpenseDuration";
	sendRequestParams ("showVoucherCalculatorPopup", args);	
}

function ajax_toggleVoucherExpenseSelectionList(prefix, voucherCalcExpense) {
	if (!ajax_validation(document.getElementById (prefix+voucherCalcExpense).form, true)) return;

	var args = new Array();

	var ele = document.getElementById(prefix+voucherCalcExpense);
	if (ele) {
		args[args.length]="voucherCalcExpenseID="+prefix+voucherCalcExpense;
		args[args.length]="voucherCalcExpenseValue="+ele.value;
	}
	args[args.length]="action=toggleVoucherExpenseListBox";
	args[args.length]="-prefix="+prefix;
	sendRequestParams ("showVoucherCalculatorPopup", args);	
}


function ajax_ReservationPlanInPlanValues(id) {
	return ajax_ReservationPlanInMessages(id,"true");
}

function ajax_ReservationPlanInReservation(id) {
	return ajax_ReservationPlanInMessages(id,"false");
}

function ajax_ReservationPlanInMessages(id, value) {
	var args = new Array();
	args[args.length]="id="+id;
	args[args.length]="name=KS_"+id;
	args[args.length]="selectedValue="+value;
	args[args.length]="action=valueChanged";
	sendRequestParams("reservationplan_toggle_plan_with_reservation",args);
	return false;
}

function ajax_saveFields (fieldID, newMask) {
	var args = new Array();

	var form;
	var ele = document.getElementById(fieldID);
	if (ele) {
		form = ele.form;
	}

	args[args.length]="__action=saveFields";
	args[args.length]="__newMask="+newMask;

	if (form) {
		for(var i=0; i < form.elements.length; i ++ ) {
			var formEle = form.elements[i];
			var name = formEle.name;
			if (!name || name.length == 0 || formEle.type == 'submit' || (name.indexOf("type_") == 0)) {
				continue;
			}
			if (formEle.type == 'checkbox') {
				args[args.length]=name+"="+(formEle.checked?"1":"0");
			} else { 
				if (formEle.value.length > 0) {
					args[args.length]=name+"="+formEle.value;
				}
			}
		}
	}

	sendRequestParams("saveFields", args);
}

function ajax_restoreFields () {
	var args = new Array();

	args[args.length]="__action=restoreFields";

	sendSynchronRequest("saveFields", args);
}

/** übetragen des Popups an die Struktur */
function ajax_editFacturaWorktimeFieldsPopUp (buttonEle) {
	if ( ajax_validation(buttonEle.form,true) ) {
		ajax_ShowFacturaWorktimeFieldsPopUp(buttonEle, "faktura_neu_kostenabrechnung_worktime_info_popup","stundenid",null,1);
		formSent = false;
	}
}

function ajax_editFacturaVoucherFieldsPopUp (buttonEle) {
	var pk;
	if ( ajax_validation(buttonEle.form,true) ) {
		pk = document.getElementById("voucherID");
		
		ajax_ShowFacturaWorktimeFieldsPopUp(buttonEle, "faktura_neu_kostenabrechnung_voucher_info_popup","voucherID",pk.value,2);
		formSent = false;
	}
}

function ajax_changeFacturaTicketWorktimeFieldsPopUp(fieldid) {
	var args;
	var e;
	args = new Array();
	args[args.length]="KT_costkind=1";
	args[args.length]="maske=faktura_neu_kostenabrechnung_ticket_worktime_info_popup";
	args[args.length]="action="+fieldid;
	args[args.length]="worktime_id="+document.getElementById("worktime_id").value;
	args[args.length]="gesamt="+document.getElementById("gesamt").value;

	e = document.getElementById("factura_role_hourwage");
	if ( e) {
		args[args.length]="factura_role_hourwage="+e.value;
	}
		
	sendRequestParams("editFacturaWorktimeFieldsPopUp", args);
	return false;
	
}

function ajax_changeFacturaWorktimeFieldsPopUp(fieldid) {
	var args;
	var e;
	args = new Array();
	args[args.length]="KT_costkind=1";
	args[args.length]="maske=faktura_neu_kostenabrechnung_worktime_info_popup";
	args[args.length]="action="+fieldid;
	args[args.length]="worktime_id="+document.getElementById("worktime_id").value;
	args[args.length]="role_id="+document.getElementById("std_role").value;
	args[args.length]="gesamt="+document.getElementById("gesamt").value;

	e = document.getElementById("factura_role_hourwage");
	if ( e) {
		args[args.length]="factura_role_hourwage="+e.value;
	}
		
	sendRequestParams("editFacturaWorktimeFieldsPopUp", args);
	return false;
}

/**
 * 
 */
function ajax_ShowFacturaWorktimeFieldsPopUp (buttonEle, action,mask, fieldName, pk,costType) {
	var b;
	var args = new Array();

	args[args.length]="xPos="+pb.e.x;
	args[args.length]="yPos="+pb.e.y;
	args[args.length]="maske="+mask;
	args[args.length]="KT_costkind="+costType;
	if ( pk ) {
		args[args.length]="KT_"+fieldName+"="+pk; 
	}
	
	if ( !action ) {
		action = "show";
	}

	args[args.length]="action="+action;
	if ( buttonEle ) {
		/** formfiller */
		_addFormValues (args, buttonEle.form);
	}

	sendRequestParams("editFacturaWorktimeFieldsPopUp", args);
}

/** 2. Gruppierungesebene für den Forecast filtern */
function ajax_ForecastSelectSecondLevelGroup(groupID) {
	var args = new Array();
	var index;
	var lbMaster;
	var value;

	lbMaster = document.getElementById('group_Filter');
	index = 0;
	if ( lbMaster.selectedIndex >= 0 ) {
		index =lbMaster.selectedIndex; 
	}
	value = lbMaster.options[index].value;
	args = new Array();
	args[args.length]="group="+value;
	
	sendRequestParams("ForecastSelectSecondLevelGroup", args);
}

function ajax_showDateCalendar (id) {
	sendRequestParams("dateCalendar", ["action=show", "id="+id, "value="+document.getElementById(id).value, "xPos="+pb.e.x, "yPos="+pb.e.y]);
}

function ajax_showDateCalendarMonth (id, day, month, year, showToday) {
		var args = new Array();

		args[args.length]="action=showMonth";
		args[args.length]="id="+id;
		args[args.length]="day="+day;
		args[args.length]="month="+month;
		args[args.length]="year="+year;
		args[args.length]="showToday="+showToday;
		
		sendRequestParams ("dateCalendar", args);
}

function ajax_hideDateCalendar (id) {
	sendRequestParams("dateCalendar", ["action=hide", "ID="  + id, "value="  + document.getElementById(id).value]);
}

function ajax_debugLog (message) {
	if (__systemType__ == 'test') {
		sendRequestParams("ajaxLogDebug", ["message="  + message]);
	}
}
function ajax_infoLog (message) {
	if (__systemType__ == 'test') {
		sendRequestParams("ajaxLogInfo", ["message="  + message]);
	}
}
function ajax_warnLog (message) {
	if (__systemType__ == 'test') {
		sendRequestParams("ajaxLogWarn", ["message="  + message]);
	}
}
function ajax_errorLog (message) {
	if (__systemType__ == 'test') {
		sendRequestParams("ajaxLogError", ["message="  + message]);
	}
}
function ajax_fatalLog (message) {
	if (__systemType__ == 'test') {
		sendRequestParams("ajaxLogFatal", ["message="  + message]);
	}
}

function ajax_showFacturaPortlets(id, sortColumn) {
	var args = new Array();
	args[args.length]= "portletId="+id;
	args[args.length]= "action=show";
	if ( sortColumn ) {
		args[args.length]= "column="+sortColumn;
	}

	sendRequestParams ("ShowFacturaPortlets", args);
}

function ajax_sortInvoiceFacturaPortlets(column) {
	ajax_showFacturaPortlets("factura_invoice", column);
}
function ajax_sortProposalFacturaPortlets(column) {
	ajax_showFacturaPortlets("factura_proposal", column);
}
function ajax_sortQuotesFacturaPortlets(column) {
	ajax_showFacturaPortlets("factura_quotes", column);
}

function ajax_ShowQuoteRemark(quoteID) {
	var args = new Array();
	args[args.length]= "portletId=factura_quote_remark";
	args[args.length]= "action=show";
	args[args.length]= "quoteID="+quoteID;
	args[args.length]= "xPos="+pb.e.x;
	args[args.length]= "yPos="+pb.e.y;

	sendRequestParams ("ShowFacturaPortlets", args);
}

function ajax_FacturaEditWorktimeCollective() {
	var args = new Array();
	args[args.length]= "portletId=factura_edit_coll_worktime";
	args[args.length]= "action=show";
	args[args.length]= "xPos="+pb.e.x;
	args[args.length]= "yPos="+pb.e.y;

	sendRequestParams ("ShowFacturaPortlets", args);
	return false;
}

function ajax_FacturaEditWorktimeRoundAmount() {
	var args = new Array();
	args[args.length]= "portletId=factura_edit_worktime_round_amount";
	args[args.length]= "action=show";
	args[args.length]= "xPos="+pb.e.x;
	args[args.length]= "yPos="+pb.e.y;

	sendRequestParams ("ShowFacturaPortlets", args);
	return false;
}

function ajax_FacturaEditWorktimeRoundAmountClose() {
	var args = new Array();
	args[args.length]= "portletId=factura_edit_worktime_round_amount";
	args[args.length]= "action=close";
	args[args.length]= "xPos="+pb.e.x;
	args[args.length]= "yPos="+pb.e.y;

	sendRequestParams ("ShowFacturaPortlets", args);
	return false;
}

function ajax_FacturaEditTicketShow(ticketID) {
	var args = new Array();
	args[args.length]= "portletId=factura_edit_ticket";
	args[args.length]= "action=show";
	args[args.length]= "ticket="+ticketID;
	args[args.length]= "xPos="+pb.e.x;
	args[args.length]= "yPos="+pb.e.y;
	
	sendRequestParams ("ShowFacturaPortlets", args);
	return false;
}

function ajax_FacturaEditServiceTimeShow(serviceID) {
	var args = new Array();
	args[args.length]= "portletId=factura_edit_service_time";
	args[args.length]= "action=show";
	args[args.length]= "serviceID="+serviceID;
	args[args.length]= "xPos="+pb.e.x;
	args[args.length]= "yPos="+pb.e.y;
	
	sendRequestParams ("ShowFacturaPortlets", args);
	return false;
}


function ajax_FacturaEditTicketClose() {
	var args = new Array();
	args[args.length]= "portletId=factura_edit_ticket";
	args[args.length]= "action=close";
	args[args.length]= "xPos="+pb.e.x;
	args[args.length]= "yPos="+pb.e.y;
	
	sendRequestParams ("ShowFacturaPortlets", args);
	return false;
}

function ajax_FacturaEditServiceTimeClose() {
	var args = new Array();
	args[args.length]= "portletId=factura_edit_service_time";
	args[args.length]= "action=close";
	args[args.length]= "xPos="+pb.e.x;
	args[args.length]= "yPos="+pb.e.y;
	
	sendRequestParams ("ShowFacturaPortlets", args);
	return false;
}


function ajax_FacturaEditWorktimeRoundAmountChange() {
	var args = new Array();
	args[args.length]= "portletId=factura_edit_coll_worktime";
	args[args.length]= "action=round_amount";
	args[args.length]= "xPos="+pb.e.x;
	args[args.length]= "yPos="+pb.e.y;
	
	sendRequestParams ("ShowFacturaPortlets", args);
	return false;
}



function ajax_FacturaEditVoucherCollective() {
	var args = new Array();
	args[args.length]= "portletId=factura_edit_coll_voucher";
	args[args.length]= "action=show";
	args[args.length]= "xPos="+pb.e.x;
	args[args.length]= "yPos="+pb.e.y;

	sendRequestParams ("ShowFacturaPortlets", args);
	return false;
}

function ajax_FacturaEditWorktimeCollectiveChange(fieldid) {
	var args;
	args = new Array();
	args[args.length]= "xPos="+pb.e.x;
	args[args.length]= "yPos="+pb.e.y;
	args[args.length]= "portletId=factura_edit_coll_worktime";
	args[args.length]="action="+fieldid;
	args[args.length]="wage="+document.getElementById("factura_role_hourwage").value;
	args[args.length]="gesamt="+document.getElementById("gesamt").value;
	args[args.length]="role_id="+document.getElementById("std_role").value;
	
	sendRequestParams("ShowFacturaPortlets", args);
	
	return false;
}

function ajax_SaveFacturaEditWorktimeCollectiveChange(buttonEle) {
	var args;
	var e;
	
	if ( ajax_validation(buttonEle.form,true) ) {
		args = new Array();
		args[args.length]= "xPos="+pb.e.x;
		args[args.length]= "yPos="+pb.e.y;
		args[args.length]= "portletId=factura_edit_coll_worktime";
		args[args.length]= "action=factura_edit_collective_worktime";
		args[args.length]= "wage="+document.getElementById("factura_role_hourwage").value;
		args[args.length]= "gesamt="+document.getElementById("gesamt").value;
		args[args.length]= "role_id="+document.getElementById("std_role").value;
		
		sendRequestParams("ShowFacturaPortlets", args);
		formSent = false;
	}
	
	return false;
}


function ajax_loadNavigation () {
	
	var args = new Array();
	args[args.length]= "action=show";
	sendSynchronRequest ("navigationHandler", args);
}

function ajax_toggleNavigation (menueID, isOpen) {
// ajax_debugLog("ajax_toggleNavigation");
	
	var args = new Array();
	args[args.length]= "action=toggle";
	args[args.length]= "menueID="+menueID;
	args[args.length]= "isOpen="+isOpen;
	sendSynchronRequest ("navigationHandler", args);
}

var customHref="#";
function ajax_ExecuteCustomLink (menuID,customLinkID) {
	customHref="#";
	var args = new Array();
	args[args.length]= "action=executeCustomLink";
	args[args.length]= "menueID="+menuID;
	args[args.length]= "customLink="+customLinkID;
	sendSynchronRequest ("navigationHandler", args);
	
	var e = document.getElementById(menuID);
	if ( e ) {
		e.setAttribute("href",customHref);
	}
	return true;
}


function ajax_toggleFacturaCostTypeCheckbox(costtype, state ) {
	var e;
	var valid;
	var args
	formSent=false;
	valid = true;
	args = new Array();
	args[args.length]= "clearselected=true";
	args[args.length]= "costType="+costtype;
	args[args.length]= "state="+state; 
	
	e = document.getElementById("actual_invoice");
	if ( e ) {
		args[args.length]= "actual_invoice="+e.value;
		valid = ajax_validation(e.form,true);
	}
	formSent=false;
	
	if ( valid ) {
		sendRequestParams ("toggleFacturaCheckbox", args);
	}
	return false;
}

function ajax_toggleFacturaTreeCheckbox(voucherID, state ) {
	var e;
	var valid;
	var args

	args = new Array();
	args[args.length]= "tree=true";
	args[args.length]= "voucherID="+voucherID;
	args[args.length]= "selected="+state;
	
	sendRequestParams ("toggleFacturaCheckbox", args);
	return false;
}

function ajax_toggleFacturaVoucherCheckbox(voucherID, state ) {
	var e;
	var valid;
	var args

	args = new Array();
	args[args.length]= "voucher=true";
	args[args.length]= "voucherID="+voucherID;
	args[args.length]= "selected="+state;
	
	sendRequestParams ("toggleFacturaCheckbox", args);
	return false;
}

function ajax_SaveFacturaEditVoucherCollectiveChange(buttonEle) {
	var args;
	var e;
	
	if ( ajax_validation(buttonEle.form,true) ) {
		args = new Array();
		args[args.length]= "xPos="+pb.e.x;
		args[args.length]= "yPos="+pb.e.y;
		args[args.length]= "portletId=factura_edit_coll_voucher";
		args[args.length]= "action=factura_edit_coll_voucher";
		e = document.getElementById("amount");
		if ( e ) {
			args[args.length]= "amount="+e.value;
		}
		e = document.getElementById("description");
		if ( e ) {
			args[args.length]= "description="+e.value;
		}
		
		sendRequestParams("ShowFacturaPortlets", args);
		formSent = false;
	}
	
	return false;
}

function ajax_toggleAllFacturaCheckbox(cb ) {
	var e;
	var valid;
	var args

	args = new Array();
	args[args.length]= "voucher=all";
	args[args.length]= "selected="+cb.checked;
	
	sendRequestParams ("toggleFacturaCheckbox", args);
	return false;
}

function ajax_assignVoucherCollectiveType (voucherTypeID) {
		args = new Array();
		args[args.length]= "xPos="+pb.e.x;
		args[args.length]= "yPos="+pb.e.y;
		args[args.length]= "voucherTypeID="+voucherTypeID;
		args[args.length]= "action=show";
		
		sendRequestParams("voucherTypePopup", args);
}

function ajax_saveVoucherCollectiveType (buttonEle, voucherTypeID) {
		args = new Array();
		args[args.length]= "xPos="+pb.e.x;
		args[args.length]= "yPos="+pb.e.y;
		args[args.length]= "voucherTypeID="+voucherTypeID;
		args[args.length]= "action=save";
		
		_addFormValues (args, buttonEle.form);
		
		sendRequestParams("voucherTypePopup", args);
}

function ajax_EditVoucherCollective (voucherCollectiveID, mode) {
	sendRequestParams("editVoucherCollective", ["ID="+voucherCollectiveID, "mode="+mode, 'action=show', "xPos="+pb.e.x, "yPos="+pb.e.y]);
}

function ajax_SaveVoucherCollective (buttonEle, voucherCollectiveID) {

		args = new Array();
		args[args.length]= "xPos="+pb.e.x;
		args[args.length]= "yPos="+pb.e.y;
		args[args.length]= "ID="+voucherCollectiveID;
		args[args.length]= "action=save";
		
		_addFormValues (args, buttonEle.form);
		
		sendRequestParams("editVoucherCollective", args);
}

function ajax_Confirm (module, textID) {
	var args = new Array();

	args[args.length]= "-module="+module;
	args[args.length]= "id="+textID;

	sendSynchronRequest ("ajaxConfirm", args);
	return (__confirmResult__);
}

/* Löscht den angegebenen Benutzer und lädt die Ergebnistabelle neu */
function ajax_DropUser (userName) {
	var args = new Array();

	args[args.length]= "userName="+userName;

	sendRequestParams ("dropUser", args);
}

function ajax_deleteStdStaffGroup (ID) {
	sendRequestParams("deleteStdStaffGroup", ["ID="  + ID]);
}	
	
function ajax_showMilestoneImage (imageID, zoomID) {
	var ele = document.getElementById (imageID);
	
	var nHeight = 0;
	var nTop;
	
	if ( ele ) {
		nHeight = 0;
		nTop = 0;
		var b = document.body;

		var r = ele;
		while (r && r != b) {
			var i = parseInt(r.offsetTop);
			if (i) {
				nTop += i;
			}
			if (r.offsetParent) {
				r = r.offsetParent;
			} else {
				r = r.parentNode;
			}
		} 

		if ( nTop > 0  ) {
			nHeight = b.clientHeight - nTop -30;
			if ( nHeight < 50 ) {
				nHeight=0;
			}
		}
	}
	ele = document.getElementById (zoomID);
	
	sendSynchronRequest("showMilestoneImage", ["imageID="+imageID, "zoom="+ele.value, "imageWidth="+document.body.clientWidth, "imageHeight="+nHeight]);
	e = document.getElementById("milestone_trend_analysis");
	e.src=e.getAttribute("customsrc")+"&width="+document.body.clientWidth+"&height="+nHeight+"&zoom="+ele.value+"&rnd="+Math.random();
}

function ajax_setFocus () {
	sendRequestParams("setFocus", ["dummy=true"]);
}

function ajax_releaseAbsence (cyclicEntryID) {
	var args = new Array();
	
	args[args.length]="xPos="+pb.e.x;
	args[args.length]="yPos="+pb.e.y;
	args[args.length]="CyclicEntry_ID="+cyclicEntryID;
	
	args[args.length]="action=release";
	
	sendRequestParams("absenceRequestPopup", args);
}

function ajax_changeAbsencePopupOverview (absenceID) {
	var args = new Array();

	args[args.length]="xPos="+pb.e.x;
	args[args.length]="yPos="+pb.e.y;
	args[args.length]="absenceID="+absenceID;
	
	args[args.length]="action=showAbsenceForUser";
	
	sendRequestParams("absenceRequestPopup", args);
}

function ajax_createAbsencePopupOverview (x1, y1, x2, y2, width) {
	var args = new Array();

	args[args.length]="xPos="+pb.e.x;
	args[args.length]="yPos="+pb.e.y;
	args[args.length]="xpos1="+x1;
	args[args.length]="ypos1="+y1;
	args[args.length]="xpos2="+x2;
	args[args.length]="ypos2="+y2;
	if ($.browser.msie) {
		args[args.length]="width="+(width+1);
	} else {
		args[args.length]="width="+width;
	}
	args[args.length]="action=showForUser";
	
	sendRequestParams("absenceRequestPopup", args);
}

function ajax_createAbsencePopup (sync) {
	var args = new Array();

// if (pb && pb.e) {
// args[args.length]="xPos="+pb.e.x;
// args[args.length]="yPos="+pb.e.y;
// }
	args[args.length]="xPos=100";
	args[args.length]="yPos=100";
	args[args.length]="action=show";

	if (sync) {
		sendSynchronRequest("absenceRequestPopup", args);
	} else {
		sendRequestParams("absenceRequestPopup", args);
	}
	formSent=false;
	
	return false;
}

function ajax_saveAbsencePopup (ele, mode) {
	var args = new Array();

	formSent=false;
	if ( ajax_validation(ele.form, true) ) {
		args[args.length]="xPos=100";
		args[args.length]="yPos=100";
// args[args.length]="xPos="+pb.e.x;
// args[args.length]="yPos="+pb.e.y;
		args[args.length]="action="+mode;
	
		_addFormValues (args, ele.form);
	
		sendRequestParams("absenceRequestPopup", args);
	}
	formSent=false;
	return false;
}

function ajax_deleteAbsence (id) {
	var args = new Array();

// args[args.length]="xPos="+pb.e.x;
// args[args.length]="yPos="+pb.e.y;
	args[args.length]="xPos=100";
	args[args.length]="yPos=100";
	args[args.length]="action=delete";
	args[args.length]="id="+id;

	sendRequestParams("absenceRequestPopup", args);
	formSent=false;
}
function ajax_showCalendarYear (id, whatID) {
	var args = new Array();

	args[args.length]="xPos=100";
	args[args.length]="yPos=100";
	args[args.length]="action=showYear";
	args[args.length]="year="+document.getElementById (id).value;
	args[args.length]="-what="+document.getElementById (whatID).value;

	sendRequestParams("absenceRequestPopup", args);
	formSent=false;
	return false;
}


function ajax_showTestLDAPConfigurationPopup() {
	var args = new Array();
	args[args.length]= "action=show";
	args[args.length]= "xPos="+pb.e.x;
	args[args.length]= "yPos="+pb.e.y;

	sendSynchronRequest ("TestLDAPConfigurationPopup", args);
	return false;
}

function ajax_testTestLDAPConfigurationPopup(buttonEle) {
	var args;
	var e;

	if ( ajax_validation(buttonEle.form,true) ) {
		args = new Array();
		args[args.length]= "xPos="+pb.e.x;
		args[args.length]= "yPos="+pb.e.y;
		args[args.length]= "action=test";

		e = document.getElementById("username");
		if ( e ) {
			args[args.length]= "username="+e.value;
		}
		e = document.getElementById("password");
		if ( e ) {
			args[args.length]= "password="+e.value;
		}
		
		sendSynchronRequest ("TestLDAPConfigurationPopup", args);
		formSent = false;
	}
	
	
	return false;
}

var excekTaskImportOkButton = "import_ok";
var excekTaskImportProceedButton = "import_proceed";
var excekTaskImportProceedSelectResourcesButton = "import_proceed_select_resources";
var excekTaskImportCancelButton = "import_cancel";
var excelTaskImportOutputAnalyze = "results_analyzing";
var excelTaskImportOutputProceed = "results_proceed";
var excelTaskImportOutputProceedSelectResources = "results_proceed_select_resources";
var excelTaskImportFormProceed = "proceed_import_form";
var excelTaskImportFormProceedSelectResources = "proceed_import_select_resources_form";
var excelTaskImportFormImport = "import_form";

function ajax_excelTaskImportAction(action, column) {

	
	// An dieser Stelle werden statische sichtbarkeiten gesetzt
	// Der AJAX-Requesthandler muss somit nur noch fehlerabhängige
	// Sichtbarkeiten
	// setzen
	if(action == "ok") {
		hideElementById(excelTaskImportFormImport);
		hideElementById(excelTaskImportFormProceed);
		hideElementById(excelTaskImportFormProceedSelectResources);
		hideElementById(excekTaskImportOkButton);
		cleanElementById(excelTaskImportOutputProceed);
		cleanElementById(excelTaskImportOutputProceedSelectResources);
		cleanElementById(excelTaskImportOutputAnalyze);
	} else if(action == "proceed") {
		hideElementById(excekTaskImportProceedButton);
		hideElementById(excelTaskImportFormProceedSelectResources);
		hideElementById(excekTaskImportCancelButton);
		hideElementById(excelTaskImportFormProceedSelectResources);
		cleanElementById(excelTaskImportOutputAnalyze);
		hideElementById(excelTaskImportOutputAnalyze);
		hideElementById(excelTaskImportOutputProceedSelectResources);
		showElementById(excelTaskImportOutputProceed);
	} else if(action == "proceed_select_resources") {
		showElementById(excekTaskImportProceedButton);
		hideElementById(excekTaskImportProceedSelectResourcesButton);
		showElementById(excekTaskImportCancelButton);
		showElementById(excelTaskImportFormProceedSelectResources);
		showElementById(excelTaskImportOutputProceedSelectResources);
		cleanElementById(excelTaskImportOutputAnalyze);
		hideElementById(excelTaskImportOutputProceed);
		hideElementById(excelTaskImportOutputAnalyze);
	} else if(action == "cancel") {
		showElementById(excelTaskImportFormImport);
		hideElementById(excelTaskImportFormProceed);
		cleanElementById(excelTaskImportOutputAnalyze);
		cleanElementById(excelTaskImportOutputProceed);
		cleanElementById(excelTaskImportOutputProceedSelectResources);
		hideElementById(excelTaskImportOutputProceed);
		hideElementById(excelTaskImportOutputProceedSelectResources);
		hideElementById(excelTaskImportOutputAnalyze);
	} else {
		hideElementById(excekTaskImportOkButton);
		showElementById(excelTaskImportOutputAnalyze);
		hideElementById(excelTaskImportOutputProceed);
		hideElementById(excelTaskImportOutputProceedSelectResources);
// cleanElementById(excelTaskImportOutputAnalyze);
// cleanElementById(excelTaskImportOutputProceed);
	}
	
	var args = new Array();
	args[args.length] = "action=" + action;
	
	if(column)
		args[args.length] = "column=" + column;
	
	sendRequestParams("excelTaskImportRequestHandler", args);

	if(action=="load")
		return true;
	
	return false;
}


function ajax_createExcelTaskImportPopup () {
	return sendRequestForPopup("excelTaskImport");
}

// function ajax_loadExcelTaskImportTemplate() {
// var args = new Array();
// args[args.length] = "templatefile=importtabelle_de.xls";
//	
// sendRequestParams("createExcelTaskImportTemplate", args);
// }

/**
 * Ähnlich wie die normale Validierung prüft die Funktion, ob die Pflichtfelder
 * des betroffenen Formulars ausgefüllt wurden.
 * 
 */
function ajax_formValidationWithUpload(form) {
	var s;
	var e;
	var args;
	
	executeForm = false;
	
	e = new Array();
	args = new Array();
	for(var i=0; i < form.elements.length; i ++ ) {
		if ( form.elements[i].type!='submit' && form.elements[i].type != 'hidden' && !(form.elements[i].disabled == 'disabled' || form.elements[i].disabled )) {
			args[args.length]=form.elements[i].name+"="+form.elements[i].value;
		}
	}
	args[args.length]="formular="+form.id;
	sendSynchronRequest ("ValidationHandler",args);	

	if ( executeForm ) {
		showElementById("upload_loading_image");
		hideElementById(excelTaskImportFormImport);
		return true;
	}
	return false;
}
 
 /**
	 * Serverseite Validierung ausführen. allerdings nur dann, wenn Nativ-Ajax
	 * genutzt wird. - ruft intern sendOnce auf.
	 */
 function ajax_validation_with_fck(form,disableProgress) {
 	var s;
 	var e;
 	var args;

// if ( isNativeAjax() && __session__ != '0' ) {
 	if ( __session__ != '0' ) {
 		if ( !formSent ) {
 	
 			// suche das Memofeld im Formular, das den FCK benutzt und Pflicht
			// ist
 			var iframeList = document.getElementsByTagName("iframe");
 			var fckIframeList = new Array();
 			
 			
 			/*
			 * In diesem Teil werden Memofelder mit FCK-Support abgearbeitet. In
			 * der momentanen FCK-Version (2.6.4) wird der Editor durch zwei
			 * ineinander verschachtelte IFrames simuilert, wobei das obere als
			 * ID die ID des Memos + "___Frame" hat, das innere jedoch keine ID.
			 * Unabhängig davon werden zunächst alle IFrames gesucht und
			 * anschließend die herausgefiltert, die mit "fck_" beginnen (siehe
			 * form.xls). Zu diesen Frames werden die passenden MemoIDs
			 * gebildet. Anschließend wird im gefundenen IFrame nach dem inneren
			 * IFrame gesucht. Aus diesem inneren IFrame wird der
			 * innerHTML-Inhalt des Bodys genommen und dem zugehörigen Memofeld
			 * als Value übergeben. Somit kann in der ajax-Validation der Inhalt
			 * des FCK geprüft werden.
			 * 
			 * In der aktuellen Version besteht leerer Inhalt des FCKs aus <p><br><p/>.
			 * Eine entsprechende Prüfung wurde in die Klasse ValidateInput
			 * eingebaut.
			 */
 			if(iframeList && iframeList.length) {
 				for(var i = 0; i < iframeList.length; i++) {
 					if(iframeList[i].id.substring(0,4) == "fck_") {
 						var memoName = iframeList[i].id.substring(0,(iframeList[i].id.length - ("___Frame".length)))
 						
 						fckIframeList[fckIframeList.length] = iframeList[i];
 						
 						// Textarea entfernen
 						var memo = document.getElementById(memoName);
 						if(memo) {
 							// Lese den Inhalt des oberen IFrames
 							var firstIframeLevelDocument = iframeList[i].contentWindow.document;
 							
 							if(firstIframeLevelDocument) {
 								// suche das innere IFrame
 								var innerIframes = firstIframeLevelDocument.getElementsByTagName("iframe");
 								
 								// Es darf nur ein IFrame geben, andernfalls
								// wurde der FCK geändert und der
 								// Code sollte geprüft werden (siehe alert()).
 								if(innerIframes && innerIframes.length == 1) {
 									memo.value = innerIframes[0].contentWindow.document.body.innerHTML;
 								} else {
 									alert("Warning: It seems that fck structurer has changed! Please contact your admin!");
 								}
 							}
 						} 
 					} 
 				}
 			
 			}
 			
 			formSent = true;
 			executeForm =false;
 			
 			e = new Array();
 			args = new Array();
 			for(var i=0; i < form.elements.length; i ++ ) {
 				if ( form.elements[i].type!='submit' && form.elements[i].type != 'hidden' && !(form.elements[i].disabled == 'disabled' || form.elements[i].disabled )) {
 					args[args.length]=form.elements[i].name+"="+form.elements[i].value;
 				}
 			}
 			
 			args[args.length]="formular="+form.id;
 			sendSynchronRequest ("ValidationHandler",args);	
 			
 			if ( executeForm ) {
 				return true;
 			}
 			
 			formSent = false;
 		} 
 		return false;
 	} else {
 		if ( !disableProgress ) {	
 			return sendOnce(form);
 		} else {
 			return true;
 		}
 	}
 }

function ajax_sortExcelTaskImportMessages (column) {
	ajax_excelTaskImportAction('sort',column);
}

var profileId;
var profileHistoryPositionX;
var profileHistoryPositionY;
function ajax_showKnowledgeProfileHistory(pId) {
	profileId = pId;
	profileHistoryPositionX = pb.e.x;
	profileHistoryPositionY = pb.e.y;
	ajax_internalShowKnowledgeProfileHistory(profileId);
}

function ajax_sortKnowledgeProfileHistory(column) {
	ajax_internalShowKnowledgeProfileHistory(profileId, column);
}

function ajax_internalShowKnowledgeProfileHistory(profileId, column) {
	var args = new Array();
	args[args.length]= "xPos="+profileHistoryPositionX;
	args[args.length]= "yPos="+profileHistoryPositionY;
	args[args.length]= "action=show";	
	args[args.length]= "profileId="+profileId;
	if (column)	
		args[args.length]= "column="+column;
	sendSynchronRequest ("knowledgeHistoryPopup", args);
}


/**
 * Diese Methode ruft die AjaxFunktion ajax_showEmailPopup(..), allerdings
 * funktioniert diese Methoe auch mit der "Alle"-Checkbox wenn sie getoggelt
 * wird, dafür muß aber die ID der Checkbox übergeben werden
 * 
 * @param formID
 *            ID des Formulars
 * @param postHandlerClassName
 *            ???
 * @param allCheckboxID
 */
function ajax_showEmailPopupToggleAllCheckBox(formID, postHandlerClassName,allCheckboxID)  {
	var oldSelected;
	var allCheckbox;
	
	oldSelected=false;
	if ( allCheckboxID ) {
		allCheckbox = document.getElementById(allCheckboxID);
		if ( allCheckbox ) {
			oldSelected = allCheckbox.checked;
			allCheckbox.checked=false;
		}
	} else {
		allCheckbox = null;
	}
	ajax_showEmailPopup (formID,postHandlerClassName);

	if ( allCheckbox ) {
		allCheckbox.checked = oldSelected;
	}
}

/**
 * 
 * @param action
 *            Aktion
 * @param id
 * @return
 */
function ajax_selectedLeaderInCtrlReservationPlan(checkbox,id) {
	var args = new Array();

	args[args.length]="xPos="+pb.e.x;
	args[args.length]="yPos="+pb.e.y;
	if ( id ) {
		args[args.length]= "action=id";
		args[args.length]= "id="+id;
	} else if ( checkbox ) { 
		if (checkbox.checked) {
			args[args.length]= "action=selectedall";
		} else {
			args[args.length]= "action=deselectedall";
		}
	}
	sendRequestParams ("SelectLeaderForReservationPlan", args);
}

/**
 * 
 * @param action
 *            Aktion
 * @param id
 * @return
 */
function ajax_showLeaderInCtrlReservationPlan() {
	var args = new Array();
	args[args.length]="xPos="+pb.e.x;
	args[args.length]="yPos="+pb.e.y;
	args[args.length]= "action=show";
	sendRequestParams ("SelectLeaderForReservationPlan", args);
}


function ajax_showDMSDetails(dmsId) {
	formSent = false;
	var args = new Array();
	args[args.length]= "xPos="+pb.e.x;
	args[args.length]= "yPos="+pb.e.y;
	args[args.length]= "action=show";	
	args[args.length]="dmsId="+dmsId;
	sendSynchronRequest ("showDMSDetails", args);
}

function ajax_projectCalculateTasks() {
	var args = new Array();
	args[args.length] = "action=calculate";
	
	var form = document.getElementById("calculate_details_form");
	if(form) {
		for(var i = 0; i < form.elements.length; i++) {
			var e = form.elements[i];
			
			if(e.type == "checkbox") {
				args[args.length] = e.id + "=" + (e.checked ? "true" : "false");
			} else {
				args[args.length] = e.id + "=" + e.value;
			}
		}
	}
	
	sendRequestParams("plannerCalculateTasksRequestHandler", args);
}
/** Handler für den Netzplan */
function ajax_network(action, ele) {
	var args = new Array();
	args[args.length] = "action="+action;

	if ('orientation' == action) {
		args[args.length] = _ajax_getSelectedValue ('orientation', ele);
	} else if ('show_collective' == action) {
		args[args.length] = "show_collective="+ele.checked;
	}
	
	sendRequestParams("networkHandler", args);
}

var docId;
function ajax_showDMSPopup(targetAction, action, subaction, dirId, _docId) {
	var args = new Array();
	args[args.length]= "action="+action;
	if (subaction)
		args[args.length]= "subaction="+subaction;
	if (dirId)
		args[args.length]= "dirId="+dirId;
	if (_docId) {
		docId = _docId;
		args[args.length]= "docId="+_docId;
	} else {
		docId = null;
	}
	args[args.length]= "xPos="+pb.e.x;
	args[args.length]= "yPos="+pb.e.y;

	sendSynchronRequest (targetAction, args);
	return false;
}

function ajax_saveDMSPopup(portletId, targetAction, _form) {
	var args = new Array();
	args[args.length]= "xPos="+pb.e.x;
	args[args.length]= "yPos="+pb.e.y;
	_addFormValues (args, _form);
	sendRequestParams(targetAction, args);
	pb.elements[portletId]._close ();
	return true;
}

function ajax_sortDMSPopup(column) {
	sendRequest ("showDocMapping", "action=show", "column="+column, "docId="+docId, "xPos="+pb.e.x, "yPos="+pb.e.y);
}

function ajax_deleteDMSDocumentTaskMapping(docId, taskId) {
	sendRequest ("showDocMapping", "action=del", "docId="+docId, "taskId="+taskId);
}

function ajax_toggleDMSFolder(folderId) {
	sendRequest ("editDoc", "action=toggleFolder", "folderId="+folderId);	
}

function ajax_doDMSUpload(action, portletId) {
	var args = new Array();
	document.getElementById("action").value = action;
	_addFormValues (args, document.getElementById("edit_document_form"));
	sendRequestParams("editDoc", args);	

// if(portletId)
// pb.elements[portletId]._close ();

}

function ajax_projectArchiveCheckProjectId(field) {
	sendRequestParams("projectArchive", ["action=singleSelect", "id="  + field.id, "checked=" + field.checked]);
}

function ajax_projectArchiveCheckAllProjectIds(ele) {
	var args = new Array();
	
	if(ele) {
		var isChecked = ele.checked;
		var form = ele.form;
		var projectIds="ids=";
		var first = true;

		for(var i=0; i < form.length;++i) {
			if (form.elements[i].type == "checkbox") {
				var e = form.elements[i];
				if (e != ele) {
					e.checked = isChecked;

					if (!first) {
						projectIds += "@";
					}
					projectIds += e.id;
					first = false;
				}
			}
		}
	}

	args[args.length] = "select=" + isChecked;
	
	args[args.length] = projectIds;
	args[args.length] = "action=multiSelect";
	
	sendRequestParams("projectArchive", args);
}

/**
 * Führt ein Request aus, um die targetListbox mit Mitarbeiterdaten zu füllen.
 * Als Quelle dient die sourceListbox sowie die withSubDivisionsCheckbox. Die
 * sourceListbox enthält die FilterDepartments, währen die die withSubDivisions-
 * Checkbox aussagt, ob Unterbereiche mit betrachtet werden sollen.
 */
function ajax_searchStaffByDepartments() {
	var args = new Array();

	// Typ herausfiltern
	var listbox = document.getElementById("employeetype_Filter");
	if(listbox && listbox.selectedIndex) {
		var selected = listbox.options[listbox.selectedIndex];
		if(selected && selected.value && !selected.disabled) {
			args[args.length] = "selectedType=" + selected.value ;
		}
	}

	listbox = document.getElementById("lb_ub_Filter");
	if(listbox && listbox.selectedIndex) {
		var selected = listbox.options[listbox.selectedIndex];
		if(selected && selected.value && !selected.disabled) {
			args[args.length] = "selectedDepartment=" + selected.value ;
		}
	}
	
	var checkbox = document.getElementById("cb_ub_filter");
	if(checkbox) {
		args[args.length] = "withSubDivisions=" + checkbox.checked ;
	}

	sendRequestParams ("searchStaffByDepartments", args);
}

/**
 * Holt die Begrüßungs-Mitteilung vom Server.
 * Überträgt dazu die Zeit des Clients
 * @return
 */
function ajax_getWelcomeMessage () {
	var now = new Date();

	sendRequestParams("getWelcomeMessage", ["hours="+now.getHours(), "singleSelect="  + now.getMinutes ()]);

}

/**
 * Wird als Handler vom WorktimeRefusePopup aufgerufen.
 * Die vorher unter dem Key "net.proventis.cost.worktime.release.overview.WorktimeReleaseSubmit#RefuseList"
 * im Contrext abgelegten Arbeitszeiten werden abgelehnt
 * @return
 */
function ajax_refuseWorktime (buttonEle) {
	formSent = false; 
	if ( ajax_validation(buttonEle.form,true) ) {
		var args = new Array();

		args[args.length]="action=send";
		args[args.length]="message="+document.getElementsByName('MA_message')[0].value;

		sendRequestParams ("showWorktimeRefusePopup", args);
	}
	formSent = false; 
}

//Bug #14097 - Fortschritt kommentarlos speichern, auch wenn danach keine AZ mehr erfasst werden dürfen
/*
function ajax_confirmFinish (action) {
	sendSynchronRequest ("showWorktimeFinishedPopup", ["action="+action]);
}
*/
function ajax_refreshWorktimeRelease () {
	sendSynchronRequest ("refreshWorktimeRelease", ["action=refresh"]);
}

function ajax_confirmActionListenerRequest(cacheUid, message) {
	if(confirm(message)) {
		sendSynchronRequest ("confirmActionListenerSystemPopupRequestHandler",["uid="+cacheUid]);
	}
}

/**
 * Schaltet in der AZ-Auswertung die Lisbox "Gruppierung" je nach "Anzeige" um
 * @param anzeigeID
 * @param groupID
 * @return
 */
function ajax_toggleGroupListbox(anzeigeID, groupID) {
	var groupLB = document.getElementById (groupID);
	if (groupLB) {
		var anzeigeLB = document.getElementById (anzeigeID);
		if (anzeigeLB.value == "0") {
			_enableField (groupLB);
		} else {
			_disableField (groupLB);
		}
	}
}

/** Feld bei Änderungen auf den Server speichern */
function ajax_FieldPersistence(id,persistence) {
	var e;
	var f = document.forms;
	for(i=0; i<  f.length;i++) {
		if ( f[i][id] ){
			var args = new Array();
			args.push("id="+id);
			args.push("value="+f[i][id].value);
			args.push("persistence="+persistence);
			sendSynchronRequest ("fieldPersistence",args);
			break;
		}
	}
}

/** Setzt die default-Start-Arbeitszeit bei Datumsänderungen in der AZ-Erfassung */
function ajax_setDefaultWorktimeStart (dateID, fromID, wtID) {
	var dateEle = document.getElementById (dateID);
	ajax_setDefaultWorktimeStartValue (dateEle.value, fromID, wtID);
}
function ajax_setDefaultWorktimeStartValue (dateValue, fromID, wtID) {
	var wtEle = document.getElementById (wtID);

	if (!wtEle || wtEle.value != "") {	// Bei AZ-Änderungen nichts tun
		return;
	}
	sendRequestParams("setDefaultWorktimeStart", ["date="+dateValue, "fromID="+fromID]);
}

function ajax_ShowStaffPerDepartment (depLbId,staffLbId,type) {
	var wtEle = document.getElementById (depLbId);
	if ( wtEle ) {
		sendSynchronRequest("ShowStaffPerDepartment", ["department="+wtEle.value, "staffLbId="+staffLbId,"type="+type]);
		wtEle = document.getElementById (staffLbId);
		if ( wtEle && wtEle.onchange) {
			wtEle.onchange();
		}
		
	}
}

function ajax_SetUserProperty (propName,value) {
	sendRequestParams("UserPropertyHandler", ["method=set", "propName="+propName, "value="+value]);
}

function ajax_GetUserProperty (propName) {
	sendSynchronRequest ("UserPropertyHandler", ["method=get", "propName="+propName]);
	
	return (__returnValue__);
}

/** 
 * Anzeige des Popup zur Aenderung des projektspezifischen Planperiodentyps
 * in der Agilen Projektplanung. 
 */
function ajax_showChangeAgilePlanerPeriodTypePopup() {
	sendRequestParams("AgilePlanerChangePeriodTypePopup", ["action=show", "xPos="+pb.e.x, "yPos="+pb.e.y]);
	return false;
}

/** 
 * Speichert den projektspezifischen Planperiodentyp
 * in der Agilen Projektplanung. 
 */
function ajax_changeAgilePlanerPeriodType(_form) {

	if (ajax_popupValidation(_form)) {
		var args = new Array();
		args[args.length] = "xPos="+pb.e.x;
		args[args.length] = "yPos="+pb.e.y;
		args[args.length] = "action=save";
		_addFormValues (args, _form);
		sendRequestParams("AgilePlanerChangePeriodTypePopup", args);
	
		ShowWaitLogoOnUnload();
	}
	
	return true;
}

/** 
 * Anzeige des Popup fuer einen Periodenuebertrag
 * in der Agilen Projektplanung. 
 */
function ajax_showAgileCarryForwardPeriodPopup() {
	sendRequestParams("AgileCarryForwardPeriodPopup", ["action=show", "xPos="+pb.e.x, "yPos="+pb.e.y]);
	return false;
}

/** 
 * Fuehrt den Periodenuebertrag
 * in der Agilen Projektplanung aus. 
 */
function ajax_carryForwardAgilePeriod(_form) {

	if (ajax_popupValidation(_form)) {
		var args = new Array();
		args[args.length] = "xPos="+pb.e.x;
		args[args.length] = "yPos="+pb.e.y;
		args[args.length] = "action=save";
		_addFormValues (args, _form);
		sendRequestParams("AgileCarryForwardPeriodPopup", args);
	
		ShowWaitLogoOnUnload();
	}
	
	return true;
}

function ajax_selectWorktimeStaffPopup() {
	var args = new Array();
	args[args.length] = "xPos="+pb.e.x;
	args[args.length] = "yPos="+pb.e.y;
	args[args.length] = "action=show";
//	_addFormValues (args, _form);
	sendRequestParams("WorktimeStaffPopup", args);
	return true;
}

function ajax_selectWorktimeStaff (btnEle) {
	var args = new Array();
	args[args.length] = "xPos="+pb.e.x;
	args[args.length] = "yPos="+pb.e.y;
	args[args.length] = "action=send";
	_addFormValues (args, btnEle.form);
	sendRequestParams("WorktimeStaffPopup", args);
	return true;
}

function ajax_resetWorktimeStaff (btnEle) {
	var args = new Array();
	args[args.length] = "xPos="+pb.e.x;
	args[args.length] = "yPos="+pb.e.y;
	args[args.length] = "action=reset";
	_addFormValues (args, btnEle.form);
	sendRequestParams("WorktimeStaffPopup", args);
	return true;
}

function ajax_selectWorktimeUb (ubListboxID, staffListboxID) {
	var args = new Array();
	args[args.length] = "xPos="+pb.e.x;
	args[args.length] = "yPos="+pb.e.y;
	args[args.length] = "action=select-ub";
	var lbEle = document.getElementById (ubListboxID);
	args[args.length] = "ubID="+lbEle.value;
	args[args.length] = "staffListboxID="+staffListboxID;
	sendRequestParams("WorktimeStaffPopup", args);
	return true;
}

/** Überprüfung ob die Summe der Leistungsnachweise die Angebotssumme übersteigt 
 * 
 * @param btnEle Element Button
 * @return true speichern, sonst abrechnen
 */ 
function ajax_ShowWarningMessageForInvoiceIsGreaterThenQuote(btnEle) {
	var args;
	var b;
	var f;

	formSent = false;
	f = btnEle.form;
	if ( ajax_validation(f, true) ) {
		
		formSent = false;
		args = new Array();
		args[args.length]="button="+btnEle.name;
		args[args.length]="quoteID="+f['quote'].value;
		args[args.length]="amount="+(f['betrag'] != null ? f['betrag'].value : "") ;
		args[args.length]="invoiceID="+( f['KT_invoice_id'] != null  ?  f['KT_invoice_id'].value : "" );
		args[args.length]="proposalID="+( f['KT_proposal_id'] != null  ?  f['KT_proposal_id'].value : "" );
		
		sendSynchronRequest("ShowWarningMessageForInvoiceIsGreaterThenQuote", args);
		b = __confirmResult__;
	} else {
		b = false;
	}
	return b;
}

function callPopupCloseHandler(id, handler) {
	var args = new Array();
	args[args.length] = "id="+id;
	args[args.length] = "handler="+handler;
	sendRequestParams("callPopupCloseHandler", args);
}

function refreshCtrlStaffTaskGantt(nodeID) {
	var args = new Array();
	if ( nodeID ) {
		args[args.length] = "nodeID="+nodeID;
	}
	sendRequestParams("CtrlStaffTaskChanger", args);
}

function ajax_setWeekFinished () {
	var args = new Array();
	sendRequestParams("weekFinishedHandler", args);
}

function ajax_refreshAbsence () {
	var args = new Array();
	sendRequestParams("refreshAbsence", args);
}
function ajax_selectDayOfYear (dateString) {
	var args = new Array();
	args[args.length] = "action=year";
	args[args.length] = "dateString="+dateString;
	sendRequestParams("selectDayOfYear", args);
}
function ajax_selectDayOfMonth (dateString, kw, year) {
	var args = new Array();
	args[args.length] = "action=weekDate";
	args[args.length] = "dateString="+dateString;
	args[args.length] = "kw="+kw;
	args[args.length] = "year="+year;
	sendRequestParams("selectDayOfYear", args);
}
function ajax_selectDayTimeInWeek (dateString, timeFrom, timeTo) {
	var args = new Array();
	args[args.length] = "action=week";
	args[args.length] = "dateString="+dateString;
	args[args.length] = "timeFrom="+timeFrom;
	args[args.length] = "timeTo="+timeTo;
	sendRequestParams("selectDayOfYear", args);
}


function ajax_editProjectPortletConfiguration() {
	var args = new Array();
	args[args.length] = "xPos="+pb.e.x;
	args[args.length] = "yPos="+pb.e.y;
	args[args.length] = "action=show";
	sendRequestParams("ShowPorletConfigurationPopUP", args);
}

function ajax_deleteRole (id) {
	sendRequestParams("deleteRole", ["action=delete", "id="+id]);
}

/* JsInclude file=psap.js */

var IE=document.all ? true : false;
var Opera = (navigator.userAgent.indexOf('Opera') != -1);
var NS = (navigator.appName == "Netscape");
var NS6 = (NS && (navigator.appVersion >= "5.0"));
if (NS6) NS = false;
if (Opera) { NS = false; NS6=false; IE=false; }

var n = navigator.userAgent.toLowerCase();
OP = !!(window.opera && document.getElementById);
IE = !!(n.indexOf("msie") >= 0 && document.all && !OP);
var IE6 = IE && (navigator.appVersion.indexOf ("MSIE 6") > 0);
var IEMC = !!(IE && n.indexOf("mac") >= 0);
NS6 = !!(typeof window.getComputedStyle != "undefined" && typeof document.createRange != "undefined");
var SAFARI = !!(n.indexOf("safari") >= 0);
var FF2 = NS6;
var FF3 = NS6;
// "Mozilla/5.0 (X11; U; Linux i686; de; rv:1.8.1.20) Gecko/20081217 Firefox/2.0.0.20"

var FF2 = NS6;
var FF3 = NS6;
if (NS6 && n.substr(n.indexOf("firefox/")+8,1) == "2") { FF2 = true; FF3 = false; }
if (NS6 && n.substr(n.indexOf("firefox/")+8,1) == "3") { FF2 = false; FF3 = true; }

// alert ("n="+n.substr(n.indexOf("firefox/")+8, 1) +", NS6="+NS6+", FF2="+FF2+", FF3="+FF3);

//alert ('userAgent='+navigator.userAgent+' appName='+navigator.appName+' appVersion='+navigator.appVersion+' IE='+IE+' NS='+NS+' NS6='+NS6+' Opera='+Opera);

// config

var fix = 0;
var dynamic = 1;
var permanent = 2;
var allDynamic = 3;
var left_margin = 20;
var top_margin = 10;
var lm = left_margin;
var tm = top_margin;
var error_msg = "";
var do_show;
var do_hide;

if (IE || Opera || NS6) {
	do_show = 'visible';
	do_hide = 'hidden';
} else if (NS) {
	do_show = 'show';
	do_hide = 'hide';
}

var lay = new Array ();
function init_layer () {
//	alert ("init_layer ()");
//	lay = new Array ();
	lay[0] = new MyLayer ('refresh',	 -1,   0, 10, 50,   0, permanent,		true);
	lay[1] = new MyLayer ('info',	 -1,   0, 11, 20,   0, permanent,		true);
//	lay[2] = new MyLayer ('dump',	 -1,   0, 11, 20,   0, permanent,		true);

	lay[0].set_visible (do_show);
	lay[1].set_visible (do_show);
//	lay[2].set_visible (do_show);
}

function MyLayer (name, xpos, ypos, zpos, width, height, state, vis) {
// alert ("MyLayer ("+name+")");
	this.name = name;
	this.xpos = xpos;
	this.ypos = ypos;
	this.zpos = zpos;
	this.width = width;
	this.height = height;
	this.state = state;
	this.vis = vis;

	try {
		if (IE) {
			this.lay = 'document.all.'+name+'.style';
		} else if (NS6) {
			this.lay = 'document.getElementById(\''+name+'\').style';
		} else if (Opera) {
			this.lay = 'document.getElementById(\''+name+'\').style';
		} else if (NS) {
			this.lay = 'document.layers.'+name;
		}
		this.set_visible = set_visible;
		this.moveto = moveto;
		this.set_content = set_content;
	} catch (e) {}
}

function moveto (xpos) {
// alert ("moveto ("+xpos+") name="+this.name);
	if (NS) {
		eval (this.lay+".visibility = '"+do_hide+"'");
		cmd = this.lay+".left = "+xpos+ ";" + this.lay+".visibility = '"+do_show+"'";
		setTimeout (cmd, 0);
	} else {
		eval (this.lay+".left = "+xpos);
	}
}

function set_visible (vis) {
// alert ("set_visible ("+vis+") name="+this.name);
	this.vis = vis;
	try {
		eval (this.lay+".visibility = '"+vis+"'");
	} catch (e) {}
}

function set_content (msg) {
//	alert ("set_content ("+msg+") name="+this.name);
	if (IE) {
		document.getElementById(this.name).innerHTML = msg;
	} else if (NS6) {
		// OK document.getElementById(this.name).innerHTML = msg;
		document.getElementById(this.name).appendChild(document.createTextNode(msg));

	} else if (Opera) {
		// Opera kann kein DHTML
	} else if (NS) {
		document.layers[this.name].document.open ();
		document.layers[this.name].document.write ('<span class="error">');
		document.layers[this.name].document.write (msg);
		document.layers[this.name].document.write ('</span>');
		document.layers[this.name].document.close ();
	}
}

var nav_width = 280;
var speed = 0;	// in ms
var step = nav_width;

// local
var dstep = 0;
var nav_pos = 0;
var dir = 0;
var state="out";
var last="navigation";

// layer (name, xpos, ypos, zpos, width, height, state, vis)

function show (sname) {
//	alert ("show ("+sname+")");
	if (NS) {
		img = "window.document.layers['buttons'].document.images['leiste_verbergen']";
	} else {
		img = "window.document.images['leiste_verbergen']"
	}
	if (sname == "") {
		if (state == "in") {
			sname = last;
			state = "out";
			eval (img+".src ='/Html/images_new/zurue.gif'");
			if (!NS) eval (img+".alt ='leiste_verbergen'");
		} else {
			state = "in";
			eval (img+".src ='/Html/images_new/weiter.gif'");
			if (!NS) eval (img+".alt ='leiste_anzeigen'");
		}
	} else {
		state = "out";
		eval (img+".src ='/Html/images_new/zurue.gif'");
		if (!NS) eval (img+".alt ='leiste_verbergen'");
	}

	w = left_margin;
	bw = 0;
	for (i = 0; i < lay.length; i++) {
		l = lay[i];
		if (l.state == dynamic) {
			if (l.name == sname) {
				l.set_visible (do_show);
				w += l.width;
				last = l.name;
			} else {
				l.set_visible (do_hide);
			}
		}
		if (l.state == allDynamic) {
			w += l.width;
			bw = l.width;
		}
	}
//	alert (w);
	for (i = 0; i < lay.length; i++) {
		l = lay[i];
		if (l.state == permanent) {
			if (l.name != 'refresh')
				l.moveto (w);
		}
		if (l.state == allDynamic) {
			l.moveto (w -bw -lm);
		}
	}
//	alert (msg);
}

function setError (msg) {
// alert ('setError ('+msg+')');
	error_msg = msg;
}

function showError () {
  alert ('showError ()');
//	if (error_msg == '')
//		return;
	for (i = 0; i < lay.length; i++) {
		l = lay[i];
		if (l.name == 'error') {
			if (error_msg == '') {
				l.set_visible (do_hide);
			} else {
				l.set_content (error_msg);
				l.set_visible (do_show);
			}

			break;
		}
	}
}

function showErrors () {
// alert ('showErrors ()');
	for (i = 0; i < lay.length; i++) {
		l = lay[i];
		if (l.name == 'error') {
			l.set_visible (do_show);
			break;
		}
	}
}

function ValidateMemo(field,maxlen) {
	var b;
	return (true);

	// disabled
	if(IE)
		b = (field.innerText.length <= maxlen);
	else
		b = (field.value.length <= maxlen);
	if(!b)
		if(confirm("ACHTUNG!\n\nSie d?rfen in diesen Feld d?rfen maximal"+maxlen+" Zeichen eingeben. "+
			"Soll der Text automatisch abgeschnitten werden?")) {
		if(IE) field.innerText = field.innerText.substring(0,maxlen);
		else field.value = field.value.substring(0,maxlen);
	}
	return b;
}

function setfocus (focus) {
//	top.frames.main.focus ();
    if ((focus >= 0) && document.forms && document.forms[focus] && document.forms[focus][0] ) {
		var f = document.forms[focus];
		for (var i = 0; i < f.elements.length; i++) {
			if (f[i].type == 'hidden') continue;
			
			// alert ("setfocus ("+focus+"): f["+i+"].name="+f[i].name);
		
			try {
	        	f[i].focus();
	        } catch (e) {}
			try {
	        	f[i].select();
	        } catch (e) { }
        	break;
		}
    }
}

function setfocusByID (focus) {
	var ele = document.getElementById(focus);
	if (ele) {
		alert ("focus@"+focus);
		ele.focus();
	}
}


var startup_idx = 0;
var startup_funcs = new Array ();

function add_startup (func) {
	for (var i = 0; i < startup_idx; i++) {
		if (startup_funcs[i] == func) {
			return;
		}
	}
//	alert ("add_startup: add "+func+" at "+startup_idx);
	startup_funcs[startup_idx++] = func;
}

var __systemType__;
var pageLoaded = false;
var __systemType__;
function atLoad (systemType, focus,link,loadNavigationFlag) {
	__systemType__ = systemType;
// 	alert ("atLoad ("+systemType+", "+focus+")");
	__systemType__ = systemType;
	pageLoaded = true;
	var e;

	loadNavigation();
	
	e = document.getElementById("bodymaintable");
	if ( e ) {
//		debugWindow ("e.nodeName="+e.nodeName+", FF2="+FF2);
		if (e.nodeName == "DIV") {
			e.style.display = "block";
		} else {
			e.style.display = ($.browser.msie ? "block" : "table");
//			e.style.display= FF2 ? "table" : "block";
		}
	}
	
	e = document.getElementById("newwaitlogoDiv");
	if ( e ) {
		e.style.display="none";
	}

	if ( (systemType == 'test') || (systemType == 'counter') ) {
		init_layer ();
	}
	if (focus != -1) {
		setfocus (focus);
	}

	for (var start_idx = 0; start_idx < startup_funcs.length; start_idx++) {
  		eval (startup_funcs[start_idx]);
	}
	

/*
	if ( loadNavigation ) {
		var myframe = top.frames["navigation"];
		if ( myframe && link ){
			if ("Konqueror" == navigator.appName) {
				myframe.location.reload();
			} else {
				myframe.location.href = link;
			}
		}
	}
*/

	showBottomToolbar ();
//	resizeToolbar ();
//	resizeBody(false, false);

	var mainframe;
	// nun das erste text oder textarea aktivieren
	
	var mainframe = top.frames['main']; 
	if ( !mainframe || top.frames.length == 0) {
		mainframe = top.window;
	}	
	
	var tabIdxAllowed = true;
//	alert (maske_name);
	if (maske_name=='login' || maske_name=='userregistrierung' || maske_name=='support') {
		tabIdxAllowed = false;
	}
	
	if (mainframe) {
		// Tabreihenfolge setzen (Bug 8181)
		if (tabIdxAllowed) {
			setTabIndex ();
//			var tabOrder;
//			var abort;
//			tabOrder=1;
//			for(var j=0; j<mainframe.document.forms.length; j++) {
//				var myform = mainframe.document.forms[j];
//				if ( !myform.target && myform.target != 'berichte' ) {
//					var ar = myform.elements;
//					var cnt = ar.length;
//					for(var i=0; i<cnt; i++) {
//						if ( ar[i].type !='hidden' ) {
//							/*set 9955
//							 * ar[i].setAttribute("tabindex",tabOrder);
//							 */ 
//							ar[i].tabIndex=tabOrder;
//							tabOrder ++;
//						}
//						
//					}
//				}
//			}
		}
		
		var abort = false;
		for(var j=0;!abort && j<mainframe.document.forms.length; j++) {
			var myform = mainframe.document.forms[j];
			/** berichtsformulare sollten nicht berücksichtigt werden */
			if ( !myform.target && myform.target != 'berichte' ) { 
				var ar = myform.elements;
				var cnt = ar.length;
				if (cnt>500) cnt=500;
				for(var i=0;!abort && i<cnt; i++) {
					try {
						var mt = ar[i].type;
//						alert (mt);
						/* Bug 8340 */
//						if (mt=='text' || mt=='textarea' || mt=='checkbox' /* ||mt=='select-one' || mt=='select-multiple' ||  mt=='submit' */) {
						/* Bug #12039 */
						if (mt=='text' || mt=='textarea' || mt=='checkbox' || ((allowListboxFocus == 'true') && (mt=='select-one' || mt=='select-multiple')) /* ||  mt=='submit' */) {
								ar[i].focus();
								abort = true;
								/* Darf kein return mehr sein, da noch nachgelagert Operationen gemacht werden */
//								return;
						}
					} catch (ex) {}
				}
			}
		}
	}
	ajax_setFocus ();

	/* Bug 9493 - Den Anchor anspringen */
	var loc;
	var locIndex;
	loc = ""+window.location.href;
	locIndex = loc.lastIndexOf("#"); 
	if ( locIndex >0 ) {
		window.location.href = loc.substring(locIndex);
	}
}

function setTabIndex (focusFieldID) {
	var mainframe;
	// nun das erste text oder textarea aktivieren
	
	var mainframe = top.frames['main']; 
	if ( !mainframe || top.frames.length == 0) {
		mainframe = top.window;
	}	

	// Nur ausführen, wenn man auch Zugriff auf das Dokument hat
	try {
		var dummy = mainframe.document.forms.length;
	} catch (e) {
		return;
	}
	
	var tabOrder;
	var abort;
	tabOrder=1;
	for(var j=0; j<mainframe.document.forms.length; j++) {
		var myform = mainframe.document.forms[j];
		if ( !myform.target && myform.target != 'berichte' ) {
			var ar = myform.elements;
			var cnt = ar.length;
			for(var i=0; i<cnt; i++) {
				if ( ar[i].type !='hidden' ) {
					ar[i].tabIndex=tabOrder;
					tabOrder ++;
				}
				
			}
		}
	}
	
	// FCK Editor Tabindex-Workaround.
	/*
	 * Zwar kann der FCK-Editor die Tabindizes der verarbeiteten Textareas einlesen und integriert
	 * sie, jedoch werden die Tabindizes von BA erst nach dem Laden des FCKs gesetzt. 
	 * Daher geschieht das Zuweisen des Tabindex eines Memofeldes an sein zugehöriges iframe an dieser
	 * Stelle.
	 */
	var iframes = document.getElementsByTagName("iframe");
	var fckMemos = new Array();
	if(iframes) {
		for(var i = 0; i < iframes.length; i++) {
			if(iframes[i].id.substring(0,4) == "fck_" ) {
				var memo = document.getElementById(iframes[i].id.substring(0,(iframes[i].id.length - ("___Frame".length))));
				if(memo) {
					iframes[i].setAttribute("tabindex", memo.getAttribute("tabindex"));
					memo.removeAttribute("tabindex");
				}
			}
		}
	}

	if (focusFieldID) {
		var ele = document.getElementById(focusFieldID);
//		debugWindow ("setTabIndex: ele = "+ele);
		ele.focus();
	}
}

function loadNavigation() {
	if ( parent.frames["navigation"]  ) {
		try {
			debugWindow ("Lade navigation");
			parent.frames["navigation"].ajax_loadNavigation ();
		} catch(e) {
			window.setTimeout('loadNavigation()',100);
		}

	}
}

function hie (file) {
	open (file, "hilfe", "width=400,height=400,resizable=no,scrollbars=yes");
}

function navIcon (action, img, name) {
	txt  = "";
	txt += "<p align='center'>";
	txt += "<a onfocus='blur()' href='javascript:navigate (\""+action+"\")'>";
	txt += "<img border='0' src='"+img+"' alt='"+name+"' title='"+name+"'>";
	txt += "</a>";
	txt += "</p>";
//	alert (txt);
	document.write (txt);
}

function holi (d) {
	if (document.forms[2].MD_holiFrom.value == "") {
			document.forms[2].MD_holiFrom.value = d;
	} else {
		if (document.forms[2].MD_holiTo.value == "") {
			document.forms[2].MD_holiTo.value = d;
		} else {
			document.forms[2].MD_holiFrom.value = d;
			document.forms[2].MD_holiTo.value = "";
		}
	}
}

function roleDefault (rname, intern, extern, extern_rka) {
	this.name = rname;
	this.intern = intern;
	this.extern = extern;
	this.extern_rka = extern_rka;
}

function setRoleDefaults (ele, arr, intern, extern, extern_rka) {
	v = ele.value;

	i_val = e_val = -1;
	a = eval (arr);
	for (i = 0; i < a.length; i++) {
		if (a[i].name == v) {
				i_val = a[i].intern;
				e_val = a[i].extern;
				if (extern_rka != "false");
					e_rka = a[i].extern_rka;
				break;
		}
	}
	if (i_val < 0) return;

	ele.form.elements[intern].value = i_val;
	ele.form.elements[extern].value = e_val;
	if (extern_rka != "false")
		ele.form.elements[extern_rka].value = e_rka;
}

function msOption (master, slave, text, clazz) {
	this.master = master;
	this.text = text;
	this.value = slave;
	this.len = text.length;
	this.clazz = clazz;
}

function msIndex (master, index, count) {
	this.master = master;
	this.index = index;
	this.count = count;
}

function setNamedMsOption (eleName, arrX, slaveX) {
		var eleM = document.getElementById(eleName);
//		eval ("document."+eleName);
	//	alert ("setNamedMsOption ( eleName="+eleName+", arrX="+ arrX+", eleM="+eleM+")");
		var eleS = eleM.form.elements[slaveX];
		var valS = ""
		try {
			valS = eleS.options[eleS.selectedIndex].value;
		} catch (e) {
			alert (e);
		}
		setMsOption (eleM, arrX, slaveX, true);
	    var optIdx;
		for (optIdx = 0; optIdx < eleS.options.length; optIdx++) {
			if (eleS.options[optIdx].value == valS) {
				eleS.selectedIndex = optIdx;
				break;
			}
		}
}

function setMsOption (ele, arr, slave, showLeer) {
	//	alert ("setMsOption ( ele="+ele+", arr="+ arr+", slave="+slave+")");
	var v = ele.options[ele.selectedIndex].value;

	var a;
	try {
		a = eval (arr);
	} catch (e) {
		return;
	}

	var l = eval (arr+"Len");
	var s = ele.form.elements[slave];
	s.length = 0;
	if (showLeer)
		s[0] = new Option ("          ", "");
/*
	if (IE || NS6)
		s.style.width=eval(1.2*(10+4))+"ex"
*/
	var idx = eval (arr+"Idx");
	var count = 0;

	if (v.length > 0) {
        var i = 0;
        var start;
        var count;
		for (i = 0; i < idx.length; i++) {
			if (idx[i].master == v) {
				start = idx[i].index;
				count = idx[i].count;
			}
		}
	} else {
//		count = idx.length;
		count = 0;
		start = 0;
	}
	if (count == 0) {
		if (s.onchange) {
			s.onchange();
		}
		return;
	}
		
    var ix;
    l = 10;
	for (i = 0; i < count; i++) {
		ix = eval(start + "+"+i);
		if ((a[ix].master == v) || (v.length == 0)) {
			// s[s.length] = new Option (a[ix].option.text, a[ix].option.value);
			
			var o = document.createElement ("option");
			try {
				if (Opera || NS)
					throw ("CatchMe");
				var attr;
				attr = document.createAttribute("value");
	     		attr.nodeValue = a[ix].value;
				o.setAttributeNode(attr);
				if (a[ix].clazz.length > 0) {
					attr = document.createAttribute("class");
		     		attr.nodeValue = a[ix].clazz;
					o.setAttributeNode(attr);
				}
				o.appendChild (document.createTextNode(a[ix].text));
			} catch (e) {
				o.setAttribute ("value", a[ix].value);
				// var str = "\u00a0\u00a0\u00a0\u00a0red (class)";
				var strNeu = a[ix].text;
				if (a[ix].clazz.length > 0) {
					var strNeu = a[ix].text.replace(/([\s\u00a0]*)(.*)/,"$1[ $2 ]");
				}
				o.appendChild (document.createTextNode(strNeu));
/*
				if (strNeu > l) {
					l = strNeu;
					if (IE || NS6)
						s.style.width=eval(1.2*(l+4))+"ex"
				}
*/
			}
			s.appendChild (o);
/*			
			if (a[ix].text.length > l) {
				l = a[ix].text.length;
				if (IE || NS6)
					s.style.width=eval(1.2*(l+4))+"ex"
			}
*/
		}
	}
	if (s.onchange) {
		s.onchange();
	}
}

function msText (id, text) {
	this.id = id;
	this.text = text;
}

function setNamedMsText (eleName, arr, slave) {
	//	alert ("setNamedMsText ( eleName="+eleName+", arr="+ arr+", slave="+slave+")");
	ele = eval ("document."+eleName);
	setMsText (ele, arr, slave);
}

function setMsText (ele, arr, slave) {
	// var msg="";
	// msg += "setMsText ( ele="+ele+", arr="+ arr+", slave="+slave+")"+"\n";
	var s;
	// msg += "setMsText: ele.selectedIndex="+ ele.selectedIndex+"\n";
	var i = 0;
	for (i = 0; i < ele.options.length; i++) {
		// msg += "setMsText: ele.options["+i+"].value="+ ele.options[i].value+"\n";
	}
	var v = ele.options[ele.selectedIndex].value;
	// msg += "setMsText: v="+ v+"\n";
	for (e=0; e < ele.form.elements.length; e++) {
		el = ele.form.elements[e];
		if ( (el.name == slave) && (el.type == 'text') ) {
			s = el;
			// msg += "setMsText: found slave="+ s.name+"\n";
			break;
		}
	}
	
	// Wenn das Feld nicht vorhanden ist: kommt die Meldung <Feld> is not definied
	try {
		a = eval (arr);
		text = "";
		for (i = 0; i < a.length; i++) {
			// msg += "setMsText: CMP a["+i+"].id=="+ v+"\n";
			if (a[i].id == v) {
				text = a[i].text;
				// msg += "setMsText: found text="+ text+"\n";
				break;
			}
		}
		try {
			s.value = text;
			// msg += "setMsText: value="+ text+"\n";
		} catch (e) {
			// msg += "setMsText: e="+e+"\n";
		}
	} catch(e) {
	}
	// alert (msg);
}

function msCheckbox (master, accountable) {
	this.master = master;
	this.accountable = accountable;
}

function setNamedMsCheckbox (eleName, arr, slave) {
	ele = eval ("document."+eleName);
	setMsCheckbox (ele, arr, slave);
}

function setMsCheckbox (ele, arr, slave) {
	v = ele.options[ele.selectedIndex].value;

	for (e=0; e < ele.form.elements.length; e++) {
		el = ele.form.elements[e];
		if ( (el.name == slave) && (el.type == 'checkbox') ) {
			s = el;
			break;
		}
	}

	a = eval (arr);
	accountable = -1;
	for (i = 0; i < a.length; i++) {
		if (a[i].master == v) {
			accountable = a[i].accountable;
			break;
		}
	}
	if (accountable == '-1')
		return;

	try {
		if (accountable == '0') {
			s.checked = false;
		} else {
			s.checked = true;
		}
	} catch (e) { }
}

var formSent = false;
function sendOnce (frm) {
	if (formSent) {
		return (false);
	}
	formSent = true;
	startwait();
	return (true);
}

function disableFields (ele, disable, enable) {
	if (disable.length > 0) {
		disableElements = disable.split (",");
		for (i = 0; i < disableElements.length; i++) {
			eval ("ele.form.elements['"+disableElements[i]+"'].disabled=true");
			eval ("ele.form.elements['"+disableElements[i]+"'].value=''");
		}
	}
	if (enable.length > 0) {
		enableElements = enable.split (",");
		for (i = 0; i < enableElements.length; i++) {
			eval ("ele.form.elements['"+enableElements[i]+"'].disabled=false");
		}
	}
}

function toggleProject (name) {
		// var msg = "";
		for (i = 1; true; i++) {
				var lineName = name+"_"+i;
				// msg += "name="+lineName+"\n";
				var ele = document.getElementById(lineName);
				if (!ele) {
						// msg += "Element not found";
						// alert (msg);
						return;
				}

				var vis = ele.style.display;
				if (vis == "none") {
						vis = "block";
				} else {
						vis = "none";
				}
				ele.style.display = vis;
				// msg += "Set to "+vis+"\n";
		}
}
function toggleSlaves (name) {
		_toggleSlaves(name);
		_toggleSlaves(name+"_IMG");
}
function _toggleSlaves (name) {
		for (i = 1; true; i++) {
				var lineName = name+"_"+i;
				var ele = document.getElementById(lineName);
				if (!ele) {
						return;
				}

				var vis = ele.style.display;
				if (vis == "") {
						vis = "none";
				} else {
						vis = "";
				}
				ele.style.display = vis;
		}
}

// var decDelim = ",";
// var groupDelim = ".";

function toLocal (val) {
	var oldVal = val;
		val = String(val);
		if (decDelim != ".") {
			var idx = val.indexOf(".");
			while (idx != -1) {
					val = val.substring(0,idx)+decDelim+val.substring (idx+1, val.length);
					idx = val.indexOf(".");
			}
		}
		if (val.indexOf(decDelim) == -1)
			val += decDelim;
		while (val.length -val.indexOf(decDelim) < 3)
			val += "0";
		if (val.length -val.indexOf (decDelim) > 3)
			val = val.substring (0, val.indexOf (decDelim)+3);
			
		debugWindow ("toLocal ("+oldVal+") returns "+val);
		return (val);
}

function toEn (val) {
	var oldVal = val;
		val = String(val);
		// Group-Delimiter entfernen
		var idx = val.indexOf(groupDelim);
		while (idx != -1) {
				val = val.substring(0,idx)+val.substring (idx+1, val.length);
				idx = val.indexOf(groupDelim);
		}
		// Dezimal-Trenner umwandeln
		if (decDelim != ".") {
			var idx = val.indexOf(decDelim);
			while (idx != -1) {
					val = val.substring(0,idx)+"."+val.substring (idx+1, val.length);
					idx = val.indexOf(decDelim);
			}
		}
		if (val.indexOf ('.') != -1) {
			if (val.length -val.indexOf ('.') > 3)
				val = val.substring (0, val.indexOf ('.')+3);
		} else {
			val += ".00";
		}
		idx = val.indexOf ('.');
		while ((val.substring(0,1) == "0") && (idx > 1)) {
			val = val.substring(1, val.length);
		}
		debugWindow ("toEn ("+oldVal+") returns "+val);
		return (val);
}

function SubmitLogin (form) {
	return (true);
}

function SubmitHrefBericht (form) {
	msg = "";
	action=form.elements["aktion"].value;
	idx = form.elements["SEC_ID"].selectedIndex;
	id = form.getAttribute ("id");
	arr = eval("EXT_"+id);
	ext = arr[idx-1];
//	msg += "idx="+idx+"\n";
//	msg += "ext="+ext+"\n";

	newAction = action+"/blueant."+ext;
	form.action=newAction;
//	msg += "action="+form.action+"\n";
//	alert (msg);
	form.submit();
	return (true);
}

function SubmitHrefBerichtMulti (form) {
	action = form.elements["aktion"].value;
	ext_id = form.elements["report-type"].selectedIndex;
	newAction = action+"/blueant."+form.elements["report-type"][ext_id].value;
	form.action=newAction;
	return (true);
}

function clearParticipationFields(type ) {
	switch(type) {
	case 0:
		clearField("kw");
		clearField("pt_h");
		break;
	case 1:
		clearField("kw");
		clearField("participation");
		break;
	case 2:
		clearField("pt_h");
		clearField("participation");
		break;
	}
}

function clearField(field ) {
		e = document.getElementById(field);
		if ( e ) {
			e.value='';
		}
}


function activateField(arr, value,field) {
	// var msg = "";
	var changedValue;
	try {
		changedValue = getValueFromField(field);
		if ( changedValue != '' ) {
			a = eval (arr);
			if ( a.length > 0 ) {
				if ( changedValue == value ) {
					for(i=0; i< a.length; i ++ ) {
						ele =field.form.elements[a[i]];
						_enableField (ele);
						// msg += "ENABLE  "+a[i]+"\n";
					}
					field.form.elements[a[0]].focus();
				} else {
					for(i=0; i< a.length; i ++ ) {
						ele =field.form.elements[a[i]];
						_disableField (ele);
						// msg += "DISABLE "+a[i]+"\n";
					}
				}
			}
		}
	} catch(e){
		// msg += "Exception "+e+"\n";
	}
	// alert (msg);
}

function throwEvent(arr, value,field) {
	var changedValue;
	var ele;
	try {
		changedValue = getValueFromField(field);
		if ( changedValue != '' ) {
			a = eval (arr);
			if ( a.length > 0 ) {
				if ( changedValue == value ) {
					for(i=0; i< a.length; i ++ ) {
						ele = field.form.elements[a[i]];
						if ( ele && ele.onchange) {
							ele.onchange();
						}
					}
					// field.form.elements[a[0]].focus();
				}
			}
		}
	} catch(e){
	}
}


/** holt ein Wert aus einem Formularfeld oder ein Leerstring falls nicht gefunden wurde */
function getValueFromField(field) {
	var changedValue;
	changedValue = '';
	try {
		if ( field.nodeName.toUpperCase() == 'SELECT' )  {
			// Combobox
			idx = field.options.selectedIndex;
			changedValue = field.options[idx].value;

		} else if ( field.nodeName.toUpperCase() =="INPUT" ) {
			if ( field.type == 'checkbox' ) {
				// Checkbox
				if ( field.checked == true ) {
					changedValue = field.value;
				} else {
					changedValue = -1;
				}
			} else {
				changedValue = field.value;
			}
		}
	} catch(e){
	}
	return changedValue;
}





/* speichert die dynamischen ?nderungen f?r Elemente in Maps
 * [ownername][keyvalue][slavename] = slavevalue
 */
var EventElementList = new Array();

/* setzt beim Element slavename den Wert salvevalue wenn beim Element ownername der Key keyvalue gew?hlt wurde 
 * siehe ListboxEntry
 */
function addlbsEntry(ownername, keyvalue, slavename, slavevalue) {
	var owner = EventElementList[ownername];
	if (!owner) {
		owner = new Array();
		EventElementList[ownername] = owner;
	}
	var key = owner[keyvalue];
	if (!key) {
		key = new Array();
		owner[keyvalue] = key;
	}
	key[slavename] = slavevalue;
}

function addLbsTargetEntry(ownername, keyvalue, slavename, targetkey, targetvalue) {
	var owner = EventElementList[ownername];
	if (!owner) {
		owner = new Array();
		EventElementList[ownername] = owner;
	}
	var key = owner[keyvalue];
	if (!key) {
		key = new Array();
		owner[keyvalue] = key;
	}
	var slave = key[slavename];
	if (!slave) {
		slave = new Array();
		key[slavename] = slave;
	}
	slave[targetkey] = targetvalue;
}

function lbsSelectEntry(element) {
	var n = element.name;
	if (n.indexOf('_')!=2) {
		alert("falsches Object: "+n);
	}
	n = n.slice(3);
	var owner = EventElementList[n];
	if (!owner) return;
	
	var i = element.selectedIndex;
	if (i>=0) {
		var key = element[i].value;
		var s = owner[key];
		if (!s) return;
		/* jetzt alle Eintr?ge in k durchgehen (Feldname=Value) Felder suchen und setzen */
		var alle = new Array();
		for(var w = 0; w<element.form.length; w++) {
			var _element = element.form[w];
			var elementname = _element.name;
			if (elementname.indexOf('_')==2)
				alle[elementname.slice(3)] = _element;
		}
		for(var w in s) {
			var slave = alle[w];
			if (slave) {
				var value = s[w];
				var typ = slave.type;
				if (typ=="select-one") {
					if (typeof value == "string") {
						/* ist eine Listbox, jetzt den Eintrag mit dem key suchen und selektieren */
						for(var q=0; q<slave.options.length; q++) {
							var op = slave.options[q];
							if (op.value==value) op.selected = 1;
						}
					} else {
						/* Value ist ein Array, also die neuen Werte in der Slave-Listbox setzen */
						slave.options.length = 0; /* Werte l?schen */
						idx = 0;
						slave.options[idx++] = new Option (" ", "");
						for (var te in value) {
							slave.options[idx++] = new Option (value[te],te);
						}
					}
				} else {
					slave.value=value;
				}
				lbsSelectEntry(slave);
			}
		}
	}
}

function syncTriStateCheckBox (ele,other) {
	if (ele.checked) {
		ele.form.elements[other].checked=false;
	}
}

function copyListbox (destId, srcId) {
	var srcLB = document.getElementById(srcId);
	var destLB = parent.document.getElementById(destId);
	
	// Inhalt der alten Listbox l?schen
	while (destLB.length > 0) {
		destLB.options[destLB.length-1] = null;
	}
	// Listbox kopieren
	var i=1;
	for (i = 0; i < srcLB.length; i++) {
		var so = srcLB.options[i];
		var desto = new Option(so.text, so.getAttribute("key"));
		try { desto.disabled = so.disabled; } catch (e) {}
		try { desto.style.cssText = so.style.cssText; } catch (e) {}
		try { desto.className = so.className; } catch (e) {}
		destLB.options[destLB.length] = desto;
	}
	destLB.selectedIndex = srcLB.selectedIndex;
}

function clearListbox (lbId) {
	try {
		var lb = document.getElementById(lbId);
		while (lb.length > 0) {
			lb.options[lb.length-1] = null;
		}
	} catch (e) { }
}

function clearParentListbox (lbId) {
	try {
		var lb = parent.document.getElementById(lbId);
		while (lb.length > 0) {
			lb.options[lb.length-1] = null;
		}
	} catch (e) { }
}

function toggleHint (show, parentEle, id) {
	ele = document.getElementById(id);
	ele.style.display = (show ? "block" : "none");
	ele.style.left = MousePositionX + 10;
	ele.style.top = MousePositionY + 10;
}

function findCSSStyle( styleName ) {
	var styleSheets;
	var style;
	var item;
	var styleWithDot;

	style = null;
	
	styleSheets = document.styleSheets;
	if ( styleSheets ) {
		styleWithDot = "."+styleName; 
		if ( !IE ) {
			for(var i=0;style==null&& i < styleSheets.length; i ++ ) {
				item = styleSheets.item(i);
				if ( item.cssRules ) {
					for(var j=0;style==null&& j < item.cssRules.length; j++ ) {
						if ( 	
							/* mozilla */
							( item.cssRules[j].selectorText==styleName || item.cssRules[j].selectorText==styleWithDot ) ||
							/* konquerer */
							item.cssRules[j].selectorText.indexOf(styleName)!=-1 ) {
							style = item.cssRules[j].style;
						}
					}
				}
			}
		} else {
			for(var i=0;style==null&& i < styleSheets.length; i ++ ) {
				item = styleSheets.item(i);
				if ( item.rules ) {
					for(var j=0;style==null&& j < item.rules.length; j++ ) {
						if ( item.rules[j].selectorText==styleName || item.rules[j].selectorText==styleWithDot ) {
							style = item.rules[j].style;
						}
					}
				}
			}
		}
	}

	return style;
}

var navOpen = true;
function displayNav (on) {
	if (document.getElementById ("fixedNavigation").checked)
		return;
	navOpen = !navOpen;
	document.getElementById ("nav_content").style.display = navOpen ? "block" : "none";
}

function toggleNav () {
	navOpen = !navOpen;
//	alert ("toggle is "+navOpen);
	document.getElementById ("root_navigation").style.display = navOpen ? "" : "none";
	document.getElementById ("root_logo").style.display = navOpen ? "" : "none";
}

/** 
 Funktioniert nur anstaenndig am Image-Tag: Beim Anker sendet der Mozilla(Firefox) 2 Requests und der IE sendet nur einen und speichert
 die Daten trotzem nicht
 @param url (String) URL die angesprungen werden sol?
 @param formName (String) Name des Formulars
 @param buttonName (String) Name des Buttons
*/
function sendFormularOnLink(url,formName,buttonName) {
	var form;
	var button;

	form = document.forms[formName];
	if ( form ) {
		if ( buttonName != null && buttonName.length > 0 ) {
			button = form[buttonName+"_btn"];
			if ( button ) {
				button.click();
			}
		}
	}
	form.action=url;
	return form.submit();
}

function sendFormByButton (buttonID) {
	var btn = document.getElementById(buttonID);
	btn.click();
	if ( !IE ) {
		btn.form.submit();
	}
}

function completeTime(ele) {
	 _completeDuration(ele, ":");
}

function completeDuration(ele) {
	_completeDuration(ele, durationSeparator);
}

function _completeDuration(ele, sep) {
//	var sep = ":";

	val = ele.value;
	if (val == "") {
		return;
	}
	// auf ungültige Zeichen testen
	var len = val.length;
	var i = 0;
	for (i = 0; i < len; i++) {
		var c = val.charAt (i);
		if ((c != 'a') && (c != 'p') && (c != 'm') && (c != sep) && ((c < '0') || (c > '9'))) {
			return;
		}
	}
	newVal = "";
	colonIdx = val.indexOf (sep);
	len = val.length;
	hasColon = (colonIdx >= 0);
	if (hasColon) {
		minutes = "0";
		if (colonIdx == (len -2)) {
			hours = val.substr (0, colonIdx+1);
			if (isDecFormat && sep != ":") {
				minutes = val.substr (colonIdx+1, 1)+"0";
			} else {
				minutes = "0"+val.substr (colonIdx+1, 1);
			}
			newVal = hours+minutes;
		}
	} else {
		if (len == 1) {
			newVal = val+sep+"00";
		} else if (len == 2) {
			newVal = val+sep+"00";
		} else if (len == 3) {
			hours = val.substring (0, 1);
			minutes = sep+val.substr (1, 2);
			newVal = hours+minutes;
		} else if (len == 4) {
			hours = val.substr (0, 2);
			minutes = sep+val.substr (2, 2);
			newVal = hours+minutes;
		}
	}
	if (newVal != "") {
		ele.value = newVal;
	}
}

function completeDate(ele) {
	
	var val = ele.value;
	if (val == "") {
		return;
	}
	var sep = dateDelim;
	var len = val.length;
	var day, month, year;
	var newVal;
	if (len == 6) {
		if (datePattern.substr (0,1) == 'y') {
			year = val.substr(0,2);
			month = val.substr(2,2);
			day = val.substr(4,2);
			newVal = year+sep+month+sep+day;
		} else {
			day = val.substr(0,2);
			month = val.substr(2,2);
			year = val.substr(4,2);
			newVal = day+sep+month+sep+year;
		}
		ele.value = newVal;
	} else if (len == 8) {
		if (val.indexOf(sep) < 0) {
			if (datePattern.substr (0,1) == 'y') {
				year = val.substr(0,4);
				month = val.substr(4,2);
				day = val.substr(6,2);
				newVal = year+sep+month+sep+day;
			} else {
				day = val.substr(0,2);
				month = val.substr(2,2);
				year = val.substr(4,4);
				newVal = day+sep+month+sep+year;
			}
			ele.value = newVal;
		}
	}
}

var Timer_1_Image = new Image();
Timer_1_Image.src = __imageadresse__+"uhr1.gif";
var Timer_2_Image = new Image();
Timer_2_Image.src = __imageadresse__+"uhr2.gif";

//stopwatch=false;
var stopForm = null;

function toggleTimer (id, running, alt) {
	var image;
	stopForm = document.getElementById (id).form;
	var icon = document.getElementById (id+"_icon");
	if (running) { // start
		image = Timer_2_Image;
//		stopwatch=false;
	} else {	// stopss
		image = Timer_1_Image;
//		stopwatch=true;
	}
	icon.src = image.src;
	icon.alt = alt;
	icon.title = alt;
}

function setStopForm (datum) {
	stopForm = null;
	for (var i = 0; i < document.forms.length; i++) {
		var form = document.forms[i];
		if (form && form[datum]) {
			stopForm = form;
			return (true);
		}
	}
	return (false);
}

function ajax_toggleStopWatchTime (datum, vonZeit, bisZeit, projekt, task, aktivitaet) {
	if (setStopForm (datum)) {
		toggleStopWatchTime (datum, vonZeit, bisZeit, projekt, task, aktivitaet);
	}
}
function ajax_toggleStopWatchDuration (datum, dauer, projekt, task, aktivitaet) {
	if (setStopForm (datum)) {
		toggleStopWatchDuration (datum, dauer, projekt, task, aktivitaet);
	}
}

function toggleStopWatchTime (datum, vonZeit, bisZeit, ticket, projekt, task, aktivitaet) {
	var dtEle = stopForm[datum];
	var vEle = stopForm[vonZeit];
	var bEle = stopForm[bisZeit];
	var tiEle = stopForm[ticket];
	
	var msg= "projekt="+projekt+"\n";
	var pEle = stopForm["MS_"+projekt];
//	msg += "MS_"+projekt+"="+pEle+"\n";
	if (!pEle) {
		pEle = stopForm["KS_"+projekt];
//		msg += "KS_"+projekt+"="+pEle+"\n";
	}
//	alert (msg);
	var tEle = stopForm[task];
	var aEle = stopForm[aktivitaet];
	
	ajax_toggleStopWatch (dtEle, vEle, bEle, null, tiEle, pEle, tEle, aEle);
}

function toggleStopWatchDuration (datum, dauer, ticket, projekt, task, aktivitaet) {
	var dtEle = stopForm[datum];
	var dEle = stopForm[dauer];
	var tiEle = stopForm[ticket];
	var pEle = stopForm["MS_"+projekt];
	if (!pEle) {
		pEle = stopForm["KS_"+projekt];
	}
//	pEle = stopForm[projekt];
	var tEle = stopForm[task];
	var aEle = stopForm[aktivitaet];
	
	ajax_toggleStopWatch (dtEle, null, null, dEle, tiEle, pEle, tEle, aEle);
}

function selectAllCB (ele) {
	var form = ele.form;
	for(var i=0; i < form.length;++i) {
		if (form.elements[i].type == "checkbox") {
			var e = form.elements[i];
			if (e != ele) {
				e.checked = true;
				if (e.onclick) {
					e.onclick ();
				}
			}
		}
	}
	ele.checked=false;
	return (false);
}

function toggleAllCB (ele, prefix, idPostfix) {
	var isChecked = ele.checked;
	var form = ele.form;
	for(var i=0; i < form.length;++i) {
		if (form.elements[i].type == "checkbox") {
			var e = form.elements[i];
			if (e != ele) {
				if ((prefix != null) && (e.name.indexOf (prefix) != 0)) {
					 // nur checkboxen mit dem angegebenen Prefix umschalten
					 continue;
				}
				if ((idPostfix != null) && (e.id.lastIndexOf (idPostfix) != e.id.length-idPostfix.length)) {
					 // nur checkboxen mit dem angegebenen Postfix in der ID umschalten
					 continue;
				}
				e.checked = isChecked;
				if (e.onclick) {
					e.onclick ();
				}
			}
		}
	}
//	ele.checked=false;
	return (false);
}

/** führt ein Link aus und setzt das Bitte warten Logo */
function ExecuteLinkItem(href ) {
	ShowWaitLogoOnUnload();
	location.href = href;
	return false;
}

function ShowWaitLogoOnUnload() {
	// Ab Firefox 3.5.7
	try {
		if ( Calendar ) {
				Calendar.Hide();
		}
	} catch(e){
	}
	try {
		HideAllPortlets();
		shownewwait();
	} catch(e){
	}
}


var plannerChangeContraintTimer = false;

function plannerChangeContraint() {
	if (!plannerChangeContraintTimer) {
		plannerChangeContraintTimer = window.setTimeout('plannerChangeContraintNow(true)',100);
	}
	return true;
}

function plannerChangeContraintNow(f) {
	var von = document.getElementsByName('KD_vondatum');
	if (von && von.length>0) {
		von = von[0];
	} else {
		return;
	}
	var bis = document.getElementsByName('KD_bisdatum');
	if (bis && bis.length>0) {
		bis = bis[0];
	} else {
		return;
	}
	
	var lb = document.getElementsByName('KS_typ');
	var v = (lb && lb.length>0) ? lb[0].value : 0;
	
	window.status = 'Von :'+von.name+"\nBis :"+bis.name+"\nV: "+v;
	
	von.disabled = false;
	bis.disabled = false;
	
	if ( v==2 || v==5 || v==6 ) {
		von.disabled = true;
		try { if (f) { bis.focus(); } } catch(ex) {}
	} 
	else
	if ( v==1 || v==3 || v==4 ) {
		bis.disabled = true;
		try { if (f) { von.focus(); } } catch(ex) {}
	}
	
	/* nun angehaengtes Datumsfeld aktivieren */
	if (false) {
		// zugehoerige Datumsfelder ausblenden
		{
			var id = von.id;
			if (id) {
				var link = document.getElementById(id+'_icon');
				if (link) {
					link.style.visibility = von.disabled ? 'hidden' : 'visible';
				}
			}
		}
		{
			var id = bis.id;
			if (id) {
				var link = document.getElementById(id+'_icon');
				if (link) {
					link.style.visibility = bis.disabled ? 'hidden' : 'visible';
				}
			}
		}
	}
	
	plannerChangeContraintTimer = false;
}

function isInClazz (searchClazz, ele) {
	if ( true ) {
		return false;
	}
	var parent = ele.parentNode;
	if (ele == document.body) {
		return (false);
	}
	var clazz = MS ? ele.className : ele.getAttribute("class");
	if ((clazz == searchClazz)) {
		return (true);
	} else {
		return (isInClazz (searchClazz,parent));
	}
}



function isInPortlet (ele) {
//		debugWindow ("isInPortlet ele="+ele);
	var parent = ele.parentNode;
	if (ele == document.body) {
//		debugWindow ("isInPortlet=FALSE");
		return (false);
	}
	var clazz = MS ? ele.className : ele.getAttribute("class");
	if (clazz == "Portlet") {
//		debugWindow ("isInPortlet=TRUE");
		return (true);
	} else {
		return (isInPortlet (parent));
	}
}

function sendRessourcemanagerUnsuccessful() {
	var e;
	var field;
	var newField;
	e = document.getElementById('form_ressourcemanager_edit');
	if ( e ) {
		field = document.getElementById("state_description");
		if ( field ) {
			newField = document.createElement("input");
			newField.setAttribute("type","hidden");
			newField.setAttribute("name",field.name);
			newField.setAttribute("value",field.value);
			e.appendChild(newField)
		}
		e.submit();
	}
	
	 return false;
}

function sendRessourcemanagerEnquiry() {
	var e=document.getElementById('ressourcemanager_save_enquire'); 
	if ( !e ) {
		var e = document.getElementById('form_ressourcemanager_enquire');
		if ( e ) {
			e.submit();
		}
	} else {
		// Button drücken 
		e.click(); 
		// und formular senden
		e.form.submit(); 
	}
	return true;
}



var Toolbar = function() {
	var	timer;
	var	openTimer;
	var globalTimer;
	var errorTimer;
	var warningTimer;
	var	menu;
	var timeout = 10000;
}

Toolbar.prototype.showToolbarMenue = function (toolbarID) {
	if (this.timer) {
		window.clearTimeout(this.timer);
	}
	if (this.menu) {
		this.menu.style.display = 'none';
	}
	this.menu = document.getElementById (toolbarID);
	this.menu.style.display="block";
	
	if (!pb.ie) {
		this.menu.style.top = "0px"
		this.menu.style.left = "8px"
	}
	this.hideElements (this.menu);
}

Toolbar.prototype.showBottomToolbarMenue = function (toolbarID) {
	if (this.timer) {
		window.clearTimeout(this.timer);
	}
	if (this.menu) {
		this.menu.style.display = 'none';
	}
	this.menu = document.getElementById (toolbarID);
	this.menu.style.display="block";
/*
	var img = this.menu.getElementsByTagName ("IMG")[0];
	this.calcAbsolutePosition (img);
	var left = this.absX;
	var bottom = this.absY;
*/
//	debugWindow ("top=-"+this.menu.clientHeight);
	this.menu.style.top = -this.menu.clientHeight+"px";
	this.hideElements (this.menu);
}

Toolbar.prototype.hideToolbarMenue = function (toolbarID) { 
	if (pb.ie6) {
		this.currentelement = document.getElementById (toolbarID);
		this.showElements ();
	} else {
		var cmd = "document.getElementById ('"+toolbarID+"').style.display = 'none';";
		this.timer = window.setTimeout(cmd, 200);
	}
}

Toolbar.prototype.openToolbar = function () {
	if (this.openTimer) {
		window.clearTimeout(this.openTimer);
	}

	//	var cmd = "document.getElementById('toolbar_info').style.display='"+ (pb.ie ? "block" : "table-row")+"';";
	var cmd = "document.getElementById('toolbar_info').style.display='block';";
	this.openTimer = window.setTimeout(cmd, 200);
}

Toolbar.prototype.openBottomToolbar = function () {
	if (this.openTimer) {
		window.clearTimeout(this.openTimer);
	}

	var cmd = "toolbar._openToolbar();";
	this.openTimer = window.setTimeout(cmd, 200);
}

Toolbar.prototype._openToolbar = function () {
	document.getElementById('bottom_toolbar_content').style.display="block";
	window.location.href="#bottom_toolbar";
	return;
	var body = document.getElementById('root');

	var scrollX = body.offsetWidth;
	var scrollY = body.offsetHeight;
	debugWindow ("_openToolbar: scrollX="+scrollX+", scrollY="+scrollY);
	window.scroll (0, scrollY);
}

Toolbar.prototype.closeToolbar = function () {
	var checked = (document.getElementById ('fixed_toolbar').style.backgroundImage.indexOf('close') > 0);

	if (!checked) {
		if (this.openTimer) {
			window.clearTimeout(this.openTimer);
		}
		this.openTimer = window.setTimeout("toolbar._closeToolbar('toolbar_info')", 200);
	}
}

Toolbar.prototype.closeBottomToolbar = function () {
	if (this.openTimer) {
		window.clearTimeout(this.openTimer);
	}
	this.openTimer = window.setTimeout("toolbar._closeToolbar('bottom_toolbar_content')", 200);
}

Toolbar.prototype._closeToolbar = function (eleID) {
	if (this.timer) {
		window.clearTimeout(this.timer);
	}
	if (this.menu) {
		this.menu.style.display = 'none';
	}
	if (this.openTimer) {
		window.clearTimeout(this.openTimer);
	}
	var cmd = "document.getElementById ('"+eleID+"').style.display = 'none';";
	this.openTimer = window.setTimeout(cmd, 200);
}

Toolbar.prototype.toggleToolbar = function (ele) {
	/* Image */
	var checked = (ele.src.indexOf('close') > 0);

	/* Checkbox */
	/*
	var checked = ele.checked;
	 */
	 
	ajax_setToolbarState (checked);
	if (checked) {
		ele.src = __imageadresse__+"toolbar_open.gif";
		this.closeToolbar ();
	} else {
		ele.src = __imageadresse__+"toolbar_close.gif";
		this.openToolbar ();
	}

/* Checkbox
	ajax_setToolbarState (ele.checked);
	if (ele.checked) {
		this.openToolbar ();
	} else {
		this.closeToolbar ();
	}
*/
}

Toolbar.prototype.toggleToolbarDiv = function (ele) {
	/* Image */
	var imgUrl = ele.style.backgroundImage;
	var checked = (imgUrl.indexOf('close') > 0);

	ajax_setToolbarState (checked);
	if (checked) {
		ele.style.backgroundImage = "url("+__imageadresse__+"toolbar_open.gif)";
		this.closeToolbar ();
	} else {
		ele.style.backgroundImage = "url("+__imageadresse__+"toolbar_close.gif)";
		this.openToolbar ();
	}
}


Toolbar.prototype.clearToolbarMessageTimer = function (id) {
//	debugWindow ("clearToolbarMessageTimer ("+id+")");

	if (id == 'global_message_mask') {
		if (this.globalTimer && (this.globalTimer != null)) {
			window.clearTimeout(this.globalTimer);
			this.globalTimer = null;
		}
	} else if (id == 'error_mask') {
		if (this.errorTimer && (this.errorTimer != null)) {
			window.clearTimeout(this.errorTimer);
			this.errorTimer = null;
		}
	} else if (id == 'warning_mask') {
		if (this.warningTimer && (this.warningTimer != null)) {
			window.clearTimeout(this.warningTimer);
			this.warningTimer = null;
		}
	} else {
		if (this.openTimer && (this.openTimer != null)) {
			window.clearTimeout(this.openTimer);
			this.openTimer = null;
		}
	}
}

Toolbar.prototype.setToolbarMessageTimer = function (id) {
//	debugWindow ("setToolbarMessageTimer ("+id+")");
	this.clearToolbarMessageTimer (id);
//	if (this.openTimer) {
//		window.clearTimeout(this.openTimer);
//	}
	
	if (id == 'global_message_mask') {
		this.globalTimer = window.setTimeout("toolbar.hideToolbarMessage ('"+id+"')", 10000);
//		debugWindow ("globalTimer = "+this.globalTimer);
	} else if (id == 'error_mask') {
		this.errorTimer = window.setTimeout("toolbar.hideToolbarMessage ('"+id+"')", 10000);
//		debugWindow ("errorTimer = "+this.errorTimer);
	} else if (id == 'warning_mask') {
		this.warningTimer = window.setTimeout("toolbar.hideToolbarMessage ('"+id+"')", 10000);
//		debugWindow ("warningTimer = "+this.warningTimer);
	} else {
		this.openTimer = window.setTimeout("toolbar.hideToolbarMessage ('"+id+"')", 10000);
//		debugWindow ("openTimer = "+this.openTimer);
	}
//	this.openTimer = window.setTimeout("toolbar.hideToolbarMessage ('"+id+"')", 10000);
}

Toolbar.prototype.hideToolbarMessage = function (id) {
//	debugWindow ("hideToolbarMessage ("+id+")");

	if (document.getElementById ('fixed_toolbar')) {
		if (!document.getElementById ('fixed_toolbar').checked) {
			this.clearToolbarMessageTimer (id);
		}
	}

	var e = document.getElementById (id);
	if (e) {
		e.style.display = 'none';
	}
	e = document.getElementById (id+"_bottom");
	if (e) {
		e.style.display = 'none';
	}
}

Toolbar.prototype.calcAbsolutePosition = function(r) {
//	debugWindow ("calcAbsolutePosition: r="+r+", r.offsetHeight="+r.offsetHeight+", r.offsetTop="+r.offsetTop);
	
	var b = document.body;
	// vom Element die Absolutposition bestimmen
	this.absX = 0;
//	this.absY = r.offsetHeight;
	this.absY = 0;
	while (r && r!=b) {
		var i = parseInt(r.offsetTop);
		if (i) this.absY += i;
		i = parseInt(r.offsetLeft);
		if (i) this.absX += i;
		r = r.offsetParent;
//	debugWindow ("calcAbsolutePosition: r="+r+", r.tagName="+r.nodeName+", this.absX="+this.absX+", this.absY="+this.absY);
	}
}

Toolbar.prototype.hideElements = function (ele) {
	if (pb.ie6) {
		if (ele) {
			this.calcAbsolutePosition (ele);
			this.xPos = this.absX;
			this.yPos = this.absY;
//			this.width = ele.style.width;
//			this.height = ele.style.height;
//			this.xPos = ele.offsetLeft;
//			this.yPos = ele.offsetTop;
			this.width = ele.clientWidth;
			this.height = ele.clientHeight;
//			alert ("xPos="+this.xPos+", yPos="+this.yPos+", width="+this.width+", height="+this.height);
		}
		
		// nun die unter dem Element liegenden Listboxen holen und unsichtbar machen
		if (!this.hidden) {
			this.hidden = new Array();
			this.elements = new Array ();
			
			for (var j=0; j<document.forms.length; j++) {
				var myform = document.forms[j];
				for(i=0; i<myform.elements.length; i++) {
					var e = myform.elements[i];
					var mt = e.type;
					if (mt=='select-one' || mt=='select-multiple' || mt=='textarea') {
						this.elements.push (e);
					}
				}
			}
		}
		var o=10;
//		debugWindow ("hideElements x="+this.xPos.value+", y="+this.yPos.value+", w="+this.width+", h="+this.height+", o="+o);
//		var p1x1=this.xPos.value, p1x2=p1x1+parseInt (this.width)+o, p1y1=this.yPos.value, p1y2=p1y1+parseInt (this.height)+o;
//		debugWindow ("hideElements x="+this.xPos+", y="+this.yPos+", w="+this.width+", h="+this.height+", o="+o);
		var p1x1=this.xPos, p1x2=p1x1+parseInt (this.width)+o, p1y1=this.yPos, p1y2=p1y1+parseInt (this.height)+o;
		for(i=0; i<this.elements.length; i++) {
			var e = this.elements[i];
			this.calcAbsolutePosition(e);
			var p2x1=this.absX;
			var p2x2=p2x1+e.offsetWidth;
			var p2y1=this.absY;
			var p2y2=p2y1+e.offsetHeight;
//			debugWindow ("hideElements absX="+this.absX+", absY="+this.absY);
			if ( 
				(p2x1>=p1x1 && p2x1<=p1x2 && p2y1>=p1y1 && p2y1<=p1y2) || 
				(p2x1>=p1x1 && p2x1<=p1x2 && p2y2>=p1y1 && p2y2<=p1y2) || 
				(p2x2>=p1x1 && p2x2<=p1x2 && p2y1>=p1y1 && p2y1<=p1y2) || 
				(p2x2>=p1x1 && p2x2<=p1x2 && p2y2>=p1y1 && p2y2<=p1y2)
			) {
				e.style.visibility = 'hidden';
				this.hidden.push(e);
			}
		}
	}
}

Toolbar.prototype.showElements = function() {
	if (pb.ie6) {
		if (this.currentelement)
			this.currentelement.style.display = "none";
		if (this.hidden) {
			for(i=0; i<this.hidden.length; i++) {
				this.hidden[i].style.visibility = 'visible';
			}
			this.hidden = 0;
		}
		window.clearTimeout(this.timeout);
		this.timeout=0;
	}
}

function showBottomToolbar () {
	var ele = document.getElementById('bottom_toolbar');
	var body = document.getElementById('root');

	if (body && ele && ele.style) {
		if (body.scrollHeight > body.clientHeight) {
			ele.style.display = "block";
		} else {
			ele.style.display = "none";
		}
	}
}

var toolbar = new Toolbar ();

var GuiTable = function() {
}

GuiTable.prototype.setup = function(id) {
	var parentElem = document.getElementById (id);
	
	var inputFields = parentElem.getElementsByTagName("input");

	for (var i = 0; i < inputFields.length; i++) {
		var type = inputFields[i].getAttribute ("type");
		if (type == "checkbox") {
 			inputFields[i].onclick=this.eventHandler;
 			inputFields[i].setAttribute ("oldValue", inputFields[i].checked)
		} else if (type == "submit") {
 			inputFields[i].onclick=this.eventHandler;
 			inputFields[i].setAttribute ("oldValue", inputFields[i].value)
		} else {
 			inputFields[i].onblur=this.eventHandler;
 			inputFields[i].setAttribute ("oldValue", inputFields[i].value)
// 			inputFields[i].onchange=this.eventHandler;
		}
	}
	
	var inputFields = parentElem.getElementsByTagName("textarea");

	for (var i = 0; i < inputFields.length; i++) {
		inputFields[i].onblur=this.eventHandler;
		inputFields[i].setAttribute ("oldValue", inputFields[i].value)
	}

	var inputFields = parentElem.getElementsByTagName("select");

	for (var i = 0; i < inputFields.length; i++) {
		debugWindow ("GuiTable.setup: select="+inputFields[i].id);
		inputFields[i].onblur=this.eventHandler;
		inputFields[i].onchange=this.eventHandler;
		inputFields[i].setAttribute ("oldValue", inputFields[i].value)
	}
}

GuiTable.prototype.eventHandler = function(evt) {
//	alert ("GuiTable.eventHandler (evt="+evt+")");
	// Event tweaks, since IE wants to go its own way...
	var event = evt || window.event;
	var target = event.target || event.srcElement;
	var tID = target.id;
	
//	debugWindow("nodeName"+target.nodeName);
	if (target.nodeName == "INPUT") {
		if ("checkbox" == target.getAttribute ("type")) {
			if (target.checked != target.getAttribute ("oldValue")) {
				ajax_GuiTableChanged(target);
				var text1 = "ID: " + tID+"\n";
				var text2 = "Checked: " + target.checked;
				debugWindow("\n\nOnClick\n"+text1+text2);
				target.setAttribute ("oldValue", target.checked)
			}
			return (true);
		} else if ("submit" == target.getAttribute ("type")) {
				ajax_GuiTableChanged(target);
			var text1 = "ID: " + tID+"\n";
			var text2 = "Value: " + target.value;
			debugWindow("\n\nOnClick\n"+text1+text2);
			return (true);
		} else {
//			debugWindow("\n\nOnBlur\n"+"Value: " + target.value+"OldValue: " + target.getAttribute ("oldValue"));
			if (target.value != target.getAttribute ("oldValue")) {
				ajax_GuiTableChanged(target);
				var text1 = "ID: " + tID+"\n";
				var text2 = "Value: " + target.value+"\n";
				var text3 = "OldValue: " + target.getAttribute ("oldValue")+"\n";
				debugWindow("\n\nOnChange\n"+text1+text2+text3);
				target.setAttribute ("oldValue",target.value)
			}
			return (false);
		}
	} else if (target.nodeName == "TEXTAREA") {
		if (target.value != target.getAttribute ("oldValue")) {
			ajax_GuiTableChanged(target);
			var text1 = "ID: " + tID+"\n";
			var text2 = "Value: " + target.value+"\n";
			var text3 = "OldValue: " + target.getAttribute ("oldValue")+"\n";
			debugWindow("\n\nOnChange\n"+text1+text2+text3);
			target.setAttribute ("oldValue", target.value)
		}
		return (false);
	} else if (target.nodeName == "SELECT") {
		if (target.value != target.getAttribute ("oldValue")) {
			ajax_GuiTableChanged(target);
			var text1 = "ID: " + tID+"\n";
			var text2 = "Value: " + target.value+"\n";
			var text3 = "OldValue: " + target.getAttribute ("oldValue")+"\n";
			debugWindow("\n\nOnChange\n"+text1+text2+text3);
			target.setAttribute ("oldValue", target.value)
		}
		return (false);
	}
};

var guiTable = new GuiTable ();


function onGuiTableCellHandler (evt) {
}
/**
 * Setzt für die GuiTable den onClickHandle
 */
function addOnClick (id) {
	guiTable.setup(id);
}


function ticketSelectAll(element) {
	var checked = element.checked;
	var id = element.id;
	var a = document.getElementsByTagName("input");
	for(var i=0; i<a.length; i++) {
		var e = a[i];
		if (e.type=='checkbox' && e.id.substring(0,id.length) == id && e.checked != checked) {
			e.click();
		}
	}
}



//String netCalcFormula   = "document.getElementById('"+FIELD_CALC_NET+"').value   = eval( document.getElementById('"+FIELD_CALC_GROSS+"').value + ' * (100 - ' + document.getElementById('"+FIELD_CALC_TAX+"').value + ') / 100 ' )";
function calcVoucherNet(prefix) {
	formSent = false;
	if (!ajax_FieldValidation ([prefix+'voucherGrossAmount', prefix+'voucherNetAmount'])) return;
//	if (!ajax_validation(document.getElementById('voucherGrossAmount').form, true)) return;
	

	var grossAmount = toEn(document.getElementById(prefix+'voucherGrossAmount').value);
	var tax = toEn(document.getElementById(prefix+'voucherVat').value);
	var net = eval(grossAmount + ' * 100 / ( 100 + ' + tax + ') ');
	net = Math.round (net*100) / 100; // kaufmännisch runden
	document.getElementById(prefix+'voucherNetAmount').value = toLocal(net);
	
	//Fakturierungsbetrag
	var _accountable = document.getElementById(prefix+'_accountable').value;
	if ('1' == _accountable) {
		document.getElementById(prefix+'voucherInvoiceAmount').value = toLocal(net);
	} else {
		if ('0' == _accountable) {
			document.getElementById(prefix+'voucherInvoiceAmount').value = toLocal(0);
		}
	}
	
}

function calcVoucherNetCalc(prefix) {
	formSent = false;
	if (!ajax_validation(document.getElementById(prefix+'voucherCalcGrossAmount').form, true)) return;
	
	var grossAmount = toEn(document.getElementById(prefix+'voucherCalcGrossAmount').value);
	var tax = toEn(document.getElementById(prefix+'voucherCalcTaxAmount').value);
//	var net = eval(grossAmount + ' * ( 100 - ' + tax + ') / 100 ');
	var net = eval(grossAmount + ' * 100 / ( 100 + ' + tax + ') ');
	document.getElementById(prefix+'voucherCalcNetAmount').value = toLocal(net);
}

//String milageAllowanceFormula = "document.getElementById('"+FIELD_CALC_SUM+"').value = eval( document.getElementById('"+FIELD_CALC_DISTANCE_IN_KM+"').value + ' * ' + document.getElementById('"+FIELD_CALC_MILAGE_ALLOWANCE+"').value )";
function calcVoucherMilage(prefix) {
	formSent = false;
	if (!ajax_validation(document.getElementById(prefix+'voucherCalcDistanceInKm').form, true)) return;

	var km = toEn(document.getElementById(prefix+'voucherCalcDistanceInKm').value);
	var ma = toEn(document.getElementById(prefix+'voucherCalcMilageAllowance').value);
	var sum = eval(km + ' * ' + ma);
	sum = Math.round (sum*100) / 100; // kaufmännisch runden
	document.getElementById(prefix+'voucherCalcMilageSumAmount').value = toLocal(sum);
}

function setDateInField (fieldID, dateAsString) {
	var ele = document.getElementById (fieldID);
	if (ele) {
		ele.value = dateAsString;
//		if (ele.onchange) {
//			ele.onchange ();
//		}
		$('#'+fieldID).change();
	}
	var p = pb.elements['dateCalendar'];
	if (p) {
		p._close ();
	}
	
}

/** Wenn ein Bild  eine dynamische Größenanpassung existiert, werden sie Hiermit neu vom Server vergrößert
 * 
 */
function reloadDynamicImage(id) {
	var e;
	var r;
	var nHeight;
	var nWidth;
	var nTop;
	
	e=document.getElementById(id);
	if ( e ) {
		var b = document.body;
		var cHeight = b.clientHeight;
		nWidth = b.clientWidth;
		nHeight = 0;
		nTop = 0;

		r = e;		
		while (r && r!=b) {
			var i = parseInt(r.offsetTop);
			if (i) {
				nTop += i;
			}
			r = r.offsetParent;
		}
		if ( nTop > 0  ) {
			nHeight = cHeight - nTop -30;
			if ( nHeight < 50 ) {
				nHeight=0;
			}
		}
//		debugWindow("nWidth="+nWidth+" nHeight="+nHeight+" nTop="+nTop);
		e.src=e.getAttribute("customsrc")+"&width="+nWidth+"&height="+nHeight;
	}
}

/**
 *  Die Checkbox vor dem Feld steuert, ob dieses enabled ist oder nicht
 *  Bisher nur für FormInteger implementiert  
 */
function ajax_enableParent (cbID, fieldID) {
	var cb = document.getElementById (cbID);
	var field = document.getElementById (fieldID);
	
	if (cb && field) {
		if (cb.checked) {
	//		var oldMandatory = field.getAttribute ("oldMandatory");
			_enableField (field)
		} else {
			_disableField (field)
		}
	}
}

 /**
  * Zeigt das Element mit dieser ID (display = "").
  * @param id - Element-ID
  */ 
 function showElementById(id) {
 	var e = document.getElementById(id);
 	if(e)
 		e.style.display = "";
 }

 /**
 * Versteckt das Element mit dieser ID (display = "none").
 * @param id - Element-ID
 */ 
 function hideElementById(id) {
 	var e = document.getElementById(id);
 	if(e)
 		e.style.display = "none";
 }

 /**
 * Löscht den inneren HTML-Inhalt des Element mit dieser ID (innerHTML = "").
 * @param id - Element-ID
 */ 
 function cleanElementById(id) {
 	var e = document.getElementById(id);
 	if(e)
 		e.innerHTML = "";
 }

 /**
 * Gibt zu einem IFrame das darin liegende Dokument zurück. 
 * Es wird das Iframe-Objekt erwartet. Dieses muss vollständig initialisert sein.
 * @param iframe - iframe-Instanz
 * @return document-Instanz
 */
 function getIframeDocument(iframe) {
 	if(!iframe)
 		return null;
 	
 	return iframe.contentWindow != undefined ? iframe.contentWindow.document : iframe.document;
 }
 
 /**
 * Schaltet die Deaktivierung eines per ID identifizierten Date-Formelements und seines DatepickerIcons um.
 * War es disabled, wird es enabled, sonst andersherum.
 * @param id - ID des umzuschaltenden Felds
 * @return void
 */
 function switchDateFieldDisable(id) {
	 var field = document.getElementById(id);
	 var icon = document.getElementById(id + "_icon");
	 
	 if(field && icon) {
		 if(field.disabled) {
			 field.disabled="";
			 icon.removeAttribute("onclick");
		 } else {
			 field.disabled="disabled";
			 field.value="";
			 icon.setAttribute("onclick", "return false;");
		 }
	 }
 }

 
	 /*
	  * Licensed under the terms of the GNU Lesser General Public License:
	  * 		http://www.opensource.org/licenses/lgpl-license.php
	  * 
	  * File Name: toggleFCKeditor.js
	  * toggleFCKeditor function
	  * For more information on the script, see http://www.saulmade.nl/FCKeditor/FCKSnippets.php
	  * 
	  * File Authors:
	  * 		Paul Moers (http://www.saulmade.nl, http://www.saulmade.nl/FCKeditor/FCKPlugins.php)
	  *
	  * Special thanks to Paul York for supporting me!
	 */
 	// config

 	// what do we do with the toolbar when disabling the editor. Possibilities are 'disable', 'hide', 'collapse'.
 	// When collapsed the toolbar can be expanded again by the user, but he'll find a disabled toolbar.
 	var toolbarDisabledState = "hide";

 	function toggleFCKeditor(editorInstance)
 	{
 		if ((!document.all && editorInstance.EditorDocument.designMode.toLowerCase() != "off") || (document.all && editorInstance.EditorDocument.body.disabled == false))
 		{
 			// disable the editArea
 			if (document.all)
 			{
 				editorInstance.EditorDocument.body.disabled = true;
 			}
 			else
 			{
 				editorInstance.EditorDocument.designMode = "off";
 			}
 			// disable the toolbar
 			switch (toolbarDisabledState)
 			{
 				case "collapse" :		editorInstance.EditorWindow.parent.FCK.ToolbarSet._ChangeVisibility(true);
 				case "disable" :		editorInstance.EditorWindow.parent.FCK.ToolbarSet.Disable();
 											buttonRefreshStateClone = editorInstance.EditorWindow.parent.FCKToolbarButton.prototype.RefreshState;
 											specialComboRefreshStateClone = editorInstance.EditorWindow.parent.FCKToolbarSpecialCombo.prototype.RefreshState;
 											editorInstance.EditorWindow.parent.FCKToolbarButton.prototype.RefreshState = function(){return false;};
 											editorInstance.EditorWindow.parent.FCKToolbarSpecialCombo.prototype.RefreshState = function(){return false;};
 											break;
 					case "hide" :		if (editorInstance.EditorWindow.parent.document.getElementById("xExpanded").style.display != "none")
 											{
 												editorInstance.EditorWindow.parent.document.getElementById("xExpanded").isHidden = true;
 												editorInstance.EditorWindow.parent.document.getElementById("xExpanded").style.display = "none";
 											}
 											else
 											{
 												editorInstance.EditorWindow.parent.document.getElementById("xCollapsed").style.display = "none";
 											}
 											break;
 			}
 		}
 		else
 		{
 			// enable the editArea
 			if (document.all)
 			{
 				editorInstance.EditorDocument.body.disabled = false;
 			}
 			else
 			{
 				editorInstance.EditorDocument.designMode = "on";
 			}
 			// enable the toolbar
 			switch (toolbarDisabledState)
 			{
 				case "collapse" :		editorInstance.EditorWindow.parent.FCK.ToolbarSet._ChangeVisibility(false);
 				case "disable" :		editorInstance.EditorWindow.parent.FCK.ToolbarSet.Enable();
 											editorInstance.EditorWindow.parent.FCKToolbarButton.prototype.RefreshState = buttonRefreshStateClone;
 											editorInstance.EditorWindow.parent.FCKToolbarSpecialCombo.prototype.RefreshState = specialComboRefreshStateClone;
 											break;
 					case "hide" :		if (editorInstance.EditorWindow.parent.document.getElementById("xExpanded").isHidden == true)
 											{
 												editorInstance.EditorWindow.parent.document.getElementById("xExpanded").isHidden = false;
 												editorInstance.EditorWindow.parent.document.getElementById("xExpanded").style.display = "";
 											}
 											else
 											{
 												editorInstance.EditorWindow.parent.document.getElementById("xCollapsed").style.display = "";
 											}
 											break;
 			}
 			// set focus on editorArea
 			editorInstance.EditorWindow.focus();
 			// and update toolbarset
 			editorInstance.EditorWindow.parent.FCK.ToolbarSet.RefreshModeState();
 		}
 	}

/**
 * Prüft, ob eines der per Liste angegebenen Inputfelder den angegebenen
 * Wert enthält. In diesem Fall wird true zurückgegeben.
 * <p/>
 * Die Liste muss die IDs der zu prüfenden Felder enthalten.  
 * @return boolean
 */
function checkOneInputForValue(list, value, message) {
	
	var needConfirm = false;
	if(list && list.length && list.length > 0) {
		for(var i = 0; i < list.length; i++) {
			var element = document.getElementById(list[i]);
			if(element) {
				if(element.value == value) {
					needConfirm = true;
					break;
				}
			}
		}
	}
	
	if(needConfirm) {
		return confirm(message);
	} 	
	return true;
}

/** Positioniert das absolut Positionierte "div" in dem Formular hinein
 * 
 * @param id des absolut-Positionierten div's
 */
function positionFormular(id) {
	var idTD = document.getElementById(id);
	if ( idTD  ) {
		var cTop=0;
		var e=idTD.parentNode;
		while ( e && e != document.body ) {
			try {
				oTi = parseInt(e.offsetTop);
				cTop += oTi;
			} catch(e0){alert(e0);}
			e = e.offsetParent;
		}
		if ( cTop > 0 )  {
			idTD.style.top=cTop+"px";
		}
	}
}


/**
 * Aktualisiert das Abwesenheits-Erfassungspopup bei Änderung.
 * @param ele - Element
 */
function changeAbsence (ele) {
	var isDay = absenceIsDay[ele.value];
	var isHour = (isDay && (isDay == 1)) ? 0 : 1;

	if (typeof isDay == "undefined") {
		isDay = 1;
		isHour = 1;
	}

	enableAbsenceField ("from_time", isHour);
	enableAbsenceField ("to_time", isHour);
	enableAbsenceField ("to", isDay);
	if (isHour == 1) {
		document.getElementById ("to").value = "";
	}

	document.getElementById ("to_icon").style.visibility= ((isDay == 1) ? "visible" : "hidden" );
	document.getElementById ("to_dummy_icon").style.visibility= ((isDay == 1) ? "visible" : "hidden" );
	document.getElementById ("plan").style.display= (((holidayID != ele.value)) ? "none" : "inline" );
	enableAbsenceField ("day_mode", (holidayID == ele.value));
	
	
	var titleInput = document.getElementById("absence_title");
	var newInput = ele[ele.selectedIndex].text;
	if (!(titleInput.value && (titleInput.value.length > 0))) {
		if(titleInput && newInput) {
			titleInput.value = newInput;
		}
	}
}

/**
 * Aktiviert / deaktiviert ein HTML-Element.
 * @param id - ID
 * @param enable - 
 * @return
 */
function enableAbsenceField (id, enable) {
	var e = document.getElementById (id);
	if (e) {
		if (enable == 1) {
			_enableField (e);

			var opt = e.options;
			if (opt && (e.selectedIndex < 0)) {
				var val="1";

				for (var i = 0; i < e.options.length; i++) {
					if (opt[i].value == val) {
						e.selectedIndex = i;
						break;
					}
				}
			}
		} else {
			e.value = "";
			_disableField (e);
		}
	}

}

CalendarReposition = function(elementid) {
	var ele = document.getElementById (elementid);
	var yPos = parseInt(ele.style.top);
	var height = parseInt(ele.style.height);
	var xPos = parseInt(ele.style.left);
	var width = parseInt(ele.style.height);
	
	var ww,wh,sbx,sby;
	var mybody = document.body;
	if ($.browser.msie) {
		wh = parseInt( mybody.offsetHeight );
		sby = mybody.scrollTop;
		ww = parseInt( mybody.offsetWidth );
		sbx = mybody.scrollLeft;
	} else {
		wh = parseInt( window.innerHeight );
		sby = window.pageYOffset;
	}

	// nun die Zielposition bestimmen
	var newy = yPos;
	if (yPos+height>wh)	{
		newy = yPos-height-35;
		if (newy > 0) {
			ele.style.top = newy+"px"; 
		}
	} else if ($.browser.msie) {
		ele.style.top = yPos+sby+"px"; 
	}
}

/* Fügt einen Defaultbutton, 1. Button dem action hinzu, falls sentButton null ist. Diese Variable wird beim drücken des Button's gesetzt 
 * @param f Formular
 * @param btnName Name des Buttons der gesendet werden soll
 * Bug 14210: Wenn in ein Formular mehr als ein Button vorhanden ist, sendet
 */
var sentButton=null;
function sendDefaultButton(f, btnName) {
	if ( sentButton == null ) {
		f.action = f.action +"&"+btnName+"=1";
	}
	return true;
}

RepositionXY = function(elementid) {
	var ele = $('#'+elementid);
	var position = ele.position();
	var xPos = parseInt(position.left);
	var yPos = parseInt(position.top);
	var height = parseInt(ele.height());
	var width = parseInt(ele.width());
	
	var ww;		// WindowWidth
	var wh;		// WindowHeight
	var sbx;	// ScrollBarX
	var sby;	// ScrollBarY
	var mybody = document.body;
	if ($.browser.msie) {
		wh = parseInt( mybody.offsetHeight );
		sby = mybody.scrollTop;
		ww = parseInt( mybody.offsetWidth );
		sbx = mybody.scrollLeft;
	} else {
		ww = parseInt( window.innerWidth );
		wh = parseInt( window.innerHeight );
		sbx = window.pageXOffset;
		sby = window.pageYOffset;
	}
	
//	debugWindow ("pb.e.x="+pb.e.x+", pb.e.y="+pb.e.y);
//	debugWindow ("xPos="+xPos+", yPos="+yPos+", width="+width+", height="+height);
//	debugWindow ("ww="+ww+", wh="+wh+", sbx="+sbx+", sby="+sby);

	// nun die Y-Zielposition bestimmen
	var newy = yPos;
	if (yPos+height>wh)	{
		newy = yPos-height-35;
		if (newy > sby) {
			ele.css( { "top":newy + "px" } );
		}
	} else if ($.browser.msie) {
		newy = yPos+sby;
		ele.css( { "top":newy + "px" } );
	}
	// nun die X-Zielposition bestimmen
	var newx = xPos;
	if (xPos+width>ww)	{
		newx = xPos-width-10;
		if (newx > 0) {
			ele.css( { "left":newx + "px" } );
		}
	} else if ($.browser.msie) {
		newx = xPos+sbx;
		ele.css( { "left":newx + "px" } );
	}
//	debugWindow ("newy="+newy+", newx="+newx);
}


/* JsInclude file=dms.js */

var DHTML = 0, DOM = 0, MS = 0, NS = 0, OP = 0,KONQ=0;
var MousePositionX = 0, MousePositionY = 0;
var OldBG = "";
var laufstatustext = "";
var laufstatus     = 0;
var laufindex      = 1; 
var WaitLogoImage  = 0;
var WaitLogoTimer = null;

window.status="";
window.defaultstatus="";

function startwait() {
	WaitLogoTimer = window.setTimeout("shownewwait()",1000);
}

function shownewwait() {
	try {
		document.getElementById("bodymaintable").style.display="none";
		document.getElementById("newwaitlogoDiv").style.display="";
	} catch (ex) {
		return;
	}
}

function hideWaitLogo() {
	try {
		if (WaitLogoTimer)
			window.clearTimeout(WaitLogoTimer);
		WaitLogoTimer = null;
		document.getElementById("newwaitlogoDiv").style.display='none';
		document.getElementById("bodymaintable").style.display='block';
	} catch (ex) {
		return;
	}
}

function DHTML_init() {

 if (window.opera) {
     OP = 1;
 }
 if(document.getElementById) {
   DHTML = 1;
   DOM = 1;
 }
 if(document.all && !OP) {
   DHTML = 1;
   MS = 1;
 }
if (window.netscape && window.screen && !DOM && !OP){
   DHTML = 1;
   NS = 1;
 }
 
 if ( navigator.appName != null && navigator.appName.indexOf("Konqueror") != -1) {
   KONQ = 1;
 }
  
}

function getElem(p1,p2,p3) {
 var Elem;
 if(DOM) {
   if(p1.toLowerCase()=="id") {
     if (typeof document.getElementById(p2) == "object")
     Elem = document.getElementById(p2);
     else Elem = void(0);
     return(Elem);
   }
   else if(p1.toLowerCase()=="name") {
     if (typeof document.getElementsByName(p2) == "object")
     Elem = document.getElementsByName(p2)[p3];
     else Elem = void(0);
     return(Elem);
   }
   else if(p1.toLowerCase()=="tagname") {
     if (typeof document.getElementsByTagName(p2) == "object" || (OP && typeof document.getElementsByTagName(p2) == "function"))
     Elem = document.getElementsByTagName(p2)[p3];
     else Elem = void(0);
     return(Elem);
   }
   else return void(0);
 }
 else if(MS) {
   if(p1.toLowerCase()=="id") {
     if (typeof document.all[p2] == "object")
     Elem = document.all[p2];
     else Elem = void(0);
     return(Elem);
   }
   else if(p1.toLowerCase()=="tagname") {
     if (typeof document.all.tags(p2) == "object")
     Elem = document.all.tags(p2)[p3];
     else Elem = void(0);
     return(Elem);
   }
   else if(p1.toLowerCase()=="name") {
     if (typeof document[p2] == "object")
     Elem = document[p2];
     else Elem = void(0);
     return(Elem);
   }
   else return void(0);
 }
 else if(NS) {
   if(p1.toLowerCase()=="id" || p1.toLowerCase()=="name") {
   if (typeof document[p2] == "object")
     Elem = document[p2];
     else Elem = void(0);
     return(Elem);
   }
   else if(p1.toLowerCase()=="index") {
    if (typeof document.layers[p2] == "object")
     Elem = document.layers[p2];
    else Elem = void(0);
     return(Elem);
   }
   else return void(0);
 }
 return void(0);
}

function getCont(p1,p2,p3) {
   var Cont;
   if(DOM && getElem(p1,p2,p3) && getElem(p1,p2,p3).firstChild) {
     if(getElem(p1,p2,p3).firstChild.nodeType == 3)
       Cont = getElem(p1,p2,p3).firstChild.nodeValue;
     else
       Cont = "";
     return(Cont);
   }
   else if(MS && getElem(p1,p2,p3)) {
     Cont = getElem(p1,p2,p3).innerText;
     return(Cont);
   }
   else return void(0);
}

function getAttr(p1,p2,p3,p4) {
   var Attr;
   if((DOM || MS) && getElem(p1,p2,p3)) {
     Attr = getElem(p1,p2,p3).getAttribute(p4);
     return(Attr);
   }
   else if (NS && getElem(p1,p2)) {
       if (typeof getElem(p1,p2)[p3] == "object")
        Attr=getElem(p1,p2)[p3][p4]
       else
        Attr=getElem(p1,p2)[p4]
         return Attr;
       }
   else return void(0);
}

function setCont(p1,p2,p3,p4) {
   if(DOM && getElem(p1,p2,p3) && getElem(p1,p2,p3).firstChild)
     getElem(p1,p2,p3).firstChild.nodeValue = p4;
   else if(MS && getElem(p1,p2,p3))
     getElem(p1,p2,p3).innerText = p4;
   else if(NS && getElem(p1,p2,p3)) {
     getElem(p1,p2,p3).document.open();
     getElem(p1,p2,p3).document.write(p4);
     getElem(p1,p2,p3).document.close();
   }
}

var FloatMenuItem = 0, FloatMenuRow, FloatMenuTimer=0;

function ShowFloatMenu( elementname, vis ) {
	var d;
	try {
		d = getElem("id",elementname,"");
		var a = d.parentNode.parentNode;
		if (vis==1) {
			if (FloatMenuTimer) { 
				window.clearTimeout(FloatMenuTimer);
			}
			FloatMenuTimer = 0;
			if ( (FloatMenuItem!=0) && (FloatMenuItem!=d) ) {
				HideFloatMenu();
			}
			if (d.style.display == "none") {
				if (MS) {
					d.style.left = MousePositionX + document.body.scrollLeft-5;
					d.style.top  = MousePositionY + document.body.scrollTop-5;
				} else {
					d.style.left = MousePositionX - 5;
					d.style.top  = MousePositionY - 5;
				}
				d.style.display = "";
				d.style.position = "absolute";
				a.style.backgroundColor = StyleDefinitions.getColorDef ("DMS_FloatMenuBackground"); // "999999";
				
				reposition(elementname);
			}
		} else {
			if ( (FloatMenuTimer==0) && (d.style.display != "none") ) {
				FloatMenuItem = d;
				FloatMenuRow = a;
				FloatMenuTimer=window.setTimeout("HideFloatMenu()",200);
			}
		}
	} catch (ex) {
		return;
	}
}

function reposition(elementname) {
	var ele = $('#'+elementname);
	var position = ele.position();
	var xPos = parseInt(position.left);
	var yPos = parseInt(position.top);
	var height = parseInt(ele.height());
	var width = parseInt(ele.width());
	
	var ww,wh,sbx,sby;
	var mybody = document.body;
	if (MS) {
		wh = parseInt( mybody.offsetHeight );
		sby = mybody.scrollTop;
		ww = parseInt( mybody.offsetWidth );
		sbx = mybody.scrollLeft;
	} else {
		wh = parseInt( window.innerHeight );
		sby = window.pageYOffset;
		ww = parseInt( window.innerWidth );
		sbx =  window.pageXOffset;
	}
	
	// nun die Zielposition bestimmen
	var newy = yPos;
	if (yPos+height>wh)	{
		newy = yPos-height-15;
		if (newy > 0) {
			ele.css( { "top":newy + "px" } );
		}
	} else if ($.browser.msie) {
		ele.css( { "top":(yPos+sby) + "px" } );
	}
	
}

function HideFloatMenu() {
	try {
		FloatMenuItem.style.display = "none";
		FloatMenuRow.style.backgroundColor = "";
		FloatMenuItem = 0;
		FloatMenuTimer = 0;
	} catch (ex) {
		alert("HideFloatMenu:"+ex);
	}
}

	
function SavePos(Ereignis) {
	if (window.event) {
		MousePositionX = window.event.clientX;
		MousePositionY = window.event.clientY;
	} else {
		MousePositionX = Ereignis.pageX;
		MousePositionY = Ereignis.pageY;
	}
	/*window.status="dada "+MousePositionX+":"+MousePositionY;*/
}

DHTML_init();
document.onmouseup = SavePos;
document.onmousemove = SavePos;
/* window.defaultStatus = "DHTML="+DHTML+" DOM="+DOM+" MS="+MS+" NS="+NS+" OP="+OP; */

function opennewurl( newurl, docloc ) {
	window.open( newurl, '_blank' );
	window.setTimeout("window.location.href='"+docloc+"'",1000);
	return false;
}

function showsearchwait(frm) {
	laufstatustext=getAttr("name","KT_suchtext",0,"value");
	laufstatus = 0;
	laufindex = 1;
	window.setInterval("Lauftext()",130);
	return true;
}

function Lauftext() {
	var txt="";
	var max=70;
	for(var i=0; i<laufstatus; i++) txt=txt+" ";

	window.status = txt+laufstatustext;

	laufstatus = laufstatus + laufindex;
	if (laufstatus<0) {
		laufstatus=0;
		laufindex=1;
	}
	if (laufstatus>max) {
		laufstatus=max;
		laufindex=-1;
	}
}

function treenodevis( elementname, minusimg, plusimg ) {
  var n=document.getElementById(elementname);
  var img=document.getElementById('img'+elementname);
  if (n) {
    if (n.style.display=="none") {
      n.style.display="";
      img.src=minusimg;
    } else {
      n.style.display="none";
      img.src=plusimg;
    }
  }
}

function activefirstfrmentry( frmname ) {
	var e = document.forms[frmname].elements;
	for( i=0; i<e.length; i++) {
		var q = e[i];
		if ( (q.type == "text") || (q.type=="checkbox") || (q.type=="textarea") ){
			q.focus();
			return;
		}
	}
}

function showwaitlogo() {
	return;
	
	var w = document.getElementById('waitlogo');
	if (!w) return;
	if (w.style.display=='none') {
		if (MS) {
			b = document.body;
			x = parseInt( (b.offsetWidth-parseInt(w.style.width))/2 ) + b.scrollLeft;
			y = parseInt( (b.offsetHeight-parseInt(w.style.height))/2 ) + b.scrollTop;
		} else {
			x = parseInt((parseInt(window.innerWidth)-parseInt(w.style.width))/2) + window.pageXOffset;
			y = parseInt((parseInt(window.innerHeight)-parseInt(w.style.height))/2) + window.pageYOffset;
		}
		w.style.left = x;
		w.style.top  = y;
		w.style.display='';
		document.getElementById('waitlogoimg').src = WaitLogoImage.src;
	} else {
		w.style.display='none';
	}
}

function dragdropshowselected( dragelement, ownerid, showit ) {
	var d;
	if (ownerid) {
		d = document.getElementById(ownerid);
	}
	if (showit) {
		dragelement.style.backgroundColor= StyleDefinitions.getColorDef ("DMS_DragDropShowitBackground"); // 'red';
		if (d) {
			d.style.borderLeft='1px solid ' + StyleDefinitions.getColorDef ("DMS_DragDropShowitBorder"); // #ffb2b2;
		}
	} else {
		dragelement.style.backgroundColor= StyleDefinitions.getColorDef ("DMS_DragDropBackground"); // 'white';
		if (d) {
			d.style.borderLeft='1px solid ' + StyleDefinitions.getColorDef ("DMS_DragDropBorder"); // white;
		}
	}
}

function getElementAbsolutTop(element) {
	var e = element;
	var i = 0;
	while (e && e.nodeName!="BODY") {
		i+=parseInt(e.offsetTop);
		e = e.parentNode;
	}
	return i;
}

/* JsInclude file=gantt.js */
var CookieClass = function() {
	this.cookievalues = 0;
	this.cookieexists = 0;
}

CookieClass.prototype.createcookie = function() {
	if (!this.cookievalues) {
		this.cookievalues = new Array();
	}
	var s = '';
	var expires = "; expires="+(new Date( (new Date()).getTime()+1000*3600*24*365 )).toGMTString()+";";
	for(var cookievalueskey in this.cookievalues) {
		s = s+cookievalueskey+'-'+this.cookievalues[cookievalueskey]+":";
	}
	document.cookie = "BLUEANTLOCAL="+s+expires;
}

CookieClass.prototype.readcookie = function(cookie)  {
	var s = cookie;
	var i,w;
	var a = /BLUEANTLOCAL=(\S+).*/;
	this.cookievalues = new Array();
	while ( s.length>0 ) {
		i = s.indexOf(";");
		if (i>0) {
			w = s.substr(0,i);
			s = s.substr(i+1,s.length);
		} else {
			w = s;
			s = '';
		}
		if (a.test(w)) {
			a.exec(w);
			var line = RegExp.$1;
			var l = /(\w+)-(\w+):?(.*)/;
			while (l.test(line)) {
				l.exec(line);
				this.cookievalues[RegExp.$1] = RegExp.$2;
				line = RegExp.$3;
			}
			this.cookieexists = 1;
		}
	}
}

CookieClass.prototype.initcookie = function() {
	if (!this.cookievalues) {
		var cookie = document.cookie;
		if (cookie)
			this.readcookie(cookie);
		if (!this.cookieexists) this.createcookie();
	}
}

CookieClass.prototype.get = function(key) {
	this.initcookie();
	if (this.cookievalues && this.cookievalues[key]) {
		return (this.cookievalues[key]);
	} else {
		return (null);
	}
}

CookieClass.prototype.set = function(key,value) {
	this.initcookie();
	this.cookievalues[key] = value;
	this.createcookie();
}

var GanttClass = function() {
	this.scrollcookiekey = 'plannernoscroll';
	this.NoScroll = Cookies.get(this.scrollcookiekey)=='1';
	this.timer = 0;
	this.timeline = 0;
	this.textmain = 0;
	this.togglelement = 0;
	this.lastYScrollPosition = 0;
}

GanttClass.prototype.Activate = function() {
	this.timer = window.setInterval("Gantt.MakeVisible()",100);
}

GanttClass.prototype.MakeVisible = function() {
	if (this.NoScroll) return;
	this.MoveTextMain();
	this.MoveTimeLine();
}

GanttClass.prototype.MoveTextMain = function() {
	if (!this.textmain) this.textmain = getElem("id","planner_textmain","");
	if (!this.textmain) return;

	var x = 0;
	if (MS) {
		x = document.body.scrollLeft;
	} else {
		x = window.pageXOffset;
	}
	this.textmain.style.left = x;
}


GanttClass.prototype.MoveTimeLine = function() {
	
	/* Wird das Gantt ueber ajax nachgeladen, kommt es zur Fehlermeldung this.timeline.parentNode is not definied*/
//	if (!this.timeline) {
		this.timeline = getElem('id','planner_timelinemain','');
		if (!this.timeline) return;
	//}
	var y = 0;
	if (MS) {
		y = document.body.scrollTop;
	} else {
		y = window.pageYOffset;
	}
	if (y==this.lastYScrollPosition)
		return;

	var timelinetop = parseInt(this.timeline.parentNode.offsetTop);
	
	var newy = y - timelinetop;
	if (newy<0) newy=0;
	this.timeline.style.top=newy;
	this.lastYScrollPosition=y;
}

GanttClass.prototype.ToggleScrolling = function(checkbox) {
	this.NoScroll = checkbox.checked;
	Cookies.set(this.scrollcookiekey,this.NoScroll?'1':'0');
}

GanttClass.prototype.ToggleVisibility = function(elementname) {
	var status = '';
	var q;
	if (this.togglelement) {
		q = this.togglelement;
		this.togglelement.style.height=this.togglelementheight;
		this.togglelement=0;
	} else {
		var d = getElem('id',elementname,'');
		if (!d) return;
		this.togglelement=d;
		q=d;
		this.togglelementheight=d.style.height;
		d.style.height = 20;
		status='none';
	}
	var l = q.childNodes.length;
	for(i = 0; i<l; i++) {
		var e = q.childNodes[i];
		if (e && (e.nodeName=="DIV") && ("gantttextmainbuttons"!=e.id))
			e.style.display=status;
	}
}

/**
 * 
 */
GanttClass.prototype.MoveToToday = function(horizontalposition) {
	try {
		var a = document.body.clientWidth;
		
		var pos = Math.round(horizontalposition - document.body.clientWidth / 2);
		if (pos>0) {
			document.body.scrollLeft = pos;
			/* manchmal scrollt er nicht weit genug, da ist wohl das Fenster noch nicht breit genug. Deshalb
			 * einfach den Wert später noch einmal setzen.
			 */
			window.setTimeout("try{document.body.scrollLeft="+pos+";}catch(e){}",900);
		}
	} catch (e) {
		/* tritt hier ein Fehler auf kann man diesen ignorieren */
	}
}

var HintClass = function() {
	this.currentelement = 0;
	this.requestedElement = 0;
	this.timeout = 0;
	this.hidden = 0;
	this.currentHintId = null;
}

HintClass.prototype.ShowIfActive = function(elementname) {
//	debugWindow ("Hint.ShowIfActive ('"+elementname+"') - requestedElement="+this.requestedElement.id);
	if (this.requestedElement.id == elementname) {
		this.Show (elementname);
	}
}

HintClass.prototype.ShowAjaxHint = function(elementname) {
	if (this.currentHintId != elementname)
		return;
	this.Show(elementname);
}

HintClass.prototype.Show = function(elementname) {
// debugWindow ("Hint.Show ('"+elementname+"')")
	if (pageLoaded) {
		this.currentHintId = elementname;
		{
			// nun check
			var d = document.getElementById(elementname);
			if (!d) return;
			var checkmethod = d.getAttribute('check');
			if (checkmethod) {
				d.removeAttribute('check');
				var elementid=d.getAttribute('elementid');
				// diese muss true liefern um den Hint anzuzeigen
				if (!eval(checkmethod+"('"+elementid+"','"+elementname+"')")) {
					this.requestedElement = d;
//					debugWindow ("Hint.Show: 1 - requestedElement='"+this.requestedElement.id);
					return;
				}
			}
		}
		this.requestedElement = document.getElementById(elementname);
//		debugWindow ("Hint.Show: 2 - requestedElement='"+this.requestedElement.id);
		this.ShowTime(elementname, 0, 1000);
	}
}

HintClass.prototype.ShowTime = function(elementname, referenceelement, time) {
	var d = document.getElementById(elementname);
	if (!d) return;

	window.clearTimeout(this.timeout);
	this.timeout = 0;
	if ( (this.currentelement) && (this.currentelement!=d) )
		this.Hide();

	// zwangsweise in den body integrieren
	var mybody = document.body;
	if (mybody && mybody!=d.parentNode)	{
		d.parentNode.removeChild(d);
		mybody.appendChild(d);
	}
	
	this.CalcPosition(d,referenceelement);

	this.currentelement = d;
	this.timeout = window.setTimeout("Hints.ShowHintNow()",time);
}

/* berechnet die Zielposition des elements */
HintClass.prototype.CalcPosition = function(element, referenceelement) {
	var d = element;
	var mybody = document.body;

	// bestimmen der Abmessungen des Inhaltes
	d.style.visibility = "hidden";
	d.style.display="";
	d.style.left=0;
	d.style.top=0;
	var dw = 0;
	var dh = 0;
	for(var i=0; i<d.childNodes.length; i++) {
		var ce = d.childNodes[i];
		if (ce) {
			if (ce.offsetWidth && ce.offsetWidth>dw) dw=ce.offsetWidth;
			if (ce.offsetHeight && ce.offsetHeight>dh) dh=ce.offsetHeight;
		}
	}
	d.style.display="none";
	d.style.visibility = "visible";

	var ww,wh,sbx,sby,bx,by;
	if (MS) {
		ww = parseInt( mybody.offsetWidth );
		wh = parseInt( mybody.offsetHeight );
		sbx = mybody.scrollLeft;
		sby = mybody.scrollTop;
		bx = MousePositionX + sbx;
		by = MousePositionY + sby;
	} else {
		ww = parseInt( window.innerWidth );
		wh = parseInt( window.innerHeight );
		sbx = window.pageXOffset;
		sby = window.pageYOffset;
		bx = MousePositionX;
		by = MousePositionY;
	}

	// nun die Zielposition bestimmen
	var newx = bx - dw/2;
	var newy = by + 25;
	if (referenceelement) {
		var r = document.getElementById(referenceelement);
		if (r) {
			this.calcAbsolutePosition(r);
			// vom Element die Absolutposition bestimmen
			newx = this.absX;
			newy = this.absY;
		}
	}

	if (newy-sby+dh>wh)	newy = by-dh-20;
	if (newx<sbx)       newx = sbx + 10;
	if (newx-sbx+dw>ww) newx = sbx+ww-dw-(window.scrollbars && window.scrollbars.visible?20:0);
	if (newy<sby) {
		newy = sby;
		newx = bx + 5;
		if (newx-sbx+dw>ww) newx = bx-dw-20;
	}
	//window.status=" ww:"+ww+"  wh:"+wh+"  sbx:"+sbx+"  sby:"+sby+"  bx:"+bx+"  by:"+by+"  newx:"+newx+"  newy:"+newy;
	d.style.left=newx;
	d.style.top=newy;
	
//	if (MS) {
	if (pb.ie6) {
		// nun die unter dem Element liegenden Listboxen holen und unsichtbar machen
		if (!this.hidden) this.hidden = new Array();
		var o=20;
		var p1x1=newx, p1x2=p1x1+dw+o, p1y1=newy, p1y2=p1y1+dh+o;
		for(var j=0; j<document.forms.length; j++) {
			var myform = document.forms[j];
			//var s = 'los: \n';
			for(i=0; i<myform.elements.length; i++) {
				var e = myform.elements[i];
				var mt = e.type;
				//s+=e.type+"\n";
				if (mt=='select-one' || mt=='select-multiple' || mt=='textarea') {
					this.calcAbsolutePosition(e);
					var p2x1=this.absX;
					var p2x2=p2x1+e.offsetWidth;
					var p2y1=this.absY;
					var p2y2=p2y1+e.offsetHeight;
					if ( 
						(p2x1>=p1x1 && p2x1<=p1x2 && p2y1>=p1y1 && p2y1<=p1y2) || 
						(p2x1>=p1x1 && p2x1<=p1x2 && p2y2>=p1y1 && p2y2<=p1y2) || 
						(p2x2>=p1x1 && p2x2<=p1x2 && p2y1>=p1y1 && p2y1<=p1y2) || 
						(p2x2>=p1x1 && p2x2<=p1x2 && p2y2>=p1y1 && p2y2<=p1y2)
					) {
						e.style.visibility = 'hidden';
						this.hidden.push(e);
					}
					//s+=p1x1+":"+p1y1+"-"+p1x2+":"+p1y2+"  "+p2x1+":"+p2y1+"-"+p2x2+":"+p2y2+"\n";
				}
			}
			//alert(s);
		}
	}
}

HintClass.prototype.calcAbsolutePosition = function(r) {
	/*if (r.boxObject) {
		this.absX = r.boxObject.x;
		this.absY = r.boxObject.y;
		return;
	}*/
	var b = document.body;
	// vom Element die Absolutposition bestimmen
	this.absX = 0;
	this.absY = r.offsetHeight;
	while (r!=b) {
		//if (r.nodeName!='TR' && r.nodeName!='FORM') {
			var i = parseInt(r.offsetTop);
			if (i) this.absY += i;
			i = parseInt(r.offsetLeft);
			if (i) this.absX += i;
		//}
		//r = r.parentNode;
		r = r.offsetParent;
	}
}

HintClass.prototype.Hide = function() {
	this.currentHintId = null;
	this.requestedElement = 0;
//	debugWindow ("Hint.Hide: requestedElement=0'");

	if (this.currentelement)
		this.currentelement.style.display = "none";
	if (this.hidden) {
		for(i=0; i<this.hidden.length; i++) {
			this.hidden[i].style.visibility = 'visible';
		}
		this.hidden = 0;
	}
	window.clearTimeout(this.timeout);
	this.timeout=0;
}

HintClass.prototype.ShowHintNow = function() {
	if (this.currentelement) {
		this.currentelement.style.display="";
	}
//	this.requestedElement = 0;
	window.clearTimeout(this.timeout);
	this.timeout = 0;
}

var Cookies = new CookieClass();
var Hints   = new HintClass();
var Gantt   = new GanttClass();

function setGanttDate () {
	var se = document.getElementById("gantt_start");
	var sval = "";
	if (se) {
		sval = se.value;
	}
	
	var ee = document.getElementById("gantt_end");
	var eval = "";
	if (ee) {
		eval = ee.value;
	}

	var ue = document.getElementById("gantt_use");
	var uval = "";
	if (ue) {
		uval = ue.checked ? "1" : "0";
	}

	ajax_setGanttDates (sval, eval, uval);	
}

function clearGanttUse () {
	var e = document.getElementById("gantt_use");
	e.checked = false;
}

/* JsInclude file=menue.js */
var JSMenue = function() {
	this.maske="";
	this.target="main";
	this.templatename= null;
	this.parentNode = null;
	this.childs = new Array();
	this.title = null;
	this.hint = null;
	this.href = null;
	this.recursion = 0;
	this.selected=false;
	this.open=false;
	this.sticky=false;
	this.variable = "";
	this.fake = false;
	this.menueId = null;
	this.setImage(0);
}

JSMenue.prototype.clear = function() {
	this.childs = new Array ();	

	parent.frames["navigation"].oldMenueNodes = parent.frames["navigation"].menueNodes;
	parent.frames["navigation"].menueNodes = new Array ();
//	this.show();
}

JSMenue.prototype.addItem = function(child) {
	child.parentNode=this;

		if (this.sticky) {
//			__systemType__ = 'test';
//			ajax_debugLog ('VOR addItem: parent='+this.title+' ['+this.open+'], child='+child.title+' ['+child.open+']');
		} else {
			this.open = false;
			if ( !this.open ) {
				child.open = false;
			}
		}
/*
	if ( !this.open ) {
		child.open = false;
	}
*/

	child.setImage(0);
	if ( this.open ) {
		this.setImage(2);
	} else {
		this.setImage(1);
	}

	child.recursion = this.recursion+1;
	this.childs[this.childs.length]=child;

//	__systemType__ = 'test';
//	ajax_debugLog ('NACH addItem: parent='+this.title+' ['+this.open+'], child='+child.title+' ['+child.open+']');
}

JSMenue.prototype.setImage = function(type ) {
	if ( this.fake && type == 0 ){
		this.image = "folder.gif";					// folder closed
	} else {
		switch ( type ) {
			case 0:
				this.image = "folderlast.gif";		// document
				break;
			case 1:
				this.image = "folder.gif";			// folder closed
				break;
			case 2:
				this.image = "folder_.gif";			// folder open
				break;
		}
	}
		
}

JSMenue.prototype.openNode = function() {
//	debugWindow ("openNode: id="+this.menueId);
	this.open = true;
	if (this.childs.length > 0) {
		this.setImage(2);
	}
}

JSMenue.prototype.closeNode = function() {
	if ( this.open ) {
//	debugWindow ("closeNode: id="+this.menueId);
		this.open = false;
		if (this.childs.length > 0) {
			this.setImage(1);
		}
	
		for (var i=0; i < this.childs.length ; i ++ ) {
			this.childs[i].closeNode();
			this.childs[i].selected = false;
		}
	}
}

JSMenue.prototype.setSelected = function(s) {
	var searchParent;
	var i;

//		debugWindow ("setSelected: id="+this.menueId+", s="+s);
	this.selected = s;
	
	if (!this.sticky) {
		parent.frames["navigation"].menue.closeNode();
//		debugWindow ("setSelected: id="+this.menueId+", s="+s+" CLOSED");
	} else {
		if ( oldSelected != null &&  s) {
//		debugWindow ("setSelected: id="+this.menueId+", s="+s+" 1");
			if ( this != oldSelected ) {
//		debugWindow ("setSelected: id="+this.menueId+", s="+s+" 2");
				oldSelected.setSelected(false);
			}
		}
	}

//	if (!this.sticky) {

		if ( this.selected ) {
//		debugWindow ("setSelected: id="+this.menueId+", s="+s+" 3");
			oldSelected = this;
		}		
		if ( s ) {
//		debugWindow ("setSelected: id="+this.menueId+", s="+s+" 4");
		
			oldSelected = this;
			
			searchParent = this.sticky ? this.parentNode : this;
			while ( searchParent != null ) {
//		debugWindow ("setSelected: id="+searchParent.menueId+" 5");
				searchParent.openNode();
				searchParent = searchParent.parentNode;
			}
			
		} else {
//		debugWindow ("setSelected: id="+this.menueId+", s="+s+" 6");
			if (!this.sticky) {
//		debugWindow ("setSelected: id="+this.menueId+", s="+s+" 7");
				searchParent = this;
				searchParent.selected = false;
/*
				while ( searchParent != null ) {
					searchParent.closeNode();
					searchParent = searchParent.parentNode;
				}
*/
			}
		}	
	
		if (!this.fake && this.childs.length ==  0 ) {
//		debugWindow ("setSelected: id="+this.menueId+", s="+s+" 8");
			this.setImage(0);
		}
//		debugWindow ("setSelected: id="+this.menueId+", s="+s+" DONE");
//	}
}

JSMenue.prototype.show = function() {
	var s;
	var id;

	s = "";
	for(var i=0; i < this.childs.length; i ++ ) {
		s += this.childs[i].showInternal();
	}
//	s += "<div style=\"background-image:url("+__imageadresse__+"layout/nav_bottom.gif);background-repeat:no-repeat;background-position:bottom right;height:16px;\" />";

	id=document.getElementById("navigationContent");
	if ( id != null ) {
		id.innerHTML = s;
	}
}


JSMenue.prototype.toggleMenue = function() {
	var w;
	w = parent.frames["navigation"];
	if ( w ) {
		this.open = !this.open;
	
		ajax_toggleNavigation (this.menueId, this.open);
	
		if (!this.sticky) {
			this.setSelected( true );
	
		} else {
			
			if (this.childs.length > 0) {
				if (this.open) {
					this.setImage (2);
				} else {
					this.setImage (1);
				}
			}
	
		}
	
		// Zugriff auf statische Variable
		w.menue.show();
		
		// Bug 12469
		try {
			if ( this.templatename == null &&  parent.frames["main"] &&this.maske== parent.frames["main"].maske_name) {
				return false;
			}
		} catch (e) {
			return true;
		}
	}
	return true;	
}

JSMenue.prototype.showInternal = function() {
	var i ;
	var clazz;
	var isSelected;
	var sizeOfChilds;
	var title;

// debugWindow ("showInternal: id="+this.menueId+", open="+this.open);

	sizeOfChilds = this.childs.length;
	if ( sizeOfChilds > 0 && this.selected) {
		clazz = "menuchildselected";
	} else if ( sizeOfChilds > 0 || this.fake) {
		clazz = "menuchild";
	} else if ( this.selected ) {
		clazz = "menuselected";
	} else {
		clazz = "menu";
	}
	title = this.title.replace(/'/g,"&#39;");
	var hint;
	if (this.hint != null) {
		hint = this.hint.replace(/'/g,"&#39;");
	} else {
		hint = title;
	}

	var s = "";

	s += "<div class=\"nav nav_"+this.recursion+" "+clazz+"_"+this.recursion+"\" style=\"padding-left:"+((this.recursion*10)-7)+"px;cursor:pointer;\"";
	s += ">";
	s += "<a class=\"nav nav_"+this.recursion+" "+clazz+"_"+this.recursion+"\" title='"+hint+"' name=\""+this.menueId+"\"";
	s +=" onfocus=\"blur();\"";
	s +=" style=\"display:block;\"";

	s+= " id=\""+this.menueId+"\"";

	if ( this.customLinkId ) {
		/** Der href wird durch die ajax-Funktion umgeändert
		 * das onclick wird anscheinend im aktuellen Frame ausgeführt und danach wird der Link mit dem entsprechenden Target aufgerufen 
		 */
		if ( this.href != null ) {
			s+= " target=\""+this.target+"\" href=\"#\" onclick=\"return ajax_ExecuteCustomLink('"+this.menueId+"',"+this.customLinkId+");\"";
		} else {
			s+= " onclick=\"return toggleMenueNode('"+this.variable+"');\" ";
			s+= " href=\"#\""; 
		}
	} else {
		if ( this.href != null ) {
			s+= " onclick=\"return menueNodes['"+this.variable+"'].executeMenue();\" ";
			s+= " target=\"main\" href=\""+this.href+"\""; 
		} else {
			s+= " onclick=\"return toggleMenueNode('"+this.variable+"');\" ";
			s+= " href=\"#\""; 
		}
	}
	s+= ">"; 

/*	s += "<img src=\""+this.imageAdresse+this.image+"\" alt=\"\" border=\"0\" style=\"margin-right:4px;\" />"; */
	s += "<ul style=\"padding-left:20px;margin:0px;list-style-image:url("+this.imageAdresse+this.image+");\"><li>";
	s += "<div style=\"overflow:hidden;\">";
	s += title;
	s += "</div></li></ul>";
	s+= "</a></div>";
	if ( this.open ) {
		for(i=0; i < sizeOfChilds; i ++ ) {
			s+= this.childs[i].showInternal();
		}
	}
	return s;
}

JSMenue.prototype.executeMenue = function() {
	var b;
	if ( parent.frames["main"] ) {
		b = this.toggleMenue();
		
		if ( this.href != null ) {
			ExecuteMenueItem(this.href);
		}	
	} 
	return false;
}


function OpenMenu( menu ) {
	menu.toggleMenue();
}

function selectPage (href) {
	if ( parent.frames["main"] ) {
		parent.frames["main"].location.href = href;
	}
}

function ExecuteMenueItem(href ) {
	var b;
		var w = parent.frames["main"];
		if ( w ) { 
			try {
				b = w.ExecuteLinkItem(href);
			} catch (e) {
				w.location.href = href;
			}
		} else {
			b = true;
		}
	return b;
}

var menue = new JSMenue();
menue.open = true;
var oldSelected = null;
var menueNodes = new Array ();

function newJSMenue (varName, sticky, name, hint, pfad, aufzu) {
//	var oldOpen = false;
//		ajax_debugLog ("newJSMenue: sticky="+sticky);
//	if (sticky) {
//		ajax_debugLog ("newJSMenue: sticky="+sticky);
//		if (parent.frames["navigation"] && parent.frames["navigation"].oldMenueNodes && parent.frames["navigation"].oldMenueNodes[varName]) {
//			oldOpen = parent.frames["navigation"].oldMenueNodes[varName].open;
//			ajax_debugLog ("newJSMenue: varName="+varName+", oldOpen="+oldOpen);
//		}
//		oldOpen = aufzu;
//	} else {
//		oldOpen = aufzu;
//	}
	
	var menueEntry = new JSMenue ();
	parent.frames["navigation"].menueNodes[varName] = menueEntry;
/*
	if (sticky) {
		menueEntry.open = oldOpen;
	} else {
		menueEntry.open = aufzu;
	}
*/
	menueEntry.open = aufzu;
	menueEntry.sticky = sticky;
	menueEntry.variable = varName;
	menueEntry.title = name;
	menueEntry.hint = hint;
	menueEntry.menueId = pfad;
//	menueEntry.open = oldOpen;

//	__systemType__ = 'test';
//	ajax_debugLog ('newJSMenue: title='+menueEntry.title+' ['+menueEntry.open+'], sticky='+sticky);


	return (menueEntry);
}

function dumpMenue (mn, label) {
	var ret = dumpMenueNode (mn, "");
	ajax_debugLog ("dumpMenue: "+label+"\n"+ret);
//	ajax_debugLog ("dumpMenue: "+label+"\n"+ret);
}
function dumpMenueNode (mn, indent) {
	var ret = indent+mn.open+" "+mn.title+"\n";
	for (var i=0; i < mn.childs.length ; i ++ ) {
		ret += dumpMenueNode (mn.childs[i], indent+"    ");
	}
	
	return (ret);
}

function toggleMenueNode(id) {
	var w;
	/* eine kopie, solange bis es sauber funktioniert 
	 * 			w.menueNodes[id].toggleMenue() 
	 * liefert ein Fehler. 
	 */
	w = parent.frames['navigation'];
	if ( w ) {
		var m;
		m = w.menueNodes[id];
		m.toggleMenue();
	}
	return false;
}

/* JsInclude file=cookies.js */
var cookies_activated = 1;
var cookievalues = 0;
var cookieexists = 0;

function createcookie() {
	if (!cookievalues) {
		cookievalues = new Array();
	}
	// Cookie setzen ist bis jetzt nicht, also abbrechen
	// return;
	var s = '';
	var expires = "; expires="+(new Date( (new Date()).getTime()+1000*3600*24*365 )).toGMTString()+";";
	for(var cookievalueskey in cookievalues) {
		s = s+cookievalueskey+'-'+cookievalues[cookievalueskey]+':';
	}
	document.cookie = "BLUEANTLOCAL="+s+expires;
	// alert ("Cookie="+document.cookie);
}

function readcookie(cookie) {
	var s = cookie;
	var i;
	var w;
	var a = /BLUEANTLOCAL=(\S+).*/;
	cookievalues = new Array();
	while ( s.length>0 ) {
		i = s.indexOf(";");
		if (i>0) {
			w = s.substr(0,i);
			s = s.substr(i+1,s.length);
		} else {
			w = s;
			s = '';
		}
		if (a.test(w)) {
			a.exec(w);
			var line = RegExp.$1;
			var l = /(\w+)-(\w+):?(.*)/;
			while (l.test(line)) {
				l.exec(line);
				cookievalues[RegExp.$1] = RegExp.$2;
				line = RegExp.$3;
			}
			cookieexists = 1;
		}
	}
}

function initcookie() {
	if (!cookievalues) {
		var cookie = document.cookie;
		if (cookie)
			readcookie(cookie);
		if (!cookieexists) createcookie();
	}
}

/* JsInclude file=calendar_week.js */

function toggleTimes () {
	toggle ();
}

function toggleDays () {
	toggle ();
}

function toggleWeekend () {
	toggle ();
}

function toggle () {
	var showRow = MS ? "block" : "table-row";
	var showCell =  MS ? "block" : "table-cell";

	var doShowWeekend = true;
	try {
		doShowWeekend = document.getElementById ("alldays").checked;
	} catch (e) {}
	var doTimeShow = document.getElementById ("alltimes").checked;

	if (cookies_activated) {
		cookievalues["alltimes"] = doTimeShow;
		cookievalues["alldays"] = doShowWeekend;
		createcookie();
	}

	var msg = "";

	if ( KONQ ) {
		var showRow = "table-row";
		var showCell = "block";
	
		trs = document.getElementsByTagName ("tr");
		for (i = 0; i < trs.length; i++) {
			clazz = MS ? trs[i].className : trs[i].getAttribute("class");
			if (clazz == "cw_time") {
				if (doTimeShow) {
					trs[i].style.display = showRow;
				} else {
					trs[i].style.display = "none";
				}
			}
		}
	
		tds = document.getElementsByTagName ("td");
		for (i = 0; i < tds.length; i++) {
			clazz = MS ? tds[i].className : tds[i].getAttribute("class");
			is_free = (clazz && (clazz.search (/cw_free/) != -1));
			is_wend = (clazz && (clazz.search (/cw_wend/) != -1));
			if (doTimeShow) {
				if (is_free) {
					tds[i].style.display =  showCell;
				}
				if (doShowWeekend) {
					if (is_wend) {
						tds[i].style.display =  showCell;
					}
				} else { /* !doShowWeekend */
					if (is_wend) {
						tds[i].style.display = "none";
					}
				}
			} else {
				if (is_free) {
					tds[i].style.display = "none";
				}
				if (doShowWeekend) {
					if (is_wend) {
						tds[i].style.display =  showCell;
					}
				} else { /* !doShowWeekend */
					if (is_wend) {
						tds[i].style.display = "none";
					}
				}
			}
		}

	} else {
		var styleCWTime;
		var styleCWFree;
		var styleCWWeekEnd;
		

		styleCWTime = findCSSStyle("cw_time");
		styleCWFree = findCSSStyle("cw_free");
		styleCWWeekEnd = findCSSStyle("cw_wend");

		if (doTimeShow) {
			if ( styleCWTime != null ) styleCWTime.display=  showRow;
			if ( styleCWFree != null ) styleCWFree.display= showCell;

			if ( styleCWWeekEnd != null ) {
				if (doShowWeekend) {
					styleCWWeekEnd.display=showCell;
				} else {
					styleCWWeekEnd.display="none";
				}
			}

		} else {
		
			if ( styleCWTime != null ) styleCWTime.display="none";
			if ( styleCWFree != null ) styleCWFree.display="none";
			if ( styleCWWeekEnd != null ) {
				if (doShowWeekend) {
					styleCWWeekEnd.display = showCell;
				} else {
					styleCWWeekEnd.display = "none";
				}
			}

		}
	}

}


function showNote(id) {
	note = document.getElementById (id);

	if (MS) {
		note.style.left = MousePositionX + document.body.scrollLeft-5;
		note.style.top  = MousePositionY + document.body.scrollTop-10;
	} else {
		note.style.left = MousePositionX - 5;
		note.style.top  = MousePositionY - 10;
	}
	note.style.position = "absolute";
	note.style.display = "block";
	note.style.height = "auto";
}
function hideNote(note) {
	note.style.display = "none";
}

function cwOnLoad () {
	if (cookies_activated) {
		initcookie ();
		var alltimes = cookievalues["alltimes"];
		document.getElementById ("alltimes").checked = (alltimes == "true") ? true : false;
		var alldays = cookievalues["alldays"];
		try {
			document.getElementById ("alldays").checked = (alldays == "true") ? true : false;
		} catch (e) {}
	}
	toggle ();
}

/* JsInclude file=portlet.js */
var button_maximize 	= new Image();
var button_minimize 	= new Image();
var button_close	 	= new Image();
var button_close_cal 	= new Image();
var resize			 	= new Image();
button_maximize.src 		= __imageadresse__+'maximize1.gif';
button_minimize.src 		= __imageadresse__+'minimize1.gif';
button_close.src	 		= __imageadresse__+'close1.gif';
button_close_cal.src 		= __imageadresse__+'close.gif';
resize.src					= __imageadresse__+'resize1.gif';


var PortletBase = function() {
	this.elements = new Array(0);
	this.currObj = null;
	
	this.n = navigator.userAgent.toLowerCase();

	this.op = !!(window.opera && document.getElementById);
//	if(this.op) document.onmousedown = new Function('e', 'if(((e = e || window.event).target || e.srcElement).tagName == "IMAGE") return false;');
	this.ie = !!(this.n.indexOf("msie") >= 0 && document.all && !this.op);
	this.ie6 = this.ie && (navigator.appVersion.indexOf ("MSIE 6") > 0);
	this.iemc = !!(this.ie && this.n.indexOf("mac") >= 0);
	this.n6 = !!(typeof window.getComputedStyle != "undefined" && typeof document.createRange != "undefined");
	this.safari = !!(this.n.indexOf("safari") >= 0);
	
	this.grid = 10
	this.grid2 = this.grid / 2;
	
	this.minWidth = 100;
	this.minHeight = 100;
	this.zIndex = 1000;
	this.moveFunc = null;
	this.upFunc = null;
	
	this.headerHeight = null;
}

PortletBase.prototype.evt = function(d_e) {
//	window.status = "pb: evt";
	this.but = (this.e = d_e || window.event).which || this.e.button || 0;
	this.button = (this.e.type == 'mousedown')? this.but : (pb.e && pb.e.button)? pb.e.button : 0;
	this.src = this.e.target || this.e.srcElement || null;
//	this.src.tag = ("" + (this.src.tagName || this.src)).toLowerCase();
	this.x = parseInt(this.e.pageX || this.e.clientX || 0);
	this.y = parseInt(this.e.pageY || this.e.clientY || 0);
//	if(pb.ie) {
//		this.x += pb.getScrollX() - (pb.ie && !pb.iemac)*1;
//		this.y += pb.getScrollY() - (pb.ie && !pb.iemac)*1;
//	}
//	this.modifKey = this.e.modifiers? this.e.modifiers&Event.SHIFT_MASK : (this.e.shiftKey || false);
	// Bug #12609 - Popup öffnet im IE an der falschen Stelle
	if(pb.ie) {
		this.x += document.body.scrollLeft;
		this.y += document.body.scrollTop;
	}

	// avoid bubble
	if (this.ie && window && window.event) {
		try {
			window.event.cancelBubble = true;
		} catch (e) {}
	}
//	window.status = "pb: evt done";
};
PortletBase.prototype.absLeft = function (el) {
	if (this.n6) {
		return (parseInt(document.defaultView.getComputedStyle(el,null).getPropertyValue("left")));
	}
	return (el.offsetParent) ? el.offsetLeft+this.absLeft(el.offsetParent) : el.offsetLeft;
}
PortletBase.prototype.absTop = function (el) {
	if (this.n6) {
		return (parseInt(document.defaultView.getComputedStyle(el,null).getPropertyValue("top")));
	}
	return (el.offsetParent) ? el.offsetTop+this.absTop(el.offsetParent) : el.offsetTop;
}
PortletBase.prototype.setHeaderHeight = function (p) {
	if (this.headerHeight == null) {
		var stylesheets = document.styleSheets;
		for (var s = 0; s < stylesheets.length; s++) {
			var cssRules = stylesheets[s].cssRules;
			if (!cssRules) {
				cssRules = stylesheets[s].rules
			}
			for (var r = 0; r < cssRules.length; r++) {
				var cssRule = cssRules[r];
				if (cssRule.selectorText == ".PortletHeadTable") {
					this.headerHeight = cssRule.style.height;
					return;
				}
			}
		}
	}
}

PortletBase.prototype.setZIndex = function (p) {
	var currZIndex = p.zIndex;
	var reOrdered = false;
	for (var pEleKey in this.elements) {
		var pEle = this.elements[pEleKey];
		if (pEle) {
			if (pEle.zIndex > currZIndex) {
				pEle.zIndex = pEle.zIndex -1;
				pEle.obj.style.zIndex = pEle.zIndex;
				reOrdered = true;
			}
		}
	}
	if (reOrdered) {
		p.zIndex = pb.zIndex -1;
		p.obj.style.zIndex = p.zIndex;
	}
}

PortletBase.prototype.trackMouse = function (evt) {
	pb.e = new pb.evt(evt);
	
	for (var pEleKey in pb.elements) {
		var pEle = pb.elements[pEleKey];
		if (pEle && ((pEle.flags & pEle.FLAG_CLOSE_CLICK) == pEle.FLAG_CLOSE_CLICK)) {
//			alert ("ele.id="+pEle.id+", flags="+pEle.flags);
			pEle._close ();
		}
	}
}

var pb = new PortletBase ();
document.onmousedown = pb.trackMouse;

var Portlet = function (id) {
	pb.elements[id] = this;
	this.id = id;
	this.flags = 0;
	this.onMouseDown = null;
	this.onMouseMove = null;
	this.onMouseUp = null;
	
	this.create ();
	pb.setHeaderHeight (this);

	this.zIndex = pb.zIndex++;
	this.obj.style.zIndex = this.zIndex;
	this.minWidth = pb.minWidth;
	this.minHeight = pb.minHeight;
	this.flags = 0;
	this.projectID = 0;
//	this.defaultFlags = (this.FLAG_SHOW_HEADER | this.FLAG_SHOW_FOOTER | this.FLAG_RESIZE | this.FLAG_MOVE | this.FLAG_MINIMIZE | this.FLAG_CLOSE);
//	this.setFlags (this.defaultFlags);
}

Portlet.prototype.FLAG_RESIZE			=    1;
Portlet.prototype.FLAG_MOVE				=    2;
Portlet.prototype.FLAG_MINIMIZE			=    4;
Portlet.prototype.FLAG_CLOSE			=    8;
Portlet.prototype.FLAG_CLOSE_CLICK		=   16;
Portlet.prototype.FLAG_SAVE_POS			=   32;
Portlet.prototype.FLAG_DEL_ON_CLOSE		=   64;
Portlet.prototype.FLAG_SHOW_HEADER		=  128;
Portlet.prototype.FLAG_SHOW_FOOTER		=  256;
Portlet.prototype.FLAG_VISIBLE			=  512;
Portlet.prototype.FLAG_MINIMIZED		= 1024;

Portlet.prototype.FLAG_MAX				= 1025;


Portlet.prototype.setFlags = function (flags) {
//	var msg = "setFlags id="+this.id+", flags="+flags;
	this.flags = 0;
	var i = 1;
	for (i = 1; (i > 0) &&  i < this.FLAG_MAX; i *= 2) {
		if (flags & i) {
//			msg += " set "+i;
			this.setFlag (i);
		}
	}
//	msg += " finalFlags "+this.flags;
//	alert (msg);
}

Portlet.prototype.clearFlags = function (flags) {
	var i = 1;
	for (i = 1; i < this.FLAG_MAX; i *= 2) {
		if (flags & i) {
			this.clearFlag (i);
		}
	}
}

Portlet.prototype.getFlags = function () {
	return (this.flags);
}

Portlet.prototype.setFlag = function (flag) {
	if ((this.flags & flag) == flag) {
		return;
	}
	this.flags |= flag;
	if (flag == this.FLAG_RESIZE) {
		var ele = document.getElementById (this.id+"_foot_right");
		if (ele) {
			ele.style.backgroundImage = "url("+resize.src+")";
			ele.style.backgroundRepeat = "no-repeat";
			ele.style.backgroundPosition = "6 3";
			ele.style.width = "20px";
			ele.style.cursor = "se-resize";

			this.resizeElem = ele;
			this.resizeElem.onmousedown = this.startResize;
		}
	} else if (flag == this.FLAG_MOVE) {
		var ele = document.getElementById (this.id+"_head_middle");
		if (ele) {
			this.moveElem = ele;
			ele.onmousedown = this.startMove;
		}
	} else if (flag == this.FLAG_MINIMIZE) {
		var ele = document.getElementById (this.id+"_head_right1");
		var r = document.createElement("img");
		r.setAttribute ("id", this.id+"_minimize");
		r.setAttribute ("src", button_minimize.src);
		r.setAttribute ("alt", "");
		r.onclick = this.minimize;
		ele.style.width = "18px";
		ele.appendChild(r);
	} else if (flag == this.FLAG_CLOSE) {
		var ele = document.getElementById (this.id+"_head_right2");
		var r = document.createElement("img");
		r.setAttribute ("id", this.id+"_close");
		if ("dateCalendar" == this.id) {
			r.setAttribute ("src", button_close_cal.src);
		} else {
			r.setAttribute ("src", button_close.src);
		}
		r.setAttribute ("alt", "");
		r.onclick = this.close;
		ele.style.width = "18px";
		ele.appendChild(r);
//	} else if (flag == this.FLAG_CLOSE_CLICK) {
//	} else if (flag == this.FLAG_SAVE_POS) {
//	} else if (flag == this.FLAG_DEL_ON_CLOSE) {
	} else if (flag == this.FLAG_SHOW_HEADER) {
//		document.getElementById (this.id+"_header").style.display = pb.ie ? "block" : "table-row";
		document.getElementById (this.id+"_header").style.display = "block";
	} else if (flag == this.FLAG_SHOW_FOOTER) {
//		document.getElementById (this.id+"_footer").style.display = pb.ie ? "block" : "table-row";
		document.getElementById (this.id+"_footer").style.display = "block";
	} else if (flag == this.FLAG_VISIBLE) {
		this._show ();
	} else if (flag == this.FLAG_MINIMIZED) {
		this._minimize();
	}
}

Portlet.prototype.clearFlag = function (flag) {
	if ((this.flags & flag) == 0) {
		return;
	}
	this.flags &= ~flag;
	if (flag == this.FLAG_RESIZE) {
		var ele = document.getElementById (this.id+"_foot_right");
		if (ele) {
			ele.style.backgroundImage = "";
			ele.style.backgroundRepeat = "no-repeat";
			ele.style.backgroundPosition = "5 7";
			ele.style.width = "1px";
			ele.style.cursor = "";

			this.resizeElem.onmousedown = null;
			this.resizeElem = null;
		}
	} else if (flag == this.FLAG_MOVE) {
		var ele = document.getElementById (this.id+"_head_middle");
		if (ele) {
			this.moveElem = null;
			ele.onmousedown = null;
		}
	} else if (flag == this.FLAG_MINIMIZE) {
		var ele = document.getElementById (this.id+"_minimize");
		document.getElementById (this.id+"_head_right1").style.width = "1px";
		ele.parentNode.removeChild (ele);
	} else if (flag == this.FLAG_CLOSE) {
		var ele = document.getElementById (this.id+"_close");
		document.getElementById (this.id+"_head_right2").style.width = "1px";
		ele.parentNode.removeChild (ele);
//	} else if (flag == this.FLAG_CLOSE_CLICK) {
//	} else if (flag == this.FLAG_SAVE_POS) {
//	} else if (flag == this.FLAG_DEL_ON_CLOSE) {
	} else if (flag == this.FLAG_SHOW_HEADER) {
		document.getElementById (this.id+"_header").style.display = "none";
	} else if (flag == this.FLAG_SHOW_FOOTER) {
		document.getElementById (this.id+"_footer").style.display = "none";
	} else if (flag == this.FLAG_VISIBLE) {
		this.hide ();
	} else if (flag == this.FLAG_MINIMIZED) {
		this._maximize();
	}
}

Portlet.prototype.startMove = function (evt) {
	pb.e = new pb.evt(evt);
	
	var id = this.id.substring (0, this.id.lastIndexOf("_head_middle"));
	var p = pb.elements[id];
	pb.currObj = p;
	this.style.cursor = "move";
/*
	if (pb.ie6) {
		document.getElementById(p.id+"_content_td").style.overflow = "visible";
		document.getElementById(p.id+"_content").style.overflow = "visible";
		document.getElementById(p.id+"_content").style.display = "none";
		document.getElementById(p.id+"_content").style.display = "none";
	}
*/
	p.getPosition ();
	pb.setZIndex (p);
	
	p.dragX = pb.e.x - p.x;
	p.dragY = pb.e.y - p.y;
	
	if(document.onmousemove != p.doMove) {
		pb.moveFunc = document.onmousemove;
		document.onmousemove = p.doMove;
	}
	if(document.onmouseup != p.stopMove) {
		pb.upFunc = document.onmouseup;
		document.onmouseup = p.stopMove;
	}
	if (pb.ie6) {
		var content = document.getElementById (p.id+"_content");
		var cnt = content.childNodes.length;
		for (i = 0; i < cnt; i++) {
			content.childNodes[i].style.visibility = "hidden";
		}	
//		content.style.visibility = "hidden";
	}
}

Portlet.prototype.doMove = function (evt) {
	pb.e = new pb.evt(evt);

	var p = pb.currObj;

	if (p != null) {
		p.x = (pb.e.x - p.dragX);
		p.y = (pb.e.y - p.dragY);
		
		p.setPosition (p.x, p.y);
//		window.status = "doMove: setPosition done";
		p.reHideElements ();
	}
/*
	if (pb.moveFunc) {
		window.status = "doMove: moveFunc...";
		return pb.moveFunc(evt);
	}
*/
//	window.status = "doMove: done";
	return false;
}

Portlet.prototype.stopMove = function (evt) {
//	window.status = "stopMove";
	pb.e = new pb.evt(evt);
	var p = pb.currObj;
/*
	if (pb.ie6) {
		document.getElementById(p.id+"_content_td").style.overflow = "auto";
		document.getElementById(p.id+"_content").style.overflow = "auto";
		document.getElementById(p.id+"_content_td").style.display = "block";
		document.getElementById(p.id+"_content").style.display = "block";
	}
*/
	pb.currObj = null;
	
	document.onmousemove = pb.moveFunc ? pb.moveFunc : null;
	document.onmouseup = pb.upFunc ? pb.upFunc : null;

	if (p != null) {
		var x = (pb.e.x - p.dragX);
		var y = (pb.e.y - p.dragY);

		p.x = ((x%pb.grid)>pb.grid2) ? Math.ceil(x/pb.grid)*pb.grid : Math.floor(x/pb.grid)*pb.grid;
		p.y = ((y%pb.grid)>pb.grid2) ? Math.ceil(y/pb.grid)*pb.grid : Math.floor(y/pb.grid)*pb.grid;
//		window.status = "stopMove x="+x+", y="+y+", p.x="+p.x+", p.y="+p.y;
		p.setPosition (p.x, p.y);
		
		if (p.flags & p.FLAG_SAVE_POS) {
			p.save ();
		}
		
		if (pb.ie6) {
			var content = document.getElementById (p.id+"_content");
			var cnt = content.childNodes.length;
			for (i = 0; i < cnt; i++) {
				content.childNodes[i].style.visibility = "visible";
			}	
//			content.style.visibility = "visible";
		}
		
	}
}

Portlet.prototype.startResize = function (evt) {
	pb.e = new pb.evt(evt);
	
	var id = this.id.substring (0, this.id.lastIndexOf("_foot_right"));
	var p = pb.elements[id];
	pb.currObj = p;
	
	pb.setZIndex (p);
	
//	window.status="clientWidth="+p.obj.clientWidth+", clientHeight="+p.obj.clientHeight;
	p.dragW = p.obj.clientWidth - pb.e.x;
	p.dragH = p.obj.clientHeight - pb.e.y;

	if(document.onmousemove != p.doResize) {
		pb.moveFunc = document.onmousemove;
		document.onmousemove = p.doResize;
	}
	if(document.onmouseup != p.stopResize) {
		pb.upFunc = document.onmouseup;
		document.onmouseup = p.stopResize;
	}

}
Portlet.prototype.doResize = function (evt) {
	pb.e = new pb.evt(evt);
	var p = pb.currObj;

	if(p != null) {
		if ((pb.e.x + p.dragW) < p.minWidth) {
			p.w = p.minWidth;
		} else {
			p.w = (pb.e.x + p.dragW);
		}
		if ((pb.e.y + p.dragH) < p.minHeight) {
			p.h = p.minHeight;
		} else {
			p.h = (pb.e.y + p.dragH);
		}

		p.setSize (p.w, p.h);
//		window.status="doResize x="+pb.e.x+", y="+pb.e.y+", w="+p.w+", h="+p.h;
		
		p.reHideElements ();
	}

	return false;
}

Portlet.prototype.stopResize = function (evt) {
	pb.e = new pb.evt(evt);
	var p = pb.currObj;

	pb.currObj = null;
	document.onmousemove = pb.moveFunc ? pb.moveFunc : null;
	document.onmouseup = pb.upFunc ? pb.upFunc : null;

	if(p != null) {
		var w = (pb.e.x + p.dragW);
		var h = (pb.e.y + p.dragH);
		
		p.w = ((w%pb.grid)>pb.grid2) ? Math.ceil(w/pb.grid)*pb.grid : Math.floor(w/pb.grid)*pb.grid;
		p.h = ((h%pb.grid)>pb.grid2) ? Math.ceil(h/pb.grid)*pb.grid : Math.floor(h/pb.grid)*pb.grid;

		if (p.w < p.minWidth) {
			p.w = p.minWidth;
		}
		if (p.h < p.minHeight) {
			p.h = p.minHeight;
		}
		p.setSize (p.w, p.h);

		if (p.flags & p.FLAG_SAVE_POS) {
			p.save ();
		}
	}
}

Portlet.prototype.minimize = function () {
	var id = this.id.substring (0, this.id.lastIndexOf("_minimize"));
	var p = pb.elements[id];
	p._minimize ();
	pb.setZIndex (p);

	if (p.flags & p.FLAG_SAVE_POS) {
		p.save ();
	}
}

Portlet.prototype._minimize = function () {
	var p = this;
	var id = p.id;

	p.oldHeight = p.obj.style.height;
	p.obj.style.height = pb.headerHeight;
	
//	document.getElementById(id+"_table").style.height = pb.headerHeight;
//	document.getElementById(id+"_content_tr").style.display = "none";
//	document.getElementById(id+"_content_td").style.display = "none";
	document.getElementById(id+"_content").style.display = "none";
	document.getElementById(id+"_footer").style.display = "none";
	
	var btn = document.getElementById(id+"_minimize");
	if (!btn) {
		btn = document.getElementById(id+"_maximize");
	}
	if (btn) {
		btn.src = button_maximize.src;
		btn.id = id+"_maximize";
		btn.onclick = p.maximize;
		p.flags |= p.FLAG_MINIMIZED;
	}
}

Portlet.prototype.maximize = function () {
	var id = this.id.substring (0, this.id.lastIndexOf("_maximize"));
	var p = pb.elements[id];
	p._maximize ();
	pb.setZIndex (p);

	if (p.flags & p.FLAG_SAVE_POS) {
		p.save ();
	}
}

Portlet.prototype._maximize = function () {
	var p = this;
	var id = p.id;

	if (!p.oldHeight) {
		p.oldHeight = p.height;
	}
//	alert ("_maximize: p.oldHeight="+p.oldHeight);
	p.obj.style.height = p.oldHeight;

//	document.getElementById(id+"_table").style.height = p.oldHeight;
//	document.getElementById(id+"_content_tr").style.display = pb.ie ? "block" : "table-row";
//	document.getElementById(id+"_content_td").style.display = pb.ie ? "block" : "table-cell";
	document.getElementById(id+"_content").style.display = "block"
	document.getElementById(id+"_footer").style.display = pb.ie ? "block" : "table-row";
	
	var btn = document.getElementById(id+"_maximize");
	if (!btn) {
		btn = document.getElementById(id+"_minimize");
	}
	if (btn) {
		btn.src = button_minimize.src;
		btn.id = id+"_minimize";
		btn.onclick = p.minimize;
		
		p.flags &= ~p.FLAG_MINIMIZED;
	}
}

Portlet.prototype.close = function () {
	var id = this.id.substring (0, this.id.lastIndexOf("_close"));
	var p = pb.elements[id];

	p.flags &= ~p.FLAG_VISIBLE;
	if (p.flags & p.FLAG_SAVE_POS) {
		p.save ();
	}

	p._close ();
}

Portlet.prototype._close = function () {
	this.showElements ();
	
	if ( this.portletHandler ) {
		eval(this.portletHandler);
	}
	
	var p = this;
	p.obj.style.display = "none";
	p.flags &= ~p.FLAG_VISIBLE;
//	p.clearFlag (p.FLAG_VISIBLE);

	if (p.flags & p.FLAG_DEL_ON_CLOSE) {
		pb.elements[p.id] = null;
		document.body.removeChild (p.obj);
	}
}

Portlet.prototype.remove = function () {
//	alert ("Portlet("+this.id+").remove()");
}

Portlet.prototype.setPositionSize = function (x, y, w, h) {
	var p = this;
	
	p.setPosition (x, y);
	p.setSize (w, h);
}

Portlet.prototype.setPosition = function (x, y) {
	var p = this;
	
	if (y < 0) {
		y = 0;
	}
	if (x < 0) {
		x = 0;
	}

	p.xPos = new PositionElement (x);
	p.yPos = new PositionElement (y);

	var xp = p.xPos.value+p.xPos.unit;
	var yp = p.yPos.value+p.yPos.unit;
	
	p.obj.style.left = xp;
	p.obj.style.top = yp;

//	window.status = "setPosition "+p.id+" x="+xp+", y="+yp;
//	po = document.getElementById (p.id);
//	po.style.left = xp;
//	po.style.top = yp;
	
//	alert ("setPosition done");
//	alert ("setPosition: p="+p+", p.id="+p.id+", p.obj="+p.obj+", p.obj.style="+p.obj.style+", x="+xp+", y="+yp);
}
/*
setRelativePosition = function (id, x, y) {
	var p = pb.elements[id];

	p.xPos = new PositionElement (x);
	p.yPos = new PositionElement (y);
	
	p.xPos = p.xPos.value+pb.e.x;
	p.xPos.unit = "px";
	p.xPos.rule = "r";
	
	p.yPos = p.yPos.value+pb.e.y;
	p.yPos.unit = "px";
	p.yPos.rule = "r";
	
	p.obj.style.left = p.xPos.toString();
	p.obj.style.top = p.yPos.toString();
	
//	window.status = "setPosition "+p.id+" x="+p.xPos.toString()+", y="+p.yPos.toString();
}
*/
Portlet.prototype.setSize = function (w, h) {
	var p = this;

	p.width = w;
	p.height = h;

	var width = p.width + "px";
	var outerHeight = p.height+ "px";
	var headerHeight = parseInt(25);
	var footerHeight = parseInt(18);
	
	var innerHeight = (parseInt(p.height) - headerHeight - footerHeight)+ "px";
//	var innerHeight = (parseInt(p.height) - parseInt(50))+ "px";
	
	p.oldHeight = outerHeight;
	
	var div = document.getElementById (p.id);

	div.style.width = width;
	div.style.height = outerHeight;

	var header = document.getElementById (p.id+"_header_table");
	header.style.width = width;

	var content = document.getElementById (p.id+"_content");
	content.style.width = width;
	content.style.height = innerHeight;

	var footer = document.getElementById (p.id+"_footer_table");
	footer.style.width = width;
	
// alert ("setSize: id="+p.id+", p.obj.id="+p.obj.id+", innerHeight="+innerHeight+", outerHeight="+outerHeight+", div.height="+p.obj.style.height+", tab.height="+tab.style.height);
//	window.status = "setSize "+p.id+" w="+p.width+", h="+p.height+", contentHeight="+content.style.height;
}

Portlet.prototype.create = function () {
	var div = document.createElement("div");
	this.obj = div;
	div.setAttribute ("id", this.id);
	div.className = "Portlet";

	var divHead = document.createElement("div");
	divHead.className = "PortletHead";
	divHead.setAttribute ("id", this.id+"_header");
	div.appendChild(divHead);

	var headTable = document.createElement("table");
	headTable.className = "PortletHeadTable";
	headTable.setAttribute ("id", this.id+"_header_table");
	divHead.appendChild(headTable);

	var tbodyh = document.createElement("tbody");
	headTable.appendChild(tbodyh);

	var headTr = document.createElement("tr");
	tbodyh.appendChild(headTr);
	
	var headTd = document.createElement("td");
	headTd.className = "PortletHeadLeft";
	headTd.setAttribute ("id", this.id+"_head_left");
	headTd.appendChild(document.createElement("spawn"));
	headTr.appendChild(headTd);
	
	headTd = document.createElement("td");
	headTd.className = "PortletHeadMiddle";
	headTd.setAttribute ("id", this.id+"_head_middle");
	headTd.appendChild(document.createElement("spawn"));
	headTr.appendChild(headTd);
	
	headTd = document.createElement("td");
	headTd.className = "PortletHeadRight1";
	headTd.setAttribute ("id", this.id+"_head_right1");
	headTd.appendChild(document.createElement("spawn"));
	headTr.appendChild(headTd);
	
	headTd = document.createElement("td");
	headTd.className = "PortletHeadRight2";
	headTd.setAttribute ("id", this.id+"_head_right2");
	headTd.appendChild(document.createElement("spawn"));
	headTr.appendChild(headTd);

	var d  = document.createElement("div");
	d.className = "PortletContent";
	d.setAttribute ("id", this.id+"_content");
	d.appendChild(document.createElement("spawn"));
	div.appendChild(d);

	var divFoot = document.createElement("div");
	divFoot.className = "PortletFoot";
	divFoot.setAttribute ("id", this.id+"_footer");
	div.appendChild(divFoot);

	var footTable = document.createElement("table");
	footTable.className = "PortletFootTable";
	footTable.setAttribute ("id", this.id+"_footer_table");
	divFoot.appendChild (footTable);

	var tbodyf = document.createElement("tbody");
	footTable.appendChild(tbodyf);

	var footTr = document.createElement("tr");
	tbodyf.appendChild(footTr);
	
	var footTd = document.createElement("td");
	footTd.className = "PortletFootLeft";
	footTd.setAttribute ("id", this.id+"_foot_left");
	footTd.appendChild(document.createElement("spawn"));
	footTr.appendChild(footTd);
	
	var footTd = document.createElement("td");
	footTd.className = "PortletFootMiddle";
	footTd.setAttribute ("id", this.id+"_foot_middle");
	var footSpawn = document.createElement("spawn");
	if (__systemType__ == 'test') {
		footSpawn.appendChild (document.createTextNode('portletId='+this.id));
	}
	footTd.appendChild(footSpawn);
	footTr.appendChild(footTd);
	
	var footTd = document.createElement("td");
	footTd.className = "PortletFootRight";
	footTd.setAttribute ("id", this.id+"_foot_right");
	
	if (pb.n6) {
		var resizeDiv = document.createElement("div");
		resizeDiv.setAttribute ("style", "width:100%;height:16px;background-color:transparent;");
		footTd.appendChild(resizeDiv);
	} else {
		footTd.appendChild(document.createElement("spawn"));
	}

	
	footTr.appendChild(footTd);
	
	document.body.appendChild(div);
//	alert ("created Portlet id="+this.id);
}

Portlet.prototype.createTable = function () {
	var div = document.createElement("div");
	this.obj = div;
	div.setAttribute ("id", this.id);
	div.className = "Portlet";

	var table = document.createElement("table");
//	this.obj = table;
	table.className = "Portlet";
//	table.setAttribute ("id", this.id);
	table.setAttribute ("id", this.id+"_table");
	div.appendChild(table);

	var tbody = document.createElement("tbody");
	table.appendChild(tbody);
	
	var tr = document.createElement("tr");
	tr.setAttribute ("id", this.id+"_header");
	tbody.appendChild(tr);
	
	var td = document.createElement("td");
	td.className = "PortletHeadTable";
	tr.appendChild(td);
	
	var headTable = document.createElement("table");
	headTable.className = "PortletHeadTable";
	td.appendChild(headTable);

	var tbodyh = document.createElement("tbody");
	headTable.appendChild(tbodyh);

	var headTr = document.createElement("tr");
	tbodyh.appendChild(headTr);
	
	var headTd = document.createElement("td");
	headTd.className = "PortletHeadLeft";
	headTd.setAttribute ("id", this.id+"_head_left");
	headTd.appendChild(document.createElement("spawn"));
	headTr.appendChild(headTd);
	
	headTd = document.createElement("td");
	headTd.className = "PortletHeadMiddle";
	headTd.setAttribute ("id", this.id+"_head_middle");
	headTd.appendChild(document.createElement("spawn"));
	headTr.appendChild(headTd);
	
	headTd = document.createElement("td");
	headTd.className = "PortletHeadRight1";
	headTd.setAttribute ("id", this.id+"_head_right1");
	headTd.appendChild(document.createElement("spawn"));
	headTr.appendChild(headTd);
	
	headTd = document.createElement("td");
	headTd.className = "PortletHeadRight2";
	headTd.setAttribute ("id", this.id+"_head_right2");
	headTd.appendChild(document.createElement("spawn"));
	headTr.appendChild(headTd);

	tr = document.createElement("tr");
	tr.setAttribute ("id", this.id+"_content_tr");
	tbody.appendChild(tr);
	
	td = document.createElement("td");
	td.className = "PortletContent";
	td.setAttribute ("id", this.id+"_content_td");
//	td.setAttribute ("id", this.id+"_content");
//	td.appendChild(document.createElement("spawn"));

	var d  = document.createElement("div");
	d.className = "PortletContent";
	d.setAttribute ("id", this.id+"_content");
	d.appendChild(document.createElement("spawn"));
	td.appendChild(d);
	tr.appendChild(td);
	
	tr = document.createElement("tr");
	tr.setAttribute ("id", this.id+"_footer");
	tbody.appendChild(tr);
	
	td = document.createElement("td");
	td.className = "PortletFootTable";
	tr.appendChild(td);

	var footTable = document.createElement("table");
	footTable.className = "PortletFootTable";
	td.appendChild(footTable);

	var tbodyf = document.createElement("tbody");
	footTable.appendChild(tbodyf);

	var footTr = document.createElement("tr");
	tbodyf.appendChild(footTr);
	
	var footTd = document.createElement("td");
	footTd.className = "PortletFootLeft";
	footTd.setAttribute ("id", this.id+"_foot_left");
	footTd.appendChild(document.createElement("spawn"));
	footTr.appendChild(footTd);
	
	var footTd = document.createElement("td");
	footTd.className = "PortletFootMiddle";
	footTd.setAttribute ("id", this.id+"_foot_middle");
	footTd.appendChild(document.createElement("spawn"));
	footTr.appendChild(footTd);
	
	var footTd = document.createElement("td");
	footTd.className = "PortletFootRight";
	footTd.setAttribute ("id", this.id+"_foot_right");
	footTd.appendChild(document.createElement("spawn"));
	footTr.appendChild(footTd);
	
	document.body.appendChild(div);
}

Portlet.prototype.show = function () {
	this._show ();

	if (this.flags & this.FLAG_SAVE_POS) {
		this.save ();
	}
}

Portlet.prototype._show = function () {
	this.hideElements ();
	
	this.obj.style.display = "block";
//	document.getElementById(this.id+"_table").style.display = pb.ie ? "block" : "table";
	this.flags |= this.FLAG_VISIBLE;
/*	Anpassungen für Bug #12609 - vorläufig entfernt
	debugWindow ("_show: this.flags="+this.flags);
	if ((this.flags & this.FLAG_SAVE_POS) == 0) {
		debugWindow ("_show: NOT SAVE_POS");
		var p = this;
		var b = document.getElementById ("root");
		if (!b) {
			b = document.body;
		}
		if (b) {
			debugWindow ("b");
			var maxX = parseInt(b.clientWidth) + parseInt(b.scrollLeft);
			var maxY = parseInt(b.clientHeight) + parseInt(b.scrollTop);
			debugWindow ("maxX="+maxX+", maxY="+maxY);
			var pMaxX = parseInt(p.xPos.value) + parseInt(p.width);
			debugWindow ("pMaxX="+pMaxX);
			var pMaxY = parseInt(p.yPos.value) + parseInt(p.height);
			debugWindow ("pMaxY="+pMaxY);
			debugWindow ("maxX="+maxX+", maxY="+maxY);
			var newXPos = p.xPos.value;
			var newYPos = p.yPos.value;
			debugWindow ("pMaxX="+pMaxX+", pMaxY="+pMaxY);
			
			if (pMaxX < maxX) {
				if (p.width > maxX) {
					newXPos = parseInt(maxX)-parseInt(p.width);
				}
			}
			if (pMaxY > maxY) {
				if (p.height < maxY) {
					newYPos = parseInt(maxY)-parseInt(p.height);
				}
			}
			debugWindow ("newXPos="+newXPos+", newYPos="+newYPos);
			p.x = ((newXPos%pb.grid)>pb.grid2) ? Math.ceil(newXPos/pb.grid)*pb.grid : Math.floor(newXPos/pb.grid)*pb.grid;
			p.y = ((newYPos%pb.grid)>pb.grid2) ? Math.ceil(newYPos/pb.grid)*pb.grid : Math.floor(newYPos/pb.grid)*pb.grid;
//			window.status = "stopMove x="+x+", y="+y+", p.x="+p.x+", p.y="+p.y;
			p.setPosition (p.x, p.y);
			
		}
	}
*/
}

Portlet.prototype.save = function () {
	var p = this;
	var o = ((p.flags & p.FLAG_MINIMIZED) == 0);
	var v = ((p.flags & p.FLAG_VISIBLE) > 0);

	ajax_setPortletPosition (p.id, p.projectID, p.xPos.value, p.yPos.value, p.width, p.height, o, v);
}

Portlet.prototype.hide = function () {
	this._hide ();

	if (this.flags & this.FLAG_SAVE_POS) {
		this.save ();
	}
}

Portlet.prototype._hide = function () {
	this._close ();
}

Portlet.prototype.setHeader = function (pos, html) {
	this.setBar ("head", pos, html);
}
Portlet.prototype.setFooter = function (pos, html) {
	this.setBar ("foot", pos, html);
}
Portlet.prototype.setBar = function (what, pos, html) {
	var id = null;
	if (pos == "left") {
		id = this.id+"_"+what+"_left";
	}
	if (pos == "middle") {
		id = this.id+"_"+what+"_middle";
	}
	if (pos == "right") {
		id = this.id+"_"+what+"_right";
	}
	if (id) {
		var ele = document.getElementById (id);
		if (ele) {
			ele.innerHTML = html;
		}
	}
}

Portlet.prototype.setContent = function (html) {
	document.getElementById(this.id+"_content").innerHTML = html;
}

Portlet.prototype.getPosition = function () {
	this.x = pb.absLeft (this.obj);
	this.y = pb.absTop (this.obj);
}

Portlet.prototype.calcAbsolutePosition = function(r) {
	var b = document.body;
	// vom Element die Absolutposition bestimmen
	this.absX = 0;
	this.absY = r.offsetHeight;
	while (r!=b) {
		var i = parseInt(r.offsetTop);
		if (i) this.absY += i;
		i = parseInt(r.offsetLeft);
		if (i) this.absX += i;
		r = r.offsetParent;
	}
}

Portlet.prototype.reHideElements = function () {
	this.showElements ();
	this.hideElements();
}

Portlet.prototype.isOwnForm = function (ele) {
	if (!ele) {
		return (false);
	}
	var content = document.getElementById(this.id+"_content");
	if (ele.parentNode == content) {
		return (true);
	}
	if (!ele.parentNode || ele.parentNode.nodeName == "body") {
		return (false);
	}
	return (this.isOwnForm (ele.parentNode));
}

Portlet.prototype.hideElements = function () {
	if (pb.ie6) {
		// nun die unter dem Element liegenden Listboxen holen und unsichtbar machen
		if (!this.hidden) {
			this.hidden = new Array();
			this.elements = new Array ();
			
			for (var j=0; j<document.forms.length; j++) {
				var myform = document.forms[j];
				if (!this.isOwnForm (myform)) {
					for(i=0; i<myform.elements.length; i++) {
						var e = myform.elements[i];
						var mt = e.type;
						if (mt=='select-one' || mt=='select-multiple' || mt=='textarea') {
							this.elements.push (e);
						}
					}
				}
			}
		}
		var o=10;
//		debugWindow ("hideElements x="+this.xPos.value+", y="+this.yPos.value+", w="+this.width+", h="+this.height+", o="+o);
		if (this && this.xPos && this.xPos.value) {
		var p1x1=this.xPos.value, p1x2=p1x1+parseInt (this.width)+o, p1y1=this.yPos.value, p1y2=p1y1+parseInt (this.height)+o;
		for(i=0; i<this.elements.length; i++) {
			var e = this.elements[i];
			this.calcAbsolutePosition(e);
			var p2x1=this.absX;
			var p2x2=p2x1+e.offsetWidth;
			var p2y1=this.absY;
			var p2y2=p2y1+e.offsetHeight;
//			debugWindow ("hideElements absX="+this.absX+", absY="+this.absY);
//			debugWindow ("hideElements p1x1="+p1x1+", p1x2="+p1x2+", p1y1="+p1y1+", p1y2="+p1y2);
			if ( 
				(p2x1>=p1x1 && p2x1<=p1x2 && p2y1>=p1y1 && p2y1<=p1y2) || 
				(p2x1>=p1x1 && p2x1<=p1x2 && p2y2>=p1y1 && p2y2<=p1y2) || 
				(p2x2>=p1x1 && p2x2<=p1x2 && p2y1>=p1y1 && p2y1<=p1y2) || 
				(p2x2>=p1x1 && p2x2<=p1x2 && p2y2>=p1y1 && p2y2<=p1y2)
			) {
				e.style.visibility = 'hidden';
				this.hidden.push(e);
			}
		}
		}
	}
}

Portlet.prototype.showElements = function () {
	if (pb.ie6) {
		if (this.hidden) {
			for(i=0; i<this.hidden.length; i++) {
				this.hidden[i].style.visibility = 'visible';
			}
			this.hidden = 0;
		}
	}
}

var PositionElement = function (val) {
	val = ""+val;
	this.rule = 'a';
	this.unit = this.getUnit (val);
	this.value = this.getValue (val);
	
//	alert ("PositionElement val="+val+", rule="+this.rule+", value="+this.value+", unit="+this.unit);
}

PositionElement.prototype.getUnit = function (val) {
	var unit = "px"; // default unit;

	if (val.indexOf("pt") > 0) {
		unit = "pt";
	} else if (val.indexOf("pc") > 0) {
		unit = "pc";
	} else if (val.indexOf("in") > 0) {
		unit = "in";
	} else if (val.indexOf("mm") > 0) {
		unit = "mm";
	} else if (val.indexOf("cm") > 0) {
		unit = "cm";
	} else if (val.indexOf("em") > 0) {
		unit = "em";
	} else if (val.indexOf("ex") > 0) {
		unit = "ex";
	} else if (val.indexOf("px") > 0) {
		unit = "px";
	}
	return (unit);
}

PositionElement.prototype.getValue = function (val) {
	var ret = 0;
	try {
		for (var i = 0; i < val.length; i++) {
			var c = val.charAt(i);
			if ((c == '-') || (c == '+') || ((c >= '0') && (c <= '9'))) {
				ret = parseInt (val.substring(i, val.length));
				if (c == '-') {
					this.rule = "r"; // relativ
				} else if (c == '+') {
					this.rule = "r"; // relativ
				}
				break;
			}
		}
	} catch (e) {}
	return (ret);
}

PositionElement.prototype.toString = function () {
	var ret = "";
	
	if (this.rule == 'a') {
		
	} else {
		if (this.value >= 0) {
			ret += "0";
		}
	}
	ret += this.value;
	ret += this.unit;
	return (ret);
}

Portlet.prototype.setContentBackground = function (color) {
	document.getElementById(this.id+"_content").style.backgroundColor = color;
}



function portlet_toggle (id, name, nr, what) {
//	alert ("portlet_toggle (id="+id+", name="+name+", nr="+nr+", what="+what+")");
	toggleTab(id, name, nr);
	document.getElementById(id).parentNode.parentNode.style.cursor="wait";
	ajax_fillTabPortlet (id, name, nr, what);
}

function createPopUp (btn, id, title, h, contentAction, parameterList) {
	ele = document.getElementById(id);

	var b = document.body;
	// vom Element die Absolutposition bestimmen
	var r = document.getElementById (btn);
	var xPos = r.offsetLeft;
	var yPos = r.offsetHeight;
	while (r!=b) {
		var i = parseInt(r.offsetTop);
		if (i) yPos += i;
		i = parseInt(r.offsetLeft);
		if (i) xPos += i;
		r = r.offsetParent;
	}

	if (!ele) {
		ele = _createPopUp (id, title);
		ele.style.left = xPos;
		ele.style.top = yPos;
		document.body.appendChild(ele);
		pp.zIndex = 10000;
		new Portlet (id, title, xPos, yPos, 0, h, true);
		
		pp.obj = pp.elements[id];
		pp.obj.display("none");
		pp.elements[id].setPosition (-1, -1, 200, h, "true");
		ajax_getPortletPosition(id);
	}

	var args;
	args = new Array();
	args[args.length]="id="+id;

	for (i = 4; i < createPopUp.arguments.length; i++) {
		args[args.length] = createPopUp.arguments[i];
	}

	_sendAsyncRequest (contentAction, false, args);
	pp.elements[id].display("block");
}

function _createPopUp (id, title) {
/*
	ele = document.createElement("div");
	ele.className = "Portlet";
	ele.setAttribute ("id", id);
	ele.setAttribute ("onMouseDown", "pp.avoidBubble();");
	ele.setAttribute ("style", "display:block; z-index:10000;");

	pop =  "<div id=\""+id+"_title\" class=\"PortletTitle\">";
	pop += "   <span id=\""+id+"_title_text\"> </span>";
	pop += "    <img id=\""+id+"_closeButton\" class=\"PortletToggleButton\" src=\""+__imageadresse__+"maximize.gif\" onMousedown=\"pp.elements."+id+".close();\">";
	pop += "</div>";
	pop += "<div id=\""+id+"_content\" class=\"PortletContent\"> </div>";
	pop += "<div id=\""+id+"_status\" class=\"PortletStatus\">";
	pop += "   <div id=\""+id+"_resize\" class=\"PortletResizeButton\" style=\"background-image: url("+__imageadresse__+"resize3.gif);\" ></div>";
	pop += "</div>";
	
	ele.innerHTML = pop;
	return (ele);
*/
}


/** Schließt ein portlet */
function closePortlet(portletID) {
	if( pb.elements[portletID] ) {
		pb.elements[portletID]._close ();
	}
}

function HideAllPortlets() {
	if ( pb && pb.elements) {
		for (var key in pb.elements) {
				pb.elements[key].obj.style.display="none";
		}
	}
}


/* JsInclude file=hour_calc.js */

var CalculatorClass = function() {
	this.id = 'currentcalculatorid';
}

CalculatorClass.prototype.Show = function(elementid, plan_value) {
	if (!this.portlet) {
		this.portlet = new Portlet (this.id);
		this.portlet.setHeader("middle", calc_header);
		this.portlet.setSize (180, 160);
		this.portlet.setFlags (this.portlet.FLAG_CLOSE | this.portlet.FLAG_SHOW_HEADER);
		this.div = document.getElementById(this.id+"_content");
	}
	this.value_plan = plan_value;
	this.value_plan_estimated = document.getElementById (elementid).value;

	this.refelement = document.getElementById(elementid);
	if (!this.refelement) return;

	this.createTable (this.div);
	var xPos = pb.e.x + 10;
	var yPos = pb.e.y - 140;
	if (pb.ie) {
		xPos += document.body.scrollLeft;
		yPos += document.body.scrollTop;
	}
	this.portlet.setPosition(xPos, yPos);
	this.portlet.show ();
}

CalculatorClass.prototype.createTable = function(base) {

	var s = '<table class="calc">'+
				'<tr>'+
					'<td class="calc_label">'+calc_label_plan+'</td>'+
					'<td class="calc_value">'+this.value_plan+'<input type="hidden" name="plan" id="plan" value="'+this.value_plan+'" /></td>'+
					'<td class="calc_unit">'+calc_unit+'</td>'+
				'</tr>'+
				'<tr>'+
					'<td class="calc_label">'+calc_label_plan_estimated+'</td>'+
					'<td class="calc_value">'+this.value_plan_estimated+'<input type="hidden" name="plan" id="plan_estimated" value="'+this.value_plan_estimated+'" /></td>'+
					'<td class="calc_unit">'+calc_unit+'</td>'+
				'</tr>'+
				'<tr>'+
					'<td class="calc_label">'+calc_label_mehr+'</td>'+
					'<td style="text-align:right;"><input style="text-align:right;font-size:1.0em;" name="mehr" id="mehr" size="5" maxlength="5" onchange="Calculator.calc();" /></td>'+
					'<td class="calc_unit">'+calc_unit+'</td>'+
				'</tr>'+
				'<!-- tr><td colspan="3" style="padding:0px;"><hr></td></tr -->'+
				'<tr>'+
					'<td class="calc_label" style="font-weight:bold;border-top:1px solid #4682B4;">'+calc_label_summe+'</d>'+
					'<td style="text-align:right;border-top:1px solid #4682B4;"><input style="text-align:right;border:none;font-size:1.0em;" name="summe" id="summe" size="5" readonly="true" value="'+this.value_plan_estimated+'" /></td>'+
					'<td class="calc_unit" style="border-top:1px solid #4682B4;">'+calc_unit+'</td>'+
				'</tr>'+
				'<tr>'+
					'<td colspan="3" style="padding:5px;"><input class="button" type="button" name="'+calc_save+'" value="'+calc_save+'" id="saveResult" onclick="Calculator.SaveResult()" /></td>'+
				'</tr>'+
			'</table>';

	base.innerHTML = s;
}

CalculatorClass.prototype.calc = function () {
	var plan, mehr, summe;

	try {
		plan = document.getElementById ("plan_estimated").value;
		plan = this.toEn (plan);
		this.getDecimals (plan);
		var plan = eval (plan +"+0");
		
		if (plan == 0) {
			plan = document.getElementById ("plan").value;
			plan = this.toEn (plan);
			this.getDecimals (plan);
			plan = eval (plan +"+0");
		}
	} catch (e) {
		alert (err_plan_NaN);
		document.getElementById ("mehr").focus();
		return false;
	}
	try {
		mehr = document.getElementById ("mehr").value;
		mehr = this.toEn (mehr);
		var mehr = eval (mehr +"+0");
	} catch (e) {
		alert (err_mehr_NaN);
		document.getElementById ("mehr").focus ();
		return false;
	}
	if (plan < 0) {
		alert (err_plan_pos);
		document.getElementById ("mehr").focus();
		return (false);
	}
	summe = eval (plan+"+"+mehr);
	if (summe < 0) {
		alert (err_sum_pos);
		document.getElementById ("mehr").focus();
		return (false);
	}
	// auf 2 Nachkommastellen runden
	summe = Math.floor(summe*100)/100;
	summe = this.toLocal (summe);
	this.summe = summe;
	document.getElementById ("summe").value = summe;
	document.getElementById ("saveResult").focus();
}

CalculatorClass.prototype.toLocal = function (val) {
	val = String(val);
	var idx = val.indexOf(".");
	if (idx != -1) {
		val = val.substring(0,idx)+decimalSeparator+val.substring (idx+1, val.length);
		var dec = val.length - idx;
		if (dec < this.decimals) {
			while (dec-- > 0) {
				val += "0";
			}
		}
	} else if (this.decimals > 0) {
		var dec = this.decimals;
		val += decimalSeparator;
		while (dec-- > 0) {
			val += "0";
		}
	}
	return (val);
}

CalculatorClass.prototype.getDecimals = function (val) {
	val = String(val);
	var idx = val.indexOf(".");
	if (idx < 0) {
		this.decimals = 0;
	} else {
		this.decimals = val.length - idx -1;
	}
}

CalculatorClass.prototype.toEn = function (val) {
	val = String(val);

	while (val.indexOf (groupingSeparator) != -1) {
		var idx = val.indexOf(groupingSeparator);
		val = val.substring(0,idx)+val.substring (idx+1, val.length);
	}
	var idx = val.indexOf(decimalSeparator);
	if (decimalSeparator != ".") {
		while (idx != -1) {
			val = val.substring(0,idx)+"."+val.substring (idx+1, val.length);
			idx = val.indexOf(decimalSeparator);
		}
	}
	return (val);
}

CalculatorClass.prototype.SaveResult = function () {
	this.calc ();
	document.getElementById (this.refelement.id).value = this.summe;
	this.portlet.hide();
}

var Calculator = new CalculatorClass();

/* JsInclude file=tab.js */
var DHTML = 0, DOM = 0, MS = 0, NS = 0, OP = 0;

if (window.opera) {
	OP = 1;
}
if(document.getElementById) {
	DHTML = 1;
	DOM = 1;
}
if(document.all && !OP) {
	DHTML = 1;
	MS = 1;
}
if (window.netscape && window.screen && !DOM && !OP){
	DHTML = 1;
	NS = 1;
}

var tabs_selected = Array ();

function toggleTab (id, name, nr) {

	var actualClass;
	var swap;
	var e;

	var divs = document.getElementById (id).parentNode.childNodes;
	for (var i = 0; i < divs.length; i++) {
		if (divs[i].nodeName == "DIV") {
			var clazz = MS ? divs[i].className : divs[i].getAttribute("class");
			if (clazz == "tab_content") {
				divs[i].style.display = "none";
				
				e = document.getElementById ("tab_head_middle_"+divs[i].id);
				actualClass = MS ? e.className : e.getAttribute("class");
				if ( actualClass.indexOf("selected") != -1 && id != divs[i].id) {

					if ( MS ) {
						document.getElementById ("tab_head_middle_"+id).className = "tab_pane_head selected";
						document.getElementById ("tab_head_middle_"+divs[i].id).className = "tab_pane_head";
					} else {
						document.getElementById ("tab_head_middle_"+id).setAttribute("class", "tab_pane_head selected" );
						document.getElementById ("tab_head_middle_"+divs[i].id).setAttribute("class", "tab_pane_head" );
					}

					/* Background-Image austauschen */
					swap = document.getElementById ("tab_head_middle_"+divs[i].id).style.backgroundImage;
					document.getElementById ("tab_head_middle_"+divs[i].id).style.backgroundImage = document.getElementById ("tab_head_middle_"+id).style.backgroundImage;
					document.getElementById ("tab_head_middle_"+id).style.backgroundImage = swap;

					/* Bilder austauschen */
					swap = document.getElementById ("tab_head_left_"+divs[i].id).src;
					document.getElementById ("tab_head_left_"+divs[i].id).src = document.getElementById ("tab_head_left_"+id).src;
					document.getElementById ("tab_head_left_"+id).src = swap;

			
					swap = document.getElementById ("tab_head_right_"+divs[i].id).src;
					document.getElementById ("tab_head_right_"+divs[i].id).src = document.getElementById ("tab_head_right_"+id).src;
					document.getElementById ("tab_head_right_"+id).src = swap;
					
				}
			}
		}
	}

	var t = document.getElementById (id);
	t.style.display = "block";
	tabs_selected[name] = nr;
//	alert ("tabs_selected["+name+"]="+tabs_selected[name]);
	return true;
}

/* JsInclude file=text_format.js */
/*
 * Funktionen fur Formattierung von Memo-Feldern
 */
 
/* {TextFormatJs} */


var fmtTimer;

function clearFmtTimer () {
	if (fmtTimer) {
//		debugWindow ("clearFmtTimer ()");
		window.clearTimeout(fmtTimer);
		fmtTimer = null;
	}
}
/*  Text bold formattieren.
 *  Wenn ein Text markiert wird, so wird dieser als fett markiert, sonst wird ein Beispieltext eingefügt.
 */
function fmt_bold(id) {
//	debugWindow ("fmt_bold (="+id+")");
	clearFmtTimer ();
	
	var text = TextArea.getSelection(id);
	if (!text || text.length == 0) {
		text = TextFormat.boldSample;
	}
	text = "[b]"+text+"[/b]";
	TextArea.replaceSelection(id, text, 3, 4);
}

/*  Text kursiv formattieren.
 *  Wenn ein Text markiert wird, so wird dieser als kursiv markiert, sonst wird ein Beispieltext eingefügt.
 */
function fmt_italic(id) {
//	debugWindow ("fmt_italic (="+id+")");
	clearFmtTimer ();
	
	var text = TextArea.getSelection(id);
	if (!text || text.length == 0) {
		text = TextFormat.italicSample;
	}
	text = "[i]"+text+"[/i]";
	TextArea.replaceSelection(id, text, 3, 4);
}

/*  Text underline formattieren.
 *  Wenn ein Text markiert wird, so wird dieser als underline markiert, sonst wird ein Beispieltext eingefügt.
 */
function fmt_underline(id) {
//	debugWindow ("fmt_underline (="+id+")");
	clearFmtTimer ();
	
	var text = TextArea.getSelection(id);
	if (!text || text.length == 0) {
		text = TextFormat.underlineSample;
	}
	text = "[u]"+text+"[/u]";
	TextArea.replaceSelection(id, text, 3, 4);
}

/*  Text als Link formattieren.
 *  Wenn ein Text markiert wird, so wird dieser als Link markiert, sonst wird ein Beispieltext eingefügt.
 */
function fmt_link(id) {
//	debugWindow ("fmt_link (="+id+")");
	clearFmtTimer ();
	
	var text = TextArea.getSelection(id);
	var url = text;
	var urlText = text;
	if (!text || text.length == 0) {
		url = TextFormat.linkSampleUrl;
		urlText = TextFormat.linkSampleText;
	}
	text = "[url="+url+"]"+urlText+"[/url]";
	TextArea.replaceSelection(id, text, 5, 6);
}

function fmt_on_focus (id) {
//	debugWindow ("fmt_on_focus (="+id+", show="+show+")");
	fmt_disp_edit(id, true);
}

function fmt_on_blur (id, show) {
//	debugWindow ("fmt_on_blur (="+id+", show="+show+")");
	fmt_disp_edit(id, false);
}

/*
 * Edit-Zeile ein- und ausblenden
 */
function fmt_disp_edit(id, show) {
	var e = document.getElementById(id); 
//	if(!e) return '';
	if(!e) return;
	
//	debugWindow ("fmt_disp_edit (="+id+", show="+show+")");
/*
	if (fmtTimer) {
		debugWindow ("fmt_disp_edit: clear Timer");
		window.clearTimeout(fmtTimer);
		fmtTimer = null;
	}
*/
	if (show) {
		e.style.display = "block";
	} else {
		var cmd = "document.getElementById ('"+id+"').style.display = 'none';";
		fmtTimer = window.setTimeout(cmd, 200);
	}
}

var TextArea = {
	getSelection: function(id) {
		var f = document.getElementById(id); 
		if(!f) return '';

		if(pb.ie) return document.selection.createRange().text;
		return f.value.substring(f.selectionStart, f.selectionEnd);
	},

 	/* replaces the selection with aValue, and returns with aValue selected */
	replaceSelection: function(id, newText, startPadding, endPadding){
 		var f = document.getElementById(id); 
 		if(!f) return;
 		var scrollTop = this.scrollTop;

 		if(pb.ie){
 			f.focus();
 			var r = document.selection.createRange();
			r.text = newText;
//			r.moveStart('character',-newText.length);
			r.moveStart('character',startPadding-newText.length);
			r.moveEnd('character', -endPadding);
			r.select();
//			f.range.select();
		} else {
			var start = f.selectionStart, end = f.selectionEnd;
			f.value = f.value.substring(0, start) + newText + f.value.substring(end);
//			f.replaceSelectionRange(start + newText.length, start + newText.length);
			f.selectionStart = start+startPadding;
    		f.selectionEnd = start + newText.length - endPadding;
		}
		f.focus();
		f.scrollTop = scrollTop;
		if(f.onchange) f.onchange();
	},

	/* check whether selection is preceeded by a \n (peek-ahead) */
	isSelectionAtStartOfLine: function(id){
		var f = document.getElementById(id); 
		if(!f) return false;

		if(pb.ie) {
			f.focus();
			var r1 = document.selection.createRange(),
			r2 = document.selection.createRange();
			r2.moveStart( "character", -1);
			if(r2.text=="") r2.moveEnd( "character", 1);
			if(r1.compareEndPoints("StartToStart", r2) == 0) return true;
			if(r2.text.charAt(0).match( /[\n\r]/ )) return true;
		} else {
			if(f.value.charAt(f.selectionStart-1) == '\n') return true;
		}
		return false;
	}
};

/* JsInclude file=listbox.js */

/**
 * dient der Eingabeunterst?tzung f?r ListBoxen
 */

var ListBoxClass = function() {
	this.num = 0;
	this.current = null;
	this.text = '';
	this.disabled = null;
	this.previndex = null;
	this.changed = null;
	this.oldonchange = null;
	this.oldonclick = null;
	this.oldonkeypress = null;
	this.oldonkeydown = null;
	this.oldonblur = null;
}

/**
 * f?r Event select.onselect
 * Listbox ausgew?hlt
 */
ListBoxClass.prototype.Select = function(lb) {
	this.setProps(lb);
//debugWindow ("Select");
// Bug #15983 - Das Select wird erst im OnFocus aufgerufen.
// Dann ist der neue Index aber bereits gesetzt, so dass die Bedingung
//		this.previndex!=this.current.selectedIndex
// im OnChange immer false liefert.
// Ein initiales Setzen des previndex auf -1 löst dieses Initialiserungsproblem
//	this.previndex=lb.selectedIndex;
// Bug #15983 - Deselektieren funktioniert nicht richtig.
// Vorbelegung mit -2 behabt auch das
	if (lb.multiple) {
		this.previndex=-2;	
	} else {
		this.previndex=lb.selectedIndex;
	}
	this.changed=false;
	this.current=lb;
	this.text='';
	this.disabled= new Array();
	// nun alle options sichtbar machen
	for(var i=0; i<this.current.options.length; i++) {
		var o = this.current.options[i];
		o.style.display='';
		this.disabled[o.index]=o.disabled;
	}
//	debugWindow ("Select DONE");
}

/**
 * setzt neue aktuelle ListBox
 */
ListBoxClass.prototype.setProps = function(lb) {
	// erst mal die alten props wiederherstellen wenn gesetzt
//	debugWindow ("setProps");
	if (this.current) {
		this.current.onkeypress=this.oldonkeypress;
		this.current.onkeydown=this.oldonkeydown;
		this.current.onblur=this.oldonblur;
		this.current.onclick=this.oldonclick;
		this.current.onchange=this.oldonchange;
		this.current=null;
	}
	if (lb) {
		// nun die neuen props setzen
		this.oldonkeypress=lb.onkeypress;
		this.oldonkeydown=lb.onkeydown;
		this.oldonblur=lb.onblur;
		this.oldonclick=lb.onclick;
		this.oldonchange=lb.onchange;
		
		lb.onchange   = function(e) { return ListBox.OnChange(e); };
		lb.onkeypress = function(e) { return ListBox.KeyPress(e); };
		lb.onkeydown  = function(e) { return ListBox.KeyDown(e); };
		lb.onclick    = function(e) { return ListBox.OnClick(e); };
		lb.onblur     = function(e) { return ListBox.Blur(e); };
	}
//	debugWindow ("setProps DONE");
}

/**
 * Event select.onblur
 * Listbox deselektiert
 */
ListBoxClass.prototype.Blur = function(event) {
	if (!this.current) return false;
	this.OnChange(event);
	window.status = '';
	for(var i=0; i<this.current.options.length; i++) {
		var o = this.current.options[i];
		o.disabled=this.disabled[o.index];
		o.style.display='';
	}
	this.setProps(null);
	return true;
}

ListBoxClass.prototype.OnClick = function(event) {
//	debugWindow ("OnClick");
	this.OnChange(event);
	if (this.oldonclick) {
		var f = this.current.onclick;
		this.current.onchange=this.oldonclick;
		try {
			this.current.onclick(event);
		} catch (ex) {}
		this.current.onclick=f;
	}
//	debugWindow ("OnClick DONE");
}

ListBoxClass.prototype.OnChange = function(event) {
//	debugWindow ("OnChange: current="+this.current+"previndex="+this.previndex+", selectedIndex="+this.current.selectedIndex);
	if (this.current && this.previndex!=this.current.selectedIndex && this.oldonchange) {
		var f = this.current.onchange;
		this.current.onchange=this.oldonchange;
		try {
			this.current.onchange(event);
		} catch (ex) {}
		try {
			this.current.onchange=f;
			this.previndex = this.current.selectedIndex;
		} catch (ex) {}
	}
//	debugWindow ("OnChange DONE");
}

/**
 * Event select.onkeydown
 * Steuer-Taste in der Listbox gedr?ckt
 */
ListBoxClass.prototype.KeyDown = function(event) {
	var k=0;
	try {
		try {
			k = typeof(event.keyCode)!='number'?window.event.keyCode:event.keyCode;
		} catch (ex3) {
			k = window.event.keyCode;
		}

		switch (k) {
			case 27 :	this.text=''; break;
			case 8  :	if (this.text.length>0) 
							this.text=this.text.substr(0,this.text.length-1);
						break;
			default : return true;
		}
		this.CheckLB();
	} catch (ex) {
		window.status = ex;
	}
	return false;
}

/**
 * Event select.onkeypress
 * Zeichen-Taste in der Listbox gedr?ckt
 */
ListBoxClass.prototype.KeyPress = function(event) {
	var c;
	try {
		try {
			c = typeof(event.keyCode)!='number'?window.event.keyCode:event.charCode;
		} catch (ex3) {
			c = window.event.keyCode;
		}
		if (c>=32) {
			this.text += String.fromCharCode(c).toLowerCase();
			this.CheckLB();
			return false;
		}
	} catch (ex) {
		window.status = ex;
	}
	return true;
}

/**
 * check auf Treffer in der Listbox mit dem Text
 */
ListBoxClass.prototype.CheckLB = function() {
	window.status=this.text;
	var oldindex = this.current.selectedIndex;
	var oldstate = oldindex>=0?this.current.options[oldindex].disabled:false;
	var newstate = oldstate;
	var newindex = -1;
	this.changed = true;
	
	function setState(o,state) {
		if (o.index==oldindex) newstate=!state;
		if (state) {
			o.style.display='';
			o.disabled=ListBox.disabled[o.index];
			if (newindex<0) {
				newindex=o.index;
				o.selected=true;
				o.parentNode.selectedIndex=o.index;
			}
		} else {
			o.style.display='none';
			o.disabled = true;
		}
	}
	
	var l = this.text.length;
	var r = new RegExp(''+this.text+'.*');
	for(var i=0; i<this.current.options.length; i++) {
		var o = this.current.options[i];
		var s = o.text;
		if (!s || typeof(s)!='string') continue;
		//setState(o, this.text==s.substr(0,l).toLowerCase()  );
		setState(o, r.test(s.toLowerCase())==true );
	}
	if (oldindex<=0 || newstate) {
		this.current.selectedIndex=newindex;
		if (newindex>=0) this.current.options[newindex].selected=true;
	}

	//window.status = 'oi:'+oldindex+' ni:'+newindex+' os:'+oldstate+' ns:'+newstate;
}

var ListBox = new ListBoxClass();

/* JsInclude file=form.js */
var formSearch = new Array();

var ExtendedForm = function (staffid, id, masks, openMsg, closeMsg) {
	var c;
	this.buttonId = id+"_full";
	this.masks	  = masks;
	this.cookiekey = staffid+this.masks+this.buttonId;
	this.formID   = id+"_content";
	this.showRow  = MS ? "block" : "table-row";
	this.show      = false;
	this.openMsg  = openMsg;
	this.closeMsg = closeMsg;
/*
	c = ajax_GetUserProperty (this.cookiekey);
	if (c) {
		this.show = (c == '1' );
	}
	ajax_SetUserProperty (this.cookiekey, this.show ? '1':'0');
*/
	//	debugWindow ("new ExtendedForm: show="+this.show);
}

ExtendedForm.prototype.toggle = function() {
	this.show = !this.show;
	ajax_SetUserProperty (this.cookiekey, this.show ? '1':'0');
}

var FormOpenImage = new Image();
FormOpenImage.src = __imageadresse__+"form_open_all.gif";
var FormCloseImage = new Image();
FormCloseImage.src = __imageadresse__+"form_close_all.gif";

var FormOpenPartImage = new Image();
FormOpenPartImage.src = __imageadresse__+"form_open_part.gif";
var FormClosePartImage = new Image();
FormClosePartImage.src = __imageadresse__+"form_close_part.gif";


ExtendedForm.prototype.showSubFormular = function() {
//	debugWindow ("showSubFormular ()");
	var i;
	var ele;
	var found;
	
	c = ajax_GetUserProperty (this.cookiekey);
	if (c) {
		this.show = (c == '1' );
	}

	ele = document.getElementById(this.buttonId);
//	debugWindow ("showSubFormular: ele="+ele);
	if ( ele ) {

		if (this.show) {
			ele.src = FormClosePartImage.src; // "images/form_close_part.gif";
			ele.alt = this.closeMsg;
			ele.title = this.closeMsg;
		} else {
			ele.src = FormOpenPartImage.src; // "images/form_open_part.gif";
			ele.alt = this.openMsg;
			ele.title = this.openMsg;
		}

		var eFormID = document.getElementById(this.formID);
		if ( eFormID ) {
			eFormID.style.display = this.show ? 'block': 'none';
		} else {
			found = 0;
			var trs = document.getElementsByTagName ("tr");
			for (i = 0; found != 2 && i < trs.length; i++) {
				var clazz = MS ? trs[i].className : trs[i].getAttribute("class");
				if ( clazz !=  null ) {
					if (clazz.indexOf(this.formID) >= 0) {
						found = 1;
						trs[i].style.display = this.show ? this.showRow: "none";
					}
				}
			}
		}
	}
}

function addExtendForm (staffid, id, masks, openMsg, closeMsg) {
//	debugWindow ("addExtendForm (staffid="+staffid+", id="+id+", maske="+masks+", openMsg"+openMsg+", closeMsg="+closeMsg);
	formSearch[id] = new  ExtendedForm (staffid, id, masks, openMsg, closeMsg); 
}

function showForm(buttonID) {
//	debugWindow ("showForm (buttonID="+buttonID+")");

	formSearch[buttonID].showSubFormular();
}

function toggleForm(buttonID) {
//	debugWindow ("toggleForm (buttonID="+buttonID+") formSearch["+buttonID+"]="+formSearch[buttonID]);
	formSearch[buttonID].toggle();
	formSearch[buttonID].showSubFormular();
}

function showFormular(id) {
//	debugWindow ("showFormular (id="+id+")");
	var c;
//	c = Cookies.get(id);
	c = ajax_GetUserProperty (id);
	if ( c == null ) {
		c = '1';
	}
	var ele = document.getElementById(id);
	if ( ele ) {
		ele.style.display = (c == '1' ) ? '' : 'none';
	}
	var image = document.getElementById(id+"_toggle");
	if (image) {
		image.src= (c == '1' ) ? FormCloseImage.src : FormOpenImage.src;
	}
}

function toggleFormular(id, openMsg, closeMsg) {
//	debugWindow ("toggleFormular (id="+id+")");
	
	var tr_ele;
	tr_ele = document.getElementById(id);
	if ( tr_ele ) {
		var image = document.getElementById(id+"_toggle");
		var tab = tr_ele;
		while (tab.nodeName != "TABLE") {
			tab = tab.parentNode;
		}
		var oldWidth = tab.clientWidth;
		
		if ( tr_ele.style.display!= 'none' ) {
			tr_ele.style.display ='none';
			image.src=FormOpenImage.src;
			image.alt = openMsg;
			image.title = openMsg;
//			Cookies.set(id,"0");
			ajax_SetUserProperty (id, '0');
		} else {
			tr_ele.style.display = '';
			image.src=FormCloseImage.src;
			image.alt = closeMsg;
			image.title = closeMsg;
//			Cookies.set(id,"1");
			ajax_SetUserProperty (id, '1');
		}
		
		tab.style.width = oldWidth;
	}
}

function toggleFormFilterOutput(id) {
	var tr_ele;
	tr_ele = document.getElementById(id+"_td");
	if ( tr_ele ) {
		var image = document.getElementById(id+"_full");
		var tf_filter = document.getElementById(id+"_td_filter");

		if ( tr_ele.style.display!= 'none' ) {
			tr_ele.style.display ='none';
			tf_filter.style.display='';
			image.src=FormOpenPartImage.src;
//			Cookies.set(id,"0");
			ajax_SetUserProperty (id, '0');

		} else {
			tr_ele.style.display = '';
			tf_filter.style.display='none';
			image.src=FormClosePartImage.src;
//			Cookies.set(id,"1");
			ajax_SetUserProperty (id, '1');
		}
	}
}


/* [JsInclude, file=dominspector.js] */

/* [JsInclude, file=cal.js] */

