// Following information is used to draw the header image for each section
urlPath = location.pathname;
topPath = urlPath.split('/')[1];
isIE   = (document.all);
isNS4  = (document.layers);
// For rollover events in the header
function showImg ( imgName, val ) {
  imgSrc = (val == 1) ? '/image/nav/'+ imgName + '_over.gif' : '/image/nav/'+ imgName + '.gif';
  eval('document.' + imgName + '.src = "' + imgSrc + '"');
}

// Following 3 functions are used to validate the newsletter signup
function focusInput ( ele ) {
  if (ele.cnt == null || ele.cnt == 0) {
    ele.value = "";
    ele.cnt = 1;
  }
}

function checkEmail ( text ) {

  var validEmail = text.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\.biz)|(\.info)|(\.name)|(\.coop)|(\.aero)|(\.museum)|(\..{2,2}))$)\b/gi);
  if (validEmail){
    return true;
  } else {
    return false;
  }
}

function checkNewsForm ( df ) {
  errorMsg = "";
  if ( (df.fullname.value == "") || (df.fullname.value == " First Last Name") || (!df.fullname.value.match(/[a-zA-Z]+\s+[a-zA-Z]/)) ) {
    errorMsg = "Please enter your first and last name.\n";
  }
  if (!checkEmail(df.email.value)) {
    errorMsg = errorMsg + "Please enter a valid email address.\n";
  }
  if (errorMsg == "") {
    return true;
  } else {
    alert(errorMsg);
    return false;
  }
}

function openDesc(edate) {
  window.open('/event/calendar/description.php?edate='+edate, 'event', 'width=440,height=300,scrollbars=yes,resizable=yes');
}

// Generic functions
function gotoURL(ele) {
  if (ele.options[ele.selectedIndex].value == '') { return; }
  document.location.href = ele.options[ele.selectedIndex].value;
}