roller_content=new Array;
roller_order=new Array;
delay_long=4500;
delay_short=20;
currentBlock=0;

function roller_stuff(bkgd, border, cover, copy) {
	this.bkgd=bkgd;
	this.border=border;
	this.cover=cover;
	this.copy=copy;
}

function roller_new_phrase() {
	roller_pos++;
	if(roller_pos==roller_content.length) roller_pos=0;
// 	obj=document.getElementById("flashBox");
// 	i=roller_content[roller_order[roller_pos]];
// 	if (i.cover.length>0) obj.innerHTML='<p><img src="'+i.cover+'" alt=" " /><br />'+i.copy;
// 	else obj.innerHTML='<p>'+i.copy;
// 	obj.style.backgroundColor=i.bkgd;
// 	obj.style.borderColor=i.border;
 	document.getElementById("testi_"+currentBlock).style.display="none";
	currentBlock=roller_order[roller_pos];
 	document.getElementById("testi_"+currentBlock).style.display="block";
 	destinationHeight=document.getElementById("testi_"+currentBlock).offsetHeight;
}


function roller_init() {
	for (i=0; i<roller_content.length; i++) {
		roller_order.push(i);
//		newImage(roller_content[i].cover);		// Don't do this without checking
	}
	for (i=0; i<roller_content.length; i++) {
		x=Math.floor(Math.random()*roller_content.length);
		j=roller_order[i]
		roller_order[i]=roller_order[x];
		roller_order[x]=j;
	}
	zobj=document.getElementById("flashBoxGradient");
	scroll_pos=-1400;
	roller_pos=-1;
	roller_new_phrase();
	roller_scroll(0);
}

function roller_scroll(state) {
	switch (state) {
		case 0:
			setTimeout("roller_scroll(1);", delay_long);
			break;
		case 2:
			scroll_pos=-700;
			zobj.style.top=(scroll_pos+"px");
			roller_new_phrase();
		case 1:
		case 3:
			scroll_pos+=4;
			zobj.style.top=(scroll_pos+"px");
			if (state==2) state=3;
			if (state==1 && scroll_pos>-(1300-destinationHeight)) state=2;
			if (scroll_pos<5) setTimeout("roller_scroll("+state+");", delay_short);
			else {
				scroll_pos=-1400;
				setTimeout("roller_scroll(1);", delay_long);
			}
			break;
	}
}

function writeTestimonials(blank) {
	for (i=0; i<roller_content.length; i++) {
		document.write('<div id="testi_'+i+'" class="testiZone" style="border-color: '+roller_content[i].border+'; background-color: '+roller_content[i].bkgd+'; '+blank+'"><p>'+roller_content[i].copy+'</p></div>');
	}
}

function writeNTestimonials(n) {
	order=new Array;
	for (i=0; i<roller_content.length; i++) order[i]=i;
	for (i=0; i<roller_content.length; i++) {
		j=Math.floor(Math.random()*roller_content.length);
		z=order[i];
		order[i]=order[j];
		order[j]=z;
	}
	for (j=0; j<n; j++) {
		i=order[j];
		document.write('<div id="testi_'+i+'" class="testiZone" style="border-color: '+roller_content[i].border+'; background-color: '+roller_content[i].bkgd+'; "><p>'+roller_content[i].copy+'</p></div>');
	}
}
