//pre-load images
var ASAPSImg = new Image();
ASAPSImg.src = '/Images/Ads/ASAPSLogo.png';
var GWPSImg = new Image();
GWPSImg.src = '/Images/Ads/GWPSLogo.png';
var e_mailImg = new Image();
e_mailImg.src = '/Images/Ads/e_mail.png';
var HFImg = new Image();
HFImg.src = '/Images/Ads/antenna.png';
var SatImg = new Image();
SatImg.src = '/Images/Ads/satellite.png';

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 = '<div>';
        str +=  '<div>';
	str += '<a href="' + this.link + '">';
	str += '<img border="0" src="' + this.img.src + '" style="float:left"></a>';
        str +=  '</div>';
        str +=  '<div>';
	str += this.copy + '<br>';
        str +=  '<a href="' + this.link + '">' + this.follow + '</a>';
        str +=  '</div></div>';
	return str;
}

var newsArray = new Array();
newsArray[0] = new makeNews("The IPS Advanced Stand Alone Prediction System (ASAPS) allows the prediction of sky wave communication conditions",'/Products_and_Services/1/1','Read More',ASAPSImg).write();

newsArray[1] = new makeNews("Ground Wave Prediction System - a graphical user interface driven tool for predicting the propagation of radio waves over the surface of the earth",'/Products_and_Services/1/4','More Info',GWPSImg).write();

newsArray[2] = new makeNews("Subscribe to email products. Flare and Proton alerts, Auroral events, Geomagnetic events, daily, weekly and monthly reports and much more.",'/Products_and_Services/4/1','More Info',e_mailImg).write();

newsArray[3] = new makeNews("On-line prediction tools for radio comminucations - HF to UHF, includes point to point predictions, air route charts, signal loss and more. Java required<BR>",'/HF_Systems/7/1','Go there',HFImg).write();

newsArray[4] = new makeNews("Services for satellite navigation systems. See the Section information for background information<BR>",'/Satellite','More Info',SatImg).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()', 1000);
	}
}


