// JavaScript Document


/*Fonction pour l'affichage des dotations  de la page DOTATIONS*/
function afficheDotation(num)
{
	for(i=1;i<8;i++)
	{
		if(i==num)
		{
			//s'il est déjà afficher
			if(window.document.getElementById('dotation'+i).className=="visible")
			{
				window.document.getElementById('dotation'+i).className="cacher";
			}
			else
				{
				window.document.getElementById('dotation'+i).className="visible";
				}
		}
		else
			{
			window.document.getElementById('dotation'+i).className="cacher";
			}
	}
}


/*Fonction pour l'affichage des conseils de la page CONSEILS DU PRO*/
function afficheConseil(num)
{
	for(i=1;i<4;i++)
	{
		if(i==num)
		{
			//s'il est déjà afficher
			if(window.document.getElementById('conseil'+i).className=="visible")
			{
				window.document.getElementById('conseil'+i).className="cacher";
			}
			else
				{
				window.document.getElementById('conseil'+i).className="visible";
				}
		}
		else
			{
			window.document.getElementById('conseil'+i).className="cacher";
			}
	}
}


function actif(num)
{
nbDiv=3;

	for (i=1;i<(nbDiv+1);i++)
	{
		//alert (window.document.getElementById('bulle'+i+'-on').className);
		if(i==num){
			
		window.document.getElementById('bulle'+i+'-off').className="bulle-inactive cacher";//on cache la version off
		window.document.getElementById('bulle'+i+'-on').className="bulle-active visible";// on affiche la version on
		/*window.document.getElementById('td'+i+'_g').className="bulleV_g";
		window.document.getElementById('td'+i+'_m').className="active";
		window.document.getElementById('td'+i+'_d').className="bulleV_d";
		window.document.getElementById('img'+i).className="picV";*/
		//alert ('td'+i+'_d' +window.document.getElementById('td'+i+'_d').className);
		}
		else
		{
		window.document.getElementById('bulle'+i+'-off').className="bulle-inactive visible";//on affiche la version off
		window.document.getElementById('bulle'+i+'-on').className="bulle-active cacher";// on cache la version on
		/*window.document.getElementById('bulle'+i).className="bulle-inactive";
		window.document.getElementById('td'+i+'_g').className="bulleB_g";
		window.document.getElementById('td'+i+'_m').className="inactive";
		window.document.getElementById('td'+i+'_d').className="bulleB_d";
		window.document.getElementById('img'+i).className="picB";*/
		}
	}
}

function iniTheme2()
{
    window.document.getElementById('bulle1-off').style.visibility = "hidden";
    window.document.getElementById('bulle1-on').style.visibility = "hidden";
    window.document.getElementById('bulle2-off').style.visibility = "hidden";
    window.document.getElementById('bulle2-on').style.visibility = "hidden";
    window.document.getElementById('bulle3-off').style.visibility = "hidden";
    window.document.getElementById('bulle3-on').style.visibility = "hidden";        
}


