function requestSubmit(path, l, arrayCheck){

  var ditta         = document.getElementById("ditta");
  var nome          = document.getElementById("nome");
  var cognome       = document.getElementById("cognome");
  var indirizzo     = document.getElementById("indirizzo");
  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 (arrayCheck["firstName"]);
    nome.style.backgroundColor = "#FF0000";
    nome.focus();
  }
  else if (cognome.value == ""){
    alert (arrayCheck["lastName"]);
    cognome.style.backgroundColor = "#FF0000";
    cognome.focus();
  }
  else if (indirizzo.value == ""){
    alert (arrayCheck["address"]);
    indirizzo.style.backgroundColor = "#FF0000";
    indirizzo.focus();
  }
  else if (email.value == ""){
    alert (arrayCheck["email1"]);
    email.style.backgroundColor = "#FF0000";
    email.focus();
  }
  else if (email.value != "" && !email_reg_exp.test(email.value)){
    alert (arrayCheck["email2"]);
		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 (privacy.checked == false){
    alert (arrayCheck["privacy"]); 
    privacy.style.backgroundColor = "#FF0000";
    privacy.focus();
  }
  else{
    if (l == "IT")
      var sending = 'Invio richiesta in corso...';
    else
      var sending = 'Sending request...';
    
    
    
    var url 	   = '../'+path+'/modules/Contatti/xml/xmlContatti.php';
  	var params 	 = 'l='+parseParam(l)+'&ditta='+parseParam(ditta.value)+'&nome='+parseParam(nome.value)+'&cognome='+parseParam(cognome.value)+'&indirizzo='+parseParam(indirizzo.value)+'&telefono='+parseParam(telefono.value)+'&email='+parseParam(email.value)+'&richieste='+parseParam(richieste.value);
    var method 	 = 'POST';
  	
    myXMLHTTPRequest(method, url, params, responseSubmit);
    
    document.getElementById("contact_form").innerHTML = '<div style="margin: 0 auto; height: 200px; text-align:center; color: #3d060b;"></div><div style="margin: 0 auto; height: 150px; text-align:center; color: #3d060b;"><br /><br /><br /><br /><br /><img src="../'+path+'/modules/Contatti/images/loading.gif" /><br/>'+sending+'</div>';
  }

}


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;
}

