chained or dependent auto complete

chained or dependent auto complete

$(document).ready(function () {
     var availableTags = [
"India",
"United States",
"Qatar"
]
$( "#tags" ).autocomplete({
    source: availableTags,
    select: function( event, ui ) {
        $( "#version" ).val('');
        //alert(ui.item.value);
        var selected_val = ui.item.value;        
        if(selected_val == "India")
        {
 var states: [
"Tamil Nadu",
"Karnataka",
"Kerala"
];

}
        else if(selected_val == "United States")
        {
            $( "#version" ).autocomplete({
                source: ['Texas' ,'California']
            });
        } 
        else if(selected_val == "Qatar")
        {
            $( "#version" ).autocomplete({
                source: ['Doha' ,'Doha Corniche']
            });
        } 
    }    
});

this is the sample autocomplete for two forms but looking for further development with four field. i want it to be with Purely jQuery. no ajax no php. i want it extend it further for Four Feild this works fine for two Feild.