// Global variables
var imageLoadFlag = 0;
var imageCache = new Array();
var menuLoadFlag = 0;
var menuCount = 0;
var onMenu = 0;
var winW, winH;
var mT = 0;
var MenuFlag = "";


// browser define
var ns = (navigator.appName == 'Netscape');
var gen3 = (parseInt(navigator.appVersion) >= 3 && parseInt(navigator.appVersion) < 4);
var ns4 = (ns && parseInt(navigator.appVersion) >= 4 && parseInt(navigator.appVersion) < 5);
var ie = (navigator.appName == 'Microsoft Internet Explorer');
var ie3 = (ie && navigator.appVersion < 4);
var ie4 = (ie && parseInt(navigator.appVersion) >= 4);
var win2k = (navigator.userAgent.indexOf('Windows NT 5.0') != -1);
var ie4mac = (ie && navigator.userAgent.indexOf('Macintosh') != -1);
var ie4orns4 = (ie4 || ns4);
var win31 = (navigator.appVersion.indexOf("Win16") != -1)



if (ie4) {
  SHOW = "visible";
  HIDE = "hidden";
} else if (ns4) {
  SHOW = "show";
  HIDE = "hide";
}


// writes the HTML for the Floating Menus

function MenuCreator() {
 if (ie4orns4) {
  var dU = MenuCreator.arguments[0];
  var dN = "lT" + dU;
  document.write('<DIV ID="' + dN + '"><IMG SRC="../images/spacer.gif" WIDTH=150 HEIGHT=1 ALT=""><BR><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=150>');
  for (var totalfields = 1; totalfields < MenuCreator.arguments.length; totalfields++) {
    document.write('<TR><TD VALIGN="TOP"><IMG SRC="../images/webball.gif" WIDTH=16 HEIGHT=13 ALT=""></TD>');
    document.write('<TD><SPAN CLASS="lM"><A CLASS="lM" onMouseOver="clearTimeout(mT);" onMouseOut="menuTimeOff(' + MenuCreator.arguments[totalfields] + '</SPAN></TD></TR>');
  }
  document.write('</TABLE></DIV>');
  if (!ie4) document.write('<DIV ID="lM' + dU + '"></DIV>');
  menuCount++;
  if (menuCount == 3) menuLoadFlag = 1;
 }
}

function finishMenu(mId) {
 var dH;
 var dN = "lT" + mId;
 dH = eleHeight(dN);
 dN = "lM" + mId;

 if (ie4 || ns4) {
   var offM = dH - ((mId == 6) ? 34 : 14);
   if (offM < 1) offM = 1;
   document.write('<DIV ID="' + dN + '"><IMG SRC="../images/nav_' + ((mId == 6) ? "bg" : "") + 'menutop.gif" WIDTH=175 HEIGHT=' + ((mId == 6) ? "41" : "28") + '><BR>');
   document.write('<IMG SRC="../images/nav_menumid.gif" WIDTH=175 HEIGHT=' + offM + '><BR><IMG SRC="../images/nav_menubtm.gif" WIDTH=175 HEIGHT=10></DIV>');
   menuTrans(dN, 85);
 } 

 if (mId == 3) menuLoadFlag = 1;

}

function changemenu(imNum, aMem, vizProp) {
  if (menuLoadFlag && imageLoadFlag) {
    if (vizProp == SHOW) {
      if (MenuFlag) {
        eval(MenuFlag);
        clearTimeout(mT);
      }
      menuTrans('l' + imNum,85);
    } else
      menuTrans('l' + imNum,100);
    MenuFlag = "";
    var imName = "lN" + imNum;
    if (ns4) eval('document.l' + imNum + '.document[imName].src = imageCache[aMem].src');
    else document[imName].src = imageCache[aMem].src;
    if (ie && win2k) {  // Windows 2000 IE fix -- will not correctly hide semi-transparent elements
      if (vizProp == SHOW) { menuTrans('lM' + imNum,85); }
      else { menuTrans('lM' + imNum,100); }
    }
    vizElement('lM' + imNum, vizProp);
    vizElement('lT' + imNum, vizProp);
    onMenu = imNum;
  }
}

function menuTrans(mId, grade) {
  if (ie4 && !ie4mac) {
    eval('document.all.' + mId + '.style.filter="alpha(opacity=' + grade + ')"');
  }
}

function menuTimeOff(imNum, aMem) {
  if (menuLoadFlag && imageLoadFlag) {
    MenuFlag = "changemenu(" + imNum + ", " + aMem + ", HIDE)";
    mT = setTimeout(MenuFlag, 2000);
  }
}

