$(document).ready(function() {
$('#submit').attr("disabled", true);
$('.error').hide();

});
$(function() {	
$('#agree').click(function() { 	if ($('#agree').attr('checked')) { $('#submit').attr("disabled", false); } else { $('#submit').attr("disabled", true); }	});  
$("form:last").submit(function() {
      if ($('#agree').attr('checked')) {        					
						// validate and process form
						// first hide any error messages
						$('.error').hide();
						// $("label#email_error").show();
						var form = $("input[name=type]").val();
						if (form = "shoutout") {
							var otherSchool = $("input#otherSchool").val();
							var school = $("select#school").val();
							//alert($("select#school").val());
							if (school == "Other" && otherSchool == "") {
								$("label#school_error").show();
								$("input#otherSchool").focus();
								return false;
							}
							var email = $("input#email").val();
							if (email == "") {
								$("label#email_error").show();
								$("input#email").focus();
								//alert('1');
								return false;
							}  	
							var desc = $("#content").val();
							if (desc == "") {
								$("label#content_error").show();
								$("#content").focus();
								return false;
							}
					}
					if (form = "article") {
							var otherSchool = $("input#otherSchool").val();
							var school = $("select#school").val();
							//alert($("select#school").val());
							if (school == "Other" && otherSchool == "") {
								$("label#school_error").show();
								$("input#otherSchool").focus();
								return false;
							}
							var email = $("input#email").val();
							if (email == "") {
								$("label#email_error").show();
								$("input#email").focus();
								return false;
							}  
							var desc = $("#content").val();
							if (desc == "") {
								$("label#content_error").show();
								$("#content").focus();
								return false;
							}											
					}
					if (form = "video") {
							var link = $("#link").val();
							if (link == "") {
								$("label#link_error").show();
								$("#link").focus();
								return false;
							}
							var otherSchool = $("input#otherSchool").val();
							var school = $("select#school").val();
							//alert($("select#school").val());
							if (school == "Other" && otherSchool == "") {
								$("label#school_error").show();
								$("input#otherSchool").focus();
								return false;
							}
							var email = $("input#email").val();
							if (email == "") {
								$("label#email_error").show();
								$("input#email").focus();
								return false;
							}  
							var desc = $("#content").val();
							if (desc == "") {
								$("label#content_error").show();
								$("#content").focus();
								return false;
							}
				}
				return true;
      }
      return false;
    });
});

