function createRequestObject()

{

{
try
{
request_o = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(ex)
{
//either this is not IE, or it is a version of IE which does not support XMLHTTP
var notIECompatibleXMLHTTP=true;
}
if(notIECompatibleXMLHTTP==true)
{
try
{
request_o = new XMLHttpRequest();
}
catch(ex)
{
//we can't use AJAX because this browser is not compatible.
request_o = false;
}
}
return request_o;
}

var XMLHTTP_o;
if(XMLHTTP_o=getXMLHTTP())
{
alert('YAY we can do AJAX.');
alert(XMLHTTP_o.toString());
}
else
{
alert('WAAAH not compatible.');
}

}

//Holds the whole request in one variable

var http = createRequestObject(); 

//-------------------------------------------------------------------



function getAthlete(order,aord, thisl1, thisl2){
	
	var orderby = order;
  var ascdesc = aord;
  var getl2 = thisl2;
  var getl1 = thisl1;
  
  //alert(getl2);
  //alert(getl1);
  //alert(orderby);
  
  var thisProgram = document.show.program.options.selectedIndex;
  var pValue = document.show.program.options[thisProgram].value;
  
  if (pValue == ""){pValue = "all";}
  
  //alert (pValue);
  
  var thisLevel = document.show.level.options.selectedIndex;
  var lValue = document.show.level.options[thisLevel].value;
  
  if (lValue == ""){lValue = "all";}
  
  //var thisState = document.form.states.options.selectedIndex;
  //var sValue = document.form.states.options[thisState].value;
  
  //alert(pValue);
  //alert(lValue);
  //alert(sValue);
  
  http.open('get', 'internal_request.php?action=sendpl&program=' + pValue + '&level=' + lValue + '&order=' + orderby + '&updown=' + ascdesc + '&l1=' + getl1 + '&l2=' + getl2);
	
	//Check to see if there is an answer from server
	
	http.onreadystatechange = handleResponse; //what to do with the data
	
	//Sends data request
	
	http.send(null);
}


function getBios(number){
	
  
  var usag = number;
  
   
  //alert(usag);
  //alert(lValue);
  //alert(sValue);
  
    http.open('get', 'internal_request.php?action=sendbr&usag='+ usag);
	
	//Check to see if there is an answer from server
	
	http.onreadystatechange = handleResponse2; //what to do with the data
	
	//Sends data request
	
	http.send(null);
}

function handleResponse(){
	   
	 //Check for ready state = 4 
	  
	if(http.readyState == 4){
		var response = http.responseText;
		
		//where to place the response // in a DIV TAG
	   
	       	
		document.getElementById('response').innerHTML = response;
	}
}

function handleResponse2(){
	   
	 //Check for ready state = 4 
	  
	if(http.readyState == 4){
		var response = http.responseText;
		
		//where to place the response // in a DIV TAG
	   
	       	
		document.getElementById('bioshow').innerHTML = response;
	}
}
