//pre-load images
var cmeImg = new Image();
cmeImg.src = 'images/cisco_ucme.jpg';
var avaImg = new Image();
avaImg.src = 'avaya/avaya_compliant.gif';
var treeImg = new Image();
treeImg.src = 'images/reception.jpg';
var formImg = new Image();
formImg.src = 'rotate1/handshaking.jpg';
var autoImg = new Image();
autoImg.src = 'images/security.gif';
var hostImg = new Image();
hostImg.src = 'images/worldsearch.jpg';

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

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

var newsArray = new Array();

newsArray[0] = new makeNews("Looking for Call Accounting on Cisco Unified Communication Manager Express? ",'http://www.telecost.com/cisco','More Info',cmeImg).write();

newsArray[1] = new makeNews("Join our FREE public webinars and find out more about our Total Communication Management Solutions",'http://ftp.telecost.com/data/webinar_public.asp','More Info',treeImg).write();

newsArray[2] = new makeNews("RSI leverages Avaya Compliant Unified Communications solutions for your communication management needs. ",'http://www.telecost.com/avaya','More Info',avaImg).write();

newsArray[3] = new makeNews("Join our florishing global team business partners and dealers.  Enjoy huge rewards!",'feedback.htm?title=Become A Partner','Click Here',formImg).write();

newsArray[4] = new makeNews("Find out more about our exiting new browser-based Visual Rapport Console.NET and other Nortel Compatible Products",'http://www.callaccountingsoftware.com','More Info',autoImg).write();

newsArray[5] = new makeNews("Let us manage your telecom data!  Hosted call accounting available from anywhere, anytime!",'http://www.hostedcallaccounting.com','More Info',hostImg).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()',5000);
}
function pauseNews() {
	if (timerID != null) {
		clearTimeout(timerID);
		timerID = null;
	}
}

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