
function rotate(eid,pid) {
	window.myRotate = this;
	this.eid = eid;
	this.pid = pid;
	this.idx = 0;
	this.showTime = 2;
	myAll.waitScript('lib.fader.js',function(){myRotate.startup()});
}

rotate.prototype.startup = function() {
	this.fader = new fader(this.eid);
	this.fader.startAt(0);
	this.fader.callbackIn = function(){myRotate.hold()};
	this.fader.callbackOut = function(){myRotate.next()};
	this.eel = document.getElementById(this.eid);
	this.pel = document.getElementById(this.pid);
	if (this.eel && this.pel) {
		this.idx = 0;
		this.content = this.pel.getElementsByTagName('div');
		if (this.content) this.show();
	}
}

rotate.prototype.fill = function() {
	//this.eel.innerHTML = '<font size="+1">"</font>'+this.content[this.idx].innerHTML+'<font size="+1">"</font>';
	var ot = '';
	ot += '<table cellpadding="0" cellspacing="0" border="0" height="105"><tr>';
	ot += '<td valign="top"><!--<img src="img/leftquote.png" border="0">--></td>';
	ot += '<td style="padding: 8px 0px 8px 0px;" valign="center">'+this.content[this.idx].innerHTML+'</td>';
	ot += '<td valign="bottom"><!--<img src="img/rightquote.png" border="0">--></td>';
	ot += '</tr></table>';
	//this.eel.innerHTML = '<img align="left" src="img/leftquote.png" border="0">'+this.content[this.idx].innerHTML+'<img align="right" src="img/rightquote.png" border="0">';
	this.eel.innerHTML = ot;
}

rotate.prototype.show = function() {
	this.fill();
	this.fader.fadeIn();
}

rotate.prototype.hold = function() {
	this.fill();
	//setTimeout(function(){myRotate.fade()},(this.showTime*1000));
	setTimeout(aaFn(this,'fade'),(this.showTime*1000));
}

rotate.prototype.fade = function() {
	this.fill();
	this.fader.fadeOut();
}

rotate.prototype.next = function() {
	if (++this.idx >= this.content.length) this.idx = 0;
	this.show();
}


