
// Original javascript menu

activateMenu = function(nav) {
  /* currentStyle restricts the Javascript to IE only */

	if (document.all && document.getElementById(nav).currentStyle) {
    var navroot = document.getElementById(nav);
		/* Get all the list items within the menu */

		var lis=navroot.getElementsByTagName("LI");

      for (i=0; i<lis.length; i++) {
        /* If the LI has another menu level */
        if(lis[i].lastChild.tagName=="UL"){
        /* assign the function to the LI */
         	lis[i].onmouseover=function() {
          /* display the inner menu */
            this.lastChild.style.display="block";
          }
          lis[i].onmouseout=function() {

          this.lastChild.style.display="none";

        }
      }
    }
  }
}

window.onload= function(){
  /* pass the function the id of the top level UL */
  /* remove one, when only using one menu */
 activateMenu('nav');
 activateMenu('nav2');
 activateMenu('nav3');
}

// End original javascript menu

  // Validate the optional email contact form for pages and
  // sub-pages

function validateEmail(){

  if (document.getElementById('name').value == '') {
    document.getElementById('name').focus();
    alert('The name field is required\n');
    return false;
  }
  if (document.getElementById('email').value == '') {
    document.getElementById('email').focus();
    alert('The email field is required\n');
    return false;
  }
  if (document.getElementById('comments').value == "") {
    document.getElementById('comments').focus();
    alert('The comments field is required\n');
    return false;
  }
  return true;
}


// Shows all hidden images from a gallery or hides all images
// if they are shown.  Takes two parameters, gallery and number.
// The gallery value is for the gallery to show/hide, whereas
// number is the number of images in the gallery

function showall(gallery, number){

  if (document.getElementById(gallery + '2').style.display == 'none') {
    for (i = 2;i <= number;i++){
      var showname = '' + gallery + i;
      document.getElementById(showname).style.display = 'inline';
    }
  } else {
    for (i = 2;i <= number;i++){
      var showname = '' + gallery + i;
      document.getElementById(showname).style.display = 'none';
    }
  }
}
