//////////////////////////////////////////////////////
//
//	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 printpage()
	  {
	  window.print();
	  return false;
	  }
	  
$(window).load(function() {
	if (document.all&&document.getElementById) {
		// this is needed for the IE 6 pseudo hover class bug
		$(".navtop li").hover(function () {
			$(this).addClass("hover");
		},function () {
			$(this).removeClass("hover");
		});
	} else {
		// this is need for safari when nav covers flash
		$(".navtop li ul").hover(function () {
			$(this).addClass("redraw");
		},function () {
			$(this).removeClass("redraw");
		});
	}
	
	
	
	$('input.print').click(printpage);

	// show/hide buttons
	if ( $('.nav_level3').length > 0 ) {
		$('#page_nav p a').addClass('display');
	}	

	// previous button
	$('a.prev').click(function(){
		var prev = $('.nav_level3 li.selected').prev('li').children('a').attr('href');
		window.location.replace(prev);
		return false;
	});

	// next button
	$('a.next').click(function(){
		var next = $('.nav_level3 li.selected').next('li').children('a').attr('href');
		window.location.replace(next);
		return false;
	});

	// Highslide
	//$('a.highslide').click(function() {
		//return hs.expand(this);
	//});
	//hs.graphicsDir = 'cmsimages/';
	hs.showCredits = false;
});

function dateTime() {
	var now = new Date();

	// Array list of days.
	var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');

	// Array list of months.
	var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');

	// Calculate the number of the current day in the week.
	var dayofmonth = ((now.getDate() < 10) ? "0" : "") + now.getDate();

	var hours = (now.getHours() > 12) ? now.getHours() - 12 : now.getHours();
	var minutes = ((now.getMinutes() < 10) ? "0" : "") + now.getMinutes();
	var meridian = (now.getHours() > 12) ? "pm" : "am";

	// Join it all together e.g. Friday, March 27, 2009 3:06pm 
	var today = days[now.getDay()] + ", " +
		months[now.getMonth()] + " " +
		dayofmonth + ", " +
		now.getFullYear() + " " +
		hours + ":" +
		minutes + 
		meridian;

	return today;
}
