$(document).ready(function(){
	// Topnav Dropdowns
	$("li#home_tab, li#sat_prep_tab, li#act_prep_tab, li#online_prep_tab, li#test_planner_tab, li#social_mission_tab").hover(function() {
		showMenu(this.id);
		},
		function(){ clearTimeout(showMenuTimeout); $(".dropdown").animate({opacity: "hide", top: "38"}, "normal");}
	);
	$("li#about_us_tab").hover(function() {
			$(this).find("div").not(this).stop(true, true).animate({opacity: "show", top: "48"}, "normal")
		},
		function(){ $(".last_dropdown").animate({opacity: "hide", top: "38"}, "normal");}
	);
	    
});
var showMenuTimeout = false;
function showMenu(elem_id) {
	exec = "$('#"+elem_id+"').find('div').not('#"+elem_id+"').stop(true, true).animate({opacity: 'show', top: '48'}, 'normal');"
	showMenuTimeout = setTimeout(exec,250);
}
function validate_fields(form) {
	region = form.find("#region").val();
	if (region!='unspecified') {
		return true;
	}
	zip = form.find("#location").val();
	if(/^\d{5}$/.test(zip)) {
		return true;
	}
	else {
		alert(zip+" is not a valid ZIP code. Please select a region or enter a valid ZIP code.");
		return false;
	}
}
function validate_tutoring(form, check_id) {
	package_id = form.find("#"+ check_id).val();

	if (package_id != '') {
		return true;
	} else {
		alert("Please select a tutor package before continuing.");
		return false;
	}
}