/* Utility JavaScript functions

   (c) School of Computing, University of Leeds 2001

*/


function imageRoll(imgname,action) {

  /* Executes image rollovers
     Jonathan Ainsworth 2/01
  */
  if (document.images) {
    if (action.toLowerCase() == 'click') {
      document.images[imgname].src = "/images/" + imgname + "_c.jpg";
    }
    else if (action.toLowerCase() == 'over') {
      document.images[imgname].src = "/images/" + imgname + "_o.jpg";
    }
    else if (action.toLowerCase() == 'out') {
      document.images[imgname].src = "/images/" + imgname + ".jpg";
    }
  }
  return true;
}


function lastUpdated() {

  /* Prints out when the host HTML document was last updated
     Jonathan Ainsworth 2/01
  */

  if (document.lastModified) {
     var lastmod = new Date(document.lastModified);
	 var months = new makeArray(12);
	 months[0] = 'Jan';
	 months[1] = 'Feb';
	 months[2] = 'Mar';
	 months[3] = 'Apr';
	 months[4] = 'May';
	 months[5] = 'Jun';
	 months[6] = 'Jul';
	 months[7] = 'Aug';
	 months[8] = 'Sep';
	 months[9] = 'Oct';
	 months[10] = 'Nov';
	 months[11] = 'Dec';

     if (lastmod.getYear() > 1995) {
        document.write('Last updated: ');
//        document.write(lastmod.toLocaleString());
		document.write(lastmod.getDate() + ' ' + months[lastmod.getMonth()] + ' ' + lastmod.getYear());
     }
  }
  return true;
}


function makeArray(n) {

  /* Creates an array - safer than using new Array
     Jonathan Ainsworth 3/01
  */
  
  this.length = n;
  for (var i=0;i<n;i++) {
     this[i] = 0;
  }
  return this;
}