function iniTheme(theme) {

    if ( theme == "" ) {
		    window.document.getElementById('bulle1-off').className="bulle-inactive visible";//on cache la version off
		    window.document.getElementById('bulle1-on').className="bulle-active cacher";// on affiche la version on
    		
		    window.document.getElementById('bulle2-off').className="bulle-inactive visible";//on cache la version off
		    window.document.getElementById('bulle2-on').className="bulle-active cacher";// on affiche la version on
    		
		    window.document.getElementById('bulle3-off').className="bulle-inactive visible";//on cache la version off
		    window.document.getElementById('bulle3-on').className="bulle-active cacher";// on affiche la version on
		}
    if (theme == "B5443457-E986-4351-A8AF-E4D05195FB79" ) 
    {
		    window.document.getElementById('bulle1-off').className="bulle-inactive cacher";//on cache la version off
		    window.document.getElementById('bulle1-on').className="bulle-active visible";// on affiche la version on
    		
		    window.document.getElementById('bulle2-off').className="bulle-inactive visible";//on cache la version off
		    window.document.getElementById('bulle2-on').className="bulle-active cacher";// on affiche la version on
    		
		    window.document.getElementById('bulle3-off').className="bulle-inactive visible";//on cache la version off
		    window.document.getElementById('bulle3-on').className="bulle-active cacher";// on affiche la version on    
    }	
    if ( theme == "CE573773-5219-4C0A-AFE6-DE619904BCEA" ) {
		    window.document.getElementById('bulle1-off').className="bulle-inactive visible";//on cache la version off
		    window.document.getElementById('bulle1-on').className="bulle-active cacher";// on affiche la version on
    		
		    window.document.getElementById('bulle2-off').className="bulle-inactive cacher";//on cache la version off
		    window.document.getElementById('bulle2-on').className="bulle-active visible";// on affiche la version on
    		
		    window.document.getElementById('bulle3-off').className="bulle-inactive visible";//on cache la version off
		    window.document.getElementById('bulle3-on').className="bulle-active cacher";// on affiche la version on
		}
    if ( theme == "49E54197-1DED-4998-94C5-4831BAF29CB8" ) {
		    window.document.getElementById('bulle1-off').className="bulle-inactive visible";//on cache la version off
		    window.document.getElementById('bulle1-on').className="bulle-active cacher";// on affiche la version on
    		
		    window.document.getElementById('bulle2-off').className="bulle-inactive visible";//on cache la version off
		    window.document.getElementById('bulle2-on').className="bulle-active cacher";// on affiche la version on
    		
		    window.document.getElementById('bulle3-off').className="bulle-inactive cacher";//on cache la version off
		    window.document.getElementById('bulle3-on').className="bulle-active visible";// on affiche la version on
		}		    	
		
	
}


/*Fonction pour l'affichage des articels de la page REGLEMENT*/
function affiche(art)
{
	for(i=1;i<17;i++)
	{
		if(i==art)
		{
			//s'il est déjà afficher
			if(window.document.getElementById('art'+i).className=="visible")
			{
				window.document.getElementById('art'+i).className="cacher";
			}
			else
				{
				window.document.getElementById('art'+i).className="visible";
				}
		}
		else
			{
			window.document.getElementById('art'+i).className="cacher";
			}
	}
}


/*Fonction pour l'affichage des panneaux participez et deja isncrit*/
function affichePano(num)
{
	for(i=1;i<3;i++)
	{
		if(i==num)
		{
			
		window.document.getElementById('onglet').className="bloc-haut"+i;
		window.document.getElementById('pano'+i).className="bloc-bas visible";
		
		}
		else
			{
			window.document.getElementById('pano'+i).className="bloc-bas cacher";
			}
	}
}

function verifMail(thisForm) {
var email = thisForm.email.value;
var aroba = email.indexOf("@");
if (aroba == -1) {

return false;
}
var point = email.indexOf(".", aroba);
if ((point == -1) || (point == (aroba + 1))) {

return false;
}
var point = email.lastIndexOf(".");
if ((point + 1) == email.length) {

return false;
}
var point = email.indexOf("..")
if (point != -1) {
return false;
}
return true;
}
function verifMail2(thisForm) {
var email = thisForm.admail.value;
var aroba = email.indexOf("@");
if (aroba == -1) {

return false;
}
var point = email.indexOf(".", aroba);
if ((point == -1) || (point == (aroba + 1))) {

return false;
}
var point = email.lastIndexOf(".");
if ((point + 1) == email.length) {

return false;
}
var point = email.indexOf("..")
if (point != -1) {
return false;
}
return true;
}

