function AffButton (label, link){
    document.write("<div align=center>");
    document.write("<table cellpadding=0 cellspacing=0><tr>");
    document.write("<td><a href='");
    document.write(link);
    document.write("'><img src=images/BtLeft.png border=0></a></td>");
    document.write("<td class=button>");
    document.write("<a href='");
    document.write(link);
    document.write("' class=ButtonLabel>");
    document.write(label.toUpperCase());
    document.write("</a>");
    document.write("</td>");
    document.write("<td><a href='");
    document.write(link);
    document.write("'><img src=images/BtRight.png border=0></a></td>"); 
    document.write("</tr></table>"); 
    document.write("</div>"); 
}

function AjoutSelection(ref)
{
	var Txt = eval("document.Prod" + ref + ".InputQte.value");
	var Unite = eval("document.Prod" + ref + ".UniteSym.value");
	var Prix = eval("document.Prod" + ref + ".Prix.value");
	Prix = (parseFloat(Prix) * parseFloat(Txt));
	if (Txt == "")
		{alert ("Veuillez indiquer une quantite SVP");}
		else
		{
		if(isNaN(Txt))
			{alert ("La quantite indiquee n'est pas valide.");}
		else
		{
			if (Unite == ""){Txt = (Txt + " x ");}else{Txt = (Txt + Unite + "&nbsp;")}
			Txt = Txt + eval("document.Prod" + ref + ".TitreProd.value");
			//if (!isNaN(Prix)) {Txt = Txt + " [&nbsp;" + Prix + "&nbsp;&euro;&nbsp;]";}
			eval("document.Prod" + ref + ".article.value= Txt");
			eval("document.Prod" + ref + ".submit()");
		}
		}
}
 
function ValideList()
{

//alert (document.ValideList.Liste.value);
 if (document.ValideList.Liste.value == ""){document.ValideList.Liste.value = " "}
 document.ValideList.submit();
}

/* email validation script */
function echeck(str) {
		var errormessage = "Adresse e-mail non valide"
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert(errormessage)
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert(errormessage)
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert(errormessage)
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert(errormessage)
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert(errormessage)
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert(errormessage)
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert(errormessage)
		    return false
		 }

 		 return true					
	}

function ValidateForm(){
	var emailID=document.contactform.email
	var nom=document.contactform.nom
	var departement=document.contactform.departement
	if ((nom.value==null)||(nom.value=="")){
		alert ("Veuillez indiquer votre nom");
		nom.focus();
		return false;
		}
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Veuillez indiquer votre adresse e-mail.");
		emailID.focus();
		return false;
	} 
	if ((departement.value==null)||(departement.value=="")){
		alert ("Veuillez indiquer votre departement ou pays\nafin de nous permettre de calculer les frais de port");
		departement.focus();
		return false;
		} 
	if (echeck(emailID.value)==false){
		emailID.value="";
		emailID.focus();
		return false;
	}
	return true
 }
/* END email validation script */

