function popupTetC(doc)
{
	window.open(doc,
				"Politique de confidentialité et sécurité de l'information.",
				"status=0, height=300, width=500,resizable=0,scrollbars=1,menubar=0,location=0"
				)
}

function emailcheck(str) 
{
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	
	/* no @ found */
	if (str.indexOf(at)==-1)
	   return -1;

	/* @ not found, or at beginning or end of string */
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)
		return -1;

	/* . (dot) not found, or at beginning or end of string */
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr)
	    return -1;

	/* . (dot) not found after @ */
	if (str.indexOf(at,(lat+1))!=-1)
	    return -1;

	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)
	    return -1;

	if (str.indexOf(dot,(lat+2))==-1)
	    return -1;

	if (str.indexOf(" ")!=-1)
	    return -1;

	return 0;
}


function validate(thisform)
{
	var msg = "";
	var thisChecked = 0;

	for (i=0; i<thisform.lignedemontant.length; i++)
	{
		if (thisform.lignedemontant[i].checked)
		{
	        if (thisform.lignedemontant[i].value == "autre")
	        {	/* autre montant */
				thisChecked = 2;
			}
			else
				thisChecked = 1;
		}
	}

	switch (thisChecked)
	{
		case 0:
			msg += "* Ligne de Montant\n";
			break;
		case 2:
			if (thisform.autremontant.value == "")
				msg += "* Un Valeur Autre Montant\n";
			break;
	}

	thischecked = 0;

	if (thisform.prenom.value == '')
		msg += "* Prénom\n";
		
	if (thisform.nom.value == '')
		msg += "* Nom\n";

	if (thisform.adresse1.value == '')
		msg += "* Adresse\n";

	if (thisform.ville.value == '')
		msg += "* Ville\n";

	if (thisform.etat.value == '')
		msg += "* Province/Etat\n";

	if (thisform.codepostal.value == '')
		msg += "* Code Postal\n";
		
	if (thisform.email.value == '')
		msg += "* Adresse courriel\n";
	else
	{
		if (emailcheck(thisform.email.value) == -1)
			msg += "* Adresse courriel sont invalide\n";

		if (thisform.email.value != thisform.email2.value)
			msg += "* 'Adresse courriel' et 'Confirmation courriel' doivent être les mêmes\n"
	}

	if (thisform.email2.value == '')
		msg += "* Confirmation courriel\n";
	else
		if (emailcheck(thisform.email2.value) == -1)
			msg += "* Confirmation courriel sont invalide\n";


	if (thisform.tetc.checked == false)
		msg += "* Soyez svp d'accord sur les termes et conditions générales";

	if (msg)
	{
		alert("Entrez, s'il vous plait:\n" + msg );
		return false;
	}
	else
		return true;

}