function SearchBox(stato) 
{
	with (document.frmSearch) 
	{
		var Lang = ver.value;
		switch (stato) 
		{
			case 1:
				if (keyword.value == "cerca..." || keyword.value == "search...") keyword.value = "";
				break;
			case 0:
				if (keyword.value == "")	
				{
					switch (Lang)
					{
						case "it": 
							keyword.value = "cerca...";
							break;
						case "en": 
							keyword.value = "search...";
							break;
					}
				}
				break;
		}
	}
}


function emailValidation(frm)
{

	var esito = true;
	var Lang = frm.ver.value;

	with (frm.txtMail)
	{
	
		if (value.length > 0)
		{
			apos = value.indexOf("@"); 
			dotpos = value.lastIndexOf(".");
			lastpos = value.length-1;
			spacepos = value.indexOf(" ");
			if (apos < 1 || dotpos-apos < 2 || lastpos-dotpos > 4 || lastpos-dotpos < 2 || spacepos > -1) esito = false;
		}
		else esito = false;
	}
		
	if (esito == false)
	{
		switch (Lang) 
		{
			case "it": alert("Indirizzo e-mail non valido"); break;
			case "en": alert("E-mail address not valid"); break;
		}
		frm.txtMail.focus()
	}

	return esito
}

function Validate()
{

	with (document.frmFeedback) 
	{
		var Lang = ver.value;
				
		var err1 = (txtNominativo.value.length < 3);
		var err2 = (txtMail.value.length < 6);				
		var err3 = (txtMessaggio.value.length < 3);
				
		if (err1) 
		{
			switch (Lang)
			{
				case "it": alert("È necessario compilare il campo Nome e Cognome"); break;
				case "en": alert("It is necessary to correctly fill out Full name field"); break;
			}
		   txtNominativo.focus();
	   	return (false);
		}	
		else if (err2) 
		{
			switch (Lang)
			{
				case "it": alert("È necessario compilare il campo Indirizzo e-mail"); break;
				case "en": alert("It is necessary to correctly fill out E-mail address field"); break;
			}
			txtMail.focus();
	   	return (false);
		}
		else if (err3) 
		{
			switch (Lang) 
			{
				case "it": alert("È necessario compilare il campo Messaggio"); break;
				case "en": alert("It is necessary to correctly fill out Message field"); break;
			}
		   txtMessaggio.focus();
		   return (false);
		}	
		
	}
	var errori = (err1 || err2 || err3);
	return emailValidation(document.frmFeedback) && (! errori);
}

function CheckSearch()
{
	with (document.frmSearch) 
	{
		if ((keyword.value == "cerca...") || (keyword.value == "search...") || (keyword.value == "")) return false;
		else return true;
	}
}
