slideShowURL = 'SlideShow_assets/SlideShow.html';       // parameter from openSlideShowWindow.js
slideShowNS4URL = 'SlideShow_assets/SlideShowNS4.html'; // parameter from openSlideShowWindow.js

slides = new Array();
slides[0] = new Slide('../Photos_files/3-Apes.jpg', '384', '512', 'Hear no evil...');
slides[1] = new Slide('../Photos_files/Anne-01.jpg', '384', '512', 'Anne - or at least that’s her back');
slides[2] = new Slide('../Photos_files/Anne-Bill.jpg', '384', '512', 'Anne and Bill');
slides[3] = new Slide('../Photos_files/Anne-Datura.jpg', '512', '384', 'Anne & Datura (um, their backs, that is)');
slides[4] = new Slide('../Photos_files/Bob-Bill.jpg', '384', '512', 'Bob and Bill (betcha can guess who’s who!)');
slides[5] = new Slide('../Photos_files/Courtois-Cousins.jpg', '384', '512', 'Courtois Cousins');
slides[6] = new Slide('../Photos_files/Cousins-02.jpg', '384', '512', 'Janet & Steve');
slides[7] = new Slide('../Photos_files/Cousins.jpg', '384', '512', 'Val, Janet, Donny & Steve');
slides[8] = new Slide('../Photos_files/GG-01.jpg', '384', '512', 'GG');
slides[9] = new Slide('../Photos_files/Host-Jim---Chris.jpg', '384', '512', 'Jim (Host) and Chris');
slides[10] = new Slide('../Photos_files/Kelly-Gaye-Val.jpg', '384', '512', 'Kelly & Gaye (and Valdemort)');
slides[11] = new Slide('../Photos_files/Liz-01.jpg', '384', '512', 'Liz');
slides[12] = new Slide('../Photos_files/Liz-02.jpg', '384', '512', 'Liz, again');
slides[13] = new Slide('../Photos_files/Liz-Anne.jpg', '384', '512', 'Liz’s ponytail & Anne');
slides[14] = new Slide('../Photos_files/Liz-GG-01.jpg', '384', '512', 'Liz & GG (yeah, she is TIRED - just flew in)');
slides[15] = new Slide('../Photos_files/Moms-cran-with-garlic-olive.jpg', '384', '512', 'Mom’s cranberry with floating garlic olive (modeled by Nook)');
slides[16] = new Slide('../Photos_files/Nook-Liz-01.jpg', '384', '512', 'Nook & Liz (cousins, but they look like sisters!) Oh, yeah, and Valdemort putting in her two bits...');
slides[17] = new Slide('../Photos_files/Nook-02.jpg', '384', '512', 'Nook contemplating Life, The Universe and Everything');
slides[18] = new Slide('../Photos_files/Nook-03.jpg', '512', '384', 'Nook looking absolutely GORGEOUS!');
slides[19] = new Slide('../Photos_files/Nook.jpg', '384', '512', 'Nook playing with phones');
slides[20] = new Slide('../Photos_files/Talking-Phones.jpg', '384', '512', 'Phones talking to each other...');
slides[21] = new Slide('../Photos_files/Three-Stooges.jpg', '384', '512', 'Three Stooges');
slides[22] = new Slide('../Photos_files/Val-02.jpg', '512', '384', 'Val');
slides[23] = new Slide('../Photos_files/Val-03.jpg', '384', '512', 'Val and her lightning shirt');
slides[24] = new Slide('../Photos_files/Val-04.jpg', '384', '512', 'Stare into my eyes');
slides[25] = new Slide('../Photos_files/Val-05.jpg', '512', '384', 'Val ');
slides[26] = new Slide('../Photos_files/Val-Nook.jpg', '384', '512', 'Cousins');
slides[27] = new Slide('../Photos_files/Val-sox.jpg', '384', '512', 'Val’s sox');
slides[28] = new Slide('../Photos_files/Val01.jpg', '384', '512', 'Val showing off the size of her mouth');
slides[29] = new Slide('../Photos_files/Presents-04.jpg', '512', '384', 'Presents');
slides[30] = new Slide('../Photos_files/Presents-02.jpg', '384', '512', 'Santa Bill');
slides[31] = new Slide('../Photos_files/Presents-03.jpg', '384', '512', 'Presents');
slides[32] = new Slide('../Photos_files/Presents-01.jpg', '384', '512', 'Presents - Hostess Becky relaxing and enjoying the show!');
slides[33] = new Slide('../Photos_files/Joanie-with-ears.jpg', '512', '384', 'Elf Joanie (um, her back) and her EARS');
isPureISOLatin1 = true;
contentEncodingConstant = 4;
feedbackURL = "TODO";
showFeedbackButton = false;
feedbackEnabled = true;

