// JavaScript Document
function controlla(){	 
	var nome = document.commento.nome.value;	
	if (nome == "") {
	   alert("Il campo nome è obbligatorio.");
	   document.commento.nome.focus();
	   return false;
	}else {
		document.commento.action = "/commentiscorr.php";
	    document.commento.submit();	
	}
 }
 function controlla2(){	 
	var nome = document.commento2.nome.value;	
	if (nome == "") {
	   alert("Il campo nome è obbligatorio.");
	   document.commento2.nome.focus();
	   return false;
	}else {
		document.commento2.action = "/commentiscorr.php";
	    document.commento2.submit();	
	}
 }

 function ismaxlength(obj){
	var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
	if (obj.getAttribute && obj.value.length>mlength)
	obj.value=obj.value.substring(0,mlength)
 }
 
 function setStar(id) {
 
	var src = new Array(5)
	
	src[0] = document.getElementById('star1');
	src[1] = document.getElementById('star2');
	src[2] = document.getElementById('star3');
	src[3] = document.getElementById('star4');
	src[4] = document.getElementById('star5');	
	
	for ( i = 0; i< id; i ++){	
		src[i].src = "/images/s_p.gif";
	}	
	
 }
 
 function UnsetStar(id,Max,decimale) {			
	var src = new Array(5)
	
	src[0] = document.getElementById('star1');
	src[1] = document.getElementById('star2');
	src[2] = document.getElementById('star3');
	src[3] = document.getElementById('star4');
	src[4] = document.getElementById('star5');	
	
	for ( l = 0; l< 5; l++){	
		src[l].src = "/images/s_v.gif";
	}
				
	for ( l = 0; l< Max; l++){	
		src[l].src = "/images/s_p.gif";				
	}	
	
	if(decimale == 1) src[Max].src = "/images/s_m.gif";
	
 }
