
var TimeToSlide = 250.0;

var openAccordion = '';
var openArrordion = '';

function runAccordion(index)
{
  var nID = "Acc" + index + "Content";
  var contentHeight = 200;
  if(openAccordion == nID)
    nID = '';
  var ContentHeight = 200;
  setTimeout("animate(" + new Date().getTime() + "," + TimeToSlide + ",'"
      + openAccordion + "','" + nID + "','" + contentHeight + "')", 33);
 
  openAccordion = nID;
}

function runArrordion(index)
{
  var nID = "Arr" + index + "Content";
  var contentHeight = 340;
  if(openArrordion == nID)
    nID = '';
   
  setTimeout("animate(" + new Date().getTime() + "," + TimeToSlide + ",'"
      + openArrordion + "','" + nID + "','" + contentHeight + "')", 33);
 
  openArrordion = nID;
}

function animate(lastTick, timeLeft, closingId, openingId, contentHeight)
{  
  var curTick = new Date().getTime();
  var elapsedTicks = curTick - lastTick;
 
  var opening = (openingId == '') ? null : document.getElementById(openingId);
  var closing = (closingId == '') ? null : document.getElementById(closingId);
 
  if(timeLeft <= elapsedTicks)
  {
    if(opening != null)
      opening.style.height = contentHeight + 'px';
   
    if(closing != null)
    {
      closing.style.display = 'none';
      closing.style.height = '0px';
    }
    return;
  }
 
  timeLeft -= elapsedTicks;
  var newClosedHeight = Math.round((timeLeft/TimeToSlide) * contentHeight);

  if(opening != null)
  {
    if(opening.style.display != 'block')
      opening.style.display = 'block';
    opening.style.height = (contentHeight - newClosedHeight) + 'px';
  }
 
  if(closing != null)
    closing.style.height = newClosedHeight + 'px';

  setTimeout("animate(" + curTick + "," + timeLeft + ",'"
      + closingId + "','" + openingId + "','" + contentHeight + "')", 33);
}
