//pre-load images
var imgRatePoint = new Image();
imgRatePoint.src = '//siteseal.ratepoint.com/member/seal/45544/9.png';
var imgInformer = new Image();
imgInformer.src = 'assets/images/asBlogBox_fp.png';
var imgTwitter = new Image();
imgTwitter.src = 'assets/images/twitter_fp_box.png';

function makeNews(theText,theLink,theImage,theAltText){
	this.copy = theText;
	this.link = theLink;
	this.img = theImage;
	this.alt = theAltText;
	this.write = writeNews;
}

function writeNews(){
	var str = '';
	str += '<p><strong>' + this.copy + '</strong></p>';
	str += '<a href="' + this.link + '"><img style="margin: 12px 0 0 40px;" src="' + this.img.src + '" height="82" width="116" alt="' + this.alt + '" border="0" /></a>';
	return str;
}

var newsArray = new Array();
newsArray[0] = new makeNews('Give feedback &amp; let us know how we\'ve done for you!','http://ratepoint.com/profile/45544',imgRatePoint,'RatePoint Site Seal').write();
newsArray[1] = new makeNews("Visit the all new To Solution technology learning center.",'/informit',imgInformer,'Stay Informed by Reading Our Blog').write();
newsArray[2] = new makeNews("Follow us on Twitter for our latest news and announcements",'http://www.twitter.com/tosolution',imgTwitter,'Follow us on Twitter').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()',8000);
}
function pauseNews() {
	if (timerID != null) {
		clearTimeout(timerID);
		timerID = null;
	}
}

function playNews() {
	if (timerID == null) {
		timerID = setTimeout('rotateNews()', 8000);
	}
}

