﻿$(document).ready(function() {

    $('#tbSearch').val('');

    $('#tbSearch').keyup(function() {

        query = $(this).val().toLowerCase();

        if (query == "") {

            $('li[content="notarius"]').show();
            $('.letter_block_wrapper').show();
            return;
        }

        $('li[content="notarius"]').each(function() {

            var item = $(this).find('div.address');

            if (item.text().toLowerCase().search(query) == -1) {

                $(this).hide();

                if ($(this).parent().find('div:visible').size() == 0) {

                    $(this).parent().parent().hide();

                }

            }
            else {
                $(this).show();
                $(this).parent().parent().show();
            }
        });
    });
});
