
var promoDirection = 99; //99=forward, 0=backward
var promoClicked = 0; //bool for when promo arrow clicked
var normalSpeed = 8000; //normal rotate speed
var delaySpeed = 12000; //delay when someone clicks on promo
var promoSpeed = normalSpeed;

function startRotation()
{
	if(PromoIsAuthor == 0)
	{
		window.setTimeout('rotatePromos()',promoSpeed);
	}

}


function rotatePromos()
{

showPromo(promoDirection,'0');
window.setTimeout('rotatePromos()',promoSpeed);
promoClicked = 0;

}



//-------------------------------------------------------
function showPromo(divRef, isClick){
  var tmpPrevLink;

	if(promoClicked == 0 || isClick == 1)
	{

  PrevLink.className = 'PromoLinkOff';
  HidePromos();

  if (divRef == 0){
	
	//set direction
	promoDirection = 0;

    if (CurPromoID>1) {CurPromoID --;}
	else if(CurPromoID == 1)
	{
		//flip from start to end
		CurPromoID = MaxCount;
	}
  }
  else if (divRef == 99){
	
	//set direction
	promoDirection = 99;

    if (CurPromoID<MaxCount) {CurPromoID ++;}
    else if (CurPromoID == MaxCount)
	{
		//start over from 1
		CurPromoID = 1;
	}
  }
  else {
  CurPromoID = divRef
  }
  
  
  if (document.all) { //IS IE 4 or 5 (or 6 beta) 
  eval("document.all.Promo" + PromoArray[CurPromoID] + ".style.display = 'block'"); 
  tmpPrevLink = eval("document.all.pl" + CurPromoID);
  tmpPrevLink.className = 'PromoLinkOn';
  PrevLink = tmpPrevLink;
  } 
  else if (document.layers) { //IS NETSCAPE 4 or below 
  document.layers['Promo' + PromoArray[CurPromoID]].display = 'block'; 
  tmpPrevLink = document.layers['pl' + CurPromoID];
  tmpPrevLink.className = 'PromoLinkOn';
  PrevLink = tmpPrevLink;
  } 
  else if (document.getElementById) { 
  eval("document.getElementById('Promo' + PromoArray[CurPromoID]).style.display = 'block'");
  tmpPrevLink = eval("document.getElementById('pl' + CurPromoID)");
  tmpPrevLink.className = 'PromoLinkOn';
  PrevLink = tmpPrevLink;
  } 

	promoClicked = isClick;
	if(isClick == 1)
	{
		promoSpeed = delaySpeed;

	}
	else
	{
		promoSpeed = normalSpeed;
	}

	}

}

//-------------------------------------------------------
function HidePromos(){
  if (document.all) { //IS IE 4 or 5 (or 6 beta) 
  document.all.Promo1.style.display = 'none'; 
  document.all.Promo2.style.display = 'none'; 
  document.all.Promo3.style.display = 'none'; 
  document.all.Promo4.style.display = 'none'; 
  document.all.Promo5.style.display = 'none'; 
  document.all.Promo6.style.display = 'none'; 
  document.all.Promo7.style.display = 'none'; 
  document.all.Promo8.style.display = 'none'; 
  document.all.Promo9.style.display = 'none'; 
  } 
  else if (document.layers) { //IS NETSCAPE 4 or below 
  document.layers['Promo1'].display = 'none'; 
  document.layers['Promo2'].display = 'none'; 
  document.layers['Promo3'].display = 'none'; 
  document.layers['Promo4'].display = 'none'; 
  document.layers['Promo5'].display = 'none'; 
  document.layers['Promo6'].display = 'none'; 
  document.layers['Promo7'].display = 'none'; 
  document.layers['Promo8'].display = 'none'; 
  document.layers['Promo9'].display = 'none'; 
  } 
  else if (document.getElementById) { 
  document.getElementById('Promo1').style.display = 'none'; 
  document.getElementById('Promo2').style.display = 'none'; 
  document.getElementById('Promo3').style.display = 'none'; 
  document.getElementById('Promo4').style.display = 'none'; 
  document.getElementById('Promo5').style.display = 'none'; 
  document.getElementById('Promo6').style.display = 'none'; 
  document.getElementById('Promo7').style.display = 'none'; 
  document.getElementById('Promo8').style.display = 'none'; 
  document.getElementById('Promo9').style.display = 'none'; 
  } 
}