
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}



	function recupPassword() {
	document.getElementById('message_recup').innerHTML="<img src=\"images/indicator.gif\"> Envoi des informations de connexion";
	new Ajax.Request('ajax/recupPassword_ajax.php',   {
	method:'post',
	parameters: $H({
	'email' : $F("email")}),
	onSuccess: function(transport){

	var response = transport.responseText || "no response";
	document.getElementById('message_recup').innerHTML=response;
	    },
	onFailure: function(){ alert('Something went wrong...') }   });

	}


	function mails_decouvrir() {
	document.getElementById('message_info').innerHTML="<img src=\"images/indicator.gif\"> Envoi de l'email";
	new Ajax.Request('ajax/mail_decouvrir_ajax.php',   {
	method:'post',
	parameters: $H({
	'email' : $F("email"), 'nom' : $F("nom"), 'emails' : $F("emails"), 'message' : $F("message"), 'confirmation' : $F("confirmation")}),
	onSuccess: function(transport){

	var response = transport.responseText || "no response";
	document.getElementById('message_info').innerHTML=response;
	    },
	onFailure: function(){ alert('Something went wrong...') }   });

	}

	/**
 *	Fonction verifiant le bon format d'un
 *	code postal en verifiant si celui ci
 *	est bien composé de 10 chiffres
 *
 *	@param num cp code postal a verifier
 */
function checkCP(cp)
{
	//Expression régulière on vérifit si il y a 10 chiffres
	var chiffres = /^[0-9]{5}$/;
	if (chiffres.test(cp))
	{
		return true;
	}
	else
	{
		return false;
	}
}
/**
 *
 *
 *
 */
function faxNum(number)
{
	//Expression régulière on vérifit si il y a 10 chiffres
	var chiffres = /([0]{1})([1-5|8]{1})([0-9]{8})$/
	if (chiffres.test(number))
	{
		return true;
	}
	else
	{
		return false;
	}
}
/**
 *	Fonction verifiant le bon format d'un
 *	numero de téléphone fixe ou GSM en
 *	verifiant qu'il est bien composé de
 *	10 chiffres commencant par 0 et 1|2|3|4|5|6
 *
 *	@param num number numero de téléphone
 */
function TelephoneNum(number)
{
	//Expression régulière on vérifit si il y a 10 chiffres
	var chiffres = /([0]{1})([1-6]{1})([0-9]{8})$/
	if (chiffres.test(number))
	{
		return true;
	}
	else
	{
		return false;
	}
}
/**
 *	Fonction verifiant le bon format d'un
 *	numero de téléphone fixe en verifiant
 *	qu'il est bien composé de 10 chiffres
 *	commencant par 0 et 1|2|3|4|5
 *
 *	@param num number numero de téléphone
 */
function TelephoneNumFix(number)
{
	//Expression régulière on vérifit si il y a 10 chiffres
	var chiffres = /([0]{1})([1-5]{1})([0-9]{8})$/
	if (chiffres.test(number))
	{
		return true;
	}
	else
	{
		return false;
	}
}
/**
 *	Fonction verifiant le bon format d'un
 *	numero de téléphone GSM en verifiant
 *	qu'il est bien composé de 10 chiffres
 *	commencant par 0 et 6
 *
 *	@param num number numero de téléphone
 */
function GSMNum(number)
{
	//Expression régulière on vérifit si il y a 10 chiffres
	var chiffres = /([0]{1})([6]{1})([0-9]{8})$/
	if (chiffres.test(number))
	{
		return true;
	}
	else
	{
		return false;
	}
}
/**
 *	Fonction verifiant le bon format d'un E-mail
 *	à l'aide des expressions régulières définies
 *	dans les variables
 *
 *	@param string email email correctement formaté
 */
function checkEmail(email)
{
	var proto  = "(mailto:)?";
	var usr    = "([a-zA-Z0-9][a-zA-Z0-9_.-]*|\"([^\\\\\x80-\xff\015\012\"]|\\\\[^\x80-\xff])+\")";
	var domain = "([a-zA-Z0-9][a-zA-Z0-9._-]*\\.)*[a-zA-Z0-9][a-zA-Z0-9._-]*\\.[a-zA-Z]{2,5}";
	var regex  = "^" + proto + "?" + usr + "\@" + domain + "$";

	var rgx    = new RegExp(regex);
	return rgx.exec(email) ? true : false;
}
/*######################################################################################################
								ZONE DE CONTRÔLE DE FORMULAIRES
########################################################################################################*/
/**
 *	Fonction de contrôle d'un formulaire avec des champs
 *	obligatoires lors du submit.
 *
 *	@exemple	a placer sur l'événement onclick d'un formulaire
 *				avec comme champ obligatoire le Prenom qui est
 *				donc placé en position 0. Il faut modifier le
 *				contenu de l'expression regulière champOblig.
 *
 *				return(verifForm([Prenom,"Prenom",Nom,"Nom"]))
 */
