/*================================================================================*/
/*                                                                                */
/*             BW2Technologies.Web.JScript.Framework (Alpha V1.0.0.0)             */
/*                                                                                */
/*                             Web-Framework Global                               */
/*                                                                                */
/*              Copyright © 2006-2010 by BW2Technologies (HP. Lassnig)            */
/*                           mail to : hansi@lassnig.ch                           */
/*                                                                                */
/*================================================================================*/

var _oActiveObject = null;
var _oLoading = null;
var _oResizeObjects = new Array();
var _oWindowWait = null;

var _oSkinColors = new Array();
var _oSkinCssClasses = new Array();
var _oSkinImages = new Array();
var _oSkinValues = new Array();

var _fSyncLock = false;
var _fResizeEvent = false;
var _fResizeEventInt = false;
var _fWaitEnd = false;

var _nCount = 0, _nStep = 0, _nStepTime = 0, _nStepValue = 0, _nStepWidth = 0;
var _nWindowWaitLeft = 0, _nWindowWaitTop = 0;

var _strFailoverURL = null;

window.ZIndex = 10;

/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/


/*================================================================================*/
/* <Function> FrameWork Error </Function>
/*================================================================================*/
function __bw2FrameworkError(strName, strDescription, lNumber) {
	       this.name = strName;
	       this.description = strDescription;
	       this.number = lNumber;

	       return this;
}

/*--------------------------------------------------------------------------------*/

__bw2FrameworkError.prototype.toString = function() { return this.name + " " + this.description; }

/*================================================================================*/
/* <Function> FrameWork Error </Function>
/*================================================================================*/
function __bw2FrameworkResize() {
         try {
             __bw2SplitContainersResize();  
             __bw2DashboardsResize();  
         } catch (e) {}
}

/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/


/*================================================================================*/
/* <Function> Add to Event-Listener </Function>
/*================================================================================*/
function __bw2AddEventListener(oObj, strEvent, refEventFunction, fCapture) {
         if (!(oObj = __bw2GetElementById(oObj))) return; //{ alert('__bw2AddEventListener no Object'); return; }
         strEvent = strEvent.toLowerCase();

         //if ((!_fIE4Up && !_fOp7Up && !_fNs8) && oObj == window) {
         if ((!_fIE4Up && !_fOp7Up && !_fNs8 && oObj != window)) {
            if (strEvent == 'resize') { 
               window.ClientWidth = __bw2WindowWidth(); 
               window.ClientHeight = __bw2WindowHeight(); 

               if (window.EventResizeFunctions == null) window.EventResizeFunctions = new Array();
               
               if (oObj.id != null) {
                  var oSet = new Object();

                  oSet.Function = refEventFunction; 
                  oSet.ID = oObj.id; 
                  oSet.OldWidth = oObj.offsetWidth;
                  oSet.OldHeight = oObj.offsetHeight;
               
                  window.EventResizeFunctions[window.EventResizeFunctions.length] = oSet;

                  if (!_fResizeEvent) __bw2ResizeEvent();
               }
                
               return; 
            }

            if (strEvent == 'scroll') { 
               window.ScrollLeft = __bw2ScrollLeft(); 
               window.ScrollTop = __bw2ScrollTop(); 
               window.EventScroll = refEventFunction; 
               __bw2ScrollEvent(); 
               return; 
            } 
         }

         try {
             if (oObj.addEventListener) {
                oObj.addEventListener(strEvent, refEventFunction, fCapture);
             } else if (oObj.attachEvent) {
                oObj.attachEvent('on' + strEvent, refEventFunction);

                if (fCapture == true) { 
                   //__bw2Debug('oObj.attachEvent : ' + strEvent + ', ' + fCapture);         
                   //oObj.setCapture();
                } 
            } else {
                eval('oObj.on' + strEvent + ' = refEventFunction;');
            }
         } catch (e) {
//             alert('__bw2AddEventListener : ' + e);
         }
}

/*================================================================================*/
/* <Function> Remove from Event-Listener </Function>
/*================================================================================*/
function __bw2RemoveEventListener(oObj, strEvent, refEventFunction, fCapture) {
         if (!(oObj = __bw2GetElementById(oObj))) return;
         strEvent = strEvent.toLowerCase();
         
         if (oObj.removeEventListener) {
            oObj.removeEventListener(strEvent, refEventFunction, fCapture);
         } else if (oObj.detachEvent) {
            oObj.detachEvent('on' + strEvent, refEventFunction);
         } else {
            eval('oObj.on' + strEvent + ' = null;');
         }
}

/*================================================================================*/
/* <Function> Append Child-Element to Form-Tag </Function>
/*================================================================================*/
function __bw2AppendChildElement(oObj) {
         try { 
             var oForm = __bw2GetElementById('oForm');
             if (oForm == null) oForm = document.getElementsByTagName('FORM')[0]
             if (oForm) oForm.appendChild(oObj); 
         } catch (e) {}
}

/*================================================================================*/
/* <Function> Append Child-Element to Form-Tag </Function>
/*================================================================================*/
function __bw2RemoveChildElement(oObj) {
         try { 
             var oForm = __bw2GetElementById('oForm');
             if (oForm == null) oForm = document.getElementsByTagName('FORM')[0]
             if (oForm) oForm.removeChild(oObj); 
         } catch (e) {}
}

/*================================================================================*/
/* <Function> Set Active-Object </Function>
/*================================================================================*/
function __bw2SetActiveObject(oObject) {
         if (oObject == null) return;
         
         try {
             var oHidden = __bw2GetElementById('__ACTIVEOBJECT');

             _oActiveObject = oObject;
             oHidden.value = _oActiveObject.id;
         } catch (ex) {}
}

/*================================================================================*/
/* <Function> Get Key-Event Options (Alt/Shift/Ctrl)-Pressed </Function>
/*================================================================================*/
function __bw2GetEventKeyOptions(oEvent) {
         if (oEvent == null) return 0;

         var nKO = 0;

         try {
             if (oEvent.altKey) nKO |= 1;
             if (oEvent.altLeft) nKO |= 2;
             if (oEvent.ctrlKey) nKO |= 4;
             if (oEvent.ctrlLeft) nKO |= 8;
             if (oEvent.shiftKey) nKO |= 16;
             if (oEvent.shiftLeft) nKO |= 32;
         } catch (ex) {}

         return nKO;
}

