function checkSubmit(formName) {
  var findAddress = /(\bca\.*\b|\bave\.*\b|\bavenue\b)/i;
  var findCounty = /county/i;
  var zipOrCity = document.srn.zipOrCity.value;
  if (formName == 'srn' && zipOrCity == 'enter a Zip Code or City') {
  	alert('Please enter a Zip Code or City before starting your search');
  	return false;
  }
  else if (formName == 'srn' && document.srn.zipOrCity.value.length < 3) {
    alert('Before proceeding, please enter a search term that is at least 3 characters long.');
    return false;
  } 
  else if (formName == 'srn' && findAddress.test(zipOrCity)) {
    alert('Please enter only a Zip Code or City Name before searching ' + RegExp.$1);
    return false;
  } 
  else if (formName == 'srn' && findCounty.test(zipOrCity) && zipOrCity.toLowerCase() != 'canyon county') {
    window.location = 'counties/index.html';
    return false;
  }    
  else if (formName == 'srf' && document.srf.schName.value == 'enter a School Name') {
  	alert('Please enter a School Name before starting your search');
  	return false;
  }
  else if (formName == 'srf' && document.srf.schName.value.length < 3) {
    alert('Before proceeding, please enter a search term that is at least 3 characters long.');
    return false;
  }

  return true;
}

function cD (fieldName) {
if (fieldName == 'zipOrCity' && document.srn.zipOrCity.value == 'enter a Zip Code or City') {
	document.srn.zipOrCity.value='';
}
else if (fieldName == 'schName' && document.srf.schName.value == 'enter a School Name') {
	document.srf.schName.value = '';
}
}

function restoreDefault (fieldName) {
if (fieldName == 'zipOrCity' && document.srn.zipOrCity.value == '') {
	document.srn.zipOrCity.value='enter a Zip Code or City';
}
else if (fieldName == 'schName' && document.srf.schName.value == '') {
	document.srf.schName.value = 'enter a School Name';
}
}

function popup (divName, clickObj) {
  var xShift = 10;
  var yShift = -30;
  var x = xShift
  var y = yShift;
  if (clickObj != null) {
    x = clickObj.clientX + xShift + document.body.scrollLeft;
    y = clickObj.clientY + yShift + document.body.scrollTop;
  }
    var obj = getDiv(divName);
    if (obj == null) {return;}
    obj.style.visibility = 'visible';
    obj.style.top = y;    
    obj.style.left = x;
}
function unpop (divName) {
    var obj = getDiv(divName);
    if (obj == null || obj.style == null) {return;}
    obj.style.visibility = 'hidden';
}
function getDiv (divName) {
    if (document.all != null) {return document.all[divName];}
    else if (parent.document.getElementById != null && parent.document.getElementById(divName) != null) {
      return parent.document.getElementById(divName);
    }
    return null;
}


