var submenus=1;
var posX, posY;
function showPos(e)
{
   e = (e) ? e : window.event;
   var element = (e.target) ? e.target: e.srcElement;
   posX = element.offsetLeft;
   posY  = element.offsetTop;
   while(element=element.offsetParent) {
      posX += element.offsetLeft;
      posY += element.offsetTop;
   }
   posX -= 25;
   posY += 20;
}

// make sub-menus
function makeSubMenus()
{
   if (!submenus)
      return;

// *** info OFF ***
   document.write("<div id=\"menubox01\" onmouseover=\"imgOn('info');showPopUpMenu('menubox01','0')\" onmouseout=\"imgOff('info');hidePopUpMenu('menubox01')\">");
   document.write("<table class=\"popmenu\" border=2 width=\"100px\" cellspacing=0 cellpadding=1 bordercolor=#2a4132>");
   document.write("<tr><td><a class=\"popUp\" href=\"/index.asp?pageType=safety\">&nbsp;Safety </a></td></tr>");
   document.write("<tr><td><a class=\"popUp\" href=\"/forms.html\">&nbsp;Forms </a></td></tr>");
   document.write("<tr><td><a class=\"popUp\" href=\"/index.asp?pageType=board\">&nbsp;Board Items </a></td></tr>");
   document.write("<tr><td><a class=\"popUp\" href=\"/index.asp?pageType=newsletter\">&nbsp;Newsletter </a></td></tr>");
   document.write("<tr><td><a class=\"popUp\" href=\"/directions.html\">&nbsp;Directions </a></td></tr>");
   document.write("<tr><td><a class=\"popUp\" href=\"/index.asp?pageType=sponsors\">&nbsp;Sponsors </a></td></tr>");
   document.write("<tr><td><a class=\"popUp\" href=\"/links.html\">&nbsp;Links </a></td></tr>");
   document.write("</table>");
   document.write("</div>");

// *** baseball OFF ***
   document.write("<div id=\"menubox02\" onmouseover=\"imgOn('base');showPopUpMenu('menubox02','0')\" onmouseout=\"imgOff('base');hidePopUpMenu('menubox02')\">");
   document.write("<table class=\"popmenu\" border=2 width=\"125px\" cellspacing=0 cellpadding=1 bordercolor=#2a4132>");
   document.write("<tr><td><a class=\"popUp\" href=\"/index.asp?pageType=majors\">&nbsp;Majors </a></td></tr>");
   document.write("<tr><td><a class=\"popUp\" href=\"/index.asp?pageType=AAA\">&nbsp;Triple-A </a></td></tr>");
   document.write("<tr><td><a class=\"popUp\" href=\"/index.asp?pageType=AA\">&nbsp;Double-A </a></td></tr>");
   document.write("<tr><td><a class=\"popUp\" href=\"/index.asp?pageType=A\">&nbsp;Single-A </a></td></tr>");
   document.write("<tr><td><a class=\"popUp\" href=\"/index.asp?pageType=rookies\">&nbsp;Rookies </a></td></tr>");
   document.write("</table>");
   document.write("</div>");

// *** info ACT ***
   document.write("<div id=\"menubox03\" onmouseover=\"imgAct('info');showPopUpMenu('menubox03','0')\" onmouseout=\"imgAct('info');hidePopUpMenu('menubox03')\">");
   document.write("<table class=\"popmenu\" border=2 width=\"100px\" cellspacing=0 cellpadding=1 bordercolor=#2a4132>");
   document.write("<tr><td><a class=\"popUp\" href=\"/index.asp?pageType=safety\">&nbsp;Safety </a></td></tr>");
   document.write("<tr><td><a class=\"popUp\" href=\"/forms.html\">&nbsp;Forms </a></td></tr>");
   document.write("<tr><td><a class=\"popUp\" href=\"/index.asp?pageType=board\">&nbsp;Board Items </a></td></tr>");
   document.write("<tr><td><a class=\"popUp\" href=\"/index.asp?pageType=newsletter\">&nbsp;Newsletter </a></td></tr>");
   document.write("<tr><td><a class=\"popUp\" href=\"/directions.html\">&nbsp;Directions </a></td></tr>");
   document.write("<tr><td><a class=\"popUp\" href=\"/index.asp?pageType=sponsors\">&nbsp;Sponsors </a></td></tr>");
   document.write("<tr><td><a class=\"popUp\" href=\"/links.html\">&nbsp;Links </a></td></tr>");
   document.write("</table>");
   document.write("</div>");

// *** baseball ACT ***
   document.write("<div id=\"menubox04\" onmouseover=\"imgAct('base');showPopUpMenu('menubox04','0')\" onmouseout=\"imgAct('base');hidePopUpMenu('menubox04')\">");
   document.write("<table class=\"popmenu\" border=2 width=\"125px\" cellspacing=0 cellpadding=1 bordercolor=#2a4132>");
   document.write("<tr><td><a class=\"popUp\" href=\"/index.asp?pageType=majors\">&nbsp;Majors </a></td></tr>");
   document.write("<tr><td><a class=\"popUp\" href=\"/index.asp?pageType=AAA\">&nbsp;Triple-A </a></td></tr>");
   document.write("<tr><td><a class=\"popUp\" href=\"/index.asp?pageType=AA\">&nbsp;Double-A </a></td></tr>");
   document.write("<tr><td><a class=\"popUp\" href=\"/index.asp?pageType=A\">&nbsp;Single-A </a></td></tr>");
   document.write("<tr><td><a class=\"popUp\" href=\"/index.asp?pageType=rookies\">&nbsp;Rookies </a></td></tr>");
   document.write("</table>");
   document.write("</div>");
}

