/*================================================================================*/
/*                                                                                */
/*             BW2Technologies.Web.JScript.Framework (Alpha V1.0.0.0)             */
/*                                                                                */
/*                                  Web-Forms                                     */
/*                                                                                */
/*              Copyright © 2006-2010 by BW2Technologies (HP. Lassnig)            */
/*                           mail to : hansi@lassnig.ch                           */
/*                                                                                */
/*================================================================================*/

var _oForms = new Array();
var _oForm = null;

/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/


/*================================================================================*/
/* <Function> Form Object </Function>
/*================================================================================*/
function __bw2Form(strForm, strTitle, strIcon, eBorderStyle, eClipControls, eToolStripPanels, nLeft, nTop, nWidth, nHeight, eStartPosition, eContentOverflow, eActiveStyle, eShowEffect, nMinWidth, nMaxWidth, nMinHeight, nMaxHeight, fCloseAndDestroy, fAjax) {
         this.Ajax = fAjax;
         this.ID = strForm;
         this.CloseAndDestroy = fCloseAndDestroy;
        
         /*--- Create Form & Set Standard-Properties ---*/
         this.Form = document.createElement('DIV');
         this.Form.id = strForm;
         this.Form.className = _oSkinCssClasses['FORM'];
         this.Form.style.position = 'absolute';
         this.Form.style.left = nLeft;
         this.Form.style.top = nTop;
         this.Form.style.width = nWidth;
         this.Form.style.height = nHeight;
         this.Form.style.display = 'none';
         this.Form.style.overflow = 'hidden';
         this.Form.style.zIndex = 1;

         //__bw2FormShadow(this.Form);

         /*--- Set optional Properties ---*/
         this.Form.Ajax = fAjax;
         this.Form.ParentObject = this;
         this.Form.Created = false;
         this.Form.Type = 'form';
         this.Form.TitleText = strTitle;
         this.Form.Icon = strIcon;
         this.Form.ActiveStyle = eActiveStyle;
         this.Form.BorderStyle = eBorderStyle;
         this.Form.ClipControls = eClipControls;
         this.Form.ContentOverflow = eContentOverflow;
         this.Form.StartPosition = eStartPosition;
         this.Form.ShowEffect = eShowEffect;
         this.Form.ToolStripPanels = eToolStripPanels;
         this.Form.Modal = false;
         this.Form.Moving = true;
         this.Form.MinWidth = nMinWidth;
         this.Form.MaxWidth = nMaxWidth;
         this.Form.MinHeight = nMinHeight;
         this.Form.MaxHeight = nMaxHeight;
         this.Form.OrigLeft = nLeft; 
         this.Form.OrigTop = nTop; 
         this.Form.OrigWidth = nWidth; 
         this.Form.OrigHeight = nHeight; 
         this.Form.WindowState = 0;
         this.Form.Zorder = true;
                 
         /*--- Define Functions ---*/
         this.Dispose = _bw2FormDestroy;

         this.Form.Activate = _bw2FormActivate;
         this.Form.Close = _bw2FormClose;
         this.Form.Create = _bw2FormCreate;
         this.Form.Deactivate = _bw2FormDeactivate;
         this.Form.Load = _bw2FormLoad;
         this.Form.Maximize = _bw2FormMaximize;
         this.Form.Minimize = _bw2FormMinimize;
         this.Form.Resize = _bw2FormResize;
         this.Form.Title = _bw2FormTitle;
         this.Form.Visible = _bw2FormVisible;

         this.Width = __bw2GetStyleWidth(this.Form.style);
         this.Height = __bw2GetStyleHeight(this.Form.style);

/*--------------------------------------------------------------------------------*/
         
         function _bw2FormActivate() {
                  try {
                      switch (this.ActiveStyle) {
                              case 0 : /*--- None ---*/
                                  break;

                              case 1 : /*--- Style ---*/
                                  break;

                              case 2 : /*--- Opage ---*/
                                  __bw2ObjectOpacity(this, 100);
                                  __bw2FormShadow(this);
                                  
                                  for (strKey in _oForms) {
                                      if ((strKey != this.id) && (_oForms[strKey] != null)) _oForms[strKey].Form.Deactivate();
                                  }

                                  break;
                      }
                      
                      window.ActiveForm = this;
                  } catch (e) {
                  }
         }

/*--------------------------------------------------------------------------------*/

         function _bw2FormBorderMouseOver(oEvent) {
             if (window.ObjectResize != null) return;
             if (!oEvent) oEvent = window.event;

             var oFrm = __bw2GetFormObject(__bw2EventSource(oEvent));
             if (oFrm.WindowState != 0) return;

             var nOffX = oEvent.clientX - oFrm.offsetLeft;
             var nOffY = oEvent.clientY - oFrm.offsetTop;
             var nW = oFrm.offsetWidth;
             var nH = oFrm.offsetHeight;

             /*--- Left-Top ---*/ 
             if ((nOffX < 5) && (nOffY < 10)) {
                oFrm.Border.ResizeMode = 1;
                oFrm.Border.style.cursor = 'nw-resize';

             /*--- Left-Bottom ---*/ 
             } else if ((nOffX < 5) && (nOffY > (nH - 10))) {
                oFrm.Border.ResizeMode = 2;
                oFrm.Border.style.cursor = 'ne-resize';

             /*--- Left-Mid ---*/ 
             } else if ((nOffX < 5) && (nOffY > 10) && (nOffY < nH)) {
                oFrm.Border.ResizeMode = 3;
                oFrm.Border.style.cursor = 'e-resize';

             /*--- Right-Top ---*/ 
             } else if ((nOffX > (nW - 5)) && (nOffY < 10)) {
                oFrm.Border.ResizeMode = 4;
                oFrm.Border.style.cursor = 'ne-resize';

             /*--- Right-Bottom ---*/ 
             } else if ((nOffX > (nW - 5)) && (nOffY > (nH - 10))) {
                oFrm.Border.ResizeMode = 5;
                oFrm.Border.style.cursor = 'nw-resize';

             /*--- Right-Mid ---*/ 
             } else if ((nOffX > (nW - 5)) && (nOffY > 10) && (nOffY < nH)) {
                oFrm.Border.ResizeMode = 6;
                oFrm.Border.style.cursor = 'e-resize';

             /*--- Top-Mid ---*/ 
             } else if (nOffY < 5) {
                oFrm.Border.ResizeMode = 7;
                oFrm.Border.style.cursor = 'n-resize';

             /*--- Bottom-Mid ---*/ 
             } else if (nOffY > (nH - 5)) {
                oFrm.Border.ResizeMode = 8;
                oFrm.Border.style.cursor = 'n-resize';
             
             } else {
                oFrm.Border.ResizeMode = 0;
                oFrm.style.cursor = 'default';
             }
             
             if (oFrm.Border.ResizeMode > 0) __bw2AddEventListener(oFrm.Border, 'mousedown', _bw2FormBorderMouseDown, false); 
         }

/*--------------------------------------------------------------------------------*/

         function _bw2FormBorderMouseOut(oEvent) {
                  if (!oEvent) oEvent = window.event;

                  try {
                      if (window.ObjectResize == null) {
                         var oFrm = __bw2GetFormObject(__bw2EventSource(oEvent));
             
                         if (oFrm.Border.Resize) return;
                         oFrm.Border.style.cursor = 'default';
                         __bw2RemoveEventListener(oFrm.Border, 'mousedown', _bw2FormBorderMouseDown, false); 
                         __bw2Debug('_bw2FormBorderMouseOut');
                      }
                  } catch (e) {
                  }
         }

/*--------------------------------------------------------------------------------*/

         function _bw2FormBorderMouseMove(oEvent) {
                  if (!oEvent) oEvent = window.event;

                  try {
                      var oSrc = __bw2EventSource(oEvent);
                      var nL = 0, nT = 0;
                      var nW = 0, nH = 0;
                      var nB = 0, nR = 0;
                      var nMW = 0, nMH = 0;
                      var nMX = oEvent.clientX;
                      var nMY = oEvent.clientY;
                  
                      if ((window.ObjectResize != null) && (window.ObjectResize.Border.Resize)) {
                         if (nMW < 1) nMW = 150;
                         if (nMH < 1) nMH = 100;

                         nL = __bw2GetStyleLeft(window.ObjectResize.style);
                         nT = __bw2GetStyleTop(window.ObjectResize.style);
                         nR = nL + __bw2GetStyleWidth(window.ObjectResize.style);
                         nB = nT + __bw2GetStyleHeight(window.ObjectResize.style);
                         nW = nR - nMX;
                         nH = nB - nMY;

                         switch (window.ObjectResize.Border.ResizeMode) {
                                case 1: /*--- Left-Top ---*/ 
                                     if (nMX > (nR - nMW)) return;
                                     if (nMY > (nB - nMH)) return;
                                     window.ObjectResize.style.left = nMX - 1;
                                     window.ObjectResize.style.top = nMY - 1;
                                     window.ObjectResize.style.width = nW + 1;
                                     window.ObjectResize.style.height = nH + 1;
                                     break;
                                case 2: /*--- Left-Bottom ---*/
                                     if (nMX > (nR - nMW)) return;
                                     nH = nMY - __bw2GetStyleTop(window.ObjectResize.style);
                                     window.ObjectResize.style.left = nMX - 1;
                                     window.ObjectResize.style.width = nW + 1;
                                     window.ObjectResize.style.height = nH + 1;
                                     break;
                                case 3: /*--- Left-Mid ---*/
                                     if (nMX > (nR - nMW)) return;
                                     window.ObjectResize.style.left = nMX - 1;
                                     window.ObjectResize.style.width = nW + 1;
                                     break;
                                case 4: /*--- Right-Top ---*/
                                     if (nMY > (nB - nMH)) return;
                                     nW = nMX - __bw2GetStyleLeft(window.ObjectResize.style);
                                     window.ObjectResize.style.top = nMY;
                                     window.ObjectResize.style.width = nW + 1;
                                     window.ObjectResize.style.height = nH + 1;
                                     break;
                                case 5: /*--- Right-Bottom ---*/
                                     if (nMX < (nL + nMW)) return;
                                     if (nMY < (nT + nMH)) return;
                                     nW = nMX - __bw2GetStyleLeft(window.ObjectResize.style);
                                     nH = nMY - __bw2GetStyleTop(window.ObjectResize.style);
                                     window.ObjectResize.style.width = nW + 1;
                                     window.ObjectResize.style.height = nH + 1;
                                     break;
                                case 6: /*--- Right-Mid ---*/
                                     if (nMX < (nL + nMW)) return;
                                     nW = nMX - __bw2GetStyleLeft(window.ObjectResize.style);
                                     window.ObjectResize.style.width = nW + 1;
                                     break;
                                case 7: /*--- Top-Mid ---*/
                                     if (nMY > (nH - nMH)) return;
                                     window.ObjectResize.style.top = nMY - 1 ;
                                     window.ObjectResize.style.height = nH + 1;
                                     break;
                                case 8: /*--- Bottom-Mid ---*/
                                     if (nMY < (nT + nMH)) return;
                                     nH = nMY - __bw2GetStyleTop(window.ObjectResize.style);
                                     window.ObjectResize.style.height = nH + 1;
                                     break;
                         }

                         window.ObjectResize.Resize();
                      }   
                  } catch (e) {
                  }

                  __bw2Unselect();
         }

/*--------------------------------------------------------------------------------*/

         function _bw2FormBorderMouseDown(oEvent) {
                  if (!oEvent) oEvent = window.event;

                  try {
                      var oFrm = __bw2GetFormObject(__bw2EventSource(oEvent));

                      if (oFrm.Border.ResizeMode != 0) {
                         oFrm.Border.Resize = true;
                         window.ObjectResize = oFrm;
                         __bw2AddEventListener(window.document, 'mouseup', _bw2FormBorderMouseUp, false);
                         __bw2AddEventListener(window.document, 'mousemove', _bw2FormBorderMouseMove, false);
                      }
                  } catch (e) {
                  }
         }         

/*--------------------------------------------------------------------------------*/

         function _bw2FormBorderMouseUp(oEvent) {
                  if (!oEvent) oEvent = window.event;

                  try {
                      if (window.ObjectResize != null) {
                         __bw2RemoveEventListener(window.document, 'mouseup', _bw2FormBorderMouseUp, false);
                         __bw2RemoveEventListener(window.document, 'mousemove', _bw2FormBorderMouseMove, false);

                         /*--- Ajax-Post Form-Position & Size ---*/   
                         if (window.ObjectResize.Ajax) {
                            var strD = 'left=' + window.ObjectResize.offsetLeft;
                            strD += '&top=' + window.ObjectResize.offsetTop;
                            strD += '&width=' + window.ObjectResize.offsetWidth;
                            strD += '&height=' + window.ObjectResize.offsetHeight;

                            __bw2AjaxRequest(window.ObjectResize.id, null, strD, 'onposreszied', null);
                         }

                         window.ObjectResize.Border.style.cursor = 'default';
                         window.ObjectResize.Border.Resize = false;
                         window.ObjectResize = null;
                      }
                  } catch (e) {
                  }

                  __bw2Unselect();
         }         

/*--------------------------------------------------------------------------------*/

         function _bw2FormCreate(strInnerHTML) {
                  if (this.Created) return;

                  /*--- Add Form-Object to MainForm ---*/
                  try {
                      var nHH = _oSkinImages['FORM_BORDER_TOP_LEFT'].Height;
                      var nFW = __bw2GetStyleWidth(this.style);
                      var nFH = __bw2GetStyleHeight(this.style);
                      var nCL = 0;
                      var nCR = 0;

                      /*--- Add Form to Main-Formular ---*/
                      __bw2AppendChildElement(this);

                      /*--- Create Form Header Border-Left ---*/
                      this.BorderTopLeft = _oSkinImages['FORM_BORDER_TOP_LEFT'].ImageObject();
                      this.appendChild(this.BorderTopLeft);
                      this.BorderTopLeft.height = nHH;

                      /*--- Create Form Header ---*/
                      this.Header = document.createElement('DIV');
                      this.appendChild(this.Header);
                      this.Header.ParentObject = this;
                      this.Header.id = this.id + '_HEADER';
                      this.Header.className = _oSkinCssClasses['FORM_HEADER'];
                      this.Header.Moving = true;
                      this.Header.style.position = 'absolute';
                      this.Header.style.left = _oSkinImages['FORM_BORDER_TOP_LEFT'].Width;
                      this.Header.style.top = 0;
                      this.Header.style.width = nFW - _oSkinImages['FORM_BORDER_TOP_LEFT'].Width - _oSkinImages['FORM_BORDER_TOP_RIGHT'].Width;
                      this.Header.style.height = nHH;
                      this.Header.style.backgroundImage = 'url(' + _oSkinImages['FORM_BORDER_TOP_MIDDLE'].Image + ')';
                      this.Header.style.backgroundRepeat = 'repeat-x';

                      __bw2AddEventListener(this.Header, 'dblclick', _bw2FormDblClick, false);

                      /*--- Create [Icon] Clip-Context ---*/
                      if (this.Icon) {
                         var strI = this.Icon.split('|');

                         this.ClipIcon = document.createElement('DIV');
                         this.ClipIcon.ParentObject = this;
                         this.ClipIcon.id = this.id + '_CLIP_ICON';
                         this.ClipIcon.Moving = true;
                         this.ClipIcon.style.position = 'absolute';
                         this.ClipIcon.style.left = _oSkinImages['FORM_BORDER_TOP_LEFT'].Width;
                         this.ClipIcon.style.top = (nHH - Number(strI[2])) / 2;
                         this.ClipIcon.style.width = strI[1];  
                         this.ClipIcon.style.height = strI[2]; 
                         this.ClipIcon.style.backgroundImage = 'url(' + strI[0] + ')';
                         this.appendChild(this.ClipIcon);
                         nCL = Number(strI[1]) + 4; 

                         if ((this.ClipControls & 1) == 1) {
                            this.ClipIcon.Moving = false;
                            __bw2AddEventListener(this.ClipIcon, 'mouseover', _bw2FormClipMouseOver, false);
                            __bw2AddEventListener(this.ClipIcon, 'mouseout', _bw2FormClipMouseOut, false);
                            __bw2AddEventListener(this.ClipIcon, 'mousedown', _bw2FormClipMouseDown, false);
                            __bw2AddEventListener(this.ClipIcon, 'mouseup', _bw2FormClipMouseUp, false);
                         }

                         __bw2AddEventListener(this.ClipIcon, 'dblclick', _bw2FormIconClose, false);

                      /*--- Create [Standard] Clip-Context ---*/
                      } else if ((this.ClipControls & 1) == 1) {
                         this.ClipContext = document.createElement('DIV');
                         this.ClipContext.ParentObject = this;
                         this.ClipContext.id = this.id + '_CLIP_CONTEXT';
                         this.ClipContext.Moving = false;
                         this.ClipContext.className = _oSkinCssClasses['FORM_CLIP_CONTEXT'];
                         this.ClipContext.style.position = 'absolute';
                         this.ClipContext.style.left = _oSkinImages['FORM_BORDER_TOP_LEFT'].Width;
                         this.ClipContext.style.top = 0;
                         this.ClipContext.style.width = _oSkinImages['CLIP_CONTEXT'].Width;
                         this.ClipContext.style.height = _oSkinImages['CLIP_CONTEXT'].Height;
                         this.ClipContext.style.backgroundImage = 'url(' + _oSkinImages['CLIP_CONTEXT'].Image + ')';
                         this.appendChild(this.ClipContext);
                         nCL = _oSkinImages['CLIP_CONTEXT'].Width + 4;

                         __bw2AddEventListener(this.ClipContext, 'mouseover', _bw2FormClipMouseOver, false);
                         __bw2AddEventListener(this.ClipContext, 'mouseout', _bw2FormClipMouseOut, false);
                         __bw2AddEventListener(this.ClipContext, 'mousedown', _bw2FormClipMouseDown, false);
                         __bw2AddEventListener(this.ClipContext, 'mouseup', _bw2FormClipMouseUp, false);
                      }

                      /*--- Create Caption ---*/
                      this.Caption = document.createElement('DIV');
                      this.appendChild(this.Caption);
                      this.Caption.ParentObject = this;
                      this.Caption.Moving = true;
                      this.Caption.id = this.id + '_CAPTION';
                      this.Caption.innerHTML = this.TitleText;
                      this.Caption.className = _oSkinCssClasses['FORM_CAPTION'];
                      this.Caption.style.position = 'absolute';
                      this.Caption.style.left = nCL + _oSkinImages['FORM_BORDER_TOP_LEFT'].Width;
                      this.Caption.style.top = 3;
                      this.Caption.style.overflow = 'hidden';

                      __bw2AddEventListener(this.Caption, 'dblclick', _bw2FormDblClick, false);

                      /*--- Create Clip-Close ---*/
                      if ((this.ClipControls & 2) == 2) {
                         this.ClipClose = document.createElement('DIV');
                         this.ClipClose.ParentObject = this;
                         this.ClipClose.id = this.id + '_CLIP_CLOSE';
                         this.ClipClose.Moving = false;
                         this.ClipClose.className = _oSkinCssClasses['FORM_CLIP_CLOSE'];
                         this.ClipClose.style.position = 'absolute';
                         this.ClipClose.style.left = nFW - _oSkinImages['CLIP_CLOSE'].Width - _oSkinImages['FORM_BORDER_TOP_RIGHT'].Width;
                         this.ClipClose.style.top = 0;
                         this.ClipClose.style.width = _oSkinImages['CLIP_CLOSE'].Width;
                         this.ClipClose.style.height = _oSkinImages['CLIP_CLOSE'].Height;
                         this.ClipClose.style.backgroundImage = 'url(' + _oSkinImages['CLIP_CLOSE'].Image + ')';
                         this.appendChild(this.ClipClose);
                         nCR += _oSkinImages['CLIP_CLOSE'].Width + 1;

                         __bw2AddEventListener(this.ClipClose, 'mouseover', _bw2FormClipMouseOver, false);
                         __bw2AddEventListener(this.ClipClose, 'mouseout', _bw2FormClipMouseOut, false);
                         __bw2AddEventListener(this.ClipClose, 'mousedown', _bw2FormClipMouseDown, false);
                         __bw2AddEventListener(this.ClipClose, 'mouseup', _bw2FormClipMouseUp, false);
                      }

                      /*--- Create Clip-Maximize ---*/
                      if ((this.ClipControls & 4) == 4) {
                         this.ClipMax = document.createElement('DIV');
                         this.ClipMax.ParentObject = this;
                         this.ClipMax.id = this.id + '_CLIP_MAXIMIZE';
                         this.ClipMax.Moving = false;
                         this.ClipMax.className = _oSkinCssClasses['FORM_CLIP_MAXIMIZE'];
                         this.ClipMax.style.position = 'absolute';
                         this.ClipMax.style.left = nFW - nCR - _oSkinImages['CLIP_MAXIMIZE'].Width - _oSkinImages['FORM_BORDER_TOP_RIGHT'].Width;
                         this.ClipMax.style.top = 0;
                         this.ClipMax.style.width = _oSkinImages['CLIP_MAXIMIZE'].Width;
                         this.ClipMax.style.height = _oSkinImages['CLIP_MAXIMIZE'].Height;
                         this.ClipMax.style.backgroundImage = 'url(' + _oSkinImages['CLIP_MAXIMIZE'].Image + ')';
                         this.appendChild(this.ClipMax);
                         nCR += _oSkinImages['CLIP_MAXIMIZE'].Width + 1;

                         __bw2AddEventListener(this.ClipMax, 'mouseover', _bw2FormClipMouseOver, false);
                         __bw2AddEventListener(this.ClipMax, 'mouseout', _bw2FormClipMouseOut, false);
                         __bw2AddEventListener(this.ClipMax, 'mousedown', _bw2FormClipMouseDown, false);
                         __bw2AddEventListener(this.ClipMax, 'mouseup', _bw2FormClipMouseUp, false);
                      }

                      /*--- Create Clip-Minimize ---*/
                      if ((this.ClipControls & 8) == 8) {
                         this.ClipMin = document.createElement('DIV');
                         this.ClipMin.ParentObject = this;
                         this.ClipMin.id = this.id + '_CLIP_MINIMIZE';
                         this.ClipMin.Moving = false;
                         this.ClipMin.className = _oSkinCssClasses['FORM_CLIP_MINIMIZE'];
                         this.ClipMin.style.position = 'absolute';
                         this.ClipMin.style.left = nFW - nCR - _oSkinImages['CLIP_MINIMIZE'].Width - _oSkinImages['FORM_BORDER_TOP_RIGHT'].Width;
                         this.ClipMin.style.top = 0;
                         this.ClipMin.style.width = _oSkinImages['CLIP_MINIMIZE'].Width;
                         this.ClipMin.style.height = _oSkinImages['CLIP_MINIMIZE'].Height;
                         this.ClipMin.style.backgroundImage = 'url(' + _oSkinImages['CLIP_MINIMIZE'].Image + ')';
                         this.appendChild(this.ClipMin);
                         nCR += _oSkinImages['CLIP_MINIMIZE'].Width + 1;

                         __bw2AddEventListener(this.ClipMin, 'mouseover', _bw2FormClipMouseOver, false);
                         __bw2AddEventListener(this.ClipMin, 'mouseout', _bw2FormClipMouseOut, false);
                         __bw2AddEventListener(this.ClipMin, 'mousedown', _bw2FormClipMouseDown, false);
                         __bw2AddEventListener(this.ClipMin, 'mouseup', _bw2FormClipMouseUp, false);
                      }

                      __bw2AddEventListener(this, 'mousedown', __bw2ObjectMove, false);
                     
                      /*--- Create Form Header Border-Right ---*/
                      this.BorderTopRight = _oSkinImages['FORM_BORDER_TOP_RIGHT'].ImageObject();
                      this.appendChild(this.BorderTopRight);
                      this.BorderTopRight.style.left = nFW - _oSkinImages['FORM_BORDER_TOP_RIGHT'].Width;
                      this.BorderTopRight.style.height = nHH;

                      this.Border = document.createElement('DIV');
                      this.appendChild(this.Border)
                      this.Border.ParentObject = this;
                      this.Border.id = this.id + '_BORDER';
                      this.Border.className = _oSkinCssClasses['FORM_BORDER'];
                      this.Border.Moving = false;
                      this.Border.Resize = false;
                      this.Border.ResizeMode = 0;
                      this.Border.style.position = 'absolute';
                      this.Border.style.left = 0;
                      this.Border.style.top = nHH;

                      if (_fIE) {
                         this.Border.style.width = nFW;
                         this.Border.style.height = nFH - nHH;
                      } else {
                         this.Border.style.width = nFW - (this.Border.offsetWidth - this.Border.clientWidth);
                         this.Border.style.height = nFH - nHH - (this.Border.offsetHeight - this.Border.clientHeight);
                      }

                      /*--- Create Top-ToolStripPanel ---*/
                      if ((this.ToolStripPanels & 1) == 1) {
                         this.ToolStripPanelTop = document.createElement('DIV');
                         this.ToolStripPanelTop.ParentObject = this;
                         this.ToolStripPanelTop.id = this.id + '_PANEL_TOP';
                         this.ToolStripPanelTop.className = _oSkinCssClasses['FORM_PANEL_TOP'];
                         this.ToolStripPanelTop.Moving = false;
                         this.ToolStripPanelTop.style.position = 'absolute';
                         this.ToolStripPanelTop.style.display = 'block';
                         this.appendChild(this.ToolStripPanelTop)
                      }

                      /*--- Create Form Container ---*/
                      this.Container = document.createElement('DIV');
                      this.Container.ParentObject = this;
                      this.Container.id = this.id + '_Content';
                      this.Container.className = _oSkinCssClasses['FORM_CONTENT'];
                      this.Container.Moving = false;
                      this.Container.style.position = 'absolute';
                      this.appendChild(this.Container)

                      if (strInnerHTML != null) this.Container.innerHTML = strInnerHTML;
                      
                      switch (this.ContentOverflow) {
                             case 0: this.Container.style.overflow = 'auto'; break;
                             case 1: this.Container.style.overflow = 'scroll'; break;
                             case 2: this.Container.style.overflow = 'visible'; break;
                             case 3: this.Container.style.overflow = 'hidden'; break;
                      }                        
                      
                      if (this.BorderStyle == 4) {
                         __bw2AddEventListener(this.Border, 'mouseover', _bw2FormBorderMouseOver, false);
                         __bw2AddEventListener(this.Border, 'mouseout', _bw2FormBorderMouseOut, false);
                      }
                      
                      /*--- Create Bottom-ToolStripPanel ---*/
                      if ((this.ToolStripPanels & 2) == 2) {
                         this.ToolStripPanelBottom = document.createElement('DIV');
                         this.ToolStripPanelBottom.ParentObject = this;
                         this.ToolStripPanelBottom.id = this.id + '_PANEL_BOTTOM';
                         this.ToolStripPanelBottom.className = _oSkinCssClasses['FORM_PANEL_BOTTOM'];
                         this.ToolStripPanelBottom.Moving = false;
                         this.ToolStripPanelBottom.style.position = 'absolute';
                         this.ToolStripPanelBottom.style.display = 'block';
                         this.appendChild(this.ToolStripPanelBottom)
                      }

                      /*--- Startup-Position ---*/
                      switch (this.StartPosition) { 
                             case 1: /*--- Center Screen ---*/
                                  var nL = (__bw2WindowWidth() - __bw2GetStyleWidth(this.style)) / 2;   
                                  var nT = (__bw2WindowHeight() - __bw2GetStyleHeight(this.style)) / 2;   

                                  if (nL < 0) nL = 0;
                                  if (nT < 0) nT = 0;

                                  this.style.left = nL;
                                  this.style.top = nT;
                                  break;
                      }

                      this.Created = true;
                  } catch (e) {
                      alert('_bw2FormCreate.Error : ' + e.name + ', ' + e.description + ', ' + e.number);
                  }
         }

/*--------------------------------------------------------------------------------*/

         function _bw2FormClipMouseDown(oEvent) {
                  if (oEvent == null) return;

                  var oClip = __bw2EventSource(oEvent);

                  if (oClip.id.indexOf('_CLIP_CONTEXT') > -1) {
                     oClip.style.backgroundImage = 'url(' + _oSkinImages['CLIP_CONTEXT'].ImageOnClick + ')';
                  } else if (oClip.id.indexOf('_CLIP_CLOSE') > -1) {
                     oClip.style.backgroundImage = 'url(' + _oSkinImages['CLIP_CLOSE'].ImageOnClick + ')';
                     if ((oClip.ParentObject.Form != null) && (oClip.ParentObject.Form.ClipOnClose != null)) eval(oClip.ParentObject.Form.ClipOnClose);
                  } else if (oClip.id.indexOf('_CLIP_MAXIMIZE') > -1) {
                     oClip.style.backgroundImage = 'url(' + _oSkinImages['CLIP_MAXIMIZE'].ImageOnClick + ')';
                  } else if (oClip.id.indexOf('_CLIP_MINIMIZE') > -1) {
                     oClip.style.backgroundImage = 'url(' + _oSkinImages['CLIP_MINIMIZE'].ImageOnClick + ')';
                  }
         }

/*--------------------------------------------------------------------------------*/

         function _bw2FormClipMouseOut(oEvent) {
                  if (oEvent == null) return;

                  var oClip = __bw2EventSource(oEvent);
                  
                  if (oClip.id.indexOf('_CLIP_CONTEXT') > -1) {
                     oClip.style.backgroundImage = 'url(' + _oSkinImages['CLIP_CONTEXT'].Image + ')';
                  } else if (oClip.id.indexOf('_CLIP_CLOSE') > -1) {
                     oClip.style.backgroundImage = 'url(' + _oSkinImages['CLIP_CLOSE'].Image + ')';
                  } else if (oClip.id.indexOf('_CLIP_MAXIMIZE') > -1) {
                     oClip.style.backgroundImage = 'url(' + _oSkinImages['CLIP_MAXIMIZE'].Image + ')';
                  } else if (oClip.id.indexOf('_CLIP_MINIMIZE') > -1) {
                     oClip.style.backgroundImage = 'url(' + _oSkinImages['CLIP_MINIMIZE'].Image + ')';
                  }
         }

/*--------------------------------------------------------------------------------*/

         function _bw2FormClipMouseOver(oEvent) {
                  if (oEvent == null) return;

                  var oClip = __bw2EventSource(oEvent);

                  oClip.style.cursor = 'hand'
                  oClip.style.cursor = 'pointer'
                  
                  if (oClip.id.indexOf('_CLIP_CONTEXT') > -1) {
                     oClip.style.backgroundImage = 'url(' + _oSkinImages['CLIP_CONTEXT'].ImageOnOver + ')';
                  } else if (oClip.id.indexOf('_CLIP_CLOSE') > -1) {
                     oClip.style.backgroundImage = 'url(' + _oSkinImages['CLIP_CLOSE'].ImageOnOver + ')';
                  } else if (oClip.id.indexOf('_CLIP_MAXIMIZE') > -1) {
                     oClip.style.backgroundImage = 'url(' + _oSkinImages['CLIP_MAXIMIZE'].ImageOnOver + ')';
                  } else if (oClip.id.indexOf('_CLIP_MINIMIZE') > -1) {
                     oClip.style.backgroundImage = 'url(' + _oSkinImages['CLIP_MINIMIZE'].ImageOnOver + ')';
                  }
         }

/*--------------------------------------------------------------------------------*/

         function _bw2FormClipMouseUp(oEvent) {
                  if (oEvent == null) return;

                  var oClip = __bw2EventSource(oEvent);
                  
                  if (oClip.id.indexOf('_CLIP_ICON') > -1) {
                     if (oClip.ParentObject.Ajax) {
                        __bw2AjaxObjOnEvent(oEvent, oClip.ParentObject.id, 'onclick', 'CLIP_CONTEXT')
                     } else {
                        __doPostBack(oClip.ParentObject.id, 'CLIP_CONTEXT');
                     }

                  } else if (oClip.id.indexOf('_CLIP_CONTEXT') > -1) {
                     oClip.style.backgroundImage = 'url(' + _oSkinImages['CLIP_CONTEXT'].ImageOnOver + ')';

                     if (oClip.ParentObject.Ajax) {
                        __bw2AjaxObjOnEvent(oEvent, oClip.ParentObject.id, 'onclick', 'CLIP_CONTEXT')
                     } else {
                        __doPostBack(oClip.ParentObject.id, 'CLIP_CONTEXT');
                     }

                  } else if (oClip.id.indexOf('_CLIP_CLOSE') > -1) {
                     oClip.style.backgroundImage = 'url(' + _oSkinImages['CLIP_CLOSE'].ImageOnOver + ')';
                     //oClip.ParentObject.Visible(false);
                     
                     if (oClip.ParentObject.Ajax) {
                        __bw2AjaxObjOnEvent(oEvent, oClip.ParentObject.id, 'onclick', 'CLIP_CLOSE')
                     } else {
                        __doPostBack(oClip.ParentObject.id, 'CLIP_CLOSE');
                     }

                  } else if (oClip.id.indexOf('_CLIP_MAXIMIZE') > -1) {
                     oClip.style.backgroundImage = 'url(' + _oSkinImages['CLIP_MAXIMIZE'].ImageOnOver + ')';

                     if (oClip.ParentObject.Ajax) {
                        __bw2AjaxObjOnEvent(oEvent, oClip.ParentObject.id, 'onclick', 'CLIP_MAXIMIZE')
                     } else {
                        __doPostBack(oClip.ParentObject.id, 'CLIP_MAXIMIZE');
                     }
                     
                     oClip.ParentObject.Maximize();

                  } else if (oClip.id.indexOf('_CLIP_MINIMIZE') > -1) {
                     oClip.style.backgroundImage = 'url(' + _oSkinImages['CLIP_MINIMIZE'].ImageOnOver + ')';

                     if (oClip.ParentObject.Ajax) {
                        __bw2AjaxObjOnEvent(oEvent, oClip.ParentObject.id, 'onclick', 'CLIP_MINIMIZE')
                     } else {
                        __doPostBack(oClip.ParentObject.id, 'CLIP_MINIMIZE');
                     }

                     oClip.ParentObject.Minimize();
                  }
         }

/*--------------------------------------------------------------------------------*/
         
         function _bw2FormClose() {
                  try {
                      __bw2ToolStripsHide();
                      __bw2ToolStripsDestroy();
                      
                      if (this.Created) {
                         if (this.style.display != 'none') this.style.display = 'none';

                         /*--- Setze sichtbare Form mit höchstem z-Index als Aktive Form ---*/
                         var nF = -1;
                         var oF = null;

                         for (strK in _oForms) {
                             if ((_oForms[strK] != null) && (_oForms[strK].Form.style.display == 'block') && (_oForms[strK].Form.style.zIndex > nF)) {
                                nF = _oForms[strK].Form.style.zIndex
                                oF = _oForms[strK].Form;
                             }
                         }

                         if (oF != null) __bw2ZOrder(oF, 'form');
                      }

                      if (this.ParentObject.CloseAndDestroy) this.ParentObject.Dispose();                           
                      
                  } catch (e) {
                  }
         }

/*--------------------------------------------------------------------------------*/

         function _bw2FormDblClick(oEvent) {
                  if (oEvent == null) return;

                  try {
                      var oW = __bw2EventSource(oEvent).ParentObject;
                      
                      if (oW.WindowState == -1) {
                         oW.Minimize();
                      } else {
                         oW.Maximize();
                      }
                  } catch (e) {
                  }
         }

/*--------------------------------------------------------------------------------*/

         function _bw2FormDeactivate() {
                  try {
                      if (this.style.display == 'block') __bw2ObjectOpacity(this, 70);
                  } catch (e) {
                  }
         }
         
/*--------------------------------------------------------------------------------*/

         function _bw2FormDestroy() {
                  if (!this.Form.Created) return;

                  /*--- Remove Form-Object from MainForm ---*/
                  try {
                      this.Form.innerHTML = '';

                      /*--- Add Form to Main-Form ---*/
                      __bw2RemoveChildElement(this.Form);

                      _oForms[this.ID] = null;

                  } catch (e) {
                      alert('_bw2FormDestroy.Error : ' + e.name + ', ' + e.description + ', ' + e.number);
                  }
         }

/*--------------------------------------------------------------------------------*/

         function _bw2FormIconClose(oEvent) {
                  if (oEvent == null) return;

                  var oClip = __bw2EventSource(oEvent);

                  if (oClip.ParentObject.Ajax) {
                     __bw2AjaxObjOnEvent(oEvent, oClip.ParentObject.id, 'onclick', 'CLIP_CLOSE')
                  } else {
                     __doPostBack(oClip.ParentObject.id, 'CLIP_CLOSE');
                  }
         }

/*--------------------------------------------------------------------------------*/

         function _bw2FormLoad(strContent, strContentToolStripTop, strContentToolStripBottom, fShow) {
                  
                  if (this.Created) {
                     if (strContent != null) this.Container.innerHTML = strContent;
                  } else {
                     this.Create(strContent);
                  }
                  
                  if ((strContentToolStripTop) && (this.ToolStripPanelTop)) { this.ToolStripPanelTop.innerHTML = strContentToolStripTop; }
                  if ((strContentToolStripBottom) && (this.ToolStripPanelBottom)) this.ToolStripPanelBottom.innerHTML = strContentToolStripBottom;
                  
                  if (fShow != null) {
                     this.Visible(fShow);
                  } else {
                     this.Visible(true);
                  }

                  /*--- OnLoad-Event for Ajax ---*/
                  //if (this.Ajax) __bw2AjaxObjOnEvent(event, this.id, 'onload', '1', true);
         }

/*--------------------------------------------------------------------------------*/

         function _bw2FormMaximize() {
                  try {
                      if (this.style.display == 'block') {
                         if (this.WindowState == 0) {
                            if ((this.ClipControls & 4) != 4) return;

                            this.Moving = false;
                            this.WindowState = 1;
                            this.OrigLeft = __bw2GetStyleLeft(this.style); 
                            this.OrigTop = __bw2GetStyleTop(this.style); 
                            this.OrigWidth = __bw2GetStyleWidth(this.style); 
                            this.OrigHeight = __bw2GetStyleHeight(this.style); 

                            this.style.left = 0;
                            this.style.top = 0;
                            this.style.width = __bw2WindowWidth(); 
                            this.style.height = __bw2WindowHeight(); 
                         } else {
                            this.Moving = true;
                            this.WindowState = 0;
                            this.style.left = this.OrigLeft; 
                            this.style.top = this.OrigTop; 
                            this.style.width = this.OrigWidth; 
                            this.style.height = this.OrigHeight; 
                            
                            __bw2FormShadow(this);
                         } 

                         this.Resize();
                      }
                  } catch (e) {
                  }
         }
         
/*--------------------------------------------------------------------------------*/

         function _bw2FormMinimize() {
                  try {
                      if (this.style.display == 'block') {
                         var nX = 0;

                         if (this.WindowState == 0) {
                            var nF = -1;
                            var oF = null;

                            for (strK in _oForms) {
                                if ((_oForms[strK] != null) && (_oForms[strK].Form.WindowState == -1)) {
                                   _oForms[strK].Form.style.left = nX;
                                   nX += 100; 
                                }
                            }

                            this.Moving = false;
                            this.WindowState = -1;

                            for (strK in _oForms) {
                                if ((_oForms[strK] != null) && (_oForms[strK].Form.WindowState == 0) && (_oForms[strK].Form.style.zIndex > nF)) {
                                   nF = _oForms[strK].Form.style.zIndex
                                   oF = _oForms[strK].Form;
                                }
                            }

                            if (oF != null) __bw2ZOrder(oF, 'form');

                            this.OrigLeft = __bw2GetStyleLeft(this.style); 
                            this.OrigTop = __bw2GetStyleTop(this.style); 
                            this.OrigWidth = __bw2GetStyleWidth(this.style); 
                            this.OrigHeight = __bw2GetStyleHeight(this.style); 

                            this.style.left = nX;
                            this.style.top = __bw2WindowHeight() - nHH;
                            this.style.width = 100; 
                            this.style.height = nHH;
                            this.Close;
                          } else {
                            this.Moving = true;
                            this.WindowState = 0;
                            this.style.left = this.OrigLeft; 
                            this.style.top = this.OrigTop; 
                            this.style.width = this.OrigWidth; 
                            this.style.height = this.OrigHeight; 
                            
                            __bw2FormShadow(this);

                            for (strK in _oForms) {
                                if ((_oForms[strK] != null) && (_oForms[strK].Form.WindowState == -1)) {
                                   _oForms[strK].Form.style.left = nX;
                                   nX += 100; 
                                }
                            }
                         } 

                         this.Resize();
                      }
                  } catch (e) {
                  }
         }
         
/*--------------------------------------------------------------------------------*/

         function _bw2FormResize() {
                  try {
                      if (this == null) return;
                      
                      var nHH = _oSkinImages['FORM_BORDER_TOP_LEFT'].Height;
                      var nWW = __bw2WindowWidth();
                      var nWH = __bw2WindowHeight();
                      
                      if (this.offsetWidth + this.offsetLeft > nWW) this.style.width = nWW - this.offsetLeft - 4;
                      if (this.offsetHeight + this.offsetTop > nWH) this.style.height = nWH - this.offsetTop - 4;
                      if (this.offsetTop < 0) this.style.top = 0;

                      var nFW = __bw2GetStyleWidth(this.style);
                      var nFH = __bw2GetStyleHeight(this.style);
                      var nCR = 0;
                      var nCL = 2;
                      var nL = 0;
                      var nH = 0;
                      var nHO = 0;
                      var nW = 0;
                      var nWO = 0;

                      if (this.style.display == 'block') {
                         if (this.WindowState == -1) {
                            this.BorderTopRight.style.left = nFW - _oSkinImages['FORM_BORDER_TOP_RIGHT'].Width;

                            if ((this.ClipControls & 1) == 1) this.ClipContext.style.display = 'none';
                            //if ((this.ClipClose & 2) == 2) this.ClipClose.style.display = 'none';

                            this.Caption.style.left = nCL + _oSkinImages['FORM_BORDER_TOP_LEFT'].Width;

                            return; 
                         }

                         this.BorderTopRight.style.left = nFW - _oSkinImages['FORM_BORDER_TOP_RIGHT'].Width;
                         this.Header.style.width = nFW - _oSkinImages['FORM_BORDER_TOP_LEFT'].Width - _oSkinImages['FORM_BORDER_TOP_RIGHT'].Width;
                         this.Header.style.height = nHH;

                         if (this.Icon) {
                            var strI = this.Icon.split('|');
                            this.ClipIcon.style.display = 'block';
                            nCL = Number(strI[1]) + 4; 
                         } else if ((this.ClipControls & 1) == 1) {
                            this.ClipContext.style.display = 'block';
                            nCL = _oSkinImages['CLIP_CONTEXT'].Width + 4;
                         } 

                         this.Caption.style.left = nCL + _oSkinImages['FORM_BORDER_TOP_LEFT'].Width;

                         /*--- Move Clip-Close ---*/
                         if ((this.ClipControls & 2) == 2) {
                            this.ClipClose.style.left = nFW - _oSkinImages['CLIP_CLOSE'].Width - _oSkinImages['FORM_BORDER_TOP_RIGHT'].Width;
                            nCR += _oSkinImages['CLIP_CLOSE'].Width + 1;
                         }
                         
                         /*--- Create Clip-Maximize ---*/
                         if ((this.ClipControls & 4) == 4) {
                            this.ClipMax.style.left = nFW - nCR - _oSkinImages['CLIP_MAXIMIZE'].Width - _oSkinImages['FORM_BORDER_TOP_RIGHT'].Width;
                            nCR += _oSkinImages['CLIP_MAXIMIZE'].Width + 1;
                         }

                         /*--- Create Clip-Minimize ---*/
                         if ((this.ClipControls & 8) == 8) {
                            this.ClipMin.style.left = nFW - nCR - _oSkinImages['CLIP_MINIMIZE'].Width - _oSkinImages['FORM_BORDER_TOP_RIGHT'].Width;
                            nCR += _oSkinImages['CLIP_MINIMIZE'].Width + 1;
                         }

                         this.Border.style.left = 0;
                         this.Border.style.top = nHH;

                         if (_fIE) {
                            this.Border.style.width = nFW;
                            this.Border.style.height = nFH - nHH;
                         } else {
                            this.Border.style.width = nFW - (this.Border.offsetWidth - this.Border.clientWidth);
                            this.Border.style.height = nFH - nHH - (this.Border.offsetHeight - this.Border.clientHeight);
                         }

                         if (this.BorderStyle == 4) {
                            nL = 3;
                            nW = nFW - 6;
                            nWO = 6;
                            nH = nFH - nHH - 3;
                            nHO = 6;
                         } else {
                            nL = 1;
                            nW = nFW - 2;
                            nWO = 2;
                            nH = nFH - nHH - 1;
                            nHO = 4;
                         }

                         this.Container.style.left = nL;
                         this.Container.style.width = nW;

                         if ((this.ToolStripPanelTop) && (this.ToolStripPanelBottom)) {
                            this.ToolStripPanelTop.style.top = nHH;
                            this.ToolStripPanelTop.style.left = nL;
                            this.ToolStripPanelTop.style.width = nW;
                            this.Container.style.top = nHH + this.ToolStripPanelTop.offsetHeight;
                            this.Container.style.height = nH - this.ToolStripPanelTop.offsetHeight - this.ToolStripPanelBottom.offsetHeight;
                            this.ToolStripPanelBottom.style.left = nL;
                            this.ToolStripPanelBottom.style.top = nH;
                            this.ToolStripPanelBottom.style.width = nW;
                         } else if (this.ToolStripPanelTop) {
                            this.ToolStripPanelTop.style.top = nHH;
                            this.ToolStripPanelTop.style.left = nL;
                            this.ToolStripPanelTop.style.width = nW;
                            this.Container.style.top = nHH + this.ToolStripPanelTop.offsetHeight;
                            this.Container.style.height = nH - this.ToolStripPanelTop.offsetHeight;
                         } else if (this.ToolStripPanelBottom) {
                            this.Container.style.top = nHH;
                            this.Container.style.height = nH - this.ToolStripPanelBottom.offsetHeight - nL;
                            this.ToolStripPanelBottom.style.left = nL;
                            this.ToolStripPanelBottom.style.top = nFH - this.ToolStripPanelBottom.offsetHeight - nL - 1;
                            this.ToolStripPanelBottom.style.width = nW;
                         } else {
                            this.Container.style.top = nHH;
                            this.Container.style.height = nH;
                         }
                      }
                  } catch (e) {
                      //alert('_bw2FormResize.Error : ' + e.name + ', ' + e.description + ', ' + e.number);
                  }
         }
         
/*--------------------------------------------------------------------------------*/

         function _bw2FormTitle(strTitle) {
                  if (strTitle != null) {
                     this.TitleText = strTitle;
                     if (this.Caption) this.Caption.innerHTML = strTitle;
                  } else if (this.Caption) {
                     return this.Caption.innerHTML;
                  } 
         }

/*--------------------------------------------------------------------------------*/

         function _bw2FormVisible(fShow) {

                  //if (_fIE) this.ShowEffect = 0;

                  /*--- Show ---*/
                  if (fShow) {
                     /*--- Modale Form ---*/  
                     if (this.Modal) {
                        this.style.zIndex = __bw2ZIndex();

                        if (window.Modal == null) {
                           window.Modal = document.createElement('DIV');
                           window.Modal.id = 'ScreenLock';
                           window.Modal.style.position = 'absolute';
                           window.Modal.style.left = 0;
                           window.Modal.style.top = 0;
                           window.Modal.style.width = 1;
                           window.Modal.style.height = 1;
                           window.Modal.style.display = 'none';
                           __bw2AppendChildElement(window.Modal);
                        }

                        window.Modal.style.display = 'block';
                        window.Modal.style.zIndex = this.style.zIndex - 1;
                        window.Modal.style.width = '100%'     //__bw2WindowWidth();
                        window.Modal.style.height = '100%'    //__bw2WindowHeight();
                        window.Modal.className = _oSkinCssClasses['FORM_MODAL'];

                        __bw2ObjectOpacity(window.Modal, 10);
                     }
                                          
                     switch (this.ShowEffect) { 
                            case 1: /*--- Blend [IN] ---*/
                                 if (this.style.display == 'none') {
                                    __bw2FormBlend(this, 'IN');
                                 } else {
                                    this.Resize();
                                    __bw2ZOrder(this, 'form');
                                 }
                                 
                                 break;
                            default:
                                 this.style.visibility = 'visible';
                                 this.style.display = 'block';
                                 this.Resize();
                                 __bw2ZOrder(this, 'form');
                                 break;
                     }

                     __bw2Loading(false);

                  /*--- Hide ---*/
                  } else {
                     switch (this.ShowEffect) { 
                            case 1: /*--- Blend [OUT] ---*/
                                 __bw2FormBlend(this, 'OUT');
                                 break;
                            default:
                                 this.style.display = 'none';
                                 this.style.visibility = 'hidden';
                                 this.Close();
                                 break;
                     }

                     /*--- Prüfe ob Modale-Form über Modaler-Form (Modal-Form mit MsgBox) ---*/  
                     var nZC = 0;
                     var nZI = -1;

                     try {
                         for (strKey in _oForms) {
                             if (_oForms[strKey] != null) {
                                if (_oForms[strKey].Form.style.display != 'none') nZC++
                                if ((strKey != this.id) && (_oForms[strKey].Form.Modal) && (_oForms[strKey].Form.style.display != 'none')) {
                                   nZI = _oForms[strKey].Form.style.zIndex - 1;
                                }  
                             }   
                         }
                     } catch (e) {}

                     if ((this.Modal) && (window.Modal != null)) {
                        /*--- Set Z-Index von Modal-View hinter die aktive Form ---*/  
                        if ((nZI > -1) && (nZC > 0)) {
                           window.Modal.style.zIndex = nZI;

                        /*--- Hide Modal-View ---*/  
                        } else {
                           __bw2ObjectOpacity(window.Modal, 0);
                           window.Modal.style.width = 1;
                           window.Modal.style.height = 1;
                           window.Modal.style.display = 'none';
                        }
                     }
                  }
         }
}

