function hideShow(id, target_id) {

    treeView(target_id);

    $("#" + id).click(function() {

        if ($.cookie(target_id) != 'shown') {
            $("#" + target_id).slideDown('normal');
            $.cookie(target_id, 'shown');
        } else {
            $("#" + target_id).slideUp('normal');
            $.cookie(target_id, 'hidden');
        }
    });

    if ($.cookie(target_id) != 'shown')
        $('#' + target_id).hide();
}

function treeView(wrapper_id) {
    $("#" + wrapper_id + " ul:first").attr('css', 'treeview').treeview({
        collapsed: true,
        unique: true,
        persist: "cookie",
        cookieId: wrapper_id + "treeview"
    });
}





$(document).ready(function() {
    // U bent Bemiddelaar Menu
    hideShow('verzekeringsmarkt', 't-verzekeringsmarkt');
    hideShow('waarom', 't-waarom');
    hideShow('samenwerking', 't-samenwerking');
    hideShow('minuten', 't-minuten');
    hideShow('producten', 't-producten');
    hideShow('kantoormodules', 't-kantoormodules', 'test');
    hideShow('webmodules', 't-webmodules');
    hideShow('abonnementen', 't-abonnementen');
    hideShow('webtotaal', 't-webtotaal');
    hideShow('mijnpolismap', 't-mijnpolismap');
    hideShow('backoffice', 't-backoffice');


    // U bent consument
    hideShow('bereken', 't-bereken');

    // Werken bij Voogd Menu
    hideShow('Vacatures', 't-vacatures');

    // Over ons
    hideShow('watwijzijn', 't-watwijzijn');
    hideShow('onzemissie', 't-onzemissie');
    hideShow('watwijbeloven', 't-watwijbeloven');
    hideShow('onssponsorbeleid', 't-onssponsorbeleid');

    // Contact
    hideShow('contactformulier', 't-contactformulier');

});