function header() {

	// vertically aligns the text in the nav menus
	$("#top > li.page_item > a").hover(function() {
	}, function() {
	 var total_height = 82;
	 var height = $(this).height();
	 var padding = (total_height - height) / 2;
	 $(this).css("padding",padding+"px 10px");
	});
	
	$("#top > li.page_item > a").trigger('mouseleave');
	$("#top > li.page_item > a").unbind('mouseenter mouseleave')
	$("#top").children(":first").css("margin-left","0").width(100);
	
	// redefine the hover action for menu items
	$("#top > li.page_item").hover(function() {
	 $(this).addClass("active");
	 $(this).find(".children").removeClass("ghost");
	}, function() {
	 $(this).removeClass("active");
	 $(this).find(".children").addClass("ghost");
	});
	
	$("#top > li.page-item-9").addClass("alwayson");
	$("#top > li.page-item-18").addClass("alwayson");
	
	$("#top .children").addClass("ghost");
	$("#top .children").css("visibility","visible");
	
	$("#top .children > li.page_item").hover(function() {
	 $(this).addClass("active");
	}, function() {
	 $(this).removeClass("active");
	});

}

//for submitting the newsletter signup form

$(document).ready(function(){ 
	$("form#register .submit").click(function(){ 
		var hasError = false;
		var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
		var email = $("input#email").val();
		if(email=="") {
			alert("Please enter your email address.");
			hasError = true;
		} else if(!emailReg.test(email)) {
			alert("Please enter a valid email address.");
			hasError = true;
		}
		if(hasError == true) { return false; }
	});
	
	$("form#freeofferform .submit").click(function(){ 
		var hasError = false;
		var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
		var email = $("input#email").val();
		if(!$("input#name6").val()||!$("input#age6").val()||!$("input#phone_h6").val()||!$("input#address7").val()||!$("input#state6").val()||!$("input#zip6").val()) {
			alert("You are missing a required field, please try again!");
			hasError = true;
		}
		if(hasError == true) { return false; }
	});
});

	window.onload = function() {
	  header();
	  sidebar();
	}

