$(function() {
	hero.init();
	recipes.init();
	//meal_planner.init();

	//COMMENT THE FOLLOWING LINE WHEN IN A PRODUCTION ENVIRONMENT
	//spotlight.load_image("images/fpo/Chicken_Parma.jpg");
});

var spotlight = {
    old_img: null,
    load_image: function(new_img) {
        spotlight.old_img = $("#cntr_spotlight_swap_top").css("background-image");

        $("#cntr_spotlight_swap_bottom").css("background-image", spotlight.old_img).show().fadeOut();
        $("#cntr_spotlight_swap_top").css("background-image", "url('" + new_img + "')").hide().fadeIn();
        $("#cntr_spotlight_swap_bottom, #cntr_spotlight_swap_top").css("background-repeat", "no-repeat");

       
    }
}

var recipes = {
	loc: null,
	init: function() {
		$('#cntr_featured_recipes').cycle({
			fx: 'scrollHorz',
			timeout: 0,
			next: '#lnk_recipes_next',
			prev: '#lnk_recipes_prev',
			easing: 'easeInOutBack',
			after: recipes.update_link
		});
	},
	update_link: function() {
		spotlight.loc = $("#cntr_featured_recipes div:visible a").attr("href");

		$("#cntr_featured_recipes_link a").attr("href",spotlight.loc);
	}
}

//var meal_planner = {
//	init: function() {
//		$("#cntr_meal_planner .right li input").click(function() {
//			if(!($(this).is(":checked")))
//				$(this).attr("checked", false);
//			else
//				if($("#cntr_meal_planner .right li input:checked").length <= 2)
//					$(this).attr("checked", true);
//				else
//					$(this).attr("checked", false);
//		});
//	}
//}

var hero = {
    init: function() {
  
    }
}

function setFeaturedImage(s,u) {
    spotlight.load_image(s);
} 

$.fn.cycle.defaults.speed   = 900;
$.fn.cycle.defaults.timeout = 6000;
