$(document).ready(function(){
    
    var content = $("#action-content");

    $("div.action-btn a").click(function(){
        // if class = on, already clicked, so unload
        if ($(this).hasClass("on")) {
            content.slideUp('fast');
            $(this).removeClass("on");
        }
        else {
            var bttn = $(this);
            $.ajax({
                dataType: "html",
                url: bttn.attr("href"),
                cache: false,
                beforeSend: function(){
                    $("#loadinfo").fadeIn('fast');
                    if ($("div.action-btn a").hasClass("on")) {
                        content.slideUp('fast');
                        $("div.action-btn a").removeClass("on");
                    }
                },
                success: function(html){
                    bttn.addClass("on");
                    content.html(html);
                },
                complete: function(){
                    content.slideDown();
                    $("#loadinfo").fadeOut('fast');
                }

            });
        }
        
        return false;
    });
    
});
