//pre-load images
var pandaImg = new Image();
pandaImg.src = 'images/pandaexpress.gif';
var depotImg = new Image();
depotImg.src = 'images/officedepot.gif';
var petcoImg = new Image();
petcoImg.src = 'images/petco.gif';
var crateImg = new Image();
crateImg.src = 'images/crate.gif';
var brownshoeImg = new Image();
brownshoeImg.src = 'images/brownshoe.gif';
var davidsbridalImg = new Image();
davidsbridalImg.src = 'images/davidsbridal.gif';
var aerosolesImg = new Image();
aerosolesImg.src = 'images/aerosoles.gif';

function makeNews(c,l,f,t,p,i){
	this.copy = c;
	this.link = l;
	this.follow = f;
	this.follow2 = t;
	this.follow3 = p;
	this.img = i;
	this.write = writeNews;
}

function writeNews(){
	var str = '';
	str += '<a href="' + this.link + '">';
	str += '<img border="0" src="' + this.img.src + '"></a><br />';
	str += this.copy + '<br>';
    str += '<p>' + this.follow + '</p>';
	str += '<p2>' + this.follow2 + '<br />';
	str += this.follow3 + '</p2>';
	return str;
}

var newsArray = new Array();
newsArray[0] = new makeNews("\"Trusonic's custom music programming and message delivery system, coupled with their platform's ease of use and value, set them apart.\"",'about/testimonials.html#davidsbridal','- David Connelly','Strategic Sourcing Manager','Davids Bridal',davidsbridalImg).write();

newsArray[1] = new makeNews("\"With Trusonic's user-friendly way of receiving content, we can provide fresh, uninterrupted music and messaging for our customers.\"",'about/testimonials.html#brownshoe','- Andrew D. Singer, C.P.M.','Director of Procurement and Support Services','Brown Shoe Company',brownshoeImg).write();

newsArray[2] = new makeNews("\"Trusonic's technology and pinpoint messaging capabilities attracted us to their platform.  We found Trusonic's value proposition to be highly compelling.\"",'about/testimonials.html#depot','- Chuck Rubin','President of North American Retail','Office Depot',depotImg).write();

newsArray[3] = new makeNews("\"Their custom music programming capabilities and extensive libraries of music is what really set Trusonic apart from other background music providers.\"" ,'about/testimonials.html#panda','- Nader Garschi','Executive Director Concept Innovations','Panda Express',pandaImg).write();

newsArray[4] = new makeNews("\"Trusonic’s flexibility is practically unlimited. Long lead times for schedule and message delivery is a thing of the past.\"",'about/testimonials.html#petco','- Clint White', 'Marketing','PETCO',petcoImg).write();

newsArray[5] = new makeNews("\"Trusonic's music programming team demonstrated a clear understanding of our brand, our shoppers, and relevant musical selections to our stores.\"",'about/testimonials.html#aerosoles','- Lynn Harvey','Director of Marketing','Aerosoles',aerosolesImg).write();

newsArray[6] = new makeNews("\"Trusonic offers a personalized kind of service that I have not found elsewhere.\"",'about/testimonials.html#crate','- Raymond Arenson','Vice President of Store Design','Crate & Barrel',crateImg).write();

var nIndex = 0;
var timerID = null;
function rotateNews(){
	var len = newsArray.length;
	if(nIndex >= len)
		nIndex = 0;
	document.getElementById('stories').innerHTML = newsArray[nIndex];
	nIndex++;
	timerID = setTimeout('rotateNews()',4000);
}
function pauseNews() {
	if (timerID != null) {
		clearTimeout(timerID);
		timerID = null;
	}
}

function playNews() {
	if (timerID == null) {
		timerID = setTimeout('rotateNews()', 1000);
	}
}
