var ProductSwitcher = Class.create();
ProductSwitcher.prototype = {
    last:null,
    initialize:function(formID, rPrefix, sPrefix) {
        form = $(formID);
        if (form==null) return;
        var col = form.getElementsByTagName("input");
        for (var i=0; i<col.length; i++) {
            if (col[i].id.indexOf(rPrefix)!=-1) {
                col[i].sel = $(sPrefix+col[i].id.substr(rPrefix.length));
                col[i].s=this;
                if (col[i].sel!=null) {

                    col[i].sel.disabled = !col[i].checked;
                    if (col[i].checked)
                        this.last = col[i].sel;
                }
                $(col[i]).observe("click", (function(event) { this.change(event); }).bind(this) )
            }
        }
    },
    change:function(e) {
        var d=Event.findElement(e);
        if (d.sel!=null)
            d.sel.disabled = !d.checked;
        if (d.s.last!=null)
            d.s.last.disabled = true;
        d.s.last = d.sel;
    }
}
