// JavaScript Document

// Fonction qui gère em menu de navigation.
function toggle(id){
    ul = "ul_" + id;
    img = "img_" + id;
    ulElement = document.getElementById(ul);
    imgElement = document.getElementById(img);
    if (ulElement){
            if (ulElement.className == 'closed'){
                    ulElement.className = "open";
                    }else{
                    ulElement.className = "closed";
                    }
            }
    }


// Fonction qui ouvre une fenêtre en mode MODAL (IE5 seulement)
function WMOpen(f,nom, h, w, scroll) {
  var PosLeft = screen.width;
  var PosTop = screen.height;
  PosLeft = ((PosLeft/2)-((w+10)/2))
  PosTop = ((PosTop/2)-((h+59)/2))
  var myPopup = window.open(f, nom, 'resizable=no,scrollbars=' + scroll + ',left=' + PosLeft + ',top=' + PosTop + ',menubar=no,status=no,width=' + w + ',height=' + h);
  if(myPopup.focus){myPopup.focus();}
}

function Form_Index_Validator(theForm) {
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(theForm.email.value)) { }
	else { alert("Email not valid !"); theForm.email.focus(); return (false); }
	if (theForm.password.value == "") { alert("type your passwords in this field \"Password\"."); theForm.password.focus(); return (false); }
	return (true);
}

function Form_passrecovery_Validator(theForm) {
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(theForm.email.value)) { }
	else { alert("Email not valid !"); theForm.email.focus(); return (false); }
	return (true);
}

function Form_Register_Validator(theForm) {
	if (theForm.Email_Parrain.value == "") { alert("type the email of your buddy \"Email of buddy\"."); theForm.Email_Parrain.focus(); return (false); }
	if (theForm.Nom.value == "") { alert("type your second name here \"Second Name\"."); theForm.Nom.focus(); return (false); }
	if (theForm.Prenom.value == "") { alert("type your first name here \"First Name\"."); theForm.Prenom.focus(); return (false); }
	if (theForm.Jour_Naissance.selectedIndex == 0) {alert("choose \"date of birth\".");	theForm.Jour_Naissance.focus(); return (false); }
	if (theForm.Mois_Naissance.selectedIndex == 0) {alert("choose \"month of birth\".");	theForm.Mois_Naissance.focus(); return (false); }
	if (theForm.Annee_Naissance.selectedIndex == 0) {alert("choose \"year of birth\"."); theForm.Annee_Naissance.focus(); return (false); }
	
	if (theForm.Telephone.value == "") { alert("type \"phone number\"."); theForm.Telephone.focus(); return (false); }
	if (theForm.Adresse.value == "") { alert("type \"Address\"."); theForm.Adresse.focus(); return (false); }
	if (theForm.CodePostal.value == "") { alert("type \"ZIP code\"."); theForm.CodePostal.focus(); return (false); }
	if (theForm.ville.value == "") { alert("type \"city\"."); theForm.ville.focus(); return (false); }
	if (theForm.Profession.selectedIndex == 0) {alert("choose \"Profession\"."); theForm.Profession.focus(); return (false); }
	
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(theForm.Email.value)) { } else { alert("Error \"Email\"."); theForm.Email.focus(); return (false); }
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(theForm.Email_Confirm.value)) { } else { alert("error \"Email confirmation\"."); theForm.Email_Confirm.focus(); return (false); }
	if (theForm.Password.value == "") { alert("type \"Password\"."); theForm.Password.focus(); return (false); }
	if (theForm.Password_Confirm.value == "") { alert("type \"Password confirmation\"."); theForm.Password_Confirm.focus(); return (false); }

	if (!theForm.CGV_Accept.checked) {alert("please accept our TOS."); theForm.CGV_Accept.focus(); return (false); }
	
	return (true);
}

