
function EmptySelect(objSelect) {
    while (objSelect.options.length > 0)
        objSelect.options[0] = null;
    // When an option is deleted the option array is 
    // recreated. Hence deleting the first item each time 
    // at least one exists will ensure that all are deleted.
}

function nextDropDown(firstObj, secondObj, strArray, intIndex) {
    var intLoop = 0;
    var strTemp = "";
    var intCheckIndex = 0;
    intCheckIndex = 0;
    InsertOption(secondObj, 0, "Any");
    {
        for (intLoop = 0; intLoop < strArray.length; intLoop++) {
            if (intIndex == 0) {
                InsertOption(secondObj, strArray[intLoop][2], strArray[intLoop][1]);
            }
            else {
                if (strArray[intLoop][intCheckIndex] == intIndex) {

                    InsertOption(secondObj, strArray[intLoop][2], strArray[intLoop][1]);
                }
            }
        }
    }
    secondObj.selectedIndex = 0;
}

function InsertOption(objSelect, varValue, varText) {
    var objOption = new Option(varText, varValue);
    objSelect.options[objSelect.options.length] = objOption;
}

function starterDropDown(firstSelect, secondSelectID, strArray) {
    var selectedID = firstSelect[firstSelect.selectedIndex].value;

    var secondObj = document.getElementById(secondSelectID);

    EmptySelect(secondObj)
    nextDropDown(firstSelect, secondObj, strArray, selectedID);
}
