// JavaScript Document

function changeAction(nomForm, destination){

	document.forms[nomForm].action=destination

}

function valider(nomForm, destination){

	changeAction(nomForm, destination);

	document.forms[nomForm].submit();

}

function verifNewMessage (nomForm, destination){ // Ajout Henriette mars 2008 - forum 
	if (!document.forms[nomForm].id_participant.value) { 
		alert('Merci de sélectionner un participant.\nSi votre nom ne figure pas dans la liste des participants, n\'usurpez pas l\identité de quelqu\'un d\autre mais inscivez vous.');
		document.forms[nomForm].id_participant.focus();
	} else valider(nomForm, destination);

}

function verifNewParticipant (nomForm, destination){ // Ajout Henriette mars 2008 - forum 
	if (!document.forms[nomForm].societe.value) { 
		alert('Merci de renseigner le nom de la société');
		document.forms[nomForm].societe.focus();
	} else if (!document.forms[nomForm].nom.value) { 
		alert('Merci de préciser votre nom');
		document.forms[nomForm].nom.focus();
	} else if (!document.forms[nomForm].prenom.value) { 
		alert('Merci de préciser votre prénom');
		document.forms[nomForm].prenom.focus();
	} else if (!document.forms[nomForm].fonction.value) { 
		alert('Merci de préciser votre fonction');
		document.forms[nomForm].fonction.focus();
	} else if (!document.forms[nomForm].email.value) { 
		alert('Merci de préciser votre email');
		document.forms[nomForm].email.focus();
	} else if (!document.forms[nomForm].tel.value) { 
		alert('Merci de préciser votre numéro de téléphone');
		document.forms[nomForm].tel.focus();
	} else valider(nomForm, destination);

}

function confirmErase(nomForm, destination){

	conf=confirm("êtes vous sûr(e) de vouloir supprimer cette donnée");

	if (conf==true){

		valider(nomForm, destination);

	}

}

function verifFormClient(nomForm, destination){

	message="les champs suivants doivent être remplis\n";

	error=0;

	if (document.forms[nomForm].nom.value==""){

		error=error+1;

		message=message+"- nom\n";

	}

	if (document.forms[nomForm].password.value==""){

		error=error+1;

		message=message+"- mot de passe\n";

	}

	if (document.forms[nomForm].contact.value==""){

		error=error+1;

		message=message+"- contact\n";

	}

	if (error>0){

		alert (message);

		changeAction(nomForm, destination);

	}

}

function verifInscription(nomForm, destination){

	message="les champs suivants doivent être remplis\n";

	error=0;

	if (document.forms[nomForm].nom.value==""){

		error=error+1;

		message=message+"- nom\n";

	}

	if (document.forms[nomForm].prenom.value==""){

		error=error+1;

		message=message+"- prenom\n";

	}

	if (document.forms[nomForm].email.value==""){

		error=error+1;

		message=message+"- email\n";

	}

	if (error>0){

		alert (message);

		

	}else{

		valider(nomForm, destination);

	}

}


function MontrerCalque () { // paramètres (calque1,calque2,...)
  var i,args=MontrerCalque.arguments; 
  for (i=0; i<(args.length); i+=1) {   
  	//alert('test222');
	if (document.layers) {
    	document[args[i]].visibility = 'visible';
		document[args[i]].height = '100%';
	} else if (document.all) {
		document.all[args[i]].style.visibility = 'visible';
		document.all[args[i]].style.height = '100%';
	} else if (document.getElementById) {
    	document.getElementById(args[i]).style.visibility = 'visible';
		document.getElementById(args[i]).style.height = '100%';
	}
  }
}


function CacherCalque () { // paramètre (calque1,calque2,...)
  var i,args=CacherCalque.arguments;
  for (i=0; i<(args.length); i+=1) {
  	if (document.layers) {
    	document[args[i]].visibility = 'hidden';
		document[args[i]].height = '0';
	} else if (document.all) {
    	document.all[args[i]].style.visibility = 'hidden';
		document.all[args[i]].style.height = '0';
	} else if (document.getElementById) {
    	document.getElementById(args[i]).style.visibility = 'hidden';
		document.getElementById(args[i]).style.height = '0';
  	}
  }
}