function Form_Register_Validator_op_ox(theForm) {
	if (theForm.Email_Parrain.value == "") { alert("type \"Email of your buddy\"."); theForm.Email_Parrain.focus(); return (false); }
	if (theForm.Nom.value == "") { alert("type \"Second Name\"."); theForm.Nom.focus(); return (false); }
	if (theForm.Prenom.value == "") { alert("type \"First Name\"."); theForm.Prenom.focus(); return (false); }
	if (theForm.Jour_Naissance.selectedIndex == 0) {alert("choose \"day of birth\".");	theForm.Jour_Naissance.focus(); return (false); }
	if (theForm.Mois_Naissance.selectedIndex == 0) {alert("choose \"month of birth\".");	theForm.Mois_Naissance.focus(); return (false); }
	if (theForm.Annee_Naissance.selectedIndex == 0) {alert("choose \"year of birth\"."); theForm.Annee_Naissance.focus(); return (false); }	
	if (theForm.Telephone.value == "") { alert("type \"phone number\"."); theForm.Telephone.focus(); return (false); }
	if (theForm.Adresse.value == "") { alert("type \"address\"."); theForm.Adresse.focus(); return (false); }
	if (theForm.CodePostal.value == "") { alert("type \"ZIP code\"."); theForm.CodePostal.focus(); return (false); }
	if (theForm.ville.value == "") { alert("type \"city\"."); theForm.ville.focus(); return (false); }
	if (theForm.Profession.selectedIndex == 0) {alert("choose \"Profession\"."); theForm.Profession.focus(); return (false); }	
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(theForm.Email.value)) { } else { alert("error \"Email\"."); theForm.Email.focus(); return (false); }
	if (theForm.Password.value == "") { alert("type \"password\"."); theForm.Password.focus(); return (false); }
	if (theForm.Password_Confirm.value == "") { alert("type \"password confirmation\"."); theForm.Password_Confirm.focus(); return (false); }

	if (!theForm.CGV_Accept.checked) {alert("please accept our TOS."); theForm.CGV_Accept.focus(); return (false); }
	
	return (true);
}

function Form_Register_Validator_op_mediastay(theForm) {
	if (theForm.Email_Parrain.value == "") { alert("type \"Email of your buddy\"."); theForm.Email_Parrain.focus(); return (false); }
	if (theForm.Nom.value == "") { alert("type \"second name\"."); theForm.Nom.focus(); return (false); }
	if (theForm.Prenom.value == "") { alert("type \"first name\"."); theForm.Prenom.focus(); return (false); }
	if (theForm.Jour_Naissance.selectedIndex == 0) {alert("choose \"day of birth\".");	theForm.Jour_Naissance.focus(); return (false); }
	if (theForm.Mois_Naissance.selectedIndex == 0) {alert("choose \"month of birth\".");	theForm.Mois_Naissance.focus(); return (false); }
	if (theForm.Annee_Naissance.selectedIndex == 0) {alert("choose \"year of birth\"."); theForm.Annee_Naissance.focus(); return (false); }	
	if (theForm.Telephone.value == "") { alert("type \"phone number\"."); theForm.Telephone.focus(); return (false); }
	if (theForm.Adresse.value == "") { alert("type \"address\"."); theForm.Adresse.focus(); return (false); }
	if (theForm.CodePostal.value == "") { alert("type \"ZIP code\"."); theForm.CodePostal.focus(); return (false); }
	if (theForm.ville.value == "") { alert("type \"city\"."); theForm.ville.focus(); return (false); }
	if (theForm.Profession.selectedIndex == 0) {alert("choose \"Profession\"."); theForm.Profession.focus(); return (false); }	
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(theForm.Email.value)) { } else { alert("error \"Email\"."); theForm.Email.focus(); return (false); }
		if (theForm.Password.value == "") { alert("type \"password\"."); theForm.Password.focus(); return (false); }
	if (theForm.Password_Confirm.value == "") { alert("type \"password confirmation\"."); theForm.Password_Confirm.focus(); return (false); }

	if (!theForm.CGV_Accept.checked) {alert("please accept our TOS."); theForm.CGV_Accept.focus(); return (false); }
	
	return (true);
}

