//  Home page 
//alert('working');

var promoRotationState = true;
var numPromos = 5;
/*sets the default by ID - not order in the list*/
var promoCount = 1;

swichStyleOn = function(item) {
	$(item).style.border = "1px solid #FFF";
	$(item).style.backgroundColor = "#FF5400";
}
swichStyleOff = function(item) {
	$(item).style.border = "1px solid #E48607";
	$(item).style.backgroundColor = "#FFB913";
}
switchButtonPlay = function(e) {
	e.stop(); 
	$('pause').addClassName('play');
	$('pause').removeClassName('pause');
}
switchButtonPause = function(e) {		
	e.stop(); 	
	$('pause').addClassName('pause');
	$('pause').removeClassName('play');
}
promoRotation = function() {
	if(promoRotationState) {
	
		/*----This switch statement is totally screwed, things have been moved a million times.
		original switch statement is commented at end of file if needed----------------------*/
	
		switch( promoCount ) {
		case 1:	
		
			/*--show "promo 8" first-----*/
		
			/*$('promo1').hide();	
			swichStyleOff('promolink1');*/
			$('promo2').hide();
			swichStyleOff('promolink2');
			$('promo3').hide();
			swichStyleOff('promolink3');
			$('promo6').hide();
			swichStyleOff('promolink6');
			$('promo8').hide();
			swichStyleOff('promolink8');
			$('promo7').show();
			swichStyleOn('promolink7');
			break;
		case 2:	
		
			/*--show "promo 7" first-----*/
		
			/*$('promo1').hide();	
			swichStyleOff('promolink1');*/
			$('promo2').hide();
			swichStyleOff('promolink2');
			$('promo3').hide();
			swichStyleOff('promolink3');
			/*$('promo4').hide();
			swichStyleOff('promolink4');
			$('promo5').hide();
			swichStyleOff('promolink5');*/
			$('promo6').hide();
			swichStyleOff('promolink6');
			$('promo8').show();
			swichStyleOn('promolink8');
			$('promo7').hide();
			swichStyleOff('promolink7');
			break;
		case 3:
		
			/*--show "promo 6" second-----*/
		
			/*$('promo1').hide();	
			swichStyleOff('promolink1');*/
			$('promo2').hide();
			swichStyleOff('promolink2');
			$('promo3').hide();
			swichStyleOff('promolink3');
			/*$('promo4').hide();
			swichStyleOff('promolink4');
			$('promo5').hide();
			swichStyleOff('promolink5');*/
			$('promo6').show();
			swichStyleOn('promolink6');
			$('promo7').hide();
			swichStyleOff('promolink7');
			$('promo8').hide();
			swichStyleOff('promolink8');
			break;
		case 4:
		
			/*--show "promo 3" third-----*/
		
			/*$('promo1').hide();	
			swichStyleOff('promolink1');*/
			$('promo2').hide();
			swichStyleOff('promolink2');
			$('promo3').show();
			swichStyleOn('promolink3');
			/*$('promo4').hide();
			swichStyleOff('promolink4');
			$('promo5').hide();
			swichStyleOff('promolink5');*/
			$('promo6').hide();
			swichStyleOff('promolink6');
			$('promo7').hide();
			swichStyleOff('promolink7');
			$('promo8').hide();
			swichStyleOff('promolink8');
			break;
		case 5:
		
			/*--show "promo 2" fourth-----*/
		
			/*$('promo1').hide();	
			swichStyleOff('promolink1');*/
			$('promo2').show();
			swichStyleOn('promolink2');
			$('promo3').hide();
			swichStyleOff('promolink3');
			/*$('promo4').hide();
			swichStyleOff('promolink4');
			$('promo5').hide();
			swichStyleOff('promolink5');*/
			$('promo6').hide();
			swichStyleOff('promolink6');
			$('promo7').hide();
			swichStyleOff('promolink7');
			$('promo8').hide();
			swichStyleOff('promolink8');
			break;	
			
		}
		(promoCount < numPromos)?promoCount++:promoCount=1;
		setTimeout("promoRotation()",5500);
	}
}

promoPause = function(e) {
	promoRotationState = false;
	switchButtonPlay(e);
	e.stop(); 
}

promoStart = function(e) {
	promoRotationState = true;
	switchButtonPause(e);
	promoRotation();
	e.stop(); 
}

promoClick = function(e,item) {
	promoRotationState = true;
	promoCount = item;
    promoRotation();
	promoPause(e);	
	e.stop(); 
}

