jQuery(document).ready(function($) {
	
	//if ($.browser.msie && $.browser.version == 6)
	//	$('head').append('<style type="text/css"> * { behavior: url(js/iepngfix.htc) }</style><script type="text/javascript" src="js/iepngfix_tilebg.js"></script>');
	
	var w, h, bg, currentRow, theClass;
	
	/* On hover effect */
	$(".readmore").hover(
		function() {
			h =  $(this).children("img").height();
			w =  $(this).children("img").width();
			oh =  $(this).children("img").outerHeight();
			$(this).children("img").after("<div></div>");
			$(this).children("img").siblings("div").css({
				"height" : h,
				"width" : w,
				"position" : "relative",
				"opacity" : "0",
				"margin" : "0",
				"margin-top" : -oh,
				"margin-bottom" : oh-h,
				"padding" : "0",
				"cursor" : "pointer"
			});
			if (h < 150) {
				bg = (w/2 - 24) + "px " + (h/2 - 36) + "px";
				theClass = "bigRead";
			} else {
				bg = (w/2 - 37) + "px " + (h/2 - 45) + "px";
				theClass = "smallRead";
			}
			//$(this).children("img").siblings("div").addClass(theClass);
			$(this).children("img").siblings("div").css({ "background-position" : bg}).addClass(theClass).fadeTo("fast", 0.6);
		},
		function() {
			$(this).children("img").siblings("div").fadeTo("fast", 0, function() { $(this).remove(); });
		}
	);
	
	$("#schedule tbody tr").hover(
		function() {
			var active = $(this).parent().find(".active");
			active.removeClass("active");
			$(this).addClass("active");
		});
	
	$('.bgMenu li').click(function() {
		if ($(this).children('big').text() == 'CONTATTI')
			$('html, body').animate({
				scrollTop: $("#footer").offset().top
			}, 1000);
	});
	
});
