var xmlHttpRes
var xmlHttpCom

function GetProperties(city)
{
	//alert(city)
	if (city > 0)
	{
		var url1 = "get_properties.asp?city="+city+"&type=1"
		xmlHttpRes = GetXmlHttpObject(GetRes)
		xmlHttpRes.open("GET",url1,true)
		xmlHttpRes.send(null)

		var url2 = "get_properties.asp?city="+city+"&type=2"
		xmlHttpCom = GetXmlHttpObject(GetCom)
		xmlHttpCom.open("GET",url2,true)
		xmlHttpCom.send(null)
	}
}

function GetRes()
{
	if(xmlHttpRes.readyState == 4 || xmlHttpRes.readyState == "complete")
	{
		//alert(xmlHttpRes.responseText)
		document.getElementById("td_res").innerHTML = xmlHttpRes.responseText
	}
}

function GetCom()
{
	if(xmlHttpCom.readyState == 4 || xmlHttpCom.readyState == "complete")
	{
		//alert(xmlHttpCom.responseText)
		document.getElementById("td_com").innerHTML = xmlHttpCom.responseText
	}
}

function GetXmlHttpObject(handler)
{ 
	var objXmlHttp=null

	if (navigator.userAgent.indexOf("Opera")>=0)
	{
		alert("This doesn't work in Opera") 
		return; 
	}
	if (navigator.userAgent.indexOf("MSIE")>=0)
	{ 
		var strName="Msxml2.XMLHTTP"
		if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
		{
			strName="Microsoft.XMLHTTP"
		} 
		try
		{ 
			objXmlHttp=new ActiveXObject(strName)
			objXmlHttp.onreadystatechange=handler 
			return objXmlHttp
		} 
		catch(e)
		{ 
			alert("Error. Scripting for ActiveX might be disabled") 
			return 
		} 
	} 
	if (navigator.userAgent.indexOf("Mozilla")>=0)
	{
		objXmlHttp=new XMLHttpRequest()
		objXmlHttp.onload=handler
		objXmlHttp.onerror=handler 
		return objXmlHttp
	}
} 
