$.fn.validate = function(ref) {
    var $aqui = true;
    var inputs = $(ref,this);
    $(inputs).each(function() {
        if ($(this).is(':text') || $(this).is(':password')) {
            if ($.trim($(this).val()) == '') {
                $aqui = false;
                alert('Campo Obrigatório !');
                $(this).focus();
                return false;
            }
        }
        else if ($(this).is('select')) {
            if ($(this).val() == '0') {
                $aqui = false;
                alert('Campo Obrigatório !');
                $(this).focus();
                return false;
            }
        }
    });
    if ($aqui == false) {
        return false;
    }
    else {
        return true;
    }
}
