function QuoteScroller(instanceName, holderID) {
	var that = this;
	this.numElements;
	this.holderID = holderID;
	this.currentIndex = -1;
	this.timer = false;
	this.delay = 7000;
	this.tweenTime = 500;
	this.sProperty = 'marginTop';
	this.startPos = -40;
	this.viewPos = 20;
	this.endPos = 70;
	
	
	this.init = function() {
		that.holderElement = document.getElementById(holderID);
		that.numElements = that.holderElement.childNodes.length;
		that.hideAll();
		that.showNext();
	};
	
	this.showNext = function() {

		if (that.currentIndex+1 < that.numElements) {
			that.currentIndex += 1;
		} else {
			that.currentIndex = 0;
		}
			
		that.holderElement.childNodes[that.currentIndex].style[that.sProperty] = that.startPos;
		that.holderElement.childNodes[that.currentIndex].style.display = "block";
		
		that.tweenIn = new Tween(that.holderElement.childNodes[that.currentIndex],that.sProperty,'px',that.startPos,that.viewPos,that.tweenTime,'easeOutQuad',that.done);
		that.tweenIn.startTween();
		
	};
	
	this.hideAll = function() {
		for (var i=0;i<that.holderElement.childNodes.length;i++) {
			that.holderElement.childNodes[i].style.display = "none";
		}
	};
	
	this.done = function() {
		//console.log('done');
		that.timer = window.setTimeout(that.hideElement, that.delay);
	}
	
	this.hideElement = function(index) {
		function hideThis() {
			that.hideAll();
			that.showNext();
		};
		
		that.tweenOut = new Tween(that.holderElement.childNodes[that.currentIndex],that.sProperty,'px',that.viewPos,that.endPos,that.tweenTime,'easeInQuad',hideThis);
		that.tweenOut.startTween();
	};
	
}

Tween = function(element,property,postfix,from,to,time,equation,onComplete) {
	/*
	Usage
	this.tweenOut = new Tween(that.holderElement.childNodes[that.currentIndex],'marginTop','px',"current",endPos,that.tweenTime,'easeInQuad',hideThis);
	this.tweenOut.startTween();
	*/
	var that = this;
	if (from == "current") {
		this.currentValue = Number(element.style[property].replace(postfix,""));
		from = this.currentValue;
	} else {
		this.currentValue = from;
		element.style[property] = from + postfix;
	}
	this.frameDelay = 40;
	this.framesTotal = time / this.frameDelay;
	this.framesDone = 0;
	
	this.element = element;
	this.property = property;
	this.postfix = postfix;
	this.from = from;
	this.to = to;
	this.time = time;
	this.onComplete = onComplete;
	this.equation = equation;
		
	this.stepValue = (to - from) / this.framesTotal;
	
	
	this.startTween = function() {
		that.tweenEngine();
	};
	
	this.stopTween = function() {
		that.framesDone = that.framesTotal;
	};
	
	this.tweenEngine = function() {
		var self = this;
		self.timer = false;
		var nextValue = that.easing[that.equation](that.framesDone,that.framesTotal,that.from,that.to)+ that.postfix;
		
		if (that.framesDone <= that.framesTotal) {
			if (that.currentValue + that.stepValue > that.to) {
				 nextValue = that.to + that.postfix;
			}
			
			if (that.property == "alpha") {
				that.setOpacity(that.element,that.to);
			} else {
				that.element.style[that.property] = nextValue;
			}
			
			self.timer = window.setTimeout(that.tweenEngine, that.frameDelay);
			var rawValue = that.element.style[that.property];
			if (that.postfix != "") {
				rawValue = rawValue.replace(that.postfix,"");
			}
			that.currentValue = Number(rawValue);
			that.framesDone++;
		} else {
			self.timer = false;
			that.framesDone = 0;
			that.onComplete();
		}
	};
	
	 this.easing = function() {
		//time, begin, change, duration
		this.linear = function(frame,total,from,to) {
			var time = frame/total;
			var change = Math.max(from,to) - Math.min(from,to);
			return	time * change + from;
		};
		this.easeInQuad = function(frame,total,from,to) {
			var time = frame/total;
			var change = Math.max(from,to) - Math.min(from,to);
			return (change * time) * time + from;
		};
		this.easeOutQuad = function(frame,total,from,to) {
			var time = frame/total;
			var change = Math.max(from,to) - Math.min(from,to);
			return (-change * time) * (time-2) + from;
		};
		this.easeInOutQuad = function(frame,total,from,to) {
			alert("easeInOutQuad is broken  8(");
			var time = frame/total;
			var change = Math.max(from,to) - Math.min(from,to);
			
			htime = time/2;
			if (htime/2 < 1) {
				return change/2*time*time + from;
			}
			return -change/2 * ((--time) * (time-2) - 1) + from;
		};
		
		return this;
	}();
	
	this.setOpacity = function(eElement, iValue) {
		eElement.style.opacity = iValue/100;
		eElement.style.filter = 'alpha(opacity=' + iValue + ')';
	}
}