
function makeNews(title, summary, link, follow, img){
	this.title = title;
	this.summary = summary;
	this.link = link;
	this.follow = follow;
	this.img = img;
	this.write = writeNews;
}

function writeNews(){
	var str = '';
	// title
	if (this.title!= "")
	{
		str +=  "<a OnClick=\"popUpWindow('" + this.link + "', 500, 400)\" href='javascript:;'><font class='orange_title'>" + this.title + "</a></font><br>";
	}
	// pic
	if (this.img!= "")
	{
		str += '<a OnClick="popUpWindow(this.link, 500, 400)" href="javascript:;"><img width="80" border="0" src="' + this.img + '" style="float: left; margin: 8 8 0 0;"></a>';
	}
	// summary
	if (this.summary!= "")
	{
		str += '<font class="Text" style="font-size: 11px; text-align:justify;">' + this.summary + '</font><br>';
	}
	// follow link
	str +=  '<div align="right">' + "<a OnClick=\"popUpWindow('" + this.link + "', 500, 400)\" href='javascript:;'>" + '<span style="font-size:10px; color:orange;">' + this.follow + ' ...</span></a></div>';

	return str;
}

var newsArray = new Array();
newsArray[0] = new makeNews('AAST News','','','','').write();

var nIndex = 0;
var timerID = null;

function rotateNews(){
	var len = newsArray.length;
	if(nIndex >= len)
		nIndex = 0;
	if (document.getElementById('stories'))
	{
			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);
	}
}




// Images at the splash
var images=new Array();
images[0]="/en/images/aast_home/refresh_pics/1.jpg";
images[1]="/en/images/aast_home/refresh_pics/2.jpg";
images[2]="/en/images/aast_home/refresh_pics/3.jpg";
images[3]="/en/images/aast_home/refresh_pics/4.jpg";
images[4]="/en/images/aast_home/refresh_pics/5.jpg";
images[5]="/en/images/aast_home/refresh_pics/6.jpg";
images[6]="/en/images/aast_home/refresh_pics/7.jpg";
images[7]="/en/images/aast_home/refresh_pics/8.jpg";
images[8]="/en/images/aast_home/refresh_pics/9.jpg";


function randomImage() 
{
	var i=Math.floor(Math.random()*images.length);
	
	var r= document.getElementById("random");	
	if (r)
	{
			document.getElementById("random").src=images[i];
	}
	
}
