// ./_js/page_landing_newsletter.js


$(document).ready(function(){
	$("a#subscribeLink").click(function() {
		$("div#innerFormBlock").slideToggle("fast");
	})
	
	
	$("input#btn_cancel").click(function() {
		$("div#innerFormBlock").slideUp("fast").hide();
	})
	
	
	
})



function validateForm(){
	var name = document.getElementById("userName");
	var org = document.getElementById("organization");
	var email1 = document.getElementById("email1");
	var email2 = document.getElementById("email2");
	var terms = document.getElementById("terms").checked;
	if(!validateObjText(name) || !validateObjText(org) || !validateObjText(email1) || !validateObjText(email2)){
		//missing info
		alert("Please ensure you enter information into all fields.");
		return;
	}
	if(email1.value != email2.value){
		//emails different
		alert("You have entered two different email addresses.  Please retype them.");
		return
	}
	if(!validateEmail(email1.value)){
		 //invalid address
		 alert("The email address you have entered is not valid.  Please try again.");
		 return;
	}
	if(!terms){
		//terms and conditions not agreed to
		alert("You must agree to the terms and conditions to subscribe.");
		return;
	}
	document.getElementById("mainForm").submit();
}