/*================================================================================*/
/* <Function> Form Close </Function>
/*================================================================================*/
function __bw2FormClose(strForm) {
         try {
             if (_oForms[strForm] == null) return;
             _oForms[strForm].Form.Visible(false)
             __bw2Loading(false);
         } catch (e) {
         }
}

/*================================================================================*/
/* <Function> Form Shadow </Function>
/*================================================================================*/
function __bw2FormShadow(oForm) {
         if (_fIE) oForm.style.filter = 'progid:dximagetransform.microsoft.shadow(direction=150, strength=4, color=#808080)';
}

/*================================================================================*/
/* <Function> Form Show </Function>
/*================================================================================*/
function __bw2FormShow(strForm, strContent, strTitle, fModal, strContentToolStripTop, strContentToolStripBottom) {
         try {
             if (_oForms[strForm] == null) return;

             with (_oForms[strForm]) {
                  if (fModal) Form.Modal = fModal; else Form.Modal = false;
                  if (strTitle == null) strTitle = '';
                 
                  if (strContent == null) {
                     var oC = __bw2GetElementById(strForm + '_Content');

                     if (oC != null) {
                        strContent = oC.innerHTML;
                        oC.innerHTML = '';
                     }
                  }    

                  Form.Title(strTitle); 
                  Form.Load(strContent, strContentToolStripTop, strContentToolStripBottom);
             }
         } catch (e) {
         }
}

