  function trim(stringa){
    while (stringa.substring(0,1) == ' '){
        stringa = stringa.substring(1, stringa.length);
    }
    while (stringa.substring(stringa.length-1, stringa.length) == ' '){
        stringa = stringa.substring(0,stringa.length-1);
    }
    return stringa;
  }
  function login_submit(){
  var espressione = /^[_a-z0-9+-]+(\.[_a-z0-9+-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+$/;
  //alert("ciao");
  var nomeut2, passw2;

  i=0;
  nomeut2 = trim(document.getElementById('id_nomeut2').value);
  passw2 = trim(document.getElementById('id_passw2').value);
  
  if (nomeut2 == ""){
  //alert("si");
  document.getElementById('id_nomeut2').style.background = "#f498ee";
  i++;
  }
  else
  {
  	
	if (!espressione.test(nomeut2))
	{
	document.getElementById('id_nomeut2').style.background = "#f498ee";
	i++;
	}
  }  


    if (passw2 == ""){
    document.getElementById('id_passw2').style.background = "#f498ee";
    i++;
    }
	else
	{
	  if (passw2.length < 6){
      document.getElementById('id_passw2').style.background = "#f498ee";
      i++;
      }  
	}
  
    if (i > 0){
    cc('id_login_errore', 'login_errore.php');
    }
    else
    {
    par = "&nomeut2=" + nomeut2 + "&passw2=" + passw2;
    //alert(par);  
    cc('id_login', 'login.php', 'post', par);
  }

}
  
  function login_del_campo(val){
  if (document.getElementById(val)){
  document.getElementById(val).style.background = "#ebebeb";
  }
  cc('id_login_errore', 'login_errore_vuoto.php');  
  }