$(document).ready(function() {
	
	// gestione barra STAGE
	if ($("#iStage").length > 0) {
		var hStage  = $("#iStage").height();
		var cssBt   = { position: "absolute"
					  , display: "none"
					  , top: hStage + "px"
					  , left: "22px"
					  , cursor: "pointer"
					  };
		var cssTxt  = { position: "absolute"
					  , display: "none"
					  , top: hStage + "px"
					  , left: "50px"
					  , fontSize: "9px"
					  };
		var imgOut  = '/skinAdmin/entigo/widgets/ico-stage.gif';
		var imgOver = '/skinAdmin/entigo/widgets/ico-stage2.gif';
		var htmlImg = '<img src="' + imgOut + '" width="20" height="14" alt="apri/chiudi stage" id="btStage" />';
		var htmlTxt = '<p id="btStageTxt">&lt; Stage</p>';

		$("#iStage").css("top", "-" + hStage + "px");
		$("#iStage").css("z-index", "500");
		$(".iStageDx").after(htmlImg);
		$("#btStage").css(cssBt).fadeIn("slow");
		$(".iStageDx").after(htmlTxt);
		$("#btStageTxt").css(cssTxt).fadeIn(500).fadeOut(2000);

		$("#btStage").click(function() {
			if ($("#iStage").css("top") == '0px') {
				$("#iStage").animate({top: "-" + hStage + "px"}, 500);
				$(this).attr("src", imgOut);
			} else {
				$("#iStage").animate({top: "0px"}, 300);
				$(this).attr("src", imgOver);
			}
		});
	};

	// gestione IMG HOVER
	$(".icsmMouseOver").each(function() {
		var src = $(this).attr('src');
		var extension = src.substring(src.lastIndexOf('.'),src.length);
		$(this).mouseover(function() {
			$(this).attr('src',src.replace(extension,'-on' + extension));
		});
		$(this).mouseout(function() {
			$(this).attr('src',src);
		});
	});
	$('#newsList').jScrollPane({maintainPosition : false, wheelSpeed : 50, showArrows:true});
	//$('.news span.testoInt').jScrollPane({maintainPosition : false, wheelSpeed : 50});
	$('#newsDet').jScrollPane({maintainPosition : false, wheelSpeed : 50, showArrows:true});
	
	$(".immagine a").fancybox({
		'overlayShow':	true
	});
	
	
});