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('../Party_files/101_5074.jpg', '600', '800', 'Mike, Jenn, Alexis, Rob, and Marilyn');
slides[1] = new Slide('../Party_files/101_5076.jpg', '600', '800', 'Bob, Mike, Jenn, Alexis, and Rob');
slides[2] = new Slide('../Party_files/101_5077.jpg', '600', '800', 'Denise, Pat, Jenna, and Justin');
slides[3] = new Slide('../Party_files/101_5078.jpg', '600', '800', 'Marilyn and Alexis');
slides[4] = new Slide('../Party_files/101_5079.jpg', '600', '800', 'Priscilla and Aaron');
slides[5] = new Slide('../Party_files/101_5082.jpg', '600', '800', 'Joyce and Aaron');
slides[6] = new Slide('../Party_files/101_5085.jpg', '600', '800', 'Rachel, Raquel, Nikki, Danielle, and Sophia');
slides[7] = new Slide('../Party_files/101_5087.jpg', '600', '800', 'Anthony and Jacob');
slides[8] = new Slide('../Party_files/101_5089.jpg', '600', '800', 'Priscilla and Jennifer');
slides[9] = new Slide('../Party_files/101_5090.jpg', '600', '800', 'Room full of fun');
slides[10] = new Slide('../Party_files/101_5096.jpg', '600', '800', 'Alfred and Bill');
slides[11] = new Slide('../Party_files/101_5098.jpg', '600', '800', 'Rob and Bob');
slides[12] = new Slide('../Party_files/101_5100.jpg', '600', '800', 'Marilyn, Rob, and Bob');
slides[13] = new Slide('../Party_files/101_5102.jpg', '600', '800', 'Heather and Sergio');
slides[14] = new Slide('../Party_files/101_5103.jpg', '600', '800', 'Carlos');
slides[15] = new Slide('../Party_files/101_5104.jpg', '600', '800', 'Debbie, John, and Aaron');
slides[16] = new Slide('../Party_files/101_5106.jpg', '600', '800', 'Jim and Joann');
slides[17] = new Slide('../Party_files/101_5107.jpg', '600', '800', 'Jeff and Alfred');
slides[18] = new Slide('../Party_files/101_5108.jpg', '600', '800', 'Val and Rawan ');
slides[19] = new Slide('../Party_files/101_5109.jpg', '600', '800', 'Miriam and Heather ');
slides[20] = new Slide('../Party_files/101_5110.jpg', '600', '800', 'Sergio and Manuel');
slides[21] = new Slide('../Party_files/101_5114.jpg', '600', '800', 'Nikki entertains');
slides[22] = new Slide('../Party_files/101_5117.jpg', '600', '800', 'Nikki');
slides[23] = new Slide('../Party_files/101_5122.jpg', '600', '800', 'conversation');
slides[24] = new Slide('../Party_files/101_5123.jpg', '600', '800', 'the kids');
slides[25] = new Slide('../Party_files/101_5130.jpg', '600', '800', 'Jeff yodels');
slides[26] = new Slide('../Party_files/101_5131.jpg', '600', '800', 'Chucky and Nikki');
slides[27] = new Slide('../Party_files/101_5133.jpg', '600', '800', 'Jenn and Joyce');
slides[28] = new Slide('../Party_files/101_5135.jpg', '600', '800', 'Cool Cake!');
slides[29] = new Slide('../Party_files/101_5138.jpg', '600', '800', 'Bob and Joyce');
slides[30] = new Slide('../Party_files/101_5142.jpg', '600', '800', 'Ryan and Carlos');
slides[31] = new Slide('../Party_files/101_5147.jpg', '600', '800', 'Jenn and Bob');
slides[32] = new Slide('../Party_files/101_5155.jpg', '600', '800', 'Jenn and Carlos');
slides[33] = new Slide('../Party_files/101_5173.jpg', '600', '800', 'Mele family and Rob');
slides[34] = new Slide('../Party_files/101_5175.jpg', '600', '800', 'Rachel, Danielle, and Raquel');
slides[35] = new Slide('../Party_files/101_5177.jpg', '600', '800', 'Alexis and Jennifer');
slides[36] = new Slide('../Party_files/101_5182.jpg', '600', '800', 'Joann, Debbie, Lucy, and Priscilla');
slides[37] = new Slide('../Party_files/101_5184.jpg', '600', '800', 'Rocking the house!');
slides[38] = new Slide('../Party_files/101_5187.jpg', '600', '800', 'Party time!');
slides[39] = new Slide('../Party_files/101_5190.jpg', '600', '800', 'Yvonne, Annette, and Bill');
slides[40] = new Slide('../Party_files/101_5191.jpg', '600', '800', 'John, Jeff, Anthony, and Rob');
slides[41] = new Slide('../Party_files/101_5192.jpg', '600', '800', 'Sweet Home Alabama');
slides[42] = new Slide('../Party_files/101_5193.jpg', '600', '800', 'Rock on!');
slides[43] = new Slide('../Party_files/101_5195.jpg', '600', '800', 'Group singalong');
slides[44] = new Slide('../Party_files/101_5196.jpg', '600', '800', 'Still singing!?');
slides[45] = new Slide('../Party_files/101_5201.jpg', '600', '800', 'Sergio and Gary');
slides[46] = new Slide('../Party_files/101_5210.jpg', '600', '800', 'Marilyn, Debbie, Lucy, Bill, John, Sophia, Anthony, and Rob');
slides[47] = new Slide('../Party_files/101_5212.jpg', '600', '800', 'Blue Moon...');
slides[48] = new Slide('../Party_files/101_5213.jpg', '600', '800', 'Bob and Rob');
slides[49] = new Slide('../Party_files/101_5215.jpg', '600', '800', 'Val, Miriam, Heather, and Sergio');
slides[50] = new Slide('../Party_files/101_5216.jpg', '600', '800', 'Gary and Rawan');
slides[51] = new Slide('../Party_files/101_5233.jpg', '600', '800', 'Heeeeyyy');
slides[52] = new Slide('../Party_files/101_5234.jpg', '600', '800', 'Lucy and Priscilla');
slides[53] = new Slide('../Party_files/101_5245.jpg', '600', '800', 'Bob and Ryan');
slides[54] = new Slide('../Party_files/101_5249.jpg', '600', '800', 'Raquel, Rob, and Christian');
slides[55] = new Slide('../Party_files/101_5257.jpg', '600', '800', 'Chucky and Rob');
slides[56] = new Slide('../Party_files/101_5259.jpg', '600', '800', 'Jennifer and Rob');
slides[57] = new Slide('../Party_files/101_5261.jpg', '600', '800', 'Partying');
slides[58] = new Slide('../Party_files/101_5265.jpg', '600', '800', 'Gary and Bob');
slides[59] = new Slide('../Party_files/101_5266.jpg', '600', '800', 'Group Huddle');
slides[60] = new Slide('../Party_files/101_5273.jpg', '600', '800', 'Opening present');
slides[61] = new Slide('../Party_files/101_5274.jpg', '600', '800', 'iChong signed to me');
slides[62] = new Slide('../Party_files/101_5286.jpg', '600', '800', 'Annette, Bill, and Phil');
isPureISOLatin1 = true;
contentEncodingConstant = 4;
feedbackURL = "TODO";
showFeedbackButton = false;
feedbackEnabled = true;