var smallTransparentGif = "";
function fixupIEPNG(strImageID, transparentGif) 
{
    smallTransparentGif = transparentGif;
    if (windowsInternetExplorer && (browserVersion < 7))
    {
        var img = document.getElementById(strImageID);
        if (img)
        {
            var src = img.src;
            img.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='scale')";
            img.src = transparentGif;
            img.attachEvent("onpropertychange", imgPropertyChanged);
        }
    }
}

var windowsInternetExplorer = false;
var browserVersion = 0;
function detectBrowser()
{
    windowsInternetExplorer = false;
    var appVersion = navigator.appVersion;
    if ((appVersion.indexOf("MSIE") != -1) &&
        (appVersion.indexOf("Macintosh") == -1))
    {
        var temp = appVersion.split("MSIE");
        browserVersion = parseFloat(temp[1]);
        windowsInternetExplorer = true;
    }
}

var inImgPropertyChanged = false;
function imgPropertyChanged()
{
    if ((window.event.propertyName == "src") && (! inImgPropertyChanged))
    {
        inImgPropertyChanged = true;
        var el = window.event.srcElement;
        if (el.src != smallTransparentGif)
        {
            el.filters.item(0).src = el.src;
            el.src = smallTransparentGif;
        }
        inImgPropertyChanged = false;
    }
}

