function getHTTPObject()
{
	// code for Mozilla, etc.
	if (window.XMLHttpRequest)
  	{
  		xmlhttp=new XMLHttpRequest()
  	}
// code for IE
	else if (window.ActiveXObject)
  	{
  		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
  	}
	return xmlhttp;
}

var ajax = getHTTPObject();



function getDistrict(stateId)
{
	if(stateId == 0)
	{	
			//alert(stateId);
			document.getElementById('district').style.display='none';
			document.getElementById('oldDistrict').style.display='';	//block is not working all browser	
	}
	else
	{
		ajax.open("GET","myDistrict.php?state="+stateId,true); 
		ajax.send(null);	
		ajax.onreadystatechange=function()
		{
			if(ajax.readyState==4)
			  {
	  			document.getElementById('district').style.display='';
				document.getElementById('district').innerHTML =  ajax.responseText;	  
				document.getElementById('oldDistrict').style.display='none';
			  }
		}
	}
}

function getMultipleDistrict(stateId)
{
		var str
		str = '';
		
		 for(i=0;i<=document.getElementById('stateCombo').options.length-1;i++)
		 	{
				if(document.getElementById('stateCombo').options[i].selected==true)
					{
						
						str = str + document.getElementById('stateCombo').options[i].value + ","
					}
			}
			
		
		
		
		ajax.open("GET","myMultipleDistrict.php?state="+str,true); 
		ajax.send(null);	
		ajax.onreadystatechange=function()
		{
			
			if(ajax.readyState==4)
			  {
	  			document.getElementById('district').style.display='';
				document.getElementById('district').innerHTML =  ajax.responseText;	  
				document.getElementById('oldDistrict').style.display='none';
			  }
		}
}

function getTaluka(districtId)
{
		if(districtId == 0)
		{	
				
				document.getElementById('taluka').style.display='none';
				document.getElementById('oldTaluka').style.display='';	//block is not working all browser	
		}
		else
		{
		
			ajax.open("GET","myTaluka.php?district="+districtId,true); 
			ajax.send(null);	
			ajax.onreadystatechange=function()
			{
				if(ajax.readyState==4)
				  {
					document.getElementById('taluka').style.display='';  
					document.getElementById('taluka').innerHTML =  ajax.responseText;	  
					document.getElementById('oldTaluka').style.display='none';
				  }
			}
		}
}

function associationDetails(talukaId)
{
		if(talukaId == 0)
		{	
				
				document.getElementById('associationName').style.display='none';
				
		}
		else
		{
			ajax.open("GET","myAssociationDetails.php?taluka="+talukaId,true);
			ajax.send(null);
			ajax.onreadystatechange=function()
			{
				if(ajax.readyState==4)
				  {
					document.getElementById('associationName').style.display='';  
					document.getElementById('associationName').innerHTML =  ajax.responseText;	
				  }
			}
		}
}
