jQuery(function(){

	/* ****************************************************** pop-ups ******************************************************* */
	// we can replace this functionality with a lightbox clone if we want to
	jQuery('a.IsPopUp').click(function(){
		PopUp({
			url: jQuery(this).attr('href'),
			name: '_new',
			location: false,
			menubar: false,
			toolbar: false,
			status: false
		});
		return false;
	});
	
	/* *********************************************************** print links *************************************************** */
	jQuery('a.IsPrint').click(function(){
		window.print();
		return false;
	});

	/* ************************************************* controls the menu ************************************************** */  

	// we need the immediate descendant selector here
	// this will have to be changed if/when we implement submenus
	var MenuLIs = jQuery('#TopMenu > ul > li');
	MenuLIs.bind('mouseenter', function(){
		var realTarget = jQuery(this);
		
		// fade in the child of the target
		realTarget.children('ul').fadeIn('fast');
		return false;
	})
	.bind('mouseleave', function(){
		var realTarget = jQuery(this);
		realTarget.children('ul').fadeOut('slow');
		return false;
	});
	
	/* ************************************************** search form ********************************************************* */
	
	var SearchForm = jQuery('#SearchForm');
	var SearchInput = jQuery('#SearchKeyword');
	SearchInput.focus(function(){
		SearchForm.addClass('Selected');
	}).
	blur(function(){
		SearchForm.removeClass('Selected');
	});
	
});