function verifForm(champs)
{
	var messageini 	= "Veuillez vérifier les champs suivants: \r \n";
	var message		= messageini;
	var message;
	var champOblig	= /^(0|2|12|14|20|24)$/;

	for(var i=0; i <= (champs.length-1); i=i+2)
	{
		//alert(i);
		//champs[i].style.backgroundColor = "#FEE27C";
		//Verification des champs obligatoires
		if(champOblig.test(i))
		{
			//Si le champ est vide on ajoute un message d'erreur
			if(champs[i].value =="")
			{
				message += "- Le champ "+champs[i+1]+" est obligatoire\r \n";
				champs[i].style.backgroundColor = "#FFF0CF";
			}
			else if(i == 20) //E-mail
			{
				if(checkEmail(champs[i].value) == false)
				{
					message += "- Mauvais format pour le champ "+champs[i+1]+"\r \n";
					champs[i].style.backgroundColor = "#FAC6B0";
				}
				else
				{
					champs[i].style.backgroundColor = "#ffffff";
				}
			}
			else
			{
				champs[i].style.backgroundColor = "#ffffff";
			}
		}
	}

	if ( messageini.length !=  message.length)
    {
		window.alert(message);
		return false;
	}
    else
    {
		return true;
	}
}

function verifFormAnnonc(champs)
{
	var messageini 	= "Veuillez vérifier les champs suivants: \r \n";
	var message		= messageini;
	var message;
	var champOblig	= /^(0|2|4|6|8)$/;

	for(var i=0; i <= (champs.length-1); i=i+2)
	{
		//alert(i);
		//champs[i].style.backgroundColor = "#FEE27C";
		//Verification des champs obligatoires
		if(champOblig.test(i))
		{
			//Si le champ est vide on ajoute un message d'erreur
			if(champs[i].value =="")
			{
				message += "- Le champ "+champs[i+1]+" est obligatoire\r \n";
				champs[i].style.backgroundColor = "#788FA1";
			}
			else if(i == 6) //E-mail
			{
				if(checkEmail(champs[i].value) == false)
				{
					message += "- Mauvais format pour le champ "+champs[i+1]+"\r \n";
					champs[i].style.backgroundColor = "#FAC6B0";
				}
				else
				{
					champs[i].style.backgroundColor = "#ffffff";
				}
			}
			else
			{
				champs[i].style.backgroundColor = "#ffffff";
			}
		}
		else if(i == 10  && champs[i].value != "") //Code postal
		{
			if(checkCP(champs[i].value) == false)
			{
				message += "- Mauvais format pour le champ "+champs[i+1]+"\r \n";
				champs[i].style.backgroundColor = "#FAC6B0";
			}
			else
			{
				champs[i].style.backgroundColor = "#ffffff";
			}
		}
		else if(i == 12 && champs[i].value != "") //Telephone
		{
			if(TelephoneNum(champs[i].value) == false)
			{
				message += "- Mauvais format pour le champ "+champs[i+1]+"\r \n";
				champs[i].style.backgroundColor = "#FAC6B0";
			}
			else
			{
				champs[i].style.backgroundColor = "#ffffff";
			}
		}
		else if(i == 14 && champs[i].value != "") //fax
		{
			if(faxNum(champs[i].value) == false)
			{
				message += "- Mauvais format pour le champ "+champs[i+1]+"\r \n";
				champs[i].style.backgroundColor = "#FAC6B0";
			}
			else
			{
				champs[i].style.backgroundColor = "#ffffff";
			}
		}
	}

	if ( messageini.length !=  message.length)
    {
		window.alert(message);
		return false;
	}
    else
    {
		return true;
	}
}

function verifFormNews(champs)
{
	var messageini 	= "Veuillez vérifier les champs suivants: \r \n";
	var message		= messageini;
	var message;
	var champOblig	= /^(0|2|4)$/;

	for(var i=0; i <= (champs.length-1); i=i+2)
	{
		//alert(i);
		//champs[i].style.backgroundColor = "#FEE27C";
		//Verification des champs obligatoires
		if(champOblig.test(i))
		{
			//Si le champ est vide on ajoute un message d'erreur
			if(champs[i].value =="")
			{
				message += "- Le champ "+champs[i+1]+" est obligatoire\r \n";
				champs[i].style.backgroundColor = "#788FA1";
			}
			else if(i == 4) //E-mail
			{
				if(checkEmail(champs[i].value) == false)
				{
					message += "- Mauvais format pour le champ "+champs[i+1]+"\r \n";
					champs[i].style.backgroundColor = "#FAC6B0";
				}
				else
				{
					champs[i].style.backgroundColor = "#ffffff";
				}
			}
			else
			{
				champs[i].style.backgroundColor = "#ffffff";
			}
		}
		else if(i == 10  && champs[i].value != "") //Code postal
		{
			if(checkCP(champs[i].value) == false)
			{
				message += "- Mauvais format pour le champ "+champs[i+1]+"\r \n";
				champs[i].style.backgroundColor = "#FAC6B0";
			}
			else
			{
				champs[i].style.backgroundColor = "#ffffff";
			}
		}
		else if(i == 12 && champs[i].value != "") //Telephone
		{
			if(TelephoneNum(champs[i].value) == false)
			{
				message += "- Mauvais format pour le champ "+champs[i+1]+"\r \n";
				champs[i].style.backgroundColor = "#FAC6B0";
			}
			else
			{
				champs[i].style.backgroundColor = "#ffffff";
			}
		}
		else if(i == 14 && champs[i].value != "") //fax
		{
			if(faxNum(champs[i].value) == false)
			{
				message += "- Mauvais format pour le champ "+champs[i+1]+"\r \n";
				champs[i].style.backgroundColor = "#FAC6B0";
			}
			else
			{
				champs[i].style.backgroundColor = "#ffffff";
			}
		}
	}

	if ( messageini.length !=  message.length)
    {
		window.alert(message);
		return false;
	}
    else
    {
		return true;
	}
}