/*================================================================================*/
/* <Function> Prüfe ob CapsLock gedrückt </Function>
/*================================================================================*/
function __bw2CheckCapsLock(oEvent) {
         var nKeyCode = 0;
         var fShiftKey = false;

         /*--- Internet Explorer 4+ ---*/
         if (document.all) {
            nKeyCode = oEvent.keyCode;
            fShiftKey = oEvent.shiftKey;

         /*--- Netscape 4 ---*/
         } else if (document.layers) {
            nKeyCode = oEvent.which;
            fShiftKey = (nKeyCode == 16) ? true : false;

         /*--- All newer Browsers ---*/
         } else if (document.getElementById) {
            nKeyCode = oEvent.which;
            if (oEvent.shiftKey) fShiftKey = true;
         }

         /*--- Upper case letters are seen without depressing the Shift key, therefore Caps Lock is on ---*/
         if ((nKeyCode > 64 && nKeyCode < 91) && !fShiftKey) {
            return true;

         /*--- Lower case letters are seen while depressing the Shift key, therefore Caps Lock is on ---*/
         } else if ((nKeyCode > 96 && nKeyCode < 123) && fShiftKey) {
            return true;
         } 
         
         return false;
}

/*================================================================================*/
/* <Function> Resize Object-Childs </Function>
/*================================================================================*/
function __bw2ChildResize(oObject, strTag) {
         if (strTag == null) strTag = 'DIV';

         for (nI = 0; nI < oObject.childNodes.length; nI++) {
//alert(oObject.childNodes[nI].id + ', ' + oObject.childNodes[nI].tagName);
             
             try {
                 if ((oObject.childNodes[nI].tagName == strTag) && (oObject.childNodes[nI].NotResize != true)) {
                    with (oObject.childNodes[nI]) {
                         if (_fIE) {
                            style.width = oObject.offsetWidth - offsetLeft;
                            style.height = oObject.offsetHeight - offsetTop;
                         } else {
                            style.width = oObject.offsetWidth - offsetLeft - parseInt(style.borderLeftWidth) - parseInt(style.borderRightWidth);
                            style.height = oObject.offsetHeight - offsetTop - parseInt(style.borderTopWidth) - parseInt(style.borderBottomWidth);
                         }   
                    }
                 }
    
                 /*--- Resize Controls (Frame, Grid, ..) ---*/
                 if ((oObject.childNodes[nI].Type) && (oObject.childNodes[nI].Type == 'editor' || oObject.childNodes[nI].Type == 'grid' || oObject.childNodes[nI].Type == 'timeplan' || oObject.childNodes[nI].Type == 'repeater')) oObject.childNodes[nI].Resize();
             } catch (e) {}
         }
}

/*================================================================================*/
/* <Function> Get Valid-Date </Function>
/*================================================================================*/
function __bw2IsValidDate(Day, Mn, Yr){

         var DateVal = Mn + "/" + Day + "/" + Yr;
         var dDate = new Date(DateVal);

         if (Date.getDate() != Day){
            alert('Invalid Date');
            return(false);
         } else if (Date.getMonth() != Mn-1) {
           //this is for the purpose JavaScript starts the month from 0
            alert('Invalid Date');
            return(false);
         } else if (Date.getFullYear() != Yr) {
            alert('Invalid Date');
            return(false);
         }
        
         return(true);
 }

/*================================================================================*/
/* <Function> Spezial Selection </Function>
/*================================================================================*/
function __bw2SelectionSpez(oElement) {

     	 // Get ID of code block
	     var e = a.parentNode.parentNode.getElementsByTagName('CODE')[0];

         // Not IE
         if (window.getSelection) {
            var s = window.getSelection();
         
            // Safari
            if (s.setBaseAndExtent) {
               s.setBaseAndExtent(e, 0, e, e.innerText.length - 1);
            // Firefox and Opera
            } else {
               var r = document.createRange();
               r.selectNodeContents(e);
               s.removeAllRanges();
               s.addRange(r);
            }

         // Some older browsers
         } else if (document.getSelection) {
            var s = document.getSelection();
            var r = document.createRange();
            r.selectNodeContents(e);
            s.removeAllRanges();
            s.addRange(r);

         // IE
         } else if (document.selection) {
            var r = document.body.createTextRange();
            r.moveToElementText(e);
            r.select();
         }
}

/*================================================================================*/
/* <Function> Unselection </Function>
/*================================================================================*/
function __bw2Unselect() {
         try { 
             if (window.getSelection) {
                var oSel = window.getSelection();
                oSel.removeAllRanges();
             } else if (document.selection) {
                document.selection.empty(); 
             }
         } catch (e) {}
}
 
/*================================================================================*/
/* <Function> Get Window-Height </Function>
/*================================================================================*/
function __bw2WindowHeight() {
         try {
             if (window.innerHeight) {
                return window.innerHeight;
             } else {
                return document.body.offsetHeight;
             }
         } catch (e) {}
       
//         var nH = 0;
//         
//         if (_fOp6Dn) nH = window.innerHeight;
//         else if (document.compatMode == 'CSS1Compat' && !window.opera && document.documentElement && document.documentElement.clientHeight)
//            nH = document.documentElement.clientHeight;
//         else if (document.body && document.body.clientHeight)
//            nH = document.body.clientHeight;
//         else if (__bw2Def(window.innerWidth, window.innerHeight, document.width)) {
//            nH = window.innerHeight;
//            if (document.width > window.innerWidth) nH -= 16;
//         }

//         return nH;
}

/*================================================================================*/
/* <Function> Get Window-Width </Function>
/*================================================================================*/
function __bw2WindowWidth() {
         try {
             if (window.innerWidth) {
                return window.innerWidth;
             } else {
                return document.body.offsetWidth;
             }
         } catch (e) {}

//         var nW = 0;
//  
//         if (_fOp6Dn) nW = window.innerWidth;
//         else if (document.compatMode == 'CSS1Compat' && !window.opera && document.documentElement && document.documentElement.clientWidth) nW = document.documentElement.clientWidth;
//         else if (document.body && document.body.clientWidth) nW = document.body.clientWidth;
//         else if (__bw2Def(window.innerWidth, window.innerHeight, document.height)) {
//            nW = window.innerWidth;
//            if (document.height > window.innerHeight) nW -= 16;
//         }
//  
//         return nW;
}

