var t;
var currentStep = 1;

$(document).ready(function(){
	step1Show();
});

function step1Show() {
	currentStep = 1;
	clearTimeout(t);
	if (!$(".point1").hasClass("active")) {
		$(".point1").addClass("active");
	}
	if ($(".point2").hasClass("active")) {
		$(".point2").removeClass("active");
	}
	if ($(".point3").hasClass("active")) {
		$(".point3").removeClass("active");
	}
	
	$(".step2").css("display", "none");
	$(".step3").css("display", "none");

	$(".step1").fadeIn(1000);
	t = setTimeout(step1Hide, 5000);
}
function step1Hide() {
	clearTimeout(t);
	$(".step1").fadeOut(500);
	t = setTimeout(step2Show, 500);
}
function step2Show() {
	currentStep = 2;
	clearTimeout(t);
	if ($(".point1").hasClass("active")) {
		$(".point1").removeClass("active");
	}
	if (!$(".point2").hasClass("active")) {
		$(".point2").addClass("active");
	}
	if ($(".point3").hasClass("active")) {
		$(".point3").removeClass("active");
	}
	
	$(".step1").css("display", "none");
	$(".step3").css("display", "none");
	
	$(".step2").fadeIn(1000);
	t = setTimeout(step2Hide, 5000);
}
function step2Hide() {
	clearTimeout(t);
    $(".step2").fadeOut(500);
 	t = setTimeout(step3Show, 500);
}
function step3Show() {
	currentStep = 3;
	clearTimeout(t);
	if ($(".point1").hasClass("active")) {
		$(".point1").removeClass("active");
	}
	if ($(".point2").hasClass("active")) {
		$(".point2").removeClass("active");
	}
	if (!$(".point3").hasClass("active")) {
		$(".point3").addClass("active");
	}
	
	$(".step1").css("display", "none");
	$(".step2").css("display", "none");
	
	$(".step3").fadeIn(1000);
	t = setTimeout(step3Hide, 5000);
}
function step3Hide() {
	clearTimeout(t);
    $(".step3").fadeOut(500);
 	t = setTimeout(step1Show, 500);
}

function moveBack() {
	switch(currentStep) {
		case 1:
			step3Show();
			break;
		case 2:
			step1Show();
			break;
		case 3:
			step2Show();
			break;
	}
}
function moveForward() {
	switch(currentStep) {
		case 1:
			step2Show();
			break;
		case 2:
			step3Show();
			break;
		case 3:
			step1Show();
			break;
	}
}
function pause () {
  clearTimeout(t);
}
