(function ($) {
  $.fn.validation = function () {
    var error = 0;
    $('.required', this).each(function () {
      var input = $(':input', this).attr("value");
      if (input == "") {
        $('label', this).addClass("error");
        $(':input', this).addClass("error");
        error++;
      } else {
        $('label', this).removeClass("error");
        $(':input', this).removeClass("error");
      }
    });

    if (error == 0) {
      var txt = $(this).find('input[type="submit"]').val();
      $(this).find('input[type="submit"]').attr('disabled', 'disabled').val('Pričekajte trenutak...');
      return true;
    } else {
      return false;
    }
  };
})(jQuery);