Valraiso.namespace('cfi.contact');
cfi.contact =
{
    submitFormContact : function()
    {
        var noerror = true;
        
        noerror = cfi.checkField('name')      && noerror;
        noerror = cfi.checkField('societe')   && noerror;
        noerror = cfi.checkEmail('email')     && noerror;
        noerror = cfi.checkField('telephone') && noerror;
        noerror = cfi.checkField('content')   && noerror;

        if ($('#objectDemand').length > 0) {
        
            noerror = cfi.checkField('objectDemand')  && noerror;
        }

        if (noerror) {
        
            $('#contact-form').submit();
        }
        
        return false;
    },
    
    submitNewsletter : function()
    {
        var noerror = true;
        noerror = cfi.checkEmail('email')  && noerror;
        if (noerror)
        {
            $('#newsletter-form').submit();
        }
        
        return false;
    },
    
    submitFormRecrutement : function()
    {
        var noerror = true;
        
        noerror = cfi.checkListField('gender') && noerror;
        noerror = cfi.checkField('name')       && noerror;
        noerror = cfi.checkField('firstname')  && noerror;
        noerror = cfi.checkEmail('email')      && noerror;
        noerror = cfi.checkField('telephone')  && noerror;
        noerror = cfi.checkField('address')    && noerror;
        noerror = cfi.checkField('zip')        && noerror;
        noerror = cfi.checkField('city')       && noerror;
        noerror = cfi.checkField('content')    && noerror;
        
        if (noerror) {
        
            $('#recrut-form').submit();
        }
        
        return false;
    }
}
