// JavaScript Document

<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function popup(page,PWidth,PHeight,id) {

	eval("fineline"+id+"=window.open('"+page+"','fineline0','toolbar=0,scrollbars=NO,location=0,status=0,menubars=0,resizable=0, title=0, width="+PWidth+",height="+PHeight+"')")
	eval("fineline"+id+".window.moveTo((screen.width/2)-(PWidth/2),(screen.height/2)-(PHeight/2))")	
}


//-->
<!----------------------------------------------------------------------------------------------->
<!-- fonction pour valider les champs du formulaire francais------------------->
function verifSelection() {if (mail_form.nom.value == "") {
alert("Vous devez inscrire votre nom")
return false
} if (mail_form.prenom.value == "") {
alert("Vous devez inscrire votre prénom")
return false
} if (mail_form.ville.value == "") {
alert("Vous devez inscrire votre ville")
return false
} if (mail_form.code_postal.value == "") {
alert("Vous devez inscrire votre code postal")
return false
} if (mail_form.province.value == "") {
alert("Vous devez inscrire votre province")
return false
} if (mail_form.courriel.value == "") {
alert("Vous devez inscrire votre courriel")
return false
}

invalidChars = " /:,;'"

for (i=0; i<invalidChars.length; i++) {	// does it contain any invalid characters?
badChar = invalidChars.charAt(i)

if (mail_form.courriel.value.indexOf(badChar,0) > -1) {
alert("Votre adresse e-mail contient des caractères invalides. Veuillez vérifier.")
mail_form.courriel.focus()
return false
}
}

atPos = mail_form.courriel.value.indexOf("@",1)			// there must be one "@" symbol
if (atPos == -1) {
alert('Votre adresse e-mail ne contient pas le signe "@". Veuillez vérifier.')
mail_form.courriel.focus()
return false
}

if (mail_form.courriel.value.indexOf("@",atPos+1) != -1) {	// and only one "@" symbol
alert('Il ne doit y avoir qu\'un signe "@". Veuillez vérifier.')
mail_form.courriel.focus()
return false
}

periodPos = mail_form.courriel.value.indexOf(".",atPos)

if (periodPos == -1) {					// and at least one "." after the "@"
alert('Vous avez oublié le point "." après le signe "@". Veuillez vérifier.')
mail_form.courriel.focus()
return false
}

if (periodPos+3 > mail_form.courriel.value.length)	{		// must be at least 2 characters after the 
alert('Il doit y avoir au moins deux caractères après le signe ".". Veuillez vérifier.')
mail_form.courriel.focus()
return false
}} // Fin de la fonction

<!----------------------------------------------------------------------------------------------->





<!-- fonction pour valider les champs du formulaire ENGLISH------------------->
function verifSelection_eng() {if (mail_form.nom.value == "") {
alert("You must type your name")
return false
} if (mail_form.prenom.value == "") {
alert("You must type your first name")
return false
} if (mail_form.ville.value == "") {
alert("You must type your city")
return false
} if (mail_form.zip_code.value == "") {
alert("You must type your zip code")
return false
} if (mail_form.province.value == "") {
alert("You must type your province or state")
return false
} if (mail_form.courriel.value == "") {
alert("You must type your email")
return false
}

invalidChars = " /:,;'"

for (i=0; i<invalidChars.length; i++) {	// does it contain any invalid characters?
badChar = invalidChars.charAt(i)

if (mail_form.courriel.value.indexOf(badChar,0) > -1) {
alert("Your email addess contains invalid caracters. Please verify")
mail_form.courriel.focus()
return false
}
}

atPos = mail_form.courriel.value.indexOf("@",1)			// there must be one "@" symbol
if (atPos == -1) {
alert('There must be one "@" symbol. Please verify.')
mail_form.courriel.focus()
return false
}

if (mail_form.courriel.value.indexOf("@",atPos+1) != -1) {	// and only one "@" symbol
alert('There must be only one "@" symbol. Please verify.')
mail_form.courriel.focus()
return false
}

periodPos = mail_form.courriel.value.indexOf(".",atPos)

if (periodPos == -1) {					// and at least one "." after the "@"
alert('There must be a comma after the "@" symbol. Please verify.')
mail_form.courriel.focus()
return false
}

if (periodPos+3 > mail_form.courriel.value.length)	{		// must be at least 2 characters after the 
alert('There must be at least 2 characters after the ".". Please verify.')
mail_form.courriel.focus()
return false
}} // Fin de la fonction

<!----------------------------------------------------------------------------------------------->

sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
