var imagenumber = 5;
var imagenumbertop = 2;  //this is the top logo rotate.
var randomnumber = Math.random();
var randpics = Math.round((imagenumber-1) * randomnumber) + 1;
var randpics1 = Math.round((imagenumbertop-1) * randomnumber) + 1;

 images = new Array  //this one is the top part of image
 images2 = new Array  //this one is the big image below part of the main image.
 
  

//* this sets an image to the array as well as a link; the 'target' will either keep the link in the same browser window or place it in its own 
 images[1] = "images/layout/top_logo_1.jpg"
 images[2] = "images/layout/top_logo_2.jpg"
 
 images2[1] = "images/layout/body/main_2.jpg"
 images2[2] = "images/layout/body/main_2a.jpg"
 images2[3] = "images/layout/body/main_2b.jpg"
 images2[4] = "images/layout/body/main_2c.jpg"
 images2[5] = "images/layout/body/main_2d.jpg"
 
 //*sendds values of the arrays outside for javacript
 var image = images[randpics1]
 var image2 = images2[randpics]
 


//this code is for the rotation of lateest news, must change for the rotate1.js if update this.
var listImg1 = new Image();
listImg1.src = 'images/news/teach_houston.jpg';
var listImg2 = new Image();
listImg2.src = 'images/news/Ashley.jpg';
var listImg3 = new Image();
listImg3.src = 'images/news/local2_news.jpg';
var listImg4 = new Image();
listImg4.src = 'images/news/student_interaction.jpg';
var listImg5 = new Image();
listImg5.src = 'images/news/Jacqueline_Ekeoba.jpg';


var imagenumber11 = 5;  //specify total number of images
var randpic11 = Math.round((imagenumber11-1) * randomnumber) 

function makeNews(h,c,l,f,i){
	this.highline = h;
	this.copy = c;
	this.link = l;
	this.follow = f;
	this.img = i;
	this.write11 = writeNews;
}


function writeNews(){
	var str = '';
	str += '<a href="' + this.link + '">';
	str += '<img border="0" src="' + this.img.src + '" + width="205" height="178" style = "float:left"><br></a>';
	str +=  '<p align="center"><a href="' + this.link + '">';   
	str +=  this.highline + '</a></p>';
	str +=  '<div class="newsevent">' + this.copy  + '</div>';
        
	return str;
}
/*
<a href="www.uh.edu">Channel 2 news report</a></strong>
function writeNews(){
	var str = '';
	str += '<a href="' + this.link + '">';
	str += '<img border="0" src="' + this.img.src + '" + width="205" height="178" style = "float:left"></a><p>&nbsp;</p>';
	str +=   this.highline + '<br>';
	str +=  '<span class="body">' + this.copy  + '</span>' +'<br>';
        str +=  '<a href="' + this.link + '">' + this.follow + '</a>';
	return str;
}
*/
var newsArray = new Array();
newsArray[0] = new makeNews("Momentum Magazine " , "teachHOUSTON targets Math and Science teacher shortage ",'http://momentum.nsm.uh.edu/2007_spring/teachhouston.htm','Read More',listImg1).write11();

newsArray[1] = new makeNews("UH press release","teachHOUSTON program wins $2.4 Million Grant from the National Mathematics and Science Initiative (NMSI)",'http://www.uh.edu/news-events/newsrelease.php?releaseid_int=110','More Info',listImg2).write11();

newsArray[2] = new makeNews("Channel 2 news report","teachHOUSTON...The program that will change the way people think about teaching.",'http://www.teachhouston.uh.edu/Channel2news_teachHouston.html','More Info',listImg3).write11();

newsArray[3] = new makeNews("Momentum Magazine " , "teachHOUSTON Gets $2.4 Million Grant to Train Science, Math Teachers. ",'http://momentum.nsm.uh.edu/2007_winter/teachhouston.htm','Read More',listImg4).write11();

newsArray[4] = new makeNews("UH news release " , "From Two Jobs to the Dean's List: Future Teacher Earns Big Break. ",'http://www.uh.edu/news-events/newsrelease.php?releaseid_int=277','Read More',listImg5).write11();

var nIndex = 0;
var timerID = null;
var timerID1 = null;
var randpic1 = null;
var randpic2 = null;
function rotateNews(){
	var len = newsArray.length;
	//if(nIndex >= len)
		//nIndex = 0;
	//document.getElementById('ad1').innerHTML = newsArray[randpic11];
	document.getElementById('ad2').innerHTML = newsArray[randpic11];
	//document.getElementById('ad5').innerHTML = newsArray[randpic];
	//document.getElementById('ad4').innerHTML = newsArray[randpic11];
}
