<!--   Gestion de la page: background et menu

function initPage(nomPage)
{
	/*document.getElementById('interface').style.backgroundImage = "url('images/index_14.gif')";
	document.getElementById('column_left').style.backgroundImage = "url('images/"+nomPage+".gif')";
	document.getElementById('content').style.backgroundImage = "url('')";*/
	MM_swapImage(''+nomPage+'','','/images/'+nomPage+'_on.gif',0);
}

function afficheMenu(rubrique,pos_x)
{
	document.getElementById(rubrique).style.left = pos_x;
	document.getElementById(rubrique).style.visibility = "visible";
	
}

function cacherMenu(rubrique)
{
	document.getElementById(rubrique).style.visibility = "hidden";
	
}

<!-- Gestion du catalogue: accordéon, compteur d'article

function afficheDetailCadeau(nomCadeau)
{
	tab = document.getElementsByTagName('div');
	for(i=0;i<tab.length;i++) {
		if (tab[ i ].className == 'cadeau')
		{
			if(tab[ i ].id == nomCadeau){
				if( tab[ i ].style.height == 'auto' ){
					tab[ i ].style.visibility = 'hidden';
					tab[ i ].style.position = 'absolute';
					tab[ i ].style.height = 0;
				}	
				else{
					tab[ i ].style.height = 'auto';
					tab[ i ].style.position = 'relative';
					tab[ i ].style.visibility = 'visible';
				}
			}
			else{
				tab[ i ].style.visibility = 'hidden';
				tab[ i ].style.position = 'absolute';
				tab[ i ].style.height = 0;
				}
		}
	}
		
}

function incrementQuantiteCadeau(refCadeau,pt)
{
	var cmd = document.getElementById('valeurCommande');
	var nouveauSolde = parseInt(cmd.innerHTML) + parseInt(pt);
	if (nouveauSolde <= document.getElementById('solde').value)
	{
		document.getElementById('nb'+refCadeau).value++;
		cmd.innerHTML = nouveauSolde;

	}
	else
		alert("Votre solde est insuffisant.");
}

function decrementQuantiteCadeau(refCadeau,pt)
{	
	var quantite = document.getElementById('nb'+refCadeau);
	if( quantite.value > 0)
	{
		quantite.value--;
		var cmd = document.getElementById('valeurCommande');
		cmd.innerHTML = parseInt(cmd.innerHTML) - parseInt(pt) ;
	}
}

var nb =0;

function get_nb(id)
{
	nb = document.getElementById('nb'+id).value;
}

function actu_solde(id,pt)
{
	var cmd = document.getElementById('valeurCommande');	
	
	if( document.getElementById('nb'+id).value >= 0 )
	{
		if(nb < document.getElementById('nb'+id).value)
			var operation = (document.getElementById('nb'+id).value - nb)*document.getElementById('pt'+id).value;
		else
			var operation = (document.getElementById('nb'+id).value - nb)*document.getElementById('pt'+id).value;
		var nouveauSolde = parseInt(cmd.innerHTML) + operation;
		if (nouveauSolde <= document.getElementById('solde').value)
			cmd.innerHTML = nouveauSolde;
		else
		{
			document.getElementById('nb'+id).value = nb;	
			alert("Votre solde est insuffisant.");
		}
	}
	else
	{
			document.getElementById('nb'+id).value = nb;
			alert('Vous ne pouvez pas avoir une quantité inférieur à 0.')
	}
}


<!-- Gestion  des sessions en AJAX


 function identification(login,password)
 {
	 getXhr()

	// On défini ce qu'on va faire quand on aura la réponse
	 xhr.onreadystatechange = function(){
		// On ne fait quelque chose que si on a tout reçu et que le serveur est ok
		if(xhr.readyState == 4 && xhr.status == 200){
			 switch(xhr.responseText){
			 	 case 'epaneliste':
						window.location.replace("/compte/compte.html");
						break;
				case 'paneliste':
						window.location.replace("/identification/paneliste.html");
						break;
				case 'delpaneliste':
						window.location.replace("/identification/panelisteannule.html");
						break;
				default:
						document.getElementById('load').style.visibility ="hidden";
						document.getElementById('login').style.visibility ="visible";
				}	

		}
	}
	
	xhr.open("GET","/identification/identification-js.php?login="+document.getElementById(login).value+"&password="+document.getElementById(password).value+"",true);
	xhr.send(null);
 }

