// JavaScript Document
<!--Modulo
/*if (document.layers)//n4
	document.write("<style>fieldset { padding: 3px; border:#eeeeee 1px solid; width: 398px; }	</style>")
	else
		if (document.all)//ie
	document.write("<style>fieldset { padding: 3px; border-top: #eeeeee 1px solid; border-left: #ffffff 1px solid; border-right: #ffffff 1px solid; border-bottom: #ffffff 1px solid; width: 500px;  }</style>")
		else
			if (!document.all && document.getElementById)//mz
	document.write("<style>fieldset { padding: 3px; border:#eeeeee 1px groove; width: 298px;  }</style>")
			else//xx
	document.write("<style>fieldset { padding: 3px; border:#eeeeee 1px groove; width: 398px;  }</style>")*/
//-->
/*
function nonInviare()
	{
		if (document.form.nome.value == "")
		{
			alert (" Controlla di aver riempito tutti i campi ")
			document.form.nome.className =  'error'; 
			document.form.nome.focus();
			return false
		}
		if (document.form.cognome.value == "")
		{
			alert (" Controlla di aver riempito tutti i campi ")
			document.form.cognome.className =  'error'; 
			document.form.cognome.focus();
			return false
		}
		if (document.form.telefono.value == "")
		{
			alert (" Controlla di aver riempito tutti i campi ")
			document.form.telefono.className =  'error'; 
			document.form.telefono.focus();
			return false
		}
		if (document.form.email.value == "")
		{
			alert (" Controlla di aver riempito tutti i campi ")
			document.form.email.className =  'error'; 
			document.form.email.focus();
			return false
		}

		if (document.form.note.value == "" )
		{
			alert (" Controlla di aver riempito tutti i campi ")
			document.form.note.className =  'error'; 
			document.form.note.focus();
			return false
		}
   EmailAddr = document.form.email.value;
   Filtro = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
   if (Filtro.test(EmailAddr))
      return true;
   else
      {
      alert("Controlla l'indirizzo di e-mail inserito");
      document.form.email.focus();
      return false;
      }		
	}
*/
<!-- Conferma per Svuotare il carrello =======================
function SvuotaCarrello(){
var agree=confirm("Vuoi veramente rimuovere tutti gli articoli dal tuo carrello?\n");
if (agree){
location="cartDelete.php"
return true;
}
else
{
return false;
}
}
// =======================
<!--
function nonInviare()
	{
  var nome = new Array();
     nome[0] = "nome";
	 nome[1] = "telefono";
     nome[2] = "email";
	 nome[3] = "note";



  for (var i=0; i<=nome.length-1; i++)
  { 
  //alert("document.form."+(nome[i])+".value == ''");

  Campo = eval("document.form."+nome[i]+".value");
  //Evidenzia = eval("document.form."+nome[i]+".className = 'error'");  
  Focus = eval("document.form."+nome[i]+".focus()");
		if (Campo == "")
		{
			alert (" Controlla di aver riempito il campo " + nome[i])
			eval("document.form."+nome[i]+".className = 'error'");
			Focus
			return false
		}
       
  }
     EmailAddr = document.form.email.value;
   Filtro = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
   if (Filtro.test(EmailAddr))
      return true;
   else
      {
      alert("Controlla l'indirizzo di e-mail inserito");
      document.form.email.focus();
	  document.form.email.className =  'error'; 
      return false;
      }
  }
//-->
<!--
function nonInviareCerca()
	{
			if (document.formCerca.cercato.value == "")
		{
			alert (" Digitare i termini della ricerca ")
			document.formCerca.cercato.className =  'error'; 
			document.formCerca.cercato.focus();
			return false
		}
		}

