 		$(document).ready(function() {

//--------- Show Hide Signup Form ---------//
			$('#trigger').click(function () {
				if($('#contactList').hasClass("hidden")) {
					$('#contactList').removeClass("hidden");
				} else {
					$('#contactList').addClass("hidden");
				}
				return false;
			});


//--------- Show Hide Other Input ---------//
			$('#listHear').change(function () {
				if($('#listHear').val()=="Other") {
					$('#otherHear').removeClass("hidden");
				} else {
					$('#otherHear').addClass("hidden");
				}
			});
			
			$('#otherHear').click(function () {
				if($('#otherHear').val()=="Please Specify") {
					$('#otherHear').val("");
				}
			});


//--------- Validate Form Fields ---------//
			$('#listSubmit').click(function () {
				
				var listEmail = $('#listEmail').val();
				var listHear = $('#listHear').val();
				var otherHear = $('#otherHear').val();
				var listSubmit = $('#listSubmit').val();
				if ($('#listExisting').attr('checked')) {
					var listExisting = "on";
				} else {
					var listExisting = "";
				}
				
				if(listEmail == "") {
					alert('Please enter your email address.');
				} else if(listHear == "") {
					alert('Please select an option from the dropdown list.');
				} else if(((listHear == "Other") && (otherHear == "")) || ((listHear == "Other") && (otherHear == "Please Specify"))) {
					alert('Please explain how you heard about Tweedy, Browne.');
				} else {
					$.post("/includes/mailList.php", {listEmail:listEmail,listHear:listHear,otherHear:otherHear,listExisting:listExisting,listSubmit:listSubmit},
					function(data){
						$('#signup').html("<p>" + data + "</p>");
					});
				}
				return false;
			});

 		});
