/* CONTROLLI INVIO ORDINI */

function submit_ordini() {
	theForm = document.form_ordini;
	
	if (theForm.nome.value == "") {
    	alert("Per favore inserire il proprio nome, grazie.");
    	theForm.nome.focus();
		}
	else if (theForm.cognome.value == "") {
    	alert("Per favore inserire il proprio cognome, grazie.");
    	theForm.cognome.focus();
		}
	else if (theForm.rag_soc.value == "") {
    	alert("Per favore inserire la ragione sociale, grazie.");
    	theForm.rag_soc.focus();
		}	
	else if (theForm.telefono.value == "") {
    	alert("Per favore inserire il proprio telefono, grazie.");
    	theForm.telefono.focus();
	}
	else if (theForm.email.value == "") {
    	alert("Per favore inserire il proprio indirizzo Email, grazie.");
    	theForm.email.focus();
	}
	else if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(theForm.email.value))) {
		alert("Indirizzo E-Mail non valido, si prega di verificarlo.\nGrazie.");
		theForm.email.focus();
	}
	else if (theForm.indirizzo.value == "") {
    	alert("Per favore inserire il proprio indirizzo, grazie.");
    	theForm.indirizzo.focus();
	}
	else if (theForm.citta.value == "") {
    	alert("Per favore inserire la citta, grazie.");
    	theForm.citta.focus();
	}
	else if (theForm.prov.value == "") {
    	alert("Per favore inserire la provincia, grazie.");
    	theForm.prov.focus();
	}
	else if (theForm.paese.value == "") {
    	alert("Per favore inserire il paese, grazie.");
    	theForm.paese.focus();
	}
	else {
    	theForm.submit();	
	}
 };
 
function submit_contatti() {		
	theForm = document.form_contatti;
	
	if (theForm.nome.value == "") {
    	alert("Per favore inserire il proprio nome, grazie.");
    	theForm.nome.focus();
	}
	else if (theForm.cognome.value == "") {
    	alert("Per favore inserire il proprio cognome, grazie.");
    	theForm.cognome.focus();
	}
	else if (theForm.email.value == "") {
    	alert("Per favore inserire il proprio indirizzo Email, grazie.");
    	theForm.email.focus();
	}
	else if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(theForm.email.value))) {
		alert("Indirizzo E-Mail non valido, si prega di verificarlo.\nGrazie.");
		theForm.email.focus();
	}
	else if (theForm.messaggio.value == "") {
    	alert("Per favore inserire il messaggio, grazie.");
    	theForm.messaggio.focus();
	}
	else {
    	theForm.submit();	
	}
 };
