$(document).ready(function(){

	// Homepage Callouts...
	
	$("div.callout").hover(function(){
		$(this).addClass("current");
	},function(){
		$(this).removeClass("current");
	});
	
	$("div.callRecipes").click(function(){
		var url = $(this).find("a:first").attr("href");
		window.location = url;
		return(false);
	});
	
	$("div.callInstantWin").click(function(e){
		if ($(this).hasClass("mustLogin")) {
			e.preventDefault();
			$('#loginInstantWin').modal({overlayClose:true});
			return(false);
		} else {
			var url = $(this).find("a:first").attr("href");
			window.location = url;
			return(false);
		}
	});
	
	$("div.callSweeps.mustLogin a").click(function(e){
		if ($(this).attr('id') != 'sandraLeeLink') {
			e.preventDefault();
			$('#loginSweeps').modal({overlayClose:true});
			return(false);
		}
	});
	
	// Rebate Tracker...
	$("#rebateLink").click(function() {
		try {
			pageTracker._trackPageview('/media/RebateForm.pdf');
		} catch(e) { }
	});
	
	// Sandra Lee Lightbox...
	$("#sandraLeeLink").click(function (e) {
		e.preventDefault();
		$('#homepageSandraLee').modal({overlayClose:true});
		return(false);
	});

	
	// Instant-Win AJAX...

	$("#instantWinGame a").click(function(){
		
		var randomNumber = parseInt(Math.random() * 10000);
		
		$.get("play.php", {rand: "" + randomNumber + ""}, function(gamePlayed) {
			$("#instantWinReplace").replaceWith(gamePlayed);
		}, "html");
		
		$("#potatoFlash").show();
		
		return(false);
	
	});


	// Expand Recipes List in Sidebar...
	
	$("#moreEntrees").click(function(){
		$("#sidebarEntrees li.moreLink").hide();
		$("#sidebarEntrees li.more").show();
		return false;
	});
	
	$("#moreSides").click(function(){
		$("#sidebarSides li.moreLink").hide();
		$("#sidebarSides li.more").show();
		return false;
	});
	
	$("div.recipeThumb").hover(function(){
		$(this).addClass("current");
	},function(){
		$(this).removeClass("current");
	});
	
	$("div.recipeThumb").click(function(){
		var url = $(this).find("a:first").attr("href");
		if (url != '#') {
			window.location = url;
			return(false);
		}
	});
	
	
	// Video Lightboxes...
	
	$("#videoLinkBakedFries").click(function (e) {
		e.preventDefault();
		$('#videoBakedFries').modal({overlayClose:true});
		return(false);
	});
	
	$("#videoLinkMashed").click(function (e) {
		e.preventDefault();
		$('#videoMashed').modal({overlayClose:true});
		return(false);
	});
		
	$("#videoLinkSalad").click(function (e) {
		e.preventDefault();
		$('#videoSalad').modal({overlayClose:true});
		return(false);
	});
	
	$("#videoLinkHowToBake").click(function (e) {
		e.preventDefault();
		$('#videoHowToBake').modal({overlayClose:true});
		return(false);
	});
			
	$("#videoLinkPotatoes101").click(function (e) {
		e.preventDefault();
		$('#videoPotatoes101').modal({overlayClose:true});
		return(false);
	});
	
	$("#videoLinkShortcuts").click(function (e) {
		e.preventDefault();
		$('#videoShortcuts').modal({overlayClose:true});
		return(false);
	});

});