/*Vérification des champs pour S'INSCRIRE*/
function verif_inscription(thisForm)
{

   if(thisForm.nom.value == '')
    {
         alert('Le champ Nom doit \352tre rempli');
         thisForm.nom.focus();
		 return false;
    }
	if(thisForm.prenom.value == '')
    {
         alert('Le champ Pr\350nom doit \352tre rempli');
         thisForm.prenom.focus();
         return false;
    }
	if(thisForm.adresse.value == '')
    {
         alert('Le champ Adresse doit \352tre rempli');
         thisForm.adresse.focus();
         return false;
    }

    if(thisForm.cp.value == '')
    {
         alert('Le champ Code Postal doit \352tre rempli');
         thisForm.cp.focus();
         return false;
    }

	if(thisForm.ville.value == '')
    {
         alert('Le champ Ville doit \352tre rempli');
         thisForm.ville.focus();
         return false;
    }
	
    if(thisForm.email.value == '')
    {
         alert('Le champ E-mail doit \352tre rempli');
         thisForm.email.focus();
         return false;
    }
	
    if (!verifMail(thisForm))
    {
         alert('Merci de bien vouloir renseigner une adresse email correcte dans le champ email');
         thisForm.email.focus();
         return false;
    }
    if(thisForm.login.value == '')
    {
         alert('Le champ Login doit \352tre rempli');
         thisForm.login.focus();
         return false;
    }
	if(thisForm.mdp.value == '')
    {
         alert('Le champ Mot de Passe doit \352tre rempli');
         thisForm.mdp.focus();
         return false;
    }
	if(thisForm.mdp2.value == '')
    {
         alert('Le champ Verification Mot de Passe doit \352tre rempli');
         thisForm.mdp2.focus();
         return false;
    }
	if(thisForm.mdp2.value != thisForm.mdp.value )
    {
         alert('Le mot de passe n\'est pas identique dans les deux champs');
         thisForm.mdp.focus();
         return false;
    }
	
	if(thisForm.elements[9].checked == false)
	{
		alert('Vous devez accepter les conditions pour vous inscrire');	
		return false;
	}
	
    return true;

}

/*Vérification des champs pour S'IDENTIFIER*/
function verif_loggue()
{
	
	if(document.identification.login.value == '')
    {
         alert('Le champ Login doit \352tre rempli');
         document.identification.login.focus();
		 return false;
    }
	
	if(document.identification.mdp.value == '')
    {
         alert('Le champ Mot de Passe doit \352tre rempli');
         document.identification.mdp.focus();
         return false;
    }
	
	document.identification.submit();
}

/*Vérification des champs pour S'IDENTIFIER*/
function verif_loggue2()
{
	
	if(document.identification2.login.value == '')
    {
         alert('Le champ Login doit \352tre rempli');
         document.identification2.login.focus();
		 return false;
    }
	
	if(document.identification2.mdp.value == '')
    {
         alert('Le champ Mot de Passe doit \352tre rempli');
         document.identification2.mdp.focus();
         return false;
    }
	
	document.identification2.submit();
}

/*Vérification des champs pour ABONNEMENT NEWSLETTER*/
function verif_newsletter()
{
	
	if(document.newsletter.email.value == '')
    {
         alert('Le champ Email doit \352tre rempli');
         document.newsletter.email.focus();
		 return false;
    }
	
	 if (!verifMail(document.newsletter))
    {
         alert('Merci de bien vouloir renseigner une adresse email correcte dans le champ email');
         document.newsletter.email.focus();
         return false;
    }
	
	document.newsletter.submit();
}


/*Vérification des champs pour POSTER UNE PHOTO*/
function verif_poster(thisForm2)
{
	 if(thisForm2.photo.value == '')
    {
         alert('Vous devez ciblez une photo');
         thisForm2.photo.focus();
		 return false;
    }
	if(thisForm2.titre.value == '')
    {
         alert('Le champ Titre doit \352tre rempli');
         thisForm2.titre.focus();
         return false;
    }
	
	 if(thisForm2.theme.value == 'choisir')
    {
         alert('Vous devez choisir le th\350me de votre photo');
         thisForm2.theme.focus();
		 return false;
    }
	
	if(thisForm2.motscles.value == '')
    {
         alert('Le champ Mots Cl\351s doit \352tre rempli');
         thisForm2.motscles.focus();
         return false;
    }

    if(thisForm2.commentaire.value == '')
    {
         alert('Le champ Commentaire doit \352tre rempli');
         thisForm2.commentaire.focus();
         return false;
    }

	if(thisForm2.elements[4].checked == false)
	{
		alert('Vous devez accepter les conditions pour vous inscrire');	
		return false;
	}
	
    return true;

}

/*Vérification des champs pour LE FORMULAIRE CONTACT*/
function verif_contact(thisForm3)
{	
	if(thisForm3.admail.value == '')
    {
         alert('Le champ Email doit \352tre rempli');
         thisForm3.admail.focus();
         return false;
    }
	if (!verifMail2(document.contact))
    {
         alert('Merci de bien vouloir renseigner une adresse email correcte dans le champ email');
         thisForm3.admail.focus();
         return false;
    }
	if(thisForm3.message.value == '')
    {
         alert('Le champ Message doit \352tre rempli');
         thisForm3.message.focus();
         return false;
    }
	return true;
}
