// JavaScript Document

<!-- OPEN CENTER WINDOW SCRIPT -->

function openCenterWindow(URL,winName,w,h,features) {

  // if screen.dimension is true (available), 
  // then calculate the position using that value, else use a fixed value
  xPos = (screen.width) ? (screen.width-w)/2 : 50;
  yPos = (screen.height) ? (screen.height-h)/2 : 50;
  
  // assemble all window settings from calculations and parameters
  settings = 'height='+h+',width='+w+',top='+yPos+',left='+xPos+','+features
  
  // open the window and bring it to front
  thisWin=window.open(URL,winName,settings);
  thisWin.focus();
}

function hov(loc,cls){
   if(loc.className)
      loc.className=cls;}
	  
//Workaround to make document.getElementById() follow W3C standard and only match on id (IE6,7 & Opera)//
//IE was returning the meta tag name "description" as well as the id "description" causing the script to fail//
var isOpera, isIE = false;
if(typeof(window.opera) != 'undefined'){isOpera = true;}
if(!isOpera && navigator.userAgent.indexOf('Internet Explorer')){isIE = true;}

//fix both IE and Opera (adjust when they implement this method properly)
if(isOpera || isIE){
  document.nativeGetElementById = document.getElementById;
  //redefine it!
  document.getElementById = function(id){
    var elem = document.nativeGetElementById(id);
    if(elem){
      //verify it is a valid match!
      if(elem.attributes['id'] && elem.attributes['id'].value == id){
        //valid match!
        return elem;
      } else {
        //not a valid match!
        //the non-standard, document.all array has keys for all name'd, and id'd elements
        //start at one, because we know the first match, is wrong!
        for(var i=1;i<document.all[id].length;i++){
          if(document.all[id][i].attributes['id'] && document.all[id][i].attributes['id'].value == id){
            return document.all[id][i];
          }
        }
      }
    }
    return null;
  };
}
	  
<!-- PHOTO GALLERY SCRIPT -->
function showPic(whichpic) {
  if (!document.getElementById("placeholder")) return true;
  var source = whichpic.getAttribute("href");
  var placeholder = document.getElementById("placeholder");
  placeholder.setAttribute("src",source);
  if (!document.getElementById("description")) return false;
  if (whichpic.getAttribute("title")) {
    var text = whichpic.getAttribute("title");
  } else {
    var text = "";
  }
  var description = document.getElementById("description");
  if (description.firstChild.nodeType == 3) {
    description.firstChild.nodeValue = text;
  }
  return false;
}

function prepareGallery() {
  if (!document.getElementsByTagName) return false;
  if (!document.getElementById) return false;
  if (!document.getElementById("showcase")) return false;
  var gallery = document.getElementById("showcase");
  var links = gallery.getElementsByTagName("a");
  for ( var i=0; i < links.length; i++) {
    links[i].onclick = function() {
      return showPic(this);
	}
    links[i].onkeypress = links[i].onclick;
  }
}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

addLoadEvent(prepareGallery);


<!-- MENU SCRIPT -->
<!--
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function mmLoadMenus() {
  if (window.mm_menu_0830083828_0) return;
  window.mm_menu_0830083828_0 = new Menu("root",176,20,"Verdana, Arial, Helvetica, sans-serif",9,"#ffffff","#ffffff","#0066cc","#003399","center","middle",0,1,1000,-5,7,true,true,true,4,false,false);
  mm_menu_0830083828_0.addMenuItem("Town&nbsp;Hall&nbsp;Archery","location='town-hall-archery-i-54.html'");
  mm_menu_0830083828_0.addMenuItem("Town&nbsp;Hall&nbsp;Events","location='town-hall-events-i-55.html'");
  mm_menu_0830083828_0.addMenuItem("Town&nbsp;Hall&nbsp;Photo&nbsp;Gallery","location='photo_gallery.html'");
  mm_menu_0830083828_0.addMenuItem("Town&nbsp;Hall&nbsp;Pro&nbsp;Shop","location='town-hall-pro-shop-i-57.html'");
   mm_menu_0830083828_0.fontWeight="bold";
   mm_menu_0830083828_0.hideOnMouseOut=true;
   mm_menu_0830083828_0.menuBorder=1;
   mm_menu_0830083828_0.menuLiteBgColor='#ffffff';
   mm_menu_0830083828_0.menuBorderBgColor='#666666';
   mm_menu_0830083828_0.bgColor='#ffffff';
  window.mm_menu_0830084353_1 = new Menu("root",168,20,"Verdana, Arial, Helvetica, sans-serif",9,"#ffffff","#ffffff","#ff0000","#660000","center","middle",0,1,1000,-5,7,true,true,true,4,false,false);
  mm_menu_0830084353_1.addMenuItem("Town&nbsp;Hall&nbsp;Sports","location='town-hall-sports-i-58.html'");
  mm_menu_0830084353_1.addMenuItem("Town&nbsp;Hall&nbsp;Apparel","location='town-hall-apparel-i-59.html'");
  mm_menu_0830084353_1.addMenuItem("Town&nbsp;Hall&nbsp;Trophies","location='town-hall-trophies-i-60.html'");
  mm_menu_0830084353_1.addMenuItem("Town&nbsp;Hall&nbsp;Signs","location='town-hall-signs-i-61.html'");
   mm_menu_0830084353_1.fontWeight="bold";
   mm_menu_0830084353_1.hideOnMouseOut=true;
   mm_menu_0830084353_1.menuBorder=1;
   mm_menu_0830084353_1.menuLiteBgColor='#ffffff';
   mm_menu_0830084353_1.menuBorderBgColor='#666666';
   mm_menu_0830084353_1.bgColor='#ffffff';

  mm_menu_0830084353_1.writeMenus();
} // mmLoadMenus()

//-->


<!-- FORMCHECKER SCRIPT -->

function formchecker(theForm)
{
	
	if (theForm.name.value == "")
  {
    alert("Please enter a Name.");
    theForm.name.focus();
    return (false);
  }
	
	if (theForm.email.value == "")
  {
    alert("Please enter an email.");
    theForm.email.focus();
    return (false);
	}
	
	if (theForm.comments.value == "")
  {
    alert("Please include a message.");
    theForm.comments.focus();
    return (false);
	}
}