/** jQuery helper methods for DropDownLists **/
function ClearOptions(element) {
    if ($(element).attr("tagName").toLowerCase() == 'select') {
        $(element).children().remove();
    }
}

function AddToOptionList(element, OptionValue, OptionText) {
    if ($(element).attr("tagName").toLowerCase() == 'select') {
        $(element).append($(document.createElement("option")).attr("value", OptionValue).text(OptionText));
    }
}

function SetSelectedValue(element, SelectValue) {
    if ($(element).attr("tagName").toLowerCase() == 'select') {
        var options = $(element).attr('options');
        for (x = 0; x < options.length; x++) {
            if (options[x].value == SelectValue) {
                options.selectedIndex = -1;
                options.selectedIndex = x;
                break;
            }
        }
    }
}