﻿$.fn.fillSelect = function(r) {
    return this.clearSelect().each(function() {
        var dropdownList = this;
        $.each(r, function(index, optionData) {
            var option = new Option(optionData.Text, optionData.Value);
            if ($.browser.msie) {
                dropdownList.add(option);
            }
            else {
                dropdownList.add(option, null);
            }
        });
    });
}

$.fn.clearSelect = function() {
    return this.each(function() {   
        this.options.length = 0;
    });
} 