/*
    Copyright © 2006, 2007 Positive Friends Inc.
    All Rights Reserved.
*/

// If we have jQuery loaded
if (typeof(jQuery) != 'undefined'){

    // When the DOM is ready
    $(document).ready(function(){

        // Get the description of the navigation path
        var navId = new String($(document.body).attr('class'));

        // Get a reference to the title node that describes where we are in the site
        var navObj = $('#'+navId);

        // Add the select class to the title node
        $(navObj).addClass('select');

        // If this is the main navigation path
        if (navId.substring(0,5) == 'main-' && navId != 'main-health'){

            // Show the correct sub navigation option
            $('#sub-'+navId.substring(5)).show();

        // If this is a sub naviagtion path
        } else if (navId.substring(0,4) == 'sub-'){

            // Get the navigation element
            var element = navId.substring(0,navId.lastIndexOf('-'));

            // Show the sub navigation element
            $('#'+element).show();

            // Add the select class to the sub navigation element
            $('#'+element.substring(element.lastIndexOf('-'))).addClass('select');

            // Add the select class to the main navigation element
            $('#main-'+element.substring(element.lastIndexOf('-') + 1)).addClass('select');

            // Add the select class to the utility navigation element
            $('#utility-'+element.substring(element.lastIndexOf('-') + 1)+'-alt').addClass('select');
        }

        // Turn the title attribute of tooltip elements into tooltips
        $('.tip').ToolTip({
	        
	        // Set the options for the tooltips
			className: 'tooltip',
			position: 'mouse',
			delay: 200
		});
    });
}
