
function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		//Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}

XmlHttp=GetXmlHttpObject();

function GetContent(src, content)
{
	if(XmlHttp) 
	{
		document.getElementById(content).innerHTML = "<center><img src='images/indicator.gif'/>Loading...</center>";
	
		XmlHttp.open("GET", src); 
		XmlHttp.onreadystatechange = function()
		{
			if (XmlHttp.readyState == 4) {
				document.getElementById(content).innerHTML = XmlHttp.responseText;
			}
		}
		XmlHttp.send(null);
	}
}

function TeamView(team_id)
{
	document.getElementById('team').style.visibility='visible';
	GetContent("get.php?action=tournament_team&team_id="+team_id, 'team' );
}

function TeamHistory(team_id)
{
	document.getElementById('team').style.visibility='visible';
	GetContent("get.php?action=team_history&team_id="+team_id, 'team' );
}


function LoadScoreboard(tr_id)
{
	GetContent("get.php?action=scoreboard&tournament_id="+tr_id+"&division_id=" + document.getElementById('division_id').value + "&round_id=" + document.getElementById('round_id').value , 'scoreboard' );
}

function LoadResults(tr_id)
{
        GetContent("get.php?action=tournament_result&tournament_id="+tr_id+"&division_id=" + document.getElementById('division_id').value , 'result' );
}

function LoadLeagueRanking()
{
        GetContent("get.php?action=league_ranking&edition_id="+ document.getElementById('edition_id').value +"&division_id=" + document.getElementById('division_id').value , 'result' );
}


function LoadTournamentTeams(tr_id, div_id)
{
        GetContent("get.php?action=tournament_teams&tournament_id="+tr_id+"&division_id=" + div_id , 'teams' );
}


function SetLive()
{
	document.getElementById('contentwrapper').style.backgroundImage='url(images/live.jpg)';
}

function ShowLeagueImg(id)
{
	document.getElementById('league_img').innerHTML = "<img src='images/league_"+id+".jpg'/>";
}

