$(document).ready(function(){
	$.fn.emptySelect = function(optionsDataArray){
		return this.each(function(){
			if(this.tagName =='SELECT') this.options.length = 0;							
		});
	};
	
	$.fn.loadSelect = function(optionsDataArray){
		return this.emptySelect().each(function(){
			if(this.tagName == "SELECT") 
			{
				var selectElement = this;
				$.each(optionsDataArray, function(index, optionData) {
					var option = new Option(optionData.caption,optionData.value, optionData.selected);
					if($.browser.msie)
						selectElement.add(option);
					else
						selectElement.add(option, null);
				});
			}
		});
	};	
});

function debug($msg) {
	if (window.console && window.console.log)
		window.console.log($msg);
}