// JavaScript Document
$(document).ready(function(){
	$("select.type").change(function () {
		//When the Type Select box changes:
		if(($("select.type").val()) == "other") {
			$("div.typeother").show(300);
		} else {
			$("div.typeother").hide(300);
		}
	});
	
	$("#coed").change(function(){
		if($("#coed").is(":checked")) {
			$("#male").attr("disabled",true);
			$("#female").attr("disabled",true);
		} else {
			$("#male").attr("disabled",false);
			$("#female").attr("disabled",false);
		}
	});
	
	$("#youth").change(function(){
		if($("#youth").is(":checked")) {
			$("div.youthother").show(300);
		} else {
			$("div.youthother").hide(300);
		}
	});
	
	$("input[@name='timeframe']").change(function() {
		if($("input[@name='timeframe']:checked").val() == 'multi') {
			$("div.multiday").show(300);
		} else {
			$("div.multiday").hide(300);
		}
	});
	
	$("input[@name='otherspeakers']").change(function() {
		if($("input[@name='otherspeakers']:checked").val() == 'yes') {
			$("div.otherspeakers").show(300);
		} else {
			$("div.otherspeakers").hide(300);
		}
	});
	
	$("input[@name='equip']").change(function() {
		if($("input[@name='equip']:checked").val() == 'yes') {
			$("div.equip").show(300);
		} else {
			$("div.equip").hide(300);
		}
	});
	
	$("select.topics").change(function () {
		//When the Topics Select box changes:
		if(($("select.topics").val()) == "other") {
			$("div.topicsother").show(300);
		} else {
			$("div.topicsother").hide(300);
		}
	});
	
	$("form").submit(function() {
		if(($("select.type").val()) == "other") {
			if(($("input[@name='typeother']").val().length) < 1) {
				alert("You must specify the desired type of presentation!");
				$("input[@name='typeother']").focus();
				return false;
			}
		}
		
		if(!($("input[@name='professional']").is(":checked") ||
		   $("input[@name='management']").is(":checked") ||
		   $("input[@name='employees']").is(":checked") ||
		   $("input[@name='youth']").is(":checked"))) {
			alert("You must specify at least one audience type!");
			$("input[@name='professional']").focus();
			return false;
		}
		
		if($("input[@name='youth']").is(":checked")) {
			if(($("input[@name='youthother']").val().length) < 1) {
				alert("You must specify the desired age group!");
				$("input[@name='youthother']").focus();
				return false;
			}
		}
		
		if(!($("input[@name='male']").is(":checked") ||
		   $("input[@name='female']").is(":checked") ||
		   $("input[@name='coed']").is(":checked"))) {
			alert("You must specify at least one audience gender or Co-Ed!");
			$("input[@name='male']").focus();
			return false;
		}
		
		if(($("input[@name='fullname']").val().length) < 1) {
			alert("You must enter your Full Name");
			$("input[@name='fullname']").focus();
			return false;
		}
		
		if(($("input[@name='phone']").val().length) < 1) {
			alert("You must enter your Phone Number");
			$("input[@name='phone']").focus();
			return false;
		}
		
		if(($("input[@name='email']").val().length) < 1) {
			alert("You must enter your E-Mail Address");
			$("input[@name='email']").focus();
			return false;
		}
		
		if(($("input[@name='organization']").val().length) < 1) {
			alert("You must enter your Organization Name");
			$("input[@name='organization']").focus();
			return false;
		}
		
		if(($("textarea[@name='address']").val().length) < 1) {
			alert("You must enter your Address");
			$("textarea[@name='address']").focus();
			return false;
		}
		
		if($("input[@name='timeframe']:checked").val() == 'multi') {
			if(($("input[@name='multidays']").val().length) < 1) {
				alert("You must specify the time frame");
				$("input[@name='multidays']").focus();
				return false;
			}
		}
		
		if($("input[@name='otherspeakers']:checked").val() == 'yes') {
			if(($("input[@name='whospeakers']").val().length) < 1) {
				alert("You must specify who the other Speakers are");
				$("input[@name='whospeakers']").focus();
				return false;
			}
			if(($("input[@name='speakerstopics']").val().length) < 1) {
				alert("You must specify what the other Speakers' topics will be");
				$("input[@name='speakerstopics']").focus();
				return false;
			}
		}
		
		if($("input[@name='equip']:checked").val() == 'yes') {
			if(($("input[@name='yesequip']").val().length) < 1) {
				alert("You must specify the Audio/Visual Equipement");
				$("input[@name='yesequip']").focus();
				return false;
			}
		}
		
		if(($("select.topics").val()) == "other") {
			if(($("input[@name='topicsother']").val().length) < 1) {
				alert("You must specify the Desired Topics!");
				$("input[@name='topicsother']").focus();
				return false;
			}
		}
		
		return true;
	});
});