/*================================================================================*/
/* <Function> Def </Function>
/*================================================================================*/
function __bw2Def() {
         for (var nI = 0; nI < arguments.length; ++nI) {
             if (typeof(arguments[nI]) == 'undefined') return false;
         }
         
         return true;
}

/*================================================================================*/
/* <Function> EventClientX </Function>
/*================================================================================*/
function __bw2EventClientX(oEvent) {
         if (_fIE) { return oEvent.clientX; } else { return oEvent.pageX; }
}

/*================================================================================*/
/* <Function> EventClientY </Function>
/*================================================================================*/
function __bw2EventClientY(oEvent) {
         if (_fIE) { return oEvent.clientY; } else { return oEvent.pageY; }
}

/*================================================================================*/
/* <Function> EventOffsetX </Function>
/*================================================================================*/
function __bw2EventOffsetX(oEvent) {
         if (_fIE) { return oEvent.offsetX; } else { return oEvent.layerX; }
}

/*================================================================================*/
/* <Function> EventOffsetY </Function>
/*================================================================================*/
function __bw2EventOffsetY(oEvent) {
         if (_fIE) { return oEvent.offsetY; } else { return oEvent.layerY; }
}

/*================================================================================*/
/* <Function> EventClientY </Function>
/*================================================================================*/
function __bw2EventSource(oEvent, strType) {
         if (!oEvent) return null;
        
         try{
             if (!strType) {
               if (_fIE) { return oEvent.srcElement; } else { return oEvent.target; }
             } else {
                switch(strType.toLowerCase) {
                      case 'from' :
                           if (_fIE) { return oEvent.fromElement; } else { return oEvent.relatedTarget; }
                           break;
                      case 'src' :
                           if (_fIE) { return oEvent.srcElement; } else { return oEvent.target; }
                           break;
                      case 'to' :
                           if (_fIE) { return oEvent.toElement; } else { return oEvent.currentTarget; }
                           break;
                      default :                     
                           if (_fIE) { return oEvent.fromElement; } else { return oEvent.relatedTarget; }
                           break;
                }
             }
         } catch (e) {
             alert('__bw2EventSource : ' + e);
             return null;
         }
}

/*================================================================================*/
/* <Function> Get Client-Info </Function>
/*================================================================================*/
function __bw2GetClientInfo() {
         try {
             var oCI = __bw2GetElementById('__CLIENTINFO'); 
             var strD = window.screen.width + '&';

             strD += window.screen.height + '&';
             strD += window.screen.colorDepth + '&';
             strD += __bw2WindowWidth() + '&'; 
             strD += __bw2WindowHeight(); 

             if (oCI != null) oCI.value = strD;
             
             /*--- Ajax Posted Information ---*/ 
             __bw2AjaxPost('__CLIENTINFO', strD);
         } catch (e) {
         }
}

/*================================================================================*/
/* <Function> Get Element Style </Function>
/*================================================================================*/
function __bw2GetComputedStyle(oObj, strProp, fInt) {
         var oS, oP = 'undefined';
         var oDV = document.defaultView;
          
         if (oDV && oDV.getComputedStyle){
            oS = oDV.getComputedStyle(oObj, '');
            if (oS) oP = oS.getPropertyValue(strProp);
 
         } else if(oObj.currentStyle) {         // convert css property name to object property name for IE
            var nI, strC, strA = strProp.split('-');
            
            strProp = strA[0];
            
            for (nI = 1; nI < strA.length; ++nI) {
                strC = strA[nI].charAt(0);
                strProp += strA[nI].replace(strC, strC.toUpperCase());
            }
            
            oP = oObj.currentStyle[strProp];
        } else return null;
        
        return fInt ? (parseInt(oP) || 0) : oP;
}

/*================================================================================*/
/* <Function> Get Client-Height </Function>
/*================================================================================*/
function __bw2ClientHeight() {
         var nV = 0, oD = document, oW = window;

         if (oD.compatMode == 'CSS1Compat' && !oW.opera && oD.documentElement && oD.documentElement.clientHeight)
            {nV = oD.documentElement.clientHeight;}
         else if (oD.body && oD.body.clientHeight)
            {nV = oD.body.clientHeight;}
         else if (__bw2Def(oW.innerWidth, oW.innerHeight, oD.width)) {
            nV = oW.innerHeight;
            if (oD.width > oW.innerWidth) nV -= 16;
        }
   
        return nV;
}

/*================================================================================*/
/* <Function> Get Client-Width </Function>
/*================================================================================*/
function __bw2ClientWidth() {
         var nV = 0, oD = document, oW = window;
 
         if (oD.compatMode == 'CSS1Compat' && !oW.opera && oD.documentElement && oD.documentElement.clientWidth) {
            nV = oD.documentElement.clientWidth;
         } else if (oD.body && oD.body.clientWidth) {
            nV = oD.body.clientWidth;
         } else if (__bw2Def(oW.innerWidth, oW.innerHeight, oD.height)) {
            nV = oW.innerWidth;
            if(oD.height > oW.innerHeight) nV -= 16;
         }

         return nV;
}

/*================================================================================*/
/* <Function> Get Cursor-Position </Function>
/*================================================================================*/
function __bw2GetCursorPosition(oObj) {
    oObj = oObj || window.event;

    var aCursor = {X:0, Y:0};

    if (oObj.pageX || oObj.pageY) {
       aCursor.X = oObj.pageX;
       aCursor.Y = oObj.pageY;
    } else {
       var oDE = document.documentElement;
       var oB = document.body;
        aCursor.X = oObj.clientX + (oDE.scrollLeft || oB.scrollLeft) - (oDE.clientLeft || 0);
        aCursor.Y = oObj.clientY + (oDE.scrollTop || oB.scrollTop) - (oDE.clientTop || 0);
    }
    
    return aCursor;
}

/*================================================================================*/
/* <Function> Get Element by ID </Function>
/*================================================================================*/
function __bw2GetElementById(oObj) {
         if (typeof(oObj) != 'string') return oObj;
         if (document.getElementById) oObj = document.getElementById(oObj);
         else if (document.all) oObj = document.all[oObj];
         else oObj = null;
         return oObj;
}

