function getXMLHTTPRequest()
{
   try
   {
      /* Firefox */
      req = new XMLHttpRequest();
   } 
   catch(err1) 
   {
      try 
      {
         /* some versions IE */
         req = new ActiveXObject("Msxml2.XMLHTTP");
      } 
      catch (err2)
      {
         try 
         {
            /* other versions IE */
            req = new ActiveXObject("Microsoft.XMLHTTP");
         }
         catch (err3)
         {
            req = false;
         }
      }
   }
   return req;
}



var http = getXMLHTTPRequest();


function callAjax(sport,league) { 

	//var myurl = '/betting/query_odds_ajax.php';
	var myurl = '/functions/ajax_odds.php';

	var modurl = myurl + "?sport=" + escape(sport) + "&league=" + escape(league);

	http.open("GET", modurl, true);
	http.onreadystatechange = useHttpResponse;
	http.send(null);
}


function useHttpResponse() {
	if (http.readyState == 4) {
		if(http.status == 200) {
			var mytext = http.responseText;
			document.getElementById('oddsdiv').innerHTML = mytext;
		}
	} else { 
		document.getElementById('oddsdiv').innerHTML = "<img src='/img/loading.gif' style='margin-bottom:10px;' alt='loading...' />";
	}
}
