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('../April 2007_files/DSC_0058.jpg', '532', '800', 'A studious young master at the beach.');
slides[1] = new Slide('../April 2007_files/DSC_0064.jpg', '800', '532', 'Trying on Mom’s new socks.');
slides[2] = new Slide('../April 2007_files/DSC_0052.jpg', '800', '532', 'He loves, loves, *loves* trucks.');
slides[3] = new Slide('../April 2007_files/DSC_0013.jpg', '800', '532', 'And mud puddles!');
slides[4] = new Slide('../April 2007_files/DSC_0024.jpg', '532', '800', 'And looking at mud puddles!');
slides[5] = new Slide('../April 2007_files/DSC_0032.jpg', '532', '800', 'And the ocean!');
slides[6] = new Slide('../April 2007_files/DSC_0038.jpg', '800', '532', 'And picking up mud!');
slides[7] = new Slide('../April 2007_files/DSC_0044.jpg', '800', '532', 'And throwing it into mud puddles!');
slides[8] = new Slide('../April 2007_files/DSC_0050.jpg', '800', '532', 'And then standing in the mud puddles!');
slides[9] = new Slide('../April 2007_files/DSC_0186.jpg', '800', '800', 'He isn’t as fond of his carseat. ');
slides[10] = new Slide('../April 2007_files/DSC_0205.jpg', '522', '800', 'Walking along the beach. (“Walk! Beach! Walk! Beach!”)');
slides[11] = new Slide('../April 2007_files/DSC_0212.jpg', '800', '532', '(“Rock! Rock!”)');
slides[12] = new Slide('../April 2007_files/DSC_0357.jpg', '800', '800', 'Pallin’ around');
slides[13] = new Slide('../April 2007_files/DSC_0400.jpg', '532', '800', 'Watering the plants. I love the pretend play.');
slides[14] = new Slide('../April 2007_files/DSC_0012.jpg', '532', '800', 'The trucks are having a crash. ');
slides[15] = new Slide('../April 2007_files/DSC_0025.jpg', '534', '800', 'He begs you! Stop Mommy from taking pictures!');
slides[16] = new Slide('../April 2007_files/DSC_0027.jpg', '532', '800', 'Please?');
slides[17] = new Slide('../April 2007_files/DSC_0029.jpg', '532', '800', 'Alseep on a long-ish drive');
slides[18] = new Slide('../April 2007_files/DSC_0060.jpg', '532', '800', 'Little man, big trees');
slides[19] = new Slide('../April 2007_files/DSC_0096.jpg', '532', '800', 'He loves Big Sur');
slides[20] = new Slide('../April 2007_files/DSC_0159.jpg', '534', '800', 'My view of Jacob when he’s in the backpack carrier. ');
slides[21] = new Slide('../April 2007_files/DSC_0219.jpg', '532', '800', 'More car photography');
slides[22] = new Slide('../April 2007_files/DSC_0132.jpg', '800', '533', 'In a sweater I knit for him');
slides[23] = new Slide('../April 2007_files/DSC_0146.jpg', '800', '533', 'The digger truck is ever-present.');
slides[24] = new Slide('../April 2007_files/DSC_0003.jpg', '532', '800', 'Jacob had his first boat ride this month.');
slides[25] = new Slide('../April 2007_files/DSC_0005.jpg', '800', '532', 'We went to Alcatraz!');
slides[26] = new Slide('../April 2007_files/DSC_0022.jpg', '532', '800', 'Jacob liked pushing his stroller around Alcatraz. ');
slides[27] = new Slide('../April 2007_files/DSC_0027_2.jpg', '532', '800', 'He didn’t like being pushed, so much.');
slides[28] = new Slide('../April 2007_files/DSC_0033.jpg', '518', '800', 'Watching people mill around in front of the prison administration building');
slides[29] = new Slide('../April 2007_files/DSC_0040.jpg', '532', '800', 'You can see the city in the distance');
slides[30] = new Slide('../April 2007_files/DSC_0065.jpg', '532', '800', 'Wandering around Alcatraz grounds');
slides[31] = new Slide('../April 2007_files/DSC_0072.jpg', '507', '800', 'Watching seagulls');
slides[32] = new Slide('../April 2007_files/DSC_0093.jpg', '532', '800', 'Golden Gate in the background');
slides[33] = new Slide('../April 2007_files/DSC_0102.jpg', '532', '800', 'In isolation, and remarkably unconcerned about it');
slides[34] = new Slide('../April 2007_files/DSC_0016.jpg', '532', '800', 'He loves to “read”');
slides[35] = new Slide('../April 2007_files/DSC_0027_4.jpg', '532', '800', 'And stack blocks!');
isPureISOLatin1 = true;
contentEncodingConstant = 4;
feedbackURL = "TODO";
showFeedbackButton = false;
feedbackEnabled = 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 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", "April 2007_files/transparent.gif");
    fixupAllIEPNGBGs();
    fixupIEPNG("id2", "April 2007_files/transparent.gif");
    fixupIEPNG("id3", "April 2007_files/transparent.gif");
    return true;
}

