//pre-load images
var BrightonImg = new Image();
BrightonImg.src = 'Images/Home/thumb_brightonexterior.jpg';
//var WagImg = new Image();
//WagImg.src = 'Images/Home/wag.JPG';

function makeNews(c,l,f,i,t){
	this.copy = c;
	this.link = l;
	this.follow = f;
	this.img = i;
	this.target=t;
	this.write = writeNews;
}

function writeNews(){
	var str = '';
	str += '<a href="' + this.link + '" target="' + this.target + '">' + this.follow + '</a><br /><br />';
	str += '<a href="' + this.link + '" target="' + this.target + '"><img border="0" src="' + this.img.src + '"></a>';
	str += this.copy + '<br>';
	return str;
}

var newsArray = new Array();

newsArray[0] = new makeNews("",'Content.aspx?Section=newsroom&DocumentID=43084','West Clinic and Memphis Heart Clinic Open New Brighton Clinic&nbsp;&nbsp;<i>(01/12/2009)</i>',BrightonImg,'_parent').write();

//newsArray[1] = new makeNews("",'Images/wags.pdf','Dr. Stacy Smith to Present at WAGS Luncheon',WagImg,'_blank').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()',6000);
}
function pauseNews() {
	if (timerID != null) {
		clearTimeout(timerID);
		timerID = null;
	}
}

function playNews() {
	if (timerID == null) {
		timerID = setTimeout('rotateNews()', 6000);
	}
}
