LoadArrays();

var intArrayMax = 28;  // UPDATE THIS VARIABLE WHEN ADDING OPTIONS
function LoadArrays()
{
Array[0] = new sElement('Office Region','Americas','Americas');
Array[1] = new sElement('Office Region','Asia Pacific','Asia Pacific');
Array[2] = new sElement('Office Region','Europe & Middle East','Europe & Middle East');

Array[3] = new sElement('Position','Associate','Associate');
Array[4] = new sElement('Position','Consultant','Consultant');
Array[5] = new sElement('Position','Project Leader','Project Leader');
Array[6] = new sElement('Position','Principal','Principal');
Array[7] = new sElement('Position','Partner','Partner');
Array[8] = new sElement('Position','Senior Advisor','Senior Advisor');

Array[9] = new sElement('Background','Academic','Academic');
Array[10] = new sElement('Background','Arts','Arts');
Array[11] = new sElement('Background','Business Administration','Business Administration');
Array[12] = new sElement('Background','Consulting','Consulting');
Array[13] = new sElement('Background','Consumer Goods & Retail','Consumer Goods & Retail');
Array[14] = new sElement('Background','Economics','Economics');
Array[15] = new sElement('Background','Energy','Energy');
Array[16] = new sElement('Background','Engineering','Engineering');
Array[17] = new sElement('Background','Financial Services','Financial Services');
Array[18] = new sElement('Background','Goverment','Government');
Array[19] = new sElement('Background','Health Care','Health Care');
Array[20] = new sElement('Background','Industrial Goods','Industrial Goods');
Array[21] = new sElement('Background','International Relations','International Relations');
Array[22] = new sElement('Background','Law','Law');
Array[23] = new sElement('Background','Mathematics','Mathematics');
Array[24] = new sElement('Background','Media & Entertainment','Media & Entertainment');
Array[25] = new sElement('Background','Non-profit','Non-profit');
Array[26] = new sElement('Background','Science','Science');
Array[27] = new sElement('Background','Social Science','Social Science');
Array[28] = new sElement('Background','Technology','Technology');

return true;
}

function sElement(strParentId,strValue,strDescription)
{	
	this.ParentId = strParentId;
	this.Id = strValue;
	this.Description = strDescription;
}

function bCascadeDrop(objDDsource,objDDdest)
{
	//function to enable cascading dropdowns
	//called as the parent dropdown changes.
	var i;
	var strText;
	var j = 0;
	var strOptionId;
	var strOptionDesc;
	var intStartPos;
		
	//find the value of the item currently selected		
	strText = objDDsource.options[objDDsource.selectedIndex].value;
	if (strText != '0')
	{
		//clear down the destination list box
		objDDdest.options.length = 0;                
		
		//loop through the elements that are in the array
		// if they match the parent if then they should be displayed.
		for (i=0; i<=intArrayMax; i++) 
		{		
			if (strText == Array[i].ParentId)
			{
				//grab the values out of the element 
				strOptionId = Array[i].Id;
				strOptionDesc= Array[i].Description;
				//alert(sOptionDesc)
				
				//write the element into the dripdown box.		
				objDDdest.options[j] = new Option (strOptionDesc,strOptionId);
				j = j + 1;		
			}	
		}	
	}	
}

