function ClearDefaultText(Which){
	if(Which.defaultValue==Which.value) Which.value="";
} 

function IsDate(dateStr) {

    var datePat = /^(\d{4})(\/|-)(\d{1,2})(\/|-)(\d{1,2})$/;
    var matchArray = dateStr.match(datePat); // is the format ok?

    if (matchArray == null) {
        //alert("Please enter date as either mm/dd/yyyy or mm-dd-yyyy.");
        return false;
    }

    year = matchArray[1]; // parse date into variables
    month = matchArray[3];
    day = matchArray[5];

    if (month < 1 || month > 12) { // check month range
        //alert("Les mois doivent être entre 1 and 12.");
        return false;
    }

    if (day < 1 || day > 31) {
        //alert("Les jours doivent être entre 1 et 31.");
        return false;
    }

    if ((month==4 || month==6 || month==9 || month==11) && day==31) {
        //alert("Le mois "+month+" n'a pas 31 jours!")
        return false;
    }

    if (month == 2) {
        var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
        if (day > 29 || (day==29 && !isleap)) {
            //alert("Fevrier " + year + " n'a pas " + day + " jours!");
            return false;
        }
    }
    return true; // la date est valide
}

function IsEmail(email) {
	// Vérifie si un Email est correct
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(email)) return true ; 
	else return false; 

}
function addFav() {
	nav = navigator.appName.substring(0,3);
	ver = navigator.appVersion.substring(0,1)
	url_site="http://www.sambafoot.com/";
	titre_site = "www.sambafoot.com";
	if (nav == "Mic" && ver >= 4) {
		window.external.AddFavorite(url_site, titre_site);
	} else {
		alert('Netscape : CTRL+D ');
	}
}

/* ----------------------------------------------------- */
function erreurs_formulaire(){
	this.lang="";
	this.nbr=0;
	this.texte="";
	this.ajout_texte = ajout_texte;
	this.get_result = get_result;
}	
function set_lang(lang){
	this.lang = lang ;
}
function ajout_texte(ajout){
	this.nbr = this.nbr + 1 ;
	this.texte = this.texte + "- " + ajout + "\n" ;
}
function get_result() {
	var buffer = "" ;
	if (this.nbr !=0) {
		/*if (this.lang == "Fr") {
			buffer = 'Renseignements incomplets :\n\n'+ this.texte +'\nMerci de completer le formulaire'
		}
		if (this.lang == "En") {
			buffer = 'Incomplete informations :\n\n'+ this.texte +'\nPlease complte the form'
		}
		if (this.lang == "Pt") {
			buffer = 'Incomplete informations :\n\n'+ this.texte +'\nPlease complte the form'
		}*/
		alert(this.texte);
		return false ;
	} else {
		return true ;
	}
}
/* ----------------------------------------------------- */