
// ==================================================
// NIFTY ONLOAD
// ==================================================
window.onload = function() {
	Nifty("div.postnav a","transparent");
	Nifty("div#arr","transparent");
}

// ==================================================
// VALIDATOR
// ==================================================
function Validator(theForm) {
	
	// --------------------------------------------------
	// NAME
	// --------------------------------------------------
	if (theForm['Name'].value == "") {
		alert("Inserire il nome.");
		theForm['Name'].focus();
		return (false);
	}
	
	// --------------------------------------------------
	// LASTNAME
	// --------------------------------------------------
	if (theForm['Lastname'].value == "") {
		alert("Inserire il cognome.");
		theForm['Lastname'].focus();
		return (false);
	}
	
	// --------------------------------------------------
	// EMAIL
	// --------------------------------------------------
	if (theForm['Email'].value == "") {
		alert("Indicare l\'indirizzo email.");
		theForm['Email'].focus();
		return (false);
	}
	// Email syntax
	if(theForm['Email'].value!=""){
		Filtro=/^[A-Za-z0-9]+([_\.-][A-Za-z0-9]+)*@[A-Za-z0-9]+([_\.-][A-Za-z0-9]+)*\.([A-Za-z]){2,4}$/i;
		if(Filtro.test(theForm['Email'].value)==false){
			alert("Email non valido");
			theForm['Email'].focus();
			return(false);
		}
	}
	
	// --------------------------------------------------
	// SUBJECT
	// --------------------------------------------------
	if (theForm['Subject'].value == "") {
		alert("Inserire il soggetto.");
		theForm['Subject'].focus();
		return (false);
	}
	// --------------------------------------------------
	// BODY
	// --------------------------------------------------
	if (theForm['Body'].value == "") {
		alert("Inserire un messaggio.");
		theForm['Body'].focus();
		return (false);
	}
	// BODY LEN
	if (theForm['Body'].value.length > 800) {
		alert("Il testo deve contenere meno di 800 caratteri");
		theForm['Body'].focus();
		return (false);
	}
	document.myForm.submit();
}
