$(document).ready(function () {
    $("a.a_cat_list_authors").click(function(e){
        $(".cat_list_authors").load(WEBROOT + 'getcatlist/authors/' + $(this).attr('href'));
        e.preventDefault();
        return false;
    });
    $("a.a_cat_list_books").click(function(e){
        $(".cat_list_books").load(WEBROOT + 'getcatlist/books/' + $(this).attr('href'));
        e.preventDefault();
        return false;
    });

    if($(".booklist_sidebar_by_author:hidden").length > 0){
        $(".cat_list_authors").load(WEBROOT + 'getcatlist/authors/all/noset');
    }
    if($(".booklist_sidebar_by_title:hidden").length > 0) {
        $(".cat_list_books").load(WEBROOT + 'getcatlist/books/all/noset');
    }
});

function setCatlistLanguage(lang){
//    alert("Lang: " + lang);
    if(lang == null || lang == "")
        lang = "all";
    if($(".booklist_sidebar_by_author:hidden").length > 0){
        $(".cat_list_books").load(WEBROOT + 'getcatlist/books/current/lang/' + lang);
        $(".cat_list_authors").load(WEBROOT + 'getcatlist/authors/current/lang/' + lang);
    }
    else {
        $(".cat_list_authors").load(WEBROOT + 'getcatlist/authors/current/lang/' + lang);
        $(".cat_list_books").load(WEBROOT + 'getcatlist/books/current/lang/' + lang);
    }
}