var xmlHttp;

//-----------------------------------------------------------------
function show_league(town_id)
{   
    //alert(town_id);
	
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
  	{
  		alert ("Your browser does not support AJAX!");
  		return;
  	}
var url="display_league.php?town_id="+town_id;	
	//alert(url);
	xmlHttp.onreadystatechange=stateChanged2;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateChanged2() 
{ 
	if (xmlHttp.readyState==4)
	{  
		document.getElementById("league_div").innerHTML=xmlHttp.responseText;		  
	}
}
//-----------------------------------------------------------------
function show_league_new(town_id)
{   
    //alert(town_id);
	
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
  	{
  		alert ("Your browser does not support AJAX!");
  		return;
  	}
var url="display_league_new.php?town_id="+town_id;	
	//alert(url);
	xmlHttp.onreadystatechange=stateChanged1;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateChanged1() 
{ 
	if (xmlHttp.readyState==4)
	{  
		document.getElementById("league_div").innerHTML=xmlHttp.responseText;		  
	}
}
//-----------------------------------------------------------------
function check_team_limit(league_id)
{   
    //alert(league_id);
	
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
  	{
  		alert ("Your browser does not support AJAX!");
  		return;
  	}
	var url="check_team_limit.php?league_id="+league_id;	
	//alert(url);
	xmlHttp.onreadystatechange=stateChanged3;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateChanged3() 
{ 
	if (xmlHttp.readyState==4)
	{  
		document.getElementById("team_chk").innerHTML=xmlHttp.responseText;		  
	}
}
//-----------------------------------------------------------------
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;
}
//-----------------------------------------------------------------
