/* This script and many more are available free online at
The JavaScript Source :: http://javascript.internet.com
Created by: Lee Underwood :: http://javascript.internet.com/ */

(function($) {

   $.fn.transictionto = function(options) {
      var settings = $.extend({
   }, options || {});
   //wrap into div if no div is present.
   $(this).each(function() {
      if ($(this).parent('div').size() == 0) {
         $(this).wrap('<div></div>')
      }
      //now swap with background trick
      $(this)
      .parent()
         .css('background-image', 'url(' + settings.destinationImage + ')')
         .css('background-repeat', 'no-repeat')
      .end()
      .fadeOut(1000, function() {
         this.src = settings.destinationImage;
         $(this).show();
      });
   });
};
})(jQuery);

var bannerImg = new Array();
  // Enter the names of the images below
  bannerImg[0]="images/CIWBanner05.jpg";
  bannerImg[1]="images/CIWBanner.jpg";
  bannerImg[2]="images/CIWBanner08.jpg";
  bannerImg[3]="images/CIWBanner07.jpg";
  bannerImg[4]="images/CIWBanner04.jpg";
  bannerImg[5]="images/CIWBanner06.jpg";
  bannerImg[6]="images/CIWBanner09.jpg";
  bannerImg[7]="images/CIWBanner03.jpg";
  bannerImg[8]="images/CIWBanner02.jpg";

var newBanner = 0;
var totalBan = bannerImg.length;

function cycleBan() {
  newBanner++;
  if (newBanner == totalBan) {
    newBanner = 0;
  }
  $('#banner img').transictionto({ destinationImage: bannerImg[newBanner] });
  //document.banner.src=bannerImg[newBanner];
  // set the time below for length of image display
  // i.e., "4*1000" is 4 seconds
  setTimeout("cycleBan()", 6*1000);
}
window.onload=setTimeout("cycleBan()", 6*1000);
