//Note that this script relies on scriptaculous effects and uses a global element

if(!CNR) var CNR = {};
CNR.Fader = Class.create();

// options:
//  selectedStyle:  (default)
//
// callbacks:
//  onFinish(selected)
//  onStart(selected)
CNR.Fader.prototype = {
	initialize: function(elementId, options) {
		this.elementId = elementId;
    	this.options = options || {};
    	this.initialized = true;
    	this.duration = this.options.duration || 0.5;
    	this.opacity = this.options.opacity || 0.7;
    },
    fade: function() {
		new Effect.Opacity(this.elementId, { from: 1.0, to: this.opacity, duration: this.duration });
	},
    show: function() {
		new Effect.Appear(this.elementId, { duration: this.duration });
	}
}
