******************************************************
**************************************************************************************************
***************************************************************************/
/*

  Usage:

  banner.add ( "image_url", "link_url" )

*/

var banner = new banner();

banner.add(
  "/staff/templates/main/images/employment.jpg",
  "http://www.coramdeoacademy.org/content/employment/index.php"
);
banner.add(
  "/staff/templates/main/images/new_may.jpg",
  "http://www.accsedu.org/page.aspx?id=36671"
);
banner.add( 
  "/staff/templates/main/images/podcastbanner.jpg",
  "http://www.coramdeoacademy.org/content/announcements/podcast.php"
);

/***************************************************************************
** THIS CAN'T BE EDITED ****************************************************
***************************************************************************/

function bannerImage(src, link) {
  this.src = src;
  this.link = link;
  this.cache = new Image();
  this.cache.src = this.src;
}

function banner() {
  this.images = [];
  this.currentImage = 0;

  this.add = function( src, link ) {
    this.images[this.images.length] = new bannerImage( src, link );
  }

  this.current = function() {
    return this.images[this.currentImage];
  }

  this.reset = function() {
    this.currentImage = 0;
  }

  this.advance = function() {
    this.currentImage++;
    if( this.currentImage > (this.images.length-1) ) this.reset();
  }

}

function advanceBanner( link_id, image_id ) {
  if( !document.getElementById ) return;
  if( !banner || banner.images.length == 0 ) return;
  image = banner.current();
  banner_link = document.getElementById( link_id );
  banner_link.href = image.link;
  banner_image = document.getElementById( image_id );
  banner_image.src = image.src;
  banner.advance();
  setTimeout( "advanceBanner('"+link_id+"','"+image_id+"')", 10000 );
}