/*window.onload = function()
 {
    //on associe la fonction verifId à
    //l'événénement onsubmit du formulaire
	if(document.getElementById('frmIdentification'))
    	document.getElementById('frmIdentification').onsubmit = "return verifId('txtlogin','txtpassword')";
 }*/
 
 function verifId(login, password)
 {
    //envoi des données
	
	document.getElementById('login').style.visibility ="hidden";
	document.getElementById('opacity').style.visibility ="visible";
	document.getElementById('load').style.visibility ="visible";
	identification(login,password);
   return false; <!--);
 }
 
 
 function login_close()
 {
	document.getElementById('login').style.visibility='hidden';
	document.getElementById('opacity').style.visibility='hidden'; 
 }
 
 <!--  Calendrier
 
 var calendar;
 
 function affiche_calendrier(p_calendar)
 {
    //envoi des données
	calendar = p_calendar;
	if(p_calendar == 'Dbt')
	{
		document.getElementById('calendrier'+p_calendar).style.visibility = 'visible';
		document.getElementById('calendrierFin').style.visibility = 'hidden';
	}
	else
	{
		document.getElementById('calendrier'+p_calendar).style.visibility = 'visible';
		document.getElementById('calendrierDbt').style.visibility = 'hidden';
	}
 }
 
  function ferme_calendrier(date)
 {
	var verif = true;
	if(date != null)
	{
		if(calendar == 'Dbt' && document.getElementById('Fin').value != '')
			verif = anteriorite_date(date,document.getElementById('Fin').value);
			
		if(calendar == 'Fin' && document.getElementById('Dbt').value != null)
			verif = anteriorite_date(document.getElementById('Dbt').value,date);
		
		if(verif)
		{
			date = date.toString();
			var annee = date.substr(0,4);
			var mois =  date.substr(4,2);
			var jour =  date.substr(6,2);
			
			document.getElementById(calendar).value = jour+'/'+mois+'/'+annee;
			
			document.getElementById('calendrier'+calendar).style.visibility = 'hidden';
		}
		else
		{
			this.value = '';
			alert('Vous ne pouvez pas entrer une date pour le retour précédent celle du départ');
			document.getElementById('calendrier'+calendar).style.visibility = 'hidden';
		}
		
	}
	else
	{
			document.getElementById('calendrier'+calendar).style.visibility = 'hidden';
	}
 }
 
 function getXhr()
{	 
	if(window.XMLHttpRequest) // Firefox et autres
	   xhr = new XMLHttpRequest(); 
	else 
		if(window.ActiveXObject){ // Internet Explorer 
		   try {
					xhr = new ActiveXObject("Msxml2.XMLHTTP");
				} catch (e) {
					xhr = new ActiveXObject("Microsoft.XMLHTTP");
				}
		}
		else { // XMLHttpRequest non supporté par le navigateur 
		   alert("Votre navigateur ne supporte pas vos commentaires!"); 
		   xhr = false; 
		}
} 

 function calendrier_mvt(date)
 {

	 getXhr()
	// On défini ce qu'on va faire quand on aura la réponse
	xhr.onreadystatechange = function(){
		// On ne fait quelque chose que si on a tout reçu et que le serveur est ok
		if(xhr.readyState == 4 && xhr.status == 200){
			document.getElementById('calendrier'+calendar).innerHTML = xhr.responseText;// ;'essai'
		}
	}
	xhr.open("GET","/getCalendrier.php?date="+date+"",true);
	xhr.send(null);
 }
 
 
 function anteriorite_date(dateDbt,dateFin)
 { 
	 dateDbt =dateDbt.toString();
	 dateFin=dateFin.toString();

	if( dateDbt.length != 8)
	{
		var jourDbt = dateDbt.substr(0,2);
		var moisDbt =  dateDbt.substr(3,2);
		var anneeDbt=  dateDbt.substr(6,4);
		var dateDbt = anneeDbt.concat(moisDbt);
		var dateDbt = dateDbt.concat(jourDbt);
		
	}

	if( dateFin.length != 8)
	{
		var anneeFin = dateFin.substr(0,2);
		var moisFin =  dateFin.substr(3,2);
		var jourFin =  dateFin.substr(6,4);
		var  dateFin= anneeFin.concat(moisFin);
		var dateFin= dateFin.concat(jourFin);
		
	}

	if( dateFin > dateDbt)
		return true;
	else
		return false;
	
 
 }

 
 function menuAll()
 {
 	document.getElementById('lnk_cadeaux').onmouseover = function(){MM_swapImage('cadeaux','','images/cadeaux_on.gif',1);afficheMenu('smCadeaux',226,111,'#B95F9E');};
	document.getElementById('lnk_cadeaux').onmouseout = function() { MM_swapImgRestore();cacherMenu('smCadeaux');};
	
	document.getElementById('lnk_boitier').onmouseover = function(){MM_swapImage('boitier','','images/boitier_on.gif',1);afficheMenu('smboitier',330,111,'#B4252E');};
	document.getElementById('lnk_boitier').onmouseout = function() { MM_swapImgRestore();cacherMenu('smboitier');};


 	document.getElementById('lnk_parrainage').onmouseover = function(){MM_swapImage('parrainage','','images/parrainage_on.gif',1);afficheMenu('smParrainage',434,111,'#F9C700');};
	document.getElementById('lnk_parrainage').onmouseout = function() { MM_swapImgRestore();cacherMenu('smParrainage');};


 	document.getElementById('lnk_marche_test').onmouseover = function(){MM_swapImage('marche_test','','images/marche_test_on.gif',1);afficheMenu('smMarche_test',538,111,'#59B124');};
	document.getElementById('lnk_marche_test').onmouseout = function() { MM_swapImgRestore();cacherMenu('smMarche_test');};


 	document.getElementById('lnk_questions').onmouseover = function(){MM_swapImage('questions','','images/questions_on.gif',1);afficheMenu('smQuestions',642,111,'#EA7300');};
	document.getElementById('lnk_questions').onmouseout = function() { MM_swapImgRestore();cacherMenu('smQuestions');};

	document.getElementById('lnk_contacts').onmouseover = function(){MM_swapImage('contacts','','images/contact_on.gif',1);afficheMenu('smContacts',746,111,'#0C2074');};
	document.getElementById('lnk_contacts').onmouseout = function() { MM_swapImgRestore();cacherMenu('smContacts');};

	document.getElementById('altSJSmenuCompte').style.visibility = 'visible';
	document.getElementById('altSJSmenuCompte').style.height = 'auto';
	
	document.getElementById('interface').style.backgroundImage = "url('images/index_14.gif')";
	document.getElementById('content').style.backgroundImage = "url('')";
	document.getElementById('column_left').style.backgroundImage = "url('')";
	
 }


