function changeTab(id) {
	if(id == "current"){
		$(id).className = "selected";
		$('admission').className = "none";
		$('prospect').className = "none";
		Element.hide('admissionContent');
		Element.hide('prospectContent');
		Element.show('currentContent');
	} else if (id == "prospect") {
		$(id).className = "selected";
		$('current').className = "none";
		$('admission').className = "none";
		Element.hide('currentContent');
		Element.hide('admissionContent');
		Element.show('prospectContent');
	} else if (id == "admission") {
		$(id).className = "selected";
		$('current').className = "none";
		$('prospect').className = "none";
		Element.hide('currentContent');
		Element.hide('prospectContent');
		Element.show('admissionContent');
	} 
}

function getRandNumber(current) {
	 var num = (rand(5)-1);
	 if(current == num) {
		  return num + 1;
	 } else {
		  return num;
	 }
}


function rand ( n ) {
	 return ( Math.floor ( Math.random ( ) * n + 1 ) );
}

var rotate = { 
	 startup: function() { 
		  new PeriodicalExecuter(rotate.cycle, 10); // change image every 5 seconds 
		  TopArray = ['football', 'softball', 'baseball', 'basketball', 'track'];
		  var current = 0;
	 }, 
	 cycle: function() { 
		  var next = getRandNumber(current);
		  var current = next;
		  new Effect.Fade('topBanner', {duration: 1, fps: 50,
				afterFinish: function() {
					 $('topBanner').src = '/pes/sa/images/'+TopArray[next]+'_banner.gif';
					  new Effect.Appear('topBanner', {duration: 1,fps: 50,queue:{scope: 'top', position: 'end'}});
				}
		  });
		  new Effect.Fade('sideBanner', {duration: 1, fps: 50,
				afterFinish: function() {
					 $('sideBanner').src = '/pes/sa/images/'+TopArray[next]+'_side_banner.gif';
					  new Effect.Appear('sideBanner', {duration: 1,fps: 50,queue:{scope: 'side', position: 'end'}});
				}
		  });
	 } 
} 
 
window.onload = rotate.startup;
setInterval(flashyIntice, 8000);

function flashyIntice() {
	 new Effect.Shake('intice');
}