function adjustStrokeHeight(idOfElement, leftDelta, rightDelta, bottomDelta)
{
    var oTextBoxOuterDiv = document.getElementById(idOfElement);

    if (oTextBoxOuterDiv)
    {
        var offsetHeight = oTextBoxOuterDiv.offsetHeight;

        var leftImage = getChildOfType(oTextBoxOuterDiv, "IMG", 0);
        if (leftImage)
        {
            leftImage.style.height = (offsetHeight - leftDelta) + "px";
        }
        var rightImage = getChildOfType(oTextBoxOuterDiv, "IMG", 1);
        if (rightImage)
        {
            rightImage.style.height = (offsetHeight - rightDelta) + "px";
        }
        var bottomImage = getChildOfType(oTextBoxOuterDiv, "IMG", 3);
        if (bottomImage)
        {
            bottomImage.style.top = (offsetHeight - bottomDelta) + "px";
        }
    }
}

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);
        }
    }
}

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 getChildOfType(oParent, sNodeName, requestedIndex)
{
    var childrenOfType = oParent.getElementsByTagName(sNodeName);
    return (requestedIndex < childrenOfType.length) ?
           childrenOfType.item(requestedIndex) : null;
}

function onPageLoad()
{
    detectBrowser();
    fixupIEPNG("id1", "Party_files/transparent.gif");
    fixupIEPNG("id2", "Party_files/transparent.gif");
    fixupIEPNG("id3", "Party_files/transparent.gif");
    fixupIEPNG("id4", "Party_files/transparent.gif");
    fixupAllIEPNGBGs();
    fixupIEPNG("id5", "Party_files/transparent.gif");
    fixupIEPNG("id6", "Party_files/transparent.gif");
    fixupIEPNG("id7", "Party_files/transparent.gif");
    fixupIEPNG("id8", "Party_files/transparent.gif");
    adjustStrokeHeight("id9", 6, 6, 4);
    fixupIEPNG("id10", "Party_files/transparent.gif");
    fixupIEPNG("id11", "Party_files/transparent.gif");
    fixupIEPNG("id12", "Party_files/transparent.gif");
    fixupIEPNG("id13", "Party_files/transparent.gif");
    fixupIEPNG("id14", "Party_files/transparent.gif");
    return true;
}

function NBmouseover(index)
{
    var normal = document.getElementById("navbar_"+index+"_normal");
    var rollover = document.getElementById("navbar_"+index+"_rollover");
    if (normal && rollover)
    {
        normal.style.visibility = "hidden";
        rollover.style.visibility = "visible";
    }
    return true;
}

function NBmouseout(index)
{
    var normal = document.getElementById("navbar_"+index+"_normal");
    var rollover = document.getElementById("navbar_"+index+"_rollover");
    if (normal && rollover)
    {
        normal.style.visibility = "visible";
        rollover.style.visibility = "hidden";
    }
    return true;
}

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;
    }
}


