// JScript source code

var Container;                          // object of Div whith main content
var Arrow                               // object of span with arrow

var Down_Arrow = "/img/menu_down_arrow.gif"; // Image filename
var Up_Arrow = "/img/menu_up_arrow.gif";     // Image filename
var MarginTop = -35;                    // ... (-35) - this is distane from top of tab
var Height = 1;                       // Container's Height in Minimized condition 
var ContaienersFullHeight;              // Container's Height in Maximized condition 
var ContainersPaddingBottom = 0        // Container's Padding-Bottom  ( in pixels )
var Step = 7;                          // develop steps ( in pixels )
var steps;                              // cantity of steps
var step_counter = 0;                   // counter for Container enlarge steps
var counter = 0;                        // counter for Window Scroll steps
var Delay = 20;                         // develop step delay
var timer = null;                       //

    function getContainersHeight()
    {
        Container = document.getElementById("Slider");
        Arrow = document.getElementById("MenuArrow");
        
        //alert(MarginTop);
        Container.style.display = "block";
        ContaienersFullHeight = Container.offsetHeight + ContainersPaddingBottom;
        Container.style.height = Height+'px';

        changeArrow();
        
    }
    
    function develop()
    {
        steps = Math.ceil( (ContaienersFullHeight - Height) / Step );
        
        if (Container.style.height == Height+'px')
        {
          stopTimer();
          maximize(Step, Delay); 
        }
        else
            {
                stopTimer();
                minimize(Step, Delay);
            }
        
        return false;
    }
    
   
    function maximize(x, delay)
    {
        var y = Container.style.height;
        y = parseInt( y.replace(/px/, "") );
        Container.style.height = (y + x)+'px';
        step_counter++;
        
        if (step_counter == steps)
        {
            stopTimer();
            changeArrow();
        }
        else{
                timer = setTimeout("maximize("+x+", "+delay+")", delay);
            }
    }
    
    function minimize(x, delay)
    {
        var y = Container.style.height;
        y = parseInt( y.replace(/px/, "") );
        Container.style.height = (y - x)+'px';
        step_counter++;
        
        if (step_counter == steps)
        {
            stopTimer();
            changeArrow();
        }
        else{
                timer = setTimeout("minimize("+x+", "+delay+")", delay);
            }
    }
    
    function stopTimer() 
    { 
        if(timer) clearTimeout(timer); timer = null; step_counter = 0;
    }    
    
    function changeArrow() 
    { 
        if (Container.style.height != Height+'px')
        {
            Arrow.src =  Up_Arrow;
        }
        else{
                Arrow.src = Down_Arrow; 
            }
    }
    

