/*================================================================================*/
/*                                                                                */
/*             BW2Technologies.Web.JScript.Framework (Alpha V1.0.0.0)             */
/*                                                                                */
/*                                 Web-Frames                                     */
/*                                                                                */
/*              Copyright © 2006-2010 by BW2Technologies (HP. Lassnig)            */
/*                           mail to : hansi@lassnig.ch                           */
/*                                                                                */
/*================================================================================*/

var _oContainers = new Array();

/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/


/*================================================================================*/
/* <Function> Frame-Container [Open/Close ] </Function>
/*================================================================================*/
function __bw2Container(strContainer, strSelectedFrame, fAjax) {
         this.Ajax = fAjax;
         this.ID = strContainer;
         this.SelectedID = strSelectedFrame;
         this.Selected = __bw2GetElementById(strSelectedFrame);
         this.Compact = __bw2GetElementById(strContainer + '_CMP');
         this.Expand = __bw2GetElementById(strContainer + '_EXP');
         this.State = __bw2GetElementById(strContainer + '_VST');
}

/*================================================================================*/
/* <Function> Frame-Container [Open/Close ] </Function>
/*================================================================================*/
function __bw2ContainerOpenClose(oEvent, strContainer, strViewState, strSelectedTab) {
         if (strContainer == null) return;
         if (strViewState == null) return;

//         try {
             with (_oContainers[strContainer]) {
                  var oCont = __bw2GetElementById(strContainer + '_Content');
                  var strVS;
                  var fLD = ((oCont) && (oCont.childNodes) && (oCont.childNodes.length == 0));

                  if (Selected == null) Selected = __bw2GetElementById(SelectedID);
                  if (Compact == null) Compact = __bw2GetElementById(strContainer + '_CMP');
                  if (Expand == null) Expand = __bw2GetElementById(strContainer + '_EXP');
                  if (State == null) State = __bw2GetElementById(strContainer + '_VST');

                  /*--- Compact ---*/  
                  if (strViewState == 'close') {
                     strVS = '1'
                     Compact.style.display = 'block';
                     Expand.style.display = 'none';
                     __bw2ResizeEventReinit();

                  /*--- Expand ---*/  
                  } else if (strViewState == 'open') {
                     strVS = '2'
                     
                     /*--- Load-Dynamic Content ---*/ 
                     if (fLD) {
                        if (oCont) oCont.innerHTML = 'Loading...';
                        __bw2Loading(true);
                        __bw2AjaxObjOnEvent(oEvent, strContainer, 'onclick', strVS);
                     } else if ((strSelectedTab) && (strSelectedTab != SelectedID)) {
                        __bw2ContainerTabSel(oEvent, strContainer, strSelectedTab);
                     }
                     
                     Compact.style.display = 'none';
                     Expand.style.display = 'block';
                     __bw2ResizeEventReinit();
                  }

                  State.value = strVS;
                  if ((Ajax) && (!fLD)) __bw2AjaxObjOnEvent(oEvent, strContainer, 'onclick', strVS);
             }
//         } catch (e) {
//             this.error = new __bw2FrameworkError(e.name, e.description, e.number);
//             alert('2. __bw2ContainerOpenClose : ' + this.error)
//         }
}

/*================================================================================*/
/* <Function> Frame-Container [Tab-Selection] </Function>
/*================================================================================*/
function __bw2ContainerTabSel(oEvent, strContainer, strSelectedTab) {
         if (!strContainer) return;
         if (!strSelectedTab) return;

         try {
             with (_oContainers[strContainer]) {  
                  if (Ajax) {
                     var oSel = __bw2GetElementById(strSelectedTab); 

                     oSel.style.display = 'block';
                     oSel.style.visibility = 'visible';

                     if (Selected == null) Selected = __bw2GetElementById(SelectedID);
                     
                     if ((Selected) && (Selected != oSel)) { 
                        SelectedID = strSelectedTab;
                        Selected.style.display = 'none';
                        Selected = oSel;
                        
                        __bw2AjaxRequest(strContainer, strSelectedTab, strSelectedTab, 'ontabselection', null);
                     }
                     
                  } else {
                     __doPostBack(strContainer, strSelectedTab);
                  }
             }
         } catch (e) {
         }
}

/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/


