var current_vc_switch = null;

$(document).ready(function(){
    $("a.category_switch").click(function(event){
        var filter = $(this).attr('data-category');
        if(current_vc_switch) {
            current_vc_switch.removeClass('active');
        }
        current_vc_switch = $(this);
        current_vc_switch.addClass('active');
        $.cookie('asw', filter, {path: '/'});
        if(filter != 'all') {
            $("#frames .frame").each(function(){
                if($(this).hasClass("c"+filter)) {
                    $(this).show();
                } else {
                    $(this).hide();
                }
            });
        } else {
            $("#frames .frame").each(function(){
                $(this).show();
            })
        }
    });
});

$(document).ready(function(){
    asw = $.cookie('asw');
    if(asw) {
        $("#csw"+asw).click();
    }
});

