// JavaScript Document

function Load_Cities()
{
	//alert(document.change_CASTE.cat.value);
	var str,arr,j,count;
	var cat = new Array();
	str=document.MatriForm.cities.value;
	//alert(str);
	arr=str.split('#');
	//alert(arr.length);
		j=0;
	for(var i=1;i<arr.length-1;i++)
	{
//		alert(arr[i]);
		cat[j]=arr[i].split('|');
		j++;
	}
	for(i=0;i<cat.length;i++)
	{
	var c = 0;
	document.MatriForm.CASTE.options.length = 0;
			if(document.MatriForm.RELIGION.value==cat[i][0])
			{
				count=0;
				for(j=1;j<cat[i].length-1;j++)
				{
					if(j==1)
					{
						document.MatriForm.CASTE.options[c++] = new Option("Select Caste",'',true);
						document.MatriForm.CASTE.options[c++] = new Option("Any",'Any',true);
						document.MatriForm.CASTE.options[c++] = new Option(cat[i][j],cat[i][j]);
					}
					else
						document.MatriForm.CASTE.options[c++] = new Option(cat[i][j],cat[i][j]);

					count++;
				}
				if(count>0)
				{
//				document.MatriForm.CASTE.options[c++]=new Option("Others","Others");
				break;	
				}
				else
				{
					document.MatriForm.CASTE.options[c++] = new Option("Dont Wish to Specify",'All',true);
					//document.MatriForm.submit();
					break;
				}
			}
			
	}

	
}


function Load_location()
{
//	alert(document.change_CASTE.cat.value);
	var str,arr,j,count;
	var cat = new Array();
	str=document.MatriForm.locations.value;
	//alert(str);
	arr=str.split('#');
	//alert(arr.length);
		j=0;
	for(var i=1;i<arr.length-1;i++)
	{
//		alert(arr[i]);
		cat[j]=arr[i].split('|');
		j++;
	}
	for(i=0;i<cat.length;i++)
	{
	var c = 0;
	document.MatriForm.CITY.options.length = 0;
			if(document.MatriForm.COUNTRY.value==cat[i][0])
			{
				count=0;
				for(j=1;j<cat[i].length-1;j++)
				{
					if(j==1)
					{
						document.MatriForm.CITY.options[c++] = new Option("Select City",'',true);
						document.MatriForm.CITY.options[c++] = new Option(cat[i][j],cat[i][j]);
					}
					else
						document.MatriForm.CITY.options[c++] = new Option(cat[i][j],cat[i][j]);

					count++;
				}
				if(count>0)
				{
//				document.MatriForm.CASTE.options[c++]=new Option("Others","Others");
				break;	
				}
				else
				{
					document.MatriForm.CITY.options[c++] = new Option("Dont Wish to Specify",'All',true);
					//document.MatriForm.submit();
					break;
				}
			}
			
	}

	
}
