// How it all works
// 1. If you're adding an item, edit the line 
// 
//    var numofItems = x 
// 
// to reflect the total number of items to be displayed
// 
// 2. All you need to is to add or edit the items to the lists. 
// All the news items
// 
// need the same number: eg: BookTitle[1], BookPictures[1], and CatLink[1] 
// all refer to the same story.
// 
// 3. All the numbering starts with 0 and increments upwards.
// eg, BookTitle[0], BookTitle[1], BookTitle[2] etc.
// 
// 4. If you have more items than NumofItems, then the ones 
// above that value won't display.
// 
// 5. If you have fewer than that number, it causes an error, so please 
// make sure you edit it is required.
// 


function NewBooks()
{

// The line below determines the total number of news items.

  var numofItems = 5 ;
  var randomnumberBooks = Math.random();
  var ItemNo = Math.round( (numofItems-1) * randomnumberBooks) ;


// Add the title of the news items here.

  var  BookTitle = new Array(numofItems);
    BookTitle[0] = "Featured Book:<br>The teachable moment";
    BookTitle[1] = "Featured Book:<br>Why we make art";
    BookTitle[2] = "Featured Book:<br>Adolescents on the edge";
    BookTitle[3] = "Featured Book:<br>The pedagogy of creativity";
    BookTitle[4] = "Featured Book:<br>Developmentally appropriate play";




	
// Add the location of the associated picture here

  var  BookPictures = new Array(numofItems);
    BookPictures[0] = "./Edlibbookscript/moment.jpg";
    BookPictures[1] = "./Edlibbookscript/art.jpg";
    BookPictures[2] = "./Edlibbookscript/edge.jpg";
    BookPictures[3] = "./Edlibbookscript/pedagogy.jpg";
    BookPictures[4] = "./Edlibbookscript/play.gif";



	
// Add the catalogue link here (make sure its a permanent link).
  var CatLink = new Array(numofItems);
    CatLink[0] = "http://resolve.library.ubc.ca/cgi-bin/catsearch?isbn=9781427799678";
    CatLink[1] = "http://resolve.library.ubc.ca/cgi-bin/catsearch?isbn=9781841503783";
    CatLink[2] = "http://resolve.library.ubc.ca/cgi-bin/catsearch?isbn=9780325026916";
	CatLink[3] = "http://resolve.library.ubc.ca/cgi-bin/catsearch?isbn=9780415548878";
    CatLink[4] = "http://resolve.library.ubc.ca/cgi-bin/catsearch?isbn=9781605540375";







// This is the part that writes to the web page. Don't edit it unless
// you know what you're doing, please.


//document.write('<p>');
document.write('<a href="' +  CatLink[ItemNo] + '" >');
document.write('<img src="');
document.write(BookPictures[ItemNo]);
document.write('" border="0" />');
document.write('</a>');

document.write('<br />');

document.write('<a href="' +  CatLink[ItemNo] + '" >');
document.write(BookTitle[ItemNo]);
document.write('</a>');


//document.write('</p>');
}







