function prototype_region_list(country_id,current_region_id,region_options) { 	
    select_list = document.getElementById("region");
    select_list.options.length = null;
    
    select_list.disabled = true; 

    if(document.getElementById('region_check')) document.getElementById('region_check').value = 1;                                  
                                        
    new Ajax.Request('includes/prototype/prototype_region_list.php?country_id='+country_id,{method: 'get',onSuccess: function(transport) {prototype_region_list_update(transport.responseText,current_region_id,region_options)}});        
}

function prototype_region_list_update(response,current_region_id,region_options) {
    var current_region_id_found;
       
    response = response.split("\n");

    select_list = document.getElementById("region");
    select_list.options.length = null;
                                            
    if(response[0]) {
        select_list.disabled = false;
        	
        select_option = new Option("","",true,true); 
        select_list.options[select_list.options.length] = select_option; 		      		  	  
	  	  
        for(i=0;i<response.length;i++) {
            region = response[i].split("|");
	  	  	  
            select_option = new Option(region[1],region[0],true,true); 
            select_list.options[select_list.options.length] = select_option; 
            
            if(current_region_id == region[0]) current_region_id_found = select_list.options.length-1;
        }	  	  
    		
        if(current_region_id_found > 0) select_list.selectedIndex = current_region_id_found;
        else                            select_list.selectedIndex = 0;

        if(document.getElementById('region_check')) document.getElementById('region_check').value = 1;
    }
    else {
        select_list.disabled = true;	

        message = "Not Available";    

        select_option = new Option(message,"",true,true); 
        select_list.options[select_list.options.length] = select_option; 		  	    	        

        if(document.getElementById('region_check')) document.getElementById('region_check').value = 0;
    }	 
}
