function toggleVisibility(id) {
    jQuery('#' + id).toggle();
};

function com_super_expand(sc) {
    jQuery('.com_major').data('v', false);
    jQuery('.com_minor').hide();
    jQuery('.com_major_cont').hide();
    jQuery('.com_super_' + sc).show();
    jQuery('.com_super_' + sc + ' .com_major').show();
};

function com_major_expand2(elJQ, maj) {
    if (!elJQ.data('v')) {
        jQuery('.com_major').data('v', false);
        jQuery('.com_major').hide();
        jQuery('.com_minor').hide();
        elJQ.data('v', true);
        jQuery('.com_' + maj).show();
        jQuery('.com_major_' + maj).show();
        return false;
    }
    return true;
};

function com_major_expand(sc, maj) {
    var majElJQ = jQuery('.com_' + maj);
    var majElLoaded = majElJQ.data('l');
    if (!majElLoaded) {
        jQuery.ajax({
            url: '/ajax/CommodityMinorCategoryMenu.aspx?sc=' + escape(sc) + '&maj=' + escape(maj),
            success: function(d, textStatus, jqXHR) {
                jQuery(majElJQ).data('l', true);
                jQuery(majElJQ).after(d);
                com_major_expand2(jQuery(majElJQ), maj);
            }
        });
        return false;
    }
    return com_major_expand2(majElJQ, maj);
};
