<!--
function MailPass() {
	window.parent.fenCentre('/customer/mail.asp','Pass',410, 158,'oui');
}
function detailreduc(Id) {
	fenCentre('/customer/bonreduc_detail.asp?Id=' + Id ,'FicheReduc', 750, 350,'oui');
}
function verifmail(emailverif) {
    chaine = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-_@";
    ok=true;
    email = emailverif.toLowerCase();
    for (i=0; i<email.length; i++) {
	    if (chaine.indexOf(emailverif.substr(i,1),0) == -1)
		    ok = false ;	
    }
    if (emailverif.indexOf("@",0) == 0) {
		    ok = false ;
	    }
    else {
		    if (emailverif.indexOf("@",emailverif.indexOf("@",0)+1) != -1)
			    {
				    ok = false ;
			    }
	    }
    return ok ;
}
function Affichage(type) {
if (type=='Pro') {
	showDiv('TitrePro');
	showDiv('PagePro');
	hideDiv('TitrePart');
	}
else {
	showDiv('TitrePart');
	hideDiv('TitrePro');
	hideDiv('PagePro');
	}
}
function inscription() {
	//document.FrmProfil.action = '/customer/choixcompte.asp';
	document.FrmProfil.submit();
}
function loginUser() {
	ok = true;
	if (document.FrmEtape1.CustumerID.value == '') {
			alert("Tapez une valeur pour le champ \"n° de compte\".");
			ok= false;
		}
	if (document.FrmEtape1.VPPassWord.value.length < 1) {
	    alert("Tapez une valeur pour le champ \"mot de passe\".");
	    document.FrmEtape1.VPPassWord.focus();
	    ok = false;
		}
	document.FrmEtape1.cli.value = 'login';	
	document.FrmEtape1.action = '/customer/login.asp';
	if (ok) document.FrmEtape1.submit();
}
function valideEtape1() {
	ok = true;
	if (verifmail(document.FrmEtape1.Email.value) != true || document.FrmEtape1.Email.value == '') {
			alert("Votre adresse mail a une syntaxe incorrecte, merci de la vérifier.");
			ok= false;
		}
	if (document.FrmEtape1.PassVP.value.length < 1) {
	    alert("Tapez une valeur pour le champ \"mot de passe\".");
	    document.FrmEtape1.PassVP.focus();
	    ok = false;
		}
    var L=document.FrmEtape1.id_type_societe.length;
		var ret="";
		for (var i = 0 ; i< L ; i++)
		{
			if(form.document.FrmEtape1.id_type_societe[i].checked) 
				{ret=document.FrmEtape1.id_type_societe[i].value;break;}
		}
		if ( ret == "")
		{
		alert ("Choisissez un type de société ?");
		return false;}
	document.FrmEtape1.action = '/customer/register.asp';
	if (ok) document.FrmEtape1.submit();
}
function valideEtape2() {
	ok = true;
	if (typeForm == 1 && document.FrmEtape2.Societe.value.length < 1) {
	    alert("Tapez une valeur pour le champ \"Dénomination\".");
	    document.FrmEtape2.Societe.focus();
	    ok = false;
		}
	if (typeAPE == 1 && document.FrmEtape2.APE.value.length < 1) {
	    alert("Tapez une valeur pour le champ \"APE/NAF\".");
	    document.FrmEtape2.APE.focus();
	    ok = false;
		}
	if (typeAPE == 1 && document.FrmEtape2.APE.value.length >= 1) {
	    tva = true;
	    //tva = verifape(document.FrmEtape2.APE.value);
	    if (tva == false)
			{
			ok = false;
			alert("La syntaxe du code \"APE/NAF\" est incorrecte.");
			}
		}
	if (typeSIRET == 1 && document.FrmEtape2.Siret.value.length < 1 && document.FrmEtape2.pasnumtva.checked == false) {
	    alert("Tapez une valeur pour le champ \"N° Siret\".");
	    document.FrmEtape2.Siret.focus();
	    ok = false;
		}
	if (typeSIRET == 1 && document.FrmEtape2.Siret.value.length >= 1) {
	    siretp = true;
	    siretp = verifsiret(document.FrmEtape2.Siret.value);
	    if (siretp == false)
			{
			ok = false;
			alert("La syntaxe du \"N° Siret\" est incorrecte.");
			}
		}
	if (document.FrmEtape2.Nom.value.length < 1) {
	    alert("Tapez une valeur pour le champ \"Nom\".");
	    document.FrmEtape2.Nom.focus();
	    ok = false;
		}
	if (document.FrmEtape2.Prenom.value.length < 1) {
	    alert("Tapez une valeur pour le champ \"Prenom\".");
	    document.FrmEtape2.Prenom.focus();
	    ok = false;
		}
	if (!document.FrmEtape2.Civilite[0].checked && !document.FrmEtape2.Civilite[1].checked && !document.FrmEtape2.Civilite[2].checked) {
	    alert("Tapez une valeur pour le champ \"civilité\".");
	    ok = false;
		}
	if (document.FrmEtape2.Telephone.value.length != 10) {
	    alert("Le champs Téléphone fixe doit comporter 10 chiffres.");
	    document.FrmEtape2.Telephone.focus();
	    ok = false;
		}
	if (document.FrmEtape2.Portable.value.length != 10) {
	    alert("Le champs Portable doit comporter 10 chiffres.");
	    document.FrmEtape2.Portable.focus();
	    ok = false;
		}
		if (document.FrmEtape2.Fax.value.length != 10) {
	    alert("Le champs Fax fixe doit comporter 10 chiffres.");
	    document.FrmEtape2.Fax.focus();
	    ok = false;
		}	
	if (document.FrmEtape2.Adresse1.value.length < 1 && document.FrmEtape2.Adresse2.value.length < 1 && document.FrmEtape2.Adresse3.value.length < 1) {
	    alert("Tapez une valeur pour le champ \"Adresse\".");
	    document.FrmEtape2.Adresse1.focus();
	    ok = false;
		}
	if (document.FrmEtape2.CP.value.length < 1) {
	    alert("Tapez une valeur pour le champ \"Code Postal\".");
	    document.FrmEtape2.CP.focus();
	    ok = false;
		}
	if (document.FrmEtape2.Ville.value.length < 1) {
	    alert("Tapez une valeur pour le champ \"Ville\".");
	    document.FrmEtape2.Ville.focus();
	    ok = false;
		}
	if (ok) document.FrmEtape2.submit();
}
function valideEtape3() {
	ok = true;
	if (document.FrmEtape3.Chez.value.length < 1) {
		alert('Tapez une valeur pour le champ \"Chez\".');
		document.FrmEtape3.Chez.focus();
		ok = false;
	}
	if (document.FrmEtape3.Adresse1_Livraison.value.length < 1 && document.FrmEtape3.Adresse2_Livraison.value.length < 1 && document.FrmEtape3.Adresse3_Livraison.value.length < 1) {
		alert('Tapez une valeur pour le champ \"Adresse\".');
		document.FrmEtape3.Adresse1_Livraison.focus();
		ok = false;
	}
	if (document.FrmEtape3.CP_Livraison.value.length < 1) {
		alert('Tapez une valeur pour le champ \"Code Postal\".');
		document.FrmEtape3.CP_Livraison.focus();
		ok = false;
	}
	if (document.FrmEtape3.Ville_Livraison.value.length < 1) {
		alert('Tapez une valeur pour le champ \"Ville\".');
		document.FrmEtape3.Ville_Livraison.focus();
		ok = false;
	}
	if (ok) document.FrmEtape3.submit();
}
function valideEtape4() {
    document.FrmEtape4.submit();
}
function valideEtape5() {
    ok = true;
    if (document.FrmEtape5.acheteur.value.length < 1) {
		alert('Entrez votre code acheteur.');
		document.FrmEtape5.acheteur.focus();
		ok = false;
	}
	if (ok) document.FrmEtape5.submit();
}
function DetailCommande(Id) {
	document.FrmTracking.Id_Commande.value = Id;
	document.FrmTracking.submit ();
}
function Sofinco() {
    document.FrmSofinco.submit();
}
function CarteBancaire(typeCarte) {
    document.FrmEtape5.TypePaiement.value = 'CB';
    document.FrmEtape5.typeCarte.value = typeCarte;
    document.FrmEtape5.submit();
}
function verifape(ape) {
    chaine = "0123456789";
    ok1 = true;
    numape = ape.toLowerCase();
	    if (numape.length == 5)
		    {
		    for (i=0; i<(numape.length-1); i++)
			    {
				    if (chaine.indexOf(numape.substr(i,1),0) == -1)
					    ok1 = false ;	
			    }
		    chaine = "abcdefghijklmnopqrstuvwxyz";
		    if (chaine.indexOf(numape.substr(i,1),0) == -1)
			    ok1 = false ;
		    }
	    else
		    {
		    ok1 = false;
		    }
    return ok1;
}
function verifsiret(siret) {
    chaine = "0123456789";
    oks = true;
    numsiret = siret.toLowerCase();
	    if (numsiret.length == 14)
		    {
		    for (i=0; i<(numsiret.length); i++)
			    {
				    if (chaine.indexOf(numsiret.substr(i,1),0) == -1)
					    oks = false ;	
			    }
		    }
	    else
		    {
		    oks = false;
		    }
    return oks;
}
function verifnumtva1(numtvatronc,nb,type)
{
switch (type)
{
	case 1 : chaine = "0123456789"; break;
	case 2 : chaine = "0123456789abcdefghijklmnopqrstuvwxyz"; break;
	default : ok1 = false;
}
	ok1=true;
	num = numtvatronc.toLowerCase();
	if (nb == num.length)
		{
		for (i=0; i<num.length; i++)
			{
				if (chaine.indexOf(num.substr(i,1),0) == -1)
					ok1 = false ;	
			}
		}
	else
		{
		ok1 = false;
		}
return ok1;
}
function verifnumtva(numtva)
{
chaine = "0123456789abcdefghijklmnopqrstuvwxyz";
chaine = "0123456789";
bon = true;
ok2=true;
num = numtva.toLowerCase();

switch (num.substr(0,2))
{
case "fr": ok2 = verifnumtva1((num.substr(2,(num.length - 2))),11,1);break;
case "de": ok2 = verifnumtva1((num.substr(2,(num.length - 2))),9,1);break;
case "at": ok2 = verifnumtva1((num.substr(2,(num.length - 2))),9,2);break;
case "be": ok2 = verifnumtva1((num.substr(2,(num.length - 2))),9,1);break;
case "dk": ok2 = verifnumtva1((num.substr(2,(num.length - 2))),8,1);break;
case "es": ok2 = verifnumtva1((num.substr(2,(num.length - 2))),9,2);break;
case "fi": ok2 = verifnumtva1((num.substr(2,(num.length - 2))),8,1);break;
case "gb": ok2 = verifnumtva1((num.substr(2,(num.length - 2))),9,1);break;
case "el": ok2 = verifnumtva1((num.substr(2,(num.length - 2))),9,1);break;
case "ie": ok2 = verifnumtva1((num.substr(2,(num.length - 2))),8,2);break;
case "it": ok2 = verifnumtva1((num.substr(2,(num.length - 2))),11,1);break;
case "lu": ok2 = verifnumtva1((num.substr(2,(num.length - 2))),8,1);break;
case "nl": alert("nl");break;
case "pt": ok2 = verifnumtva1((num.substr(2,(num.length - 2))),9,1);break;
case "se": ok2 = verifnumtva1((num.substr(2,(num.length - 2))),12,1);break;
default: 
	alert("La syntaxe du N° intracommunautaire est incorrecte");
	bon = false;
}
if (ok2 == false)
{
	alert("La syntaxe du N° intracommunautaire est incorrecte");
	bon = false;
}
return bon;
}
//-->
