



	function openPopup(url, widthx, heighty, startx, starty, fixed, scroll) {

		if (!scroll) { scroll = "no"; }

		if (fixed == true) {
			window.open(url,"","width=" + widthx + ",height=" + heighty + ",resizable=no,scrollbars=" + scroll + ",screenx=" + (screen.width-widthx)/2 + ",screeny=" + (screen.height-heighty)/2 + ",menubar=0,toolbar=0");
		} else {
			window.open(url,"","width=" + widthx + ",height=" + heighty + ",resizable=yes,scrollbars=yes,screenx=" + (screen.width-widthx)/2 + ",screeny=" + (screen.height-heighty)/2 + ",menubar=0,toolbar=0");
		}
	}







	function CheckPhone(e, obj) {

		var evtobj=window.event? event : e
		var code=e.keyCode? e.keyCode : e.charCode

		if (!((code >= 48 && code <= 57)
			|| (code >= 37 && code <= 40)
			|| (code == 8)
			|| (code == 13))) {
			alert("Vous ne pouvez utiliser que les chiffres ici.");
			obj.value = "";
			return false;
		} else { return true; }
	}







	function CheckText(e, obj) {

		var evtobj=window.event? event : e
		var code=e.keyCode? e.keyCode : e.charCode
		
	      // || window.event.keyCode == 95

		if (!((code >= 48 && code <= 57)
		     || (code >= 65 && code <= 90)
		     || (code >= 97 && code <= 122)
			 || (code >= 37 && code <= 40)
			 || (code == 8)
			 || (code == 13)
		 )) {
			alert("Vous ne pouvez utiliser que les lettres et les chiffres");
			obj.value = "";
			return false;
		} else { return true; }
	}








	function CheckMail(e, obj) {
		var evtobj=window.event? event : e
		var code=e.keyCode? e.keyCode : e.charCode
		
		var LastChar = code;

		if (!((LastChar >= 48 && LastChar <= 57)
		     || (LastChar >= 65 && LastChar <= 90)
		     || LastChar == 95
		     || LastChar == 64
		     || LastChar == 46
			 || LastChar == 45
		     || (LastChar >= 97 && LastChar <= 122)
			 || (LastChar >= 37 && LastChar <= 40)
			 || (LastChar == 8)
			 || (LastChar == 13)
		 )) {
			var Char;
			if (LastChar == 32) { Char = "espace"; }
			else { Char = String.fromCharCode(LastChar); }
			alert("Ce charactère n'est pas permis dans un email. (" + Char + ")");
			obj.value = "";
			return false;
		} else { return true; }
	}








	function ValidEmail(str) {
		str = str.toLowerCase( );
		if (
		    str.indexOf("@") != -1 &&
		    (str.indexOf(".com") != -1 ||
		    str.indexOf(".net") != -1 ||
		    str.indexOf(".org") != -1 ||
		    str.indexOf(".ca") != -1 ||
		    str.indexOf(".qc") != -1 ||
		    str.indexOf(".biz") != -1 ||
			str.indexOf(".fr") != -1 ||
		    str.indexOf(".us") != -1)
		) { return true; }
		else { return false; }
	}









	function AutoJump(len, obj, next) {

		//obj = eval("document." + obj);

		if (obj.value.length == len) { next.focus(); }

	}









	function CheckSubmitForm(formname) {

		o_form = eval("document." + formname);




		if (o_form.username != undefined) {

			if (o_form.username.value == "") {

				alert("Vous devez choisir un pseudonyme.");
				return false;

			}

		}






		////////////////// Check passwords /////////////////////////////
		if (o_form.passw != undefined) {

			if (o_form.passw.value == "") {

				alert("Vous devez choisir un mot de passe.");
				return false;

			} else if (o_form.passw.value != o_form.passw2.value) {

				alert("La confirmation du mot de passe ne concorde pas.");
				o_form.passw2.value = "";
				return false;

			}

		}



		////////////////// Check change passwords /////////////////////////////

		if (o_form.new_passw != undefined) {

			if (o_form.new_passw.value != o_form.new_passw2.value) {

				alert("La confirmation du nouveau mot de passe ne concorde pas.");
				o_form.new_passw2.value = "";
				return false;

			}

		}





		/////////////////// Check mail field if present ////////////////

		if (o_form.email != undefined) {

			if (!ValidEmail(o_form.email.value)) { alert("L'email soumis est invalide."); return false; }


			/////////// check confirmation mail if present /////////
			if (o_form.email2 != undefined) {

				if (o_form.email.value != o_form.email2.value) { alert("La confirmation de l'email ne concorde pas."); return false; }

			}


		}




		/////////////////// personnal info check //////////////////////////

		if (o_form.name != undefined) {

			if (o_form.name.value == "") {

				alert("Vous devez indiquer votre prénom.\n\n(Cette information est confidentielle)");
				return false;

			}

		}


		if (o_form.tel_eu != undefined) {
			if (o_form.tel_eu.value == '' || o_form.tel_eu.value.length < 10) {

				alert("Vous devez entrer votre numéro de téléphone complet.\n\n(10 chiffres - cette information est confidentielle)");
				return false;

			}
		} else {
			if (o_form.tel1 != undefined) {
	
				if (o_form.tel1.value == '' || o_form.tel2.value == '' || o_form.tel3.value == '' || o_form.tel1.value.length < 3 || o_form.tel2.value.length < 3 || o_form.tel3.value.length < 4) {
	
					alert("Vous devez entrer votre indicatif régional ainsi que votre numéro de téléphone.\n\n(cette information est confidentielle)");
					return false;
	
				}
	
			}
		}





		/////////////////// postal code check //////////////////////////

		if (o_form.cp1 != undefined) {

			if (o_form.cp1.value == '' || o_form.cp2.value == '' || o_form.cp1.value.length < 3 || o_form.cp2.value.length < 3) {

				alert("Vous devez entrer un code postal valide.");
				return false;

			}

		}

		
		if (o_form.location != undefined) {
			if (o_form.location.value == "") {
				alert("S'il vous plait indiquer votre ville.");
				return false;
			}
		}
		
		


		if (o_form.accept != undefined) {
			if (o_form.accept.checked != true) {
				alert("Vous devez accepter la politique d'utilisation.");
				return false;
			}
		}



		//// if we reach here everything is fine so move on //////////
		o_form.submit();
		return true;



	}