//-->
//-->
//Dettaglio Img ===============================
function PopupImage(imageName) { 
		
	myNewWindow = window.open('', 'Dettaglio','width=600,height=500,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=1'); 
	myNewWindow.document.write("<HTML><HEAD><TITLE>Dettaglio<\/TITLE><\/HEAD>");
	myNewWindow.document.write("<BODY leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'><table width='100%' height='100%' border='0' cellspacing='0' cellpadding='0'><tr><td align='center' valign='middle'>");
	myNewWindow.document.write("<IMG SRC='" + imageName + "'><br><center><a href='javascript:close()' title='Chiudi questa finestra' style='color:#767676; font-family:Tahoma; font-size:11px;'>X CHIUDI</a></center></td></tr></table><\/BODY><\/HTML>");
	myNewWindow.document.close();
	myNewWindow.focus();
		
}
//============================== 
// <!--Colora righe tabella
function hl(row, color) {
if (typeof(row.style) == 'undefined' || typeof(row.cells) == 'undefined') {
return false;
}
row.style.backgroundColor = color;
}
// -->
<!--Mostra/Nascondi 
function toggleForm(oggetto) {
	
	ff = document.getElementById(oggetto);
	
	ff.style.display = 'block';
//alert (ff.style.display)
}
function toggleClose(oggetto) {
	ff = document.getElementById(oggetto);
	ff.style.display = 'none';
//alert (ff.style.display)
}
//-->
	showRow = (navigator.appName.indexOf("Internet Explorer") != -1) ? "block" : "table-row";

	function mail_tab_switch ()

	{
		document.getElementById ('mail_tab').style.display = (document.getElementById ('mail_tab').style.display == 'none') ? showRow : 'none';
		
	}

	function request_switch (tab)
	{
		document.getElementById ('request_tab').style.display = (tab == 'request_tab') ? showRow : 'none';
		document.getElementById ('friend_tab').style.display = (tab == 'friend_tab') ? showRow : 'none';
	}

	

	function request_send(kind, params)
	{
		isOK = request_check(kind);
		if (isOK)
		{
			url 				= kind + '_confirm.xhtml?' + 
									(document.getElementById(kind + '_form_spaceUD') 	? ('ud=' 			+ document.getElementById(kind + '_form_spaceUD').value) 	: '') + 
									(document.getElementById(kind + '_form_nome') 		? ('&nome_ric='		+ document.getElementById(kind + '_form_nome').value )		: '') + 
									(document.getElementById(kind + '_form_tel')		? ('&tel_ric=' 		+ document.getElementById(kind + '_form_tel').value )		: '') + 
									(document.getElementById(kind + '_form_email_from')	? ('&send_from=' 	+ document.getElementById(kind + '_form_email_from').value) : '') + 
									(document.getElementById(kind + '_form_email_to')	? ('&send_to=' 		+ document.getElementById(kind + '_form_email_to').value) 	: '') + 
									(document.getElementById(kind + '_form_body')		? ('&send_body='	+ document.getElementById(kind + '_form_body').value)		: '') ;
			if (params)
				url += params;
									
			window.location 	= url;
		}
		return isOK;
	}

	function request_check (kind)
	{
		var isOK = true;
		
		if (isOK)
		{
			if (document.getElementById (kind + '_form_nome') && document.getElementById (kind + '_form_nome').value == '')
			{
				alert ('Attenzione! Il campo nome e\' obbligatorio.')
				isOK = false;
			}
		}
		if (isOK)
		{
			if (document.getElementById (kind + '_form_tel') && document.getElementById (kind + '_form_tel').value == '')
			{
				alert ('Attenzione! Il campo telefono e\' obbligatorio.')
				isOK = false;
			}
		}
		if (isOK)
		{
			if (document.getElementById (kind + '_form_email_from') && (document.getElementById (kind + '_form_email_from').value.replace( new RegExp ("([a-zA-Z0-9_\\.\\-])+\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,4})$", "i"), "") != ''))
			{
				alert ('Attenzione! Il campo e-mail non e\' un\'indirizzo di posta elettronica valido.')
				isOK = false;
			}
		}
		if (isOK)
		{
			if (document.getElementById (kind + '_form_email_from') && document.getElementById (kind + '_form_email_from').value == '')
			{
				alert ('Attenzione! Il campo e-mail e\' obbligatorio.')
				isOK = false;
			}
		}
		if (isOK)
		{
			if (document.getElementById (kind + '_form_email_to') && (document.getElementById (kind + '_form_email_to').value.replace( new RegExp ("([a-zA-Z0-9_\\.\\-])+\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,4})$", "i"), "") != ''))
			{
				alert ('Attenzione! Il campo \'e-mail del tuo amico\' non e\' un\'indirizzo di posta elettronica valido.')
				isOK = false;
			}
		}
		if (isOK)
		{
			if (document.getElementById (kind + '_form_email_to') && document.getElementById (kind + '_form_email_to').value == '')
			{
				alert ('Attenzione! Il campo \'e-mail del tuo amico\' e\' obbligatorio.')
				isOK = false;
			}
		}
		if (isOK)
		{
			document.getElementById(kind + '_form').disabled = true;
			document.getElementById(kind + '_form').className += " off";
		}
		
		return isOK;
	}

