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 form_rec_pass(){
//alert("ciao");
var nomeut, email, ran1, ran;
var espressione = /^[_a-z0-9+-]+(\.[_a-z0-9+-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+$/;

i=0;
//nomeut = trim(document.getElementById('id_nomeut').value);
email = trim(document.getElementById('id_email').value);
ran1 = document.getElementById('id_ran1').value;
ran = document.getElementById('id_ran').value;
var ck = new Array();
ck[1] = "a7f1c8";
ck[2] = "b2r3ac";
ck[3] = "q2et89";
ck[4] = "p1y5h3";
ck[5] = "mh3g77";
ck[6] = "nf33t4";
ck[7] = "l2ep77";
ck[8] = "nu55h3";
ck[9] = "nu55h3";
ck[10] = "yh3na2";
ck[11] = "yv77e8";
ck[12] = "psa662";
ck[13] = "wf43l1";
ck[14] = "cxz234";
ck[15] = "ke2p37";


  if (email == ""){
  document.getElementById('id_email').style.background = "#f498ee";
  i++;
  }
  else
  {
  	
	if (!espressione.test(email))
	{
	document.getElementById('id_email').style.background = "#f498ee";
	i++;
	}
  }
  
  /*
  if (nomeut == ""){
  document.getElementById('id_nomeut').style.background = "#f498ee";
  i++;
  }
  */

  if (ran == ""){
  document.getElementById('id_ran').style.background = "#f498ee";
  i++;
  }
  else
  {
    if ( !((ran == ck[ran1]) || (ran == ck[ran1].toUpperCase())) ){
    document.getElementById('id_ran').style.background = "#f498ee";
    i++;
    }
  }
  
  if (i > 0){
  cc('id_errore', 'form_errore.php');
  }
  else
  {
  par = "&nomeut=" + nomeut + "&email=" + email;
  //alert(par);  
  cc('corpo_ab', 'rec_pass_form_real.php', 'post', par);
  }

}

function form_del_campo(val){
  if (document.getElementById(val)){
  document.getElementById(val).style.background = "#ffffff";
  }  
cc('id_errore', 'form_errore_vuoto.php');
}