function onChangeCountry(country_id, target)
{
	if(country_id == 'SELECT')
	{
		$(target).update("");
		return;
	}

	//$(target).update("<option>Loading...</option>");	
	var opt = document.createElement('option');
	$(target).options.add(opt);
  opt.text = 'Loading...';
 	opt.value = '';
	
	new Ajax.Request('get_language.php', 
	{
	  method: 'get',
	  asynchronous: true,
	  parameters:'id=' + country_id,
	  onException: function(transport) 
  		{
			$(target).update('<option>Error while loading</option>');
		}
		,
	  onFailure: function(transport) 
  		{
			$(target).update('<option>Error while loading</option>');
		}
		,
	  onSuccess: function(transport) 
  		{
			var response = transport.responseText;
			
			if(response != "")
		  {
		    	objs = response.evalJSON();
		    	
		    	$(target).update("");

		    	for(i=0; i<objs.length; i++)
		    	{
		    			var opt = document.createElement('option');
      			  $(target).options.add(opt);
			        opt.text = objs[i].value;
        			opt.value = objs[i].key;
		    	}
		  }
		}
	});
}

