// Revised 12-15-08 (VV)

// Added for special popup window link
function open_release(url) {
release_window = window.open(url,"release","width=760,height=500,menubar=yes,toolbar=1,resizable=1,scrollbars=1,top=35,left=100");
}


// Random News Stories Script
// ITS Web Services, Enterprise Systems
// Adapted from http://www.scratchprojects.com/2006/03/random_story_using_javascript_p01.php
// Modified on Steroids by Jim Soha, 3/7/07

function randomIndex(lobound,hibound) {
	return (Math.floor(Math.random()*(hibound+1-lobound))+lobound);
}

function randomStory(numShow) {

/***************************************************************************

This script displays stories at random from the entries below. Each story 
entry is broken up into lists for Photos, Links, Titles and Stories.

There is a place in the HTML web page code where you set how many stories
are to be displayed at a time.

You can have as many or as few story entries as you want. See below for the
place in this script where you specify how many entries you want to use.

For instance, if you want to have just 10 stories to choose from, 
enter numAll=10 at the place below. The script will then draw from 
entries 0-9 only, and will ignore the remaining entries 10-14. You can 
add or remove entries as you wish, just maintain the consecutive ordering.

The entries must be numbered starting with [0].

***************************************************************************/

// Photos - images can have any valid file name
// Note: all photos must have the same size, width="140" height="95"
// var fixedphoto="random_stories/images/thumb_sph.jpg"
var photo=new Array()
photo[0]="random_stories/images/thumb_yuhs.jpg"
photo[1]="random_stories/images/thumb_sph.jpg"
photo[2]="random_stories/images/thumb_sackler.jpg"
photo[3]="random_stories/images/thumb_oster.jpg"
photo[4]="random_stories/images/thumb_construction.jpg"
photo[5]="random_stories/images/thumb_youn.jpg"
photo[6]="random_stories/images/thumb_fox.jpg"
photo[7]="random_stories/images/thumb_schoelkopf.jpg"
photo[8]="random_stories/images/thumb_barger2.jpg"
photo[9]="random_stories/images/thumb_spethschol.jpg"
photo[10]="random_stories/images/thumb_disneyhauser.jpg"
photo[11]="random_stories/images/thumb_bulldogs.jpg"
photo[12]="random_stories/images/thumb_chang.jpg"



// Links to Stories
// var fixedlink="http://newresidentialcolleges.yale.edu/"
// var fixedlink="javascript:open_release('http://opa.yale.edu/news/article.aspx?id=5970')"
// var fixedlink="http://publichealth.yale.edu/challenge/"
var link=new Array()
link[0]="../news/yuhs.html"
link[1]="http://publichealth.yale.edu/challenge/"
link[2]="../news/sackler.html"
link[3]="../news/oster.html"
link[4]="../news/construction.html"
link[5]="../news/youn.html"
link[6]="../news/foxfoundation.html"
link[7]="../news/schoelkopf.html"
link[8]="../news/barger.html"
link[9]="javascript:open_release('http://opa.yale.edu/news/article.aspx?id=6738')"
link[10]="../news/disneyhauser.html"
link[11]="../news/bulldogs_israel.html"
link[12]="javascript:open_release('http://opa.yale.edu/news/article.aspx?id=7070')"





// Titles
// var fixedtitle="Yale Launches Public Health Challenge"
var title=new Array()
title[0]="Construction Under Way for New Health Services Center"
title[1]="Yale Launches Public Health Challenge"
title[2]="Gift Funds New Institute for Sciences"
title[3]="Anonymous Gift Celebrates Student–Faculty Connection"
title[4]="Yale Tomorrow Campaign Helps Transform Yale’s Campus"
title[5]="Yale Alum Acts Against Hunger"
title[6]="Fox Foundation Funds Work on Parkinson’s Disease"
title[7]="A Conversation with Robert J. Schoelkopf"
title[8]="Yale Dedicates First On-Campus Micro Wind Turbines"
title[9]="Financial Aid Fund grows in Environment School"
title[10]="Alumni Offer Aid for International Students"
title[11]="Bulldogs Return to Campus after Summer in Israel"
title[12]="Scholar of Chinese Literature Named Chace Professor"


// Story Blurbs - Each entry must be written all on one line!
// remember to use \ (backslash) to escape reserved characters like / ? . " '
// for open single quote use= &lsquo; closed single quote= &rsquo;
// apostrophe= &rsquo;
// abbreviate year=
// HTML decimal entities = &#8216; &#8217;
// HTML named entities = &lsquo; &rsquo;
// var fixedstory="Two Yale College alumni match gifts for financial aid and innovation shaping human health around the globe."
var story=new Array()
story[0]="The state-of-the-art facility will support Yale’s ability to provide healthcare to students, faculty, and staff."
story[1]="Two Yale College alumni match gifts for financial aid and innovation shaping human health around the globe."
story[2]="Research collaboration among Yale scientists has gained momentum, thanks to a gift from Dr. Raymond and Beverly Sackler."
story[3]="A $1 million gift will establish the Sharon Oster Resource Fund for Undergraduate Teaching and Engagement."
story[4]="Thanks to the generosity of alumni, parents, and friends, construction is transforming the University landscape."
story[5]="Financial aid opens doors for people and ideas that change the world—like Andrew Youn ’00 and his One-Acre Fund."
story[6]="Imaging molecules in the living brain, Mark Saltzman and Michael Levene uncover new paths for drug delivery."
story[7]="Yale professor lays important groundwork for putting quantum computers into real practice."
story[8]="Yale University recently celebrated the inauguration of the Prospect Street Windmill Project."
story[9]="Alumni, faculty, and friends honor outgoing dean Gus Speth."
story[10]="Dr. Abigail E. Disney and Pierre N. Hauser II provide support for Yale’s Environment School"
story[11]="The first participants in a new Bulldogs program gained direct experience with Israeli culture."
story[12]="Kang-i Sun Chang is the inaugural Malcolm G. Chace ’56 Professor of East Asian Languages and Literatures."




// Here is where you specify the number of stories you want to draw from
var numAll=13
//	fixedposition=1 

var availNdx=new Array()

for (i=0; i<numAll; i++)
	availNdx[i]=i;

for (j=0; j<numShow; j++) {
    tempNdx=randomIndex(j,numAll-1)
	ran_num=availNdx[tempNdx];
//	if (j==fixedposition-1) {
//	document.write('<table cellspacing="0" class="photo-box"><tbody><tr><td class="pic"><img src="'+fixedphoto+'" width="140" height="95" border="0" \/><\/td>');
//	document.write('<td class="txt"><p><strong><a href="'+fixedlink+'">'+fixedtitle+'<\/a></strong><br \/>'+fixedstory+'&nbsp;');
//	document.write('<a href="'+fixedlink+'">Read more.<\/a><\/p><\/td><\/tr><\/tbody><\/table>');
//	}
//	else {
	document.write('<table cellspacing="0" class="photo-box"><tbody><tr><td class="pic"><img src="'+photo[ran_num]+'" width="140" height="95" border="0" \/><\/td>');
	document.write('<td class="txt"><p><strong><a href="'+link[ran_num]+'">'+title[ran_num]+'<\/a></strong><br \/>'+story[ran_num]+'&nbsp;');
	document.write('<a href="'+link[ran_num]+'">Read more.<\/a><\/p><\/td><\/tr><\/tbody><\/table>');
//	}
	availNdx[tempNdx]=availNdx[j];
}

}



