var d=document, imgs = new Array(), zInterval = null, current=0, pause=false;

function so_init()
{

 elRotator = document.getElementById('rotator');
 aImgs = elRotator.getElementsByTagName('div');
 
 for(var i=0; i<aImgs.length; i++) {
    aImgs[i].style.visibility = 'visible';
 }
 
 if(!d.getElementById || !d.createElement)return;


 imgs = d.getElementById('rotator').getElementsByTagName('img');
 for(i=1;i<imgs.length;i++) {
 	imgs[i].xOpacity = 0;
 	setOpacity(imgs[i]);
 }
 imgs[0].style.display = 'block';
 imgs[0].xOpacity = 0.99;
 setOpacity(imgs[0]);

 setTimeout(so_xfade,5000);
}

function so_xfade()
{
 cOpacity = imgs[current].xOpacity;
 nIndex = imgs[current+1]?current+1:0;

 nOpacity = imgs[nIndex].xOpacity;

 cOpacity-=.05;
 nOpacity+=.05;

 imgs[nIndex].style.display = 'block';
 imgs[current].xOpacity = cOpacity;
 imgs[nIndex].xOpacity = nOpacity;

 setOpacity(imgs[current]);
 setOpacity(imgs[nIndex]);


 if(cOpacity<=0)
 {
  imgs[current].style.display = 'none';
  current = nIndex;
  setTimeout(so_xfade,3000);
 }
 else
 {
  setTimeout(so_xfade,50);
 }

}

 function setOpacity(obj)
 {
  if(obj.xOpacity>.99)
  {
   obj.xOpacity = .99;
   return;
  }

  obj.style.opacity = obj.xOpacity;
  obj.style.MozOpacity = obj.xOpacity;
  obj.style.filter = 'alpha(opacity=' + (obj.xOpacity*100) + ')';
 }
 
 
 
 
 
 
 
 
 
 
 topPromos = new Array(), tpCurrent=0, topPromoImages = new Array()
  
 function promoT_init()
 {
 	if( (!d.getElementById) || (!d.createElement) )
 	{
 		return;
 	}

 	elTopPromos = document.getElementById('TopPromos');
 	topPromos = elTopPromos.getElementsByTagName('div');
 	//topPromoImages = elTopPromos.getElementsByTagName('img')

 	
 	// For each promotion div
 	for( var i=0; i<topPromos.length; i++ )
 	{
 		topPromos[i].style.visibility = 'visible';
 		topPromos[i].xOpacity = 0;
 		setOpacity(topPromos[i]);
 	}
 	
 	//topPromoImages[0].style.display = 'block';
 	topPromos[0].xOpacity = 0.99;
 	setOpacity(topPromos[0]);
 	
	setTimeout(promoT_xfade,5000);
 }
 
 
 function promoT_xfade()
 {
 	// What's the next element we're working with?
 	nIndex = (topPromos[tpCurrent+1])? tpCurrent+1 : 0;
 	
 	// Get the current and next elements opacity
 	cOpacity = topPromos[tpCurrent].xOpacity;
 	nOpacity = topPromos[nIndex].xOpacity;
 	
 	// Decrease / Increase the opacities 	
 	cOpacity-=.05;
 	nOpacity+=.05;
 	
 	// Record the opacities
 	//topPromoImages[nIndex].style.display = 'block';
 	topPromos[tpCurrent].xOpacity = cOpacity;
 	topPromos[nIndex].xOpacity = nOpacity;
 	
 	// Set the opacities
 	setOpacity(topPromos[tpCurrent]);
 	setOpacity(topPromos[nIndex]);
 	
 	if( cOpacity<=0 )
 	{
 		//topPromoImages[tpCurrent].style.display = 'block';
 		tpCurrent = nIndex;
 		setTimeout(promoT_xfade,3000);
 	}
 	else
 	{
 		setTimeout(promoT_xfade,50);
 	}
 }
 
 
 
 
  bottomPromos = new Array(), bpCurrent=0;
   
  function promoB_init()
  {
  	if( (!d.getElementById) || (!d.createElement) )
  	{
  		return;
  	}
 
  	elBottomPromos = document.getElementById('BottomPromos');
  	bottomPromos = elBottomPromos.getElementsByTagName('div');
 
  	
  	// For each promotion div
  	for( var i=0; i<bottomPromos.length; i++ )
  	{
  		bottomPromos[i].style.visibility = 'visible';
  		bottomPromos[i].xOpacity = 0;
  		setOpacity(bottomPromos[i]);
  	}
  	
  	bottomPromos[0].xOpacity = 0.99;
  	setOpacity(bottomPromos[0]);
  	
 	setTimeout(promoB_xfade,5000);
  }
  
  
  function promoB_xfade()
  {
  	// What's the next element we're working with?
  	nIndex = (bottomPromos[bpCurrent+1])? bpCurrent+1 : 0;
  	
  	// Get the current and next elements opacity
  	cOpacity = bottomPromos[bpCurrent].xOpacity;
  	nOpacity = bottomPromos[nIndex].xOpacity;
  	
  	// Decrease / Increase the opacities 	
  	cOpacity-=.05;
  	nOpacity+=.05;
  	
  	// Record the opacities
  	bottomPromos[bpCurrent].xOpacity = cOpacity;
  	bottomPromos[nIndex].xOpacity = nOpacity;
  	
  	// Set the opacities
  	setOpacity(bottomPromos[bpCurrent]);
  	setOpacity(bottomPromos[nIndex]);
  	
  	if( cOpacity<=0 )
  	{
  		bpCurrent = nIndex;
  		setTimeout(promoB_xfade,3000);
  	}
  	else
  	{
  		setTimeout(promoB_xfade,50);
  	}
 }