/*================================================================================*/
/* <Function> Get BW2-Form Object </Function>
/*================================================================================*/
function __bw2GetFormObject(oObj) {
         try {
             if ((oObj.Type) && (oObj.Type == 'form')) {
                return oObj;
             } else if (oObj.parentElement != null) {
//__bw2Debug('parentElement');             
                return __bw2GetFormObject(oObj.parentElement);
             } else if (oObj.parentNode != null) {
//__bw2Debug('parentNode');             
                return __bw2GetFormObject(oObj.parentNode);
             } else {
//__bw2Debug('No Parents');             
             }
         } catch (e) {
             __bw2Debug('__bw2GetFormObject Error : ' + e);
         }
}

/*================================================================================*/
/* <Function> Gibt Nummer zurück </Function>
/*================================================================================*/
function __bw2GetNumber(strValue) {
         if ((strValue == null) || (strValue == '')) return 0;

         var nN = 0;
                  
         switch (strValue.toLowerCase()) {
                case 'thin' : nN = 0; break;
                case 'medium' : nN = 1; break;
                case 'thick' : nN = 2; break;
                default : nN = Number(strValue.replace(/px/, '')); break;
         }

         return nN;
}

/*================================================================================*/
/* <Function> Gibt Style zurück </Function>
/*================================================================================*/
function __bw2GetStyle(oObj, strCssRule) {
	     var strValue = null;

  	     if ((document.defaultView) && (document.defaultView.getComputedStyle)) {
 	        strValue = document.defaultView.getComputedStyle(oObj, '').getPropertyValue(strCssRule);
	     } else if (oObj.currentStyle) {
	        strCssRule = strCssRule.replace(/-([a-zA-Z])/g, function (strMatch, f1) { return f1.toUpperCase(); });
	        strValue = oObj.currentStyle[strCssRule];
	     }
    	
	     return strValue;
}

/*================================================================================*/
/* <Function> Gibt Style-Left in Pxel zurück </Function>
/*================================================================================*/
function __bw2GetStyleLeft(oStyle) {
         if (oStyle.pixelLeft) {
            return oStyle.pixelLeft;
         } else {
            return Number(oStyle.left.replace(/px/, ''));
         }
}

/*================================================================================*/
/* <Function> Gibt Style-Top in Pxel zurück </Function>
/*================================================================================*/
function __bw2GetStyleTop(oStyle) {
         if (oStyle.pixelTop) {
            return oStyle.pixelTop;
         } else {
            return Number(oStyle.top.replace(/px/, ''));
         }
}

/*================================================================================*/
/* <Function> Gibt Style-Width in Pxel zurück </Function>
/*================================================================================*/
function __bw2GetStyleWidth(oStyle) {
         if (oStyle.pixelWidth) {
            return oStyle.pixelWidth;
         } else {
            return Number(oStyle.width.replace(/px/, ''));
         }
}

/*================================================================================*/
/* <Function> Gibt Style-Height in Pxel zurück </Function>
/*================================================================================*/
function __bw2GetStyleHeight(oStyle) {
         if (oStyle.pixelHeight) {
            return oStyle.pixelHeight;
         } else {
            return Number(oStyle.height.replace(/px/, ''));
         }
}

/*================================================================================*/
/* <Function> Get encoded HTML </Function>
/*================================================================================*/
function __bw2HTMLEncode(strData) {
         var strBuffer = '';

         for (nI = 0; nI < strData.length; nI++) {
             var cC = strData.charAt(nI); 

             if (cC >= 'a' && cC <= 'z' || cC >= 'A' && cC <= 'Z' || cC >= '0' && cC <= '9') {
                strBuffer += cC;
             } else {
                strBuffer += '&amp;#' + strData.charCodeAt(nI) + ';';
             }

             alert('Buffer : ' + strBuffer);
         }

         return strData;
}

/*================================================================================*/
/* <Function> Get decoded HTML </Function>
/*================================================================================*/
function __bw2HTMLDecode(strData) {
         var strBuffer = '';

         for (nI = 0; nI < strData.length; nI++) {
             var cC = strData.charAt(nI); 

             if (cC >= 'a' && cC <= 'z' || cC >= 'A' && cC <= 'Z' || cC >= '0' && cC <= '9') {
                strBuffer += cC;
             } else {
                strBuffer += '&amp;#' + strData.charCodeAt(nI) + ';';
             }

             alert('Buffer : ' + strBuffer);
         }

         return strData;
}

/*================================================================================*/
/* <Function> Num </Function>
/*================================================================================*/
function __bw2Num() {
         for (var nI = 0; nI < arguments.length; ++nI) { 
             if (isNaN(arguments[nI]) || typeof(arguments[nI])!='number') return false;
         }

         return true;
}

/*================================================================================*/
/* <Function>   </Function>
/*================================================================================*/
function __bw2PageX(oObj) {
         var nX = 0;
 
         oObj = __bw2GetElementById(oObj);
  
         while (oObj) {
               if (__bw2Def(oObj.offsetLeft)) nX += oObj.offsetLeft;
               oObj = __bw2Def(oObj.offsetParent) ? oObj.offsetParent : null;
         }
        
         return nX;
}

/*================================================================================*/
/* <Function>   </Function>
/*================================================================================*/
function __bw2PageY(oObj) {
         var nY = 0;
 
         oObj = __bw2GetElementById(oObj);
  
         while (oObj) {
               if (__bw2Def(oObj.offsetTop)) nY += oObj.offsetTop;
               oObj = __bw2Def(oObj.offsetParent) ? oObj.offsetParent : null;
         }
 
         return nY;
}

/*================================================================================*/
/* <Function> Prozent[%] von Wert </Function>
/*================================================================================*/
function __bw2Proz(dValue, dProz) {
         if (dValue == 0) return; 
         return (dValue / 100) * dProz;
}

