function PromoReveal(
	contentMaskId, leftEdgeMaskId, leftEdgeId, contentAreaId, leftEdgeGrayBarId, messageId, revealId, revealParaId, headerShadowMaskId, headerShadowId, headerShadowSqId,
	smWidth, smHeight, lgWidth, lgHeight, revealParaHeight, leftEdgeMaskWidth, bgImageHeight, contentAreaBgWidth) {

	this.smWidth = smWidth;
	this.smHeight = smHeight;
	this.lgWidth = lgWidth;
	this.lgHeight = lgHeight;
	this.revealParaHeight = revealParaHeight;
	
	this.leftEdgeMaskWidth = leftEdgeMaskWidth;
	this.bgImageHeight = bgImageHeight;
	this.contentAreaBgWidth = contentAreaBgWidth;
	
	this.pr_content_area_mask = document.getElementById(contentMaskId);
	this.pr_left_edge_mask = document.getElementById(leftEdgeMaskId);
	this.pr_left_edge = document.getElementById(leftEdgeId);
	this.pr_content_area = document.getElementById(contentAreaId);
	this.le_gb = document.getElementById(leftEdgeGrayBarId);
	this.pr_message = document.getElementById(messageId);
	this.pr_reveal = document.getElementById(revealId);

	this.pr_reveal.style.marginTop = (bgImageHeight - lgHeight) + 'px';
	this.pr_reveal_para = document.getElementById(revealParaId);
	this.pr_reveal_para.style.height = revealParaHeight;
	this.header_shadow_mask = document.getElementById(headerShadowMaskId);
	this.header_shadow = document.getElementById(headerShadowId);
	this.header_shadow_sq = document.getElementById(headerShadowSqId);	
	
	this.currentState = "collapsed";
	this.timelinePosition = 0.0;
	this.animationTime = .25;
	this.frameRate = 30.0;
	this.easeFunction = function(t) { return t*(2-t); };
	
	var self = this;

	this.pr_content_area_mask.onmouseover= function() { self.prExpand(); };
	this.pr_content_area_mask.onmouseout=function() { self.prCollapse(); };
}

PromoReveal.prototype.timelineMove = function(inc){
	if (this.timelinePosition + inc > .999) {
		this.pr_transform(1);
		this.currentState = "expanded";
	}
	else if (this.timelinePosition + inc < .001) {
		this.pr_transform (0);
		this.currentState = "collapsed";
	}
	else {
		this.pr_transform (this.timelinePosition + inc);
	}
};

PromoReveal.prototype.prExpand = function() {
	if (this.currentState != "expanded") {
		this.currentState = "expanding";
		if(!this.handle) {
			var self = this;
			this.handle = setInterval( function() { self.animate(); }, (1000/this.frameRate));
		}
	}
};

PromoReveal.prototype.prCollapse = function() {	
	if (this.currentState != "collapsed") {
		this.currentState = "collapsing";
		if(!this.handle) {
			var self = this;
			this.handle = setInterval( function() { self.animate(); }, (1000/this.frameRate));
		}
	}
};


PromoReveal.prototype.pr_transform = function(t) {
	this.timelinePosition = t;
	t = this.easeFunction(t);
	this.pr_left_edge_mask.style.height = Math.floor(this.smHeight*(1-t)+this.lgHeight*t)+"px";
	this.pr_content_area_mask.style.height = this.pr_left_edge_mask.style.height;
	this.pr_content_area_mask.style.width = Math.floor((this.smWidth - this.leftEdgeMaskWidth)*(1-t) + (this.lgWidth - this.leftEdgeMaskWidth)*t)+"px";

	this.header_shadow_sq.style.display = "none"; 
	this.header_shadow_mask.style.display = "block"; 
	this.header_shadow_mask.style.width = Math.floor((this.smWidth - 6)*(1-t) + (this.lgWidth - 6 + 5 )*t)+"px";

	this.pr_left_edge.style.marginTop = Math.floor((this.smHeight-this.bgImageHeight)*(1-t)+((this.lgHeight - this.bgImageHeight)*t))+"px";
	this.pr_content_area.style.marginTop = this.pr_left_edge.style.marginTop;
	this.pr_content_area.style.marginLeft = Math.floor(((this.smWidth - this.leftEdgeMaskWidth)-this.contentAreaBgWidth)*(1-t)+(((this.lgWidth - this.leftEdgeMaskWidth)-this.contentAreaBgWidth)*t))+"px";

	this.header_shadow.style.marginLeft = Math.floor(((this.smWidth - this.leftEdgeMaskWidth)-this.contentAreaBgWidth)*(1-t)+(((this.lgWidth - this.leftEdgeMaskWidth)-this.contentAreaBgWidth)*t)) + 6 + "px";
	
	this.le_gb.style.opacity = (1-t);
	this.le_gb.style.filter = "alpha(opacity=" + ((1-t)*100) + ")";
	this.pr_message.style.opacity = this.le_gb.style.opacity;
	this.pr_message.style.filter = "alpha(opacity=" + ((1-t)*100) + ")";
	this.pr_reveal.style.opacity = t;
	this.pr_reveal.style.filter = "alpha(opacity=" + (t*100) + ")";
	if (t < 0.001) {
		this.pr_reveal.style.display = "none";
		this.le_gb.style.display = "block";
		this.pr_message.style.display = "block";
	}
	else if (t > 0.999) {
		this.pr_reveal.style.display = "block";
		this.le_gb.style.display = "none";
		this.pr_message.style.display = "none";
	}
	else {
		this.pr_reveal.style.display = "block";
		this.le_gb.style.display = "block";
		this.pr_message.style.display = "block";
	}
};

PromoReveal.prototype.animate = function (){
	var inc = 1.0/(this.frameRate*this.animationTime);
	switch (this.currentState) {
	case "expanded":
	case "collapsed":
		clearInterval (this.handle);
		this.handle = null;
		break;
	case "expanding":
		this.timelineMove(inc);
		break;
	case "collapsing":
		this.timelineMove(-inc);
		if ( this.header_shadow_mask.style.width == (this.smWidth-6) + "px" )
			{   
				this.header_shadow_sq.style.display = "block"; 
				this.header_shadow_mask.style.display = "none"; 
			}
		break;
	};
};
