function panierPasPret()
{
	alert("Planimage permettra l'achat en ligne à partir du 15 janvier 2003.  Merci de votre compréhension\nPlanimage will allow online purchases starting from the 15th of january 2003.  Thank you for your patience.");
	return false;
}

/***************************Controle des InnerText des visites Virt*************************************/
function writit(text,id)
{
	if (document.getElementById)
	{
		x = document.getElementById(id);
		x.innerHTML = text;
	}
	else if (document.all)
	{
		x = document.all[id];
		x.innerHTML = text;
	}
	else if (document.layers)
	{
		var x = document.layers[id];
		var text2 = '<P>' + text + '</P>';
		x.document.open();
		x.document.write(text2);
		x.document.close();
	}
}

/***************************Validation remplissage bon de commande*************************************/
//Premiere partie : adresse de livraison
function validerBonCommande(nomForm)
{
	if(nomForm.txtNomUtilisateur.value=="")
	{
		alert("Veuillez inscrire votre nom de famille.\nPlease enter your last name.");
		return false;
	}
	if(nomForm.txtPrenomUtilisateur.value=="")
	{
		alert("Veuillez inscrire votre prénom.\nPlease enter your first name.");
		return false;
	}
	if(nomForm.txtAdresse.value=="")
	{
		alert("Veuillez inscrire votre adresse.\nPlease enter your address.");
		return false;
	}
	if(nomForm.txtVille.value=="")
	{
		alert("Veuillez inscrire votre ville.\nPlease enter your city.");
		return false;
	}
	if(nomForm.txtCodePostal.value=="")
	{
		alert("Veuillez inscrire votre code postal.\nPlease enter your Zip/Postal Code.");
		return false;
	}
	
	if(nomForm.paysId.value=="")
	{
		alert("Veuillez choisir un pays.\nPlease select a country.");
		return false;
	}
	//la personne doit rentrer au moins un numéro de téléphone
	//on doit pouvoir les joindre pour confirmer la commande
	if(nomForm.txtTelephone.value=="" && nomForm.txtCellule.value=="" && nomForm.txtTelbureau.value=="")
	{
		alert("Veuillez inscrire au moins un numéro de téléphone.\nPlease enter at least one telephone number.");
		return false;
	}
	if(nomForm.txtTelephone.value!="" && isNaN(nomForm.txtTelephone.value) || nomForm.txtCellule.value!="" && isNaN(nomForm.txtCellule.value) || nomForm.txtTelbureau.value!="" && isNaN(nomForm.txtTelbureau.value))
	{
		alert("Le format du numéro de téléphone n'est pas correctement inscrit.\nThe telephone number's format is incorrect.");
		return false;
	}
	//verifier l'adresse de facturation
	if(nomForm.chkFacture.checked)
	{
		if(nomForm.txtNomFacturation.value=="" || nomForm.txtPrenomFacturation.value=="" || nomForm.txtAdresseFacturation.value=="" || nomForm.txtVilleFacturation.value=="" || nomForm.txtCodePostalFacturation.value=="" || nomForm.paysIdFacturation.value=="")
		{
			if(nomForm.txtNomFacturation.value=="")
			{
				alert("Veuillez inscrire votre nom de famille pour l'adresse de facturation.\nPlease enter your last name for the billing address.");
				return false;
			}
			if(nomForm.txtPrenomFacturation.value=="")
			{
				alert("Veuillez inscrire votre prénom pour l'adresse de facturation\nPlease enter your first name for the billing address.");
				return false;
			}
			if(nomForm.txtAdresseFacturation.value=="")
			{
				alert("Veuillez inscrire votre adresse pour l'adresse de facturation\nPlease enter your address for the billing address.");
				return false;
			}
			if(nomForm.txtVilleFacturation.value=="")
			{
				alert("Veuillez inscrire votre ville pour l'adresse de facturation\nPlease enter your city for the billing address.");
				return false;
			}
			if(nomForm.txtCodePostalFacturation.value=="")
			{
				alert("Veuillez inscrire votre code postal pour l'adresse de facturation\nPlease enter your Zip/Postal Code for the billing address.");
				return false;
			}
			
			if(nomForm.paysIdFacturation.value=="")
			{
				alert("Veuillez choisir un pays pour l'adresse de facturation\nPlease select a country for the billing address.");
				return false;
			}
			return false;
		}//fin si on a coche pour ajouter adresse de facturation
	}//fin verifier l'adresse de facturation
}//fin fonction validerBonCommande(nomForm)
//afficher ou non la partie de l'adresse de facturation du formulaire
					  function adresseFacturationOnOff(clic)
					  {
						  if(clic.chkFacture.checked==true)
						  {
						  		document.getElementById("idFacturation").style.visibility="visible";
								document.getElementById("idTitreAdresseFacturation").style.visibility="visible";
								if(clic.paysIdFacturation.value=="CAN")
								{
									document.getElementById("tdprovinceFacturation").style.visibility="visible";
									document.getElementById("tdtitreprovinceFacturation").style.visibility="visible";
								}
								if(clic.paysIdFacturation.value=="USA")
								{
									document.getElementById("tdetatFacturation").style.visibility="visible";
									document.getElementById("tdtitreetatFacturation").style.visibility="visible";
								}
						  }
						  else
						  {
						  		document.getElementById("idFacturation").style.visibility="hidden";
								document.getElementById("idTitreAdresseFacturation").style.visibility="hidden";
								document.getElementById("tdprovinceFacturation").style.visibility="hidden";
								document.getElementById("tdtitreprovinceFacturation").style.visibility="hidden";
								document.getElementById("tdetatFacturation").style.visibility="hidden";
								document.getElementById("tdtitreetatFacturation").style.visibility="hidden";
						  }
						}//fin fonction afficher adresse de facturation