/*================================================================================*/
/* <Function> Neu anordnen der Content-Componenten </Function>
/*================================================================================*/
function __bw2ReorderContent(oObj) {
         try {
             return;
         
             if ((oObj.children) && (oObj.children.length > 0)) {
                for (var nI = 0; nI < oObj.children.length; nI++)	{
                    var oChild = oObj.children[nI];

                    if ((oChild.style.display != 'none') && ((oChild.Type == null) || (oChild.Type == 'menubar') || (oChild.Type == 'toolbar'))) {



                    }
                }
                  
             } else if (oObj.childNodes.length > 0) {
                var oPrev = null;
                var nH = 0;
                
                if (_fIE) {
                   for (nI = 0; nI < oObj.childNodes.length; nI++) {
                       var oCN = oObj.childNodes[nI];

                       if (oCN.style.display != 'none') {
                           if ((oCN.Type == null) || (oCN.Type == 'menubar') || (oCN.Type == 'toolbar')) {
                              var oMB = oCN.childNodes[0];

                              oCN.style.width = oMB.offsetWidth;

                              if (oPrev != null) {
                                 var nPO = oPrev.offsetLeft + oPrev.offsetWidth;
                                 var nPW = oObj.offsetWidth - oCN.offsetWidth;

                                 if (nPO < nPW) {
                                    oCN.style.position = 'absolute';
                                    oCN.style.left = nPO + 1;
                                    oCN.style.top = oPrev.offsetTop;
                                 } else {
                                    oCN.style.position = 'relative';
                                    oCN.style.left = 0;
                                    oCN.style.top = 0;
                                 }
                              }

                              oPrev = oCN;
                           }
                       }
                   }
                } else {
                   var oC = oObj.childNodes; 

                   for (nI = 0; nI < oC.length; nI++) {
                       var oChild = oC[nI];
                       
                       try {
                           if ((oChild.id == null) || (oChild.Type != 'menubar') || (oChild.Type != 'toolbar')) oChild = null;
                       } catch (e) {
                           oChild = null;
                       }

                       if ((oChild != null) && (oChild.style.display != 'none')) {
                          var oCN = oChild;
                          var oCNC = oCN.childNodes;
                          var oMB = oCNC[1];

                          //oCN.style.visibility != 'hidden'
                          oCN.style.width = oMB.offsetWidth;

                          if (oPrev != null) {
                             var nPO = oPrev.offsetLeft + oPrev.offsetWidth;
                             var nPW = oObj.offsetWidth - oMB.offsetWidth + 19;
                      
                             if (nPO < nPW) {
                                oCN.style.position = 'absolute';
                                oCN.style.left = nPO + 1;
                                oCN.style.top = oPrev.offsetTop
                             } else {
                                oCN.style.position = 'relative';
                                oCN.style.left = 0;
                                oCN.style.top = 0;
                             }
                          }

                          //oCN.style.visibility != 'visible'
                          oPrev = oCN;
                       }     
                   } 
                   return; 
                }
             }    

         } catch (e) { 
         }
}

/*================================================================================*/
/* <Function> Polled Resize-Event (Geko-Browsers) </Function>
/*================================================================================*/
function __bw2ResizeEvent() {
         _fResizeEvent = true; 
         _fResizeEventInt = false;
         _nCount++

//__bw2Debug(_nCount + ', ' + window.EventResizeFunctions.length);

         try {
             for (oI in window.EventResizeFunctions) {
                 var oObj = window.EventResizeFunctions[oI];
                 var oElem = __bw2GetElementById(oObj.ID);

                 if ((oElem != null) && ((oObj.OldWidth != oElem.offsetWidth) || (oObj.OldHeight != oElem.offsetHeight))) { 
                    oObj.OldWidth = oElem.offsetWidth; 
                    oObj.OldHeight = oElem.offsetHeight;
                    _fResizeEventInt = true;

                    if (oObj.Function) oObj.Function(oElem);
                 }
             }
         } catch (e) {
         }

         if (_fResizeEventInt) {
            __bw2ResizeEvent();
         } else {
            setTimeout('__bw2ResizeEvent()', 250);
         }
}

/*================================================================================*/
/* <Function> Reinitialize Resize-Event (Geko-Browsers) </Function>
/*================================================================================*/
function __bw2ResizeEventReinit() {
         if ((window.EventResizeFunctions == null) || (window.EventResizeFunctions.length == 0)) return;

         try {
             for (oI in window.EventResizeFunctions) {
                 with (window.EventResizeFunctions[oI]) {
                      OldWidth = 0; 
                      OldHeight = 0;
                 }
             }
         } catch (e) {
              __bw2Debug('Exception in [__bw2ResizeEventReinit] : ' + e);
         }
}

/*================================================================================*/
/* <Function> Entferne Resize-Event (Geko-Browsers) </Function>
/*================================================================================*/
function __bw2ResizeEventRemove(strObj) {
         if ((window.EventResizeFunctions == null) || (window.EventResizeFunctions.length == 0)) return;

         try {
             var nP = -1;

             for (oI in window.EventResizeFunctions) {
                 var oObj = window.EventResizeFunctions[oI];

                 if ((oObj != null) && (oObj.ID == strObj)) {
                    nP = Number(oI);
                    break; 
                 }
             }
             
             if (nP > -1) {
                window.EventResizeFunctions[nP] = null;
                window.EventResizeFunctions.splice(nP, 1);
             }
         } catch (e) {
             __bw2Debug('Exception in [__bw2ResizeEventRemove] : ' + e);
         }
}

/*================================================================================*/
/* <Function> Event Scroll </Function>
/*================================================================================*/
function __bw2ScrollEvent() {
         if (window.EventScroll) setTimeout('__bw2ScrollEvent()', 250);
  
         var nSL = __bw2ScrollLeft();
         var nST = __bw2ScrollTop();
  
         if (window.ScrollLeft != nSL || window.ScrollTop != nST) { 
            window.ScrollLeft = sl; 
            window.ScrollTop = st; 
            if (window.EventScroll) window.EventScroll(); 
         }
}

/*================================================================================*/
/* <Function> Scroll-Left </Function>
/*================================================================================*/
function __bw2ScrollLeft(oObj, fWin) {
         var nOffset=0;

         if (!__bw2Def(oObj) || fWin || oObj == document || oObj.tagName.toLowerCase() == 'html' || oObj.tagName.toLowerCase() == 'body') {
            var oW = window;
     
            if (fWin && oObj) oW = oObj;
            if (oW.document.documentElement && oW.document.documentElement.scrollLeft) nOffset = oW.document.documentElement.scrollLeft;
            else if (oW.document.body && __bw2Def(oW.document.body.scrollLeft)) nOffset = oW.document.body.scrollLeft;
         } else {
            oObj = __bw2GetElementById(oObj);
            if (oObj && __bw2Num(oObj.scrollLeft)) nOffset = oObj.scrollLeft;
         }
  
         return nOffset;
}

