// Author: Caleb Johnston | Big Spaceship
// Date: July 7, 2005
// Site: Billboard.com
// attn: DHTML Image object

// The Img object is used for image swapping without the use of an Id.
// This object requires only one parameter when called which is the image object itself.
// Due to the nature of this rollover mechanism, an image that uses this object 
// may have only one rollover state (ie. no 'down' or 'up' state).

//constructor
Img = function(rolloverPath){
	this.outSrc = null;				//rollout image path
	this.overSrc = rolloverPath;	//rollover image path
	this.state = false;				//the image state
};

//swap out the image file
Img.prototype.swap = function(imgObj){
	//if a default image hasn't been stored, then store one
	if (this.outSrc == null) { 
	this.outSrc = imgObj.src;
	}
	//if the button is already on, then turn it off -and vise versa
	if (this.state){
		imgObj.src = this.outSrc
	} else {
		imgObj.src = this.overSrc
	}
	//toggle state
	this.state = !this.state;
}



