/*
   Background Image Transition Slide Show
   Version 1.0
   October 25, 2010

   Will Bontrager
   http://www.willmaster.com/
   Copyright 2010 Bontrager Connection, LLC

   Bontrager Connection, LLC grants you 
   a royalty free license to use or modify 
   this software provided this notice appears 
   on all copies. This software is provided 
   "AS IS," without a warranty of any kind.
*/

var Images = new Array(); // leave line as is.

// Customization info is in the "Background Image Transition 
//    Slide Show" article in the Willmaster Library at 
//    http://www.willmaster.com/library/

var ImageIDvalue = "image";

var TransitionIncrement = 1;

var IncrementInterval = 1;

var PauseBeforeNextImage = 1500;

Images.push("images/img_main_header3.jpg");
Images.push("images/img_main_header4.jpg");
Images.push("images/img_main_header5.jpg");



// End of customization section. //

var opacity = 100;
var currentImage = 0;
var topImage = Images.length - 1;
var image = document.getElementById(ImageIDvalue);
var IE = (image.filters) ? true : false;
var timerthing;

function FadeIn() {
opacity += TransitionIncrement;
if( opacity >= 100 ) { opacity = 100; }
if( IE ) { image.filters.alpha.opacity = opacity; }
else { image.style.opacity = opacity/100; }
if( opacity == 100 ) {
   clearInterval(timerthing);
   setTimeout("StartFadeOut()",PauseBeforeNextImage);
   }
}

function FadeOut() {
opacity -= TransitionIncrement;
if( opacity <= 0 ) { opacity = 0; }
if( IE ) { image.filters.alpha.opacity = opacity; }
else { image.style.opacity = (opacity==0) ? 0 : opacity/100; }
if( opacity == 0 ) {
   clearInterval(timerthing);
   currentImage++;
   if( currentImage > topImage ) { currentImage = 0; }

   image.style.background = "url("+Images[currentImage]+") no-repeat center";
   timerthing = setInterval("FadeIn()",IncrementInterval);
   }
}

function StartFadeOut() { timerthing = setInterval("FadeOut()",IncrementInterval); }

function StartSlideShowTransition() {
setTimeout("StartFadeOut()",PauseBeforeNextImage);
}

StartSlideShowTransition();

