﻿/// <reference name="Section.js"/>

var expanded = [];

function growSection(grow, hide, sectionIndex)
{
    if ($('tooltip')) $('tooltip').hide();
    if ($(hide)) $(hide).hide();
    new Effect.Morph(grow, {
      style: 'width: 798px;',
      duration: 0.25
    });
    expanded[sectionIndex] = true;
}

function shrinkSection(shrink, show, sectionIndex)
{
    new Effect.Morph(shrink, {
      style: 'width: 395px;',
      duration: 0.25,
      afterFinish: function() { if ($(show)) $(show).show(); }
    });
    expanded[sectionIndex] = false;
}

function toggleSection(target, sibling, sectionIndex)
{
    if (expanded[sectionIndex])
    {
        shrinkSection(target, sibling, sectionIndex);
    }
    else
    {
        growSection(target, sibling, sectionIndex);
    }
}

if(typeof(Sys) != 'undefined') Sys.Application.notifyScriptLoaded();