$(document).ready(function() {
		//change the menu item to active.
		if (activeMenuId) { $("#" + activeMenuId).addClass("active"); }
		if (activeParentMenuId) {
		 	$("#" + activeParentMenuId).children(".onImage").show();
		 	$("#" + activeParentMenuId).children(".offImage").hide();
		}
		
		//now set up the rollover and don't do any rollover if the menu item is active
		// the above code took care of that
		 $(".subNav").bind("mouseover",function(){
			if($(this).attr("id") != activeMenuId){
				$(this).addClass("active");
			}
		})
		 $(".subNav").bind("mouseout",function(){
			if($(this).attr("id") != activeMenuId){
				$(this).removeClass("active");
			}
		})
		 $(".page_item").children("a").bind("mouseover",function(){
			$(this).addClass("active");
		})
		 $(".page_item").children("a").bind("mouseout",function(){
			$(this).removeClass("active");
		})
		
		 $(".parentNav").bind("mouseover",function(){
			if($(this).attr("id") != activeParentMenuId){
		 		$(this).children(".onImage").show();
		 		$(this).children(".offImage").hide();
			}
		})
		 $(".parentNav").bind("mouseout",function(){
			if($(this).attr("id") != activeParentMenuId){
		 		$(this).children(".onImage").hide();
		 		$(this).children(".offImage").show();
			}
		})

		 $(".inPageSubNav").bind("click",function(){
			//first take off all active states of intrapage links
			$(".inPageSubNav ").removeClass("active");
			//"this" means the one they clicked on, so add the active class to it
			$(this).addClass("active");
			//hide all of the hidden content
			$(".subNavContent").hide();
			//now show the hidden content for the link they clicked on
			//get the id of the link they clicked on
			var linkId = $(this).attr("id");
			//now assume that the hidden content has the same Id preceded by "content_"
			$("#content_" + linkId).show();
		})
		 $(".bodyHeaderImage").bind("click",function(){
			//first take off all active states of intrapage links
			$(".inPageSubNav ").removeClass("active");
			//show all of the hidden content
			$(".subNavContent").show();
		})
		
		//this code makes the required fields required
		$("form").submit(function(){
		 	var complete = true;
			//alert($(this).children(".required").attr("id"));
			$(this).children("table").children("tbody").children("tr").children("td").children(".required").each( function() {
		        //alert($(this).attr("id"));
		        if($(this).attr("value") == ""){
					alert("Please fill out all required fields");
					$(this).focus();
					complete = false;
					return false;
				}
		    });
			if(!complete){
				return false;
			}
		})

});