// site specific javascript

if(!$.browser.safari)
{
	$(document).ready(function(){
		behavior_binder();
	});
}
else
{
	$(window).load(function(){
		behavior_binder();
	});
}


/*
Binds behaviors
** can be re-run whenever there are DOM changes
*/
function behavior_binder(){

/* DRAWS THE FONT IMAGE FOR THE TARGETED ELEMENT
	*/
	
	$('.module_header h2').each(function(){
		$(this).drawFont();
	});
	$('.module_title').each(function(){
		$(this).drawFont();
	});
	
/* TURNS ON INTERNAL TABS
	(requires jquery-ui-tabs.js)
	*/
	$("ul.module_tabs").tabs();

/* MAIN NAVIGATION DROP DOWN
	*/
	$('li.dropdownlink').hover(
		function() { $('#submenu', this).css('display', 'block'); },
		function() { $('#submenu', this).css('display', 'none'); }
	);
	
	$('#submenu, #main_nav ul li.dropdownlink a#shows').hover(
		function() { $('#main_nav ul li.dropdownlink a#shows').css('background-image', "url('_images/main_nav/nav_shows_hover-bkg.gif')"); },
		function() { $('#main_nav ul li.dropdownlink a#shows').css('background-image', "url('_images/main_nav/nav_shows-bkg.gif')"); }
	);


/* ADD FIRST/LAST TO LI
		adds a class 'first' to the first LI, and a 'last' to the last LI and 'first last' to a single LI
	*/
	$('ul').each(function(i){
		$(this).children('li:first').addClass('first');
		$(this).children('li:last').addClass('last');
	});
/* ADD FIRST/LAST TO DT/DD
		adds a class 'first' to the first DT and DD, and a 'last' to the last DT and DD and 'first last' to a single DT and DD
	*/
	$('dl').each(function(i){
		$(this).children('dt:first').addClass('first');
		$(this).children('dt:last').addClass('last');
		$(this).children('dd:first').addClass('first');
		$(this).children('dd:last').addClass('last');
	});
}

function nav_select(this_section){
	$('#navigation .selected').removeClass('selected');
	$('#'+this_section).addClass('selected');
}