var ContentHeight = 300;
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);
}

function accordian_cs(id, current, nextDiv, n) {
    for (i = 1; i <= n; i++) {
        if (i == current) {
            jQuery('#' + id + i).next('div.' + nextDiv).slideDown('slow');
            jQuery('#' + id + i).attr('class', 'accHeadOn_cs');
            tempSrc = jQuery('#' + id + i).find('img').attr('src');
            tempSrc = tempSrc.replace("Off", "On");
            jQuery('#' + id + i).find('img').attr("src", tempSrc);
        } else {

            jQuery('#' + id + i).next('div.' + nextDiv).slideUp('slow');
            if (current == 2) {
                jQuery('#' + id + i).attr('class', 'accHead1Off_cs');
				document.getElementById("t2").className = "accCont_cs";
				tempSrc = jQuery('#' + id + i).find('img').attr('src');
            	tempSrc = tempSrc.replace("Off", "On");
            	jQuery('#' + id + i).find('img').attr("src", tempSrc);
				//document.getElementById("t3").className = "accCont_cs";
            } else {
                jQuery('#' + id + i).attr('class', 'accHead2Off_cs');
            }
			if (current == 3) {
                jQuery('#' + id + i).attr('class', 'accHead2Off_cs');
				document.getElementById("t3").className = "accCont_cs";
				tempSrc = jQuery('#' + id + i).find('img').attr('src');
            	tempSrc = tempSrc.replace("Off", "On");
           		jQuery('#' + id + i).find('img').attr("src", tempSrc);
				//document.getElementById("t3").className = "accCont_cs";
            } else {
                jQuery('#' + id + i).attr('class', 'accHead3Off_cs');
            }
			if (current == 4) {
                jQuery('#' + id + i).attr('class', 'accHead3Off_cs');
				document.getElementById("t4").className = "accCont_cs";
				tempSrc = jQuery('#' + id + i).find('img').attr('src');
           		tempSrc = tempSrc.replace("Off", "On");
           		jQuery('#' + id + i).find('img').attr("src", tempSrc);
				//document.getElementById("t3").className = "accCont_cs";
            } else {
                jQuery('#' + id + i).attr('class', 'accHead4Off_cs');
            }
            tempSrc = jQuery('#' + id + i).find('img').attr('src');
            tempSrc = tempSrc.replace("On", "Off");
            jQuery('#' + id + i).find('img').attr("src", tempSrc);
        }
    }
}

function accordian_cs2(id, current, nextDiv, n) {
    for (i = 1; i <= n; i++) {
        if (i == current) {
            jQuery('#' + id + i).next('div.' + nextDiv).slideDown('slow');
            jQuery('#' + id + i).attr('class', 'accHeadOn_cs2');
            tempSrc = jQuery('#' + id + i).find('img').attr('src');
            tempSrc = tempSrc.replace("Off", "On");
            jQuery('#' + id + i).find('img').attr("src", tempSrc);
        } else {

            jQuery('#' + id + i).next('div.' + nextDiv).slideUp('slow');
            if (current == 2) {
                jQuery('#' + id + i).attr('class', 'accHead1Off_cs2');
				document.getElementById("t2").className = "accCont_cs2";
				tempSrc = jQuery('#' + id + i).find('img').attr('src');
            	tempSrc = tempSrc.replace("Off", "On");
            	jQuery('#' + id + i).find('img').attr("src", tempSrc);
				//document.getElementById("t3").className = "accCont_cs2";
            } else {
                jQuery('#' + id + i).attr('class', 'accHead2Off_cs2');
            }
			if (current == 3) {
                jQuery('#' + id + i).attr('class', 'accHead2Off_cs2');
				document.getElementById("t3").className = "accCont_cs2";
				tempSrc = jQuery('#' + id + i).find('img').attr('src');
            	tempSrc = tempSrc.replace("Off", "On");
           		jQuery('#' + id + i).find('img').attr("src", tempSrc);
				//document.getElementById("t3").className = "accCont_cs2";
            } else {
                jQuery('#' + id + i).attr('class', 'accHead3Off_cs2');
            }
			if (current == 4) {
                jQuery('#' + id + i).attr('class', 'accHead3Off_cs2');
				document.getElementById("t4").className = "accCont_cs2";
				tempSrc = jQuery('#' + id + i).find('img').attr('src');
           		tempSrc = tempSrc.replace("Off", "On");
           		jQuery('#' + id + i).find('img').attr("src", tempSrc);
				//document.getElementById("t3").className = "accCont_cs2";
            } else {
                jQuery('#' + id + i).attr('class', 'accHead4Off_cs2');
            }
            tempSrc = jQuery('#' + id + i).find('img').attr('src');
            tempSrc = tempSrc.replace("On", "Off");
            jQuery('#' + id + i).find('img').attr("src", tempSrc);
        }
    }
}

function accordian_cs3(id, current, nextDiv, n) {
    for (i = 1; i <= n; i++) {
        if (i == current) {
            jQuery('#' + id + i).next('div.' + nextDiv).slideDown('slow');
            jQuery('#' + id + i).attr('class', 'accHeadOn_cs3');
            tempSrc = jQuery('#' + id + i).find('img').attr('src');
            tempSrc = tempSrc.replace("Off", "On");
            jQuery('#' + id + i).find('img').attr("src", tempSrc);
        } else {

            jQuery('#' + id + i).next('div.' + nextDiv).slideUp('slow');
            if (current == 2) {
                jQuery('#' + id + i).attr('class', 'accHead1Off_cs3');
				document.getElementById("t2").className = "accCont_cs3";
				tempSrc = jQuery('#' + id + i).find('img').attr('src');
            	tempSrc = tempSrc.replace("Off", "On");
            	jQuery('#' + id + i).find('img').attr("src", tempSrc);
				//document.getElementById("t3").className = "accCont_cs3";
            } else {
                jQuery('#' + id + i).attr('class', 'accHead2Off_cs3');
            }
			if (current == 3) {
                jQuery('#' + id + i).attr('class', 'accHead2Off_cs3');
				document.getElementById("t3").className = "accCont_cs3";
				tempSrc = jQuery('#' + id + i).find('img').attr('src');
            	tempSrc = tempSrc.replace("Off", "On");
           		jQuery('#' + id + i).find('img').attr("src", tempSrc);
				//document.getElementById("t3").className = "accCont_cs3";
            } else {
                jQuery('#' + id + i).attr('class', 'accHead3Off_cs3');
            }
			if (current == 4) {
                jQuery('#' + id + i).attr('class', 'accHead3Off_cs3');
				document.getElementById("t4").className = "accCont_cs3";
				tempSrc = jQuery('#' + id + i).find('img').attr('src');
           		tempSrc = tempSrc.replace("Off", "On");
           		jQuery('#' + id + i).find('img').attr("src", tempSrc);
				//document.getElementById("t3").className = "accCont_cs3";
            } else {
                jQuery('#' + id + i).attr('class', 'accHead4Off_cs3');
            }
            tempSrc = jQuery('#' + id + i).find('img').attr('src');
            tempSrc = tempSrc.replace("On", "Off");
            jQuery('#' + id + i).find('img').attr("src", tempSrc);
        }
    }
}


