function trim(str)
{
   return str.replace(/^\s*|\s*$/g,"");
}

function validForm()
{
	var strErrorMsg = "";
	
	if (trim(document.FForm.INoClient.value) == "")
	{
		strErrorMsg = "Vous devez entrer votre numéro de client.";
		document.FForm.INoClient.focus();
	}
	else if (document.FForm.INoClient.value.search(/^([A-Za-z]|\d)\d{6}$/))
	{
		strErrorMsg = "Le numéro de client entré est invalide.";
		document.FForm.INoClient.focus();
	}
	else if (trim(document.FForm.IPrenom.value) == "")
	{
		strErrorMsg = "Vous devez entrer votre prénom.";
		document.FForm.IPrenom.focus();
	}
	else if (trim(document.FForm.INom.value) == "")
	{
		strErrorMsg = "Vous devez entrer votre nom.";
		document.FForm.INom.focus();
	}
	else if (trim(document.FForm.IAdresse.value) == "")
	{
		strErrorMsg = "Vous devez entrer votre adresse.";
		document.FForm.IAdresse.focus();
	}
	else if (trim(document.FForm.IVille.value) == "")
	{
		strErrorMsg = "Vous devez entrer votre ville.";
		document.FForm.IVille.focus();
	}
	else if (trim(document.FForm.ICodePostal.value) == "")
	{
		strErrorMsg = "Vous devez entrer votre code postal.";
		document.FForm.ICodePostal.focus();
	}
	else if (trim(document.FForm.ITelephone.value) == "")
	{
		strErrorMsg = "Vous devez entrer votre téléphone.";
		document.FForm.ITelephone.focus();
	}
	else if (trim(document.FForm.ICourriel.value) == "")
	{
		strErrorMsg = "Vous devez entrer votre adresse courriel.";
		document.FForm.ICourriel.focus();
	}
	else if (document.FForm.ICourriel.value.search(/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/) == -1)
	{
		strErrorMsg = "L'adresse courriel entrée est invalide.";
		document.FForm.ICourriel.focus();
	}
	else if (document.FForm.SPourcentage.selectedIndex == 0)
	{
		strErrorMsg = "Vous devez sélectionner le pourcentage de propane dans votre réservoir.";
		document.FForm.SPourcentage.focus();
	}
	
	if (strErrorMsg != "")
	{
		alert(strErrorMsg);
		return false;
	}
}