// JavaScript Documentvar castes = new Array();
states['Hindu'] = new Array('Caste no Bar','Agarwal','Baidya','Baishnab','Baishya','Banik','Barujibi','Brahmin','Brahmin - Barendra','Brahmin - Kulin','Brahmin - Rarhi','Brahmin - Rudraj','Goala','Karmakar','Kayastha','Modak','Mahisya','Namasudra','Napit','Rajput','Sadgope','Saha','SC','Tamboli','Tantubai','Tili','ST','Vishwakarma','Kurmi','Other');
states['Muslim'] = new Array('Caste no Bar','Sunni','Shia','Ansari','Arain','Awan','Bohra','Dekkani','Dudekula','Hanafi','Jat','Khoja','Lebbai','Maliki','Mapila','Maraicar','Memon','Mughal','Pathan','Qureshi','Rajput','Rowther','Saifi','Sheikh','Syed','Unspecified','Other');
states['Christian'] = new Array('Caste no Bar','Born Again','Bretheren','Church of South India','Evangelist','Jacobite','Knanaya','Knanaya Catholic','Latin Catholic','Malankara','Protestant','Roman Catholic','Other');
states['Buddhist'] = new Array('Caste no Bar','Mahayana','Hinayana','Other');
states['Jain'] = new Array('Caste no Bar','Shetambara','Digambara','Other');

function setCastes() {
 cntrySel = document.getElementById('religion');
 stateList = states[cntrySel.value];
 changeSelect('caste', stateList, stateList);
}


function changeSelect(fieldID, newOptions, newValues) {
 selectField = document.getElementById(fieldID);
 selectField.options.length = 0;
 for (i=0; i<newOptions.length; i++) {
   selectField.options[selectField.length] = new Option(newOptions[i], newValues[i]);
 }
}

function addLoadEvent(func) {
 var oldonload = window.onload;
 if (typeof window.onload != 'function') {
   window.onload = func;
 } else {
   window.onload = function() {
     if (oldonload) {
       oldonload();
     }
     func();
   }
 }
}

addLoadEvent(function() {
 setCastes();
});

