
function richiedi(y) {
	function trim(stringa) {    
		while (stringa.substring(0,1) == ' ') {        
			stringa = stringa.substring(1, stringa.length);    
		}    
		while (stringa.substring(stringa.length-1, stringa.length) == ' ') {       
			stringa = stringa.substring(0,stringa.length-1);    
		}    
		return stringa;
	}

	var error = "";
			
	if(document.getElementById('anti2')) {
		if(document.getElementById('oggetto')) {
			if(trim(document.getElementById('oggetto').value) === ""){
				error += "- Il campo oggetto è Obbligatorio...\n";
			}	
		}	
		if(trim(document.getElementById('descrizione').value) === ""){
			error += "- Il campo messaggio è Obbligatorio...\n";
		}	
		if(trim(document.getElementById('anti2').value) === ""){
			error += "- Inserire il testo riportato nell'immagine...\n";
		}else if (trim(document.getElementById('anti2').value) !== y) {
			error += "- Testo riportato nell'immagine non corretto...\n";
		}		
	}
	
	if(error !== "") {
		alert(error);
		return false;
	}
}
