/*================================================================================*/
/*                                                                                */
/*             BW2Technologies.Web.JScript.Framework (Alpha V1.0.0.0)             */
/*                                                                                */
/*                             Web-Framework Tools                                */
/*                                                                                */
/*              Copyright © 2006-2010 by BW2Technologies (HP. Lassnig)            */
/*                           mail to : hansi@lassnig.ch                           */
/*                                                                                */
/*================================================================================*/

var _oTimeoutSlide = null;

var _fCancelSlide = false;
var _fObjectSlide = false;

/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/


/*================================================================================*/
/* <Function> Animiere Logo-Texte </Function>
/*================================================================================*/
function __bw2AnimateLogoText() {
         __bw2ObjectBlend('oLogoText1', 0, 100, 1000, '__bw2AnimateLogoText2()');
}

/*--------------------------------------------------------------------------------*/

function __bw2AnimateLogoText2() {
         __bw2ObjectBlend('oLogoText2', 0, 100, 2000, '__bw2AnimateLogoText3()');
}

/*--------------------------------------------------------------------------------*/

function __bw2AnimateLogoText3() {
         __bw2ObjectBlend('oLogoText2', 100, 40, 2000, '__bw2AnimateLogoText4()');
}

/*--------------------------------------------------------------------------------*/

function __bw2AnimateLogoText4() {
         __bw2ObjectBlend('oLogoText3', 0, 100, 2000, '__bw2AnimateLogoText5()');
}

/*--------------------------------------------------------------------------------*/

function __bw2AnimateLogoText5() {
         __bw2ObjectOpacity('oLogoText2', 0);
         __bw2ObjectBlend('oLogoText3', 100, 40, 2000, '__bw2AnimateLogoText6()');
}

/*--------------------------------------------------------------------------------*/

function __bw2AnimateLogoText6() {
         __bw2ObjectBlend('oLogoText4', 0, 100, 2000, '__bw2AnimateLogoText7()');
}

/*--------------------------------------------------------------------------------*/

function __bw2AnimateLogoText7() {
         __bw2ObjectOpacity('oLogoText3', 0);
         __bw2ObjectBlend('oLogoText4', 100, 0, 1200, '__bw2AnimateLogoText8()');
}

/*--------------------------------------------------------------------------------*/

function __bw2AnimateLogoText8() {
         __bw2ObjectBlend('oLogoText1', 100, 0, 1000, '__bw2AnimateLogoText9()');
}

/*--------------------------------------------------------------------------------*/

function __bw2AnimateLogoText9() {
         __bw2Wait(1000);
         __bw2ObjectBlend('oLogoText1', 0, 100, 1000, '__bw2AnimateLogoText2()');
}

/*================================================================================*/
/* <Function> Object Ein-/Aus-Blenden </Function>
/*================================================================================*/
function __bw2FormBlend(oObj, strMode) { 
         oObj = __bw2GetElementById(oObj); 
         if (oObj == null) return;

         /*--- Einblenden ---*/
         if (strMode == 'IN') { 
		    oObj.style.visibility = 'hidden';
            oObj.style.display = 'block';
            oObj.Resize();
            oObj.FormBlendIN = 100;

            __bw2ObjectOpacity(oObj, 0);
            __bw2ObjectBlend(oObj, 0, 100, 400)
            
         /*--- Ausblenden ---*/
         } else if (strMode == 'OUT') { 
            oObj.FormBlendOUT = 0;

            __bw2ObjectBlend(oObj, 100, 0, 400)
         }
}

