var Timer;
var Pas = 3;
function moveLayer(Sens) {
	Objet=document.getElementById("contenu");
    if(parseInt(Objet.style.top) + (Pas*Sens)>0)  {
		clearTimeout(Timer);
	}
	else if(parseInt(Objet.style.top) + (Pas*Sens)<-(Objet.offsetHeight-document.getElementById("support").offsetHeight)) {
		clearTimeout(Timer);
	}
    else {
        Objet.style.top = (parseInt(Objet.style.top) + (Pas*Sens)) + "px";
	}
	Timer = setTimeout("moveLayer(" + Sens + ");", 30);
}

function open_popup(page,largeur,hauteur,nom) 
{ 
	window.open(page,nom,"status=no,scrollbars=yes,resizable=no,height="+hauteur+",width="+largeur+",top=0,left=0"); 
}

function chiffres(event) {
	// Compatibilité IE / Firefox
	if(!event && window.event) {
		event=window.event;
	}
	// IE
	if((event.keyCode < 48 || event.keyCode > 57) && event.keyCode != 46 && event.keyCode != 8 && event.keyCode != 110 && event.keyCode != 37 && event.keyCode != 39) {
		event.returnValue = false;
		event.cancelBubble = true;
	}
	// DOM
	if((event.which < 48 || event.which > 57) && event.which != 46 && event.which != 8 && event.which != 110 && event.which != 37 && event.which != 39) {
		event.preventDefault();
		event.stopPropagation();
	}
}

function submitAdresse(argForm) {
	if(argForm.email.value != argForm.email2.value) {
		alert("Mauvaise confirmation de votre email"); 
	} else {
		if(argForm.nom_1.value == "") {
			alert("Veuillez saisir un nom pour l'adresse de facturation"); 
		}
		else if(argForm.adresse1_1.value == "") {
			alert("Veuillez saisir une adresse pour l'adresse de facturation"); 
		}
		else if(argForm.cp_1.value == "") {
			alert("Veuillez saisir un code postal pour l'adresse de facturation"); 
		}
		else if(argForm.ville_1.value == "") {
			alert("Veuillez saisir une ville pour l'adresse de facturation"); 
		}
		else if(argForm.tel_1.value == "") {
			alert("Veuillez saisir un numéro de téléphone pour l'adresse de facturation"); 
		}
		else {
			/*
			if (argForm.nom_2.value!="" || argForm.prenom_2.value!="" || argForm.adresse1_2.value!="" || argForm.cp_2.value!="" || argForm.ville_2.value!="" || argForm.tel_2.value!="" ) {
				if(argForm.nom_2.value == "" ) {
					alert("Veuillez saisir un nom pour le bénéficiare du bon cadeau"); 
				}
				else if(argForm.prenom_2.value == "") {
					alert("Veuillez saisir un prénom pour le bénéficiare du bon cadeau"); 
				}
				else if(argForm.adresse1_2.value == "") {
					alert("Veuillez saisir une adresse pour le bénéficiare du bon cadeau"); 
				}
				else if(argForm.cp_2.value == "") {
					alert("Veuillez saisir un code postal le bénéficiare du bon cadeau"); 
				}
				else if(argForm.ville_2.value == "") {
					alert("Veuillez saisir une ville pour le bénéficiare du bon cadeau"); 
				}
				else if(argForm.tel_2.value == "") {
					alert("Veuillez saisir un numéro de téléphone pour le bénéficiare du bon cadeau"); 
				}
				else if(verifEmail(argForm.email.value,"")) {
					argForm.submit();
				}
			}
			else */
			if(verifEmail(argForm.email.value,"")) {
				argForm.submit();
			}
		}
	}
}

function submitOption(argForm) {
	if(argForm.bon[0].checked == true) {
		if(argForm.nom_bon.value == "" ) {
			alert("Veuillez saisir un nom pour le bénéficiare du bon cadeau"); 
		}
		else if(argForm.prenom_bon.value == "") {
			alert("Veuillez saisir un prénom pour le bénéficiare du bon cadeau"); 
		}
		else if(argForm.adresse1_bon.value == "") {
			alert("Veuillez saisir une adresse pour le bénéficiare du bon cadeau"); 
		}
		else if(argForm.cp_bon.value == "") {
			alert("Veuillez saisir un code postal le bénéficiare du bon cadeau"); 
		}
		else if(argForm.ville_bon.value == "") {
			alert("Veuillez saisir une ville pour le bénéficiare du bon cadeau"); 
		}
		else {
			argForm.submit();
		}
	}
	else if(argForm.bon[1].checked == true || argForm.bon[2].checked == true) {
		if(argForm.nom_bon.value == "" ) {
			alert("Veuillez saisir un nom pour le bénéficiare du bon cadeau"); 
		}
		else if(argForm.prenom_bon.value == "") {
			alert("Veuillez saisir un prénom pour le bénéficiare du bon cadeau"); 
		}
		else {
			argForm.submit();
		}
	}
}

function griser1Option(argForm) {
	argForm.societe_bon.style.backgroundColor = "#bbbbbb";
	argForm.nom_bon.style.backgroundColor = "#ffffff";
	argForm.prenom_bon.style.backgroundColor = "#ffffff";
	argForm.adresse1_bon.style.backgroundColor = "#ffffff";
	argForm.adresse2_bon.style.backgroundColor = "#bbbbbb";
	argForm.cp_bon.style.backgroundColor = "#ffffff";
	argForm.ville_bon.style.backgroundColor = "#ffffff";
	argForm.tel_bon.style.backgroundColor = "#bbbbbb";
}

function griser2Option(argForm) {
	argForm.societe_bon.style.backgroundColor = "#bbbbbb";
	argForm.nom_bon.style.backgroundColor = "#ffffff";
	argForm.prenom_bon.style.backgroundColor = "#ffffff";
	argForm.adresse1_bon.style.backgroundColor = "#bbbbbb";
	argForm.adresse2_bon.style.backgroundColor = "#bbbbbb";
	argForm.cp_bon.style.backgroundColor = "#bbbbbb";
	argForm.ville_bon.style.backgroundColor = "#bbbbbb";
	argForm.tel_bon.style.backgroundColor = "#bbbbbb";
}


function submitLivraison(argForm) {
	if(argForm.nom_2.value == "" ) {
		alert("Veuillez saisir un nom pour l'adresse de livraison"); 
	}
	else if(argForm.prenom_2.value == "") {
		alert("Veuillez saisir un prénom pour l'adresse de livraison"); 
	}
	else if(argForm.adresse1_2.value == "") {
		alert("Veuillez saisir une adresse pour l'adresse de livraison"); 
	}
	else if(argForm.cp_2.value == "") {
		alert("Veuillez saisir un code postal l'adresse de livraison"); 
	}
	else if(argForm.ville_2.value == "") {
		alert("Veuillez saisir une ville pour l'adresse de livraison"); 
	}
	else {
		argForm.submit();
	}
	
}


function verifEmail(email)
{
var place = email.indexOf("@",1);
var point = email.indexOf(".",place+1);
if ((place > -1)&&(email.length >2)&&(point > 1))
	{
		return(true);
	}
else
	{
	    alert('Entrez une adresse e-mail valide SVP !'); 
		return(false);
	}
}

function submitNewsletter(argForm) {
	if(argForm.email.value==0 || verifEmail(argForm.email.value)==false) {
		alert("Veuillez saisir un e-mail valide SVP !"); 
	}
	else {
		argForm.submit();
	}
}