<!--
var prevSelectUserElement;

function enableDisableElement(element, enable)
{
	document.getElementById(element).disabled = !enable;
}

function showHideElement(element, show)
{
	if (show)
		document.getElementById(element).style.display = "inline";
	else
		document.getElementById(element).style.display = "none";
}

function setElementChecked(element, checked)
{
	document.getElementById(element).checked = checked;
}

function setElementInnerText(element, text)
{
	document.getElementById(element).innerHTML = text;
}

function setElementValue(element, value)
{
	document.getElementById(element).value = value;
}

function showContextHelp(element)
{
	var text;

	switch (element.id)
	{
		case 'imgContextHelpLeagueType':
			text = '<b>LeagueType</b><br>The league type sets the main rules and determines the way in which your league works. More help is available for each of the league types.';
			break;
		case 'imgContextHelpLeagueTypeStandard':
			text = '<b>Standard</b><br>Make picks for every game on the schedule each week.';
			break;
		case 'imgContextHelpLeagueTypeBestBet':
			text = '<b>Best Bet</b><br>Make picks for a select number of games on the schedule each week.';
			break;
		case 'imgContextHelpLeagueTypeStandardPlusBestBet':
			text = '<b>Standard Plus Best Bet</b><br>Make picks for every game on the schedule each week while designating a select number of games as Best Bet games. 2 points are earned for each Best Bet win, 1 point for each tie.';
			break;	
		case 'imgContextHelpLeagueTypeConfidence':
			text = '<b>Confidence</b><br>Make picks and assign a confidence rank from highest to lowest to every game on the schedule each week. Each win earns points equivalent to the game\'s rank. For example, a correct pick for the highest ranked game receives 16 points.';
			break;
			
		case 'lblAFCHor':
			text = '<b>AFC for columns and NFC for rows</b><br>The score of the AFC team is used for the column numbers, while the score of the NFC team is used for the row numbers.';
			break;
		case 'lblAFCVert':
			text = '<b>NFC for columns and AFC for rows</b><br>The score of the NFC team is used for the column numbers, while the score of the AFC team is used for the row numbers.';
			break;
		case 'lblEnrollOpen':
			text = '<b>Open enrollment</b>  (pick first)<br>With open enrollment, everyone uses the same link to join the pool. People type in their own names and choose as many squares as they like, which is why this is sometimes called the "pick first" option.';
			break;
		case 'lblEnrollRestricted':
			text = '<b>Restricted enrollment</b> (pay first)<br>With restricted enrollment, everyone receives their own individual link to join the pool, typically through e-mail. You provide the name and the number of squares each person is allowed to choose, which is why this is sometimes called the "pay first" option.';
			break;
		case 'lblAutomatic':
			text = '<b>Automatic column/row numbers</b><br>The column and row numbers will be instantly assigned at random once the last square is chosen.';
			break;
		case 'lblManual':
			text = '<b>Manual column/row numbers</b><br>You will set the column and row numbers yourself at any time.';
			break;
		case 'txtPrize4':
			text = '<b>4th Quarter prize</b><br>It is recommended you award a Final prize instead of a 4th Quarter prize, since the game may go into overtime. However, you may wish to award both; if the game ends in regulation time, simply award the 4th Quarter winner both prizes.';
			break;
		case 'shortenUrlLink':
		    text = '<b>Shorten Link</b><br>Click this to turn the long link for your pool into a much shorter link.';
		    break;
			
		case 'txtName':
			text = '<b>Name</b><br>Your name, which will be displayed in the squares you select. A preview is shown to the right.';
			break;
		case 'txtEmail':
			text = '<b>E-mail</b> (optional)<br>If you provide your e-mail address, you will receive pool messages, such as being notified when all of the squares have been selected.';
			break;
	}

	showBalloon(element.id, text);
}

function selectUserTeams(selectionType)
{
	var elems = document.forms[0].elements;
	var attrib;
	var checkValue;
	var newCheckValue;
	
	switch (selectionType)
	{
		case 0:
			newCheckValue = true;
			break;
		case 1:
			newCheckValue = false;
			break;
		case 2:
			attrib = "_paid";
			checkValue = 1;
			break;
		case 3:
			attrib = "_paid";
			checkValue = 0;
			break;
		case 4:
			attrib = "_active";
			checkValue = 1;
			break;
		case 5:
			attrib = "_active";
			checkValue = 0;
			break;
	}
	
	if (selectionType >= 2)
	{
		for (var i = 0; i < elems.length; i++)
			if (elems[i].attributes[attrib] != null)
				if (elems[i].attributes[attrib].value == checkValue)
					elems[i].checked = true;
				else
					elems[i].checked = false;
	}
	else
	{
		for (var i = 0; i < elems.length; i++)
			if (elems[i].name == "chkAction")
				elems[i].checked = newCheckValue;
	}
}

function drpMessagesActionsChange()
{
	var action = parseInt(document.getElementById("drpActions").value);
	var btnSubmit = document.getElementById('btnSubmit');
	
	switch (action)
	{
		case 0:
			showHideElement('divMessage', true);
			showHideElement('divAdmin', false);
			showHideElement('btnSubmit', true);
			btnSubmit.src = 'images/post.gif';
			break;
		case 1:
			showHideElement('divMessage', false);
			showHideElement('divAdmin', true);
			showHideElement('btnSubmit', true);
			btnSubmit.src = 'images/remove.gif';
			break;
		default:
			showHideElement('divMessage', false);
			showHideElement('divAdmin', false);
			showHideElement('btnSubmit', false);
			break;
	}
}

