
//This can be used as a super class really
//any specifics can then be inherited...no fucking time!!

var ObservableCombo=Class.create(
{
    initialize: function(cmbControl,indexToShow)
    {
        this.Combo=cmbControl;
        this.indexToShow=indexToShow;
        this.observer=null;
    }, //end initialise
    OnChange: function ()
    {
        this.observer.setObservableEvent(this);
    }, //end OnChange
    setObserver: function(observer)
    {
        this.observer=observer;
    },
    getValue: function()
    {
        return this.Combo.value;
    },
    setIndex: function(index)
    {
        try
        {
            this.Combo.selectedIndex=index;
        }
        catch (err)
        {
            this.Combo.selectedIndex=-1;
        }
    },
    setValue: function(Value)
    {
    	var idx=-1;
    	$A(this.Combo.options).each(function(itm)
    	{
    		idx++;
    		if (itm.value==Value)
    		{
    			this.setIndex(idx);
    			throw $break;
    		}
    	},this);
    },//end setValue
    resetCombo: function()
    {
        if (this.Combo.options.length>0)
            this.setIndex(0);
        else
            this.setIndex(-1);
    },
    getIndex: function()
    {
        return this.Combo.selectedIndex;
    },
    disable: function()
    {
        Form.Element.disable($(this.Combo));
    },
    enable: function()
    {
        Form.Element.enable($(this.Combo));
    },
    getOptions: function()
    {
    	return this.Combo.options;
    }
}); //End ObservableCombo