//////////////////////////////////////////////////////
//
//	The purpose of this file is to
//	apply a hover class on mouseover
//	on the <li> elements in the nav.
//	This is because IE doesn't put
//	the pseudo class :hover on <li> elements
//
//	This is code that uses the
//	jquery javascript library (http://jquery.com/)
//
//////////////////////////////////////////////////////
function checkDate(mDate)
{
	mmddyy = mDate.split("-");
	if(mmddyy.length != 3)
		return false;
	var today = new Date();
	var thisDate = new Date();
	thisDate.setMonth(mmddyy[0] - 1);
	thisDate.setDate(mmddyy[1]);
	thisDate.setYear('20' + mmddyy[2]);
	if( today > thisDate)
		return false;
	return true;
	
}

$(window).load(function() {
	$(".emptytext").focus( function(){
		if ( $(this).val() == $(this)[0].defaultValue ) {
			$(this).val("");
		}
	});
	$(".emptytext").blur( function(){
		if ( $(this).val() == "" ) {
			$(this).val( $(this)[0].defaultValue );
		}
	});
		$('p.a').hide();
		$('p.q').toggle(function(){
			$(this).next().show();	
			$(this).addClass('open');
		}, function(){
			$(this).next().hide();	
			$(this).removeClass('open');
		});
	
	if($('#calendarnav').length> 0)
	{
		$('#calendarnav ul li').each(function(){
			var myDate = $(this).children('span.description').html();
			if( checkDate(myDate) )
				$(this).show();
		});
	}

	// this is needed for the IE 6 pseudo hover class bug
		$(".navtop > li").hover(function() {
			$(this).addClass("hover");
			
		},
		function () {
			$(this).removeClass("hover");
		});
		
		$(".navtop > li li ").hover(
		function () {
			$(this).addClass("hover");
		},
		function () {
			$(this).removeClass("hover");
			
		});

	if (document.all&&document.getElementById) {
		
		
		
	} else {
		// this is need for safari when nav covers flash
		$(".navtop li ul").mouseover(function () {
			$(this).addClass("redraw");
		});
		$(".navtop li ul").mouseout(function () {
			$(this).removeClass("redraw");
		});
	}
});
