﻿/*================================================================================*/
/*                                                                                */
/*             BW2Technologies.Web.JScript.Framework (Alpha V1.0.0.0)             */
/*                                                                                */
/*                                  Web-Dashboard                                 */
/*                                                                                */
/*              Copyright © 2006-2010 by BW2Technologies (HP. Lassnig)            */
/*                           mail to : hansi@lassnig.ch                           */
/*                                                                                */
/*================================================================================*/

var _oDashboards = new Array();
var _oDashboard = null;
var _oSelectedRasterLine = null;
var _fPanelShow = false;

var _oWidgets = new Array();
var _oWidgetForm = null;
var _oWidgetPlaceHolder = null;

/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/


/*================================================================================*/
/* <Function> Dashboard Object </Function>
/*================================================================================*/
function __bw2Dashboard(strDashboard, strColumns, nMinSize, fAjax) {
         this.Ajax = fAjax;
         this.ID = strDashboard;
         this.Widgets = new Array();
         
         this.AddWidget = _bw2DashboardAdd;
         this.Dispose = _bw2DashboardDispose; 
         this.Resize = _bw2DashboardResize; 
         //this.ResizeIndex = _oResizeObjects.length;

         /*--- Dashboard-Object ---*/
         this.Dashboard = __bw2GetElementById(strDashboard);
         this.Dashboard.ParentObject = this;
         this.Dashboard.ColumnSizes = strColumns.split(/;/);
         this.Dashboard.MinSize = nMinSize;
         this.Dashboard.Type = 'dashboard';

         this.Dashboard.id = strDashboard;
         this.Dashboard.style.zIndex = 0;
         this.Dashboard.style.overflow = 'auto';
         this.Dashboard.style.marginRight = '3';
         this.Dashboard.style.marginBottom = '3';

         /*--- Event-Handlers ---*/   
         this.Dashboard.onmousedown = _bw2Dashboard_OnMouseDown;
         this.Dashboard.onmousemove = _bw2Dashboard_OnMouseMove;
         this.Dashboard.onmouseout = _bw2Dashboard_OnMouseOut;
         this.Dashboard.onmouseup = _bw2Dashboard_OnMouseUp;

         if (_fIE) {
            __bw2AddEventListener(this.Dashboard, 'resize', _bw2Dashboard_Resize, false);

         /*--- Add to Resizing Objects-Collection ---*/
         } else {
            //_oResizeObjects[this.ResizeIndex] = this;
         }

         /*--- Columns ---*/   
         this.Dashboard.Columns = new Array();

         /*--- Raster-Lines ---*/   
         this.Dashboard.RasterLines = new Array();
         this.Dashboard.RasterLinesCreate = _bw2DashboardRasterLinesCreate;
         this.Dashboard.RasterLinesDelete = _bw2DashboardRasterLinesDelete;
         this.Dashboard.RasterLinesVisible = _bw2DashboardRasterLinesVisible;
         this.Dashboard.RasterLinesCreate();

         /*--- Config-Panel ---*/   
         this.Dashboard.PanelConfig = new __bw2DashboardPanelConfig(this.Dashboard);
         this.Dashboard.PanelConfig.Panel.SetCols.Input.value = this.Dashboard.ColumnSizes.length;

/*--------------------------------------------------------------------------------*/

         function _bw2DashboardAdd(oWidget) {
                  try {
                      this.Widgets[this.Widgets.length] = oWidget;
                      //this.Widgets[oWidget.ID] = oWidget;
                         
                      /*--- Widget add on defined Column ---*/  
//                      if (oWidget.ColumnIndex > -1) {
//                         this.Dashboard.Columns[oWidget.ColumnIndex].Column.appendChild(oWidget.Form);

//                      /*--- Widget add on Column with free space ---*/  
//                      } else {
//                         this.Dashboard.Columns[0].Column.appendChild(oWidget.Form);
//                      }
//                      
//                      oWidget.Position(true);
//                      
//                      /*--- CallBack for loading Content ---*/
//                      __bw2AjaxAsyncCallBack(oWidget.ID, null, 0);
                  } catch (e) {} 
         }

/*--------------------------------------------------------------------------------*/

         function _bw2DashboardDispose() {
         
                  /*--- Clear in Resizing-Objects Collection ---*/
                  //if (!_fIE) _oResizeObjects[this.ResizeIndex] = null;

                  /*--- Clear in Dashboards Collection ---*/
                  _oDashboards[this.ID] = null;

                  /*--- Destroy Objects ---*/           
                  this.Dashboard.RasterLinesDelete();
                  this.Dashboard.PanelConfig.Dispose();
         }

/*--------------------------------------------------------------------------------*/

         function _bw2DashboardResize() {
                 try {
                     with (this) {
                          Dashboard.PanelConfig.Panel.style.left = (Dashboard.offsetWidth - Dashboard.PanelConfig.Panel.offsetWidth) / 2;

                          //__bw2Debug(Dashboard.parentElement.clientWidth + ', ' + Dashboard.parentElement.clientHeight + ' - ' + Dashboard.offsetWidth + ', ' + Dashboard.offsetHeight);
                          //__bw2Debug(Dashboard.parentNode.clientWidth + ', ' + Dashboard.parentNode.clientHeight + ' - ' + Dashboard.offsetWidth + ', ' + Dashboard.offsetHeight);
                          //__bw2Debug(Dashboard.offsetWidth + ', ' + Dashboard.offsetHeight);

                          /*--- MouseMove on Columns ---*/ 
                          //for (var nI = 0; nI < Dashboard.ColumnSizes.length; nI++)	{
                          //    Dashboard.Columns[nI].Column.style.height = '100%';  //Dashboard.clientHeight;
                          //}
                     }
                  } catch (e) {}
         }

/*--------------------------------------------------------------------------------*/

         function _bw2Dashboard_OnMouseDown(oEvent) {
                  if (oEvent == null) oEvent = window.event;

                  /*--- Raster-Lines ---*/
                  try {
                      if (this.PanelConfig.Panel.ShowRaster.Selected) return;
                      this.RasterLinesVisible(true);
                  } catch (e) {}
         }

/*--------------------------------------------------------------------------------*/

         function _bw2Dashboard_OnMouseMove(oEvent) {
                  if (oEvent == null) oEvent = window.event;

                  /*--- Drag Widget ---*/
                  try {
                      if (_oWidgetForm) {
                         var nMX = __bw2EventClientX(oEvent);
                         var nMY = __bw2EventClientY(oEvent);
                         
                         _oWidgetForm.style.left = nMX - _oWidgetForm.OffsetMX;
                         _oWidgetForm.style.top = nMY - _oWidgetForm.OffsetMY;
                         
                         /*--- MouseMove on Columns ---*/ 
                         for (var nI = 0; nI < this.ColumnSizes.length; nI++)	{
                             if ((nMX > this.Columns[nI].Column.offsetLeft) && (nMX < this.Columns[nI].Column.offsetLeft + this.Columns[nI].Column.offsetWidth)) {
                                this.Columns[nI].Column.MouseMove(nMY);
                                break;
                             }
                         }

                         return;
                      }
                  } catch (e) {}

                  /*--- Panel Slide (IN/OUT) ---*/
                  try {
                      var nDBy = __bw2ObjectOffsetTop(this) + 18;  //this.PanelConfig.Panel.MaxSize;

                      if (__bw2EventClientY(oEvent) < nDBy) {
                         this.PanelConfig.Panel.SlideIn();
                      } else if ((__bw2EventClientY(oEvent) > nDBy) && (this.PanelConfig.Panel.IsSliding == 1)) {
                         if (_oTimeoutSlide) { clearTimeout(_oTimeoutSlide); _oTimeoutSlide = null; }
                         this.PanelConfig.Panel.IsSliding = 0;
                         this.PanelConfig.Panel.SlideOut();
                      } else {
                         this.PanelConfig.Panel.IsSliding = 0;
                         this.PanelConfig.Panel.SlideOut();
                      }
                  } catch (e) {}

                  __bw2Unselect();
         }

/*--------------------------------------------------------------------------------*/

         function _bw2Dashboard_OnMouseOut(oEvent) {
                  if (oEvent == null) oEvent = window.event;

                  /*--- Panel-Slide ---*/
                  try {
                      if (_oTimeoutSlide) { clearTimeout(_oTimeoutSlide); _oTimeoutSlide = null; }
                      this.PanelConfig.Panel.IsSliding = 0;
                      this.PanelConfig.Panel.SlideOut();
                  } catch (e) {}
         }

/*--------------------------------------------------------------------------------*/

         function _bw2Dashboard_OnMouseUp(oEvent) {
                  if (oEvent == null) oEvent = window.event;

                  /*--- Drop Widget ---*/
                  try {
                      if ((_oWidgetForm != null) && (_oWidgetPlaceHolder != null)) {
                         _oWidgetPlaceHolder.parentNode.replaceChild(_oWidgetForm, _oWidgetPlaceHolder);
                         _oWidgetPlaceHolder.style.display = 'none';

                         _oWidgetForm.className = _oSkinCssClasses['WIDGET'];
                         _oWidgetForm.style.position = 'static';
                         _oWidgetForm.style.width = '100%';
                         _oWidgetForm.style.margin = '5';
                         _oWidgetForm.style.marginBottom = '10';
                         
                         __bw2ObjectOpacity(_oWidgetForm, 100);
                         if (_fIE) __bw2FormShadow(_oWidgetForm);

                         /*--- Repos aller Wigedts ---*/
                         for (strID in _oWidgets) {
                             _oWidgets[strID].Position();
                         }   
                      }

                      _oWidgetForm = null;
                      _oWidgetPlaceHolder = null;
                  } catch (e) {}

                  /*--- Raster-Lines ---*/
                  try {
                      if (this.PanelConfig.Panel.ShowRaster.Selected) return;
                      this.RasterLinesVisible(false);
                  } catch (e) {}

                  __bw2Unselect();
         }

/*--------------------------------------------------------------------------------*/

         function _bw2DashboardRasterLinesCreate() {
                   
                  /*--- Create Columns ---*/ 
                  for (var nI = 0; nI < this.ColumnSizes.length; nI++)	{
                      this.Columns[nI] = new __bw2DashboardColumn(this, nI);
                  } 
                  
                  /*--- Create Raster-Lines ---*/ 
                  for (var nI = 0; nI < this.ColumnSizes.length - 1; nI++)	{
                      this.RasterLines[nI] = new __bw2DashboardRasterLine(this, nI);
                  } 
         }

/*--------------------------------------------------------------------------------*/

         function _bw2DashboardRasterLinesDelete() {
                  for (var nI = 0; nI < this.RasterLines.length; nI++)	{
                      this.RasterLines[nI].Dispose();
                      this.RasterLines[nI] = null;
                  } 

                  /*--- Create Columns ---*/ 
                  for (var nI = 0; nI < this.ColumnSizes.length; nI++)	{
                      this.Columns[nI].Dispose();
                      this.Columns[nI] = null;
                  } 

                  this.Columns = new Array();
                  this.ColumnSizes = new Array();
                  this.RasterLines = new Array();
         }

/*--------------------------------------------------------------------------------*/

         function _bw2DashboardRasterLinesVisible(fVisible) {
                  if (this.RasterLines.length == 0) return;
         
                  try {
                      if (fVisible == null) return this.Visible;

                      this.Visible = fVisible
                      
                      if (fVisible) {
                         for (var nI = 0; nI < this.RasterLines.length; nI++)	{
                             with (this.RasterLines[nI].Line) {
                                  style.visibility = 'visible';
                                  
                                  if (this.ColumnSizes[nI] == '*') {
                                  } else {
                                     style.left = this.ColumnSizes[nI] + '%';
                                  }
                             }
                         } 
                      } else {
                         for (var nI = 0; nI < this.RasterLines.length; nI++)	{
                             this.RasterLines[nI].Line.style.visibility = 'hidden';
                         } 
                      }
                  } catch (e) {}
         }

/*--------------------------------------------------------------------------------*/

         function _bw2Dashboard_Resize(oEvent) {
                  if (oEvent == null) return;

                  try {
                      var oDB = null;

                      if (oEvent.Type == null) {
                         oDB = __bw2EventSource(oEvent);
                      } else {
                         oDB = oEvent;
                      }
                     
                      oDB.ParentObject.Resize();
                  } catch (e) {}
         }
}

