// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

$(document).ready(function() {
	$(".calendar_helper tr").each(function() {
		$(this).find("td:last-child").css("background","none");
	});
	
	if ($("#cartellone img").size()==0) $("#cartellone .claim").show();
	
	var cal_rows = $("#calendar_helper tr").size();
	if (cal_rows == 6) $("#calendar_helper td").height(20);
	
	$("#calendar_helper tr").each(function() {
		$(this).find(".weekend:eq(1)").css("background","none");
	});
	
	Shadowbox.init();
});

$(window).load(function() {
	$("ul.events li").each(function() {
		if ($(this).find("img.event").size()==1) {
			var img = $(this).find("img.event");
			$(this).height(img.height()).css("background","url("+img.attr("src")+") center top no-repeat");
			img.remove();
			$(this).find("article").css({"position":"absolute","left":"30px","bottom":"20px","padding":"0"}).width(900);
		}
	});
	
	if ($("#cartellone img").size()==1) {
		$("#cartellone").height($("#cartellone img").height()).find("img").css("position","absolute").next(".content").fadeIn();
	} else {
		$("#cartellone").addClass("clearfix").find(".content").show();
	}
	
	$("#menubottom > li").mouseenter(function() {
		$(this).find(".sec").fadeIn("fast");
	});
	
	$("#menubottom > li").mouseleave(function() {
		$(this).find(".sec").fadeOut("fast");
	});
	
	$("li.event").live("click",function() {
		location.href = $(this).find("a").attr("href");
	});
	
});
