var curX = 1;

function animateLoop() {
	// HIDE
	$(".hh-item-on").removeClass("hh-item-on").addClass("hh-item-off");
	$(".hh-cont-on").hide().removeClass("hh-cont-on").addClass("hh-cont-off");
	$("#bg-home-hero div:visible").fadeOut();
	
	// INCREMENT
	curX = (curX + 1 > 4 ? 1 : curX + 1);
	
	// SHOW
	$("#hh-item-" + curX).removeClass("hh-item-off").addClass("hh-item-on");		
	$("#hh-cont-" + curX).fadeIn().removeClass("hh-cont-off").addClass("hh-cont-on");
	$("#bg-home-hero-" + curX).fadeIn();
}

$(document).ready(function() {
    theDefaultArrow = $(".hh-item-on");
    $("#bg-home-hero-2, #bg-home-hero-3, #bg-home-hero-4").hide();

    $(".nav-home-hero-item").hover(function() {
        theIDNumber = $(this).attr("id").substring($(this).attr("id").length - 1);

        curX = parseInt(theIDNumber);

        // HIDE
        $(".hh-item-on").removeClass("hh-item-on").addClass("hh-item-off");
        $(".hh-cont-on").hide().removeClass("hh-cont-on").addClass("hh-cont-off");
        $("#bg-home-hero div:visible").hide();

        // SHOW
        $(this).removeClass("hh-item-off").addClass("hh-item-on");
        $("#hh-cont-" + theIDNumber).show().removeClass("hh-cont-off").addClass("hh-cont-on");
        $("#bg-home-hero-" + theIDNumber).show();
    }, function() {
        // NO MOUSEOUT FUNCTION
    });

    setInterval("animateLoop()", 8000);
});