function newsLetterPopup(formy)
{
	if (formy.newsletter_email.value)
	{
		if (validEmail(formy.newsletter_email.value))
		{
			emailURL = 'http://lists.ipcmedia.com/cgi-bin/subscribe.cgi/69?email_addr=' + formy.newsletter_email.value;
			window.open(emailURL, "emailPopup", 'height=300,width=550,top=100,left=100,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no');
			return true;
		}
	}
    alert("Please enter a valid email address.");
    formy.newsletter_email.focus();
    formy.newsletter_email.select();
    return false;
}

function validEmail(email)
{
	invalidChars = " /:,;"

	if (email == "") {						// cannot be empty
		return false
	}
	for (i=0; i<invalidChars.length; i++) {	// does it contain any invalid characters?
		badChar = invalidChars.charAt(i)
		if (email.indexOf(badChar,0) > -1) {
			return false
		}
	}
	atPos = email.indexOf("@",1)			// there must be one "@" symbol
	if (atPos == -1) {
		return false
	}
	if (email.indexOf("@",atPos+1) != -1) {	// and only one "@" symbol
		return false
	}
	periodPos = email.indexOf(".",atPos)
	if (periodPos == -1) {					// and at least one "." after the "@"
		return false
	}
	if (periodPos+3 > email.length)	{		// must be at least 2 characters after the "."
		return false
	}
	domainName = email.substring(atPos+1, periodPos)
	if (domainName.length < 2) {			// Cannot have a domain less than 2 characters long
		return false
	}
	return true
}