/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/


/*================================================================================*/
/* <Function> Form Logon </Function>
/*================================================================================*/
function __bw2FormsLogon(oEvent, oInpUserName, oInpPassword, strOnEvent, nSubmitType, strChallange) {
         if (!strOnEvent) return;

         try {
             var oIU = __bw2GetElementById(oInpUserName);
             if (oIU.value == '') return;

             var oIP = __bw2GetElementById(oInpPassword);
             var strPWD = oIP.value;    /* PlainText */

             switch (nSubmitType) {
                    case 1 :            /* HashBased */
                         strPWD = __getMD5(strPWD);   
                         break;             
                    case 2 :            /* ChallengeBased */
                         strPWD = __getMD5(strPWD, strChallange);
                         break;             
                    case 3 :            /* ClientCertificateBased */
                         break;             
             }

             if ((oIU) && (oIP)) {
                var strCapsLock = 'CapsLock=';
                var fCapsLock = false;  //__bw2CheckCapsLock(oEvent);
                
                if (fCapsLock) {
                   strCapsLock += '1'; 
                } else {
                   strCapsLock += '0';
                   if (_oBalloonTip) _oBalloonTip.Visible(false);
                }
             
                switch (strOnEvent) {
                       case 'onchanged' :
                           __bw2AjaxRequest(oIU.id, null, oIU.value, strOnEvent, null, oIP.id + "=" + strPWD + '&' + strCapsLock);
                           //__bw2AjaxRequest(oIU.id, null, oIU.value, strOnEvent, null, oIP.id + "=" + strPWD);
                            break;             

                       case 'onclick' :
                           __bw2AjaxRequest(oIU.id, null, oIU.value, 'onkeypressreturn', null, oIP.id + "=" + strPWD + '&' + strCapsLock);
                           //__bw2AjaxRequest(oIU.id, null, oIU.value, 'onkeypressreturn', null, oIP.id + "=" + strPWD);
                            break;             

                       case 'onkeypressreturn' :  
                            if ((oEvent.keyCode != 13) && (!fCapsLock)) return;

                            __bw2AjaxRequest(oIU.id, null, oIU.value, strOnEvent, null, oIP.id + "=" + strPWD + '&' + strCapsLock);
                            //__bw2AjaxRequest(oIU.id, null, oIU.value, strOnEvent, null, oIP.id + "=" + strPWD);
                            break;             
                }
             }
         } catch (e) {
         }
}

/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/
