var xmlHttp;

function showCarVersion(ID,text,index)
{
	xmlHttp	=	GetXmlHttpObject();
	if(xmlHttp == null)
	{
		alert("Browser soes not support");
		return;
	}
	var	textID	=	"index="+index+"&makerID";
	if(text == "versions")
	{
		textID	=	"carID";
	}
	
	var url	=	"/get-car-version.php?"+textID+"="+ID;
	
	xmlHttp.onreadystatechange = function()
	{	
		if(xmlHttp.readyState == 4 || xmlHttp.readyState =='complete')
		{
			stateChanged(text,index);
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateChanged(text,index)
{
	document.getElementById(text + index).innerHTML = xmlHttp.responseText;
}

function GetXmlHttpObject()
{
	var xmlHttp = null;
	try{
		xmlHttp = new XMLHttpRequest();
		}
	catch(e)
	{
	try
		{
			xmlHttp = new ActiveXObject("MSxml2.XMLHTTP");
		}
		catch(e)
		{
			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
	
}