function ValidateRegistrazionePressRoomIta(theForm)
{

  if(!document.getElementById || !document.getElementsByTagName) return;
  theForm = document.getElementsById("formRegUtente");
  //theForm = document.getElementsByTagName("FORM")[0];

  // Controlla che la testa non sia vuota
  if (theForm.RagSoc.value == "") {
  			alert("Inserisci il nome della testata.");
  			theForm.RagSoc.focus();
  			return(false)
  	}

  // Controlla che il nome non sia vuoto
  if (theForm.Nome.value == "")
  {
	alert("Inserisci il tuo nome.");
	theForm.Nome.focus();
	return(false)
  }

  // Controlla che il conome non sia vuoto
  if (theForm.Cognome.value == "")
  {
	alert("Inserisci il tuo cognome.");
	theForm.Cognome.focus();
	return(false)
  }

  // Controlla che email non sia vuota
  if (theForm.EMail.value == "") {
	alert("Inserisci l\'indirizzo Email.");
	theForm.EMail.focus();
	return(false)
  }

  // Controlla che email sia valida: caratteri consentiti
  var checkOK = "1234567890qwertyuiopsdfghjklafghjklzxcvbnm@_-.QERTYUIOPASDFGHJLZXCVBNM";
  var checkStr = theForm.EMail.value;
  var EmailValida = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
	ch = checkStr.charAt(i);
	for (j = 0;  j < checkOK.length;  j++)
	  if (ch == checkOK.charAt(j))
		break;
	if (j == checkOK.length)
	{
	  EmailValida = false;
	  break;
	}

  }

  // Controlla che email sia valida: presenza della @
  if (checkStr.indexOf('@') == -1)
    EmailValida = false;

  // Controlla che email sia valida: presenza di 1 punto
  if (checkStr.indexOf('.') == -1)
    EmailValida = false;

  if (!EmailValida)
  {
	alert("Inserisci un indirizzo email valido");
	theForm.EMail.focus();
	return (false);
  }

  // Controlla se la Password e' vuota
  if (theForm.Password.value == "")
  {
	alert("Inserisci una Password.");
	theForm.Password.focus();
	return(false)
  }

  // Controlla se la Password2 e' vuota
  if (theForm.Password2.value == "") {
	alert("Inserisci la Password una seconda volta per conferma.");
	theForm.Password2.focus();
	return(false)
  }


  // Controlla se il telefono e' in cifre
  var checkOK = "0123456789/ ";
  var checkStr = theForm.VarUtenteValue2.value;
  var TelefonoValido = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      TelefonoValido = false;
      break;
    }
  }

  if (!TelefonoValido)
  {
    alert("Inserisci un numero di Telefono valido, solo cifre.");
    theForm.VarUtenteValue2.focus();
    return (false);
  }


  if (theForm.Privacy.checked == false )
  {
	alert('Per comletare la registrazione é necessario autorizzare l\'uso dei dati personali.');
	theForm.Privacy.focus();
	return (false);
  }

  return (true);
}



function ValidateContattiIta(theForm)
{

  // Controlla se l'email e' vuoto
  if (theForm.EMail.value == "") {
	alert("Inserire l\'indirizzo Email.");
	theForm.EMail.focus();
	return(false)
  }

  // Controlla se l'email e' valida: caratteri consentiti
  var checkOK = "1234567890qwertyuiopsdfghjklafghjklzxcvbnm@_-.QERTYUIOPASDFGHJLZXCVBNM";
  var checkStr = theForm.EMail.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
	ch = checkStr.charAt(i);
	for (j = 0;  j < checkOK.length;  j++)
	  if (ch == checkOK.charAt(j))
		break;
	if (j == checkOK.length)
	{
	  allValid = false;
	  break;
	}

  }

  // Controlla se l'email e' valida: presenza della @
  if (checkStr.indexOf('@') == -1)
    allValid = false;

  // Controlla se l'email e' valida: presenza di 1 punto
  if (checkStr.indexOf('.') == -1)
    allValid = false;

  if (!allValid)
	{
	alert("Inserire un indirizzo email valido");
	theForm.EMail.focus();
	return (false);
	}

  // Controlla se il nome e' vuoto
  /*
  if (theForm.Nome.value == "") {
  			alert("Inserire il Nome.");
  			theForm.Nome.focus();
  			return(false)
  	}

  // Controlla se il cognome e' vuoto

  if (theForm.Cognome.value == "") {
			alert("Inserire il Cognome.");
			theForm.Cognome.focus();
			return(false)
	}
*/

  // Controlla se il messaggio e' vuoto

  if (theForm.Messaggio.value == "") {
  			alert("Scrivi un messaggio.");
  			theForm.Messaggio.focus();
  			return(false)
  	}


  // Controlla se il telefono e' in cifre
  var checkOK = "0123456789/ ";
  var checkStr = theForm.Telefono.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Inserire un numero di Telefono valido, solo cifre.");
    theForm.Telefono.focus();
    return (false);
  }

  if (theForm.Privacy.checked == false )
  {
	alert('Per inviare un messaggio è\' necessario autorizzare l\'uso dei dati personali.');
	theForm.Privacy.focus();
	return (false);
  }

  return (true);
}