/*================================================================================*/
/* <Function> Load Dashboard-Wigets </Function>
/*================================================================================*/
function __bw2DashboardsLoad() {

         /*--- Loop over Dashboards ---*/
         for (strDID in _oDashboards) {
             if ((_oDashboards[strDID] != null) && (_oDashboards[strDID].Widgets.length > 0)) {
                var nCC = _oDashboards[strDID].Dashboard.Columns.length;
                var nCW = _oDashboards[strDID].Widgets.length;
                var nCI = 0, nRI = 0;
                var nWidgets = new Array(nCC);

                for (var nI = 0; nI < nCC; nI++) { nWidgets[nI] = new Array(nCW); }

                /*--- Loop over Widgets ---*/
                for (nW in _oDashboards[strDID].Widgets) {
                    with (_oDashboards[strDID].Widgets[nW]) {
                         nCI = ColumnIndex; 
                         nRI = RowIndex;
                         
                         if (nCI > nCC - 1) nCI = nCC - 1;

                         __bw2Debug(nCI + ', ' + nRI);
                         
                         if (nWidgets[nCI][nRI]) {
                            nRI += 1;
                            while (nWidgets[nCI][nRI]) { nRI++ }
                         }

                         nWidgets[nCI][nRI] = nW;
                         ColumnIndex = nCI;
                         RowIndex = nRI;
                    }
                }

                /*--- Add Widgets to Daschboard ---*/
                for (var nC = 0; nC < nCC; nC++) {
                    for (var nR = 0; nR < nCW; nR++) {
                        if (nWidgets[nC][nR] != null) {
                           nRI = Number(nWidgets[nC][nR]);

                           with (_oDashboards[strDID].Widgets[nRI]) {
                                /*--- Add Widget-Form to Column ---*/
                                _oDashboards[strDID].Dashboard.Columns[nC].Column.appendChild(Form);

                                /*--- CallBack for loading Content ---*/
                                var strQ = 'ColumnIndex=' + ColumnIndex + '&RowIndex=' + RowIndex;
                                __bw2AjaxAsyncCallBack(ID, strQ, 0);
                           }
                        }
                    }                
                }
             }
         }
}

