
var now = new Date();
var curr_year = now.getFullYear();
var curr_month = now.getMonth();

curr_month++;

$(function() {
		   
	function toggle_arrow(img) {
		if($(img).attr("src") == "/images/arrow_up.png") {
			$(img).attr("src","/images/arrow_down.png");
		} else {
			$(img).attr("src","/images/arrow_up.png");
		}
	}
	// Main Menu animation
	$("[id^=menu_item_]").hover(function() {
		$(this).animate({ color: "ecologo" }, 400);
	}, function () {
		$(this).animate({ color: "ecomenu" }, 400);
	});

	// Side Menu animation
	$("[id^=smenu_item_]").hover(function() {
		$(this).animate({ color: "ecomenu" }, 400);
	}, function () {
		$(this).animate({ color: "ecomenu2" }, 400);
	});
	
	// eventi.php
	$("#content_year_"+curr_year).show("fast", function() {
		$("#arrow_"+curr_year).attr("src","/images/arrow_up.png");
	});

	$("#content_month_"+curr_month+"_"+curr_year).show("fast", function() {
		$("#arrow_"+curr_month+"_"+curr_year).attr("src","/images/arrow_up.png");
	});
	
	$("[id^=year_]").click(function() {
		var id_year = $(this).attr("id").replace("year_","");
		$("#content_year_"+id_year).slideToggle("fast");
		toggle_arrow("#arrow_"+id_year);
	});
	
	$("[id^=month_]").click(function() {
		var id_month = $(this).attr("id").replace("month_","");
		$("#content_month_"+id_month).slideToggle("fast");
		toggle_arrow("#arrow_"+id_month);
	});
});