function drpLeagueActionsChange()
{
	var action = parseInt(document.getElementById('drpActions').value);
	var btnSubmit = document.getElementById('btnSubmit');
	
	switch(action)
	{
		case 0:
			showHideElement('divMessage', true);
			showHideElement('divDelete', false);
			showHideElement('btnSubmit', true);
			setElementChecked('chkDelete', false);
			btnSubmit.src = 'images/send.gif';
			break;
		case 1:
			showHideElement('divMessage', false);
			showHideElement('divDelete', false);
			showHideElement('btnSubmit', true);
			setElementChecked('chkDelete', false);
			btnSubmit.src = 'images/save.gif';
			break;
		case 2:
			showHideElement('divMessage', false);
			showHideElement('divDelete', false);
			showHideElement('btnSubmit', true);
			setElementChecked('chkDelete', false);
			btnSubmit.src = 'images/save.gif';
			break;
		case 3:
			showHideElement('divMessage', false);
			showHideElement('divDelete', true);
			showHideElement('btnSubmit', true);
			btnSubmit.src = 'images/deleteteam.gif';
			break;
		default:
			showHideElement('btnSubmit', false);
			showHideElement('divDelete', false);
			showHideElement('divMessage', false);
			document.getElementById('drpActions').selectedIndex = 0;
			break;
	}
}

function optLeagueTypeChange(value)
{
	switch(value)
	{
		case 0:
			showHideElement('divBestBetGamesCount', false);
			showHideElement('divSort', false);
			showHideElement('divConfidenceHighRank', false);
			break;
		case 1:
			showHideElement('divBestBetGamesCount', true);
			showHideElement('divSort', false);
			showHideElement('divConfidenceHighRank', false);
			break;
		case 2:
			showHideElement('divBestBetGamesCount', true);
			showHideElement('divSort', true);
			showHideElement('divConfidenceHighRank', false);
			break;
		case 3:
			showHideElement('divBestBetGamesCount', false);
			showHideElement('divSort', true);
			showHideElement('divConfidenceHighRank', true);
			break;
		case 4:
			showHideElement('divBestBetGamesCount', false);
			showHideElement('divSort', false);
			showHideElement('divConfidenceHighRank', false);
			setElementChecked('chkUsePointsBox', false);
			enableDisableElement('chkUsePointsBox', false);
			setElementChecked('chkPointsBoxClosestWithoutOver', false);
			enableDisableElement('chkUsePointsBox', false);
			enableDisableElement('chkPointsBoxClosestWithoutOver', false);
			break;
	}
}

function addRemoveDefaultPicks(add)
{
	var defaultPicks = document.getElementById('drpDefaultPicks');

	if (add)
	{		
		defaultPicks.options.add(new Option('Favorites', '2'), 2);
		defaultPicks.options.add(new Option('Underdogs', '3'), 3);
	}
	else
	{
		defaultPicks.selectedIndex = 0;
		defaultPicks.options[2] = null;
		defaultPicks.options[2] = null;
	}
}
		
function useLinesChecked()
{
	var checked = document.getElementById('chkUseLines').checked;

	enableDisableElement('chkForceHalfPoints', checked);
	enableDisableElement('lblForceHalfPoints', checked);
	setElementChecked('chkForceHalfPoints', false);
	addRemoveDefaultPicks(checked);
}

function usePointsBoxChecked()
{
	var checked = document.getElementById('chkUsePointsBox').checked;

	enableDisableElement('chkPointsBoxClosestWithoutOver', checked);
	enableDisableElement('lblPointsBoxClosestWithoutOver', checked);
	setElementChecked('chkPointsBoxClosestWithoutOver', false);
}

function picksReminderCustomChecked()
{
	var checked = document.getElementById('chkPicksReminderCustom').checked;

	enableDisableElement('drpReminderDays', checked);
	enableDisableElement('drpReminderHours', checked);
}

function picksDeadlineChanged()
{
	var checked = document.getElementById('optPicksDeadlineCustom').checked;

	enableDisableElement('drpDays', checked);
	enableDisableElement('drpHours', checked);
}

function optWinnersClicked(show)
{
	if (!show)
	{
		setElementChecked('chkUsePointsBox', false);
		enableDisableElement('lblUsePointsBox', false);
		setElementChecked('chkPointsBoxClosestWithoutOver', false);
		enableDisableElement('lblPointsBoxClosestWithoutOver', false);
	}
	else
	{
		enableDisableElement('chkUsePointsBox', true);
		enableDisableElement('lblUsePointsBox', true);
	}
}

function optDefaultPicksClicked(enable)
{
	if (!enable)
		document.getElementById('drpDefaultPicks').selectedIndex = 0;

	enableDisableElement('drpDefaultPicks', enable);
}

function checkForEnter()
{
	if (window.event.keyCode == 13)
		findUser();
}

function findUser()
{
	var userName = document.getElementById('txtFindName').value;
	var userElement = document.getElementById('_' + userName.toLowerCase());
	var userElementTop;
	
	if (userElement != null)
	{
		userElementTop = userElement.offsetTop + userElement.offsetParent.offsetTop;			
	
		if (prevSelectUserElement != null)
			prevSelectUserElement.className = '';

		document.body.scrollTop = userElementTop;
		userElement.className = 'HighlightGray';
					
		prevSelectUserElement = userElement;
	}
	else
		alert('Could not find a coach with the last name of "' + userName + '."');
}
-->