// SERVICE SOLUTIONS TAB

var ContentHeight = 231;
var TimeToSlide = 250.0;

var openAccordion = '';

function runAccordion(index)
{
  var nID = "Accordion" + index + "Content";
  if(openAccordion == nID)
    nID = '';
   
  setTimeout("animate("
      + new Date().getTime() + "," + TimeToSlide + ",'"
      + openAccordion + "','" + nID + "')", 33);
 
  openAccordion = nID;
}

function animate(lastTick, timeLeft, closingId, openingId)
{ 
  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 + "')", 33);
}

// CONTACT US NOW TAB

var ContentHeights = 70;
var TimeToSlides = 250.0;

var openAccordions = '';

function runAccordions(index)
{
  var nIDs = "Accordion" + index + "Content";
  if(openAccordions == nIDs)
    nIDs = '';
   
  setTimeout("animates("
      + new Date().getTime() + "," + TimeToSlides + ",'"
      + openAccordions + "','" + nIDs + "')", 33);
 
  openAccordions = nIDs;
}

function animates(lastTick, timeLeft, closingsId, openingsId)
{ 
  var curTicks = new Date().getTime();
  var elapsedTickz = curTicks - lastTick;
 
  var openings = (openingsId == '') ?
      null : document.getElementById(openingsId);
  var closings = (closingsId == '') ?
      null : document.getElementById(closingsId);
 
  if(timeLeft <= elapsedTickz)
  {
    if(openings != null)
      openings.style.height = ContentHeights + 'px';
   
    if(closings != null)
    {
      closings.style.display = 'none';
      closings.style.height = '0px';
    }
    return;
  }
 
  timeLeft -= elapsedTickz;
  var newClosedHeights =
      Math.round((timeLeft/TimeToSlides) * ContentHeights);

  if(openings != null)
  {
    if(openings.style.display != 'block')
      openings.style.display = 'block';
    openings.style.height =
        (ContentHeights - newClosedHeights) + 'px';
  }
 
  if(closings != null)
    closings.style.height = newClosedHeights + 'px';

  setTimeout("animates(" + curTicks + "," + timeLeft + ",'"
      + closingsId + "','" + openingsId + "')", 33);
}

