﻿$(document).ready(function() {

    // Find list items representing folders and
    // style them accordingly.  Also, turn them
    // into links that can expand/collapse the
    // tree leaf.
    $('.helpMenu li > ul').each(function(i) {
        // Find this list's parent list item.
        var parent_li = $(this).parent('li');

        // Style the list item as folder.
        parent_li.addClass('folder');

        // Temporarily remove the list from the
        // parent list item, wrap the remaining
        // text in an anchor, then reattach it.
        var sub_ul = $(this).remove();
        parent_li.wrapInner('<a/>').find('a').click(function() {
            // Make the anchor toggle the leaf display.
            // Make iFrame readjust according to height needed.
            sub_ul.toggle();
            sub_ul.find('a').attr({
                onClick: "return true;"
            });
        });
        parent_li.append(sub_ul);
    });

    // Hide all lists except the outermost.
    $('.helpMenu ul ul').hide();

    //custom JQuery CSS
    //$('.helpMenu li:first').css("font-style", "italic");
    //$('.helpMenu li:first').css("padding-bottom", "6px");
    //$('.helpMenu ul:first').css("margin-left", "-15px");

    $('.index').click(function() {
        $('.cnt').hide();
        $('.idx').show();
    }
    );

    $('.content').click(function() {
        $('.idx').hide();
        $('.cnt').show();
    }
    );
});	