/*================================================================================*/
/* <Function> Resize Dashboards </Function>
/*================================================================================*/
function __bw2DashboardsResize(strChilds) {
         var fC = false;
         
         for (strID in _oDashboards) {
             if (_oDashboards[strID] != null) {
                if (strChilds != null) {
                   if (fC) _oDashboards[strID].Resize();
                   if (strID == strChilds) fC = true;
                } else { 
                   _oDashboards[strID].Resize();
                }
             }
         }
}

/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/


/*================================================================================*/
/* <Function> Dashboard Column Object </Function>
/*================================================================================*/
function __bw2DashboardColumn(oParent, nIndex) {
         this.ID = oParent.id + '_Column' + nIndex;
         this.ParentObject = oParent;
         this.Index = nIndex;
         
         this.Dispose = _bw2DashboardColumnDispose; 
         this.Resize = _bw2DashboardColumnResize;

         /*--- Create Column Object ---*/
         this.Column = document.createElement('DIV'); oParent.appendChild(this.Column);
         this.Column.ParentObject = this;
         this.Column.Dashboard = oParent;
         this.Column.Index = nIndex;

         this.Column.id = this.ID;
         this.Column.style.zIndex = 0;
         this.Column.style.position = 'absolute';
         this.Column.style.display = 'block';
         this.Column.style.overflow = 'visible';
         this.Column.style.top = '0';

         //this.Column.style.height = '100%';
         //this.Column.style.backgroundColor = 'green';

         if (_fIE) {
            this.Column.style.paddingRight = '0';
         } else { 
            this.Column.style.paddingRight = '10';
         }

         this.Column.MouseMove = _bw2Column_MouseMove; 
         
         this.Resize();

/*--------------------------------------------------------------------------------*/

         function _bw2DashboardColumnDispose() {
                  try {  
                      while (this.Column.children.length > 0) {
                            var oC = this.Column.children(0);
                            this.Column.removeChild(oC);
                      }  
                  } catch (e) {}

                  /*--- Remove from Container ---*/                    
                  this.ParentObject.removeChild(this.Column);
         }

/*--------------------------------------------------------------------------------*/

         function _bw2DashboardColumnResize() {
                  try {  
                      var nX = 0, nW = 0;
                      
                      if (_fIE) {
                          if (this.Index == 0) {
                             nX = 0;
                             nW = Number(this.ParentObject.ColumnSizes[this.Index]) - nX;
                          } else if (this.Index == this.ParentObject.ColumnSizes.length - 1) {   
                             nX = Number(this.ParentObject.ColumnSizes[this.Index - 1]) + 0.5;
                             nW = 100 - nX - 0.5;
                          } else {
                             nX = Number(this.ParentObject.ColumnSizes[this.Index - 1]) + 0.5;
                             nW = Number(this.ParentObject.ColumnSizes[this.Index]) - nX;
                          }
                      } else {
                          if (this.Index == 0) {
                             nX = 0;
                             nW = Number(this.ParentObject.ColumnSizes[this.Index]) - nX - 0.6;
                          } else if (this.Index == this.ParentObject.ColumnSizes.length - 1) {   
                             nX = Number(this.ParentObject.ColumnSizes[this.Index - 1]) + 0.5;
                             nW = 100 - nX - 1.3;
                          } else {
                             nX = Number(this.ParentObject.ColumnSizes[this.Index - 1]) + 0.7;
                             nW = Number(this.ParentObject.ColumnSizes[this.Index]) - nX - 0.7;
                          }
                      }    

                      this.Column.style.left = nX + '%';
                      this.Column.style.width = nW + '%';
                  } catch (e) {}  
         }

/*--------------------------------------------------------------------------------*/

         function _bw2Column_MouseMove(nMY) {
                  if (_oWidgetPlaceHolder == null) return;  
         
                  var nOY = __bw2ObjectOffsetTop(this);
                  
                  try {
                      nMY -= nOY;
                      
                      if (_oWidgetPlaceHolder.Column == this.ParentObject.Index) {
                         for (var nI = 0; nI < this.children.length; nI++)	{
                             var oChild = this.children[nI];

                             /*--- Move Up ---*/                           
                             if ((nMY > oChild.offsetTop) && (nMY < oChild.offsetTop + (oChild.offsetHeight / 2))) {
                                if ((oChild != _oWidgetPlaceHolder) && (oChild.previousSibling != _oWidgetPlaceHolder)) {
                                   this.removeChild(_oWidgetPlaceHolder);
                                   this.insertBefore(_oWidgetPlaceHolder, oChild);    
                                   break;
                                }

                             /*--- Move Down ---*/                           
                             } else if ((nMY > oChild.offsetTop + (oChild.offsetHeight / 2)) && (nMY < oChild.offsetTop + oChild.offsetHeight)) {
                                if (oChild != _oWidgetPlaceHolder) {
                                   this.removeChild(_oWidgetPlaceHolder);
    
                                   if (oChild.nextSibling) {
                                      this.insertBefore(_oWidgetPlaceHolder, oChild.nextSibling);    
                                   } else {
                                      this.appendChild(_oWidgetPlaceHolder);    
                                   }

                                   break;
                                }
                             }
                         }
                      } else {
                         var oCol = _oWidgetPlaceHolder.parentNode;

                         oCol.removeChild(_oWidgetPlaceHolder);

                         _oWidgetPlaceHolder.Column = this.ParentObject.Index
                         this.appendChild(_oWidgetPlaceHolder);    
                      }
                  } catch (e) {}
         }
}

/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/


