var playList         = new Array();


function slideIntoView (divName, newHeight)
{
  document.getElementById (divName).style.overflow = "hidden";
  growTo (divName, newHeight);
}

function slideIn (divName, newHeight)
{
  document.getElementById (divName).style.overflow = "hidden";
  growTo (divName, newHeight);
}

function slideOut (divName, newHeight)
{
  shrinkTo (divName, newHeight);
}


function growTo (divName, newHeight)
{
  var height  = newHeight / 3;

  setHeight (divName, height); // 33%
  show(divName);

  height = height + ((newHeight - height) / 3); // 55%
  playListAdd ("setHeight('" + divName + "', '" + height + "px')");

  height = height + ((newHeight - height) / 3); // 70%
  playListAdd ("setHeight('" + divName + "', '" + height + "px')");

  height = height + ((newHeight - height) / 3); // 80%
  playListAdd ("setHeight('" + divName + "', '" + height + "px')");

  height = height + ((newHeight - height) / 2); // 90%
  playListAdd ("setHeight('" + divName + "', '" + height + "px')");

  height = height + ((newHeight - height) / 3); // 95%
  playListAdd ("setHeight('" + divName + "', '" + height + "px')");

  height = height + ((newHeight - height) / 3); // 95%
  playListAdd ("setHeight('" + divName + "', '" + height + "px')");

  playListAdd ("setHeight('" + divName + "', '" + newHeight + "px')");
}

function shrinkTo (divName, newHeight)
{
  var totalHeight = parseInt (document.getElementById (divName).style.height);
  var height      = totalHeight / 3;

  setHeight (divName, totalHeight - height); // 67%
  show(divName);

  height = height + ((totalHeight - height) / 3); // 55%
  playListAdd ("setHeight('" + divName + "', '" + (totalHeight - height) + "px')");

  height = height + ((totalHeight - height) / 3); // 55 + 30%
  playListAdd ("setHeight('" + divName + "', '" + (totalHeight - height) + "px')");

  height = height + ((totalHeight - height) / 3); // 20%
  playListAdd ("setHeight('" + divName + "', '" + (totalHeight - height) + "px')");

  height = height + ((totalHeight - height) / 2); // 10%
  playListAdd ("setHeight('" + divName + "', '" + (totalHeight - height) + "px')");

  height = height + ((totalHeight - height) / 3); // 5%
  playListAdd ("setHeight('" + divName + "', '" + (totalHeight - height) + "px')");

  height = height + ((totalHeight - height) / 3); // 5%
  playListAdd ("setHeight('" + divName + "', '" + (totalHeight - height) + "px')");
}

function play ()
{
  if (playList.length != 0)
  {
    currentSelection = playList.shift();
    //logDebug (currentSelection);
    //alert ("pause before " + currentSelection);
    eval (currentSelection);
    //alert ("after");
  }
  setTimeout ("play()", 66);
}

function playListAdd (item)
{
  playList.push(item);
}

play();


