
/*----------------------------------------*/  				  
/*----------------------------------------*/  				  
// jQuery
/*----------------------------------------*/  				  
/*----------------------------------------*/

$(document).ready(function() {
						   
/*----------------------------------------*/  				  
/*----------------------------------------*/  				  
// JQUERY Sandbox 
/*----------------------------------------*/  				  
/*----------------------------------------*/  				  
$("#usr-menu-in ul li:last-child").removeClass("separator");



/*----------------------------------------*/  				  
/*----------------------------------------*/  				  
// End JQUERY Sandbox 
/*----------------------------------------*/  				  
/*----------------------------------------*/  



$(".tooltip-link").click(
function () {
var position = {};
$(this).position(position);
position.top=position.top-$(this).height()+10;
position.left=position.left-50;
$("#page-content").find(".tooltip-box").hide();
$("#page-content").find(".dropShadow").remove();
$(this).parent().find(".tooltip-box").css(position).fadeIn(500, function () {
						 $(this).dropShadow({left:0,top:0});
					 });
      return false;
}
); 


/*----------------------------------------*/  				  
// CLOSE 
/*----------------------------------------*/  				  

$(".close-link, .close-link2").each(function (c) {
$(this).click(function () {
$(this).parent().hide().removeShadow();
$("#page-content").find(".dropShadow").remove();
						return false;
						})
});

$(".vota-commento .close-link2").each(function (c) {
$(this).click(function () {
$(this).parent().parent().find(".tooltip-link").addClass("modcomm").text("Modifica commento");
$(this).parent().hide().removeShadow();
$("#page-content").find(".dropShadow").remove();
						return false;
						})
});



/*----------------------------------------*/  				  
// READ MORE 
/*----------------------------------------*/  				  

$("#contenuti-offf h4 a").click(
	function () {
$(this).parent().parent().find(".interno-box-testo").toggleClass("mostra");
});

$(".rm-link").click(
	function () {
$(this).parent().next(".rm-body-hide").addClass("rm-body-show").removeClass("rm-body-hide");
$(this).remove();
});

$(".rmt-link").click(
	function () {
$(this).next(".rm-body-hide").addClass("rm-body-show").removeClass("rm-body-hide");
});

$("span.rm-body-hide table tr:odd, table.dati tr:odd").addClass("odd");
//$("span.rm-body-hide table tr:last-child").removeClass("odd").addClass("lst");
$("span.rm-body-hide table td.hi, table.dati td.hi").wrapInner("<span></span>");



/*----------------------------------------*/  				  
// MENU > SUBMENU 
/*----------------------------------------*/  				  
$(".menu2 a#itm-studia, .menu2 a#itm-info, .menu2 a#itm-primopiano").click(
	function () {
$(this).parent().parent().find("a.wait").removeClass("selected").addClass("notselected");
$(this).parent().parent().find(".submenu").hide();
$(this).parent().find(".submenu").fadeIn("slow");
$(this).addClass("selected").removeClass("notselected");
});

$("a#itm-info").click(
	function () {
$(this).parent().find(".submenu").fadeIn("slow");
$(this).addClass("selected").removeClass("notselected");
});
$("a#itm-info").click(
	function () {
//$(this).parent().find(".submenu").toggle("slow");
$("a#itm-studia").parent().find(".submenu").fadeOut("slow");
$("a#itm-info").addClass("selected");
});

$("a#itm-studia").click(
	function () {
$(this).parent().find(".submenu").fadeIn("slow");
$(this).addClass("selected").removeClass("notselected");
});
$("a#itm-studia").click(
	function () {
//$(this).parent().find(".submenu").toggle("slow");
$("a#itm-info").parent().find(".submenu").fadeOut("slow");
$("a#itm-info").addClass("selected");
});

$("a#fai-domanda").click(
	function () {
$(this).parent().fadeOut("slow");
$(this).parent().parent().find(".submenu").fadeIn("slow");
$(this).addClass("selected");
});

/*----------------------------------------*/  				  
// HIDDEN TEXT 
/*----------------------------------------*/  				  

$("#page-content .hidden-text .shlk").parent().parent().addClass('opened');
$("#page-content .hidden-text .shlk").parent().css({"margin-bottom":"10px"});

$(".hide").hide();


//--------------------------

$(".htxt .shlk").click(
	function () {
$(this).parent().parent().addClass('opened');
$(this).parent().css({"margin-bottom":"10px"});
				$(this).parent().parent().children("*").each(function (i) {
				$(this).find("*").fadeIn("slow");
				$(this).fadeIn("slow");
				$(this).css({"display":"block"});
				
$(".hide").each(function (d) {
$(this).hide();});
});
});


$(".htxt .close-ht").click(
	function () {
$(this).parent().children("*").not(".shlk, .shlk-bkg").slideUp('fast', function (wait) {
$(this).parent().removeClass('opened');});
});






$("#menu-backoffice h2").toggle(
	function () {
$(this).parent().children("ul").slideDown();
},
	function () {
$(this).parent().children("ul").slideUp();
});

$("#menu-backoffice dt").parent().parent("li").addClass("dlist");


$("#menu-backoffice dt").toggle(
	function () {
$(this).parent().children("dd").fadeIn();
$(this).parent().parent("li").toggleClass("min");
},
	function () {
$(this).parent().children("dd").hide();
$(this).parent().parent("li").toggleClass("min");
});

/*----------------------------------------*/  				  
// FORUM 
/*----------------------------------------*/  				  
$("table.clrows tr:odd").addClass("odd");

/*----------------------------------------*/  				  
// VOTO 
/*----------------------------------------*/  

var votor1 = $("span#vt1").text();
var votor2 = $("span#vt2").text();
var votor3 = $("span#vt3").text();
var votor4 = $("span#vt4").text();
var votor5 = $("span#vt5").text();
var votor6 = $("span#vt6").text();
var votor7 = $("span#vt7").text();
var votor8 = $("span#vt8").text();
var votor9 = $("span#vt9").text();
var votor10 = $("span#vt10").text();
var votor11 = $("span#vt11").text();
var votor12 = $("span#vt12").text();
var votor13 = $("span#vt13").text();
var votor14 = $("span#vt14").text();
var votor15 = $("span#vt15").text();
var votor16 = $("span#vt16").text();
var votor17 = $("span#vt17").text();
var votor18 = $("span#vt18").text();
var votor19 = $("span#vt19").text();
var votor20 = $("span#vt20").text();

$("tr#r1").addClass("voto" + votor1);
$("tr#r2").addClass("voto" + votor2);
$("tr#r3").addClass("voto" + votor3);
$("tr#r4").addClass("voto" + votor4);
$("tr#r5").addClass("voto" + votor5);
$("tr#r6").addClass("voto" + votor6);
$("tr#r7").addClass("voto" + votor7);
$("tr#r8").addClass("voto" + votor8);
$("tr#r9").addClass("voto" + votor9);
$("tr#r10").addClass("voto" + votor10);
$("tr#r11").addClass("voto" + votor11);
$("tr#r12").addClass("voto" + votor12);
$("tr#r13").addClass("voto" + votor13);
$("tr#r14").addClass("voto" + votor14);
$("tr#r15").addClass("voto" + votor15);
$("tr#r16").addClass("voto" + votor16);
$("tr#r17").addClass("voto" + votor17);
$("tr#r18").addClass("voto" + votor18);
$("tr#r19").addClass("voto" + votor19);
$("tr#r20").addClass("voto" + votor20);

$("tr.voto1 table.tab-voti, tr.voto2 table.tab-voti, tr.voto3 table.tab-voti, tr.voto4 table.tab-voti, tr.voto5 table.tab-voti, tr.voto6 table.tab-voti, tr.voto7 table.tab-voti, tr.voto8 table.tab-voti, tr.voto9 table.tab-voti, tr.voto10 table.tab-voti").removeClass("tab-voti").addClass("tab-votioff");
$("tr.voto1 .tab-votioff td.v01, tr.voto2 .tab-votioff td.v02, tr.voto3 .tab-votioff td.v03, tr.voto4 .tab-votioff td.v04, tr.voto5 .tab-votioff td.v05, tr.voto6 .tab-votioff td.v06, tr.voto7 .tab-votioff td.v07, tr.voto8 .tab-votioff td.v08, tr.voto9 .tab-votioff td.v09, tr.voto10 .tab-votioff td.v10").addClass("sel");


$("table.tab-voti td.v01").click(function () {
$(this).parent().parent().parent().find("td").not(this).removeClass("sel");
$(this).toggleClass("sel");
if ( $(this).hasClass("sel") ) {
$(this).parent().parent().parent().parent().parent().find("a.tooltip-link").addClass("show");
$(this).parent().parent().parent().parent().parent().find("option[value='1']").attr("selected", true);
} else {
$(this).parent().parent().parent().parent().parent().find("a.tooltip-link").removeClass("show");
$(this).parent().parent().parent().parent().parent().find("option[value='1']").attr("selected", false);
}});


$("table.tab-voti td.v02").click(function () {
$(this).parent().parent().parent().find("td").not(this).removeClass("sel");
$(this).toggleClass("sel");
if ( $(this).hasClass("sel") ) {
$(this).parent().parent().parent().parent().parent().find("a.tooltip-link").addClass("show");
$(this).parent().parent().parent().parent().parent().find("option[value='2']").attr("selected", true);
} else {
$(this).parent().parent().parent().parent().parent().find("a.tooltip-link").removeClass("show");
$(this).parent().parent().parent().parent().parent().find("option[value='2']").attr("selected", false);
}});


$("table.tab-voti td.v03").click(function () {
$(this).parent().parent().parent().find("td").not(this).removeClass("sel");
$(this).toggleClass("sel");
if ( $(this).hasClass("sel") ) {
$(this).parent().parent().parent().parent().parent().find("a.tooltip-link").addClass("show");
$(this).parent().parent().parent().parent().parent().find("option[value='3']").attr("selected", true);
} else {
$(this).parent().parent().parent().parent().parent().find("a.tooltip-link").removeClass("show");
$(this).parent().parent().parent().parent().parent().find("option[value='3']").attr("selected", false);
}});


$("table.tab-voti td.v04").click(function () {
$(this).parent().parent().parent().find("td").not(this).removeClass("sel");
$(this).toggleClass("sel");
if ( $(this).hasClass("sel") ) {
$(this).parent().parent().parent().parent().parent().find("a.tooltip-link").addClass("show");
$(this).parent().parent().parent().parent().parent().find("option[value='4']").attr("selected", true);
} else {
$(this).parent().parent().parent().parent().parent().find("a.tooltip-link").removeClass("show");
$(this).parent().parent().parent().parent().parent().find("option[value='4']").attr("selected", false);
}});


$("table.tab-voti td.v05").click(function () {
$(this).parent().parent().parent().find("td").not(this).removeClass("sel");
$(this).toggleClass("sel");
if ( $(this).hasClass("sel") ) {
$(this).parent().parent().parent().parent().parent().find("a.tooltip-link").addClass("show");
$(this).parent().parent().parent().parent().parent().find("option[value='5']").attr("selected", true);
} else {
$(this).parent().parent().parent().parent().parent().find("a.tooltip-link").removeClass("show");
$(this).parent().parent().parent().parent().parent().find("option[value='5']").attr("selected", false);
}});


$("table.tab-voti td.v06").click(function () {
$(this).parent().parent().parent().find("td").not(this).removeClass("sel");
$(this).toggleClass("sel");
if ( $(this).hasClass("sel") ) {
$(this).parent().parent().parent().parent().parent().find("a.tooltip-link").addClass("show");
$(this).parent().parent().parent().parent().parent().find("option[value='6']").attr("selected", true);
} else {
$(this).parent().parent().parent().parent().parent().find("a.tooltip-link").removeClass("show");
$(this).parent().parent().parent().parent().parent().find("option[value='6']").attr("selected", false);
}});


$("table.tab-voti td.v07").click(function () {
$(this).parent().parent().parent().find("td").not(this).removeClass("sel");
$(this).toggleClass("sel");
if ( $(this).hasClass("sel") ) {
$(this).parent().parent().parent().parent().parent().find("a.tooltip-link").addClass("show");
$(this).parent().parent().parent().parent().parent().find("option[value='7']").attr("selected", true);
} else {
$(this).parent().parent().parent().parent().parent().find("a.tooltip-link").removeClass("show");
$(this).parent().parent().parent().parent().parent().find("option[value='7']").attr("selected", false);
}});


$("table.tab-voti td.v08").click(function () {
$(this).parent().parent().parent().find("td").not(this).removeClass("sel");
$(this).toggleClass("sel");
if ( $(this).hasClass("sel") ) {
$(this).parent().parent().parent().parent().parent().find("a.tooltip-link").addClass("show");
$(this).parent().parent().parent().parent().parent().find("option[value='8']").attr("selected", true);
} else {
$(this).parent().parent().parent().parent().parent().find("a.tooltip-link").removeClass("show");
$(this).parent().parent().parent().parent().parent().find("option[value='8']").attr("selected", false);
}});


$("table.tab-voti td.v09").click(function () {
$(this).parent().parent().parent().find("td").not(this).removeClass("sel");
$(this).toggleClass("sel");
if ( $(this).hasClass("sel") ) {
$(this).parent().parent().parent().parent().parent().find("a.tooltip-link").addClass("show");
$(this).parent().parent().parent().parent().parent().find("option[value='9']").attr("selected", true);
} else {
$(this).parent().parent().parent().parent().parent().find("a.tooltip-link").removeClass("show");
$(this).parent().parent().parent().parent().parent().find("option[value='9']").attr("selected", false);
}});


$("table.tab-voti td.v10").click(function () {
$(this).parent().parent().parent().find("td").not(this).removeClass("sel");
$(this).toggleClass("sel");
if ( $(this).hasClass("sel") ) {
$(this).parent().parent().parent().parent().parent().find("a.tooltip-link").addClass("show");
$(this).parent().parent().parent().parent().parent().find("option[value='10']").attr("selected", true);
} else {
$(this).parent().parent().parent().parent().parent().find("a.tooltip-link").removeClass("show");
$(this).parent().parent().parent().parent().parent().find("option[value='10']").attr("selected", false);
}});

$(".media").media();
$("#swf1").media( { width: 468, height: 60, autoplay: true, caption:false, src:'/banners/banner_468.swf' } ); 
$("#swf-s20090803").media( { width: 468, height: 60, autoplay: true, caption:false, src:'/_swf/calendario-sim/s20090803.swf' } ); 
$("#swf-b20090803").media( { width: 728, height: 90, autoplay: true, caption:false, src:'/_swf/calendario-sim/b20090803.swf' } ); 

$("#swf-s20090805").media( { width: 468, height: 60, autoplay: true, caption:false, src:'/_swf/calendario-sim/s20090805.swf' } ); 
$("#swf-b20090803").media( { width: 728, height: 90, autoplay: true, caption:false, src:'/_swf/calendario-sim/b20090803.swf' } ); 

$("#swf-s20090807").media( { width: 468, height: 60, autoplay: true, caption:false, src:'/_swf/calendario-sim/s20090807.swf' } ); 
$("#swf-b20090803").media( { width: 728, height: 90, autoplay: true, caption:false, src:'/_swf/calendario-sim/b20090803.swf' } ); 

$("#swf-edises468").media( { width: 468, height: 60, autoplay: true, caption:false, src:'/_swf/edises468.swf' } ); 
$("#swf-edises728").media( { width: 728, height: 90, autoplay: true, caption:false, src:'/_swf/edises728.swf' } ); 

/*----------------------------------------*/
//	Closing jQuery
/*----------------------------------------*/  

	});
