var wkshoptitle
var wkshopdate
function mailfriend(showhide,w,d){
	if(showhide == "show"){
        document.getElementById('popupbox').style.visibility="visible"; /* If the function is called with the variable 'show', show the login box */
    }else if(showhide == "hide"){
        document.getElementById('popupbox').style.visibility="hidden"; /* If the function is called with the variable 'hide', hide the login box */
    }
	wkshoptitle = w;
	wkshopdate = d;
}

var good;
function checkEmailAddress(field) {
// the following expression must be all on one line...
var goodEmail = field.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.');
    good = false;
  }
}

u = window.location; 
m = "I thought this might interest you -  "; 
function sendMail() { 
  address = document.mailfriend.eaddress.value;
  checkEmailAddress(address);
  if (good) {
// the following expression must be all on one line... 
    window.location = "mailto:"+address+"?cc=essences@universalessences.com"+"&subject="+m+wkshoptitle+" on "+wkshopdate+"&body=Click on the link at Universal Essences ("+document.title+") for more information "+u; 
  mailfriend('hide','','')
  } 
} 

function clearDefault(el) {
  if (el.defaultValue==el.value) el.value = ""
}
