jQuery( function() {
    $( '#btnSend' ).live( 'click', function( event ) {
        var error = false;

       $.each( $( '.required' ), function() {
            if( $( this ).val() === '' ) {
                error = true;
                $( this ).addClass( 'invalid' );
            }
        } );

        if( error === false ) {
            $( this.parentNode.parentNode ).submit();
        }

        event.preventDefault();
    } );

    $( '.required' ).live( 'click', function( event ) {
        if( $( this ).hasClass( 'invalid' ) ) {
            $( this ).removeClass( 'invalid' );
        }
    } );
} );