/*================================================================================*/
/* <Function> Scroll-Top </Function>
/*================================================================================*/
function __bw2ScrollTop(oObj, fWin) {
         var nOffset=0;

         if (!__bw2Def(oObj) || fWin || oObj == document || oObj.tagName.toLowerCase() == 'html' || oObj.tagName.toLowerCase() == 'body') {
            var oW = window;
            
            if (fWin && oObj) oW = oObj;
            if (oW.document.documentElement && oW.document.documentElement.scrollTop) nOffset = oW.document.documentElement.scrollTop;
            else if (oW.document.body && __bw2Def(oW.document.body.scrollTop)) nOffset = oW.document.body.scrollTop;
         } else {
            oObj = __bw2GetElementById(oObj);
            if (oObj && __bw2Num(oObj.scrollTop)) nOffset = oObj.scrollTop;
         }
  
         return oOffset;
}

/*================================================================================*/
/* <Function> Set Focus by Object-Name </Function>
/*================================================================================*/
function __bw2SetFocus(oObj, fSelected) {
         try {
             if ((oObj != null) && (fSelected != null)) {
                window.FocusObjectID = __bw2GetElementById(oObj).id;
                window.FocusObjectSelected = fSelected;
                setTimeout('__bw2SetFocus()', 100);

             } else if (window.FocusObjectID) {
                var oObj = __bw2GetElementById(window.FocusObjectID);
            
                if (oObj) {
                   if (window.FocusObjectSelected) oObj.select();
                   oObj.focus();
                }
                 
                window.ObjectFocusID = null;
                window.ObjectSelected = false;
             }
         } catch (ex) {
         }
}

/*================================================================================*/
/* <Function> String-Check </Function>
/*================================================================================*/
function __bw2Str() {
         for(var nI=0; nI<arguments.length; ++nI){ if (typeof(arguments[nI])!='string') return false; }
         return true;
}

/*================================================================================*/
/* <Function> Trim Functions </Function>
/*================================================================================*/
function __bw2LTrim(strV) { return strV.replace(/^[ ]+/, ''); } 
function __bw2RTrim(strV) { return strV.replace(/[ ]+$/, ''); } 
function __bw2Trim(strV)  { return __bw2LTrim(__bw2RTrim(strV)); } 

/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/


/*================================================================================*/
/* <Function> Ermittle Left-Pos eines Objektes </Function>
/*================================================================================*/
function __bw2ObjectIsChildFromType(oObj, strType) {
         if (strType == null) return false;

         var oOffsetParent = oObj.offsetParent;

         while (oOffsetParent) {
               if ((oOffsetParent.Type) && (oOffsetParent.Type == strType.toLowerCase())) return true;
               oOffsetParent = oOffsetParent.offsetParent;
         }

         return false;
}

/*================================================================================*/
/* <Function> Ermittle Left-Pos eines Objektes </Function>
/*================================================================================*/
function __bw2ObjectOffsetLeft(oObj) {
         if(!(oObj = __bw2GetElementById(oObj))) return 0;

         var nOffsetLeft = oObj.offsetLeft - oObj.scrollLeft;
         var oOffsetParent = oObj.offsetParent;

         while (oOffsetParent) {
               nOffsetLeft += oOffsetParent.offsetLeft - oOffsetParent.scrollLeft;
               oOffsetParent = oOffsetParent.offsetParent;
         }
       
         return nOffsetLeft;
}

/*================================================================================*/
/* <Function> Ermittle Top-Pos eines Objektes </Function>
/*================================================================================*/
function __bw2ObjectOffsetTop(oObj) {
         if(!(oObj = __bw2GetElementById(oObj))) return 0;

         var nOffsetTop = oObj.offsetTop - oObj.scrollTop;
         var oOffsetParent = oObj.offsetParent;

         while (oOffsetParent) {
               nOffsetTop += oOffsetParent.offsetTop - oOffsetParent.scrollTop;
               oOffsetParent = oOffsetParent.offsetParent;
         }
       
         return nOffsetTop;
}

/*================================================================================*/
/* <Function> Ermittle höhe des Objekts (Element) </Function>
/*================================================================================*/
function __bw2ObjectHeight(oObj, nHeight) {
         if(!(oObj = __bw2GetElementById(oObj))) return 0;

         if (__bw2Num(nHeight)) {
            if (nHeight < 0) nHeight = 0; else nHeight = Math.round(nHeight);
         } else nHeight = -1;

         var oCSS = __bw2Def(oObj.style);
         
         if (oObj == document || oObj.tagName.toLowerCase() == 'html' || oObj.tagName.toLowerCase() == 'body') {
            nHeight = __bw2ClientHeight();
 
         } else if(oCSS && __bw2Def(oObj.offsetHeight) && __bw2Str(oObj.style.height)) {
            if (nHeight >= 0) {
               var nPT = 0, nPB = 0, nBT = 0, nBB = 0;
 
               if (document.compatMode == 'CSS1Compat') {
                  var oGCS = __bw2GetComputedStyle;

                  nPT = oGCS(oObj, 'padding-top', 1);
                  
                  if (nPT !== null) {
                     nPB = oGCS(oObj, 'padding-bottom', 1);
                     nBT = oGCS(oObj, 'border-top-width', 1);
                     nBB = oGCS(oObj, 'border-bottom-width', 1);

                  } else if(__bw2Def(oObj.offsetHeight, oObj.style.height)) {
                     oObj.style.height = nHeight + 'px';
                     nPT = oObj.offsetHeight - nHeight;
                  }
               }
            
               nHeight -= (nPT + nPB + nBT + nBB);
            
               if (isNaN(nHeight) || (nHeight < 0)) return; else oObj.style.height = nHeight + 'px';
            }
            
            nHeight = oObj.offsetHeight;
            
         } else if (oCSS && __bw2Def(oObj.style.pixelHeight)) {
            if (nHeight >= 0) oObj.style.pixelHeight = nHeight;
            nHeight = oObj.style.pixelHeight;
        }
        
        return nHeight;
}

