

function teamRequest(id,sport,year,state,calledby,canrand)
{
if (canrand === undefined) {
var canrand = -1;
}

 if ( calledby === undefined ) {
    url = "index.php?option=com_tournament&buildjs=true&id=" + id + "&sport=" + sport + "&year="+year+"&state="+state+"&canrand="+canrand;
} else if (calledby == 'roster') {
    url = "index.php?option=com_tournament&buildjs=true&id=" + id + "&sport=" + sport + "&year="+year+"&state="+state + "&calledby=roster";
	
} else {
	url = "index.php?option=com_tournament&buildjs=true&id=" + id + "&sport=" + sport + "&year="+year+"&state="+state;
}
if (canrand == 1) {
url = url + "&canrand=1";
//alert(url);
}

var http_request = false;

if (window.XMLHttpRequest)
{ // Mozilla, Safari,...
http_request = new XMLHttpRequest();

if (http_request.overrideMimeType)
{
http_request.overrideMimeType('text/xml');
// See note below about this line
}
} else if (window.ActiveXObject)
{ // IE
try
{
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e)
{
try
{
http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}

if (!http_request)
{
alert('Giving up :( Cannot create an XMLHTTP instance');
return false;
}

http_request.onreadystatechange = function() { alertContents(http_request ); };

http_request.open('GET', url, true);
http_request.send(null);

}


function alertContents(http_request,id)
{
if (http_request.readyState == 4)
{
if (http_request.status == 200)
{
	eval(http_request.responseText);
}

}
}
