$(document).ready(function(){
    $('#rightblock-vote-form').submit(function(){
        var elementset = $('#rightblock-vote-form input[type=radio]');
        var chkd = false;
        for(var i in elementset) chkd = chkd || elementset[i].checked;
        if(!chkd) return false;
        $('#rightblock-vote-form .vote-btn').css('display','none').parent().css('text-align','center').append('<div class="waiter" style="width:24px;height:24px;margin:0 auto;">&nbsp;</div>');
        $.ajax({
            type: "POST",
            async: true,
            dataType: 'html',
            cache: false,
            url: $(this).attr('action'),
            data: $(this).serialize(),
            success: function(msg){
                $('#voteblockwrapper').animate({opacity:0.01},600,function(){
                    $(this).html(msg).animate({opacity:1},500);
                });
            },
            error: function(XMLHttpRequest, textStatus, errorThrown){
                $('#rightblock-vote-form .vote-btn').css('display','block').parent().css('text-align','left').remove('.waiter');
                alert('Не возможно выполнить операцию!');
            }
        });
        return false;
    });
    
    $('#scheduleblock .schedule_groups_title').click(function(){
        $('#scheduleblock .schedule_groups:not(:hidden)').slideUp();
        $('#scheduleblock .schedule_lesson_description:not(:hidden)').slideUp();
        $(this).next('.schedule_groups:hidden').slideDown();
    });
    $('#scheduleblock .schedule_lesson_title').click(function(){
        $('#scheduleblock .schedule_lesson_description:not(:hidden)').slideUp();
        $(this).next('.schedule_lesson_description:hidden').slideDown();
    });
});
