var re_email    = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
var acconsento = 0;
function Tell(WHAT)
{
	var tuo_nome = document.modulo.tuo_nome.value;
	var tua_email = document.modulo.tua_email.value;
	var nome_amico = document.modulo.nome_amico.value;
	var email_amico = document.modulo.email_amico.value;
	if (tuo_nome == "" || tuo_nome == "undefined" || tuo_nome == null || tuo_nome.charAt(0) == " ")
	{
		alert("Inserisci il tuo nome!");
		document.modulo.tuo_nome.value = "";
		document.modulo.tuo_nome.focus();
	}
	else if (re_email.test(tua_email) == false)
	{
		alert("Inserisci il tuo indirizzo email!");
		document.modulo.tua_email.value = "";
		document.modulo.tua_email.focus();
	}
	else if (nome_amico == "" || nome_amico == "undefined" || nome_amico == null || nome_amico.charAt(0) == " ")
	{
		alert("Inserisci il nome del tuo amico!");
		document.modulo.nome_amico.value = "";
		document.modulo.nome_amico.focus();
	}
	else if (re_email.test(email_amico) == false)
	{
		alert("Inserisci l'indirizzo email del tuo amico!");
		document.modulo.email_amico.value = "";
		document.modulo.email_amico.focus();
	}
	else if (acconsento == 0)
	{
		alert("Non hai acconsentito al trattamento dei dati personali!");
	}
	else
	{
		document.modulo.method = "post";
		document.modulo.action = "/tell.php?tell=" + WHAT + "&told=yes";
		document.modulo.submit();
	}
}
function ContinueReading()
{
	document.getElementById("short2").style.position = "relative";
	document.getElementById("short2").style.visibility = "visible";
	document.getElementById("short2").style.display = "inline";
	document.getElementById("short3").style.position = "absolute";
	document.getElementById("short3").style.visibility = "hidden";
	document.getElementById("short3").style.display = "none";
}
var XMLHTTP;
function AjaxChooseImage(Stringa)
{
	if (Stringa.length == 1)
	{
		var url = "/fotogallery/ajax.php?iniziale=" + Stringa.toUpperCase();
		XMLHTTP = RicavaBrowser(CambioStato);
		XMLHTTP.open("GET", url, true);
		XMLHTTP.send(null);
	}
	else
	{
		document.getElementById("risultati").innerHTML = "";
	} 
}
function CambioStato()
{
	if (XMLHTTP.readyState == 4)
	{
		var R = document.getElementById("risultati");
		R.innerHTML = XMLHTTP.responseText;
	}
}
function RicavaBrowser(QualeBrowser)
{
	if (navigator.userAgent.indexOf("MSIE") != (-1))
	{
		var Classe = "Msxml2.XMLHTTP";
		if (navigator.appVersion.indexOf("MSIE 5.5") != (-1));
		{
			Classe = "Microsoft.XMLHTTP";
		} 
		try
		{
			OggettoXMLHTTP = new ActiveXObject(Classe);
			OggettoXMLHTTP.onreadystatechange = QualeBrowser;
			return OggettoXMLHTTP;
		}
		catch(e)
		{
			alert("Errore: l'ActiveX non verrą eseguito!");
		}
	}
	else if (navigator.userAgent.indexOf("Mozilla") != (-1))
	{
		OggettoXMLHTTP = new XMLHttpRequest();
		OggettoXMLHTTP.onload = QualeBrowser;
		OggettoXMLHTTP.onerror = QualeBrowser;
		return OggettoXMLHTTP;
	}
	else
	{
		alert("L'esempio non funziona con altri browser!");
	}
}


