function requestSubmit(path, l){

  var nome          = document.getElementById("nome");
  //var cognome       = document.getElementById("cognome");
  //var indirizzo     = document.getElementById("indirizzo");
  //var cap           = document.getElementById("cap");
  //var citta         = document.getElementById("citta");
  //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 == ""){
    if (l == "IT")
      alert("ERRORE: IL CAMPO NOME NON E' STATO COMPILATO");
    else if (l == "EN")
      alert("ERROR: FIELD NAME IS REQUIRED");
    nome.style.backgroundColor = "#FF0000";
    nome.focus();
  }
  else if (email.value == ""){
    if (l == "IT")
      alert("ERRORE: IL CAMPO EMAIL NON E' STATO COMPILATO");
    else if (l == "EN")
      alert("ERROR: FIELD EMAIL IS REQUIRED");  
    email.style.backgroundColor = "#FF0000";
    email.focus();
  }
  else if (email.value != "" && !email_reg_exp.test(email.value)){
    if (l == "IT")
      alert("ERRORE: CAMPO EMAIL NON CORRETTO");
    else if (l == "EN")
      alert("ERROR: FIELD EMAIL IS NOT CORRECT");
		email.value = '';
		email.focus();
	}
	/*else if (telefono.value != "" && !phone_reg_exp.test(telefono.value)){
    if (l == "IT")
      alert("ERRORE: CAMPO TELEFONO NON CORRETTO. SONO CONSENTITI SOLO NUMERI E I SIMBOLI . - + /");
    else if (l == "EN")
      alert("ERROR: FIELD PHONE IS NOT CORRECT");		
  	telefono.value = '';
		telefono.focus();
	}*/
	else if (richieste.value == ""){
    if (l == "IT")
      alert("ERRORE: IL CAMPO RICHIESTE NON E' STATO COMPILATO");
    else if (l == "EN")
      alert("ERROR: FIELD REQUEST IS REQUIRED");		
		richieste.focus();
	}
  /*else if (privacy.checked == false){
    if (l == "IT")
      alert("ERRORE: MANCA AUTORIZZAZIONE PRIVACY");
    else if (l == "EN")
      alert("ERROR: YOU HAVE TO AGREE PRIVACY NOTICE");  
    privacy.style.backgroundColor = "#FF0000";
    privacy.focus();
  }*/
  else{
    if (l == "IT")
      var sending = 'Invio richiesta in corso...';
    else if (l == "EN")
      var sending = 'Sending request...';
    
    var url 	   = path+'/modules/Contatti/xml/xmlContatti.php';
  	//var params 	 = 'l='+parseParam(l)+'&nome='+parseParam(nome.value)+'&cognome='+parseParam(cognome.value)+'&indirizzo='+parseParam(indirizzo.value)+'&cap='+parseParam(cap.value)+'&citta='+parseParam(citta.value)+'&telefono='+parseParam(telefono.value)+'&email='+parseParam(email.value)+'&richieste='+parseParam(richieste.value);
  	var params 	 = 'l='+parseParam(l)+'&nome='+parseParam(nome.value)+'&email='+parseParam(email.value)+'&richieste='+parseParam(richieste.value);
    var method 	 = 'POST';

    document.getElementById("contact_form").innerHTML = '<div style="margin: 0 auto; height: 150px; text-align:center;"><img src="'+path+'/modules/Contatti/images/loading.gif" /><br/>'+sending+'</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;
}
