function getHTTPObject()
{
	if (window.ActiveXObject) 
		{return new ActiveXObject("Microsoft.XMLHTTP");}
	else if (window.XMLHttpRequest) 
		{return new XMLHttpRequest();}
	else {
		alert("Your browser does not support AJAX.");
		return null;
	}
}

function byId(id)
{
	return document.getElementById(id);
}
var creatureExtraMaxHeight;
var creatureExtraCurrentHeight;
var creatureExtraDivId;
function getCreatureExtra(id, petId)
{
	httpObjectExtraStats = getHTTPObject();
	creatureExtraDivId = id;
	if (httpObjectExtraStats !== null) 
	{
		byId(creatureExtraDivId).style.visibility = "visible";
		byId(creatureExtraDivId).innerHTML = "Loading stats<div style='height: 11px; margin-right: 2px; width: 16px; float: right; background-image: URL(\"../creatures/style/images/loadBars.gif\")'></div>";
		byId(creatureExtraDivId).style.overflow = "visible";
		byId(creatureExtraDivId).style.height = "";
		creatureExtraCurrentHeight = 16;
		httpObjectExtraStats.onreadystatechange = getCreatureExtraOutput;
		httpObjectExtraStats.open("GET", "../creaturesdev/common/ajax/getCreatureExtraStats.php?id="+petId+"&r="+new Date().getTime(), true);
		httpObjectExtraStats.send();
	}
}
function getCreatureExtraOutput()
{
	if (httpObjectExtraStats.readyState == 4)
	{
		byId(creatureExtraDivId).innerHTML = httpObjectExtraStats.responseText;
		creatureExtraMaxHeight = byId(creatureExtraDivId).clientHeight;
		byId(creatureExtraDivId).style.overflow = "hidden";
		expandCreatureExtra();
	}
}
function hideCreatureExtra(id)
{
	byId(id).style.visibility = "hidden";
}
function expandCreatureExtra()
{
	creatureExtraCurrentHeight+=4;
	byId(creatureExtraDivId).style.height = creatureExtraCurrentHeight+"px";
	if (creatureExtraCurrentHeight < creatureExtraMaxHeight)
	{
		setTimeout('expandCreatureExtra()', 5)
	}
}
