/*
Site-wide JS
*/

YAHOO.util.Event.onDOMReady(function(){
  var mozilla_menu_bar = new YAHOO.widget.MenuBar('menu_bar', {
    autosubmenudisplay: true,
    showdelay: 50,
    hidedelay: 50,
    iframe: false,
    lazyload: false,
    monitorresize: false,
    appendtodocumentbody: true
  });
	function menuBarOver(p_sType, p_aArgs) {
	    $("li.yuimenubaritem a.currentSection span").hide();
	}
	function menuBarOut(p_sType, p_aArgs) {
	    $("li.yuimenubaritem a.currentSection span").show();
	}
	
	mozilla_menu_bar.subscribe("mouseover", menuBarOver);
	mozilla_menu_bar.subscribe("mouseout", menuBarOut);


  mozilla_menu_bar.render();

  Cufon.replace('#menu_bar li a.section', {fontFamily:"InterstateRegular"});

  $("#breadcrumb ol li:eq(0)").remove();
  $("#breadcrumb ol li:eq(0)").addClass('first');
  Cufon.replace('#breadcrumb li', {fontFamily:"InterstateLight"});
  Cufon.replace('#newsticker h4', {fontFamily:"InterstateLight"});
	Cufon.replace('body#home .slideshow p.category', { fontFamily: 'InterstateRegular' });
	Cufon.replace('body#home .slideshow p.text', { fontFamily: 'InterstateRegular' });

  Cufon.replace('h2', {fontFamily:"InterstateRegular"});
	Cufon.replace('body#home .slideshow h2', { fontFamily: 'InterstateLight' });
  Cufon.replace('h3', {fontFamily:"InterstateRegular"});
  Cufon.replace('.blackbox p a', {fontFamily:"InterstateRegular"});
  Cufon.replace('#homepagecontent-wrapper h3.title, #section_blocks .container h3', {fontFamily:"InterstateLight"});
  Cufon.replace('#homepagecontent-wrapper h4.title, #calendar_view #calendar_header h1', {fontFamily:"InterstateRegular"});
  Cufon.replace('#sitemap li a.navButton', {fontFamily:"InterstateRegular"});
  $('#section_nav ul li:eq(0)').addClass('first-child');
  $('#section_nav ul:first > li:last').addClass('last-child');
  $('#section_nav ul:eq(0) li:eq(1)').addClass('second-child');
  // add current page to all of the parents
  $('#section_nav li:has(a.currentPage):not(ul ul li)').addClass('currentSection');
  $('.currentSection a:first').addClass('main_display');
  DD_roundies.addRule('#section_nav ul li.first-child', '0 10px 0 0', true);
  DD_roundies.addRule('#section_nav ul li.last-child', '0 0 10px 0', true);
  DD_roundies.addRule('.rounded_container', '7px', true);
 DD_roundies.addRule('.rounded_blue_button', '2px', true);
	$("li.yuimenubaritem a.currentSection span").width("100%");
  $("#SearchQ").hint();
 	// on the homepage make sure all the content blocks are the same height
	var tallest_box = 0;
	$("body#home div.blackbox").each(function(){
		if($(this).height() > tallest_box)
			tallest_box = $(this).height()
	});
	$("body#home div.blackbox").height(tallest_box);
});