/*================================================================================*/
/* <Function> Ermittle breite des Objekts (Element) </Function>
/*================================================================================*/
function __bw2ObjectWidth(oObj, nWidth) {
         if(!(oObj = __bw2GetElementById(oObj))) return 0;

         if (__bw2Num(nWidth)) {
            if (nWidth < 0) nWidth = 0; else nWidth = Math.round(nWidth);
         } else nWidth = -1;

         var oCSS = __bw2Def(oObj.style);
         
         if (oObj == document || oObj.tagName.toLowerCase() == 'html' || oObj.tagName.toLowerCase() == 'body') {
            nWidth = __bw2ClientWidth();

         } else if(oCSS && __bw2Def(oObj.offsetWidth) && __bw2Str(oObj.style.width)) {
            if (nWidth >= 0) {
               var nPL = 0, nPR = 0, nBL = 0, nBR = 0;
                
               if (document.compatMode == 'CSS1Compat') {
                  var oGCS = __bw2GetComputedStyle;

                  nPL = oGCS(oObj, 'padding-left', 1);

                  if (nPL !== null) {
                     nPR = oGCS(oObj, 'padding-right', 1);
                     nBL = oGCS(oObj, 'border-left-width', 1);
                     nBR = oGCS(oObj, 'border-right-width', 1);

                  } else if (__bw2Def(oObj.offsetWidth, oObj.style.width)){
                     oObj.style.width = nWidth + 'px';
                     nPL = oObj.offsetWidth - nWidth;
                  }
               }
               
               nWidth -= (nPL + nPR + nBL + nBR);

               if (isNaN(nWidth) || (nWidth < 0)) return;
               else oObj.style.width = nWidth + 'px'; 
            }

            nWidth = oObj.offsetWidth;
            
         } else if (oCSS && __bw2Def(oObj.style.pixelWidth)) {
            if (nWidth >= 0) oObj.style.pixelWidth = nWidth;
            nWidth = oObj.style.pixelWidth;
         }

         return nWidth;
}

/*================================================================================*/
/* <Function> Verschiebe DHTML-Object </Function>
/*================================================================================*/
function __bw2ObjectMove(oEvent) {
         var oEO;
         var oSrc = __bw2EventSource(oEvent);
         var oBSrc = oSrc;
         var oForm = __bw2GetElementById('oForm');
         var nOffX = 0;
         var nOffY = 0;

         if (!oSrc) return;
         if (oSrc.ParentObject) oBSrc = oSrc.ParentObject;

         if ((oBSrc.Type) && (oBSrc.Type == 'form')) {
            if (oBSrc.WindowState == -1) {
               oBSrc.Minimize();
               return;
            }
            
            if (!oBSrc.Moving) return;
         }
         
         __bw2ZOrder(oSrc);

         if (!oSrc.Moving) return;
         if (oSrc.ParentObject) oBSrc = oSrc.ParentObject;
         if (oForm) oEO = oForm; else oEO = oBSrc;
         
         window.ObjectMove = oBSrc;
                   
         try {
             nOffX = oEvent.clientX - window.ObjectMove.offsetLeft
             nOffY = oEvent.clientY - window.ObjectMove.offsetTop

             __bw2AddEventListener(oEO, 'mousemove', _ObjectMove, false);
             __bw2AddEventListener(oEO, 'mouseup', _ObjectMoveEnd, false);

         } catch (e) {
             alert('__bw2ObjectMove : ' + e);
         }

         function _ObjectMove(oEvent) {
                  try {
                      if (window.ObjectMove) {  
                         window.ObjectMove.style.left = oEvent.clientX - nOffX;
                         window.ObjectMove.style.top = oEvent.clientY - nOffY;
                      }  
                  } catch (e) {}
         }

         function _ObjectMoveEnd(oEvent) {
                  try {
                      if (window.ObjectMove) {  
                         window.ObjectMove.OffsetX = window.ObjectMove.offsetLeft;
                         window.ObjectMove.OffsetY = __bw2WindowHeight() - window.ObjectMove.offsetTop;
                  
                         /*--- Ajax-Post Form-Position & Size ---*/   
                         if ((window.ObjectMove.Ajax) && (oBSrc.Type) && (oBSrc.Type == 'form')) {
                            var strD = 'left=' + window.ObjectMove.offsetLeft;
                            strD += '&top=' + window.ObjectMove.offsetTop;
                            strD += '&width=' + window.ObjectMove.offsetWidth;
                            strD += '&height=' + window.ObjectMove.offsetHeight;

                            __bw2AjaxRequest(window.ObjectMove.id, null, strD, 'onposreszied', null);
                         }
                  
                         __bw2RemoveEventListener(oEO, 'mousemove', _ObjectMove, false);
                         __bw2RemoveEventListener(oEO, 'mouseup', _ObjectMoveEnd, false);
                      }
                  } catch (e) {}
         }
}

/*================================================================================*/
/* <Function> Form Shadow </Function>
/*================================================================================*/
function __bw2ObjectShadow(oObj) {
         if (_fIE) {
            oObj.style.filter = 'progid:dximagetransform.microsoft.shadow(direction=150, strength=4, color=#808080)';
         } else if (oObj.style.BoxShadow != null) {
            oObj.style.BoxShadow = '3px 3px 3px #808080';
            alert('All')
         } else if (oObj.style.MozBoxShadow != null) {
            oObj.style.MozBoxShadow = '3px 3px 3px #808080';
            //alert('Mozilla')
         } else if (oObj.style.khtmlBoxShadow != null) {
            oObj.style.khtmlBoxShadow = '3px 3px 3px #808080';
            //alert('Konqueror')
         } else if (oObj.style.webkitBoxShadow != null) {
            oObj.style.webkitBoxShadow = '3px 3px 3px #808080';
            //alert('Safari')
         }            
}

