
// Random News Stories Script
// ITS Web Services, Enterprise Systems
// Adapted from http://www.scratchprojects.com/2006/03/random_cutline_using_javascript_p01.php
// Modified on Steroids by Jim Soha, 3/7/07

// Adapted with Next/Previous buttons by Nick Appleby, 1/25/08

function randomIndex(lobound,hibound) {
	return (Math.floor(Math.random()*(hibound+1-lobound))+lobound);
}

function randomSplash(thenumber) {
	
// Here is where you specify the number of cutlines you want to draw from
var numAll=11
	
if (thenumber==undefined) {
	
	tempNdx=randomIndex(0,numAll-1);
//	tempNdx=8; // Here is where you set the starting splash item
	
} else {
	
	tempNdx=thenumber;
	if (tempNdx>=numAll) {
		tempNdx=0;
	}
	if (tempNdx<0) {
		tempNdx=numAll-1;
	}
}
	

/***************************************************************************

This script displays stories at random from the entries below. Each cutline 
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 cutline 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].

***************************************************************************/
var photo=new Array()
photo[0]="random_stories/splash/hm_jacksons.jpg"
photo[1]="random_stories/splash/hm_greenberg.jpg"
photo[2]="random_stories/splash/hm_steitz.jpg"
photo[3]="random_stories/splash/hm_foster.jpg"
photo[4]="random_stories/splash/hm_morserenovations.jpg"
photo[5]="random_stories/splash/hm_smilowopen.jpg"
photo[6]="random_stories/splash/hm_damilola.jpg"
photo[7]="random_stories/splash/hm_sacklersymp.jpg"
photo[8]="random_stories/splash/hm_rosencranz.jpg"
photo[9]="random_stories/splash/hm_calhounded.jpg"
photo[10]="random_stories/splash/hm_gwathmey.jpg"




// Links to Stories
var link=new Array()
link[0]="javascript:open_release('http://opa.yale.edu/news/article.aspx?id=6560')"
link[1]="../news/greenbergded.html"
link[2]="javascript:open_release('http://opa.yale.edu/news/article.aspx?id=6948')"
link[3]="../news/foster.html"
link[4]="../news/morserenovation.html"
link[5]="javascript:open_release('http://www.yalecancercenter.org/news/2009releases/oct2109-Smilow-Cancer-Hospital-dedication.html')"
link[6]="../news/oladeru.html"
link[7]="../news/sacklersymp.html"
link[8]="../news/rosenkranz.html"
link[9]="../news/calhoun.html"
link[10]="../news/gwathmey.html"


// Cutlines - 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 cutline=new Array()
cutline[0]="A transformational gift of $50 million has established the Jackson Institute for Global Affairs at Yale."
cutline[1]="Yale University has dedicated the Maurice R. Greenberg Conference Center as a new home for international programs."
cutline[2]="Yale’s Thomas Steitz is one of three winners of the 2009 Nobel Prize in Chemistry."
cutline[3]="Noted architect and alumnus Norman Foster, left, has donated $3 million for a visiting professorship in the School of Architecture."
cutline[4]="With the continued support of generous donors, Morse College became the eleventh residential college to undergo renovation."
cutline[5]="Donors Joel and Joan Smilow (third and fourth from left) joined with Yale and city leaders to dedicate the Smilow Cancer Hospital."
cutline[6]="Oluwadamilola Oladeru &rsquo;11 came to Yale to receive a well-rounded liberal arts education and to participate in a strong biology program."
cutline[7]="The Raymond and Beverly Sackler Institute for Biological, Physical, and Engineering Sciences was formally dedicated October 16."
cutline[8]="Rosenkranz Hall was officially dedicated at a ceremony honoring Yale benefactors Robert Rosenkranz ’62 and Alexandra Munroe."
cutline[9]="More than 100 members of the Calhoun College community gathered recently to celebrate the renewal of their beloved residential college."
cutline[10]="Ralph Lauren has established a professorship in memory of architect Charles Gwathmey."


nextNumber=tempNdx+1;
prevNumber=tempNdx-1;

splashString = '<a href="'+link[tempNdx]+'"><img src="'+photo[tempNdx]+'" width="538" height="314" border="0" alt="" \/><\/a>';
splashString = splashString + '<table id="splashtable" width="538" cellspacing="0" cellpadding="0" bgcolor="#0073ae"><tr>';
splashString = splashString + '<td><p class="cutline">'+cutline[tempNdx]+'&nbsp;<a href="'+link[tempNdx]+'">Read more.<\/a><\/p><\/td>';
splashString = splashString + '<td width="65"><p class="cutline"><a href="javascript:randomSplash('+prevNumber+')"><img src="images/previous.gif" alt="Previous" name="button_prev" width="15" height="18" border="0" id="button_prev" \/><\/a>';
splashString = splashString + '&nbsp;&nbsp;<a href="javascript:randomSplash('+nextNumber+')"><img src="images/next.gif" alt="Next" name="button_next" width="15" height="18" border="0" id="button_next" \/><\/a><\/p><\/td>';
splashString = splashString + '<\/tr><\/table>';

document.getElementById('splashdiv').innerHTML=splashString;
}
