var good;
function checkEmailAddress(efield) {
	
// the following expression must be all on one line...
var goodEmail = efield.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
if (goodEmail) {
good = true;
}
else {
alert('Please enter a valid e-mail address.');
efield.focus();
efield.select();
good = false;
   }
}
u = window.location;
d = "Please drop the following email address from your newsletter subscription (I'm sick of it): ";
dt= "Drop me from the Newsletter";
m = "Please add the following email address to the wonderful newsletter: ";
t = "Add me to the Newsletter";
function mailIt(address) {
good = false;
//alert("after check");
checkEmailAddress(address);

if (good) {
// the following expression must be all on one line...
    window.location = "mailto:info@coffeemuggers.com?subject="+t+"&body="+m+address.value;
   }
}

function mailDrop(address) {
good = false;
//alert("after check");
checkEmailAddress(address);

if (good) {
// the following expression must be all on one line...
    window.location = "mailto:info@coffeemuggers.com?subject="+dt+"&body="+d+address.value;
   }
}

function mailForm(subject,email,comments)
{
  s = subject.value;
  e = email.value;
  c = comments.value;
  if (s=="")
  {
	  s = "No specific subject";
  }
  if (e=="")
  {
	  e="anonymous";
  }
  if (c=="")
  {
	  alert('Please enter a comment or two.  Thanks.');
	  comments.focus();
	  comments.select();
	  return;
  }
  window.location = "mailto:info@coffeemuggers.com?subject="+s+"&body="+"Comments from "+e+": "+c;
}


