function validate() {

	var pattern = /\s*\w+@[^\.]+\.[^\.]+(\.[^\.])*\s*/;
	var letters = /[a-zA-Z]/;
	var numbers = /[0-9]/;
	legalChars = "~0123456789.-ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_@+";
	alphaNums = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
	errorMsg = "";

	if (document.signupForm.email.value.length < 7)
		errorMsg += "\nEmail address must be at least 7 characters";

	//Validate Email against pattern match
	if (document.signupForm.email.value != "") {
	    if(!pattern.test(document.signupForm.email.value)) {
			errorMsg += "\nInvalid E-Mail Address."
	    }
	}
	//This enhances the previous Email check. This checks for legal values and returns illegal values
	if (document.signupForm.email.value != "" && document.signupForm.email.value.length > 1) {
	    for(x=0; x < document.signupForm.email.value.length; x++) {
		if (legalChars.indexOf(document.signupForm.email.value.substring(x,x+1)) < 0)
		    errorMsg += "\n" + "Illegal character '"+document.signupForm.email.value.substring(x,x+1)+"' at position " +(x+1)+ " in E-Mail Address.";
	    }
	}

	//FINAL CHECK FOR ERROR MESSAGES
	if (errorMsg.length > 0) {
		errorMsg = "The following errors must be corrected before submitting this form:\n" + errorMsg;
		alert (errorMsg);
		return false;
	}
CallPopup(document.signupForm.email.value);
    return false;	//true;
}


//<!--*************** <a href="javascript:CallPopup()">HTML Popup</a> ********************  -->
function CallPopup(email) {
	windowURL = 'http://www.waisting-away.com/newsletteradd.asp?email='+email;
	windowWidth  = 350;
	windowHeight = 210;
	//SET FEATURES AND OPEN POPUP
	windowName = 'POPUP';
	windowFeatures = 'width='+windowWidth+',height='+windowHeight+',toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=1,screenX=200,left=200,screenY=150,top=150';
	window.open( windowURL, windowName, windowFeatures ); 
}

//<!--***********************************  -->

function CallOptOut() {
	windowURL = 'optout.asp'; //newsleavesuccess.asp';
	windowWidth  = 400;
	windowHeight = 200;
	//SET FEATURES AND OPEN POPUP
	windowName = 'POPUP';
	windowFeatures = 'width='+windowWidth+',height='+windowHeight+',toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=1,screenX=200,left=200,screenY=150,top=150';
	window.open( windowURL, windowName, windowFeatures ); 
}

function validate2() {

	var pattern = /\s*\w+@[^\.]+\.[^\.]+(\.[^\.])*\s*/;
	var letters = /[a-zA-Z]/;
	var numbers = /[0-9]/;
	legalChars = "~0123456789.-ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_@+";
	alphaNums = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
	errorMsg = "";

	if (document.newsignup.email.value.length < 7)
		errorMsg += "\nEmail address must be at least 7 characters";

	//Validate Email against pattern match
	if (document.newsignup.email.value != "") {
	    if(!pattern.test(document.newsignup.email.value)) {
			errorMsg += "\nInvalid E-Mail Address."
	    }
	}
	//This enhances the previous Email check. This checks for legal values and returns illegal values
	if (document.newsignup.email.value != "" && document.newsignup.email.value.length > 1) {
	    for(x=0; x < document.newsignup.email.value.length; x++) {
		if (legalChars.indexOf(document.newsignup.email.value.substring(x,x+1)) < 0)
		    errorMsg += "\n" + "Illegal character '"+document.newsignup.email.value.substring(x,x+1)+"' at position " +(x+1)+ " in E-Mail Address.";
	    }
	}

	if (document.newsignup.FirstName.value.length < 2)
		errorMsg += "\nFirstName must be at least 2 characters";
	if (document.newsignup.LastName.value.length < 2)
		errorMsg += "\nLastName must be at least 2 characters";
	if (document.newsignup.City.value.length < 2)
		errorMsg += "\nCity must be at least 2 characters";
	if (document.newsignup.State.selectedIndex == 0)
		errorMsg += "\nYou must select a State";
	if (document.newsignup.Zip.value.length < 5)
		errorMsg += "\nZip must be at least 5 characters";


	if (!document.newsignup.agree.checked)
		errorMsg += "\nYou must read the disclaimer statement and check the agree box";

	//FINAL CHECK FOR ERROR MESSAGES
	if (errorMsg.length > 0) {
		errorMsg = "The following errors must be corrected before submitting this form:\n" + errorMsg;
		alert (errorMsg);
		return false;
	}

    return true;
}