var speed = 50
var pause = 2000
var timerID = null
var bannerRunning = false
var ar = new Array()

//ar[0] = "CJMSBL Spring 2004 Schedule"

var currentMessage = 0
var offset = 0

function stopBanner()
{
	if (bannerRunning)
	clearTimeout (timerID)
	bannerRunning = false
}

function startBanner()
{
	stopBanner()
	showBanner()
}

function showBanner()
{
	var text = ar[currentMessage]
	
	if (offset < text.length)
	{
		if (text.charAt(offset) == " ")
			offset++
		
		var partialMessage = text.substring(0, offset + 1)
		window.status = partialMessage

		offset++
		timerID = setTimeout("showBanner()", speed)
		bannerRunning = true
	}
	else
	{
		offset = 0
		currentMessage++
		if (currentMessage == ar.length)
			currentMessage = 0
		timerID = setTimeout("showBanner()", pause)
		bannerRunning = true
	}
}

var user;
var domain;
var suffix;

function email(user, domain, suffix)
{
	document.write('<a href="' + 'mailto:' + user + '@' + domain + '.' + suffix + '"  class=link>' + user + '@' + domain + '.' + suffix + '</a>');
}

var managerMenuSet;
var umpireMenuSet

function buildMenu(x)
{
	var browser = browserTest();
	var myRow = document.getElementById(x);
	var myImage = document.getElementById("ballspin");
	var newMenuField;
	
	
	if (x == 'managers' && !managerMenuSet)
	{
		if (browser == "Netscape")
		{
			document.getElementById("Managers").style.visible=visible;
			myRow.innerHTML = "hello kathleen";
		}
		else
		{
			myCell = myRow.insertCell();
			newMenuField = "&nbsp;";
			myCell.innerHTML = newMenuField;
			myCell = myRow.insertCell();
			newMenuField = "<a href='managers_american.html' title='American Division Managers' class=submenu onMouseOver='style.fontWeight=\"bold\"' onMouseOut='style.fontWeight=\"normal\"'>&nbsp;American</a>" +
							"<br><a href='managers_national.html' title='National Division Managers' class=submenu onMouseOver='style.fontWeight=\"bold\"' onMouseOut='style.fontWeight=\"normal\"'>&nbsp;National</a>";
			myCell.innerHTML = newMenuField;
		}
		
		managerMenuSet = true;
	}
	else if (x == 'umpires' && !umpireMenuSet)
	{
		myCell = myRow.insertCell();
		newMenuField = "&nbsp;";
		myCell.innerHTML = newMenuField;
		myCell = myRow.insertCell();
		newMenuField = "<a href='umpires.html' title='Umpire Contact Info' class=submenu onMouseOver='style.fontWeight=\"bold\"' onMouseOut='style.fontWeight=\"normal\"'>&nbsp;Contact Info</a>" +
						"<br><a href='umpires_american.html' title='American Division Umpire Schedule' class=submenu onMouseOver='style.fontWeight=\"bold\"' onMouseOut='style.fontWeight=\"normal\"'>&nbsp;AL Schedule</a>" +
						"<br><a href='umpires_national.html' title='National Division Umpire Schedule' class=submenu onMouseOver='style.fontWeight=\"bold\"' onMouseOut='style.fontWeight=\"normal\"'>&nbsp;NL Schedule</a>";
		myCell.innerHTML = newMenuField;
		
		umpireMenuSet = true;
	}
	else
	{
		myRow.deleteCell();
		myRow.deleteCell();
		if (x == 'managers')
		{
			managerMenuSet = false;
		}
		if (x == 'umpires')
		{
			umpireMenuSet = false;
		}
	}
	
	if (myImage)
	{
		myImage.src="images/baseball-spin.gif";
	}
}

function highlight(x,color)
{
	if (document.all||document.getElementById)
	x.style.font.color=color
}

function browserTest() {
	thisapp=navigator.appName;
       	thisversion=navigator.appVersion;
	return thisapp;
}

var theFocus = null;

function openWindow (url, w, h)
{
	var browser = browserTest();
	if (browser == "Netscape")
	{
		if (w == undefined) { w = 'WIDTH=500'; }
		if (h == undefined) { h = 'HEIGHT=300'; }
		if (theFocus == undefined) { theFocus = 'lookup'; }
	}
	else
	{
		if (w == null) { w = 'WIDTH=500'; }
		if (h == null) { h = 'HEIGHT=300'; }
		if (theFocus == null) { theFocus = 'lookup'; }
	}
	var winspecs = w +","+ h +",resizable=1,scrollbars=1,menubar=0,location=0,top=0,left=0";
	lookup_window = window.open(url, "lookup_window", winspecs);

	if (theFocus == 'main')
	{
		self.focus();
	}
	else
	{
		lookup_window.focus();
	}

	if (lookup_window.opener == null) lookup_window.opener = window;
	self.name = "main";
}

/* keep the ball spinning when user closes the print window */
function closeWindow()
{
	var myImage = opener.document.getElementById("ballspin");
	myImage.src="images/baseball-spin.gif";
	window.close();
}

function changeButton(img_name, img_src, img_alt)
{
	document[img_name].src = img_src;
	document[img_name].alt = img_alt;
}

var theFocus = null;
	
function openPhotoWindow(x)
{
	document.photoform.currentNumber.value = x;
	var league = document.getElementById("division");
	var url = "";
	
	if (league.value == "national")
	{
		url = "photowindow_nl.html";
	}
	else if (league.value == "american")
	{
		url = "photowindow_al.html";
	}
	
	var w = "width=540px";
	var h = "height=664px";
	
	var winspecs = w +","+ h +",resizable=1,scrollbars=1,menubar=0,location=0,top=0,left=0";
	lookup_window = window.open(url, "lookup_window", winspecs);

	if (theFocus == 'main') {
		self.focus();
	}
	else {
		lookup_window.focus();
	}

	if (lookup_window.opener == null) lookup_window.opener = window;
	self.name = "main";
}