﻿/*main scripts*/

function submitEmailSignup() {
	var emailSend = document.getElementById("EmailSend").value;	
	window.location.href = "http://wacopa.org/Email.aspx?EmailSend="+emailSend;
}

function validate_ContactForm() {
	var FullName = document.getElementById("FullName").value;
	var Email = document.getElementById("Email").value;
	if(Email != "" && FullName != "") {
		var filePath = "../dmc_main/server.aspx";
		var myRand = parseInt(Math.random()*999999999);
		var myForm = document.form1;
		var today = new Date();
		var queryString = "rand="+myRand;
		for(var i=0; i<myForm.length; i++) {
			if(myForm[i].name != "__VIEWSTATE") {
				queryString += '&'+myForm[i].name+'='+escape(myForm[i].value);
			}
		}
		//add date added
		queryString += '&da='+today;
		//add date added
		$.get(filePath, queryString ,
		function(data){
			if(sanitizeServerAjaxCall(data) == "success") {
				window.location.href = "gdform.asp?"+queryString;					
			} else {
				document.getElementById("mess_resp").innerHTML = "Failed to submit form";
			}
		});
	} else {
		document.getElementById("mess_resp").innerHTML = "Please include all required fields";
	}
}
