$(document).ready(function()
{

    $('#menu a').each(function()
    {     
        if($(this).attr('href') == window.location.pathname)
        {        
            $(this).parent().parent().addClass('current');
        
            if($(this).hasClass('sub_item'))
            {        
                var found = false;
            
                var oElement = $(this).parent().parent();
            
                while(found == false)
                {
                    oElement = oElement.prev();
                    
                    oChild = oElement.children('h2').children('a');
                    
                    if(!oChild.hasClass('sub_item'))
                    {
                        oChild.parent().parent().addClass('current');
                        
                        found = true;   
                    }            
                }
            }
        }     
    });    
    
    $('a.external').click(function()
    {
        window.open(this.href);
        return false;
    });
    
    $('#content img').each(function()
    {
        var sFloat = $(this).css('float');  
        
        if(sFloat == 'left')
        {
            $(this).css('margin-right', '10px');
        } 
        else if(sFloat == 'right')
        {
            $(this).css('margin-left', '10px');
        }  
    });
    
});


