function showSubNav(id) {
	$("ul#sub-4").attr("style","display: none");
	$("ul#sub-5").attr("style","display: none");
	$("ul#sub-7").attr("style","display: none");
	$("ul#sub-8").attr("style","display: none");
	$("ul#sub-9").attr("style","display: none");
	$("ul#sub-10").attr("style","display: none");
	$("ul#sub-11").attr("style","display: none");
	$("ul#sub-12").attr("style","display: none");
	$("ul#sub-" + id).attr("style","display:block");
}

function toggleFAQ(id) {
	$("div.faq-div").attr("style","display: none");
	$("h2.faq-h2").removeClass("active");
	if($("h2#h2-" + id).hasClass("active")) { //toggle closed
		$("div#faq-" + id).attr("style","display:none");
		$("h2#h2-" + id).removeClass("active");		
	} else { //toggle opened 
		$("div#faq-" + id).attr("style","display:block");
		$("h2#h2-" + id).addClass("active");
	}
	
}

function validateForm(f) {
	$.ajax({
   		type: "POST",
   		url: "/wp-content/themes/goolsby/lib/ajax/validateForm.php",
   		data: $('#' + f).serialize(),
   		success: function(msg){
   			//reset
			$("#u-name").removeClass("error");
			$("#email").removeClass("error");
			$("#phone").removeClass("error");
			$("#message").removeClass("error");
     		if(msg == "") {
     			htmlin = "<h1>Thank you!</h1><ul><li>You have taken the first step in securing your defense. You can expect a call from us shortly.</li></ul><!-- Google Code for Goolsbylaw.com Form Submit Conversion Page --><div style=\"display:inline;\"><img height=\"1\" width=\"1\" style=\"border-style:none;\" alt=\"\" src=\"http://www.googleadservices.com/pagead/conversion/1042992917/?label=X5aaCMvptgEQlZ6r8QM&amp;guid=ON&amp;script=0\"/></div>";
     			$('div.box.gray').html(htmlin);
     			
     		} else {
     			var e = new Array();
     			e = msg.split("|");
     			n = 0;
     			for(var i in e) {
	     			$('#' + e[i]).addClass("error");
	     			if(n==0) {
	     				$('#' + e[i]).focus();
	     			}
	     			n++;
     			}
     			alert("Your submission is either incomplete or invalid. Please check the form fields highlighted and try again.");
     		}
   		}
 	});
 	return false;
}

