/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: CodeLifter.com | http://www.codelifter.com */
var good;
function checkEmailAddress(field) {
// the following expression must be all on one line...
var goodEmail = field.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.');
    field.focus();
    field.select();
    good = false;
  }
}


function mailThisUrl(page) {
  good = false
  checkEmailAddress(document.eMailer.address);
  if (good) {
  if (page == 'traffic') {
  	u = 'http://squareworld.com/ios/traffic';
  	m = "TN Traffic Cams iPhone web app link";
  } else if (page == 'countdown') {
  	u= 'http://squareworld.com/ios/countdown';
  	m = "Countdown to Disney iPhone web app link";
  } else if (page == 'phase10') {
  	u= 'http://squareworld.com/ios/phase10';
  	m = "Phase 10 Scorekeeper iPhone web app link";
  } else if (page == 'scoreboard') {
  	u= 'http://squareworld.com/ios/scoreboard';
  	m = "Simple Scoreboard iPad web app link";
  }
 
    // the following expression must be all on one line...
    window.location = "mailto:"+document.eMailer.address.value+"?subject="+m+"&body="+u;
  }
}

