var fadingTimeOut=6000;
var divFading=0;
$(document).ready(function(){
	
	
	$("div.notShowed").hide();
	
	$("div.menuDesplegat").hide();
  
	//set up the images fading  in and out
	setTimeout("changeFading()", fadingTimeOut);
		
	/*RIGHT BOTTOM*/
	$("div.leftColumnInferior div.menuHomeAlumni div.peuMenuHome").click(function(){
		$("div.leftColumnInferior div.menuHomeAlumni div.peuMenuHome").toggle();
		if ($("div.leftColumnInferior div.menuHomeAlumni div.notShowed").is(":hidden")) {
	        $("div.leftColumnInferior div.menuHomeAlumni div.notShowed").slideDown("fast");
		
	    } else {
	        $("div.leftColumnInferior div.menuHomeAlumni div.notShowed").slideUp("fast");
	    }
	}); 
	
	
	/*NOTICIES*/
	$("div.centerColumnInferior div#finalCapsaNoticies div.persiana").click(function(){
		$("div.centerColumnInferior div#finalCapsaNoticies div.persiana").toggle();
		if ($("div.centerColumnInferior div#noticiesHome div.notShowed").is(":hidden")) {
	        $("div.centerColumnInferior div#noticiesHome div.notShowed").slideDown("fast");
		
	    } else {
	        $("div.centerColumnInferior div#noticiesHome div.notShowed").slideUp("fast");
	    }
	}); 
});

var imgFading=0;
function changeFading(){
	var imgs=$("div#imatgeLinksHome img");
	if(imgs.length>0){
		nextImgFading=(imgFading+1)%imgs.length;
		if(imgFading==0){
			$("div#imatgeLinksHome img.notVisible").fadeOut("slow");	
		}else{
			$("div#imatgeLinksHome img").eq(imgFading).fadeIn("slow");
		}
		imgFading=nextImgFading;
		setTimeout("changeFading()", fadingTimeOut);
	}
}

