$(document).ready(function() {

    $('#announcements tbody tr').hover(function() {
        $(this).addClass('announsHighlight');
    }, function() {
        $(this).removeClass('announsHighlight');
    });

    $('#announcements tbody tr').click(function() {
        window.location.href = '/announcement/view/' + this.id;
    });

    $('#filterAnnAll').addClass('pointer').click(function() {
        $(document.body).addClass('wait');
        $('#blockAnnouncements').load('/announcement/filter/', {
            filter: 0,
            idrubric: $('#idRubric').val(),
            pageNum: $('#pageNum').val()},
        function() {$(document.body).removeClass('wait');});
    });

    $('#filterAnnSale').addClass('pointer').click(function() {
        $(document.body).addClass('wait');
        $('#blockAnnouncements').load('/announcement/filter/', {
            filter: 1,
            idrubric: $('#idRubric').val(),
            pageNum: $('#pageNum').val()},
        function() {$(document.body).removeClass('wait');});
    });

    $('#filterAnnVacancy').addClass('pointer').click(function() {
        $(document.body).addClass('wait');
        $('#blockAnnouncements').load('/announcement/filter/', {
            filter: 2,
            idrubric: $('#idRubric').val(),
            pageNum: $('#pageNum').val()},
        function() {$(document.body).removeClass('wait');});
    });

});
