// JavaScript Document
//var ContentHeight = 50;
var TimeToSlide = 250.0;

var openAccordion = '';

function runAccordion(index)
{
	var ContentHeight=0;
	if(index == 1) {ContentHeight=(2*27);}
	if(index == 2) {ContentHeight=(7*27);}
  var nID = "Accordion" + index + "Content";
  if(openAccordion == nID)
    nID = '';
    
  setTimeout("animate(" 
      + new Date().getTime() + "," + TimeToSlide + ",'" 
      + openAccordion + "','" + nID + "'," + ContentHeight +")", 33);
  
  openAccordion = nID;
}
function animate(lastTick, timeLeft, closingId, openingId , CH)
{  
  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 = CH + 'px';
    
    if(closing != null)
    {
      closing.style.display = 'none';
      closing.style.height = '0px';
    }
    return;
  }
 
  timeLeft -= elapsedTicks;
  var newClosedHeight = 
      Math.round((timeLeft/TimeToSlide) * CH);

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

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


