
//need to recall this one for rotate the 3 image news.


//This part is for randomly select 3 news from the news event
//pre-load images
var listImg1 = new Image();
listImg1.src = 'images/news/tgtc.jpg';
var listImg2 = new Image();
listImg2.src = 'images/news/mathWSJ.jpg';
var listImg3 = new Image();
listImg3.src = 'images/news/Canic.jpg';
var listImg4 = new Image();
listImg4.src = 'images/news/feature_josic.jpg';
var listImg5 = new Image();
listImg5.src = 'images/news/teach_houston.jpg';
var listImg6 = new Image();
listImg6.src = 'images/news/Bodmann_research_img.jpg';
var listImg7 = new Image();
listImg7.src = 'images/news/teachHouston.jpg';
var listImg8 = new Image();
listImg8.src = 'images/news/Vern_Paulsen.jpg';
var listImg9 = new Image();
listImg9.src = 'images/news/small_Black_Logo.jpg';
var listImg10 = new Image();
listImg10.src = 'images/news/minh_ru.jpg';
var listImg11 = new Image();
listImg11.src = 'images/news/combinatexas.jpg';
var listImg12 = new Image();
listImg12.src = 'images/news/Manos_Papadakis.jpg';
/*
var listImg2 = new Image();
listImg2.src = 'images/news/golubitsky.jpg';
var listImg3 = new Image();
listImg3.src = 'images/news/keyfitz.jpg';
var listImg4 = new Image();
listImg4.src = 'images/news/henry_pitcher.jpg';


*/

