
$(function () {
	var kickout = false;
	var next = null;
	var prev = null;
	var noJump = $("#stepNavSrc").attr("noJump");
	var activeStep = $("#stepNavSrc").attr("activeStep");
	if (activeStep.length < 1) {
		window.alert("Active Step not set!");
	}
	
	$("#featureBoxes .featureBox:eq(" + (activeStep-2) + ")").addClass("selected");
	
	$("#stepNav li").each(function () {
		if (kickout) {
			return;
		}
		if (next == "return") {
			next = $(this).find("a").attr("href");
			kickout = true;
			return;
		}
		
		if (noJump) {
			$(this).find("a").attr("href", "#");			
		}
		
		if ($(this).text().indexOf(activeStep) > -1) {
			$(this).addClass("active");
			if (!noJump) {
				next = "return";
			}
			return;
		}
		prev = $(this).find("a").attr("href");
	});
	if (next && next != "return") {
		$("#stepNav .next a").attr("href", next);
	} else {
		$("#stepNav .next").hide();
	}
	if (prev) {
		$("#stepNav .prev a").attr("href", prev);
	} else {
		$("#stepNav .prev a").hide();
	}
});

