﻿function ValideCourriel(strLangue)
{
    var tbCourriel;
    tbCourriel = document.getElementById("iAbonnement"); 
    
	//Courriel
	if (tbCourriel.value == "")
	{
		if (strLangue == "fr")
			alert("Vous devez entrer un courriel.");
		else
			alert("You must enter your email.");
			
		tbCourriel.focus();
		return false;
	}
	
	if (!ValiderCourriel(tbCourriel.value))
	{
		if( strLangue == "fr" )
			alert("Vous devez entrer un courriel valide.");
		else
			alert("You must enter a valid email.");
			
		tbCourriel.focus();
		return false;
	}
}

function ValiderCourriel(strCourriel)
{
    var courrielReg = "^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$";
    var regex = new RegExp(courrielReg);
    return regex.test(strCourriel);
}