/* 

Code for randomly selecting an image and loading it in the banner.

To use, simply add the following to the <head> of each page:

<script src="/scripts/jquery-1.4.2.min.js"></script>
<script src="/scripts/random_banner.js"></script>

*/


// Path to images, must end in '/'
var path = '/images/banner/';

// List of image filenames
var images = ['banner1.jpg', 'banner2.jpg', 'banner3.jpg', 'banner4.jpg', 'banner5.jpg',
              'banner6.jpg', 'banner7.jpg', 'banner8.jpg', 'banner9.jpg', 'banner10.jpg'];

$(function() {
  // Pick a random index into images
  i = (Math.random() * images.length) | 0;

  // Construct the url for the randomly chosen image
  image_url = path + images[i];

  // Set the background-image style of the banner to the chosen image
  $('#banner').css('background-image', 'url(\'' + image_url +  '\')');
});
