$(document).ready(function(){ 
    	
	//$("ul.sidenav").supersubs({ 
    //       	minWidth:    5,   // minimum width of sub-menus in em units 
    //        maxWidth:    19,   // maximum width of sub-menus in em units 
    //        extraWidth:  1     // extra width can ensure lines don't sometimes turn over 
                               // due to slight rounding differences and font-family 
    //}); 
		
	$('#disclaimer').hide();
	$('#sitemap').hide();

	$('a#toggle-disclaim').click(function() {
	  $('#disclaimer').toggle(400);
	  return false;
	});

	$('a#toggle-sitemap').click(function() {
	  $('#sitemap').toggle(400);
	  return false;
	});
	$('a.external').click(function(){
        window.open(this.href);
        return false;
    });
	
	
});
	
$(document).ready(function(){
		$("#mast").newsticker();
	}); 
	$(function() {
    $("#headlines").jCarouselLite({
        btnNext: ".next",
        btnPrev: ".prev",
		auto: 3600,
		speed: 3200
    });
});
	
$(function () {
        // basic version is: $('div.demo marquee').marquee() - but we're doing some sexy extras
		$("#scroller").simplyScroll({
			className: 'vert',
			horizontal: false,
			frameRate: 20,
			speed: 1,
			autoMode: 'loop'
		});
		
    });

jQuery(document).ready(function() { 
								// clear input on focus
jQuery('.searchClear').focus(function()
{
if(jQuery(this).val()==$(this).attr('title'))
{
clearMePrevious = $(this).val();
jQuery(this).val('');
}
});

// if field is empty afterward, add text again
jQuery('.searchClear').blur(function()
{
if(jQuery(this).val()=='')
{
jQuery(this).val(clearMePrevious);
}
});
});

//Jay
$(document).ready(function() {
	
//On Hover Over
function megaHoverOver(){
    $(this).find(".sub").stop().css({'left':'207px'}).fadeTo('fast', 1).show(); //Find sub and fade it in
	//$(this).find(".sub").stop().fadeTo('fast', 1).show(); //Find sub and fade it in
    
	(function($) {
        //Function to calculate total width of all ul's
        jQuery.fn.calcSubWidth = function() {
            rowWidth = 0;
            //Calculate row
            $(this).find("ul").each(function() { //for each ul...
                rowWidth += $(this).width(); //Add each ul's width together
            });
			
			rowWidth += 3;
        };
    })(jQuery); 
	
	$(this).calcSubWidth();  //Call function to calculate width of all ul's
    $(this).find(".sub").css({'width' : rowWidth}); //Set Width

}
//On Hover Out
function megaHoverOut(){
  $(this).find(".sub").stop().fadeTo('fast', 0, function() { //Fade to 0 opactiy
      //$(this).hide();  //after fading, hide it
	  $(this).css({'left':'-9999em'});
  });
}


//Set custom configurations
var config = {
     sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)
     interval: 200, // number = milliseconds for onMouseOver polling interval
     over: megaHoverOver, // function = onMouseOver callback (REQUIRED)
     timeout: 400, // number = milliseconds delay before onMouseOut
     out: megaHoverOut // function = onMouseOut callback (REQUIRED)
};

$("ul.sidenav li .sub").css({'opacity':'0'}); //Fade sub nav to 0 opacity on default
$("ul.sidenav li").hoverIntent(config); //Trigger Hover intent with custom configurations

	
});