//permet de vérifier le code postal canadien et américain
	function estCPCan(valeur,champ,pays,cp,prov) {
	   if(pays.value=="CAN" || pays.value=="USA")
		{
		    var codePostal  = valeur;
		     if(pays.value=="CAN"){
				var modelCP6 = /^\w\d\w\s\d\w\d$/;}
		   	 if(pays.value=="USA"){
				var modelCP6 = /^\d\d\d\d\d$/;}
			
			//supprimer les espaces vides en trop
			codePostal = supprimerEspace(codePostal);
			
			//controler la longueur
			if(pays.value=="CAN"){
				if(codePostal.length!=7){
					alert ("Le code postal n'est pas valide (H0H 0H0)\nThe zip code is invalid (H0H 0H0)");
					return false;
				}
				/*
				//verification de la premiere lettre du code pour valider la province choisie
				var distCp = 
				{
					"AB":new Array("T"),
					"BC":new Array("V"),
					"MB":new Array("R"),
					"NB":new Array("E"),
					"NL":new Array("A"),
					"NT":new Array("X"),
					"NS":new Array("B"),
					"NU":new Array("X"),
					"ON":new Array("K","L","M","N","P"),
					"PE":new Array("C"),
					"QC":new Array("G","H","J"),
					"SK":new Array("S"),
					"YT":new Array("Y")
				};
	
					Array.prototype.contains = function(elt) { for(var i=0; i<this.length; i++) {if(this[i]==elt) return true; } return false; };
					//alert(cp)
					function validerProvCP(cp,prov) {
					var test = (distCp[prov].contains(cp.charAt(0)))?"":"Le code postal ne correspond pas a la province choisie";
					alert(test);
					}// fin validerProvCP(cp,prov)
					validerProvCP(cp,prov);
					*/
				
			}
			/*			
			//var distCp = {"qc":new Array("g","h","j"),"on":new Array("k","l","m","n","p")};
			var distCp = 
			{
			"AB":new Array("T"),
			"BC":new Array("V"),
			"MB":new Array("R"),
			"NB":new Array("E"),
			"NL":new Array("A"),
			"NT":new Array("X"),
			"NS":new Array("B"),
			"NU":new Array("X"),
			"ON":new Array("K","L","M","N","P"),
			"PE":new Array("C"),
			"QC":new Array("G","H","J"),
			"SK":new Array("S"),
			"YT":new Array("Y")
			};
	
			Array.prototype.contains = function(elt) { for(var i=0; i<this.length; i++) {if(this[i]==elt) return true; } return false; };
	
			function validerProvCP(cp,prov) {
			alert(cp+prov);
				//var test = (distCp[prov].contains(cp.charAt(0)))?"C'est bon":"Pas bon!!!!!";
				if(!distCp[prov].contains(cp.charAt(0)))
				{
					alert("Le code postal ne correspond pas &agrave; la province\nThe zip code does not match the choosen province");
				}
				//alert(test);
			}
			*/
			
			
			
			
			//validation du code postal etazunien
			if(pays.value=="USA"){
				if(codePostal.length!=5){
					alert ("Le code postal n'est pas valide (12345)\nThe zip code is invalid (12345)");
					return false;
				}
			}
		    if(codePostal.search(modelCP6) != -1) {
		        return true;
		    }
		    else {
				alert ("Le code postal n'est pas valide\nThe zip code is invalid");
		        return false;
		  	}
		}//fin si c'est un code postal canadien ou américain
		else
		{
			return true;
		}
	}//fin fonction