/*================================================================================*/
/* <Function> Image Object </Function>
/*================================================================================*/
function __bw2Image(strName, nWidth, nHeight, strImage, strImageOnOver, strImageOnClick, strImageDisabled, strImageSelected, strImageSelectedDisabled, strImageExpand) {
         if (strImageOnOver == null) strImageOnOver = strImage;
         if (strImageOnClick == null) strImageOnClick = strImage;
         if (strImageDisabled == null) strImageDisabled = strImage;
         if (strImageSelected == null) strImageSelected = strImage;
         if (strImageSelectedDisabled == null) strImageSelectedDisabled = strImage;
         if (strImageExpand == null) strImageExpand = strImage;

         this.Name = strName;
         this.Width = nWidth;
         this.Height = nHeight;

         this.Image = strImage;
         this.ImageOnOver = strImageOnOver;
         this.ImageOnClick = strImageOnClick;
         this.ImageDisabled = strImageDisabled;
         this.ImageSelected = strImageSelected;
         this.ImageSelectedDisabled = strImageSelectedDisabled;
         this.ImageExpand = strImageExpand;

         this.ImageObject = _bw2ImageObject;

/*--------------------------------------------------------------------------------*/

         function _bw2ImageObject() {
                  var oI = new Image();
                  oI.Moving = false;
                  oI.src = this.Image;
                  oI.style.position = 'absolute';
                  return oI;
         } 
}

/*================================================================================*/
/* <Function> Ein-/Ausblenden der [Loading..]-Info </Function>
/*================================================================================*/
function __bw2Loading(fShow) {
         try {
      	     var nWidth = _oSkinImages['LOADING_BORDER'].Width;
	         var nHeight = _oSkinImages['LOADING_BORDER'].Height;
	         var nLeft = (__bw2WindowWidth() - nWidth) / 2;
	         var nTop = (__bw2WindowHeight() - nHeight) / 2;

             if (_oLoading == null) {
                var oAnim = document.createElement('IMG');
                oAnim.src = _oSkinImages['LOADING'].Image;
                oAnim.style.position = 'absolute';
                oAnim.style.left = 5;
                oAnim.style.top = 4;

                _oLoading = document.createElement('DIV');
                _oLoading.id = 'oLoading';
                _oLoading.className = _oSkinCssClasses['LOADING_SHADOW'];
                _oLoading.style.display = 'block';
                _oLoading.style.position = 'absolute';
                _oLoading.style.width = nWidth;
                _oLoading.style.height = nHeight;
                _oLoading.style.backgroundImage = 'url(' + _oSkinImages['LOADING_BORDER'].Image + ')';
                _oLoading.style.visibility = 'hidden';
                _oLoading.appendChild(oAnim);

                __bw2AppendChildElement(_oLoading);
             }

             if (_oLoading) {
                if (fShow) {
                   _oLoading.style.display = 'block';
                   _oLoading.style.visibility = 'visible'; 
                   _oLoading.style.left = nLeft;
                   _oLoading.style.top = nTop;
                   _oLoading.style.zIndex = 1000;
                } else {
                   _oLoading.style.visibility = 'hidden'; 
                }
             }
         } catch (e) {
         }
}

/*================================================================================*/
/* <Function> DoEvents </Function>
/*================================================================================*/
function __bw2DoEvents(nLoops) { 
         if (nLoops == null) nLoops = 10; else nLoops = nLoops * 10;
         __bw2DoEventsLoop(0, nLoops); 
} 

/*--------------------------------------------------------------------------------*/

function __bw2DoEventsLoop(nI, nMax) { 
         nI++; 
         if(nI <= nMax) setTimeout('__bw2DoEventsLoop(' + nI + ',' + nMax + ')', 0); 
} 

/*================================================================================*/
/* <Function> Wait (ms) </Function>
/*================================================================================*/
function __bw2Wait(nWait) {
         var oTs = new Date();
         var nMs = oTs.getTime();
         var nMsE = nMs + nWait;

         while (nMs < nMsE) {
               oTs = new Date();
               nMs = oTs.getTime();
         }
}

/*================================================================================*/
/* <Function> Warte bis Child-Window geschlossen wird </Function>
/*================================================================================*/
function __bw2WindowWaitForClose(oWindow) {
         try {
             if (oWindow != null) {
                this.Window = oWindow;
                this.WindowLeft = window.screenLeft; 
                this.WindowTop = window.screenTop - 60;

                window.moveTo(window.screenLeft, window.screen.height);
                setTimeout('__bw2WindowWaitForClose(null)', 1000)

             } else {
                if (this.Window.closed) {
                   //window.moveTo(this.WindowLeft, this.WindowTop);
                   window.close();
                } else { 
                   setTimeout('__bw2WindowWaitForClose(null)', 1000)
                }
             }
         } catch (e) {
         }
}

/*================================================================================*/
/* <Function> DHTML-Object nach vorne bringen </Function>
/*================================================================================*/
function __bw2ZIndex() {
         if (window.ZIndex > 200) window.ZIndex = 100;
         if (window.ActiveForm != null) window.ZIndex = Number(window.ActiveForm.style.zIndex);
         window.ZIndex++;
         return Number(window.ZIndex);
}

/*================================================================================*/
/* <Function> DHTML-Object nach vorne bringen </Function>
/*================================================================================*/
function __bw2ZOrder(oObj, strType) {
         if (!oObj) return;

         try{
             if ((!strType) || (strType = 'form')) {
                var oForm = __bw2GetFormObject(oObj);

                if (oForm != null) {
                   if (!window.ActiveForm) {
                      oForm.style.zIndex = __bw2ZIndex();
                      
                   } else if (window.ActiveForm != oForm) {
                      if (oForm.Modal) {
                         oForm.style.zIndex = Number(window.ActiveForm.style.zIndex) + 2;
                         if (window.Modal) window.Modal.style.zIndex = oForm.style.zIndex - 1; 
                      } else {
                         oForm.style.zIndex = Number(window.ActiveForm.style.zIndex) + 1;
                      }
                   } else {
                      return; 
                   }   

                   if (oForm.Activate) {
                      oForm.Activate();
                   } else {
                      window.ActiveForm = oForm;
                   }

                   if (oForm.style.zIndex != '') window.ZIndex = Number(oForm.style.zIndex);
                } else {
                }
             } else {
                alert('Z-Order default : ' + strType);             
             }
         } catch (e) {
             alert('__bw2ZOrder : ' + e);
         }
}

/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/

