function changeEmotional(Sbutton){
	if (Sbutton.className!='Sbutton on'){
		var buttons = Sbutton.parentNode;
		elenco_buttons = buttons.getElementsByTagName('div');
		for (var i=0;i<elenco_buttons.length;i++){
			if(elenco_buttons[i].className=='Sbutton on'){
				elenco_buttons[i].className='Sbutton';
			}
			else{
				if(elenco_buttons[i]==Sbutton){
					
					elenco_buttons[i].className='Sbutton on';
					var divInScroll = document.getElementById('scroll').getElementsByTagName('DIV');
					
					for (var j=0;j<divInScroll.length;j++){
						divInScroll[j].style.display='none';
						divInScroll[j].style.left='0px';
						if(j==i){
							divInScroll[j].style.display='block';
							
						}
					}
				
				}
			}
		}
	}
	clearTimeout(time);
}

var time='';
var attuale=0;
var accendi=1;
var delay=4000;

function rotateEmotional(){
	var emotional = document.getElementById('emotional');
	buttonsemotional = emotional.getElementsByTagName('div');
	for (k=0;k<buttonsemotional.length;k++){
		if(buttonsemotional[k].className=='buttons'){
			buttons=buttonsemotional[k];
		}
	}
	

	
	elenco_buttons = buttons.getElementsByTagName('div');
	for (var i=0;i<elenco_buttons.length;i++){
		if(elenco_buttons[i].className=='Sbutton on') attuale=i
	}
	
	accendi=attuale+1;
	if(accendi==elenco_buttons.length)accendi=0;
	/*if(accendi==3)accendi=0;*/
	attuale=accendi
	
	changeEmotional(elenco_buttons[accendi])

	timeEmotional();
}

function timeEmotional(){
	if (document.getElementById("emotional"))	time = setTimeout('rotateEmotional()',delay);
}


function accessibility(){
	if($('emotional')){
		 	$('emotional').style.overflow='hidden';
	}
	
}


function onload_function(){
	//accessibility();	
	timeEmotional();
}

