{


  String.prototype.trim = function() {
	    return this.replace(/^\s+|\s+$/g,"");
    }

    function ValidateEmail(email) {
    if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email)){
        return (true)
    }
    alert("Le courriel est invalide!")
    return (false)
    }

    function viewLegal() {
        myRef = window.open('http://www.systeme-analyse-boursier.com/termecondition.html','termcondition',
                'left=200,top=50,width=900,height=500,scrollbars=1,toolbar=1,resizable=1');

    }

    function valideInscription(form) {
        if (form.prenom.value.trim()=="") {
            alert("Le champ du Prenom est invalide!");
            form.prenom.focus();
            return (false)
        }

        if (form.nom.value.trim()=="") {
            alert("Le champ du Nom est invalide!");
            form.nom.focus();
            return (false)
        }

        if (form.pays.selectedIndex<1) {
            alert("Le champ du Pays est invalide!");
            form.pays.focus();
            return (false)
        }
        
        if (form.pays.selectedIndex==3) {
    
            //alert(form.annonceVille.selectedIndex);
            if (form.annonceVille.selectedIndex==0) {
                alert("Le champ de la Ville est invalide!");
                form.annonceVille.focus();
                return (false)
            }
        } else {
            if (form.annonceVilleName.value.trim()=="") {
                alert("Le champ du Ville est invalide!");
                form.annonceVilleName.focus();
                return (false)
            }
        }



        if (form.courriel.value.trim()=="") {
            alert("Le champ du Courriel est invalide!");
            form.courriel.focus();
            return (false)
        }

        
        if (ValidateEmail(form.courriel.value)) {
            if (form.motpasse.value.trim()=="") {
                alert("Le champ du Mot de passe est invalide!");
                form.motpasse.focus();
                return (false)
            }
            if (form.motpasse.value!=form.confirmmotpasse.value) {
                alert("La confirmation de votre mot de passe n'est pas identique a votre mot de passe!");
                form.motpasse.focus();
                return (false)
            }

            if (form.acceptTerm.checked == false) {
               alert("Vous devez cocher la boite pour les Modalités et Conditions.");
               form.acceptTerm.focus();
               return false;
            }

            form.submit();
        } else {
            form.courriel.focus();
        }
        
    }


}
