function doLoad() {
  // does nothing
}

var firstEl;

function validateForm(frm) {
  errs = "";
  firstEl = null;
  els = frm.elements;
  for(i=0; i<els.length; i++) {
    if(els[i].id == "req")
      errs += checkVal(els[i]);
  }
  if(errs != "") {
    alert("Please make the following changes:\n\n" + errs);
    if(firstEl)
      firstEl.focus();
    return false;
  }
  return true;
}

function checkVal(el) {
  if(el) {
    if(((el.tagName == "INPUT" || el.tagName == "TEXTAREA") && el.value == "")
       || (el.tagName == "SELECT" && el.options[el.selectedIndex].value == "")) {
      if(firstEl == null)
        firstEl = el;
      return "- " + el.title + "\n";
    }
  }
  return "";
}

function toggleImg(img) {
  src = img.src;
  if(src.indexOf('_off') != -1)
    img.src = src.replace('_off', '_on');
  else if(src.indexOf('_on') != -1)
    img.src = src.replace('_on', '_off');
}

function preloadImg(img) {
  src = img.src;
  document.onImg = new Image();
  document.onImg.src = src.replace('_off', '_on');
}
function goTo(u) {
  window.location = u;
}

function popup(url, width, height, scrolling, name) {
  openPopupWindow(url, width, height, scrolling, name);
}

function openPopupWindow(url, width, height, scrolling, name) {
  if (!width) width = 350;
  if (!height) height = 350;
  if (!scrolling) scrolling = "no"; 
  if (!name) name = "win"+Math.round(Math.random()*1000); 
  
  features = "width="+width+","
           + "height="+height+","
           + "toolbar=no,"
           + "location=no,"
           + "status=no,"
           + "menubar=no,"
           + "scrollbars="+scrolling+","
           + "top=50,"//+(window.screen.height-height)/2+","
           + "left=50";//+(window.screen.width-width)/2;
  window.open(url,name,features);
}

function openLegal() {
  openPopupWindow('/legal-disclaimer.php', 600, 400, 'yes', 'legalWin');
}

function watchVid() {
  popup('/vid.html',452,293,'no','vidWin');
}

function _hover(el) {
	el.className = 'hover';
}

function _out(el) {
	el.className = 'out';
}
function _clear(el) {
  t = el.title;
  if(el.value == t)
    el.value = '';
}

function _blur(el) {
  t = el.title;
  if(el.value == '')
    el.value = t;
}

function _validate(frm) {
  n = frm.name;
  eml = frm.email;
  at = eml.value.indexOf('@');
  if(n.value == n.title || n.value == '') {
    alert("Please enter your name");
    return false
  } else
  if(eml.value == eml.title || eml.value == '') {
    alert('Please enter your phone number or email address');
    return false;
  } else if(at != -1 && eml.value.indexOf('.', at) <= at) {
    alert('Please enter a valid email address');
    return false;
  } else if(at == -1 && eml.value.length < 10) {
    alert('Please enter a valid phone number or email address');
    return false;
  }
  return true;
}