function ValidateIscrNewsletter(theForm)
{


  // Controlla se la Cellulare e' vuoto
  if (theForm.Cellulare.value == "")
  {
	alert("Inserisci un Cellulare.");
	theForm.Cellulare.focus();
	return(false)
  }


  // Controlla se il Cellulare e' in cifre
  var checkOK = "0123456789+";
  var checkStr = theForm.Cellulare.value;
  var TelefonoValido = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      TelefonoValido = false;
      break;
    }
  }

  if (!TelefonoValido)
  {
    alert("Inserisci un numero di Cellulare valido, solo cifre.");
    theForm.Cellulare.focus();
    return (false);
  }

  // Controlla se l'email e' vuoto
  if (theForm.EMail.value == "") {
	alert("Inserisci l\'indirizzo Email.");
	theForm.EMail.focus();
	return(false)
  }

  // Controlla se l'email e' valida: caratteri consentiti
  var checkOK = "1234567890qwertyuiopsdfghjklafghjklzxcvbnm@_-.QERTYUIOPASDFGHJLZXCVBNM";
  var checkStr = theForm.EMail.value;
  var EmailValida = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
	ch = checkStr.charAt(i);
	for (j = 0;  j < checkOK.length;  j++)
	  if (ch == checkOK.charAt(j))
		break;
	if (j == checkOK.length)
	{
	  EmailValida = false;
	  break;
	}

  }

  // Controlla se l'email e' valida: presenza della @
  if (checkStr.indexOf('@') == -1)
    EmailValida = false;

  // Controlla se l'email e' valida: presenza di 1 punto
  if (checkStr.indexOf('.') == -1)
    EmailValida = false;

  if (!EmailValida)
  {
	alert("Inserisci un indirizzo email valido");
	theForm.EMail.focus();
	return (false);
  }

  if (theForm.Privacy.checked == false )
  {
	alert('Per comletare la registrazione é necessario autorizzare l\'uso dei dati personali.');
	theForm.Privacy.focus();
	return (false);
  }

  return (true);
}


function ValidateNewsletterIta(theForm){


  // Controlla se il Cellulare e' in cifre
  var checkOK = "0123456789/ ";
  var checkStr = theForm.Cellulare.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Inserire un numero di Cellulare valido, solo cifre.");
    theForm.Cellulare.focus();
    return (false);
  }

  // Controlla che email non sia vuoto
  if (theForm.EMail.value == "") {
	alert("Inserisci il tuo indirizzo Email.");
	theForm.EMail.focus();
	return(false)
  }

  // Controlla che email sia valida: caratteri consentiti
  var checkOK = "1234567890qwertyuiopsdfghjklafghjklzxcvbnm@_-.QERTYUIOPASDFGHJLZXCVBNM";
  var checkStr = theForm.EMail.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
	ch = checkStr.charAt(i);
	for (j = 0;  j < checkOK.length;  j++)
	  if (ch == checkOK.charAt(j))
		break;
	if (j == checkOK.length)
	{
	  allValid = false;
	  break;
	}

  }

  // Controlla che email sia valida: presenza della @
  if (checkStr.indexOf('@') == -1)
    allValid = false;

  // Controlla che email sia valida: presenza di 1 punto
  if (checkStr.indexOf('.') == -1)
    allValid = false;

  if (!allValid)
	{
	alert("Inserire un indirizzo email valido");
	theForm.EMail.focus();
	return (false);
	}

 
  if (theForm.Privacy.checked == false )
  {
	alert('Per l\'iscrizione alla newsletter e\' necessario autorizzare l\'uso dei dati personali.');
	theForm.Privacy.focus();
	return (false);
  }

  return (true);
}






// INGLESE

function ValidateIscrNewsletterEng(theForm)
{


  // Controlla che Cellulare non sia vuoto
  if (theForm.Cellulare.value == "")
  {
	alert("Insert mobile number.");
	theForm.Cellulare.focus();
	return(false)
  }


  // Controlla che Cellulare sia in cifre
  var checkOK = "0123456789+";
  var checkStr = theForm.Cellulare.value;
  var TelefonoValido = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      TelefonoValido = false;
      break;
    }
  }

  if (!TelefonoValido)
  {
    alert("Insert a valid mobile number, digits only.");
    theForm.Cellulare.focus();
    return (false);
  }

// Controlla che email non sia vuoto
  if (theForm.EMail.value == "") {
	alert("Insert email address.");
	theForm.EMail.focus();
	return(false)
  }

  // Controlla che email sia valida: caratteri consentiti
  var checkOK = "1234567890qwertyuiopsdfghjklafghjklzxcvbnm@_-.QERTYUIOPASDFGHJLZXCVBNM";
  var checkStr = theForm.EMail.value;
  var EmailValida = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
	ch = checkStr.charAt(i);
	for (j = 0;  j < checkOK.length;  j++)
	  if (ch == checkOK.charAt(j))
		break;
	if (j == checkOK.length)
	{
	  EmailValida = false;
	  break;
	}

  }

  // Controlla che email sia valida: presenza della @
  if (checkStr.indexOf('@') == -1)
    EmailValida = false;

  // Controlla che email sia valida: presenza di 1 punto
  if (checkStr.indexOf('.') == -1)
    EmailValida = false;

  if (!EmailValida)
  {
	alert("Insert valid email address");
	theForm.EMail.focus();
	return (false);
  }


  if (theForm.Privacy.checked == false )
  {
	alert('Check autorization for use of personal info.');
	theForm.Privacy.focus();
	return (false);
  }

  return (true);
}
function mostraDivNewsletter()
{
   	if(document.getElementById("HomePopupDiv")){
		document.getElementById("HomePopupDiv").style.display = 'block';
	}
}
function nascondiPopup()
{
   	if(document.getElementById("HomePopupDiv")){
		document.getElementById("HomePopupDiv").style.display = 'none';
	}
}
