﻿function SetLoadingMessage(sourceId, targetId) {
    var targetList = document.getElementById(targetId);
    var sourceList = document.getElementById(sourceId);
    if (sourceList != null && targetList != null) {
        if (sourceList.selectedIndex > 0) {
            if (targetList.options.length > 0) {
                targetList.options[targetList.selectedIndex].text = "Loading...";
            } else {
                var option = document.createElement("option");
                option.text = "Loading...";
                option.value = "";
                targetList.options.add(option);
            }
        } else {
            targetList.options.length = 0;
        }
    }
}

function PerformRedirect(dropDownId) {
    var dropDownList = document.getElementById(dropDownId);
    if (dropDownList != null) {
        if (dropDownList.options.selectedIndex > 0) {
            var selectedValue = dropDownList.options[dropDownList.selectedIndex].value;
            if (selectedValue != "") {
                window.location = selectedValue;
            }
        }
    }
    return true;
}
