function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function Popup(url)
{
	window.open(url,"Popup","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=530,height=450,left=25,top=25");
}

// validazione dell'indirizzo email
function verEmail(stringa)
{
   if (stringa.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
		return true;
   else
		return false;
}

function ControllaDati(form,lang,tipo_form)
{
	var tipo = tipo_form;
	var msgErrore = '';
	
	switch (lang)
	{
		case "eng":
			txt_errore1 = "- Username required.\n";
			txt_errore2 = "- Password required.\n";
			txt_errore3 = "- Email required.\n";
			txt_errore4 = "- Insert a valid Email.\n";
			txt_errore5 = "- Start Number required.\n";
			txt_errore6 = "- Subscription to past numbers is not available.\n";
			txt_errore7 = "- Choose type of subscription.\n";
			txt_errore8 = "- Choose price of subscription.\n";
			txt_errore9 = "- Username required.\n";
			txt_errore10 = "- Password required.\n";
			txt_errore11 = "- Password must be at least 8 characters.\n";
			txt_errore12 = "- Confirm password required.\n";
			txt_errore13 = "- Confirm password must be at least 8 characters.\n";
			txt_errore14 = "- Repeat password correctly.\n";
			txt_errore15 = "- First Name required.\n";
			txt_errore16 = "- Last Name required.\n";
			txt_errore17 = "- Adress required.\n";
			txt_errore18 = "- Civic Number required.\n";
			txt_errore19 = "- Phone Number required.\n";
			txt_errore20 = "- City required.\n";
			txt_errore21 = "- ZIP Code required.\n";
			txt_errore22 = "- Please select an italian province.\n";
			txt_errore23 = "- Email required.\n";
			txt_errore24 = "- Insert a valid Email.\n";
			txt_errore25 = "- Age required.\n";
			txt_errore26 = "- Message required.\n";
			txt_errore27 = "- Delivery Adress required.\n";
			txt_errore28 = "- Delivery Civic number required.\n";
			txt_errore29 = "- Payment type required.\n";
			txt_errore30 = "- Company Name required.\n";
			txt_errore31 = "- VAT required.\n";
			txt_errore32 = "- Adress required.\n";
			txt_errore33 = "- Civic Number required.\n";
			txt_errore34 = "- City required.\n";
			txt_errore35 = "- ZIP Code required.\n";
			txt_errore36 = "- Please select an italian province.\n";
			txt_errore37 = "- Select a type of search.\n";
			txt_errore38 = "- Free text can\'t be empty.\n";
			txt_errore39 = "- Insert a word more than 2 characters.\n";

			tit_msg_errore = "Errors found:\n\n";
			tit_msg_fattura = "\n\nFor the invoice:\n";
			tit_msg_conferma = "Choose OK to go on with your order.";
			break;
		default:
			txt_errore1 = "- Username è obbligatorio.\n";
			txt_errore2 = "- Password è obbligatorio.\n";
			txt_errore3 = "- Il campo Email non può essere vuoto.\n";
			txt_errore4 = "- Inserire un indirizzo Email corretto.\n";
			txt_errore5 = "- E\' necessario precisare da che numero deve partire l\'abbonamento.\n";
			txt_errore6 = "- Non ci si può abbonare ai numeri passati.\n";
			txt_errore7 = "- Scegliere il tipo di abbonamento.\n";
			txt_errore8 = "- Scegliere il prezzo dell\'abbonamento.\n";
			txt_errore9 = "- Username è obbligatorio.\n";
			txt_errore10 = "- Password è obbligatorio.\n";
			txt_errore11 = "- Password deve essere di almeno 8 caratteri.\n";
			txt_errore12 = "- Conferma password è obbligatorio.\n";
			txt_errore13 = "- Conferma password deve essere di almeno 8 caratteri.\n";
			txt_errore14 = "- La password deve essere ripetuta correttamente.\n";
			txt_errore15 = "- Il campo Nome non può essere vuoto.\n";
			txt_errore16 = "- Il campo Cognome non può essere vuoto.\n";
			txt_errore17 = "- Il campo Indirizzo non può essere vuoto.\n";
			txt_errore18 = "- Il campo Numero Civico non può essere vuoto.\n";
			txt_errore19 = "- Il campo Telefono non può essere vuoto.\n";
			txt_errore20 = "- Il campo Città non può essere vuoto.\n";
			txt_errore21 = "- Il campo C.A.P. non può essere vuoto.\n";
			txt_errore22 = "- Selezionare una provincia italiana.\n";
			txt_errore23 = "- Il campo Email non può essere vuoto.\n";
			txt_errore24 = "- Inserire un indirizzo Email corretto.\n";
			txt_errore25 = "- Il campo Età non può essere vuoto.\n";
			txt_errore26 = "- Il campo Messaggio non può essere vuoto.\n";
			txt_errore27 = "- Il campo Indirizzo di spedizione non può essere vuoto.\n";
			txt_errore28 = "- Il campo Numero civico di spedizione non può essere vuoto.\n";
			txt_errore29 = "- Deve essere scelto un tipo di pagamento.\n";
			txt_errore30 = "- Il campo Ragione Sociale non può essere vuoto.\n";
			txt_errore31 = "- Il campo Partita IVA non può essere vuoto.\n";
			txt_errore32 = "- Il campo Indirizzo non può essere vuoto.\n";
			txt_errore33 = "- Il campo Numero Civico non può essere vuoto.\n";
			txt_errore34 = "- Il campo Città non può essere vuoto.\n";
			txt_errore35 = "- Il campo C.A.P. non può essere vuoto.\n";
			txt_errore36 = "- Il campo Provincia non può essere vuoto.\n";
			txt_errore37 = "- Inserire almeno un criterio di ricerca.\n";
			txt_errore38 = "- Testo libero non può essere vuoto.\n";
			txt_errore39 = "- Testo libero deve essere almeno di due caratteri.\n";
			
			tit_msg_errore = "Sono stati rilevati i seguenti errori:\n\n";
			tit_msg_fattura = "\n\nPer la fatturazione:\n";
			tit_msg_conferma = "Scegliere OK per procedere all\'acquisto.";
	}

	// INIZIO login
	if (tipo == "login")
	{
		if ( (document.login.user.value == "") || ( (document.login.user.value.replace(/\s*/gi,'') == '') || (document.login.user.value.replace(/\x13\x10*/gi,'') == '')) )
			msgErrore += txt_errore1;
		
		if ( (document.login.pass.value == "") || ( (document.login.pass.value.replace(/\s*/gi,'') == '') || (document.login.pass.value.replace(/\x13\x10*/gi,'') == '')) )
			msgErrore += txt_errore2;
	}
	// FINE login
	
	// INIZIO recpw
	if (tipo == "recpw")
	{
		if ( (document.login.email.value == "") || ((document.login.email.value.replace(/\s*/gi,'') == '') || (document.login.email.value.replace(/\x13\x10*/gi,'') == '')) )
				msgErrore += txt_errore3;
		else
		{
			if (!verEmail(document.login.email.value))
				msgErrore += txt_errore4;
		}
	}
	// FINE recpw
	
	// INIZIO abbonamento o contatti o new
	if ( tipo == "abbonamento" || tipo == "contatti" || tipo == "new" )
	{
		if (tipo == "abbonamento" || tipo == "new")
		{
			var msgConferma;
			msgConferma = tit_msg_conferma;
		}

		// INIZIO new
		if ( tipo == "new" )
		{
			var el = document.forms[0].elements;
			if (document.abbonamento_ottagono.Numero.value == '')
					msgErrore += txt_errore5;
			else
			{
				if (parseInt(document.abbonamento_ottagono.Numero.value, 0) < parseInt(document.abbonamento_ottagono.nextnumber.value, 0))
					msgErrore += txt_errore6;
			}

			for(var i = 0 ; i < el.length ; ++i)
			{
				if(el[i].type == "radio")
				{
					var radiogroup = el[el[i].name]; // get the whole set of radio buttons.
					var itemchecked = false;
					for(var j = 0 ; j < radiogroup.length && el[i].name == "nuovo_rinnovo" ; ++j)
					{
						if(radiogroup[j].checked)
						{
							itemchecked = true;
							break;
						}
					}

					if(!itemchecked)
					{
						if(el[i].name == "nuovo_rinnovo")
						{
							msgErrore += txt_errore7;
							break;
						}
					}
				}
			}
			for(var i = 0 ; i < el.length ; ++i)
			{
				if(el[i].type == "radio")
				{
					var radiogroup = el[el[i].name]; // get the whole set of radio buttons.
					var itemchecked = false;
					for(var j = 0 ; j < radiogroup.length && el[i].name == "tipo_abb" ; ++j)
					{
						if(radiogroup[j].checked)
						{
							itemchecked = true;
							break;
						}
					}
	
					if(!itemchecked)
					{
						if(el[i].name == "tipo_abb")
						{
							msgErrore += txt_errore8;
							break;
						}
					}
				}
			}
		}
		// FINE new

		// INIZIO abbonamento
		if (tipo == "abbonamento")
		{
			var msgErrore_fat = '';

			// INIZIO dati login abbonamento
			if (document.abbonamento_ottagono.mod_userpass.value == "1")
			{
				if ( (document.abbonamento_ottagono.user.value == "") || ( (document.abbonamento_ottagono.user.value.replace(/\s*/gi,'') == '') || (document.abbonamento_ottagono.user.value.replace(/\x13\x10*/gi,'') == '')) )
						msgErrore += txt_errore9;
			}

			if ( (document.abbonamento_ottagono.pass.value == "") || ((document.abbonamento_ottagono.pass.value.replace(/\s*/gi,'') == '') || (document.abbonamento_ottagono.pass.value.replace(/\x13\x10*/gi,'') == '')) )
				msgErrore += txt_errore10;

			if (document.abbonamento_ottagono.pass.value.length < 8)
				msgErrore += txt_errore11;

			if ( (document.abbonamento_ottagono.pass_2.value == "") || ((document.abbonamento_ottagono.pass_2.value.replace(/\s*/gi,'') == '') || (document.abbonamento_ottagono.pass_2.value.replace(/\x13\x10*/gi,'') == '')) )
				msgErrore += txt_errore12;

			if (document.abbonamento_ottagono.pass_2.value.length < 8)
				msgErrore += txt_errore13;

			if (document.abbonamento_ottagono.pass_2.value != document.abbonamento_ottagono.pass.value)
				msgErrore += txt_errore14;
			// FINE dati login abbonamento
		}
		// FINE abbonamento

		// INIZIO comuni per contatti e abbonamento
		if (tipo != "new")
		{
			if ( (document.abbonamento_ottagono.Nome.value == "") || ((document.abbonamento_ottagono.Nome.value.replace(/\s*/gi,'') == '') || (document.abbonamento_ottagono.Nome.value.replace(/\x13\x10*/gi,'') == '')) )
				msgErrore += txt_errore15;

			if ( (document.abbonamento_ottagono.Cognome.value == "") || ((document.abbonamento_ottagono.Cognome.value.replace(/\s*/gi,'') == '') || (document.abbonamento_ottagono.Cognome.value.replace(/\x13\x10*/gi,'') == '')) )
				msgErrore += txt_errore16;

			if ( (document.abbonamento_ottagono.Indirizzo.value == "") || ((document.abbonamento_ottagono.Indirizzo.value.replace(/\s*/gi,'') == '') || (document.abbonamento_ottagono.Indirizzo.value.replace(/\x13\x10*/gi,'') == '')) )
				msgErrore += txt_errore17;

			if ( (document.abbonamento_ottagono.numerocivico.value == "") || ((document.abbonamento_ottagono.numerocivico.value.replace(/\s*/gi,'') == '') || (document.abbonamento_ottagono.numerocivico.value.replace(/\x13\x10*/gi,'') == '')) )
				msgErrore += txt_errore18;

			if ( (document.abbonamento_ottagono.Telefono.value == "") || ((document.abbonamento_ottagono.Telefono.value.replace(/\s*/gi,'') == '') || (document.abbonamento_ottagono.Telefono.value.replace(/\x13\x10*/gi,'') == '')) )
				msgErrore += txt_errore19;

			if ( (document.abbonamento_ottagono.Citta.value == "") || ((document.abbonamento_ottagono.Citta.value.replace(/\s*/gi,'') == '') || (document.abbonamento_ottagono.Citta.value.replace(/\x13\x10*/gi,'') == '')) )
				msgErrore += txt_errore20;

			if ( (document.abbonamento_ottagono.Cap.value == "") || ((document.abbonamento_ottagono.Cap.value.replace(/\s*/gi,'') == '') || (document.abbonamento_ottagono.Cap.value.replace(/\x13\x10*/gi,'') == '')) )
				msgErrore += txt_errore21;

			if ( document.abbonamento_ottagono.Stato.options[document.abbonamento_ottagono.Stato.selectedIndex].value == "3" )
			{
				if ( document.abbonamento_ottagono.Provincia.options[document.abbonamento_ottagono.Provincia.selectedIndex].value == "0" )
					msgErrore += txt_errore22;
			}

			if ( (document.abbonamento_ottagono.Email.value == "") || ((document.abbonamento_ottagono.Email.value.replace(/\s*/gi,'') == '') || (document.abbonamento_ottagono.Email.value.replace(/\x13\x10*/gi,'') == '')) )
				msgErrore += txt_errore23;
			else
			{
				if (!verEmail(document.abbonamento_ottagono.Email.value))
					msgErrore += txt_errore24;
			}

			if ( (document.abbonamento_ottagono.eta.value == "") || ((document.abbonamento_ottagono.eta.value.replace(/\s*/gi,'') == '') || (document.abbonamento_ottagono.eta.value.replace(/\x13\x10*/gi,'') == '')) )
				msgErrore += txt_errore25;
		}
		// FINE comuni per contatti e abbonamento

		// INIZIO contatti
		if (tipo == "contatti")
		{
			if ( (document.abbonamento_ottagono.testo_messaggio.value == "") || ((document.abbonamento_ottagono.testo_messaggio.value.replace(/\s*/gi,'') == '') || (document.abbonamento_ottagono.testo_messaggio.value.replace(/\x13\x10*/gi,'') == '')) )
				msgErrore += txt_errore26;
		}
		// FINE contatti

			// INIZIO abbonamento
			if (tipo == "abbonamento" )
			{
				if (document.abbonamento_ottagono.mod_ecommerce.value == "1")
				{
					if (document.abbonamento_ottagono.sped_indirizzo.value != "")
					{
						if ((document.abbonamento_ottagono.sped_indirizzo.value.replace(/\s*/gi,'') == '') || (document.abbonamento_ottagono.sped_indirizzo.value.replace(/\x13\x10*/gi,'') == ''))
							msgErrore_fat += txt_errore27;
						else
						{
							if ( (document.abbonamento_ottagono.sped_numerocivico.value == '') || (document.abbonamento_ottagono.sped_numerocivico.value.replace(/\s*/gi,'') == '') || (document.abbonamento_ottagono.sped_numerocivico.value.replace(/\x13\x10*/gi,'') == '') )
								msgErrore += txt_errore28;
						}
					}
				}

				flg_pagamento = false;
				for (i = 0; i < document.abbonamento_ottagono.pagamento.length; i++)
				{
					if (document.abbonamento_ottagono.pagamento[i].checked)
						flg_pagamento = true;
				}

				if (!flg_pagamento)
					msgErrore += txt_errore29;

				if (document.abbonamento_ottagono.fattura.checked == true)
				{
					if ( (document.abbonamento_ottagono.fat_ragionesociale.value == "") || ((document.abbonamento_ottagono.fat_ragionesociale.value.replace(/\s*/gi,'') == '') || (document.abbonamento_ottagono.fat_ragionesociale.value.replace(/\x13\x10*/gi,'') == '')) )
						msgErrore_fat += txt_errore30;

					if ( (document.abbonamento_ottagono.fat_partitaiva.value == "") || ((document.abbonamento_ottagono.fat_partitaiva.value.replace(/\s*/gi,'') == '') || (document.abbonamento_ottagono.fat_partitaiva.value.replace(/\x13\x10*/gi,'') == '')) )
						msgErrore_fat += txt_errore31;

					if ( (document.abbonamento_ottagono.fat_indirizzo.value == "") || ((document.abbonamento_ottagono.fat_indirizzo.value.replace(/\s*/gi,'') == '') || (document.abbonamento_ottagono.fat_indirizzo.value.replace(/\x13\x10*/gi,'') == '')) )
						msgErrore_fat += txt_errore32;

					if ( (document.abbonamento_ottagono.fat_numerocivico.value == "") || ((document.abbonamento_ottagono.fat_numerocivico.value.replace(/\s*/gi,'') == '') || (document.abbonamento_ottagono.fat_numerocivico.value.replace(/\x13\x10*/gi,'') == '')) )
						msgErrore_fat += txt_errore33;

					if ( (document.abbonamento_ottagono.fat_citta.value == "") || ((document.abbonamento_ottagono.fat_citta.value.replace(/\s*/gi,'') == '') || (document.abbonamento_ottagono.fat_citta.value.replace(/\x13\x10*/gi,'') == '')) )
						msgErrore_fat += txt_errore34;

					if ( (document.abbonamento_ottagono.fat_cap.value == "") || ((document.abbonamento_ottagono.fat_cap.value.replace(/\s*/gi,'') == '') || (document.abbonamento_ottagono.fat_cap.value.replace(/\x13\x10*/gi,'') == '')) )
						msgErrore_fat += txt_errore35;

					if ( document.abbonamento_ottagono.fat_paese.options[document.abbonamento_ottagono.fat_paese.selectedIndex].value == "3" )
					{
						if ( document.abbonamento_ottagono.fat_provincia.options[document.abbonamento_ottagono.fat_provincia.selectedIndex].value == "" )				{
							msgErrore_fat += txt_errore36;
					}
				}
			}
			// FINE abbonamento
		}
		// FINE comuni x abbonamento e contatti
	}
	// FINE abbonamento o contatti o new

	// INIZIO ricerca
	if (tipo == "archivio")
	{
		if ( (document.cerca.testofree.value == "") || ((document.cerca.testofree.value.replace(/\s*/gi,'') == '') || (document.cerca.testofree.value.replace(/\x13\x10*/gi,'') == '')) )
		{
			if ( document.cerca.numero.options[document.cerca.numero.selectedIndex].value=="" && document.cerca.anno.options[document.cerca.anno.selectedIndex].value=="" )
				msgErrore += txt_errore37;
			else
			{
				if (document.cerca.testofree.value != "" && document.cerca.testofree.value.length > 0)
					msgErrore += txt_errore38;
			}
		}
		else
		{
			if (document.cerca.testofree.value.length < 2)
				msgErrore += txt_errore39;
		}
	}
	// FINE ricerca

// CONTROLLI PER MSG ERRORE
	if (msgErrore != '' || (tipo == "abbonamento" && msgErrore_fat != ""))
	{
		if (tipo == "abbonamento")
		{
			if (msgErrore != '')
				if (msgErrore_fat != "")
					msgErrore = tit_msg_errore + msgErrore + tit_msg_fattura + msgErrore_fat;
				else
					msgErrore = tit_msg_errore + msgErrore;
			else
			{
				if (msgErrore_fat != "")
					msgErrore = tit_msg_errore + tit_msg_fattura + msgErrore_fat;
			}
		}
		else
			msgErrore = tit_msg_errore + msgErrore;

		/*if (tipo == "abbonamento" && msgErrore_fat != "")
			msgErrore += tit_msg_fattura + msgErrore_fat;*/
	
		alert(msgErrore);
		return false;
	}
	else
	{
		if (tipo == "abbonamento" || tipo == "new")
		{
			if(confirm(msgConferma))
				return true;
			else
				return false;
		}
		else
			return true;
	}
}

function FiltroRicerca(f,lang,tipo_form)
{
	/*
	tipo_form:
	- 1 = ricerca semplice del menu'
	- 2 = ricerca da archivio
	*/
	
	var msgErrore = "";
	var txtfree = f.testofree.value;
	
	if (tipo_form == '2')
	{
		var anno = f.anno;
		var numero = f.numero;
	}
	
	switch (lang)
	{
		case "eng":
			txt_errore1 = "- Select a type of search.\n";
			txt_errore2 = "- Insert a key word more than 2 characters.\n";
			txt_errore3 = "- Key word can't be empty.\n";

			tit_msg_errore = "Errors found:\n\n";
			break;
		default:
			txt_errore1 = "- Inserire almeno un criterio di ricerca.\n";
			txt_errore2 = "- Il testo libero deve essere almeno di 3 caratteri.\n";
			txt_errore3 = "- Il testo libero non può essere vuoto.\n";
			
			tit_msg_errore = "Sono stati rilevati i seguenti errori:\n\n";
	}

	if (tipo_form == '2')
	{
		if ( numero.options[numero.selectedIndex].value=="" && anno.options[anno.selectedIndex].value==""  )
		{
			if ( (txtfree == "") || (txtfree.replace(/\s*/gi,'') == '') || (txtfree.replace(/\x13\x10*/gi,'') == '') )
				msgErrore += txt_errore1;
			else if (txtfree.length < 3)
				msgErrore += txt_errore2;
		}
		else
		{
			if (txtfree != '')
			{
				if (txtfree.length < 3)
					msgErrore += txt_errore2;
				if ((txtfree.replace(/\s*/gi,'') == '') || (txtfree.replace(/\x13\x10*/gi,'') == ''))
					msgErrore += txt_errore3;
			}
		}
	}
	else if (tipo_form == '1')
	{
		if ( (txtfree == '') || (txtfree.replace(/\s*/gi,'') == '') || (txtfree.replace(/\x13\x10*/gi,'') == '') )
			msgErrore += txt_errore3;
		else if (txtfree.length < 3)
			msgErrore += txt_errore2;
	}
	
	if (msgErrore != "")
	{
		msgErrore = tit_msg_errore + msgErrore;
		alert(msgErrore);
		return false;
	}
	else
	{
		if (tipo_form == '2')
			return true;
		else
			f.submit();
	}
}

function Contatti(f,lingua)
{
	var controlla;
	var msgErrore = '';
	switch(lingua)
	{
		case 'eng':
			msg_errore1 = ": is required and can\'t be empty.\n"
			msg_errore2 = ": insert a valid e-mail address.\n"
			tit_msg_errore = "Errors found:\n\n";
			break;
		default:
			msg_errore1 = ": è obbligatorio e non può essere vuoto.\n"
			msg_errore2 = ": inserire un indirizzo email valido.\n"
			tit_msg_errore = "Si sono verificati i seguenti errori:\n\n";
	}
	
	for(var i=0 ; i < f.elements.length ; i++)
	{
		controlla = f.elements[i].name.substring(f.elements[i].name.length-1);
		if (controlla != '0')
		{
			switch (controlla)
			{
				case '1':
					if ( (f.elements[i].value == '') || (f.elements[i].value.replace(/\s*/gi,'') == '' ) || (f.elements[i].value.replace(/\x13\x10*/gi,'') == '') )
						msgErrore += "- " + FormattaAlert(f.elements[i].name.substring(0,f.elements[i].name.length-2)) + msg_errore1;
					break;
				case '2':
					if (!verEmail(f.elements[i].value))
						msgErrore += "- " + FormattaAlert(f.elements[i].name.substring(0,f.elements[i].name.length-2)) + msg_errore2;
					break;
			}
		}
	}
	
	if (msgErrore != '')
	{
		alert(tit_msg_errore + msgErrore);
		return false;
	}
	else
		return true;
		
}

function FormattaAlert(nome)
{
	var testo = nome;
	testo = testo.replace("§"," ");
	testo = testo.replace("[a]","à");
	testo = testo.replace("[e]","è");
	testo = testo.replace("[i]","ì");
	testo = testo.replace("[o]","ò");
	testo = testo.replace("[u]","ù");

	return testo;
}

function verificaQta(f,lingua)
{
	var controlla;
	var contacheck = 0;
	var msgErrore = '';
	switch(lingua)
	{
		case 'eng':
			msg_errore = "Select a product.\n"
			tit_msg_errore = "Errors found:\n\n";
			break;
		default:
			msg_errore = "Selezionare almeno un prodotto.\n"
			tit_msg_errore = "Si sono verificati i seguenti errori:\n\n";
	}
	
	for(var i=0 ; i < f.elements.length ; i++)
	{
		controlla = f.elements[i].name.substring(0,6);
		if (controlla == "compra" && f.elements[i].checked)
			contacheck++;
	}

	if (contacheck <= 0)
		msgErrore += msg_errore;

	if (msgErrore != '')
	{
		alert(tit_msg_errore + msgErrore);
		return false;
	}
	else
		return true;
}