function ValiderPeriodeComplete()
{
	if ( document.FormAbonnement.VOCA_PERIODE0.checked )
	{
		for ( i = 1 ; i < 6 ; i++ )
		{
			periode_totale = eval ( "document.FormAbonnement.VOCA_PERIODE" + i );
			periode_totale.checked = false;
		}
	}
	return CalculerCout();
}

function ValiderPeriodePartielle()
{
	if ( document.FormAbonnement.VOCA_PERIODE1.checked  || document.FormAbonnement.VOCA_PERIODE2.checked  || document.FormAbonnement.VOCA_PERIODE3.checked  || document.FormAbonnement.VOCA_PERIODE4.checked  || document.FormAbonnement.VOCA_PERIODE5.checked )
	{
		document.FormAbonnement.VOCA_PERIODE0.checked = false;
	}
	return CalculerCout();
}

function ValiderCommandePeriodeComplete()
{
	if ( document.FormCommande.VOCA_PERIODE0.checked )
	{
		for ( i = 1 ; i < 6 ; i++ )
		{
			periode_totale = eval ( "document.FormCommande.VOCA_PERIODE" + i );
			periode_totale.checked = false;
		}
	}
	return CalculerCoutCommande();
}

function ValiderCommandePeriodePartielle()
{
	if ( document.FormCommande.VOCA_PERIODE1.checked  || document.FormCommande.VOCA_PERIODE2.checked  || document.FormCommande.VOCA_PERIODE3.checked  || document.FormCommande.VOCA_PERIODE4.checked  || document.FormCommande.VOCA_PERIODE5.checked )
	{
		document.FormCommande.VOCA_PERIODE0.checked = false;
	}
	return CalculerCoutCommande();
}

function ValiderLivretComplet()
{
	if ( document.FormCommande.livret0.checked )
	{
		for ( i = 1 ; i < 6 ; i++ )
		{
			livret_total = eval ( "document.FormCommande.livret" + i );
			livret_total.checked = false;
		}
	}
	return CalculerCoutCommande();
}

function ValiderLivretPartiel()
{
	if ( document.FormCommande.livret1.checked  || document.FormCommande.livret2.checked  || document.FormCommande.livret3.checked  || document.FormCommande.livret4.checked  || document.FormCommande.livret5.checked )
	{
		document.FormCommande.livret0.checked = false;
	}
	return CalculerCoutCommande();
}

function CalculerCout()
{
	coefficient_1 = 0;
	coefficient_2 = 0;
	niveau_selectionne = 0;
	for ( i = 0 ; i < 5 ; i++ )
	{
		niveau_en_cours = eval ( "document.FormAbonnement.elements['VOCA_NIVEAU[]'][" + i + "]" );
		if ( niveau_en_cours.checked )
		{
			niveau_selectionne = niveau_selectionne + 1;
		}
	}
	coefficient_1 = 50 * niveau_selectionne;
	coefficient_2 = 15 * niveau_selectionne;
	if ( document.FormAbonnement.VOCA_PERIODE0.checked )
	{
		document.FormAbonnement.VOCA_MONTANT.value= coefficient_1 +" €";
	}
	else
	{
		var periode_cochee=0;
		for ( i = 1 ; i < 6 ; i++ )
		{
			periode_totale = eval ( "document.FormAbonnement.VOCA_PERIODE" + i );
			if ( periode_totale.checked )
			{
				periode_cochee = periode_cochee + 1;
			}
		}
		if ( periode_cochee == 5 )
		{
			document.FormAbonnement.VOCA_MONTANT.value= coefficient_1 +" €";
		}
		else
		{
			document.FormAbonnement.VOCA_MONTANT.value= eval ( coefficient_2 * periode_cochee ) + " €";
		}
	}
}

function CalculerCoutCommande()
{
	coefficient_1 = 0;
	coefficient_2 = 0;
	niveau_selectionne = 0;
	MontantCommande = 0;
	MontantLivret = 0;
	MontantAbonnement = 0;
	
	
	if ( document.FormCommande.livret0.checked )
	{
		MontantLivret = 35;
	}
	else
	{
		var livret_coche = 0;
		for ( i = 1 ; i < 6 ; i++ )
		{
			livret_total = eval ( "document.FormCommande.livret" + i );
			if ( livret_total.checked )
			{
				livret_coche = livret_coche + 1;
			}
		}
		if ( livret_coche == 5 )
		{
			MontantLivret = 35;
		}
		else
		{
			MontantLivret = 12 * livret_coche;
		}
	}

	for ( i = 0 ; i < 5 ; i++ )
	{
		niveau_en_cours = eval ( "document.FormCommande.elements['VOCA_NIVEAU[]'][" + i + "]" );
		if ( niveau_en_cours.checked )
		{
			niveau_selectionne = niveau_selectionne + 1;
		}
	}
	coefficient_1 = 50 * niveau_selectionne;
	coefficient_2 = 15 * niveau_selectionne;
	if ( document.FormCommande.VOCA_PERIODE0.checked )
	{
		MontantAbonnement = coefficient_1;
	}
	else
	{
		var periode_cochee=0;
		for ( i = 1 ; i < 6 ; i++ )
		{
			periode_totale = eval ( "document.FormCommande.VOCA_PERIODE" + i );
			if ( periode_totale.checked )
			{
				periode_cochee = periode_cochee + 1;
			}
		}
		if ( periode_cochee == 5 )
		{
			MontantAbonnement = coefficient_1;
		}
		else
		{
			MontantAbonnement = coefficient_2 * periode_cochee;
		}
	}
	document.FormCommande.VOCA_MONTANT.value = eval ( MontantLivret + MontantAbonnement ) + " €";
}

function impr()
{
	var nav=navigator.appName;
	var ver=parseInt(navigator.appVersion);
	if ( ( nav == "Netscape" && ver[0] <4 ) || (nav == "Microsoft Internet Explorer"  && ver[0] <5))
		alert("Pour imprimer taper Ctrl p ou Fichier/Imprimer");
	else
	{
		window.print();
	}
}

function ChangeNiveau( NiveauActuel )
{
	if ( document.SelectionNiveauPeriode.NiveauActuel.value != NiveauActuel )
	{
		document.SelectionNiveauPeriode.submit();
	}
}

function ChangePeriode( PeriodeActuel )
{
	if ( document.SelectionNiveauPeriode.PeriodeActuel.value != PeriodeActuel )
	{
		document.SelectionNiveauPeriode.submit();
	}
}

