$(document).ready(function() { 

	//plugins.jquery.com/project/floatobject
	$("#containerNav").makeFloat({x:"current",y:"current", speed:"fast"});
	
	// homepage bullet toggles
	$('.homeBulletTitle').toggle(
		function() { 
			$(this).removeClass("Off").addClass("On");
			$(this).find(".homeBulletText").show();
		},
		function() {
			$(this).removeClass("On").addClass("Off"); 
			$(this).find(".homeBulletText").hide();
		}
	);
	
	// homepage hero rotation
	var intervalHomeHero = setInterval("rotateHomeHero();", 6000);
	rotateHomeHero();

	// allow homepage hero numbers to be clicked
	$("#homeHeroNumbers ul li").click( function() {

		var iClickedIndex = $(this).index();
		var current = ($("#homeHeroImgs ul li.On"));
		var next = $("#homeHeroImgs ul li:eq(" + iClickedIndex + ")")

		next.fadeIn("slow");		
		next.addClass("On");
		current.hide();
		current.removeClass("On")		

		$("#homeHeroNumbers ul li#On").attr("id", "");	
		$(this).attr("id", "On");
		
		// stop rotation
		clearInterval(intervalHomeHero);
	});	
	
	// About Us Page
	$(".keyPoint").mouseover( function() {
		$(".keyPoint").removeClass("On");
		$(this).addClass("On"); 
	});
	$("#keyPoint1").mouseover( function() {
		$(".boxAboutTitle").hide();
		$(".boxAboutText").hide();
		$("#boxAboutTitle1").show();
		$("#boxAboutText1").show();
	});
	$("#keyPoint2").mouseover( function() {
		$(".boxAboutTitle").hide();
		$(".boxAboutText").hide();
		$("#boxAboutTitle2").show();
		$("#boxAboutText2").show();
	});	
	$("#keyPoint3").mouseover( function() {
		$(".boxAboutTitle").hide();
		$(".boxAboutText").hide();
		$("#boxAboutTitle3").show();
		$("#boxAboutText3").show();
	});	
	// trigger mouseover for first item
	$("#keyPoint1").trigger("mouseover");
});	

function rotateHomeHero() {
	var current = ($("#homeHeroImgs ul li.On"));
	var next = current.next();
	if (!next.length) next = $("#homeHeroImgs ul li:first");
	
	next.fadeIn("slow");		
	next.addClass("On");
	current.hide();
	current.removeClass("On")

	var iIndexCurrent = $("#homeHeroImgs ul li").index(current);
	$("#homeHeroNumbers ul li:eq(" + iIndexCurrent + ")").attr("id", "");
	var iIndexNext = $("#homeHeroImgs ul li").index(next);
	$("#homeHeroNumbers ul li:eq(" + iIndexNext + ")").attr("id", "On");	
}	

