$(function() {
	$aperto = getCookie("aperto");
	
	$("#FCprodotti").find("ul div").each(function() {
	    if(!(jQuery.browser.msie & (jQuery.browser.version == 6))) {
			$(this).blend(); 

			$(this).hover(function() {
				$(this).find('a').css('color', '#FFFFFF');
			}, function () {
				$(this).find('a').css('color', '#777777');
			});
		} else {
			$(this).hover(function() {
				$(this).find('a').css('color', '#333333');
			}, function () {
				$(this).find('a').css('color', '#777777');
			});
		}
		$(this).click(function() {  
			$aperto = $(this).attr("cod");
			$("#FCprodotti").find("div.prodotti").each(function() {
				//alert($(this).attr("cod")+" "+$aperto);
				if($(this).attr("cod") != $aperto) { 
					$(this).next("ul.voce").hide("slow"); 
					//alert($(this).attr("cod")+" no  "+$aperto);
				} else {
					$(this).next("ul.voce").show("slow");
					//alert($(this).attr("cod")+" si "+$aperto);
				}
			});
			//alert($aperto);
			SetCookie("aperto", $aperto);
			//$(this).next("ul.voce").show();
		});
	});
	
	$("li.prodotti1").each(function() {
		if(!(jQuery.browser.msie & (jQuery.browser.version == 6))) {
			$(this).blend();											
			$(this).hover(function() {
				$(this).find('a').css('color', '#FFFFFF');
			}, function () {
				$(this).find('a').css('color', '#777777');
			});
		} else {
			$(this).hover(function() {
				$(this).find('a').css('color', '#333333');
			}, function () {
				$(this).find('a').css('color', '#777777');
			});
		}
	});
	
	$('.FCslide').hover(function(){
		$(".boxcaption", this).stop().animate({top:'300px'},{queue:false,duration:200});
	}, function() {
    	$(".boxcaption", this).stop().animate({top:'340px'},{queue:false,duration:100});
	});
	
});

$(document).ready(function() {
	$aperto = getCookie("aperto");
	$("#FCprodotti").find("div.prodotti").each(function() {
		if($(this).attr("cod") == $aperto) { 
			$(this).next("ul.voce").show("slow"); 
		}
	});
});
