function DropBox(dropbox)
{
	this.dropbox = dropbox;
	var that = this;
		
	this.Populate = function (data, mark)
	{
		// First remove elements from dropbox
		that.dropbox.childElements().each(function (value)
		{
			value.remove();
		});
		
		mark = mark == null ? false : mark;
		
		var option = null;
		
		if(data.opt_one != null)
		{
			option = new Option(data.opt_one, data.val_one);
			if(data.classname != null)
				option.className = data.classname;
			that.dropbox.options[that.dropbox.options.length] = option;
		}
		
		// Set the selected index to 0 ... this may change in a bit on value == match
		var selected_index = 0;
		if(typeof data.items.each == 'function')
		{
			data.items.each(function (value, index)
			{
				var opt_text = '';
			
				if(typeof data.opt == 'object')
				{
					var separator = data.opt[0];
					opt_text += value[data.opt[1]];
					for(var i=2; i<data.opt.length; i++)
						opt_text += separator + value[data.opt[i]];
				}
				else
					opt_text += value[data.opt];
			
				option = new Option(opt_text, value[data.val]);
			
				if(mark && data.match != null && option.value == data.match) // MARK THIS ROW!
					selected_index = index;
			
				if(data.classname != null)
					option.className = data.classname;
				
				that.dropbox.options[that.dropbox.options.length] = option;
			});
		}
		
		// Select the selected option in teh SELECT element
		that.dropbox.selectedIndex = selected_index;
	};
	
	this.GetSelectedIndex = function ()
	{
		return that.dropbox.selectedIndex;
	};
}