// Initialize the Scripts for this site.

$(document).ready(function() {
    
    // Opens up certain links in new window:
    $('.lnkBlank').click(function() {
        window.open($(this).attr('href'), 'newWindow', '');
        return false;
    });
    
    $('#search input.txtSearch').focus(function() {
        $(this).select();
    });
    
    $('ul#Menu li.item:not(:last)').each(function() {
        $(this).after('\n                <li class="separator"><img src="/menu-separator.gif" width="2" height="50" alt="" /></li>');
    });
    
    // Hides list item images if no src is defined:
    $('img.listItemImage').each(function() {
        if ($(this).attr('src') == '') {
            $(this).hide();
        }
    });
    
    // Category Menu Formatting / Styling:

    // Show 3rd level when 3rd level is selected:
    $('#categoryMenu li ul li a.current').each(function() {
        $(this).parent().find('ul:first').show();
    });

    // Show 3rd level when 4rd level is selected:
    $('#categoryMenu li ul li ul li a.current').each(function() {
        $(this).parent().parent().show();
    });
    
    // Show 4rd level when 4rd level is selected:
    $('#categoryMenu li ul li ul li ul li a.current').each(function() {
        $(this).parent().parent().parent().parent().show();
    });
    
    // Add the Arrow to the top level categories:
    $('#categoryMenu > li').each(function() {
        $(this).css('background','url("/category-menu-main-arrow.gif") no-repeat 0px 5px');
    });
    
});