function selectTeam(selectedID,unselectedID) {
	document.getElementById('tb' + unselectedID).style.backgroundColor = '#FFFFFF';
	document.getElementById('tb' + selectedID).style.backgroundColor = '#F7F4B3';
	document.getElementById('tbdiv' + unselectedID).style.borderColor = '#FFFFFF';
	document.getElementById('tbdiv' + selectedID).style.borderColor = '#000000';
}

function checkForCookies() {
	document.cookie = "fbb=cookietest";
	if (document.cookie.indexOf("fbb=cookietest") >= 0 ) {
		return true;
	} else {
		document.write( '<img src="/football/images/icon_error.gif" height="10" width="11" alt="error"/> This site requires cookies to be enabled.  For instructions on enabling cookies in your browser please view the <a href="faq.do#9.1" style="color: #FF0000; font-weight: bold; text-decoration: underline;">FAQ Page</a>.' );
		return false;
	}
}

var handleGPSDialog = null;
function showGamePickStatsDialogBox (gameid,homeid,awayid,pickid,myrank,won){
	window.name='main';
	var url = "/user/gamepickstats.do?gameID=" + gameid + "&homeID=" + homeid + "&awayID=" + awayid + "&pickID=" + pickid + "&myRank=" + myrank + "&won=" + won;
	if (window.showModelessDialog) {
		if (handleGPSDialog != null  && !handleGPSDialog.closed) {
			handleGPSDialog.close();
		}
		handleGPSDialog = window.showModelessDialog(url,window,"status:no;dialogWidth:395px;dialogHeight:414px;help:no");
	} else {
		GPSDialog = window.open(url, "GPSDialog", "menubar=no,toolbar=no,location=no,screenx=175,screeny=175,top=175,left=175,status=no,scrollbars=no,resizeable=no,width=390px,height=400px");
		GPSDialog.focus();
	}
}


var handleGCDialog = null;
function showGameCompareDialogBox (gameid,homeid,awayid){
	window.name='main';
	var url = "/fbp_gamecompare.do?gameID=" + gameid + "&homeID=" + homeid + "&awayID=" + awayid;
	//if (window.showModelessDialog) {
	//	if (handleGCDialog != null  && !handleGCDialog.closed) {
	//		handleGCDialog.close();
	//	}
	//	handleGPSDialog = window.showModelessDialog(url,window,"status:no;dialogWidth:395px;dialogHeight:414px;help:no");
	//} else {
		GCDialog = window.open(url, "GCDialog", "menubar=no,toolbar=no,location=no,screenx=175,screeny=175,top=175,left=175,status=no,scrollbars=no,resizeable=no,width=550px,height=500px");
		GCDialog.focus();
	//}
}


function showUpdate(whichOnes) {
	for (var x=0; x < useinfo.length; x++) {
		document.all[whichOnes][x].style.display = "none";
		document.all[whichOnes + "input"][x].style.display = "";
	}
}

// Used on errorpage
function toggleError(section) {
	document.getElementById(section).style.display = (document.getElementById(section).style.display=='none')?"":"none";
}
				
				

				function buttonDown(objectStyle) {
					objectStyle.borderTopColor = "#696969"; 
					objectStyle.borderLeftColor = "#696969"; 
					objectStyle.borderRightColor = "#FAFAFA"; 
					objectStyle.borderBottomColor = "#FAFAFA";
				}
				function buttonUp(objectStyle) {
					objectStyle.borderTopColor = "#ffffff"; 
					objectStyle.borderLeftColor = "#ffffff"; 
					objectStyle.borderRightColor = "#696969"; 
					objectStyle.borderBottomColor = "#696969";
				}

// used on fbp_newgroup, fbp_groupadmintools
function togglePassword(flag) {
		document.groupinfo.password1.value="";
		document.groupinfo.password2.value="";
		document.groupinfo.password1.disabled = flag;
		document.groupinfo.password2.disabled = flag;
}
function excelDownload() {
	alert("The Group Results Excel is\nunavailable at this time.\n\nPlease check again later.");
}

function validatePicks() {
	
	var message = "";
	
	// Find out how many games need to be picked
	var numPicks = 1;
	//while (document.getElementById('pick' + numPicks) != null) {
	while (document.submitPicks["pick" + numPicks] != null) {
		numPicks++;
	}


	//alert(document.forms["submitPicks"].elements["pick"+(numPicks-1)][0].checked);

	// Check to see if made pick
	for (var x=1; x < numPicks; x++) {
		if (!document.forms["submitPicks"].elements["pick" + x][0].checked && !document.forms["submitPicks"].elements["pick" + x][1].checked) {
			message += "\n\n-One or more games not selected\n  Please select the winners for all available games.";
			break;
		}
	}
	
	//alert(document.forms["submitPicks"].elements["mnfpoints"].value.length);

	// Check to see if entered MNF Score
	if (document.submitPicks.mnfpoints.value.length == 0) {
		message += "\n\n-Total MNF Points not entered\n  Please enter value between 0-255.";
	} else if (parseInt(document.submitPicks.mnfpoints.value) != document.submitPicks.mnfpoints.value-0) { 
		message += "\n\n-Total MNF Points must number between 0-255.";
	} else if (parseInt(document.submitPicks.mnfpoints.value) > 255) { 
		message += "\n\n-Total MNF Points must be between 0-255.";
	}



	//var message2 = "";

	//for (var a=0; a < document.submitPicks.rank.length; a++) {
	//	message2 += "\n" + a + " - " + document.submitPicks.rank[a].value + " - " + document.submitPicks.gameid[a].value;
	//}

	//alert(message2);







	if (message.length > 0) {
		alert("The following errors occurred:" + message);
		return false;
	} else {
		return true;
	}

}




function isHeadlinesLoaded() {
	var objASH = document.getElementById("footballfeedscombeta");
	if (objASH.innerHTML.length < 500 || objASH.innerHTML.length > 5000) {
		objASH.innerHTML = "<div>Headlines Not Available</div>";
	}
}

