	var rotateSpeed = 5;
	var bannerCount = 3;
	var lastBanner = 1;
	var shouldContinue = true;
	var isPaused = false;

	var labels = Array();
	labels[1] = "1. banner 1";
	labels[2] = "2. banner 2";
	labels[3] = "3. banner 3";

	function startTime(){
		$(document).everyTime(rotateSpeed * 1000, function(){
			if ((lastBanner == bannerCount) && (shouldContinue == false)) {
				switchBanner(1);
				$(document).stopTime();
			}
			else if (lastBanner == bannerCount) {
				lastBanner = 0;
				switchBanner(lastBanner + 1);
			}
			else {
				switchBanner(lastBanner + 1);
			}
		});
	}

	startTime();

	$("#link1").click(function() {
		$('#hero1').fadeIn(1000);
		$(document).stopTime();
		$('#link1').addClass('active');
		$('#link2').removeClass('active');
		$('#link3').removeClass('active');
	
		return false;
	});

	$("#link2").click(function() {
		$('#hero2').fadeIn(1000);
		$('#hero1').fadeOut(1000);
		$(document).stopTime();
		$('#link1').removeClass('active');
		$('#link2').addClass('active');
		$('#link3').removeClass('active');
	
		return false;
	});

	$("#link3").click(function() {
		$('#hero1').fadeOut(1000);
		$('#hero2').fadeOut(1000);
		$('#hero3').fadeIn(1000);
		$(document).stopTime();
		$('#link1').removeClass('active');
		$('#link2').removeClass('active');
		$('#link3').addClass('active');
	
		return false;
	});

	$("#pause").click(function() {
		if(isPaused){
			startTime();
			$('#pause').removeClass('active');
			isPaused = false;
		}else{
			$(document).stopTime();
			$('#pause').addClass('active');	
			isPaused = true;
		}

		return false;
	});

	function switchBanner(whatBanner){
		switch (whatBanner){
			case 1:
				$('#hero1').fadeIn(1000);
				$('#hero2').fadeOut(1000);
				$('#hero3').fadeOut(1000);
				$('#link1').addClass('active');
				$('#link2').removeClass('active');
				$('#link3').removeClass('active');
				break;
		
			case 2:
				$('#hero1').fadeOut(1000);
				$('#hero2').fadeIn(1000);
				$('#hero3').fadeOut(1000);
				$('#link1').removeClass('active');
				$('#link2').addClass('active');
				$('#link3').removeClass('active');
				break;
		
			default:
				$('#hero1').fadeOut(1000);
				$('#hero2').fadeOut(1000);
				$('#hero3').fadeIn(1000);
				$('#link1').removeClass('active');
				$('#link2').removeClass('active');
				$('#link3').addClass('active');
		}
		
		lastBanner = whatBanner;
	}
