/**************** IMAGE SLIDE HOLDER ****************/
document.writeln('<table width="100%" cellspacing="0" cellpadding="0"><tr><td id="featured"><!--START IMAGE SLIDES--><div><a id="featureNewsImageLink" href="http://www.nrao.edu/nraoRSS.xml"><img src="http://www.nrao.edu/images_news/other/megamaser.jpg" alt="NRAO News" name="featureNewsImage" width="526" height="112" id="featureNewsImage" style="border:1px solid #798691; border-bottom:none;" /></a><div id="controller" style="width:526px;"> <a href="http://www.nrao.edu/nraoRSS.xml"><img src="http://www.nrao.edu/images/logos/rssnewsfeed2.gif" alt="RSS News Feed" width="91" height="20" border="0" style="margin:2px 0px 0px 2px;" /></a> <a href="http://twitter.com/astroNRAO"><img src="http://www.nrao.edu/images/logos/twitter2.gif" alt="Twitter" width="91" height="20" border="0" style="margin:2px 0px 0px 2px;" /></a> <a href="http://www.facebook.com/groups.php?ref=sb#/group.php?gid=8051833826"><img src="http://www.nrao.edu/images/logos/facebook2.gif" alt="Facebook" width="91" height="20" border="0" style="margin:2px 0px 0px 2px;" /></a> <a href="http://www.youtube.com/user/astroradio"><img src="http://www.nrao.edu/images/logos/youtube2.gif" alt="YouTube" width="91" height="20" border="0" style="margin:2px 10px 0px 2px;" /></a>');
document.writeln('<a id="prev" href="#" onclick="clearTimeout(t2); chgNewsImg(-1); pause(this);"></a>');
document.writeln('<a id="pp" class="pause" href="#" onclick="pause(this);"></a>');
document.writeln('<a id="next" href="#" onclick="clearTimeout(t2); chgNewsImg(1); pause(this);"></a>');
document.writeln('<div id="locator"># of #</div></div></div><!--END IMAGE SLIDES--></td></tr><tr><td>');



/**************** NEWS ITEMS ****************/
/*************************
news[NUMBER] = [
	"TITLE",
	"DATE",
	"INTRO",
	"LINK",
	"IMAGE",
	"science, epo, or both"];
*************************/
var news = [];
news[0] = [
	"Dr. Anthony Readhead Awarded the 2009 Jansky Lectureship",
	20090604,
	"The National Radio Astronomy Observatory is pleased to announce that the 2009 Karl G. Jansky Lectureship has been awarded to Dr. Anthony C. S. Readhead, Director of the Owens Valley Radio Observatory, Caltech...",
	"http://www.nrao.edu/jansky/2009/readhead.shtml",
	"http://www.nrao.edu/images_news/other/jansky.jpg",
	"science"];
news[1] = [
	"The NRAO and the Astro2010 Decadal Survey",
	20090609,
	"nointro",
	"http://www.nrao.edu/A2010/",
	"http://www.nrao.edu/images_news/other/astro2010.jpg",
	"science"];
news[2] = [
	"Read NRAO Responses to Questions from Decadal Survey RMS Panel",
	20090609,
	"nointro",
	"http://www.nrao.edu/A2010/rfi/RMS_PanelResponse_NRAO_Director.pdf",
	"http://www.nrao.edu/images_news/other/astro2010_responses.jpg",
	"science"];
news[3] = [
	"Frontier Gravitational Physics Advancement",
	20090901,
	"Scientists using a continent-wide array of radio telescopes have made an extremely precise measurement of the curvature of space caused by the Sun's gravity, and their technique promises a major contribution to a frontier area of basic physics.",
	"http://www.nrao.edu/pr/2009/gravity/",
	"http://www.nrao.edu/images_news/vlba/gravity.jpg",
	"both"];
news[4] = [
	"The VLA Helps Explain the Activity of Black Holes at the Centers of Galaxy Clusters ",
	20090911,
	"nointro",
	"http://www3.uni-bonn.de/Press-releases/a-fresh-log-on-a-smouldering-fire",
	"http://www.nrao.edu/images_news/other/blackholes.jpg",
	"both"];
news[5] = [
	"High-School Student Discovers Strange Astronomical Object",
	20090922,
	"A West Virginia high-school student analyzing data from a giant radio telescope has discovered a new astronomical object -- a strange type of neutron star called a rotating radio transient...",
	"http://www.nrao.edu/pr/2009/pulsarstudent/",
	"http://www.nrao.edu/images_news/other/bolyard.jpg",
	"both"];
news[6] = [
	"ALMA Telescope Reaches New Heights",
	20090923,
	"The ALMA (Atacama Large Millimeter/submillimeter Array) astronomical observatory took another step forward and upward...",
	"http://www.nrao.edu/pr/2009/antennahigh/",
	"http://www.nrao.edu/images_news/naasc/antennahigh.jpg",
	"both"];
news[7] = [
	"High-School Astronomy Sleuth Meets President Obama",
	20091008,
	"Lucas Bolyard, the West Virginia high-school student who discovered a strange neutron star using data from NRAO's Robert C. Byrd Green Bank Telescope (GBT), was a guest of honor at the White House star party Wednesday night, October 7. President Obama, in his opening remarks at the star party, introduced Bolyard, who stood next to the podium as the President said...",
	"http://www.nrao.edu/pr/other/obama/",
	"http://www.nrao.edu/images_news/other/obama.jpg",
	"both"];
news[8] = [
	"NRAO October eNews, Volume 2, Issue 10",
	20091014,
	"nointro",
	"http://www.nrao.edu/news/newsletters/",
	"http://www.nrao.edu/images_news/enews/enews.jpg",
	"both"];
