// Holds menu li
var li = null;

// Closes out dropdown menu
function closeMenu() {
	if (li) {
		li.find('ul').hide();
		li = null;
	}
}

// Page Ready
$(document).ready(function() {
	// Zebra stripe table rows
	$('tr:nth-child(odd)').addClass('odd');
	
	// Input Focus
	$("input:not([type='button'],[type='checkbox'],[type='radio']),textarea").focus(function(){
		$(this).addClass("focus");
	});
	$("input:not([type='button'],[type='checkbox'],[type='radio']),textarea").blur(function(){
		$(this).removeClass("focus");
	});
	
	// Dropdown Navigation Menus
	$('#nav > ul > li').hover(
		over = function() {
			closeMenu();
			$(this).find('ul').fadeIn('fast');
		}, 
		out = function() {
			li = $(this);
			setTimeout("closeMenu()",600);
		}
	);
	
	// Header Images, Slightly delay the cycle initialization
	setTimeout(function(){
		$('#headerimg').cycle({ 
			fx:			'fade', 
			speed:		600, 
			timeout:	10000,
			random:		1
		});
	}, 300);

	
	// Slider
	$('div#slider1').codaSlider();
	
	// Search Form
	/*
	$('div#search input#q').focus(function(){
		if ($(this).attr('value') == 'search') {
			$(this).attr('value','');
		}
	});
	$('div#search input#q').blur(function(){
		if ($(this).attr('value') == '') {
			$(this).attr('value','search');
		}
	});
	*/
});