<!--
// This script works in conjunction with the EventBrowser web control
// This script is based on Smart Folding Menu tree- By Dynamic Drive (rewritten 03/03/02)

var ns6=document.getElementById&&!document.all
var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1

var lastSport = null;
var lastTournament = null;

function Event(eventId)
{	
	/*if (String(parent.main.marketList) == "undefined")
		parent.main.location.href = "betting.aspx?eventId="+eventId;
	else	
		parent.main.marketList.location.href = "marketList.aspx?eventId="+eventId;
		*/
		
    window.open('Marketlist.aspx?eventId='+eventId,'_self');
}

function CheckContained(e)
{
	var isContained=0;
	cur=ns6? e.target : event.srcElement;  //get the clicked Element	
	if (cur.id.indexOf("bs_")== 0 || cur.id.indexOf("bt_")== 0) {   //if a sport or tounrament is clicked
		var foldercontent= cur.getElementsByTagName("UL")[0];/*ns6? cur.nextSibling.nextSibling : cur.all.tags("UL")[0];*/ //get the ul tag containing the tournaments (if sport is clicked) or events (if tourmanent is clicked)
		
		if (foldercontent.style.display=="none"){
			foldercontent.style.display="";
			if (cur.id.indexOf("bs_")==0) {
				if (lastSport != null) {
					lastSport.className = "bs";
					lastFoldercontent= lastSport.getElementsByTagName("UL")[0];/*ns6? lastSport.nextSibling.nextSibling : lastSport.all.tags("UL")[0]*/
					lastFoldercontent.style.display="none";
				}
				
				tmpSportId = cur.getAttribute("name");
				myArr = tmpSportId.split("_");				
				cur.className = "bso";
				lastSport = cur;
			} else if (cur.id.indexOf("bt_")==0) {			    
				if (lastTournament != null) {
					lastTournament.className = "bt";
					lastFoldercontent=lastTournament.getElementsByTagName("UL")[0];//ns6? lastTournament.nextSibling.nextSibling : lastTournament.all.tags("UL")[0]
					lastFoldercontent.style.display="none";
				}
				cur.className = "bto"
				lastTournament = cur;				
			}			
		}
		else {
			foldercontent.style.display="none";
			if (cur.id.indexOf("bs_")==0){
				cur.className = "bs";
				lastSport = null;
			} else if (cur.id.indexOf("bt_")==0) { 
				cur.className = "bt";
				lastTournament = null;
			}
		}
	}
}

if (ie4||ns6){
	document.onclick=CheckContained;
}


function ExpandAll(){
    var eb_root_ul = document.getElementById("ulEventBrowser");
    var eb_u_list = eb_root_ul.getElementsByTagName("UL");
    var eb_u_list_count = eb_u_list.length;
    for (var eb_ul_index = 0; eb_ul_index<eb_u_list_count; eb_ul_index++){
        eb_u_list[eb_ul_index].style.display = "";
    }  
    lastTournament = null;
    lastSport = null; 
}

function CollapseAll(){
    var eb_root_ul = document.getElementById("ulEventBrowser");
    var eb_u_list = eb_root_ul.getElementsByTagName("UL");
    var eb_u_list_count = eb_u_list.length;
    for (var eb_ul_index = 0; eb_ul_index<eb_u_list_count; eb_ul_index++){
        eb_u_list[eb_ul_index].style.display = "none";
    }
    lastTournament = null;
    lastSport = null; 
    
}

//-->