//permet de supprimer les espaces à gauche et à droite d'une chaine
function supprimerEspace(chaine){
	var chaineTemp="";
	var compteur;
	
	if(chaine == "") {
		chaine = " ";
	}
	for(compteur=0;compteur<chaine.length;compteur++){
		var unCar=chaine.charAt(compteur);
		if(unCar!=" "){
			break;
		}//fin if
	}//fin for
	
	if(compteur==chaine.length){
		return chaineTemp;
	}
	
	chaineTemp=chaine.substr(compteur,(chaine.length-compteur));
	
	for(compteur=(chaineTemp.length-1);compteur>=0;compteur--){
		var unCar=chaineTemp.charAt(compteur);
		if(unCar!=" "){
			break;
		}//fin if
	}//fin for

	chaineTemp=chaineTemp.substr(0,(compteur+1));

	return chaineTemp;
}//fin fonction

//fonction qui permet de vérifier que le mail est valide
function verifieMail() 
{
var messPasValide = "Veuillez saisir un courriel valide\nPlease enter a valid E-mail";
var email = document.frmbdc.txtCourrielUtilisateur.value;
var aroba = email.indexOf("@");
if (aroba == -1) {
alert(messPasValide);
return false;
}
var point = email.indexOf(".", aroba);
if ((point == -1) || (point == (aroba + 1))) {
alert(messPasValide);
return false;
}
var point = email.lastIndexOf(".");
if ((point + 1) == email.length) {
alert(messPasValide);
return false;
}
var point = email.indexOf("..")
if (point != -1) {
alert(messPasValide);
return false;
}
return true;
}//fin fonction

	//on doit retenir  quel pays et quelle province choisi la personne
function retenirChoix()
{

	if (document.frmbdc.paysId.value=="CAN")
	{
		document.frmbdc.paysChoisiHid.value = document.frmbdc.paysId.value;
		document.frmbdc.provinceHid.value = document.frmbdc.txtProvince.value;
	}
	if (document.frmbdc.paysId.value=="USA")
	{
		document.frmbdc.paysChoisiHid.value = document.frmbdc.paysId.value;
		document.frmbdc.provinceHid.value = document.frmbdc.txtEtat.value;
	}
	if (document.frmbdc.paysId.value!="CAN" && document.frmbdc.paysId.value!="USA")
	{
		document.frmbdc.provinceHid.value ="";
		document.frmbdc.paysChoisiHid.value = document.frmbdc.paysId.value;
	}
	if (document.frmbdc.prefixeDuRevRet.value!="")
	{
		document.frmbdc.prefixeDuRev.value = document.frmbdc.prefixeDuRevRet.value;
	}
}
if (document.getElementById)
{

	function choisirProvince()
	{
		//rend visible ou invisible, le select des provinces ou des états
		if (document.frmbdc.paysId.value=="CAN")
		{
			document.getElementById("tdprovince").style.visibility="visible";
			document.getElementById("tdtitreprovince").style.visibility="visible";
		}
		else
		{
			document.getElementById("tdprovince").style.visibility="hidden";
			document.getElementById("tdtitreprovince").style.visibility="hidden";
		}
		if (document.frmbdc.paysId.value=="USA")
		{
			document.getElementById("tdetat").style.visibility="visible";
			document.getElementById("tdtitreetat").style.visibility="visible";
		}
		else
		{
			document.getElementById("tdetat").style.visibility="hidden";
			document.getElementById("tdtitreetat").style.visibility="hidden";
		}
	}//fin fonction
	
	function choisirProvinceFacturation()
	{
		//rend visible ou invisible, le select des provinces ou des états
		if (document.frmbdc.paysIdFacturation.value=="CAN")
		{
			document.getElementById("tdprovinceFacturation").style.visibility="visible";
			document.getElementById("tdtitreprovinceFacturation").style.visibility="visible";
		}
		else
		{
			document.getElementById("tdprovinceFacturation").style.visibility="hidden";
			document.getElementById("tdtitreprovinceFacturation").style.visibility="hidden";
		}
		if (document.frmbdc.paysIdFacturation.value=="USA")
		{
			document.getElementById("tdetatFacturation").style.visibility="visible";
			document.getElementById("tdtitreetatFacturation").style.visibility="visible";
		}
		else
		{
			document.getElementById("tdetatFacturation").style.visibility="hidden";
			document.getElementById("tdtitreetatFacturation").style.visibility="hidden";
		}
	}//fin fonction
}//fin accepte fonction getElementById

function controlEcoExpress()
{
		if (document.frmbdc.paysId.value=="USA")
		{
			document.getElementById("divSelect").style.visibility="visible";
		}
		else
		{
			document.getElementById("divSelect").style.visibility="hidden";
			document.frmbdc.rdTypeLiv2.checked = false;
		}
		if(divSelect.style.visibility=="hidden")
		{
			document.frmbdc.slTypeLivHid.value = "express";
			document.frmbdc.rdTypeLiv.checked = true;
		}
		//alert (document.frmbdc.slTypeLiv.value);
}