/*================================================================================*/
/* <Function> Dashboard Cofiguration-Panel Object </Function>
/*================================================================================*/
function __bw2DashboardPanelConfig(oParent) {
         var oTR = null;
         var oTD = null;

         this.ID = oParent.id + '_PanelConfig';
         this.ParentObject = oParent;

         this.Dispose = _bw2DashboardPanelConfigDispose; 

         /*--- Create [Panel] Object ---*/
         this.Panel = document.createElement('DIV'); oParent.appendChild(this.Panel);
         this.Panel.ParentObject = this;
         this.Panel.Dashboard = oParent;
         this.Panel.Direction = 0;
         this.Panel.IsSliding = 0;
         this.Panel.MaxSize = 32;
         this.Panel.OnOver = false;

         this.Panel.id = this.ID;
         this.Panel.style.zIndex = 2;
         this.Panel.style.position = 'absolute';
         this.Panel.style.display = 'block';
         this.Panel.style.overflow = 'hidden';
         this.Panel.style.visibility = 'visible';
         this.Panel.style.width = '400';
         this.Panel.style.height = '0';
         this.Panel.style.left = (oParent.offsetWidth - this.Panel.offsetWidth) / 2;
         this.Panel.style.top = '0';

//         if (_fIE) {
//            this.Panel.style.filter = "progid:dximagetransform.microsoft.alphaimageloader(src='" + _oSkinImages['DASHBOARD_PANEL_CONFIG_BACKGROUND'].ImageSelected + "', sizingMethod='scale')";
//         } else {   
//            this.Panel.style.backgroundImage = "url(" + _oSkinImages['DASHBOARD_PANEL_CONFIG_BACKGROUND'].Image + ")";
//         }

         this.Panel.onmousemove = _bw2DashboardPanelConfig_PanelOnMouseMove;
         this.Panel.onmouseout = _bw2DashboardPanelConfig_PanelOnMouseOut;
         this.Panel.Size = _bw2DashboardPanelConfig_PanelSize;
         this.Panel.SlideIn = _bw2DashboardPanelConfig_PanelSlideIn;
         this.Panel.SlideOut = _bw2DashboardPanelConfig_PanelSlideOut;

         /*--- Create [BackGround]-Object ---*/
         this.Panel.BackGround = document.createElement('DIV'); this.Panel.appendChild(this.Panel.BackGround);
         this.Panel.BackGround.style.display = 'block';
         this.Panel.BackGround.style.position = 'absolute';

         //this.Panel.BackGround.style.zIndex = 0;
         this.Panel.BackGround.style.left = '0';
         this.Panel.BackGround.style.top = '0';
         this.Panel.BackGround.style.width = '100%';
         this.Panel.BackGround.style.height = _oSkinImages['DASHBOARD_PANEL_CONFIG_BACKGROUND'].Height; //'100%';

         if (_fIE6) {
            this.Panel.BackGround.style.filter = "progid:dximagetransform.microsoft.alphaimageloader(src='" + _oSkinImages['DASHBOARD_PANEL_CONFIG_BACKGROUND'].ImageSelected + "', sizingMethod='scale')";
         } else {   
            this.Panel.BackGround.style.backgroundImage = "url(" + _oSkinImages['DASHBOARD_PANEL_CONFIG_BACKGROUND'].Image + ")";
         }

         //this.Panel.BackGround.style.backgroundPositionY = 'bottom';
         //this.Panel.BackGround.style.backgroundPosition = 'bottom';
         
         /*--- Create [ShowRaster]-Checkbox ---*/ 
         this.Panel.ShowRaster = document.createElement('DIV'); this.Panel.appendChild(this.Panel.ShowRaster);
         this.Panel.ShowRaster.Dashboard = oParent;
         this.Panel.ShowRaster.Panel = this.Panel;
         this.Panel.ShowRaster.Selected = false;

         this.Panel.ShowRaster.id = this.Panel.id + '_CLIP_PIN';
         this.Panel.ShowRaster.alt = '';
         this.Panel.ShowRaster.style.display = 'block';
         this.Panel.ShowRaster.style.position = 'absolute';
         this.Panel.ShowRaster.className = _oSkinCssClasses['DASHBOARD_PANEL_CAPTION'];
         this.Panel.ShowRaster.style.paddingLeft = _oSkinImages['DASHBOARD_CHECKBOX'].Width + 5;
         this.Panel.ShowRaster.style.height = _oSkinImages['DASHBOARD_CHECKBOX'].Height;
         this.Panel.ShowRaster.style.left = '10';
         this.Panel.ShowRaster.style.top = '4';
         this.Panel.ShowRaster.innerHTML = 'Raster';
         
         this.Panel.ShowRaster.onclick = _bw2DashboardPanelConfig_ShowRasterOnClick;
         this.Panel.ShowRaster.Image = _bw2DashboardPanelConfig_ShowRasterImage;
         this.Panel.ShowRaster.Image(this.Panel.ShowRaster.Selected);
        
         /*--- Create [Columns]-Input ---*/ 
         this.Panel.SetCols = document.createElement('DIV'); this.Panel.appendChild(this.Panel.SetCols);
         this.Panel.SetCols.style.position = 'absolute';
         this.Panel.SetCols.style.left = '90';
         this.Panel.SetCols.style.top = '0';
         this.Panel.SetCols.className = _oSkinCssClasses['DASHBOARD_PANEL_CAPTION'];
         this.Panel.SetCols.innerHTML = 'Anzahl Spalten :&nbsp;';

         this.Panel.SetCols.Input = document.createElement('INPUT'); this.Panel.SetCols.appendChild(this.Panel.SetCols.Input);
         this.Panel.SetCols.Input.Dashboard = oParent;
         this.Panel.SetCols.Input.Panel = this.Panel;
         this.Panel.SetCols.Input.id = this.Panel.id + '_INPUT_COLS';
         this.Panel.SetCols.Input.type = 'text';
         this.Panel.SetCols.Input.className = _oSkinCssClasses['DASHBOARD_PANEL_INPUT'];
         this.Panel.SetCols.Input.maxLength = '1';
         this.Panel.SetCols.Input.value = oParent.ColumnSizes.length;
         this.Panel.SetCols.Input.LastValue = oParent.ColumnSizes.length;
         this.Panel.SetCols.Input.style.position = 'absolute';
         this.Panel.SetCols.Input.style.top = '-1';
         this.Panel.SetCols.Input.style.height = '18';
         this.Panel.SetCols.Input.style.width = '20';
         this.Panel.SetCols.Input.style.paddingLeft = '6';
         this.Panel.SetCols.Input.style.backgroundImage = "url(" + _oSkinImages['DASHBOARD_INPUT_ROWS'].Image + ")";

         this.Panel.SetCols.Input.onkeypress = _bw2DashboardPanelConfig_KeyPress;
         this.Panel.SetCols.Input.onkeyup = _bw2DashboardPanelConfig_SetColsInput;
         
         /*--- Create [Pin]-Clip ---*/ 
         this.Panel.ClipPin = document.createElement('IMG'); this.Panel.appendChild(this.Panel.ClipPin);
         this.Panel.ClipPin.Panel = this.Panel;
         this.Panel.ClipPin.Selected = false;
         
         this.Panel.ClipPin.id = this.Panel.id + '_CLIP_PIN';
         this.Panel.ClipPin.alt = '';
         this.Panel.ClipPin.style.display = 'block';
         this.Panel.ClipPin.style.position = 'absolute';
         this.Panel.ClipPin.style.width = _oSkinImages['DASHBOARD_PANEL_CONFIG_PIN'].Width;
         this.Panel.ClipPin.style.height = _oSkinImages['DASHBOARD_PANEL_CONFIG_PIN'].Height;
         this.Panel.ClipPin.style.left = this.Panel.offsetWidth - _oSkinImages['DASHBOARD_PANEL_CONFIG_PIN'].Width - 7;
         this.Panel.ClipPin.style.top = '2';

//         if (this.Panel.ClipPin.Selected) {
//            this.Panel.ClipPin.src = _oSkinImages['DASHBOARD_PANEL_CONFIG_PIN'].ImageSelected;
//         } else {
//            this.Panel.ClipPin.src = _oSkinImages['DASHBOARD_PANEL_CONFIG_PIN'].Image;
//         }

         this.Panel.ClipPin.onclick = _bw2DashboardPanelConfig_PinClipOnClick;
         this.Panel.ClipPin.Image = _bw2DashboardPanelConfig_PinClipImage;
         this.Panel.ClipPin.Image(this.Panel.ClipPin.Selected);

/*--------------------------------------------------------------------------------*/

         function _bw2DashboardPanelConfigDispose() {
                  this.ParentObject.removeChild(this.Panel);
         }

/*--------------------------------------------------------------------------------*/

         function _bw2DashboardPanelConfig_PanelOnMouseMove() {
                  this.OnOver = true;
         }

/*--------------------------------------------------------------------------------*/

         function _bw2DashboardPanelConfig_PanelOnMouseOut() {
                  if (this.ClipPin.Selected) return;
                  this.IsSliding = -1;
                  this.OnOver = false;
                  _fCancelSlide = false;
                  if (_oTimeoutSlide) { clearTimeout(_oTimeoutSlide); _oTimeoutSlide = null; }
                  _oTimeoutSlide = setTimeout("__bw2ObjectSlide(0, '" + this.id  + "', 3, 1)", 100); 
         }

/*--------------------------------------------------------------------------------*/

         function _bw2DashboardPanelConfig_PanelSlideIn() {
                  if ((this.Size() >= this.MaxSize) || (this.IsSliding != 0)) return;
                  this.IsSliding = 1;
                  this.OnOver = false;
                  _fCancelSlide = false;
                  if (_oTimeoutSlide) { clearTimeout(_oTimeoutSlide); _oTimeoutSlide = null; }
                  _oTimeoutSlide = setTimeout("__bw2ObjectSlide(1, '" + this.id  + "', 3, 1)", 500); 
         }

/*--------------------------------------------------------------------------------*/

         function _bw2DashboardPanelConfig_PanelSlideOut() {
                  if ((this.ClipPin.Selected) || (this.Size() <= 0) || (this.IsSliding != 0)) return;
                  this.IsSliding = -1;
                  this.OnOver = false;
                  _fCancelSlide = false;
                  if (_oTimeoutSlide) { clearTimeout(_oTimeoutSlide); _oTimeoutSlide = null; }
                  _oTimeoutSlide = setTimeout("__bw2ObjectSlide(0, '" + this.id  + "', 3, 1)", 100); 
         }

/*--------------------------------------------------------------------------------*/

         function _bw2DashboardPanelConfig_PanelSize(nSize) {
                  if (nSize != null) {
                     if (nSize < 0) nSize = 0; 
                     if (nSize > this.MaxSize) nSize = this.MaxSize; 
                     
                     var nY = this.MaxSize - nSize;

                     this.style.height = nSize; 
                     //this.Background.style.top = nY; 
                     this.ShowRaster.style.top = 4 - nY; 
                     this.SetCols.style.top = 4 - nY; 
                     this.ClipPin.style.top = 2 - nY; 
                  } else {
                     return this.offsetHeight;
                  }
         }
         
/*--------------------------------------------------------------------------------*/

         function _bw2DashboardPanelConfig_ShowRasterImage(fSelected) {
                  try {
                      if (_fIE) {
                         this.style.cursor = 'hand';
                         this.style.backgroundPositionX = 'left';
                         this.style.backgroundPositionY = 'top';
                      } else {
                         this.style.cursor = 'pointer';
                         this.style.backgroundPosition = 'left top';
                      } 

                      this.style.backgroundRepeat = 'no-repeat';

                      if (fSelected) {
                         this.style.backgroundImage = "url(" + _oSkinImages['DASHBOARD_CHECKBOX'].ImageSelected + ")";
                         this.Dashboard.RasterLinesVisible(true);
                      } else {
                         this.style.backgroundImage = "url(" + _oSkinImages['DASHBOARD_CHECKBOX'].Image + ")";
                         this.Dashboard.RasterLinesVisible(false);
                      }
                  } catch (e) {}
         }

/*--------------------------------------------------------------------------------*/

         function _bw2DashboardPanelConfig_ShowRasterOnClick() {
                  this.Selected = !this.Selected;
                  this.Image(this.Selected);
         }

/*--------------------------------------------------------------------------------*/

         function _bw2DashboardPanelConfig_KeyPress(oEvent) {
                  if (oEvent == null) oEvent = window.event; 
                  __bw2Debug(oEvent.keyCode);
                  if ((oEvent.keyCode < 49) || (oEvent.keyCode > 57)) { oEvent.returnValue = false; return; }
         }

/*--------------------------------------------------------------------------------*/

         function _bw2DashboardPanelConfig_SetColsInput(oEvent) {
                  if (oEvent == null) oEvent = window.event; 

                  if ((oEvent.keyCode < 49) || (oEvent.keyCode > 57)) { oEvent.returnValue = false; return; }
                    
                  /*--- Check Value ---*/  
                  if (this.value == '') return;
                  if ((isNaN(this.value)) || (this.value < 1)) { this.value ='1'; }

                  this.Dashboard.RasterLinesDelete();

                  var strP = '';
                  var nC = parseInt(this.value);
                  var nP = parseInt(100 / nC);
                  var nX = nP;
                  
                  for (var nI = 0; nI < nC - 1; nI++)	{
                      this.Dashboard.ColumnSizes[nI] = nX;
                      if (nI == 0) strP = nX; else strP += ';' + nX;
                      nX += nP;
                  } 
                                    
                  this.Dashboard.RasterLinesCreate();
                  if (this.Panel.ShowRaster.Selected) this.Dashboard.RasterLinesVisible(true);
                  
                  /*--- Post Columns-Definition ---*/
                  if (this.Dashboard.ParentObject.Ajax) __bw2AjaxRequest(this.Dashboard.id + '_RasterLines', null, strP, 'onchange');
         }

/*--------------------------------------------------------------------------------*/

         function _bw2DashboardPanelConfig_PinClipImage(fSelected) {
                  if (_fIE) {
                     //this.src = _oSkinImages['BLANK'].Image;
                     //this.width = _oSkinImages['DASHBOARD_PANEL_CONFIG_PIN'].Width;
                     //this.height = _oSkinImages['DASHBOARD_PANEL_CONFIG_PIN'].Height;
                     this.style.cursor = 'hand';
                     
                     if (fSelected) {
                        this.src = _oSkinImages['DASHBOARD_PANEL_CONFIG_PIN'].ImageSelected;
                        if (_fIE6) this.style.filter = "progid:dximagetransform.microsoft.alphaimageloader(src='" + _oSkinImages['DASHBOARD_PANEL_CONFIG_PIN'].ImageSelected + "', sizingMethod='scale')";
                     } else {
                        this.src = _oSkinImages['DASHBOARD_PANEL_CONFIG_PIN'].Image;
                        if (_fIE6) this.style.filter = "progid:dximagetransform.microsoft.alphaimageloader(src='" + _oSkinImages['DASHBOARD_PANEL_CONFIG_PIN'].Image + "', sizingMethod='scale')";
                     }
                  } else {
                     this.style.cursor = 'pointer';

                     if (fSelected) {
                        this.src = _oSkinImages['DASHBOARD_PANEL_CONFIG_PIN'].ImageSelected;
                     } else {
                        this.src = _oSkinImages['DASHBOARD_PANEL_CONFIG_PIN'].Image;
                     }
                  } 
         }

/*--------------------------------------------------------------------------------*/

         function _bw2DashboardPanelConfig_PinClipOnClick() {
                  this.Selected = !this.Selected;
                  this.Image(this.Selected);
         }
}