function navmaker()
{

var ns3adjust = 0;
if (win31 || gen3 || ie3){
	if (ie3) var ns3adjust = 49;
	else if (gen3) var ns3adjust = 17;
	else if (win31) var ns3adjust = 100;
}
  document.write('<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=758><TR>');
 document.write('<TD VALIGN=TOP><IMG SRC="../images/spacer.gif" HEIGHT=4 WIDTH=1 ALT=""><BR></TD></TR>');
 document.write('</TABLE>');

 document.write('<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=758><TR><TD VALIGN=TOP><IMG SRC="../images/spacer.gif" HEIGHT=1 WIDTH=10></TD>');
 document.write('<TD VALIGN=TOP><A HREF="http://www.bayareatexasbaseball.com"><IMG SRC="../images/batbcom.gif" HEIGHT=23 WIDTH=194 BORDER=0 ALT="www.BayAreaTexasBaseball.com"><BR></A></TD>\n');
 document.write('<TD ALIGN=LEFT VALIGN=TOP><IMG SRC="../images/nav_topalgerian32.gif" HEIGHT=72 WIDTH=553 BORDER=0 usemap="#mapNav" ALT=""><BR></TD></TR>');
 document.write('</TABLE>');
 document.write('<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=758><TR>');
 document.write('<TD VALIGN=TOP><IMG SRC="../images/spacer.gif" HEIGHT=1 WIDTH=10></TD>');
 document.write('<TD VALIGN=TOP>');
 if (!win31) {document.write('<IMG SRC="../images/spacer.gif" BORDER=0 HEIGHT=1 WIDTH=' + (17 + ns3adjust) + ' ALT="">');}
 	else {document.write('<IMG SRC="../images/spacer.gif" BORDER=0 HEIGHT=1 WIDTH=32 ALT="">');}
 document.write('<IMG SRC="../images/spacer.gif" WIDTH=559 HEIGHT=45 BORDER=0></A></TD></TR>');
 document.write('</TABLE>\n');

}

function eleHeight(eleId)
{
   if (ie4)
     return eval('document.all.' + eleId + '.offsetHeight');
   else if (ns4)
     return eval('document.' + eleId + '.document.height');
}

function vizElement(eleId, vizProp)
{
  if (ie4) eval('document.all.' + eleId + '.style.visibility = "' + vizProp + '"');
  else if (ns4) eval('document.' + eleId + '.visibility = "' + vizProp + '"');
}

function cacheimages() {
 if (document.images) {
  for (var loadProg = 0; loadProg < cacheimages.arguments.length; loadProg++) {
    cI = cacheimages.arguments[loadProg];
    imageCache[loadProg] = new Image();
    imageCache[loadProg].src = '../images/nav_' + cI + '.gif';
  }
 imageLoadFlag = 1;
 }
}

function setup() {
 if (ie4orns4) {
  cacheimages('home', 'home_on', 'registration', 'registration_on', 'news', 'news_on', 'sponsor', 'sponsor_on', 'schedules', 'schedules_on', 'standings', 'standings_on');

  if (ns4) {
    winW = window.innerWidth;
    winH = window.innerHeight;
    window.onresize = reDraw;
  }

 }
}

function reDraw() {
  if (ns4 && (winW!=window.innerWidth || winH!=window.innerHeight))
    history.go(0);
}

window.onload = setup;
window.offscreenBuffering = true;


<!--
var ie4 = ((navigator.appName == 'Microsoft Internet Explorer') && parseInt(navigator.appVersion) >= 4);
MenuCreator(0, '0, 0);" HREF="../about/board.htm">Board Members</A>',
                 '0, 0);" HREF="../about/baseball.htm">Baseball Information</A>',
	    '0, 0);" HREF="../maps/fields.htm">Map to the Fields</A><IMG SRC="../images/spacer.gif" WIDTH=1 HEIGHT=12 BORDER=0>');
MenuCreator(1, '1, 2);" HREF="../register/spring.htm">Spring</A> ',
                '1, 2);" HREF="../register/fall.htm">Fall</A>');
MenuCreator(2, '2, 4);"HREF="../info/phr.htm">2008 BATB, MLB and Pepsi</A>',
	'2, 4);" HREF="../info/survey07.htm">2007 Survey Results</A>');
MenuCreator(3, '3, 6);" HREF="../sponsors/newsponsor.htm">Become a Sponsor</A>',
                '3, 6);" HREF="../sponsors/sponsors.htm">See Our Sponsors</A>');
MenuCreator(4, '4, 8);" HREF="../schedules/baseball.htm">Spring Baseball</A>',
                '4, 8);" HREF="../schedules/fallsched.htm">Fall Baseball</A>');
MenuCreator(5, '5, 10);" target="_blank" HREF="../schedules/spring/2010/standings5.htm">Machine Pitch I</A>',
                '5, 10);" target="_blank" HREF="../schedules/spring/2010/standings6.htm">Machine Pitch II</A>',
	'5, 10);" target="_blank" HREF="../schedules/spring/2010/standings7.htm">Freshman</A>',
	'5, 10);" target="_blank" HREF="../schedules/spring/2010/standings8.htm">Sophomore 11</A>',
	'5, 10);" target="_blank" HREF="../schedules/spring/2010/standings11.htm">Sophomore 12</A>',
	'5, 10);" target="_blank" HREF="../schedules/spring/2010/standings9.htm">Junior</A>',
	'5, 10);" target="_blank" HREF="../schedules/spring/2010/standings10.htm">Senior</A>');
navmaker('Test','');

// -->
<!--
if (ie4 || ns4)
  for (var i = 0; i < menuCount; i++)
    finishMenu(i);
// -->