<!--  Verification des formulaires

function verif_Mail(a){
	testm = 1 ;
	 for (var j=1 ; j<(a.length) ; j++) {
	  if (a.charAt(j)=='@') {
	   if (j<(a.length-4)){
		for (var k=j ; k<(a.length-2) ; k++) {
		 if (a.charAt(k)=='.') 
			testm = 0;
		}
	   }
	  }
	 }
	 if( testm == 1)
	 	document.getElementById('alertemail').innerHTML = "Votre adresse n'est pas valide";
	else {
		document.getElementById('alertemail').innerHTML = "&nbsp;";
		if( document.getElementById('email').value == document.getElementById('confemail').value){
			document.getElementById('alertconfemail').innerHTML = "&nbsp;";
			testm=0;
			}
		else
			document.getElementById('alertconfemail').innerHTML = "Votre email n'est pas confirmé";
		}

	return testm ;
	
}

function verif_naissance(id)
{
	regexp = /[0-3][0-9]\/[0-1][0-9]\/[0-9][0-9][0-9][0-9]/;
	if(regexp.exec(document.getElementById(id).value)){
		document.getElementById('alert'+id).innerHTML = "&nbsp;";
		return 0;
		}
	else{
		document.getElementById('alert'+id).innerHTML = "Votre date de naissance n'est pas valide";
		return 1;
		}
}

function verif_numCarte(id){

	regexp = /^3701455[0-9]{6}$/;
	if(regexp.exec(document.getElementById(id).value)){
		document.getElementById('alert'+id).innerHTML = "&nbsp;";
		return 0;
		}
	else{
		document.getElementById('alert'+id).innerHTML = "Champ mal renseigné";
		return 1;
		}
}

function verif_numTel(id){

	regexp = /[0-9]{10}/;
	if(regexp.exec(document.getElementById(id).value)){
		document.getElementById('alert'+id).innerHTML = "&nbsp;";
		return 0;
		}
	else{
		document.getElementById('alert'+id).innerHTML = "Champ obligatoire";
		return 1;}
}


function verif_Complet(id){
	if(document.getElementById(id).value == ""){
		document.getElementById('alert'+id).innerHTML = "Champ obligatoire";
		return 1;
	} else {
		document.getElementById('alert'+id).innerHTML = "&nbsp;";
		return 0;
	}
}

function verifForm()
{
	var args = verifForm.arguments;
	var validation = 0;
	for(var i = 0; i < args.length; i++)
	{
		switch(args[i]){
		case 'numCarte':
			validation += verif_numCarte(args[i]);
			break;
		case 'email':
			if(document.getElementById(args[i]) != null);
				validation += verif_Mail(document.getElementById(args[i]).value);
			break;
		case 'naissanceAdherent':
			validation += verif_naissance(args[i]);
			break;
		case 'numTelAdherent':
			validation += verif_numTel(args[i]);
			break;
		case 'numPortableAdherent':
			validation += verif_numTel(args[i]);
			break;
		default:
			validation += verif_Complet(args[i]);
			break;
		}
	}

	if(validation == 0)
	{
		return true;
	}
	else
		return false;
}

