/*================================================================================*/
/*                                                                                */
/*             BW2Technologies.Web.JScript.Framework (Alpha V1.0.0.0)             */
/*                                                                                */
/*                             Web-Framework Ajax-Infos                           */
/*                                                                                */
/*              Copyright © 2006-2010 by BW2Technologies (HP. Lassnig)            */
/*                           mail to : hansi@lassnig.ch                           */
/*                                                                                */
/*================================================================================*/

/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/


/*================================================================================*/
/* <Function> AjaxInfo : Write AjaxInfo-Information to the AjaxInfo-Window </Function>
/*================================================================================*/
function __bw2AjaxInfo(fRun, nRxBytes, nTxBytes) {
         if (__bw2GetElementById('oBW2AjaxInfoWindow')) {
            var oImg = __bw2GetElementById('oBW2AjaxInfoWindow_ANI');
         
            if (fRun) {
               //oImg.style.visibility = 'visible';
               //oImg.start;
               oImg.style.display = 'block';
               //oImg.style.zIndex = 10;
            } else {
               oImg.end;
               //oImg.style.visibility = 'hidden';
               oImg.style.display = 'none';
            }
         }
}

/*================================================================================*/
/* <Function> AjaxInfo : Create a AjaxInfo-Window </Function>
/*================================================================================*/
function __bw2AjaxInfoCreate(strHtmlObjectID, nWidth, nHeight, nLeft, nTop) {
         if (!strHtmlObjectID) strHtmlObjectID = 'oForm';
	     var oObj = __bw2GetElementById(strHtmlObjectID);

	     if (!oObj) return;
         if (!nWidth) nWidth = 110;
         if (!nHeight) nHeight = 30;
         if (!nLeft) nLeft = __bw2WindowWidth() - nWidth - 10;
         if (!nTop) nTop = __bw2WindowHeight() - nHeight - 10;

         /*--- Form-Body ---*/         
         var oDW = document.createElement('DIV');

         oDW.id = 'oBW2AjaxInfoWindow';
         oDW.className = _oSkinCssClasses['FORM_SHADOW'];
         oDW.style.position = 'absolute';
         oDW.style.left = nLeft;
         oDW.style.top = nTop;
         oDW.style.width = nWidth;
         oDW.style.height = nHeight;
         oDW.OffsetX = nLeft;
         oDW.OffsetY = __bw2WindowHeight() - nTop;

         //oDW.style.border = '1px solid black';
         oDW.style.backgroundImage = 'url(images/ajax/Background.png)'
         oDW.style.fontFamily = 'Arial, Tahoma';
         oDW.style.fontSize = '8px';
         oDW.style.fontStyle = 'normal';

         oDW.Type = 'form';
         oDW.Moving = true;
         oDW.Zorder = true;
         
         /*--- Recource - Image ---*/         
         var oImg = document.createElement('IMG');
         oImg.id = 'oBW2AjaxInfoWindow_ANI';
         oImg.src = 'images/ajax/Resource.gif';
         oImg.style.position = 'relative';
         oImg.style.left = 6;
         oImg.style.top = 6;
         oImg.style.display = 'none';
        // oImg.style.visibility = 'hidden';

         oDW.appendChild(oImg);

         /*--- Form-Caption ---*/         
/*
         var oDWC = document.createElement('DIV');

         oDWC.style.position = 'absolute';
         oDWC.style.left = 0;
         oDWC.style.top = 0;
         
         if (_fIE) {
            oDWC.style.cursor = 'hand';
            oDWC.style.width = nWidth - 2;
            oDWC.style.height = 20;
         } else {
            oDWC.style.cursor = 'pointer';
            oDWC.style.width = nWidth - 2;
            oDWC.style.height = 16;
         } 

         oDWC.style.borderBottom = '1px solid black';
         oDWC.style.backgroundColor = '#F0E68C';
         oDWC.style.color = '#555555';
         oDWC.style.paddingLeft = '2px';
         oDWC.style.paddingTop = '2px';
         oDWC.style.fontFamily = 'Arial, Tahoma';
         oDWC.style.fontSize = '11px';
         oDWC.style.fontStyle = 'normal';
         oDWC.innerHTML = 'BW2 Debug-View';

         oDWC.Moving = true;
         oDWC.ParentObject = oDW; 
*/
         /*--- Form-View ---*/         
/*
         var oDWV = document.createElement('DIV');

         oDWV.id = 'oBW2DebugWindowView';
         oDWV.style.position = 'absolute';
         oDWV.style.left = 0;

         if (_fIE) {
            oDWV.style.top = 20;
            oDWV.style.width = nWidth - 2;
            oDWV.style.height = nHeight - 22;
         } else {
            oDWV.style.top = 19;
            oDWV.style.width = nWidth - 6;
            oDWV.style.height = nHeight - 25;
         } 

         oDWV.style.padding = '3px';
         oDWV.style.backgroundColor = '#F4F0A2';
         oDWV.style.fontFamily = 'Arial, Tahoma';
         oDWV.style.fontSize = '11px';
         oDWV.style.fontStyle = 'normal';
         oDWV.style.overflow = 'auto';

         oDWV.Moving = false;
         oDWV.ParentObject = oDW; 
*/
         /*--- Adding Objects ---*/ 
/*
         oDW.appendChild(oDWC);
         oDW.appendChild(oDWV);
*/

         oObj.appendChild(oDW);
         
         if (_fIE) __bw2AddEventListener(window, 'RESIZE', __bw2AjaxInfoPosition, false);

         __bw2AddEventListener(oDW, 'mousedown', __bw2ObjectMove, false);
         
         return oDW;
}