function Form_Register_Validator_form_reduit(theForm) {
	if (theForm.Email_Parrain.value == "") { alert("type \"Email of your buddy\"."); theForm.Email_Parrain.focus(); return (false); }
	if (theForm.Nom.value == "") { alert("type \"second name\"."); theForm.Nom.focus(); return (false); }
	if (theForm.Prenom.value == "") { alert("type \"first name\"."); theForm.Prenom.focus(); return (false); }
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(theForm.Email.value)) { } else { alert("error \"Email\"."); theForm.Email.focus(); return (false); }
		if (theForm.Password.value == "") { alert("type \"password\"."); theForm.Password.focus(); return (false); }
	if (theForm.Password_Confirm.value == "") { alert("type \"password confirmation\"."); theForm.Password_Confirm.focus(); return (false); }

	if (!theForm.CGV_Accept.checked) {alert("please accept our TOS."); theForm.CGV_Accept.focus(); return (false); }
	
	return (true);
}


function Form_Register_Validator_form_reduit2(theForm) {
	if (theForm.Email_Parrain.value == "") { alert("type \"Email of your buddy\"."); theForm.Email_Parrain.focus(); return (false); }	
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(theForm.Email.value)) { } else { alert("error \"Email\"."); theForm.Email.focus(); return (false); }
	if (theForm.Password.value == "") { alert("type \"Password\"."); theForm.Password.focus(); return (false); }
	if (theForm.Password_Confirm.value == "") { alert("confirm \"Password\"."); theForm.Password_Confirm.focus(); return (false); }
	if (theForm.Password.value != theForm.Password_Confirm.value) { alert("password is different."); theForm.Password_Confirm.focus(); return (false); }
	if (!theForm.CGV_Accept.checked) {alert("you need to accept our TOS."); theForm.CGV_Accept.focus(); return (false); }
	
	return (true);
}

function Form_Register_adresses_complementaires(theForm) {
	if (theForm.nom.value == "") { alert("type \"Second Name\"."); theForm.nom.focus(); return (false); }
	if (theForm.adresse.value == "") { alert("type \"Address\"."); theForm.adresse.focus(); return (false); }
	if (theForm.cp.value == "") {alert("type \"ZIP code\"."); theForm.cp.focus(); return (false); }
	if (theForm.prenom.value == "") {alert("type \"First Name\"."); theForm.prenom.focus(); return (false) ;}
	if (theForm.ville.value == "") {alert("type \"City\"."); theForm.ville.focus(); return (false);}
	
	return (true);
}


function Form_Register2_Validator(theForm) {
	if (theForm.Nom.value == "") { alert("type \"Second Name\"."); theForm.Nom.focus(); return (false); }
	if (theForm.Prenom.value == "") { alert("type \"First Name\"."); theForm.Prenom.focus(); return (false); }
	if (theForm.Jour_Naissance.selectedIndex == 0) {alert("choose \"Day of birth\".");	theForm.Jour_Naissance.focus(); return (false); }
	if (theForm.Mois_Naissance.selectedIndex == 0) {alert("choose \"Month of birth\".");	theForm.Mois_Naissance.focus(); return (false); }
	if (theForm.Annee_Naissance.selectedIndex == 0) {alert("choose \"Year of birth\"."); theForm.Annee_Naissance.focus(); return (false); }
	
	if (theForm.Telephone.value == "") { alert("type \"Telephone number\"."); theForm.Telephone.focus(); return (false); }
	if (theForm.Adresse.value == "") { alert("type \"Address\"."); theForm.Adresse.focus(); return (false); }
	if (theForm.CodePostal.value == "") { alert("type \"ZIP code\"."); theForm.CodePostal.focus(); return (false); }
	if (theForm.ville.value == "") { alert("type \"City\"."); theForm.ville.focus(); return (false); }
	if (theForm.Profession.selectedIndex == 0) {alert("type \"Profession\"."); theForm.Profession.focus(); return (false); }
	
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(theForm.Email.value)) { } else { alert("error \"Email\"."); theForm.Email.focus(); return (false); }
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(theForm.Email_Confirm.value)) { } else { alert("Error \"Email confirmation\"."); theForm.Email_Confirm.focus(); return (false); }

	return (true);
}

function Form_Register3_Validator(theForm) {
	if (theForm.nouveau.value != theForm.nouveauconfirm.value) { alert("password is different."); theForm.nouveau.focus(); return (false); }

	return (true);
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