/*================================================================================*/
/* <Function> Object Ein-/Aus-Blenden </Function>
/*================================================================================*/
function __bw2ObjectBlend(oObj, nOpacStart, nOpacEnd, nDuration, strFunction) { 
         oObj = __bw2GetElementById(oObj);
         if (oObj == null) return;
         
         var nSpeed = Math.round(nDuration / 100);       /* Blend geschwindigkeit */
         var nTimer = 0; 

         if (strFunction != null) {
            oObj.OnBlendValue = nOpacEnd;
            oObj.OnBlendFunction = strFunction;
         }

         /*--- Einblenden ---*/
         if (nOpacStart < nOpacEnd) { 
            for (nI = nOpacStart; nI <= nOpacEnd; nI++) { 
                //__bw2ObjectOpacity(oObj, nI);
                //__bw2Wait(10)
                setTimeout("__bw2ObjectOpacity('" + oObj.id + "', " + nI + ")", (nTimer * nSpeed)); 
                nTimer++; 
            } 
            
         /*--- Ausblenden ---*/
         } else if (nOpacStart > nOpacEnd) { 
            for (nI = nOpacStart; nI >= nOpacEnd; nI--) { 
                //__bw2ObjectOpacity(oObj, nI);
                //__bw2Wait(10)
                setTimeout("__bw2ObjectOpacity('" + oObj.id + "', " + nI + ")", (nTimer * nSpeed)); 
                nTimer++; 
            } 
         } 
} 

/*================================================================================*/
/* <Function> Object Transparenz </Function>
/*================================================================================*/
function __bw2ObjectOpacity(oObj, nOpacity) { 
         oObj = __bw2GetElementById(oObj); 
         if (oObj == null) return;

         try {
             if (oObj.style.opacity != null) {
                oObj.style.opacity = (nOpacity / 100); 
             } else if (oObj.style.MozOpacity != null) {  
                oObj.style.MozOpacity = (nOpacity / 100); 
             } else if (oObj.style.filter != null) {  
                oObj.style.filter = 'alpha(opacity=' + nOpacity + ')'; 
             } else if (oObj.style.KhtmlOpacity != null) {  
                oObj.style.KhtmlOpacity = (nOpacity / 100); 
             }
             
             if (oObj.style.display != 'block') oObj.style.display = 'block';
             if (oObj.style.visibility != 'visible') oObj.style.visibility = 'visible';
         } catch (e) {} 

         if ((oObj.OnBlendValue != null) && (oObj.OnBlendValue > -1)) {
            //if (nOpacity < 4) __bw2Debug('');
         
            if (oObj.OnBlendValue == nOpacity) {
               var strF = oObj.OnBlendFunction;  
               oObj.OnBlendValue = -1;
               oObj.OnBlendFunction = null;
               eval(strF);
            }

         } else if ((oObj.FormBlendIN != null) && (oObj.FormBlendIN > -1)) {
            if (oObj.FormBlendIN == nOpacity) {
               oObj.FormBlendIN = -1;
               __bw2ZOrder(oObj, 'form');
               __bw2SetFocus();
            }
            
         } else if ((oObj.FormBlendOUT != null) && (oObj.FormBlendOUT > -1)) {
            if (oObj.FormBlendOUT == nOpacity) {
               oObj.FormBlendOUT = -1;
               oObj.style.visibility = 'hidden';
               //oObj.style.display = 'none';
               oObj.Close();
            }
         }
}

/*================================================================================*/
/* <Function> Object Silede (In/Out) </Function>
/*================================================================================*/
function __bw2ObjectSlide(nMode, strObj, nStep, nTimeout) {
         try {
             var oObj = __bw2GetElementById(strObj);
             
             if (_fCancelSlide) { oObj.IsSliding = 0; _fObjectSlide = false; _fCancelSlide = false; return; }
             if (_fObjectSlide) return; else _fObjectSlide = true;
             if (oObj.OnOver) { oObj.IsSliding = 0; _fObjectSlide = false; return; }

             if (nMode == 0) {
                __bw2ObjectSlideOut(strObj, nStep, nTimeout);
             } else {
                __bw2ObjectSlideIn(strObj, nStep, nTimeout);
             }
         } catch (e) {}
}

/*--------------------------------------------------------------------------------*/

function __bw2ObjectSlideIn(strObj, nStep, nTimeout) {
         _fObjectSlide = true;

         try {
             var oObj = __bw2GetElementById(strObj);
             var nSize = oObj.Size();

             if (nSize < oObj.MaxSize) {
                oObj.Size(nSize + nStep);
                setTimeout("__bw2ObjectSlideIn('" + strObj  + "', " + nStep + ", " + nTimeout + ")", nTimeout);
             } else {
                oObj.IsSliding = 0;
                _fObjectSlide = false;
             }
         } catch (e) {}
}