news[9] = [
	"Blast from the Past Gives Clues About Early Universe",
	20091028,
	"Astronomers using the National Science Foundation's Very Large Array (VLA) radio telescope have gained tantalizing insights into the nature of the most distant object ever observed in the Universe -- a gigantic stellar explosion known as a Gamma Ray Burst (GRB)...",
	"http://www.nrao.edu/pr/2009/grbz8/",
	"http://www.nrao.edu/images_news/vla/grbz8.jpg",
	"both"];
news[10] = [
	"Gamma-ray Sources Guide Astronomers to Pulsars",
	20091106,
	"WASHINGTON - Energetic gamma rays are providing astronomers with a new way to hunt those hard-to-find whirling dervishes known as pulsars...",
	"http://www.sciencenews.org/view/generic/id/49198/title/Gamma-ray_sources_guide_astronomers_to_pulsars",
	"http://www.nrao.edu/images_news/other/pulsars.jpg",
	"both"];
news[11] = [
	"Close-Up Movie Shows Hidden Details in the Birth of Super-Suns",
	20091116,
	"Cambridge, MA - The constellation of Orion is a hotbed of massive star formation, most prominently in the Great Nebula that sits in Orion's sword. The glowing gas of the Nebula is powered by a group of young massive stars, but behind it is a cluster of younger stars and clumps of gas. Still gathering together under gravity's pull, these gas clumps will eventually ignite into stars...",
	"http://www.cfa.harvard.edu/news/2009/pr200922.html",
	"http://www.nrao.edu/images_news/other/supersuns.jpg",
	"both"];
news[12] = [
	"Record-Breaking Radio Astronomy Project to Measure Sky with Extreme Precision",
	20091116,
	"Astronomers will tie together the largest collection of the world's radio telescopes ever assembled to work as a single observing tool in a project aimed at improving the precision of the reference frame scientists use to measure positions in the sky...",
	"http://www.nrao.edu/pr/2009/bigvlbi/",
	"http://www.nrao.edu/images_news/vlba/bigvlbi.jpg",
	"both"];
var news2 = [];
for (j=0; j<news.length; j++){
	news2[j] = news[news.length-1-j];
}
var featureNewsImage = [];
var featureNewsImageLink = [];
for (i=0; i<news2.length; i++){
	if ((audience == news2[i][5]) || (news2[i][5] == "both")){
		document.writeln('<p id="news' + i + '">');
		document.writeln('<a href="' + news2[i][3] + '">');
		document.writeln('<span class="newsTitle">' + news2[i][0] + '</span> ');
		document.writeln('(' + processDate(news2[i][1]) + ')');
		if (news2[i][2] != "nointro"){document.writeln(': ' + news2[i][2]);}
		document.writeln('</a></p>');
	}
	featureNewsImage[i] = news2[i][4];
	featureNewsImageLink[i] = news2[i][3];
}
/*END NEWS ITEMS SCRIPT*/
var items;
var itemsSCI = 0;
var itemsEPO = 0;
for (i=0; i<news.length; i++){
	if ((news[i][5] == "science")||(news[i][5] == "both")){
		itemsSCI++;
	}
	if ((news[i][5] == "epo")||(news[i][5] == "both")){
		itemsEPO++;
	}
}
var newsItems;
if (audience == "epo"){
	newsItems = itemsEPO;
} else {
	newsItems = itemsSCI;
}
/*if (audience == "science"){
	items = itemsSCI;
	document.writeln('<p>' + items + '</p>');
} else {
	items = itemsEPO;
	document.writeln('<p>' + items + '</p>');
}*/



/**************** IMAGE SLIDE SWAPPER ****************/
var imgNewsNum = 0;   /*(Math.floor(Math.random()*newsItems));*/
var t2;
var rowNum;
function chgNewsImg(direction){	
	rowNum = imgNewsNum;
	document.getElementById('news'+rowNum).className = "";   /*Clear previously highlighted row...*/
	imgNewsNum = imgNewsNum + direction;   /*Add the direction ... -1, 0, or 1 ... to the current image number.*/
	if(imgNewsNum >= newsItems){   /*If it passes the end of the image array, go to the beginning.*/
		imgNewsNum = 0;
	}
	if(imgNewsNum < 0){   /*If it passes the beginning of the image array, go to the end.*/
		imgNewsNum = newsItems - 1;
	}
	document.getElementById('featureNewsImage').setAttribute("src", featureNewsImage[imgNewsNum]);   /*Set the image source...*/
	document.getElementById('featureNewsImageLink').setAttribute("href", featureNewsImageLink[imgNewsNum]);   /*Set the image link...*/
	document.getElementById('news'+imgNewsNum).className = "currentNews";   /*Highlight the cooresponding row...*/
	displayNumber = imgNewsNum + 1;   /*Set the display number to one more than the JavaScript count number...*/
	document.getElementById('locator').innerHTML = displayNumber + " of " + newsItems;   /*...and display "# of #" with previous and next buttons.*/
	t2 = setTimeout ("chgNewsImg(1)", 4000);
}
function pause(btn){
	btn.blur();
	clearTimeout(t2);
	document.getElementById('pp').className = "play";
	document.getElementById('pp').setAttribute("onclick", "play(this);");
}
function play(btn){
	btn.blur();
	document.getElementById('pp').className = "pause";
	document.getElementById('pp').setAttribute("onclick", "pause(this);");
	chgNewsImg(1);
}
if(document.getElementById('featureNewsImage')){   /*If there is a feature image on the page after loading (the home page)...*/
	chgNewsImg(0);   /*Set it to the random number.*/
}
document.writeln('</td></tr></table>');