<!--//
var strNullValue = "";
var arrDropDowns = new Array();
if (strNullText == "" || strNullText == null){
	var strNullText = "Choose by Title";
}

function fctDefineDropDown(strForm){
	this.formRef = "this.document." + strForm;
	this.options = new Array();
	this.children = new Array();
}

function fctDropDownOptions(varValue, strText, strParentID, bolSelected){
	this.text =  strText;
	this.value =  varValue;
	this.parentID = strParentID;
	this.selected = bolSelected;
}

function fctAddDropDown(strDropDown, strForm){
	if (arrDropDowns[strDropDown]){
		return;
	}
	eval(strDropDown + "_OptionCount = 0");
	eval(strDropDown + "_ChildCount = 0");
	arrDropDowns[strDropDown] = new fctDefineDropDown(strForm);
}

function fctAddDropDownOptions(strDropDown, varOptionID, strOptionText, varParentID, strSelected){
	if (!arrDropDowns[strDropDown]){
		return;
	}
	var intOptionCount = eval(strDropDown + "_OptionCount");
	arrDropDowns[strDropDown].options[intOptionCount] = new fctDropDownOptions(varOptionID, strOptionText, varParentID, strSelected);
	eval(strDropDown + "_OptionCount = " + (intOptionCount + 1));
}

function fctAddChild(strParentDropDown, strChildDropDown){
	if (!arrDropDowns[strParentDropDown] || !arrDropDowns[strChildDropDown] ){
		return;
	}
	var intChildCount = eval(strParentDropDown + "_ChildCount");
	arrDropDowns[strParentDropDown].children[intChildCount] = strChildDropDown;
	eval(strParentDropDown + "_ChildCount = " + (intChildCount + 1));
}

function fctActivateDropDown(strDropDown){
	if (!arrDropDowns[strDropDown]){
		return;
	}else if (!eval(arrDropDowns[strDropDown].formRef + "." + strDropDown)){
		return;
	}
	varParentID = 0;
	fctChangeDropDown(strDropDown, varParentID);
	fctPopulateChildDropDowns(strDropDown);
}

function fctChangeDropDown(strDropDown, varParentID){
	if (!arrDropDowns[strDropDown]){
		return;
	}else if (!eval(arrDropDowns[strDropDown].formRef + "." + strDropDown)){
		return;
	}
	var intSelected = 0;
	eval(arrDropDowns[strDropDown].formRef + "." + strDropDown + ".options.length=0");
	var bolFound = false;
	for (var intFindCount = 0; intFindCount < arrDropDowns[strDropDown].options.length; intFindCount++){
		if (arrDropDowns[strDropDown].options[intFindCount].parentID == varParentID){
			bolFound = true;
			break;
		}
	}
	if (bolFound == true){	
		var intOptionAddCount = 0;
		for (intOptionCount = intFindCount; intOptionCount < arrDropDowns[strDropDown].options.length; intOptionCount++){
			if (arrDropDowns[strDropDown].options[intOptionCount].parentID == varParentID){
				eval(arrDropDowns[strDropDown].formRef + "." + strDropDown + ".options[intOptionAddCount] = new Option (arrDropDowns[strDropDown].options[intOptionCount].text, arrDropDowns[strDropDown].options[intOptionCount].value, false, false)");// new Option (text, value, defaultSelected, selected)
				if (arrDropDowns[strDropDown].options[intOptionCount].selected){
					intSelected = intOptionAddCount;
				}
				intOptionAddCount = intOptionAddCount + 1;
			}
		}
	}else{
		eval(arrDropDowns[strDropDown].formRef + "." + strDropDown + ".options[0] = new Option ('" + strNullText + "', '" + strNullValue + "', false, false)");
	}
	eval(arrDropDowns[strDropDown].formRef + "." + strDropDown + ".selectedIndex = " + intSelected);
}

function fctPopulateChildDropDowns(strDropDown){
	if (!arrDropDowns[strDropDown]){
		return;
	}else if (!eval(arrDropDowns[strDropDown].formRef + "." + strDropDown)){
		return;
	}else if (!arrDropDowns[strDropDown].children[0]){
		return;
	}
	var varParentID = eval(arrDropDowns[strDropDown].formRef + "." + strDropDown + ".options[" + arrDropDowns[strDropDown].formRef + "." + strDropDown + ".selectedIndex" + "].value");
	for (var intChildCount = 0; intChildCount < arrDropDowns[strDropDown].children.length; intChildCount++){
		fctChangeDropDown(arrDropDowns[strDropDown].children[intChildCount], varParentID);
		fctPopulateChildDropDowns(arrDropDowns[strDropDown].children[intChildCount]);
	}
}


function fctDefaultSelected(strDropDown, intOptionID, bolParentSelect){
	if (!arrDropDowns[strDropDown]){
		return;
	}else if (!arrDropDowns[strDropDown].options[0]){
		return;
	}
	var varParentID = 0;
	var bolFound = false;
	for (var intOptionCount = 0; intOptionCount < arrDropDowns[strDropDown].options.length; intOptionCount++){
		if (arrDropDowns[strDropDown].options[intOptionCount].value == intOptionID){
			varParentID = arrDropDowns[strDropDown].options[intOptionCount].parentID
			arrDropDowns[strDropDown].options[intOptionCount].selected = true;
			bolFound = true;
			break;
		}
	}
	if (bolFound == true){
		for (var intOptionCount = 0; intOptionCount < arrDropDowns[strDropDown].options.length; intOptionCount++){
			if (arrDropDowns[strDropDown].options[intOptionCount].parentID == varParentID && arrDropDowns[strDropDown].options[intOptionCount].value != intOptionID){
				arrDropDowns[strDropDown].options[intOptionCount].selected = false;
			}
		}
		if (bolParentSelect && varParentID != 0){
			for (var i in arrDropDowns){
				for (var intOptionCount = 0; intOptionCount < arrDropDowns[i].children.length; intOptionCount++){
					if (arrDropDowns[i].children[intOptionCount] == strDropDown){
						fctDefaultSelected(i, varParentID, true);
						break;
					}
				}
			}
		}
	}
}
//-->
