	function postRequest(strURL)
	{
		var xmlHttp;
		if(window.XMLHttpRequest)
		{ // For Mozilla, Safari, ...
			var xmlHttp = new XMLHttpRequest();
		}
		else if(window.ActiveXObject)
		{ // For Internet Explorer
			var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		xmlHttp.open('POST', strURL, true);
		xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlHttp.onreadystatechange = function()
		{
			if (xmlHttp.readyState == 4)
			{
				//document.getElementById("txtPostResult").innerHTML
				result = xmlHttp.responseText;
				document.getElementById("txtPostResult").innerHTML="<span style=\"color: #DE3700;\">&nbsp;"+result+"</span>";
				//updatepage(xmlHttp.responseText);
			}
		}
		xmlHttp.send(strURL);
	}
	
	
	function GetXmlHttpObject()
	{
		var xmlHttp=null;
		try
		{
			// Firefox, Opera 8.0+, Safari
			xmlHttp=new XMLHttpRequest();
		}
		catch (e)
		{
		//Internet Explorer
			try
			{
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch (e)
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
		}
		return xmlHttp;
	}	

	function PostModelRequest(strURL)
	{
		var xmlHttp;
		if(window.XMLHttpRequest)
		{ // For Mozilla, Safari, ...
			var xmlHttp = new XMLHttpRequest();
		}
		else if(window.ActiveXObject)
		{ // For Internet Explorer
			var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		xmlHttp.open('POST', strURL, true);
		xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlHttp.onreadystatechange = function()
		{
			if (xmlHttp.readyState == 4)
			{
				document.getElementById("GetModels").innerHTML=xmlHttp.responseText;
				GetAllModels();
			}
		}
		xmlHttp.send(strURL);
	}
	
	
	/* Post Request */
	function PostAnyRequest(strURL, ElemId)
	{
		var xmlHttp;
		if(window.XMLHttpRequest){ // For Mozilla, Safari, ...
			var xmlHttp = new XMLHttpRequest();
		}
		else if(window.ActiveXObject){ // For Internet Explorer
			var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		xmlHttp.open('POST', strURL, true);
		xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlHttp.onreadystatechange = function(){
			if (xmlHttp.readyState == 4){
				document.getElementById(ElemId).innerHTML=xmlHttp.responseText;
			}
		}
		xmlHttp.send(strURL);
	}
/* End of post any request */
	


function getHTTPObject() {
	var xmlhttp;
	/*@cc_on
	@if (@_jscript_version >= 5)
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	} catch (E) {
		xmlhttp = false;
	}
	}
	@else
	xmlhttp = false;
	@end @*/
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
		xmlhttp.overrideMimeType("text/xml"); 
	}catch(e){
		xmlhttp = false;
	}
	}
	return xmlhttp;
}

var tableBusy = false;
var tableHttp = getHTTPObject();
var step1Over = false;
var row = "";

function DisplayPropertyType(objCId)
{
	if (!tableBusy)
	{
		document.frmSearch.cSecondType.options.length = 0;
		document.frmSearch.cSecondType.options[0] = new Option("Loading...","");
		var url = "display-second-type.php?id=" + objCId;
		//alert(objCId);
		tableHttp.open("GET", url, true);
		tableHttp.onreadystatechange = CheckResponse;
		tableHttp.send(null);
		tableBusy = true;
		tableHttp.send(null);
	}
}
//cCountryName, cState
function CheckResponse()
{
	if (tableHttp.readyState == 4)
	{
		if (tableHttp.responseText.indexOf('invalid') == -1)
		{
			try
			{
				var xmlRecord = tableHttp.responseXML.getElementsByTagName('Subcategories');
				
				var output = xmlRecord[0].getElementsByTagName('subcatname').item(0).firstChild.data;

				if (output == "N State|")
				{
					document.frmSearch.cState.options.length = 0;
				}
				else
				{
					var cSecondType = document.frmSearch.cSecondType;
					cSecondType.options.length = 0;
					var outputArr = new Array();
					outputArr = output.split(":");
					var list = outputArr;
					for(i=0;i<list.length;i=i+1)
					{
						var stateString = list[i];
						var stateArr = new Array();
						stateArr = stateString.split("|");
						cSecondType.options[i] = new Option(stateArr[1],stateArr[0]);
					}
				}
				tableBusy = false;
			}
			catch(e)
			{
				alert("Error: " + e) ;
			}
		}
	}
}