/***********************************************
* Translucent Cross Fade Slideshow HTML HEAD script
*  - © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for original source code
***********************************************/

/***********************************************
* External variables that must be set in HTML page using slideshow
*
* slideSpeed   // Animation speed (opacity increment)
* slideRate    // Animation rate of increment in milliseconds
* slidePause   // Pause between slides in milliseconds
* slideContent // Array of slideshow content arrays,
*              //  [URL, ALT, OPTIONAL LINK, OPTIONAL LINK TARGET]
***********************************************/

/***********************************************
* External variables supplied by slide_show.js
*
* currCanvas // Canvas for current slide
* nextCanvas // Canvas for next slide
* currIndex  // Index value for next slide
* dropSlide  // Repeating interval for slide movement
***********************************************/

var currentOpacity = 0;    // Opacity of current canvas

function resetNextCanvas()
{
    setObjectOpacity(nextCanvas, 0);

    currentOpacity = 100;

    nextCanvas.innerHTML = getSlideHtml(slideContent[currIndex]);
}

function transitionSlide()
{
    if (currentOpacity > 0)
    {
        currentOpacity = Math.max((currentOpacity - slideSpeed), 0);

        setObjectOpacity(currCanvas, currentOpacity);
        setObjectOpacity(nextCanvas, (100 - currentOpacity));
     }
    else
    {
        clearInterval(dropSlide);

        var tempobj = currCanvas;
        currCanvas  = nextCanvas;
        nextCanvas  = tempobj;

        ++currIndex;

        if (currIndex >= slideContent.length)
        {
            currIndex = 0;
        }

        resetNextCanvas();

        setTimeout("startSlideTransition()", slidePause);
    }
}

function startSlideTransition()
{
    setObjectOpacity(currCanvas, 100);
    currCanvas.style.zIndex--;

    setObjectOpacity(nextCanvas, 0);
    nextCanvas.style.zIndex++;

    var temp = 'setInterval("transitionSlide()",' + slideRate + ')';
    dropSlide = eval(temp);
}
/***********************************************
* End of Translucent Cross Fade Slideshow script
***********************************************/
