function jq_form_validate(f) 
{
    var valid = true;	
    jQuery('#contact_form').find(".required").each(function(el){	
        if (isEmpty($(this).val()) ) {
            valid= false;
            $(this).addClass("notvalid");
        }
    });
    if ( !valid ) {
        alert("Formulaire incomplet !");
    }
    return valid;
}

function isEmpty(value) 
{
    if (value) {
        for (var i= 0; i < value.length; i++) {
            var c = value.charAt(i);
            if ((c != ' ') && (c != '\n') && (c != '\t')) {
                return false;
            }
        }
        return true;
    } else {
        return true;
    }
}

jQuery(function() {
    $(".required").focus(function() {
        $(this).removeClass("notvalid");
    });
    
    $('#contact_form').submit(function() {
        if( jq_form_validate('#contact_form') ) {
            //$(this).ajaxSubmit(); 
            alert("Merci, votre message a bien été envoyé.  Nous communiquerons avec vous sous peu.");
            //self.parent.TB_remove();
            return true;
            //return false; 
        }
        return false; 
    });
    
});