//don't forget to include the Color Animations plugin
$(document).ready(function(){
    $(".vacancy_bl:even").addClass("alt");

    $(".vacancy_bl .to_memory").click(function(){
        var Id = $(this).attr('id');
        document.getElementById(Id + '_block').style.display = 'none';
        document.getElementById(Id + '_process').style.display = 'block';
        
        $.ajax({url:"/mysave.php?op=add&ob_id="+Id,
                type:"GET",
                data:{},
                error:function()
                     {alert("Error of data sending!")},
                success:function(K){
                                    $("#"+Id).parents(".vacancy_bl").animate({ backgroundColor: "#EBFDEC" }, "slow")
                                    document.getElementById(Id + '_process').style.display = 'none';
                                    document.getElementById(Id + '_save').style.display = 'block';
                                    }})

        return false;
    });
    
    $(".vacancy_bl .del_memory").click(function(){
        var Id = $(this).attr('id');
        Id = Id.substring(4,50);
        document.getElementById(Id + '_delmem').style.display = 'none';
        document.getElementById(Id + '_process').style.display = 'block';
        
        $.ajax({url:"/mysave.php?op=delete&ob_id="+Id,
                type:"GET",
                data:{},
                error:function()
                     {alert("Error of data sending!")},
                success:function(K){
                                    $("#"+Id).parents(".vacancy_bl").animate({ backgroundColor: "#F1F0F0" }, "slow")
                                    $("#"+Id).parents(".vacancy_bl").addClass("delete");
                                    document.getElementById(Id + '_process').style.display = 'none';
                                    document.getElementById(Id + '_block').style.display = 'block';
                                    }})

        return false;
    });

    $(".vacancy_bl .btn-delete").click(function(){
        alert("This comment will be deleted!");

        $(this).parents(".vacancy_bl").animate({ backgroundColor: "#fbc7c7" }, "fast")
        .animate({ opacity: "hide" }, "slow")
        return false;
    });

    $(".vacancy_bl .btn-unapprove").click(function(){
        $(this).parents(".vacancy_bl").animate({ backgroundColor: "#fff568" }, "fast")
        .animate({ backgroundColor: "#ffffff" }, "slow")
        .addClass("spam")
        return false;
    });

    $(".vacancy_bl .btn-approve").click(function(){
        $(this).parents(".vacancy_bl").animate({ backgroundColor: "#dafda5" }, "fast")
        .animate({ backgroundColor: "#ffffff" }, "slow")
        .removeClass("spam")
        return false;
    });

    $(".vacancy_bl .btn-spam").click(function(){
        $(this).parents(".vacancy_bl").animate({ backgroundColor: "#fbc7c7" }, "fast")
        .animate({ opacity: "hide" }, "slow")
        return false;
    });
});