Event.observe(window,'load', function() {
	swichStyleOn('promolink7');
	$('promo7').show();
	$('promo8').hide();
	$('promo2').hide();
	$('promo3').hide();
	$('promo6').hide();
    promoRotation();
    
	Event.observe('pause','click',function(e) {
		promoRotationState?promoPause(e):promoStart(e);
		e.stop(); 
	}	
	);
	/*----These event clicks are also trashed, and preserved in comments at the bottom-----*/
	
	Event.observe('promolink2','click',function(e) {
		promoClick(e,5);
    	e.stop(); 
	}	
	);
	Event.observe('promolink3','click',function(e) {
		promoClick(e,4);
    	e.stop(); 
	}	
	);
	
	Event.observe('promolink6','click',function(e) {
		promoClick(e,3);
    	e.stop(); 
	}	
	);
	Event.observe('promolink7','click',function(e) {
		promoClick(e,1);
    	e.stop(); 
	}	
	);
	Event.observe('promolink8','click',function(e) {
		promoClick(e,2);
    	e.stop(); 
	}	
	);
}
);


/*-------The original switch statement for promoRotation();
		case 1:	
			$('promo1').show();	
			swichStyleOn('promolink1');
			$('promo2').hide();
			swichStyleOff('promolink2');
			$('promo3').hide();
			swichStyleOff('promolink3');
			$('promo4').hide();
			swichStyleOff('promolink4');
			$('promo5').hide();
			swichStyleOff('promolink5');
			$('promo6').hide();
			swichStyleOff('promolink6');
			break;
		case 2:
			$('promo1').hide();	
			swichStyleOff('promolink1');
			$('promo2').show();
			swichStyleOn('promolink2');
			$('promo3').hide();
			swichStyleOff('promolink3');
			$('promo4').hide();
			swichStyleOff('promolink4');
			$('promo5').hide();
			swichStyleOff('promolink5');
			$('promo6').hide();
			swichStyleOff('promolink6');
			$('promo7').hide();
			swichStyleOff('promolink7');
			break;
		case 3:
			$('promo1').hide();	
			swichStyleOff('promolink1');
			$('promo2').hide();
			swichStyleOff('promolink2');
			$('promo3').show();
			swichStyleOn('promolink3');
			$('promo4').hide();
			swichStyleOff('promolink4');
			$('promo5').hide();
			swichStyleOff('promolink5');
			$('promo6').hide();
			swichStyleOff('promolink6');
			$('promo7').hide();
			swichStyleOff('promolink7');
			break;
		case 4:
			$('promo1').hide();	
			swichStyleOff('promolink1');
			$('promo2').hide();
			swichStyleOff('promolink2');
			$('promo3').hide();
			swichStyleOff('promolink3');
			$('promo4').show();
			swichStyleOn('promolink4');
			$('promo5').hide();
			swichStyleOff('promolink5');
			$('promo6').hide();
			swichStyleOff('promolink6');
			break;	
		case 5:
			$('promo1').hide();	
			swichStyleOff('promolink1');
			$('promo2').hide();
			swichStyleOff('promolink2');
			$('promo3').hide();
			swichStyleOff('promolink3');
			$('promo4').hide();
			swichStyleOff('promolink4');
			$('promo5').show();
			swichStyleOn('promolink5');
			$('promo6').hide();
			swichStyleOff('promolink6');
			break;
		case 6:
			$('promo1').hide();	
			swichStyleOff('promolink1');
			$('promo2').hide();
			swichStyleOff('promolink2');
			$('promo3').hide();
			swichStyleOff('promolink3');
			$('promo4').hide();
			swichStyleOff('promolink4');
			$('promo5').hide();
			swichStyleOff('promolink5');
			$('promo6').show();
			swichStyleOn('promolink6');
			$('promo7').hide();
			swichStyleOff('promolink7');
			break;
		case 7:
			$('promo1').hide();	
			swichStyleOff('promolink1');
			$('promo2').hide();
			swichStyleOff('promolink2');
			$('promo3').hide();
			swichStyleOff('promolink3');
			$('promo4').hide();
			swichStyleOff('promolink4');
			$('promo5').hide();
			swichStyleOff('promolink5');
			$('promo6').hide();
			swichStyleOff('promolink6');
			$('promo7').show();
			swichStyleOn('promolink7');
			break;
---------------*/
/*--------------The Event Clicks
Event.observe('promolink1','click',function(e) {
		promoClick(e,1);
    	e.stop(); 
	}	
	);
	Event.observe('promolink2','click',function(e) {
		promoClick(e,2);
    	e.stop(); 
	}	
	);
	Event.observe('promolink3','click',function(e) {
		promoClick(e,3);
    	e.stop(); 
	}	
	);
	Event.observe('promolink4','click',function(e) {
		promoClick(e,4);
    	e.stop(); 
	}	
	);
	Event.observe('promolink5','click',function(e) {
		promoClick(e,5);
    	e.stop(); 
	}	
	);
	Event.observe('promolink6','click',function(e) {
		promoClick(e,6);
    	e.stop(); 
	}	
	);
	Event.observe('promolink7','click',function(e) {
		promoClick(e,7);
    	e.stop(); 
	}	
	);

----------------*/


