function requestSubmit(){

  //var l             = document.getElementById("l");
  var nome          = document.getElementById("nome");
  var cognome       = document.getElementById("cognome");
  //var indirizzo     = document.getElementById("indirizzo");
  //var provincia     = document.getElementById("provincia");
  //var cap           = document.getElementById("cap");
  var telefono      = document.getElementById("telefono");
  var email         = document.getElementById("email");
  var richieste     = document.getElementById("richieste");
  //var privacy       = document.getElementById("privacy");

  //var phone_reg_exp = /^([0-9_\.\-\+\ \/])+$/;
	var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;

  if (nome.value == ""){
  
    alert("ERRORE: IL CAMPO NOME NON E' STATO COMPILATO");
    nome.style.backgroundColor = "#FF0000";
    nome.focus();
  
  }
  /*else if (cognome.value == ""){
  
    alert("ERRORE: IL CAMPO COGNOME NON E' STATO COMPILATO");
    cognome.style.backgroundColor = "#FF0000";
    cognome.focus();
  
  }*/
  else if (email.value == ""){
  
    alert("ERRORE: IL CAMPO EMAIL NON E' STATO COMPILATO");
    email.style.backgroundColor = "#FF0000";
    email.focus();
  
  }
  else if (email.value != "" && !email_reg_exp.test(email.value)){
  
    alert("ERRORE: CAMPO EMAIL NON CORRETTO");
		email.value = '';
		email.focus();
			
	}
	/*else if (telefono.value != "" && !phone_reg_exp.test(telefono)){
		
		alert("ERRORE: CAMPO TELEFONO NON CORRETTO. SONO CONSENTITI SOLO NUMERI E I SIMBOLI . - + /");
		telefono.value = '';
		telefono.focus();
			
	}*/
  /*else if (privacy.checked == false){
  
    alert("ERRORE: MANCA AUTORIZZAZIONE PRIVACY");
    privacy.style.backgroundColor = "#FF0000";
    privacy.focus();
  
  }*/
  else{
    
    var url 	   = 'modules/Contatti/xml/xmlContatti.php';
  	var params 	 = 'nome='+nome.value+'&cognome='+cognome.value+'&email='+email.value+'&richieste='+richieste.value;
    var method 	 = 'POST';
  	
  	document.getElementById("contact_form").innerHTML = '<div style="margin: 0 auto; height: 150px; text-align:center;"><img src="modules/Contatti/images/loading.gif" /><br/>Invio richiesta in corso...</div>';
    myXMLHTTPRequest(method, url, params, responseSubmit);

  }

}


function responseSubmit(httpRequest){
	if (myXMLHTTPResponse(httpRequest, "text/xml")){

		var xmldoc = myXMLHTTPResponse(httpRequest, "text/xml");
		
		var esito = xmldoc.getElementsByTagName('esito').item(0).firstChild.data;		

		document.getElementById("contact_form").innerHTML = esito;
		
	}
	else{
	}
}


function colorOK(field){

  var color = "#FFFFFF";
  document.getElementById(field).style.backgroundColor = color;

}
/*
function colorOK2(field){

  var color = "#000000";
  document.getElementById(field).style.backgroundColor = color;

}*/
