(function($) { 

	$(document).ready(function () {
		var menus = $('#navigation li').not('li.utilities');
		$(menus).each(function () {
			var submenu = false;
			$(this).bind('mouseenter',function (e) {
				hideMenus();
				$(this).addClass('active');
				submenu = '#'+$(this).attr('rel')+"-menu";
				$('#menus').animate({'height':$(submenu).outerHeight()+'px'},300);
				$(submenu).css('visibility','visible');
			});			
		});
		
		hideMenus();
		
		function hideMenus () {
			$('ul.submenu').css('visibility','hidden');
			$(menus).removeClass('active');
		}
		
		$(menus).each(function () {
			if ($(this).attr('rel') == $('body').attr('id')) {
				$(this).trigger('mouseenter');
				return;
			}
		});
		
		stripe();

	});

/**
 * stripe()
 * 
 * Adds alternating classes to table row cells.
 */
function stripe () {
	// the flag we'll use to keep track of 
	// whether the current row is odd or even
	var even = false;

	// if arguments are provided to specify the colors
	// of the even & odd rows, then use the them;
	// otherwise use the following defaults:
	var evenClass = arguments[1] ? arguments[1] : "even";
	var oddClass = arguments[2] ? arguments[2] : "odd";

	$('table tr').each(function (){
		$(this).addClass( even ? evenClass : oddClass );
		even = !even; // flip from odd to even, or vice-versa

	});	
}

})(jQuery);