var imagenumber11 = 9;  // should be 7, but put 6 cause fix the last news item
var randomnumber11 = Math.random();
var randpic11 = Math.round((imagenumber11-1) * randomnumber11) 

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;
}
//<div align="justify"><a href="uhtest.htm"><img src="news/Glowinski.jpg" width="156" height="210" hspace="15" border="0"  style = "float:right">
function writeNews(){
	var str = '';
	str += '<a href="' + this.link + '">';
	str += '<img border="0" src="' + this.img.src + '" + width="105" height="138" style = "float:left"></a><br><br>';
	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[8] = new makeNews(" Featured Article: Vern Paulsen.","Vern Paulsen is the recipient of the 2007/2008 University of Houston Teaching Excellence Award and of Western Michigan University's Distinguished Alumnus Award in Mathematics. He has published over 80 research articles, written four books and has been continuously funded by the National Science Foundation since 1983.",'http://www.math.uh.edu/Matweb/faculty/Featured_article_Paulsen.html','Read more',listImg8).write11();

newsArray[7] = new makeNews(" Featured Article: Kre&scaron;imir Josi&#263;.","Kre&scaron;imir Josi&#263; works in several areas of mathematical biology and applied dynamics. His work in this area has appeared in journals like Nature, Neural Computation and the Journal of Computational Neuroscience.",'http://www.math.uh.edu/Matweb/faculty/Featured_article_Josic.html','Read more',listImg4).write11();

newsArray[6] = new makeNews("Mathematical Medicine" , "Suncica Canic is a mathematician, not a medical doctor, but her research could save the lives of heart patients.",'http://www.nsm.uh.edu/features/math-nsm/mathematical-medicine/index.php','Read More',listImg3).write11();

newsArray[5] = new makeNews("Article on Wall Street Journal proclaims Math #1" , "Wall Street Journal article proclaims Mathematics to be the #1 profession.",'http://online.wsj.com/article_email/SB123119236117055127-lMyQjAxMDI5MzAxNjEwOTYyWj.html','Read More',listImg2).write11();

newsArray[4] = new makeNews(" Featured Article: Manos Papadakis.","Manos Papadakis works on developing tools for harnessing latent information in 3D image data sets using wavelets and other multiscale representations combined with sophisticated classification algorithms. His methods have a great impact in the applications of cardiovascular imaging and neuroscience.",'http://www.math.uh.edu/Matweb/faculty/Featured_article_Papadakis.html','Read more',listImg12).write11();

newsArray[3] = new makeNews(" Featured Article: Min Ru.","Min Ru has a broad range of research interests, including complex analysis, differential geometry and number theory. He has made important contributions in these fields, and his work has been published in leading mathematical journals.",'http://www.math.uh.edu/Matweb/faculty/Featured_article_Ru.html','Read more',listImg10).write11();

/*
newsArray[3] = new makeNews("CombinaTexas Conference - April 25 and 26, 2009" , "The 10th annual meeting of CombinaTexas will be held on the campus of the University of Houston on April 25 and 26, 2009. The CombinaTexas Conference is dedicated to the strengthening and enrichment of the mathematics personnel base.",'http://www.math.uh.edu/CombinaTexas/','View more information and register online',listImg11).write11();

newsArray[4] = new makeNews("Texas Geometry and Topology Conference - Feb. 20 to Feb. 22, 2009" , "The 2009 Spring Texas Geometry and Topology Conference will be held at the Department of Mathematics - University of Houston.",'http://www.math.uh.edu/~tgtc/','Read More',listImg1).write11();

newsArray[11] = new makeNews("Amundson Lecture Series 2009.","The Department of Mathematics will host the Amundson Lecture Series by Professor Emmanuel Candes (California Institute of Technology) in 2009. The lectures will be held on April 29-May 1, 2009 at the University of Houston.",'http://www.math.uh.edu/amundsonlectureseries/','Read more',listImg9).write11();

newsArray[3] = new makeNews("In memory of Professor Michael Friedberg" , "We regret to inform our University community of the death of Professor Michael Friedberg. Mike was a Department of Mathematics faculty member for 41 years, a valued friend and respected colleague. Mike, age 69, died unexpectedly at home on Friday, September 12.",'http://www.math.uh.edu/Matweb/memory_of_Professor_Michael_Friedberg.html','Read More',listImg11).write11();

newsArray[3] = new makeNews("Sixth Annual Houston Conference on Theoretical Neuroscience - November 8, 2008" , "This annual conference will highlight work in the field of computational and theoretical neuroscience by Houston-Galveston area researchers. The conference includes both talks and a poster session. ",'http://cohesion.rice.edu/centersandinst/gcc/neuro.cfm','Read More',listImg1).write11();

newsArray[1] = new makeNews("Martin Golubitsky Elected to the American Academy of Arts and Sciences","HOUSTON, May 10, 2006 – Joining past U.S. presidents and Pulitzer Prize winners, Martin Golubitsky, a University of Houston mathematician, has been elected to the American Academy of Arts and Sciences. ",'http://www.uh.edu','More Info',listImg2).write11();

newsArray[2] = new makeNews("Barbara Keyfitz receives Farfel Award","Barbara Keyfitz, Professor of Mathematics, has earned the University of Houston 2006 Esther Farfel Award, the highest honor UH bestows on a faculty member. <br> <br> Keyfitz is the first woman to be appointed director of a major math institute in Toronto, Canada.",'http://www.nsm.uh.edu/newsroom/2006/0508_keyfitz.htm','More Info',listImg3).write11();

newsArray[3] = new makeNews("92-year-old to graduate from UH with a bachelor degree in math","Crossing the stage to graduate from the University of Houston, summer 2007 semester culminated a quest that Henry Pitcher, 92, began 75 years ago.",'http://www.math.uh.edu/Matweb/New_events/5.8.07-92-year-old.htm','Full Story',listImg4).write11();

// this is Amundson lecture anual event, may reuse every year.
newsArray[6] = new makeNews("Amundson Lecture Series 2008.","The Department of Mathematics will host the Amundson Lecture Series by Professor Jerrold Marsden in 2008. The lectures will be held on April 9-11, 2008 at the University of Houston.",'http://www.math.uh.edu/amundsonlectureseries/','Read more',listImg7).write11();

newsArray[2] = new makeNews("In the mid-eighties Siemion Fajtlowicz wrote a computer program to invent conjectures. These conjectures quickly began to inspire papers by other mathematicians, including the noted mathematician Paul Erdos.","Recent versions of this program are used for learning mathematics and for making conjectures about three forms of carbon molecules, including Buckyballs.",'http://www.math.uh.edu/~siemion/','Read more',listImg6).write11();
*/
newsArray[2] = new makeNews("Featured Article: Bernhard G. Bodmann","Bernhard Bodmann's research focuses on harmonic and functional analysis and related design problems in signal communications and signal processing. ",'http://www.math.uh.edu/Matweb/faculty/Featured_article_Bodmann.html','Read more',listImg6).write11();

newsArray[1] = new makeNews("Bull's-eye: Programs targeting Math, Science teacher shortage may get boost","National Math and Science Initiative Names UH as Potential Recipient of $2.4 Million Grant to Replicate UTeach.",'http://www.uh.edu/admin/media/nr/2007/07july/071707nmsigrant.html','Full Story',listImg5).write11();



newsArray[0] = new makeNews("teachHOUSTON: graduate with teacher certification.","If you are an undergraduate who wants to teach mathematics, science or computer science at the middle or high school level, then teachHOUSTON is a program for you.",'http://teachhouston.uh.edu/','Learn more',listImg7).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('ad3').innerHTML = newsArray[randpic11];
	if (randpic11 == len - 2){
		randpic1 = len-1;
		randpic2 = 0;
		document.getElementById('ad1').innerHTML = newsArray[randpic1];
		document.getElementById('ad2').innerHTML = newsArray[randpic2];
	}
	else if (randpic11 == len-1){
		randpic1 = 0;
		randpic2 = randpic1 +1;
		document.getElementById('ad1').innerHTML = newsArray[randpic1];
		document.getElementById('ad2').innerHTML = newsArray[randpic2];
	}
	else {
		randpic1 = randpic11+1;
		randpic2 = randpic1 +1;
		document.getElementById('ad1').innerHTML = newsArray[randpic1];
		document.getElementById('ad2').innerHTML = newsArray[randpic2];
	}
	//nIndex++;
	//timerID = setTimeout('rotateNews()',6000);
}
/*

//this function try to keep the one fix the first and other 2 rotate. for forcusing news purpose.
function rotateNews(){
	var len = newsArray.length -1;
	fix = 4;  // the new to be fixed. fix the last one
	//if(nIndex >= len)
		//nIndex = 0;
	document.getElementById('ad3').innerHTML = newsArray[randpic11];
	if (randpic11 == len - 2){
		randpic1 = len-1;
		randpic2 = 0;
		document.getElementById('ad1').innerHTML = newsArray[fix]; //fix the last new 
		document.getElementById('ad2').innerHTML = newsArray[randpic2];
	}
	else if (randpic11 == len-1){
		randpic1 = 0;
		randpic2 = randpic1 +1;
		document.getElementById('ad1').innerHTML = newsArray[fix];
		document.getElementById('ad2').innerHTML = newsArray[randpic2];
	}
	else {
		randpic1 = randpic11+1;
		randpic2 = randpic1 +1;
		document.getElementById('ad1').innerHTML = newsArray[fix];
		document.getElementById('ad2').innerHTML = newsArray[randpic2];
	}
	//nIndex++;
	//timerID = setTimeout('rotateNews()',6000);
}
*/
rotateNews();