/**
 *	Fonction de contrôle d'un formulaire avec champs radio
 *	et verification de la correspondance d'un password
 */
function submitForm(champs)
{
	var messageini 		= "Veuillez vérifier les champs suivants: \r \n";
	var message			= messageini;
	var radioCiv		= 0;

	//Radio civilité
	for(j=0;j <= 2; j++)
	{
		if(infos_custom.civilite[j].checked)
		{
			radioCiv=1;
		}

	}
	if(radioCiv==0)
	{
		message += "- Le champ civilité est obligatoire\r \n";
	}
	if(i == 22)		//Password
	{
		if(champs[22].value != "" && champs[24].value != "")
		{
			if(champs[22].value != "")
			{
				if(champs[22].value != champs[24].value)
				{
					message += "- La verification du mot de passe est mauvaise\r \n";
					champs[22].style.backgroundColor = "#FBA602";
					champs[24].value = "";
					champs[24].style.backgroundColor = "#FBA602";

				}
				else
				{
					champs[22].style.backgroundColor = "#ffffff";
					champs[24].style.backgroundColor = "#ffffff";
				}
			}
		}
		else if(champs[22].value != "" && champs[24].value == "")
		{
			message += "- Vous devez renseigner le champ de verification du mot de passe\r \n";
			champs[24].style.backgroundColor = "#FBA602";
		}
		else if(champs[22].value == "" && champs[24].value != "")
		{
			message += "- Vous devez renseigner le champ mot de passe\r \n";
			champs[22].style.backgroundColor = "#FBA602";
		}
		else
		{
			champs[22].style.backgroundColor = "#ffffff";
			champs[24].style.backgroundColor = "#ffffff";
		}
	}

	if ( messageini.length !=  message.length)
    {
		window.alert(message);
		return false;
	}
    else
    {
		return true;
	}
}

function vider_champ_from() {
	if ($('fieldEmail').value == "Votre email") {
		$('fieldEmail').value = "";
	}
}

function imprime_zone(titre, obj)

{
// Définie la zone a imprimer
var zi = document.getElementById(obj).innerHTML;

// Ouvre une nouvelle fenetre
var f = window.open("", "ZoneImpr", "height=500, width=600, toolbar=0, menubar=0, scrollbars=1, resizable=1, status=0, location=0, left=10, top=10");

// Définit le Style de la page
f.document.body.style.color = '#000000';
f.document.body.style.backgroundColor = '#FFFFFF';
f.document.body.style.padding = "10px";

// Ajoute les Données
f.document.title = titre;
f.document.body.innerHTML += "<h4>France Formations<br>www.fr-formations.com</h4>" + zi + "";

// Imprime et ferme la fenetre
f.window.print();
f.window.close();
return true;
}

function isDate(year, month, day) {
  // month argument must be in the range 1 - 12
  month = month - 1; // javascript month range : 0- 11
  var tempDate = new Date(year,month,day);
  if ( (tempDate.getFullYear() == year) &&
      (month == tempDate.getMonth()) &&
      (day == tempDate.getDate()) )
    return true;
  else
    return false
}

function setAllCheckBox(fieldName, checkValue, formId){
	if (formId) {
		$(formId).getInputs('checkbox',fieldName).each(function(elt){elt.checked=checkValue});
	} else {
		$$('input[type=\'checkbox\'][name=\''+fieldName+'\']').each(function(elt){elt.checked=checkValue});
	}
}

function openTchat(id) {
  fenetre = window.open('tchat.php?to='+id,'tchat_'+id,'menubar=no, status=no, scrollbars=no, menubar=no, width=560, height=520');
  fenetre.focus();
}

function getWindowHeight() {
  var myHeight = 0;
  if( typeof( window.innerHeight ) == 'number' ) {
    //Non-IE
    myHeight = window.innerHeight;
  } else if( document.documentElement && document.documentElement.clientHeight ) {
    //IE 6+ in 'standards compliant mode'
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && document.body.clientHeight ) {
    //IE 4 compatible
    myHeight = document.body.clientHeight;
  }
  return myHeight;
}