//-- All plugin/jquery function additions should be added in the below format, within the 'globalLib' var, then initialized after the jQuery $(function(){
//
//		 	,COMMON_NAME_OF_LIBRARY_ITEM_TO_BE_INITIALIZED :
//			{
//				init : function()
//				{
//					YOUR CODE HERE
//				}
//			} -----Add comma here only if you add more rules; the last rule should not have a comma here	 

var globalLib =
{

//Basic HTML and utility functions
//---------------------------------------------------------------------------------
	html_functions :
	{
		init : function() 
		{
			// Some effects rely on an element to be initially hidden,
			// but we only hide them if the user has javascript
			$('.jshide').addClass('hide');

			//prepend "More in this Section" to sub_nav
			//$('p.sub_nav').prepend('<strong>More in this section: </strong>');
			
			// Open external links in new windows
			$('a[href^="http://"], a[href^="https://"]')
				.not('a[href$=".doc"], a[href$=".pdf"]')
				.addClass('external').attr('target', '_blank');
			
			// Open pdf links in new windows + add icon
			$('a[href$=".pdf"]').attr('target', '_blank').not('[class*="noicon"]').append('<span/>').addClass('pdf');
			
			// Open M$ doc links in new windows + add icon
			$('a[href$=".doc"]').attr('target', '_blank').not('[class*="noicon"]').append('<span/>').addClass('doc');
		}//end HTML init
	}//end HTML functions


// IE6 Duct Tape	
//-------------------------------------------------------------------------------
	,ie_functions :
	{
		init : function()
		{
		  	//detects if browser is IE by checking leadingWhitespace property. 
		  	//See: http://docs.jquery.com/Utilities/jQuery.support
			var fancyHover = $.support.leadingWhitespace;
			if(fancyHover == false) 
			{//browser is IE, use script
				$('#nav ul li, #utility-nav ul li').bind('mouseenter mouseleave', function(){
					$(this).toggleClass('sfhover');
				});
			}//end if/else
		}//end ie init
	}//end ie_functions


// Navigation
//-------------------------------------------------------------------------------
	,navigation :
	{
		init : function()
		{
			//superfish menus
			$.xLazyLoader({
				js: 'http://21.scripts.sesamehost.com/scripts/superfish.js',
				name: 'superfish',
				success: function() {
					$('#nav>ul, #utility-nav>ul, #logins>ul').superfish({ 
						hoverClass:		'sfhover',							//class used by IE for hover effects
				        delay:			500,                             	//one second delay on mouseout 
				        animation:		{opacity:'show',height:'show'},  	//fade-in and slide-down animation 
				        autoArrows:  	false,                           	//disable generation of arrow mark-up 
				        disableHI:   	true              					// set to true to disable hoverIntent detection
				    });
				}
			});
		}//end init
	}//end navigation	
};//end globalLib


//JQuery Setup
$(function(){  
  //globalLib.navigation.init();
  globalLib.ie_functions.init();
  globalLib.html_functions.init();
});//end document.ready
