/*  **************************************************************************************************  */
/*  This program is copyright 2011 by LightningStrike Studios (http://www.lightningstrikestudios.com/)  */
/*  It is provided under a Creative Commons Attribution-NonCommercial-ShareAlike license.               */
/*  This means you may use, remix, tweak, and build upon this work so long as                           */
/*  you do not charge for it or sell it, and so long as you include this license notice                 */
/*  and a link to http://www.lightningstrikestudios.com/                                                */
/*  **************************************************************************************************  */


// IMAGE SLIDESHOW V6


// SET UP COUNTERS
var count=0;
var timer;
var doflipper=1;	// 1 to enable image flip
var imagecount= 12;   // UPDATE FOR slideshowX.jpg IMAGES
var width=500;       // UPDATE FOR IMAGE WIDTH
var height=375;      // UPDATE FOR IMAGE HEIGHT
var scale;
var lastimagedelay=1;	// 1 for last image delay, 0 for no delay


// SETS THE OPACITY OF THE GRAPHIC, FOR BOTH REAL BROWSERS AND IE
function setopacity(value)
{
// slideshow.style.-ms-filter = 'progid:DXImageTransform.Microsoft.Alpha(Opacity=' + value*10 + ')';
// slideshow.style.filter = 'alpha(opacity=' + value*10 + ')';
// slideshow.style.opacity = value/10;

// document.getElementById('slideshow').style.-ms-filter = 'progid:DXImageTransform.Microsoft.Alpha(Opacity=' + value*10 + ')';
document.getElementById('slideshow').style.filter = 'alpha(opacity=' + value*10 + ')';
document.getElementById('slideshow').style.opacity = value/10;

}


// ADJUSTS THE SIZE OF THE IMAGES
function setsize(scale)
{
document.getElementById('slideshow').style.width = width/scale;
document.getElementById('slideshow').style.height = height/scale;
}


// FADE IN
function fadein()
{
var timer=setTimeout("setopacity(0)",100);
var timer=setTimeout("setopacity(1)",150);
var timer=setTimeout("setopacity(2)",200);
var timer=setTimeout("setopacity(3)",250);
var timer=setTimeout("setopacity(4)",300);
var timer=setTimeout("setopacity(5)",350);
var timer=setTimeout("setopacity(6)",400);
var timer=setTimeout("setopacity(7)",450);
var timer=setTimeout("setopacity(8)",500);
var timer=setTimeout("setopacity(9)",550);
var timer=setTimeout("setopacity(10)",600);
}


// SHORT FADE OUT
function shortfadeout()
{
var timer=setTimeout("setopacity(10)",5000);
var timer=setTimeout("setopacity(9)",5050);
var timer=setTimeout("setopacity(8)",5100);
var timer=setTimeout("setopacity(7)",5150);
var timer=setTimeout("setopacity(6)",5200);
var timer=setTimeout("setopacity(5)",5250);
var timer=setTimeout("setopacity(4)",5300);
var timer=setTimeout("setopacity(3)",5350);
var timer=setTimeout("setopacity(2)",5400);
var timer=setTimeout("setopacity(1)",5450);
var timer=setTimeout("setopacity(0)",5500);
var timer=setTimeout("flip()",6000);   // restart slideshow

}


// LONG FADE OUT
function longfadeout()
{
var timer=setTimeout("setopacity(10)",9000);
var timer=setTimeout("setopacity(9)",9050);
var timer=setTimeout("setopacity(8)",9100);
var timer=setTimeout("setopacity(7)",9150);
var timer=setTimeout("setopacity(6)",9200);
var timer=setTimeout("setopacity(5)",9250);
var timer=setTimeout("setopacity(4)",9300);
var timer=setTimeout("setopacity(3)",9350);
var timer=setTimeout("setopacity(2)",9400);
var timer=setTimeout("setopacity(1)",9450);
var timer=setTimeout("setopacity(0)",9500);
var timer=setTimeout("flip()",10000);   // restart slideshow
}



// FLIP THE IMAGES
function flip()
{
if (doflipper == 1)
{
count=count+1;
if (count > imagecount) {count = 1};

var timer=setTimeout("document.getElementById('slideshow').src='slideshow' + count +'.jpg'",50);   // set the image number

fadein();   // fade in

if (lastimagedelay == 1)    // determine if we will show the last image for double time
{

if (count == imagecount)    // show the last image for double time
{
longfadeout();    // long fade out
}
      
if (count < imagecount)    // show the last image for normal time
{
shortfadeout();
}

}  // end if lastimagedelay

else   // if we are not using the long image delay
{
shortfadeout();
}




}   // end if doflipper
}   // end flip