/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/


/*================================================================================*/
/* <Function> Dashboard Raster-Line Object </Function>
/*================================================================================*/
function __bw2DashboardRasterLine(oParent, nIndex) {
         this.ID = oParent.id + '_RasterLine' + nIndex;
         this.ParentObject = oParent;

         this.Dispose = _bw2DashboardRasterLineDispose; 

         /*--- Create Raster-Line Object ---*/
         this.Line = document.createElement('DIV');
         this.Line.ParentObject = this;
         this.Line.Dashboard = oParent;
         this.Line.Index = nIndex;

         this.Line.id = this.ID;
         this.Line.style.zIndex = 1;
         this.Line.style.display = 'block';
         this.Line.style.visibility = 'hidden';
         this.Line.style.marginRightWidth = '2';
         this.Line.style.borderRightWidth = '1';
         this.Line.style.borderRightStyle = 'dotted';
         this.Line.style.borderRightColor = _oSkinColors['DASHBOARD_RASTERLINE'];

         this.Line.style.position = 'absolute';
         this.Line.style.width = '4';
         this.Line.style.height = '100%';
         this.Line.style.left = this.ParentObject.ColumnSizes[nIndex] + '%';
         this.Line.style.top = '0';
          
         if (_fIE) {
            this.Line.style.cursor = 'col-resize';
         } else {
            this.Line.style.cursor = 'e-resize';
         }
         
         oParent.appendChild(this.Line);

         /*--- Add Event-Handlers ---*/
         this.Line.onmousedown = _bw2DashboardRasterLine_DragBegin;
         __bw2AddEventListener(oParent, 'mousemove', _bw2DashboardRasterLine_DragMove, false);
         __bw2AddEventListener(oParent, 'mouseup', _bw2DashboardRasterLine_DragEnd, false);

/*--------------------------------------------------------------------------------*/

         function _bw2DashboardRasterLineDispose() {

                  /*--- Remove Event-Handlers ---*/
                  __bw2RemoveEventListener(this.ParentObject, 'mousemove', _bw2DashboardRasterLine_DragMove, false);
                  __bw2RemoveEventListener(this.ParentObject, 'mouseup', _bw2DashboardRasterLine_DragEnd, false);

                  /*--- Remove from Container ---*/                    
                  this.ParentObject.removeChild(this.Line);
         }

/*--------------------------------------------------------------------------------*/

         function _bw2DashboardRasterLine_DragBegin(oEvent) {
                  if (oEvent == null) oEvent = window.event;

                  _oSelectedRasterLine = this;

                  if (_fIE) {
                     window.document.body.style.cursor = 'col-resize';
                  } else {
                     window.document.body.style.cursor = 'e-resize';
                  }
         }

/*--------------------------------------------------------------------------------*/

         function _bw2DashboardRasterLine_DragMove(oEvent) {
                  if ((oEvent == null) || (_oSelectedRasterLine == null)) return;

                  var nP = __bw2EventClientX(oEvent) - 5;
                  var nPMin = 0; 
                  var nPMax = 0; 

                  if (_oSelectedRasterLine.Index < _oSelectedRasterLine.Dashboard.RasterLines.length - 1) nPMax = _oSelectedRasterLine.Dashboard.RasterLines[_oSelectedRasterLine.Index + 1].Line.offsetLeft - _oSelectedRasterLine.Dashboard.MinSize;
                  if (_oSelectedRasterLine.Index > 0) nPMin = _oSelectedRasterLine.Dashboard.RasterLines[_oSelectedRasterLine.Index - 1].Line.offsetLeft + _oSelectedRasterLine.Dashboard.MinSize;
                  if (_oSelectedRasterLine.Index == 0) nPMin = _oSelectedRasterLine.Dashboard.MinSize;
                  if (_oSelectedRasterLine.Index == _oSelectedRasterLine.Dashboard.RasterLines.length - 1) nPMax = _oSelectedRasterLine.Dashboard.offsetWidth - _oSelectedRasterLine.Dashboard.MinSize;;
                  
                  if (nP < nPMin) {
                     nP = nPMin;
                  } else if (nP > nPMax) {
                     nP = nPMax;
                  }

                  _oSelectedRasterLine.Dashboard.ColumnSizes[_oSelectedRasterLine.Index] = (100 / _oSelectedRasterLine.Dashboard.offsetWidth) * nP;
                  _oSelectedRasterLine.style.left = _oSelectedRasterLine.Dashboard.ColumnSizes[_oSelectedRasterLine.Index] + '%';

                  //__bw2Debug(_oSelectedRasterLine.Dashboard.ColumnSizes[_oSelectedRasterLine.Index]);
                  __bw2Unselect();
         }

/*--------------------------------------------------------------------------------*/

         function _bw2DashboardRasterLine_DragEnd(oEvent) {
                  if ((oEvent == null) || (_oSelectedRasterLine == null)) return;

                  /*--- Resize Columns ---*/ 
                  for (var nI = 0; nI < _oSelectedRasterLine.Dashboard.ColumnSizes.length; nI++)	{
                      _oSelectedRasterLine.Dashboard.Columns[nI].Resize();
                  } 

                  /*--- Post Columns-Definition ---*/
                  var strP = '';
                  var strV = '';

                  for (var nI = 0; nI < _oSelectedRasterLine.Dashboard.RasterLines.length; nI++)	{
                      strV = _oSelectedRasterLine.Dashboard.ColumnSizes[nI];
                      
                      if (nI == 0) {
                         strP = strV;
                      } else {
                         strP += ';' + strV;
                      }
                  }
                  
                  //strV = 100 - Number(strV);
                  //strP += ';' + strV;
                  strP += ';*';

                  if (_oSelectedRasterLine.Dashboard.ParentObject.Ajax) __bw2AjaxRequest(_oSelectedRasterLine.id, null, strP, 'onchange');

                  _oSelectedRasterLine = null;
                  window.document.body.style.cursor = 'default';
         }
}

