function MM_goToURL()
{
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function Radius()
	{
	Nifty("H1,DIV.bloccoInforma-Popup,DIV.bloccoAscolta-Popup","#92bce0,small");
	}

function ValidateCerca(theForm){

		if (theForm.Testo.value == ""){
			alert("Inserire almeno una parola.");
			theForm.Testo.focus();
			return(false)
		}
		return (true);
	}

function ValidateContatti(theForm)
{
// Controlla che il codice di sicurezza sia presente
  if (theForm.CMImgCheckerText.value == "") {
	alert("Inserisci le lettere che vedi qui sotto.");
	theForm.CMImgCheckerText.focus();
	return(false)
  }

// Controlla che il messaggio non sia vuoto
if (theForm.Messaggio.value == "") 
	{
	alert("Scrivi il messaggio.");
	theForm.Messaggio.focus();
	return(false)
	}

// Controlla che il nome non sia vuoto
if (theForm.Nome.value == "") 
	{
	alert("Inserisci il Nome.");
	theForm.Nome.focus();
	return(false)
	}
// Controlla che il cognome non sia vuoto
if (theForm.Cognome.value == "") 
	{
	alert("Inserisci il Cognome.");
	theForm.Cognome.focus();
	return(false)
	}

// Controlla se email non sia vuota
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("Inserisci un indirizzo email valido");
	theForm.EMail.focus();
	return (false);
	}

// Controlla che il telefono sia 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("Inserisci un numero di Cellulare valido, solo cifre.");
	theForm.Cellulare.focus();
	return (false);
	}

if (theForm.Privacy.checked == false )
	{
	alert('Per inviare un messaggio devi autorizzarci al trattamento dei tuoi dati personali.');
	theForm.Privacy.focus();
	return (false);
	}

return (true)
}

function ValidateNewsletter(theForm)
{
// Controlla che email non sia vuoto
if (theForm.EMail.value == "") 
	{
	alert("Inserire 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 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);
	}

// Controlla che nomeCognome non sia vuoto
/*
if (theForm.NomeCognome.value == "") {
		alert("Inserire il Nome e Cognome.");
		theForm.NomeCognome.focus();
		return(false)
}

*/

if (theForm.Privacy.checked == false )
	{
	alert('Per iscriverti alla newsletter devi autorizzare il trattamento dei dati personali.');
	theForm.Privacy.focus();
	return (false);
	}

return (true)
}
function ValidateFormFoto(theForm)
{

  // Controlla che il nome non sia vuoto
  /*
  if (theForm.Nome.value == "")
  {
  	alert("Inserisci il Nome.");
  	theForm.Nome.focus();
  	return(false);
  }
  */
  // Controlla che il cognome non sia vuoto
  /*
  if (theForm.Cognome.value == "")
  {
	alert("Inserisci il Cognome.");
	theForm.Cognome.focus();
	return(false);
  }
  */
  // Controlla che l'email non sia vuoto
  if (theForm.EMail.value == "")
  {
	alert("Inserisci il tuo indirizzo Email.");
	theForm.EMail.focus();
	return(false);
  }

  // Controlla che l'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 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 che il check privacy sia true

  if (theForm.Privacy.checked == false )
  {
	alert('Per inviare un messaggio devi autorizzare il trattamento dei dati personali.');
	theForm.Privacy.focus();
	return (false);
  }

  // Controlla se FotoDescrizione sia pieno
  if ((theForm.FotoDescrizione.value == "") && (theForm.Foto.value == ""))
  {
  	alert("Inserisci la foto  e la descrizione");
  	return(false);
  }

  return (true);
}

function MostraImmagineDaCaricare()
{

 if (navigator.userAgent.indexOf('MSIE 6.0')>-1)  {
	  	//alert("stai usando Internet Explorer 6");
		document.getElementById('fotoDaInviareImg').src='file:///' + document.getElementById('fotoDaInviare').value;
		document.getElementById('fotoDaInviareImg').height='300';
		}

else if (navigator.userAgent.indexOf('MSIE 7.0')>-1) {
	  	//alert("stai usando Internet Explorer 7");
		document.getElementById('fotoDaInviareImg').src=document.getElementById('fotoDaInviare').value;
		//document.getElementById('fotoDaInviareImg').height='300';
		}

else if (navigator.userAgent.indexOf('Firefox/')>-1) {
	//alert("stai usando Firefox");
	document.getElementById('fotoDaInviareImg').src='file:///' + document.getElementById('fotoDaInviare').value;
	//document.getElementById('fotoDaInviareImg').height='300';
	}

else if (document.layers)
  	{
	//alert("stai usando Netscape 4");
	}

 else
  	{
	//prompt ("stai usando un browser sconosciuto");
	}

  return(true);
}

function mostraDivNewsletter()
{
	if(document.getElementById("boxNewsletter"))
		{
		document.getElementById("boxNewsletter").style.display = 'block';
		}
}

function nascondiDivNewsletter()
{
	if(document.getElementById("boxNewsletter"))
		{
		document.getElementById("boxNewsletter").style.display = 'none';
		}
}

function mostraDivSms()
{
	if(document.getElementById("boxSms"))
		{
		document.getElementById("boxSms").style.display = 'block';
		}
}

function nascondiDivSms()
{
	if(document.getElementById("boxSms"))
		{
		document.getElementById("boxSms").style.display = 'none';
		}
}

