  // form.js - John Steele http://www.steelesoftconsulting.com/
var submitcount=0;
function checkSubmit() {     // Don't allow double submit on form (if they have javascript)
  if (submitcount == 0) {
    submitcount++;
    return true;
    }
  else {
    alert('You have already submitted this form. Please wait...');
    return false;
    }
  }
function empty(str) {        // checks if string is empty
  if(str == null || str == '')
    return true;
  return false;
  }
function checkempty(validform, formval, formfocus, alertmsg) {
  if(!validform)
    return false;
  if(empty(formval)) {
    alert('Please Enter: ' + alertmsg);
    formfocus.focus();
    return false;
    }
  return true;
  }
function checkphone(validform, formval, formfocus, alertmsg) {
  var pattern = /^(^(.*)[0-9]{3})(.*)([0-9]{3})(.*)([0-9]{4})/i;
  if (empty(formval))
      return true;
  if(!validform)
    return false;
  if(!pattern.test(formval)) {
    alert('Please Enter a Valid ' + alertmsg + ' [ ex: (555) 555-1212 ]');
    formfocus.focus();
    return false;
    }
  return true;
  }
function checkemail(validform, formval, formfocus, alertmsg) {
  var pattern = /^[\w\-]+(\.[\w\-]+)*@[\w\-]+\.([\w\-]+\.)*[a-z]{2,}$/i;
  if(!validform)
    return false;
  if(empty(formval)) {
    alert('Please Enter: ' + alertmsg);
    formfocus.focus();
    return false;
    }
  if(!pattern.test(formval)) {
    alert('Please Enter a Valid ' + alertmsg);
    formfocus.focus();
    return false;
    }
  return true;
  }
