var xmlHttp;
		
function showAddForm(str) {
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null) {
		alert ("Browser does not support HTTP Request");
		return;
	}
	var url="show-add-form.php";
	url=url+"?category_id="+str;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=showAddFormStateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 

function showAddFormStateChanged() {
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
		document.getElementById("item_add_form").innerHTML=xmlHttp.responseText;
	}
}

function changeBrandList(str) {
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null) {
		alert ("Browser does not support HTTP Request");
		return;
	}
	var url="show-brands.php";
	url=url+"?category_id="+str;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=showChangeBrandListStateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 

function showChangeBrandListStateChanged() {
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
		document.getElementById("brands").innerHTML=xmlHttp.responseText;
	}
}


function showModel(str) {
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null) {
		alert ("Browser does not support HTTP Request");
		return;
	}
	var url="show-models.php";
	url=url+"?brand_id="+str;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=showModelStateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 

function showModelStateChanged() {
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
		document.getElementById("model_div").innerHTML=xmlHttp.responseText;
	}
}

function showAddModel(str1, str2) {
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null) {
		alert ("Browser does not support HTTP Request");
		return;
	}
	var url="/show-models.php";
	url=url+"?brand_id="+str1+"&selected="+str2;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=showAddModelStateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 

function showAddModelStateChanged() {
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
		document.getElementById("modelrow").innerHTML=xmlHttp.responseText;
	}
}


function showRegions(str3, str4) {
	xmlHttp1=GetXmlHttpObject()
	if (xmlHttp1==null) {
		alert ("Browser does not support HTTP Request");
		return;
	}
	var url="/show-regions.php";
	url=url+"?country_id="+str3+"&selected="+str4;
	url=url+"&sid="+Math.random();
	xmlHttp1.onreadystatechange=showRegionsStateChanged;
	xmlHttp1.open("GET",url,true);
	xmlHttp1.send(null);
} 

function showRegionsStateChanged() {
	if (xmlHttp1.readyState==4 || xmlHttp1.readyState=="complete") {
		document.getElementById("regionrow").innerHTML=xmlHttp1.responseText;
	}
}

function showRegionsSearch(str) {
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null) {
		alert ("Browser does not support HTTP Request");
		return;
	}
	var url="/show-regions-search.php";
	url=url+"?country_id="+str;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=showRegionsshowRegionsSearchStateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 

function showRegionsshowRegionsSearchStateChanged() {
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
		document.getElementById("regionrow").innerHTML=xmlHttp.responseText;
	}
}


function GetXmlHttpObject() { 
	var objXMLHttp=null;
	if (window.XMLHttpRequest) {
		objXMLHttp=new XMLHttpRequest();
	}
	else if (window.ActiveXObject) {
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	return objXMLHttp;
} 
