/***********************************************
* Translucent Common 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 (x increment)
* slideRate   // Animation rate in milliseconds
* slidePause  // Pause between slides in milliseconds
* slidePath   // Path to slide images
* slideHeight // Height for slideshow 'screen'
* slideWidth  // Width for slideshow 'screen'
* slideContent // Array of slideshow content arrays,
*              //  [URL, ALT, OPTIONAL LINK, OPTIONAL LINK TARGET]
***********************************************/

var currCanvas = null;    // Canvas for current slide
var nextCanvas = null;    // Canvas for next slide
var currIndex  = 0;       // Index value for next slide
var dropSlide  = null;    // Repeating interval for slide movement

// Variables to detect use of IE4 or DOM
var ie4 = document.all;
var dom = document.getElementById;
// var dom = (document.getElementById) &&
//           (navigator.userAgent.indexOf("Opera") == -1);

function getSlideHtml(theSlide)
{
    // URL, ALT, OPTIONAL LINK, OPTIONAL LINK TARGET
    var slideHtml = "";
    
    if (theSlide[2]!= "")
    {
        slideHtml = '<a'                                                 +
                    ' onClick="openPopup(this.href); return false;"'     +
                    ' onMouseOver="loadPopup(this.href); return false;"' +
                    ' href="'                                            +
                    theSlide[2]                                          +
                    '" target="'                                         +
                    theSlide[3]                                          +
                    '">'                                                  ;
    }

    slideHtml += '<img src="' + theSlide[0] +
                    '" alt="' + theSlide[1] + '" border="0">';

    if (theSlide[2]!= "")
    {
        slideHtml += '</a>';
    }

    return slideHtml;
}

function getObjByName(objName)
{
    if (ie4 || dom)
    {
        return (ie4 ? eval("document.all." + objName) :
                      document.getElementById(objName));
    }
    else if (document.layers)
    {
        return document.tickernsmain.document.tickernssub;
    }

    return null;
}

function setObjectOpacity(whatObj, newOpacity)
{
        if (whatObj.filters)
        {
            whatObj.filters.alpha.opacity = newOpacity;
        }
        else if (whatObj.style.MozOpacity)
        {
            whatObj.style.MozOpacity = (newOpacity / 100.0);
        }
        else if (whatObj.style.opacity)
        {
            whatObj.style.opacity = (newOpacity / 100.0);
        }
}

function changeLayerSlide()
{
    ++currIndex;

    if (currIndex >= slideContent.length)
    {
        currIndex = 0;
    }

    nextCanvas.document.write(getSlideHtml(slideContent[currIndex]));
    nextCanvas.document.close();
}

function startSlideShow()
{
    currCanvas = getObjByName("slideshow_canvas1");
    nextCanvas = getObjByName("slideshow_canvas0");

    if (ie4 || dom)
    {
        resetNextCanvas();

        startSlideTransition();
    }
    else if (document.layers)
    {
        document.slideshow_screen.visibility = 'show';

        nextCanvas = document.slideshow_screen.document.slideshow_canvas;

        nextCanvas.document.write(getSlideHtml(slideContent[currIndex]));
        nextCanvas.document.close();

        setInterval("changeLayerSlide()", slidePause);
    }
}

/***********************************************
* End of Translucent Common Slideshow script
***********************************************/
