$(function(){
	
	/* Nav */
	$("li.item").hover(
		function () { $(this).addClass("itemon"); },
		function () { $(this).removeClass("itemon"); }
	);
	
	/* Social Sites */
	$("ul.socialsites a").fadeTo(0, .75).hover(
		function() {
			$(this).fadeTo("fast", 1);
		},
		function() {
			$(this).fadeTo("fast", .75);
		}
	);
	
	/* Search */
	$("div.searchSubmit a:first span:first").hide();
	$("div.searchSubmit a:first").hover(
		function(){$(this).find("span:first").fadeIn();},
		function(){$(this).find("span:first").fadeOut();}
	).click(function(){$("form#searchForm").submit()});

	/* Frontpage Email Signup */
	$("div.email-signup a").click(function(e){
		e.preventDefault();
		$(this).parent().find(".email-form").slideToggle();
	}).hover(
		function(){
			$(this).find("span:first").fadeIn();
		},
		function(){
			$(this).find("span:first").fadeOut();
		}
	).find("span:first").hide();

});

function countdownToRedirect(seconds,location,container) {
	if (seconds == 0) window.location = location;
	$(container).html(seconds);
	setTimeout(function(){
		if ((seconds - 1) >= 0) countdownToRedirect(seconds - 1, location, container);
	}, 1000);
}