var good;
function checkEmailAddress(field) {

	// Note: The next expression must be all on one line...
	//       allow no spaces, linefeeds, or carriage returns!
	var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\.xxx)|(\..{2,2}))$)\b/gi);
	
	if (goodEmail){
	   good = true;
	} else {
		alert("'E-mail' field was not filled correctly.");
		field.focus();
		field.select();
		good = false;
	}
	
	return good;
}

function sendOff(wich){
	OFORM = wich;
	nome_check = OFORM.c45.value;
	cognome_check = OFORM.c46.value;
	email_check = OFORM.c43;
	societa_check = OFORM.c47.value;
	captcha_check = OFORM.verifyCaptcha.value;
	
	if (nome_check.length < 1) {
		alert("The field 'Nome' was not specified");
		return false; 
	}
	
	if (cognome_check.length < 1) {
		alert("The field 'Cognome' was not specified");
		return false; 
	}
	
	if (societa_check.length < 1) {
		alert("The field 'Societa\'' was not specified");
		return false; 
	}
	
	if (email_check.value.length < 1) {
		alert("'E-mail' field was not specified");
		return false; 
	}else{
		if(checkEmailAddress(email_check) == false){
			return false;
		};
	}
	
	if (captcha_check.length < 1) {
		alert("Insert the image code to go trought the process");
		return false; 
	}
	
	if(good == true){
		if (OFORM.privacy.checked == false){
			alert("You must check the privacy field.");
			good = false;
		}else{
			good = true;
		}
	}
	//if(good == true){ OFORM.submit(); }else{ return false; }
	if(good == false){ return false; }else{ return true; }
}

