



	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(obj) {

		if (!(window.event.keyCode >= 48 && window.event.keyCode <= 57) && ((window.event.keyCode > 13) && (window.event.keyCode <= 256))) {
			window.event.returnValue = false;
			alert("Vous ne pouvez utiliser que les chiffres ici.");
			obj.value = "";
		} 
	}







//	function CheckText(obj) {
//
//
//	      // || window.event.keyCode == 95
//
//		if (!((window.event.keyCode >= 48 && window.event.keyCode <= 57)
//		     || (window.event.keyCode >= 65 && window.event.keyCode <= 90)
//		     || (window.event.keyCode >= 97 && window.event.keyCode <= 122)
//		 )) {
//			window.event.returnValue = false;
//			alert("Vous ne pouvez utiliser que les lettres et les chiffres");
//			obj.value = "";
//		} 
//	}

	function CheckText(obj) {
	
		if (!((window.event.keyCode >= 48 && window.event.keyCode <= 57)
		     || (window.event.keyCode >= 65 && window.event.keyCode <= 90)
		     || window.event.keyCode == 95
		     || (window.event.keyCode >= 97 && window.event.keyCode <= 122)
		 ) && ((window.event.keyCode > 13) && (window.event.keyCode <= 256))) {
			window.event.returnValue = false;
			alert("Vous ne pouvez utiliser que les lettres, chiffres\net l'underscore ( _ ) .");
			obj.value = "";
		} 
	}






	function CheckMail(obj) {

		var LastChar = window.event.keyCode;

		if (!((window.event.keyCode >= 48 && window.event.keyCode <= 57)
		     || (window.event.keyCode >= 65 && window.event.keyCode <= 90)
		     || window.event.keyCode == 95
		     || window.event.keyCode == 64
		     || window.event.keyCode == 46
		     || (window.event.keyCode >= 97 && window.event.keyCode <= 122)
		 ) && ((window.event.keyCode > 13) && (window.event.keyCode <= 256))) {

			var Char;

			if (LastChar == 32) { Char = "espace"; }
			else { Char = String.fromCharCode(LastChar); }

			window.event.returnValue = false;
			alert("Ce charactère n'est pas permis dans un email. (" + Char + ")");
			obj.value = "";
		} 
	}







	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(".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.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;



	}



