
var img = new Array();
img['enhancement'] = new Array();

var current_winner = 0;
var winner_timeout = false;

function preloadImages () {	
	img['enhancement']['professionals'] = new Image();
	img['enhancement']['professionals'].src = tpl_img_path + "index/performance/professionals.jpg";
	
	img['enhancement']['collegiates'] = new Image();
	img['enhancement']['collegiates'].src = tpl_img_path + "index/performance/collegiates.jpg";
	
	img['enhancement']['juniors'] = new Image();
	img['enhancement']['juniors'].src = tpl_img_path + "index/performance/juniors.jpg";
	
	img['enhancement']['corporate'] = new Image();
	img['enhancement']['corporate'].src = tpl_img_path + "index/performance/corporate.jpg";
	
	img['enhancement']['team'] = new Image();
	img['enhancement']['team'].src = tpl_img_path + "index/performance/team.jpg";
	
	img['enhancement']['personal'] = new Image();
	img['enhancement']['personal'].src = tpl_img_path + "index/performance/personal.jpg";
}

function rotateWinners() {
	var rotation = 5 * 1000;	// rotate every 3 seconds
	
	next_winner = (current_winner == 6) ? 1 : current_winner + 1;
	
	goToWinner(next_winner);
	
	winner_timeout = window.setTimeout("rotateWinners()", rotation);
}

function goToWinnerStop (index) {
	if (winner_timeout) {
		window.clearTimeout(winner_timeout);
	}

	goToWinner(index);
}

function goToWinner (index) {
	document.getElementById('winners_headline_div').innerHTML = document.getElementById('winners_headline_' + index).value;
	document.getElementById('winners_cpy_div').innerHTML = document.getElementById('winners_cpy_' + index).value;
	document.getElementById('winners_bg_img').src = winners_img_path + document.getElementById('winners_img_' + index).value;

	lnk = document.getElementsByName('winners_slogan_lnk');
	for (i = 0; i < lnk.length; i ++) {
		lnk[i].className = "winners_slogan_out_lnk";
	}
	
	document.getElementById('winners_slogan_' + index + '_lnk').className = "winners_slogan_over_lnk";

	current_winner = index;
}

function loadTab (section, tab) {
	var professionals = document.getElementById('professionals_lnk');
	var collegiates = document.getElementById('collegiates_lnk');
	var juniors = document.getElementById('juniors_lnk');
	var corporate = document.getElementById('corporate_lnk');
	var team = document.getElementById('team_lnk');
	var personal = document.getElementById('personal_lnk');

	var bg_img = document.getElementById(section + '_bg_img');
	
	bg_img.src = img['enhancement'][tab].src;
	bg_img.useMap = "#" + tab + "_map";
	
	switch (tab) {
		case 'professionals':
			professionals.style.top = '55px';
			collegiates.style.top = '252px';
			juniors.style.top = '275px';
			break;
		case 'collegiates':
			professionals.style.top = '55px';
			collegiates.style.top = '79px';
			juniors.style.top = '275px';
			break;
		case 'juniors':
			professionals.style.top = '55px';
			collegiates.style.top = '79px';
			juniors.style.top = '105px';
			break;
		case 'corporate':
			corporate.style.top = '55px';
			team.style.top = '252px';
			personal.style.top = '275px';
			break;
		case 'team':
			corporate.style.top = '55px';
			team.style.top = '79px';
			personal.style.top = '275px';
			break;
		case 'personal':
			corporate.style.top = '55px';
			team.style.top = '79px';
			personal.style.top = '105px';
			break;
	}
}
