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

///////////////////////////////////////////////////////////////////////////////////////// general ajx function

function findState(mmenu_id1,cdiv)
{
	xmlHttp=GetXmlHttpObject();			
	if (xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	}			
	//document.getElementById('loading123').style.display = "inline";
	var url="getstate.php?cid="+mmenu_id1;
	xmlHttp.open('GET',url,true);
	xmlHttp.onreadystatechange=function(){ onstateChanged_state(cdiv); }
	xmlHttp.send(null);
}		
function onstateChanged_state(ctrlname) 
{
	if(xmlHttp.readyState==4)
	{ 
		
		var rslt = xmlHttp.responseText;				 
		//document.getElementById('loading123').style.display = "none";
		document.getElementById(ctrlname).innerHTML = rslt;	
		//document.getElementById(ctrlname).style.display = 'inline';
		
	}		
}
function findCity(mmenu_id1,cdiv)
{
	xmlHttp=GetXmlHttpObject();			
	if (xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	}			
	//document.getElementById('loading123').style.display = "inline";
	var url="getcity.php?cid="+mmenu_id1;	
	xmlHttp.open('GET',url,true);
	xmlHttp.onreadystatechange=function(){ onstateChanged_city(cdiv); }
	xmlHttp.send(null);
}		
function onstateChanged_city(ctrlname) 
{
	if(xmlHttp.readyState==4)
	{ 
		
		var rslt = xmlHttp.responseText;				 
		//document.getElementById('loading123').style.display = "none";
		document.getElementById(ctrlname).innerHTML = rslt;	
		//document.getElementById(ctrlname).style.display = 'inline';
		
	}		
}
function findSubcat(mmenu_id1,cdiv)
{
	xmlHttp=GetXmlHttpObject();			
	if (xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	}			
	//document.getElementById('loading123').style.display = "inline";
	var url="getsubcategory.php?cid="+mmenu_id1+"&nm="+cdiv;
	xmlHttp.open('GET',url,true);
	xmlHttp.onreadystatechange=function(){ onstateChanged_subcat(cdiv); }
	xmlHttp.send(null);
}		
function onstateChanged_subcat(ctrlname) 
{
	if(xmlHttp.readyState==4)
	{ 
		
		var rslt = xmlHttp.responseText;				 
		//document.getElementById('loading123').style.display = "none";
		document.getElementById(ctrlname).innerHTML = rslt;	
		//document.getElementById(ctrlname).style.display = 'inline';
		
	}		
}
function findimge(mmenu_id1,cdiv)
{
	xmlHttp=GetXmlHttpObject();			
	if (xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	}			
	document.getElementById('loading').style.display = "inline";
	var url="micaimg.php?"+mmenu_id1;
	xmlHttp.open('GET',url,true);
	xmlHttp.onreadystatechange=function(){ onstateChanged_img(cdiv); }
	xmlHttp.send(null);
}		
function onstateChanged_img(ctrlname) 
{
	if(xmlHttp.readyState==4)
	{ 
		
		var rslt = xmlHttp.responseText;				 
		document.getElementById('loading').style.display = "none";
		document.getElementById(ctrlname).innerHTML = rslt;	
		//document.getElementById(ctrlname).style.display = 'inline';
		
	}		
}
