var good;

function checkEmailAddress(field)
{
  var goodEmail=field.value.match(/\b(^(\S+@).+((\.com)|(\.name)|(\.biz)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
  if (goodEmail)
  {
  good = true
  }
  else
  {
    alert('Please enter a valid e-mail address.');
    field.focus();
    field.select();
    good=false;
  }
}

function mailThis()
{
   
  good=false;
  checkEmailAddress(document.frmEmail.txtSourceEmail);
  if (good)
  {
    checkEmailAddress(document.frmEmail.txtTargetEmail);
    if (good)
    {
      window.location = "detail.asp?" + sPassAlong + "&ID=" + sAID + "&LOCATION=" + sLOC + "&SEmail=" + document.frmEmail.txtSourceEmail.value + "&TEmail=" + document.frmEmail.txtTargetEmail.value + "&EmailSubj=" + escape(document.frmEmail.txtMsg.value) ;
    }
  }
}
