function ReadMorePanel(sPanelElement, sButtonElement, sButtonTextElement)
{
    this.PanelId = sPanelElement;
    this.ButtonId = sButtonElement;
    this.ButtonTextId = sButtonTextElement;
    this.isVisible = false;
    
    this.togglePanel = togglePanel;
    this.scrollPage = scrollPage;
}

function togglePanel()
{
    if (false == this.isVisible)
    {
        new Effect.BlindDown(this.PanelId, {duration:2});
        setTimeout("$(" + this.ButtonId + ").removeClassName('casestudybutton');", 2000);
        setTimeout("$(" + this.ButtonId + ").addClassName('minimizebutton');", 2000);
    }
    else
    {
        new Effect.BlindUp(this.PanelId, {duration:2});
        setTimeout("$(" + this.ButtonId + ").removeClassName('minimizebutton');", 2000);
        setTimeout("$(" + this.ButtonId + ").addClassName('casestudybutton');", 2000);
    }
    
    this.isVisible = !this.isVisible;
}

function scrollPage()
{
    var nWindowHeight = window.innerHeight;
    var nWindowOffset = window.scrollY;
    var nPanelHeight = $(this.PanelId).offsetHeight;
    var nButtonPosition = $(this.ButtonId).offsetTop;
    var nButtonHeight = $(this.ButtonId).offsetHeight;

    var nScrollBy = (nButtonHeight + nPanelHeight + (nButtonHeight + nButtonPosition) - (nWindowOffset + nWindowHeight));

    window.scrollBy(0, nScrollBy);

}

var ReadMorePanels = [];

ReadMorePanels[0] = new ReadMorePanel("myFamilyPanel", "myFamilyButton", "myFamilyButtonText");

