function externalLinks() {	
	$("a[rel='external']").attr("target","_blank");
}

var promoNo = 1;
function switchPromo() {
	promoNo++;
	if (promoNo==4) { promoNo = 1; }
	$("ul#promo>li").removeClass("over");

	$("li#pr"+promoNo).addClass("over");
	$("li#pr"+promoNo).find("a.foto").hide();
	$("li#pr"+promoNo).find("a.foto").fadeIn("slow");

	promoTime = setTimeout('switchPromo()', 3000);
}

var promoTime;

window.onload = function() {
    externalLinks();      

    jQuery(function($) {     
        $("div.program").find("ul>li").hover(function() { $(this).addClass("over"); },function() { $(this).removeClass("over"); });
        $("div.program").find("ul").find("ul>li").unbind("hover");
		
		promoTime = setTimeout('switchPromo()', 4000);

		$("ul#promo>li").click(function() {
			window.location.href = $(this).find("a").attr('href');
		});

		$("ul#promo>li").hover(function() {
			$("ul#promo>li").removeClass("over");  

			$(this).addClass("over"); 
			$(this).find("a.foto").hide();
			$(this).find("a.foto").fadeIn("slow");

			clearTimeout(promoTime);
		}, function() { });

		$(".star").rating({
			callback: 
				function(value, link){
					alert(value);
				}
		});

		$(".soutezTip input").click(function() {
			$(".soutezTip tr").removeClass("active");
			$(".soutezTip input").each(function(index) {
				if ($(this).attr("checked")) {
				    $(this).parent().parent().addClass("active");
				}
			});	
		});

    });  
    
}
