/**
 * Domenico. M. Maresca
 * domenico.maresca@gmail.com
 */

$(function() {
	$("a.fancybox").fancybox({
		'frameWidth': 640,
		'frameHeight': 480,
		'zoomSpeedIn': 500,
		'zoomSpeedOut': 500
	});
	offers();
	rollovers();
});

function offers(){
	var tot = $("#specialOffers li").length;
	if(tot<=3) return;
	$("#specialOffers li:gt(2)").hide();	
	setInterval(function(){
		$("#specialOffers li:eq(0)").hide("slow", function(){
			$("#specialOffers").append($(this).clone());
			$(this).remove();
		});
		$("#specialOffers li:eq(3)").show("slow");
	},6000);	
}

function rollovers(){
	$('.customBox .box div').hide();
	$('.customBox .box').each(function(){
		$(this).find('img:first').hover(function(){
			$(this).hide();
			$(this).parent().find('div').show();
		},null);
		$(this).find('div:first').hover(null,function(){
			$(this).hide();
			$(this).parent().find('img:first').show();
		});
	});
}
