function mostra_iscrizioni()
	{
  		var checkino = document.getElementById('check_iscrizioni');
  		if (checkino.checked == true)
	  		{
			swap_class('categorie','block');
	  		}
		else
			{
			swap_class('categorie','hidden');
			}
	}

function nascondi_iscrizioni()
	{
			swap_class('categorie','hidden');
	}

function mostra_desidero_registrarmi_fun()
	{
  		var checkino = document.getElementById('mostra_desidero_registrarmi');
  		if (checkino.checked == true)
	  		{
			swap_class('desidero_registrarmi','block');
	  		}
		else
			{
			swap_class('desidero_registrarmi','hidden');
			}
	}
	
function nascondi_desidero_registrarmi()
	{
			swap_class('desidero_registrarmi','hidden');
	}	
	
function checkrequired(variabile)
	{
		if (document.getElementById(variabile).value.length < 5)
			{
			alert("Il form non è stato compilato correttamente. Si prega di inserire tutti i campi obbligatori (*).")
//			document.getElementById('avviso').style.display = "block";
			return false;
			}
		else
			{
			return true;
			}
	}



// function checkrequired(which)
// 	{
// 	var pass=true
// 	if (document.images)
// 		{
// 		for (i=0;i<which.length;i++)
// 			{
// 			var tempobj=which.elements[i]
// 			if (tempobj.name.substring(0,8)=="required")
// 				{
// 				if (((tempobj.type=="text"||tempobj.type=="textarea")&&tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&tempobj.selectedIndex==-1))
// 					{
// 					pass=false
// 					break
// 					}
// 				}
// 			}
// 		}
// if (!pass)
// 	{
// 	alert("Il form non è stato compilato correttamente. Si prega di inserire tutti i campi obbligatori (*).")
// /*	document.write("Il form non è stato compilato correttamente. Si prega di inserire tutti i campi obbligatori (*).");
// 	document.getElementById(avviso).style.display = "block";
// */

// 	return false
// 	}
// else
// 	return true
// }


/* -------------------------------- */

	function textCounter(field, countfield, maxlimit) {
	if (field.value.length > maxlimit)
	field.value = field.value.substring(0, maxlimit);
	else
	countfield.value = maxlimit - field.value.length;	
	}
	
/* -------------------------------- */
	
// function	avvisa_disabilita()
// 			{
// 			document.oncontextmenu = avvisa_disabilita;
// //			alert('Tasto destro disabilitato');
// 			return(false);
// 			}
// function	riabilita ()
// 			{
// 			document.oncontextmenu = riabilita;
// 			return(true);
// 			}
	
/* -------------------------------- */

function swap_class(oggetto,classe)
	{
  var mio_oggetto = document.getElementById(oggetto);
  if(mio_oggetto)
	  	{
	    mio_oggetto.className = classe;
	  	}
	}
			
/* -------------------------------- */
	
function checktutti(variabile_1) 
	{
  with (document.form_contatti_1) 
  	{
    for (var i=0; i < elements.length; i++) 
    	{
        if (elements[i].type == 'checkbox' && elements[i].name == variabile_1)
        	{
           elements[i].checked = true;
       		}
    	}
  	}  
	}

function unchecktutti(variabile_1) 
	{
  with (document.form_contatti_1) {
    for (var i=0; i < elements.length; i++) 
    	{
        if (elements[i].type == 'checkbox' && elements[i].name == variabile_1)
        	{
           	elements[i].checked = false;
       		}
		}
	}
	}	

/* disabilita tasto destro
-------------------------------- */
		
function	avvisa_disabilita()
			{
			document.oncontextmenu = avvisa_disabilita;
//			alert('Tasto destro disabilitato');
			return(false);
			}
function	riabilita ()
			{
			document.oncontextmenu = riabilita;
			return(true);
			}
	
			
/* funzione per calcolare il prezzo in shop
----------------------------------------------------------- */

	var price_array = new Array();

	function trova_somma()
		{
			price_tot = 0;
			contatore = 0;
			while (contatore < price_array.length)
				{
					price_tot = price_tot + price_array[contatore];
					contatore = contatore + 1;
				}
			return price_tot;
		}

	function aggiorna_prezzo()
		{
			trova_somma();
			document.getElementById('prezzo').value = price_tot;
		}

	function change_value(id_da_cambiare,valore)
		{
			price_array[id_da_cambiare] 	= valore;
			aggiorna_prezzo();
		}

	function controlla_completamento()
		{
			contatore_2		= 0;
			controllore_2	= 0;		// sono i campi NON selezionati
			while (contatore_2 < price_array.length)
				{
					if (price_array[contatore_2] == null)
						{
							controllore_2 = controllore_2 + 1;
						}
					contatore_2 = contatore_2 + 1;
				}
			if (controllore_2 == 0)
				{
					return(true);
				}
			else
				{
					alert("Per procedere all'acquisto è necessario selezionare ogni campo delle opzioni.");
					return(false);
				}
		}

	function cancella_tutto()
		{
			document.form_acquisto.reset();
		}