/*================================================================================*/
/* <Function> AjaxInfo : Positioning AjaxInfo-Window by Resize & Scroll </Function>
/*================================================================================*/
function __bw2AjaxInfoPosition() {
         try {
             var oDW = __bw2GetElementById('oBW2AjaxInfoWindow')
             if (!oDW) return;

             with (oDW) {
                  //__bw2Debug('Window With/Height : ' + __bw2WindowWidth() + '/' + __bw2WindowHeight() + ', ' + OffsetX)

                  if (!OffsetX) {
                     style.left = 10;
                  } else {
                     style.left = OffsetX;
                  }
                     
                  if (!OffsetY) {
                     style.top = __bw2WindowHeight() - offsetHeight - 10;
                  } else {
                     if (offsetTop < 0) {
                        OffsetY = __bw2WindowHeight();
                        style.top = 0;
                     //} else if (OffsetY > 20) {
                     //   OffsetY = 20;
                     //   style.top = __bw2WindowHeight() - OffsetY;

                     } else {
                        style.top = __bw2WindowHeight() - OffsetY;
                     }  
                  }
             }
         } catch (e) {
             //alert('__bw2AjaxInfoPosition : ' + e);
         }
}

/*================================================================================*/
/* <Function> AjaxInfo : Show AjaxInfo-Window </Function>
/*================================================================================*/
function __bw2AjaxInfoON() {
         try {
             var oDW = __bw2GetElementById('oBW2AjaxInfoWindow');

             if (!oDW) oDW = __bw2AjaxInfoCreate('oForm');

             with (oDW) {
                  style.display = 'block';
             }
         } catch (e) {
             alert('__bw2AjaxInfoON : ' + e);
         }
}

/*================================================================================*/
/* <Function> AjaxInfo : Hide AjaxInfo-Window </Function>
/*================================================================================*/
function __bw2AjaxInfoOFF() {
         try {
             var oDW = __bw2GetElementById('oBW2AjaxInfoWindow');
             if (!oDW) return;

             with (oDW) {
                  style.display = 'none';
             }
         } catch (e) {
             alert('__bw2AjaxInfoOFF : ' + e);
         }
}

/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/
