var imagenumber = 8;
var randomnumber = Math.random();
var randpics = Math.round((imagenumber-1) * randomnumber) + 1;
 images = new Array  //this one is the top part of image
 images2 = new Array  //this one is the botom second part of the main image.
 quotes = new Array // this one is the insipratinal quote at bottom of page.
  

//* 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/body/home_1.jpg"
 images2[1] = "images/layout/body/home_2.jpg"
 
 
 images[2] = "images/layout/body/home_1a.jpg"
 images2[2] = "images/layout/body/home_2a.jpg"

 images[3] = "images/layout/body/home_1b.jpg"
 images2[3] = "images/layout/body/home_2b.jpg"

 images[4] = "images/layout/body/home_1_blank.jpg"
 images2[4] = "images/layout/body/home_2c.jpg"

 images[5] = "images/layout/body/home_1_blank.jpg"
 images2[5] = "images/layout/body/home_2d.jpg"
 
 images[6] = "images/layout/body/home_1_blank.jpg"
 images2[6] = "images/layout/body/home_2e.jpg"
 
 images[7] = "images/layout/body/home_1_blank.jpg"
 images2[7] = "images/layout/body/home_2f.jpg"
 
 images[8] = "images/layout/body/home_1g.jpg"
 images2[8] = "images/layout/body/home_2g.jpg"
 
 quotes[1] = "Sometimes a teacher has to flick the switch several times before the light bulb comes on."
 quotes[2] = "A great teacher helps students believe they can do anything...except fail."
 quotes[3] = "What greater goal than teaching? What greater gift than knowledge?"
 quotes[4] = "Teachers change the world one day, one lesson, one student at a time."
 quotes[5] = "Somewhere between believing and achieving is a really good teacher or two."
 quotes[6] = "A teacher is the perfect balance of firmness and understanding, of guidance and freedom, of mentor and friend."
 quotes[7] = "Anyone can say, 'Open the book'. A good teacher makes us want to open our minds as well" 
 quotes[8] = "A teacher's enthusiasm is the most contagious thing in the world."
 
//*sendds values of the arrays outside for javacript
 var image = images[randpics]
 var image2 = images2[randpics]
 var quotes = quotes[randpics]



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;
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/archive/nr/2007/07july/071707nmsigrant.html','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('ad5').innerHTML = newsArray[randpic];
	//document.getElementById('ad4').innerHTML = newsArray[randpic11];
}

/*
function rotateNews(){
	var len = newsArray.length;
	//if(nIndex >= len)
		//nIndex = 0;
	document.getElementById('ad3').innerHTML = newsArray[randpic];
	if (randpic == len - 2){
		randpic1 = len-1;
		randpic2 = 0;
		document.getElementById('ad1').innerHTML = newsArray[randpic1];
		document.getElementById('ad2').innerHTML = newsArray[randpic2];
	}
	else if (randpic == len-1){
		randpic1 = 0;
		randpic2 = randpic1 +1;
		document.getElementById('ad1').innerHTML = newsArray[randpic1];
		document.getElementById('ad2').innerHTML = newsArray[randpic2];
	}
	else {
		randpic1 = randpic+1;
		randpic2 = randpic1 +1;
		document.getElementById('ad1').innerHTML = newsArray[randpic1];
		document.getElementById('ad2').innerHTML = newsArray[randpic2];
	}
	//nIndex++;
	//timerID = setTimeout('rotateNews()',6000);
}




function rotateNews1(){
	var len = newsArray.length;
	if(nIndex >= len)
		nIndex = 0;
	document.getElementById('stories1').innerHTML = newsArray[nIndex];
	nIndex++;
	timerID1 = setTimeout('rotateNews1()',6000);
}

function pauseNews() {
	if (timerID != null) {
		clearTimeout(timerID);
		timerID = null;
	}
}

function playNews() {
	if (timerID == null) {
		timerID = setTimeout('rotateNews()', 1000);
	}
}

function pauseNews1() {
	if (timerID1 != null) {
		clearTimeout(timerID1);
		timerID1 = null;
	}
}

function playNews1() {
	if (timerID1 == null) {
		timerID1 = setTimeout('rotateNews1()', 1000);
	}
}

*/