/*--------------------------------------------------------------------------------*/

function __bw2ObjectSlideOut(strObj, nStep, nTimeout) {
         _fObjectSlide = true;

         try {
             var oObj = __bw2GetElementById(strObj);
             var nSize = oObj.Size();

             //if (nSize < __bw2Proz(oObj.MaxSize, 60)) { nStep += 1; nTimeout -= 1;}
             //if (nTimeout < 1) nTimeout = 1;

             if (nSize > 0) {
                oObj.Size(nSize - nStep);
                setTimeout("__bw2ObjectSlideOut('" + strObj  + "', " + nStep + ", " + nTimeout + ")", nTimeout);
             } else {
                oObj.IsSliding = 0;
                _fObjectSlide = false;
             }
         } catch (e) {}
}

/*================================================================================*/
/* <Function> Animiere Cursor </Function>
/*================================================================================*/
function __bw2AnimateProgressBar(strProgressBarID, nInterval, nStep) {

    try {
         var oPB = __bw2GetElementById(strProgressBarID); 
         var oPC = __bw2GetElementById(strProgressBarID + '_CURSOR'); 

         if (oPB.Timer == null) oPB.Timer = new Array();
         if (oPB.SlideBack == null) oPB.SlideBack = false;
         if (oPB.Break == null) oPB.Break = 0;
         
         /*--- Start ---*/
         if ((nInterval != null) && (oPB.Break == 0)) {
            var nPos = 0;
            var nStyle = Number(oPB.getAttribute('AnimationStyle'));

            if (nStyle == 0) {    
               if (!oPB.SlideBack) {
                  nPos = oPC.offsetLeft + nStep;
               } else {
                  nPos = oPC.offsetLeft - nStep;
               }

               if (nPos + oPC.offsetWidth >= oPB.offsetWidth) {
                  nPos = oPB.offsetWidth - oPC.offsetWidth;
                  oPB.SlideBack = true;
               } else if (nPos < 0) {
                  nPos = 0;
                  oPB.SlideBack = false;
               } 
            } else {
               nPos = oPC.offsetLeft + nStep;

               if (nPos > oPB.offsetWidth) {
                  nPos = - oPC.offsetWidth;  
               } 
            }
            
            oPC.style.left = nPos;                                     
             
            oPB.Timer[oPB.Timer.length] = setTimeout("__bw2AnimateProgressBar('" + strProgressBarID + "', " + nInterval + ", " + nStep + ");", nInterval);                                                                

         } else if (oPB.Break == 1) {
            oPB.Break = 0;            

         } else {
            oPB.Break = 1; 
 
            if (oPB.Timer != null) {
               for (nI in oPB.Timer) {
                   clearTimeout(oPB.Timer[nI]);     
               }

               oPB.Timer = null;
            }   
         }    
    } catch (e) {}            
}

/*================================================================================*/
/* <Function> Zeichnet transparenten DIV über den gesammten Screen (MODAL-Style) </Function>
/*================================================================================*/
function __bw2ScreenLock() { 
         try {
             if (window.Modal == null) {
                window.Modal = document.createElement('DIV');
                window.Modal.id = 'ScreenLock';
                window.Modal.className = _oSkinCssClasses['SCREEN_LOCK'];
                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.width = "100%";   
             window.Modal.style.height = "100%";  
             window.Modal.style.zIndex = __bw2ZIndex();

             __bw2ObjectOpacity(window.Modal, 10);
         } catch (e) {}
}

/*================================================================================*/
/* <Function> Entfernt transparenten DIV über den gesammten Screen (MODAL-Style) </Function>
/*================================================================================*/
function __bw2ScreenUnlock() { 
         try {
             if (window.Modal != null) {
                __bw2ObjectOpacity(window.Modal, 0);
                window.Modal.style.width = 1;
                window.Modal.style.height = 1;
                window.Modal.style.display = 'none';
             }
         } catch (e) {}
}

/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------*/