// show the pop-up menu
function showPopUpMenu(objID,trap)
{
   if (!submenus)
      return;
   showPos();
   if (trap == 1) {
      popMenuShowPosX= posX; //event.x;
      popMenuShowPosY= posY; //event.y;
   }
   if (document.all) {
      objName = eval('document.all.' + objID + '.style');
      objName.pixelLeft = popMenuShowPosX;
      objName.pixelTop = popMenuShowPosY;
   }
   else {
      objName = eval('document.' + objID);
      objName.left = popMenuShowPosX;
      objName.top = popMenuShowPosY;
   }
}

// hide the pop-up menu
function hidePopUpMenu(objID)
{
   if (!submenus)
      return;

   if (document.all) {
      objName = eval('document.all.' + objID + '.style');
      objName.pixelLeft = popMenuHidePos;			
   }
   else {
      objName = eval('document.' + objID);
      objName.left = popMenuHidePos;
   }
   window.status= '';
}

// scripting template to produce top header/menu
function topmenu(curPage)
{
// create sub-menu
   makeSubMenus();

// create header
   document.write("<table class=header border=0 cellspacing=0 cellpadding=0 width='100%>'");
//*** NORMAL
   document.write("<tr><td><img src=\"/images/HYSA_banner.jpg\" width=\"950px\" height=\"85px\"></td></tr>");
//*** NORMAL

//*** CHRISTMAS
//   document.write("<tr><td><div style=\"width:950px;height:85px\"><img src=\"/images/HYSA_banner.jpg\" width=\"950px\" height=\"85px\">");
//   document.write("<img src=\"/images/ChristmasLights.gif\" style=\"border:none;width:550px;height:35px;position:absolute;left:82px;top:74px\"></div></td></tr>");
//*** CHRISTMAS
//*** AUTUMN
//   document.write("<tr><td><img src=\"/images/HYSA_banner_autumn.jpg\" width=\"950px\" height=\"85px\"></td></tr>");
//*** AUTUMN
   document.write("<tr valign=bottom>");
   document.write("<td class=menuTab>");
   document.write("<table border=0 cellspacing=0 cellpadding=0 align=right>");
   document.write("<tr>");

// create menu toolbar
   if (curPage == 'news')
      document.write("<td><img src=\"/images/news_ON.gif\" height=\"20px\" width=\"75px\" alt=\"\" name=\"news\"></td>");
   else
      document.write("<td><img src=\"/images/news_OFF.jpg\" height=\"20px\" width=\"75px\" alt=\"\" name=\"news\" onmouseover=\"imgOn('news')\" onmouseout=\"imgOff('news')\" onclick=\"window.location='/index.asp'\"></td>");

   if (curPage == 'baseball')
      document.write("<td><img src=\"/images/baseball_On.gif\" height=\"20px\" width=\"100px\" alt=\"\" name=\"base\" onmouseover=\"imgAct('base');showPopUpMenu('menubox04','1')\" onmouseout=\"imgAct('base');hidePopUpMenu('menubox04')\" onclick=\"window.location='/index.asp?pageType=baseball'\"></td>");
//      document.write("<td><img src=\"/images/baseball_ON.gif\" height=\"20px\" width=\"100px\" alt=\"\" name=\"base\"></td>");
   else
      document.write("<td><img src=\"/images/baseball_OFF.jpg\" height=\"20px\" width=\"100px\" alt=\"\" name=\"base\" onmouseover=\"imgOn('base');showPopUpMenu('menubox02','1')\" onmouseout=\"imgOff('base');hidePopUpMenu('menubox02')\" onclick=\"window.location='/index.asp?pageType=baseball'\"></td>");

   if (curPage == 'basketball')
      document.write("<td><img src=\"/images/basketball_ON.gif\" height=\"20px\" width=\"125px\" alt=\"\" name=\"bask\"></td>");
   else
      document.write("<td><img src=\"/images/basketball_OFF.jpg\" height=\"20px\" width=\"125px\" alt=\"\" name=\"bask\" onmouseover=\"imgOn('bask')\" onmouseout=\"imgOff('bask')\" onclick=\"window.location='/index.asp?pageType=basketball'\"></td>");

   if (curPage == 'soccer')
      document.write("<td><img src=\"/images/soccer_ON.gif\" height=\"20px\" width=\"100px\" alt=\"\" name=\"socc\"></td>");
   else
      document.write("<td><img src=\"/images/soccer_OFF.jpg\" height=\"20px\" width=\"100px\" alt=\"\" name=\"socc\" onmouseover=\"imgOn('socc')\" onmouseout=\"imgOff('socc')\" onclick=\"window.location='/index.asp?pageType=soccer'\"></td>");

   if (curPage == 'info')
      document.write("<td><img src=\"/images/info_On.gif\" height=\"20px\" width=\"75px\" alt=\"\" name=\"info\" onmouseover=\"imgAct('info');showPopUpMenu('menubox03','1')\" onmouseout=\"imgAct('info');hidePopUpMenu('menubox03')\" onclick=\"window.location='/info.html'\"></td>");
//      document.write("<td><img src=\"/images/info_ON.gif\" height=\"20px\" width=\"75px\" alt=\"\" name=\"info\"></td>");
   else
      document.write("<td><img src=\"/images/info_OFF.jpg\" height=\"20px\" width=\"75px\" alt=\"\" name=\"info\" onmouseover=\"imgOn('info');showPopUpMenu('menubox01','1')\" onmouseout=\"imgOff('info');hidePopUpMenu('menubox01')\" onclick=\"window.location='/info.html'\"></td>");

// create footer
   document.write("</tr>");
   document.write("</table>");
   document.write("</td>");
   document.write("</tr>");
   document.write("<tr>");
   document.write("<td colspan=2><img src='/images/orange1pix.jpg' height=4px width='100%' border=0 alt=''/></td>");
   document.write("</tr>");
   document.write("</table>");
}
