//////////////////////////////////////////////////////
//
//	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/)
//
//////////////////////////////////////////////////////
$(document).ready(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");
		});
	}
	
	$(".question").click(function () {
		$(this).toggleClass("open");
		$(this).siblings(".answer").slideToggle();
	});
	
	$("#mac_list .navchild a").click(function() {
		//$("#mac_content").empty();
		$("#mac_list .navchild a").removeClass("selected");
		$(this).addClass("selected");
		$("#mac_content").load(this.href);
		return false;
	});
});

$(window).load(function() {

	$("#mac_list").each(function(){

		var first_slide = $("#mac_list .navchild a");
		$(first_slide[0]).addClass("selected");
		$("#mac_content").load(first_slide[0].href);
	});

	// remove default text from input text field on focus
	$("input.emptytext").focus(function() {
		if ( $(this).val() == $(this)[0].defaultValue ) {
			$(this).val("");
		}
	});

	// put default text back in on blur
	$("input.emptytext").blur(function() {
		if ( $(this).val() == "" ) {
			$(this).val( $(this)[0].defaultValue );
		}
	});

});

