var xmlHttp;

function commonFunc(url,divId,ID)
{
	xmlHttp = GetXmlHttpObject();
	
	if(xmlHttp == null)
	{
		alert("Browser does not support HTTP REQUEST");
		return;
	}
	xmlHttp.onreadystatechange = function()
	{
		if(xmlHttp.readyState == 4 || xmlHttp.readyState =='complete')
		{
			stateChanged(divId);
		}
	}
	
	if(ID)
	{
		url = url + ID;
	}
	//alert(url);
	
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	
}

function stateChanged(divId)
{
	//alert(divId);
	document.getElementById(divId).innerHTML = xmlHttp.responseText;
	if(divId == "state1")
	{
		document.getElementById('city').innerHTML = "<select name= 'cityID' style='font-size:10px;width:250px'><option value=''>SELECT</option></select>";
	}
}


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;		
}
