menu = 
{
    bulletDown  : 'url(images/menu_bullet-down.gif)',
    bulletRight : 'url(images/menu_bullet-right.gif)',

    init: function(){
            
        //collapse all except the one marked as 'expanded' with the class .expanded
        $('.navWrap>li>strong:not(.expanded, .relatedTopics)').each(function(){
            $('+ul', this).css({display: 'none'});
        });
        $('.navWrap>li>strong:not(.relatedTopics), .navWrap>li>a>strong:not(.relatedTopics)').each(function(){$(this).css({
                cursor: 'pointer',
                backgroundImage: menu.bulletRight
            });
        });
            //change expanded image
            $('.expanded').css('background-image', menu.bulletDown);
            $('.navWrap>li>strong').click(function(){
               if($(this).hasClass('relatedTopics'))
                {
                    return
                };
                if($(this).hasClass('expanded'))
                {
                    menu.collapse(this);
                }
                else
                {
                    menu.expand(this);   
                     
                }
            });
    },
    collapse : function(e){
        $('+ul', e).slideUp('slow', function(){
            $(e).css('background-image', menu.bulletRight);
            $(e).removeClass('expanded');
            lcolHeight = $('#lCol').outerHeight();
            wrapperHeight = $('#midWrap').outerHeight();
            contHeight = $('#midWrap #content').outerHeight();
            if(lcolHeight < wrapperHeight) { $('#midWrap').css('height', (contHeight > lcolHeight) ? contHeight : lcolHeight + 'px'); }
        });
    },
    expand : function(e) {
        $('+ul', e).slideDown('slow', function(){
            $(e).css('background-image', menu.bulletDown);
            $(e).addClass('expanded');
            lcolHeight = $('#lCol').outerHeight();
            wrapperHeight = $('#midWrap').outerHeight();
            if(lcolHeight > wrapperHeight) { $('#midWrap').css('height', (lcolHeight-10) + 'px'); }
        });
    }
}



$(function(){
    //round the corners in a less DOM intensive way

    $('.rounded').each(function(){
        if($(this).children('span.tr, span.bl, span.br, span.tl').length == 0)
        {
            $(this).prepend('<span class="tr">&nbsp</span>')
                   .prepend('<span class="tl">&nbsp</span>')
                   .append ('<span class="bl">&nbsp</span>')
                   .append ('<span class="br">&nbsp</span>');
        }
    });

//$('.rounded').corner();
    
    //menu.init();
    
    
    //make sure right column doesnt go over end of document
    rcolHeight = $('#rCol').outerHeight();
    lcolHeight = $('#lCol').outerHeight();
    wrapperHeight = $('#midWrap').outerHeight();
    if(rcolHeight > wrapperHeight || lcolHeight > wrapperHeight) {  $('#midWrap').css('height', (rcolHeight > lcolHeight) ? rcolHeight : lcolHeight + 'px');  }
});
