var ChristianSubCasts =  new Array(
						"('Born again')",
						"('Bretheren')",
						"('CSI')",
						"('Cannonite')",
						"('Going born again')",
						"('Jacobite')",
						"('Latin catholic')",
						"('Malankara catholic')",
						"('Syrian catholic')",
						"('Marthoma')",
						"('Orthodox')",
						"('Pentecost')",
						"('Protestant')",
						"('Salvation army')",
						"('Other Christian')"
					);
var ChristianSubCastsValues =  new Array(
						"('1')",
						"('2')",
						"('3')",
						"('4')",
						"('5')",
						"('6')",
						"('7')",
						"('8')",
						"('9')",
						"('10')",
						"('11')",
						"('12')",
						"('13')",
						"('14')",
						"('99')"
					);
					
var MuslimSubCasts =  new Array(
						"('Shiya')",
						"('Sunni')",
						"('Other Muslim')"
					);
var MuslimSubCastsValues =  new Array(
						"('201')",
						"('202')",
						"('299')"
					);

var HinduSubCasts =  new Array(
						"('Brahmin')",
						"('Dheevara')",
						"('Ezhava')",
						"('Ezhuthachan')",
						"('Marar')",
						"('Menon')",
						"('Nadar')",
						"('Nair')",
						"('Nambiar')",
						"('Nampoothiri')",
						"('Panickar')",
						"('Pillai')",
						"('Pisharody')",
						"('Saiva vellala')",
						"('Thandan')",
						"('Thiyya')",
						"('Varier')",
						"('Velar')",
						"('Vellala pillai')",
						"('Viswakarma')",
						"('Other Hindu')"
					);
var HinduSubCastsValues =  new Array(
						"('101')",
						"('102')",
						"('103')",
						"('104')",
						"('105')",
						"('106')",
						"('107')",
						"('108')",
						"('109')",
						"('110')",
						"('111')",
						"('112')",
						"('113')",
						"('114')",
						"('115')",
						"('116')",
						"('117')",
						"('118')",
						"('119')",
						"('120')",
						"('199')"
					);
					
var OtherSubCasts =  new Array(
						"('All Others')"
					);
var OtherSubCastsValues =  new Array(
						"('399')"
					);


function PopulateList(myForm)
{
	RemoveItems(myForm);

	var len = myForm.cboReligion.options.length;
	for (var i=0; i<len; i++)
	{
		if ( myForm.cboReligion.options[i].selected == true )
		{
			populate(myForm, myForm.cboReligion.options[i].text);
		}
	}
}

function RemoveItems(myForm)
{
	if (myForm.cboCaste.options == null || myForm.cboCaste.options.length == 0)
	{
		return;
	}
		
	while (myForm.cboCaste.options.length > 0)
	{
		myForm.cboCaste.options[(myForm.cboCaste.options.length - 1)] = null;
	}
}

function populate(myForm, selected)
{
	var selectedArray = eval(selected + "SubCasts");
	var selectedValArray = eval(selected + "SubCastsValues");
	
	var CurLen = myForm.cboCaste.options.length

	for (var i=CurLen, x=0; i < (selectedArray.length+CurLen); i++, x++)
	{
		eval("myForm.cboCaste.options[i]=" + "new Option(" + selectedArray[x] + ", " + selectedValArray[x] + ")");
	}

	/*
	if (myForm.cboReligion.options[0].value == '')
	{
		myForm.cboReligion.options[0]= null;
		if ( navigator.appName == 'Netscape')
		{
			if (parseInt(navigator.appVersion) < 4)
			{
				window.history.go(0);
			}
			else
			{
				if (navigator.platform == 'Win32' || navigator.platform == 'Win16') 
				{
					window.history.go(0);
				}
			}
		}
	}
	*/
} 

function AddDefaultOption(myForm, selected)
{
	eval("myForm.cboCaste.options[0]=" + "new Option('All', '')");
}