var xmlHttp;
var selectedbox;

function getxmlhttp()
{
	try
	{   
		// Firefox, Opera 8.0+, Safari   
		xmlHttp=new XMLHttpRequest();    
	}
	catch (e)
	{    
	 	// Internet Explorer   
		try
	        {      
	      		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
	      	}
	    	catch (e)
	      	{      
	      		try
	        	{        
	        		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");       
	        	}
	     		catch (e)
		        {        
			        alert("Your browser does not support AJAX!");
	        		return false;
	        	}
	      	}
	}
    	return xmlHttp;
}
	
function ajaxFunction(featureval)
{  
  	empty_rest('tint_colour');
  	xmlHttp=getxmlhttp();
    	var url1="ajax.php";
	url1=url1+"?feature="+featureval;
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url1,true);
	xmlHttp.send(null);
}
  
function stateChanged()
{
	obj=document.getElementById("tint_colour");
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		var len;
		len=obj.length;
		
		while(len>0)
		{
			len=len-1;
			obj.options[len]=null; 		
		} 
		//len=obj.length;  
		var str=xmlHttp.responseText.split("|");
		//obj.subgroup[len]=null;
		obj.options[0]=new Option( "Please Select",'0');
		for(i=0;i < (str.length-1);i++)
		{
			//len=obj.length;
			str1=str[i].split("#");
			obj.options[i+1]=new Option( str1[1],str1[0]);
		}	
		
	}
}
  
function empty_rest(id)
{
  		obj=document.getElementById("tint_colour");
  		var len;
		len=obj.length;
		
		while(len>0)
		{
			len=len-1;
			obj.options[len]=null; 		
		} 

}