/**
 * Description goes here.
 * @class   ScrollingContent
 * @author  Neal Mckinney
 * @date    13.11.2011
 * @version 0.1
**/

function ScrollingContent(target, baseY, startY, endY) {
	this.target = target;
	this.baseY = baseY;
	this.startY = startY;
	this.endY = endY;
	this.initObjects();
	this.initEvents();
}

ScrollingContent.prototype.toString = function() {
	return "ScrollingContent";
}

// INITIALIZATION =======================================================================================================

ScrollingContent.prototype.initObjects = function() {
	this.hidden = true;
	this.speed = .1;
}

ScrollingContent.prototype.initEvents = function() {

}

// ACTIONS ==============================================================================================================

ScrollingContent.prototype.update = function(top) {
	if (top >= this.startY && top < this.endY) {
		var offset = top-this.startY;
		//console.log("offset: "+offset);
		var percent = offset/this.endY*.45;
		//console.log("percent: "+percent);
		var destY = this.baseY - offset*this.speed*(1-percent);
		if (this.skipEasing) var destY = this.baseY - offset*this.speed;
		this.target.setStyle("top", destY);
		if (this.hidden) {
			this.hidden = false;
			this.target.setStyle("display", "block");
		}
	} else {
		if (!this.hidden) {
			this.hidden = true;
			this.target.setStyle("display", "none");
		}
	}
};



// EVENTS ===============================================================================================================