function fixupIEPNGBG(oBlock) 
{
    if (oBlock)
    {
        var currentBGImage = oBlock.currentStyle.backgroundImage;
        var currentBGRepeat = oBlock.currentStyle.backgroundRepeat;
        var urlStart = currentBGImage.indexOf('url(');
        var urlEnd = currentBGImage.indexOf(')', urlStart);
        var imageURL = currentBGImage.substring(urlStart + 4, urlEnd);

        if (imageURL.charAt(0) == '"')
        {
            imageURL = imageURL.substring(1);
        }
        
        if (imageURL.charAt(imageURL.length - 1) == '"')
        {
            imageURL = imageURL.substring(0, imageURL.length - 1);
        }

        var overrideRepeat = false;

        var filterStyle =
            "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" +
            imageURL +
            "', sizingMethod='crop');";

        if (RegExp("/C[0-9A-F]{8}.png$").exec(imageURL) != null)
        {
            filterStyle =
                "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" +
                imageURL +
                "', sizingMethod='scale');";

            overrideRepeat = true;
        }

        var backgroundImage = new Image();
        backgroundImage.src = imageURL;
        var tileWidth = backgroundImage.width;
        var tileHeight = backgroundImage.height; 
        
        var blockWidth = 0;
        var blockHeight = 0;
        if (oBlock.style.width)
        {
            blockWidth = parseInt(oBlock.style.width);
        }
        else
        {
            blockWidth = oBlock.offsetWidth;
        }
        if (oBlock.style.height)
        {
            blockHeight = parseInt(oBlock.style.height);
        }
        else
        {
            blockHeight = oBlock.offsetHeight;
        }

        if ((blockWidth == 0) || (blockHeight == 0))
        {
            return;
        }
        
        var wholeRows = 1;
        var wholeCols = 1;
        var extraHeight = 0;
        var extraWidth = 0;
        
        if ((currentBGRepeat.indexOf("no-repeat") != -1) ||
              ((tileWidth == 0) && (tileHeight == 0)) ||
              overrideRepeat)
        {
            tileWidth = blockWidth;
            tileHeight = blockHeight;

        }
        else if ((currentBGRepeat.indexOf("repeat-x") != -1) ||
              (tileHeight == 0))
        {
            wholeCols = Math.floor(blockWidth / tileWidth);
            extraWidth = blockWidth - (tileWidth * wholeCols);
            tileHeight = blockHeight;

        }
        else if (currentBGRepeat.indexOf("repeat-y") != -1)
        {
            wholeRows = Math.floor(blockHeight / tileHeight);
            extraHeight = blockHeight - (tileHeight * wholeRows);
            tileWidth = blockWidth;

        }
        else
        {
            wholeCols = Math.floor(blockWidth / tileWidth);
            wholeRows = Math.floor(blockHeight / tileHeight);
            extraWidth = blockWidth - (tileWidth * wholeCols);
            extraHeight = blockHeight - (tileHeight * wholeRows);
        }
        
        var wrappedContent = document.createElement("div");
        wrappedContent.style.position = "relative";
        wrappedContent.style.zIndex = "1";
        wrappedContent.style.left = "0px";
        wrappedContent.style.top = "0px";
        if (!isNaN(parseInt(oBlock.style.width)))
        {
            wrappedContent.style.width = "" + blockWidth + "px";
        }
        if (!isNaN(parseInt(oBlock.style.height)))
        {
            wrappedContent.style.height = "" + blockHeight + "px";
        }
        var pngBGFixIsWrappedContentEmpty = true;
        while (oBlock.hasChildNodes())
        {
            if (oBlock.firstChild.nodeType == 3)
            {
                if (RegExp("^ *$").exec(oBlock.firstChild.data) == null)
                {
                    pngBGFixIsWrappedContentEmpty = false;
                }
            }
            else
            {
                pngBGFixIsWrappedContentEmpty = false;
            }
            wrappedContent.appendChild(oBlock.firstChild);
        }
        if (pngBGFixIsWrappedContentEmpty)
        {
            wrappedContent.style.lineHeight = "0px";
        }
        
        var newMarkup = "";
        for (var currentRow = 0; 
             currentRow < wholeRows; 
             currentRow++)
        {
            for (currentCol = 0; 
                 currentCol < wholeCols; 
                 currentCol++)
            {
                newMarkup += "<div style=" +
                        "\"position: absolute; line-height: 0px; " +
                        "width: " + tileWidth + "px; " +
                        "height: " + tileHeight + "px; " +
                        "left:" + currentCol *  tileWidth + "px; " +
                        "top:" + currentRow *  tileHeight + "px; " +
                        "filter:" + filterStyle + 
                        "\" > </div>";
            }
            
            if (extraWidth != 0)
            {
                newMarkup += "<div style=" +
                        "\"position: absolute; line-height: 0px; " +
                        "width: " + extraWidth + "px; " +
                        "height: " + tileHeight + "px; " +
                        "left:" + currentCol *  tileWidth + "px; " +
                        "top:" + currentRow *  tileHeight + "px; " +
                        "filter:" + filterStyle + 
                        "\" > </div>";
            }
        }
        
        if (extraHeight != 0)
        {
            for (currentCol = 0; 
                 currentCol < wholeCols; 
                 currentCol++)
            {
                newMarkup += "<div style=" +
                        "\"position: absolute; line-height: 0px; " +
                        "width: " + tileWidth + "px; " +
                        "height: " + extraHeight + "px; " +
                        "left:" + currentCol *  tileWidth + "px; " +
                        "top:" + currentRow *  tileHeight + "px; " +
                        "filter:" + filterStyle + 
                        "\" > </div>";
            }
            
            if (extraWidth != 0)
            {
                newMarkup += "<div style=" +
                        "\"position: absolute; line-height: 0px; " +
                        "width: " + extraWidth + "px; " +
                        "height: " + extraHeight + "px; " +
                        "left:" + currentCol *  tileWidth + "px; " +
                        "top:" + currentRow *  tileHeight + "px; " +
                        "filter:" + filterStyle + 
                        "\" > </div>";
            }
        }
        oBlock.innerHTML = newMarkup;

        oBlock.appendChild(wrappedContent);
        oBlock.style.background= "";
    }
}

function fixupAllIEPNGBGs()
{
    if (windowsInternetExplorer && (browserVersion < 7))
    {
        try
        {
            var oDivNodes = document.getElementsByTagName('DIV');
            for (var iIndex=0; iIndex<oDivNodes.length; iIndex++)
            {
                var oNode = oDivNodes.item(iIndex);
                if (oNode.currentStyle &&
                    oNode.currentStyle.backgroundImage &&
                    (oNode.currentStyle.backgroundImage.indexOf('url(') != -1) &&
                    (oNode.currentStyle.backgroundImage.indexOf('.png")') != -1))
                {
                    fixupIEPNGBG(oNode);
                }
            }
        }
        catch (e)
        {
        }
    }
}

function onPageLoad()
{
    detectBrowser();
    fixupIEPNG("id1", "Photos_files/transparent.gif");
    fixupAllIEPNGBGs();
    fixupIEPNG("id2", "Photos_files/transparent.gif");
    fixupIEPNG("id3", "Photos_files/transparent.gif");
    return true;
}