/***************************GRILLE.PHP, controle des radiobutton*******************************************/
function radioJeuPlan8(radioJeu)
{
	if(radioJeu.chkJeu8.checked==true)
	{
		if(radioJeu.chkJeu5){radioJeu.chkJeu5.checked=false;}//5
		if(radioJeu.chkJeu4){radioJeu.chkJeu4.checked=false;}//4
		if(radioJeu.chkJeu1){radioJeu.chkJeu1.checked=false;}//1
		if(radioJeu.chkEtude){radioJeu.chkEtude.checked=false;}//etude
		if(radioJeu.chkKit){radioJeu.chkKit.checked=false;}//kit
	}
}
function radioJeuPlan5(radioJeu)
{
	if(radioJeu.chkJeu5.checked==true)
	{
		if(radioJeu.chkJeu8){radioJeu.chkJeu8.checked=false;}//8
		if(radioJeu.chkJeu4){radioJeu.chkJeu4.checked=false;}//4
		if(radioJeu.chkJeu1){radioJeu.chkJeu1.checked=false;}//1
		if(radioJeu.chkEtude){radioJeu.chkEtude.checked=false;}//etude
		if(radioJeu.chkKit){radioJeu.chkKit.checked=false;}//kit
	}
}
function radioJeuPlan4(radioJeu)
{
	if(radioJeu.chkJeu4.checked==true)
	{
		if(radioJeu.chkJeu8){radioJeu.chkJeu8.checked=false;}//8
		if(radioJeu.chkJeu5){radioJeu.chkJeu5.checked=false;}//5
		if(radioJeu.chkJeu1){radioJeu.chkJeu1.checked=false;}//1
		if(radioJeu.chkEtude){radioJeu.chkEtude.checked=false;}//etude
		if(radioJeu.chkKit){radioJeu.chkKit.checked=false;}//kit
	}
}
function radioJeuPlan1(radioJeu)
{
	if(radioJeu.chkJeu1.checked==true)
	{
		if(radioJeu.chkJeu8){radioJeu.chkJeu8.checked=false;}//8
		if(radioJeu.chkJeu5){radioJeu.chkJeu5.checked=false;}//5
		if(radioJeu.chkJeu4){radioJeu.chkJeu4.checked=false;}//4
		if(radioJeu.chkEtude){radioJeu.chkEtude.checked=false;}//etude
		if(radioJeu.chkKit){radioJeu.chkKit.checked=false;}//kit
	}
}
function radioEtude(radioJeu)
{
	if(radioJeu.chkEtude.checked==true)
	{
		if(radioJeu.chkJeu8){radioJeu.chkJeu8.checked=false;}//8
		if(radioJeu.chkJeu5){radioJeu.chkJeu5.checked=false;}//5
		if(radioJeu.chkJeu4){radioJeu.chkJeu4.checked=false;}//4
		if(radioJeu.chkJeu1){radioJeu.chkJeu1.checked=false;}//1
		if(radioJeu.chkKit){radioJeu.chkKit.checked=false;}//kit
	}
}
function radioKit(radioJeu)
{
	if(radioJeu.chkKit.checked==true)
	{
		if(radioJeu.chkJeu8){radioJeu.chkJeu8.checked=false;}//8
		if(radioJeu.chkJeu5){radioJeu.chkJeu5.checked=false;}//5
		if(radioJeu.chkJeu4){radioJeu.chkJeu4.checked=false;}//4
		if(radioJeu.chkJeu1){radioJeu.chkJeu1.checked=false;}//1
		if(radioJeu.chkEtude){radioJeu.chkEtude.checked=false;}//etude
	}
}

//si on choisi plan pour étude, on ne peut pas choisir d'autres option de la grille
 function validePlanEtudeSeul(boite)
 {
 	//alert (boite.prixCopieAdd.value)
 	if(boite.chkEtude.checked==true && (boite.txtNbCopie.value!=0 || boite.chkPlanInv.checked==true || boite.chkMiroir.checked==true || boite.chkVersMetric.checked == true || boite.chkListMat.checked == true))
{
	alert("Vous ne pouvez pas choisir d\'autres options si vous vous procurez un plan pour étude.\nYou can\'t choose any option if you choose a study plan.");	
	return false;
}
 }
/***************************PRELOAD DES IMAGES*******************************************/

/*******************************Validation du nombre de copie (plgrille.php)************/
function valideNbCopie(boite)
{
	 if (isNaN(boite.value))
	 {
	 	alert ("Veuillez entrer un nombre valide\nPlease enter a valid number");
	return false;
	 }
	 else
	 return true;
}


