
function toggleSeries(num, numGames) {

	for (i = 1; i <= numGames; i++) {
		var ele = document.getElementById("ul_game"+i)
		var span = document.getElementById("sl_game"+i)

		if (ele != null) { ele.className = "closed" }
		if (span != null) {
			var temp = span.innerHTML.toLowerCase()
			// contains link?
			if (temp.indexOf('<a') == -1) {
				// no link (currently selected game), unbold the text
				var temp2 = span.innerHTML.replace('<b>','')
				temp2 = temp2.replace('</b>','')
				temp2 = temp2.replace('<B>','')
				temp2 = temp2.replace('</B>','')
				span.innerHTML = '<a id="gl_game'+i+'" href="javascript:void(0)" onclick="toggleSeries('+i+','+numGames+');" onmouseover="style.cursor=\'hand\';">'+temp2+'</a>'
				
				var img = document.getElementById("il_game"+i)
				img.src = "http://assets.espn.go.com/i/mlb/playoffs2007/carrot_right.gif"
			}
		}
	}
	
	var box = document.getElementById("ul_game"+num)
	var link = document.getElementById("gl_game"+num)
	var span = document.getElementById("sl_game"+num)
	var inner;
	
	if (box != null) { box.className = "open" }
	if (link != null) {
		// get img tag from within <a href=""></a>
		inner = link.innerHTML
		if (span != null) {
			// replace <a tags in span just with img tag
			span.innerHTML = '<b>'+inner+'</b>'
		}
	}
	
	var boximg = document.getElementById("il_game"+num)
	if (boximg != null) { 
		boximg.src = "http://assets.espn.go.com/i/mlb/playoffs2007/carrot_down.gif"
	}

}


