﻿// slidy rollovers helper code...

    var isTxt1Up = false;   // flag to tell if the first box is up or down
    var isTxt2Up = false;   // flag to tell if the second box is up or down
    var isTxt3Up = false;   // flag to tell if the third box is up or down
    var isTxt4Up = false;   // flag to tell if the fourth box is up or down
    
    function MoveBoxUp( boxId )
    {
        switch( boxId )
        {
            case "txt1":
                if( !isTxt1Up )
                {
                    Effect.MoveBy( "txt1", -92, 0 );
                    isTxt1Up = true;
                }
                break;
            case "txt2":
                if( !isTxt2Up )
                {
                    Effect.MoveBy( "txt2", -92, 0 );
                    isTxt2Up = true;
                }
                break;
            case "txt3":
                if( !isTxt3Up )
                {
                    Effect.MoveBy( "txt3", -92, 0 );
                    isTxt3Up = true;
                }
                break;
            case "txt4":
                if( !isTxt4Up )
                {
                    Effect.MoveBy( "txt4", -92, 0 );
                    isTxt4Up = true;
                }
                break;
        }
    }
    
    function MoveBoxDown( boxId )
    {
        switch( boxId )
        {
            case "txt1":
                if( isTxt1Up )
                {
                    var moveAmount = CalcBoxPosition( boxId );
                    Effect.MoveBy( 'txt1', moveAmount, 0 );
                    // delay and reset box in case needed, this allows moveby to finish...
                    setTimeout( "ResetBox( 'txt1' )", 1000 );
                    isTxt1Up = false;
                }
                break;
            case "txt2":
                if( isTxt2Up )
                {
                    var moveAmount = CalcBoxPosition( boxId );
                    Effect.MoveBy( 'txt2', moveAmount, 0 );
                    // delay and reset box in case needed, this allows moveby to finish...
                    setTimeout( "ResetBox( 'txt2' )", 1000 );
                    isTxt2Up = false;
                }
                break;
            case "txt3":
                if( isTxt3Up )
                {
                    var moveAmount = CalcBoxPosition( boxId );
                    Effect.MoveBy( 'txt3', moveAmount, 0 );
                    // delay and reset box in case needed, this allows moveby to finish...
                    setTimeout( "ResetBox( 'txt3' )", 1000 );
                    isTxt3Up = false;
                }
                break;
            case "txt4":
                if( isTxt4Up )
                {
                    var moveAmount = CalcBoxPosition( boxId );
                    Effect.MoveBy( 'txt4', moveAmount, 0 );
                    // delay and reset box in case needed, this allows moveby to finish...
                    setTimeout( "ResetBox( 'txt4' )", 1000 );
                    isTxt4Up = false;
                }
                break;
        }
    }
    
    function CalcBoxPosition( boxId )
    {
        var box = document.getElementById( boxId );
        // alert( box.style.top );
        var moveAmount = 116 - parseInt( box.style.top );
        // calc for error caused by box continuing it's movement after the onmouseout event has been triggered
        return moveAmount;
    }
    
    function ResetBox( boxId )
    {
        var box = document.getElementById( boxId );
        var top = parseInt( box.style.top );
        var moveAmount = 116 - top;
        Effect.MoveBy( boxId, moveAmount, 0 );
    }