function changeLines(type){
	if(document.getElementsByName("divDecimalLines")){
		
		elementCount = document.getElementsByName("divDecimalLines").length;	
		elementA = document.getElementsByName("divDecimalLines");
		elementB = document.getElementsByName("divMoneyLines");
		var liAmerican = document.getElementById("liAmerican");
		var liDecimal = document.getElementById("liDecimal");
		var rdoOptions = document.frmFormatOption.optOdds;
		
		if(type=='money'){
			rdoOptions[0].checked = true;
			rdoOptions[1].checked = false;
			liDecimal.className = "format_selected";
			liAmerican.className = "format_unselected";
		}else{
			rdoOptions[0].checked = false;
			rdoOptions[1].checked = true;
			liDecimal.className = "format_unselected";
			liAmerican.className = "format_selected";
		}
	
		
		if(type=='money'){
			//document.getElementById("american").className="selected";
			//document.getElementById("decimal").className="unselected";
			SetCookieRoot('odds','money',1)
			for (i=0; i<elementCount; i++) {
				elementA[i].style.display='none';
				elementB[i].style.display='';
			}
			
		} else {
			//document.getElementById("american").className="unselected";
			//document.getElementById("decimal").className="selected";
			SetCookieRoot('odds','decimal',1)
			for (i=0; i<elementCount; i++) {
				elementA[i].style.display='';
				elementB[i].style.display='none';
			}
		}
	
	}
	  
}

//This function was renamed to SetCookieRoot 
//This function was also declared in the scoreboard code 
//The scoreboard code did not specify path. So we ended up
//having many cookies for the odds value depending on what dir level of the
//site you were at.
function SetCookieRoot(cookieName,cookieValue,nDays) {
	if (nDays) {
		var date = new Date();
		date.setTime(date.getTime()+(nDays*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = cookieName + "=" + cookieValue + expires + "; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function pageLoad(){
	//alert(readCookie('odds'));
	changeLines(readCookie('odds'));
}
	