function popupform(myform, windowname)
{	
  var email = document.getElementById('emailaddress');
  if (email) {
    if (validate_email(email.value || '')) {
      window.open('', windowname, 'height=800,width=1000,scrollbars=yes');
      myform.target = windowname;
      return true;
    } else {
      alert('Please enter a valid email address.');
    }
  }
  return false;
}


function validate_email(email_address) {
  var reg = /^[A-Za-z0-9_\-\.]+\@[A-Za-z0-9_\-\.]+\.([A-Za-z]{2,4})$/;
  var domain = /^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/i;
  reg.lastIndex = 0;
  domain.lastIndex = 0;

  var m = reg.exec(email_address);
  if (m) {
    m = m[1];
    if (m.length == 2 || (m.length > 2 && m.match(domain))) {
      return true;
    }
  }
  return false;
}


function enableField()
{
  document.form2.submit.disabled = false;
}


function checkMail(email) {
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(email)) return true;
	else alert('The address email you have entered is not valid!');
}

function emailPopup (form, specId) {
if (specId) {
	specId=specId;
}
else {
	//Set up a default id if not given
	specId='http://lists.ipcmedia.com/cgi-bin/CLOsubscribe.cgi/75?email_addr=';
}

if(checkMail(form.email_addr.value)) {
	emailURL = specId + form.email_addr.value;
	window.open(emailURL, "emailPopup", 'height=400,width=550,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no');
}
return false
}

function blankText(component) {
	if (component.value.length > 0)
		component.value = '';
}
