var sliderHeight = "38px";
var sliderLinkHeight = 32;
var padding = '70px';

$(document).ready(function(){
    // Show the slider content
    $('.slider').show();
    
    $('.slider').each(function () {
        var current = $(this);
        current.attr("box_h", current.height());
    });
    
    // Set the initial slider state
    $(".slider").css("height", sliderHeight);
    $(".sliderLink").html('<a href="#" onclick="return sliderAction();">Partner</a>');
    $(".slidingFoot").css("display", 'none');
}); 
 
// Set the initial slider state
var slider_state = "close";

function sliderAction() {
	if (slider_state == "close")
    {
        sliderOpen();
        slider_state = "open";
    }
    else if (slider_state == "open")
    {
        sliderClose();
        slider_state = "close";
    }
    return false;
}

function sliderOpen()
{
    var open_height = $(".slider").attr("box_h") + "px";
    var open_height_with_space = parseInt($(".slider").attr("box_h")) + parseInt(sliderLinkHeight) + "px";
    $(".slider").animate({"height": open_height}, {duration: "slow" });
    //$("#container-content").css("padding-bottom", (parseInt($(".slider").attr("box_h"))+parseInt(sliderLinkHeight)) + "px");
    $("#container-content").animate({"padding-bottom": open_height_with_space}, {duration: "slow" });
    $(".sliderLink").html('<a href="#" onclick="return sliderAction();">Partner</a>');
    $(".slidingHead").slideUp("normal");
    $(".slidingFoot").fadeIn("normal");
    //scroll to bottom;
    $('html, body').animate({scrollTop: $('#container-page').height()}, 800);
}

function sliderClose()
{
    $(".slider").animate({"height": sliderHeight}, {duration: "slow" });
    //$("#container-content").css("padding-bottom", padding);
    $("#container-content").animate({"padding-bottom": padding}, {duration: "slow" });
    $(".sliderLink").html('<a href="#" onclick="return sliderAction();">Partner</a>');
    $(".slidingHead").slideDown("normal");
    $(".slidingFoot").fadeOut("normal");
}
