// Author: Caleb Johnston | Big Spaceship
// Date: June 22, 2005
// Site: Billboard.com
// attn: interaction class

// The Rollover object is used for all style based rollovers on the entire site.
// With this Rollover object, a javascript DOM reference must be made to the item which
// is to have a rollover affect applied to it.
// The Rollover object's strength is in reducing redundancy. Any object that has a rollover effect
// that is used elsewhere can share the same object. So fewer objects can be made.

// NOTE: anytime something uses the fade(), fadeIn(), or fadeOut() methods but doesn't 
// pass "this" as the parameter and passes a childNode object instead that childNode 
// object is expected (by some browsers) to be on the same line as the object that makes the call. 

// rollover object
Rollover = function(stylePropStr, overColorStr, outColorStr){
	this._id;	//object id (yet undeclared)
	this._prop	= stylePropStr;	//css style property to fade
	this._over	= overColorStr;	//over color string
	this._out	= outColorStr;	//out color string
	this._toggle = false;		//interaction mode (true=on/false=off)
	this._fading = false;		//help stop the flicker that dumb browsers produce
}

// fading method
Rollover.prototype.fade = function(obj) {
	this._toggle = !this._toggle;
	this._toggle? obj.style[this._prop] = this._over : obj.style[this._prop] = this._out;
	this._fading = false;
}

// fadeOut and fadeIn are used for dropdown menus or one of the two interactive modules (reviews pages + entertainment pages)
// fadeOut and fadeIn methods used to account for an anomaly in the Safari event model
Rollover.prototype.fadeOut = function(obj) {
	obj.style[this._prop] = this._out;
}

Rollover.prototype.fadeIn = function(obj) {
	obj.style[this._prop] = this._over;
}