/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/



/*================================================================================*/
/* <Function> Widget Object </Function>
/*================================================================================*/
function __bw2Widget(strWidget, strDashboard, strCaption, eContentType, eViewState, nColumnIndex, nRowIndex, strHeight, fAjax) {
         this.Ajax = fAjax;
         this.ID = strWidget;
         this.ContentType = eContentType;
         this.ColumnIndex = nColumnIndex;
         this.RowIndex = nRowIndex;
         this.ViewState = eViewState;

         this.Dispose = _bw2Dispose; 
         this.Position = _bw2Position; 

         /*--- Create Form & Set Standard-Properties ---*/
         this.Form = document.createElement('DIV');
         this.Form.ParentObject = this;
         this.Form.DashboardID = strDashboard;
         this.Form.id = strWidget;
         this.Form.className = _oSkinCssClasses['WIDGET'];
         this.Form.style.zIndex = 1;
         this.Form.style.display = 'block';
         this.Form.style.overflow = 'hidden';
         this.Form.style.visibility = 'visible';
         this.Form.style.width = '100%';
         this.Form.style.margin = '5';
         this.Form.style.marginBottom = '10';

         //this.Form.GetPos = _bw2WidgetPos; 

         /*--- Event-Handlers ---*/   
         //this.Form.onmousedown = _bw2Widget_OnMouseDown;

         /*--- Create [Header]-Object ---*/
         this.Form.Header = document.createElement('DIV'); this.Form.appendChild(this.Form.Header);
         this.Form.Header.ParentObject = this.Form;
         this.Form.Header.Widget = this;
         this.Form.Header.style.display = 'block';
         this.Form.Header.style.position = 'relative';
         this.Form.Header.style.overflow = 'hidden';
         this.Form.Header.style.width = '100%';

         if (_fIE) {
            this.Form.Header.style.cursor = 'hand';
         } else {
            this.Form.Header.style.cursor = 'pointer';
         }

         /*--- Create IFRAME [Content]-Object ---*/
         if (this.ContentType == 1) {
            //this.Form.Content = document.createElement('<IFRAME SECURITY="restricted">'); this.Form.appendChild(this.Form.Content);
            this.Form.Content = document.createElement('IFRAME'); this.Form.appendChild(this.Form.Content);
            this.Form.Content.frameBorder = '0';
            
            if (_fIE) {
               this.Form.Content.style.width = '100%';
            } else {
               this.Form.Content.style.width = '98%';
            }

            //this.Form.Content.Source = _bw2IFrameSource;
            //this.Form.Content.Refresh = _bw2IFrameOnLoad;

         /*--- Create DIV [Content]-Object ---*/
         } else {
            this.Form.Content = document.createElement('DIV'); this.Form.appendChild(this.Form.Content);
         }

         this.Form.Content.id = this.ID + "_CONTENT"
         this.Form.Content.ParentObject = this.Form;
         this.Form.Content.Widget = this;
         this.Form.Content.className = _oSkinCssClasses['WIDGET_CONTENT'];
         this.Form.Content.style.display = 'block';
         this.Form.Content.style.position = 'relative';
         this.Form.Content.style.height = strHeight;

         this.Form.Content.Visible = function (fVisible) { if (fVisible) this.style.display = 'block'; else this.style.display = 'none'; };

         /*--- Create [Header]-Content ---*/
         var oTA = document.createElement('TABLE'); this.Form.Header.appendChild(oTA);
         var oTB = document.createElement('TBODY'); oTA.appendChild(oTB);
         var oTR = document.createElement('TR'); oTB.appendChild(oTR);
         var oTD = document.createElement('TD'); oTR.appendChild(oTD);
         var nHH = _oSkinImages['WIDGET_BORDER_TOP_LEFT'].Height;

         oTA.style.width = '100%';
         oTA.cellPadding = 0;
         oTA.cellSpacing = 0;

         /*--- Create Form Header Border-Left ---*/
         oTD.style.backgroundImage = "url(" + _oSkinImages['WIDGET_BORDER_TOP_LEFT'].Image + ")";
         oTD.style.height = nHH;
         oTD.style.width = _oSkinImages['WIDGET_BORDER_TOP_LEFT'].Width;
         oTD.innerHTML = '&nbsp;';

         /*--- Create Form Caption ---*/
         oTD = document.createElement('TD'); oTR.appendChild(oTD);
         oTD.ParentObject = this.Form; 
         oTD.Widget = this; 
         oTD.id = strWidget + '_CAPTION';
         oTD.style.backgroundImage = "url(" + _oSkinImages['WIDGET_BORDER_TOP_MIDDLE'].Image + ")";
         oTD.style.height = nHH;
         oTD.className = _oSkinCssClasses['WIDGET_CAPTION'];
         oTD.innerHTML = strCaption;

         oTD.onmousedown = _bw2Widget_OnMouseDown;

         /*--- Create Form Header Clip-Context ---*/
         oTD = document.createElement('TD'); oTR.appendChild(oTD);
         oTD.ParentObject = this.Form; 
         oTD.Widget = this; 
         oTD.id = strWidget + '_CLIP_CONTEXT';
         oTD.style.backgroundImage = "url(" + _oSkinImages['WIDGET_CLIP_CONTEXT'].Image + ")";
         oTD.style.height = nHH;
         oTD.style.width = _oSkinImages['WIDGET_CLIP_CONTEXT'].Width;
         oTD.innerHTML = '&nbsp;';

         oTD.PerformClick = _bw2Widget_ClipContextMenu;
         oTD.onmouseover = function() { this.style.backgroundImage = "url(" + _oSkinImages['WIDGET_CLIP_CONTEXT'].ImageOnOver + ")"; };
         oTD.onmouseout = function() { this.style.backgroundImage = "url(" + _oSkinImages['WIDGET_CLIP_CONTEXT'].Image + ")"; };
         oTD.onmousedown = function() { this.style.backgroundImage = "url(" + _oSkinImages['WIDGET_CLIP_CONTEXT'].ImageOnClick + ")"; };   
         oTD.onmouseup = function() { this.style.backgroundImage = "url(" + _oSkinImages['WIDGET_CLIP_CONTEXT'].Image + ")"; this.PerformClick(); };

         /*--- Create Form Header Clip-Minimize/Maximize ---*/
         oTD = document.createElement('TD'); oTR.appendChild(oTD);
         oTD.ParentObject = this.Form; 
         oTD.Widget = this; 

         if (oTD.Widget.ViewState < 2) {
            oTD.Image = 'WIDGET_CLIP_MAXIMIZE';
            this.Form.Content.style.display = 'none';
         } else {
            oTD.Image = 'WIDGET_CLIP_MINIMIZE';
            this.Form.Content.style.display = 'block';
         }

         oTD.id = strWidget + '_CLIP_MINMAX';
         oTD.style.backgroundImage = "url(" + _oSkinImages[oTD.Image].Image + ")";
         oTD.style.height = nHH;
         oTD.style.width = _oSkinImages[oTD.Image].Width;
         oTD.innerHTML = '&nbsp;';

         oTD.PerformClick = _bw2Widget_ClipMinMax;
         oTD.onmouseover = function() { this.style.backgroundImage = "url(" + _oSkinImages[this.Image].ImageOnOver + ")"; };
         oTD.onmouseout = function() { this.style.backgroundImage = "url(" + _oSkinImages[this.Image].Image + ")"; };
         oTD.onmousedown = function() { this.style.backgroundImage = "url(" + _oSkinImages[this.Image].ImageOnClick + ")"; };
         oTD.onmouseup = function() { this.style.backgroundImage = "url(" + _oSkinImages[this.Image].Image + ")"; this.PerformClick(); };   

         /*--- Create Form Header Clip-Close ---*/
         oTD = document.createElement('TD'); oTR.appendChild(oTD);
         oTD.ParentObject = this.Form; 
         oTD.Widget = this; 
         oTD.id = strWidget + '_CLIP_CLOSE';
         oTD.style.backgroundImage = "url(" + _oSkinImages['WIDGET_CLIP_CLOSE'].Image + ")";
         oTD.style.height = nHH;
         oTD.style.width = _oSkinImages['WIDGET_CLIP_CLOSE'].Width;
         oTD.innerHTML = '&nbsp;';

         oTD.PerformClick = _bw2Widget_ClipClose;
         oTD.onmouseover = function() { this.style.backgroundImage = "url(" + _oSkinImages['WIDGET_CLIP_CLOSE'].ImageOnOver + ")"; };
         oTD.onmouseout = function() { this.style.backgroundImage = "url(" + _oSkinImages['WIDGET_CLIP_CLOSE'].Image + ")"; };
         oTD.onmousedown = function() { this.style.backgroundImage = "url(" + _oSkinImages['WIDGET_CLIP_CLOSE'].ImageOnClick + ")"; };
         oTD.onmouseup = function() { this.style.backgroundImage = "url(" + _oSkinImages['WIDGET_CLIP_CLOSE'].Image + ")"; this.PerformClick(); };   

         /*--- Create Form Header Border-Right ---*/
         oTD = document.createElement('TD'); oTR.appendChild(oTD);
         oTD.style.backgroundImage = "url(" + _oSkinImages['WIDGET_BORDER_TOP_RIGHT'].Image + ")";
         oTD.style.height = nHH;
         oTD.style.width = _oSkinImages['WIDGET_BORDER_TOP_RIGHT'].Width;
         oTD.innerHTML = '&nbsp;';

         /*--- Add on Dashboard ---*/
         try {
             _oDashboards[strDashboard].AddWidget(this);
             //if (this.Ajax) __bw2AjaxRequest(this.Form.Content.id, null, null, 'onload');
         } catch (e) {} 

/*--------------------------------------------------------------------------------*/

         function _bw2Dispose() {

         }

/*--------------------------------------------------------------------------------*/

//         function _bw2IFrameSource(strURL) {
//             try {
//                 this.src = strURL;
//                 setTimeout('__bw2WidgetRefresh("' + this.Widget.ID + '")', 2000); 
//             } catch (e) {} 
//         }

/*--------------------------------------------------------------------------------*/

         function _bw2Position(fNotPost) {
             try {
                 var oObj = this.Form;
                 var nC = 0;
                 var fAP = false;
                 
                 while (oObj.previousSibling != null) {
                       oObj = oObj.previousSibling; 
                       nC++;
                 } 
                 
                 if (this.ColumnIndex != this.Form.parentNode.Index) { this.ColumnIndex = this.Form.parentNode.Index; fAP = true; }
                 if (this.RowIndex != nC) { this.RowIndex = nC; fAP = true; }
                 
                 if (fNotPost == true) return nC;
                 
                 /*--- Ajax-Post [onrepos] ---*/
                 if ((fAP) && (this.Ajax)) {
                    __bw2AjaxRequest(this.ID, null, 'ColumnIndex=' + this.ColumnIndex + '&RowIndex=' + this.RowIndex, 'onrepos', null, null, true);
                 }

                 return nC;
             } catch (e) {} 
         }

/*--------------------------------------------------------------------------------*/

         function _bw2Widget_ClipClose(oEvent) {
                  alert('Close : ' + this.id);
         }

/*--------------------------------------------------------------------------------*/

         function _bw2Widget_ClipContextMenu(oEvent) {
                  alert('Context : ' + this.id);
         }

/*--------------------------------------------------------------------------------*/

         function _bw2Widget_ClipMinMax(oEvent) {
                  if (this.Widget.ViewState == 2) {
                     this.Widget.ViewState = 1;
                     this.Image = 'WIDGET_CLIP_MAXIMIZE';
                     this.ParentObject.Content.Visible(false);
                  } else {
                     this.Widget.ViewState = 2;
                     this.Image = 'WIDGET_CLIP_MINIMIZE';
                     this.ParentObject.Content.Visible(true);
                  }  
                  
                  this.style.backgroundImage = "url(" + _oSkinImages[this.Image].ImageOnOver + ")";
         }

/*--------------------------------------------------------------------------------*/

         function _bw2Widget_OnMouseDown(oEvent) {
                  if (oEvent == null) oEvent = window.event;

                  try {
                      _oWidgetForm = this.ParentObject;

                      with (_oDashboards[_oWidgetForm.DashboardID]) {  
                           /*--Check Widget-Header selection ---*/
                           var nMY = 0;

                           if (oEvent.offsetY) {
                              nMY = oEvent.offsetY;
                           } else if (oEvent.layerY) {
                              nMY = oEvent.layerY;
                           }

                           if (nMY > _oWidgetForm.Header.offsetHeight) return;

                           /*--- Init Widget-Move ---*/
                           var oCol =_oWidgetForm.parentNode;
                           var nOT = _oWidgetForm.offsetTop;
                           var nOL = oCol.offsetLeft + _oWidgetForm.offsetLeft;
                                                     
                           _fCancelSlide = true;
                           _oWidgetForm.OffsetMX = __bw2EventClientX(oEvent) - nOL;
                           _oWidgetForm.OffsetMY = __bw2EventClientY(oEvent) - nOT;

                           if (_oWidgetPlaceHolder == null) {
                              _oWidgetPlaceHolder = document.createElement('DIV');
                              _oWidgetPlaceHolder.id = 'WidgetPlaceHolder';
                              _oWidgetPlaceHolder.className = _oSkinCssClasses['WIDGET_PLACEHOLDER'];
                              _oWidgetPlaceHolder.style.display = 'block';
                              _oWidgetPlaceHolder.style.zIndex = 0;
                              _oWidgetPlaceHolder.style.width = '100%';
                              _oWidgetPlaceHolder.style.margin = 5;
                              _oWidgetPlaceHolder.style.marginBottom = '10';
                           }
                          
                           _oWidgetPlaceHolder.Column = oCol.ParentObject.Index;

                           if (_fIE) {
                              _oWidgetPlaceHolder.style.height = _oWidgetForm.offsetHeight;
                           } else {
                              _oWidgetPlaceHolder.style.height = _oWidgetForm.offsetHeight - 2;
                           }

                           oCol.replaceChild(_oWidgetPlaceHolder, _oWidgetForm);
                          
                           _oWidgetForm.style.position = 'absolute';
                           _oWidgetForm.style.width = _oWidgetPlaceHolder.offsetWidth;
                           _oWidgetForm.style.left = nOL;
                           _oWidgetForm.style.top = nOT;
                           _oWidgetForm.style.zIndex = 4;
                           __bw2ObjectOpacity(_oWidgetForm, 70);

                           Dashboard.appendChild(_oWidgetForm);
                      }  
                  } catch (e) {}
         }
}

/*--------------------------------------------------------------------------------*/

function __bw2WidgetRefresh(strWidgetID) {
         try {
             var oCont = __bw2GetElementById(strWidgetID + "_CONTENT");

             alert(oCont.tagName);
             
             if (oCont.tagName == 'IFRAME') {
                var strT = oCont.contentWindow.document.title;
                alert(strT);
                //__bw2GetElementById(strWidgetID + "_CAPTION").innerHTML = strT;
             }
         } catch (e) {} 
}

/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/