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('../SF & Napa 2006_files/DSC02829.jpg', '800', '600', 'gonna go eat!  ');
slides[1] = new Slide('../SF & Napa 2006_files/DSC02839.jpg', '600', '800', 'artsy photo of the restaurant');
slides[2] = new Slide('../SF & Napa 2006_files/DSC02848.jpg', '600', '800', 'Dinner at Boulevard');
slides[3] = new Slide('../SF & Napa 2006_files/DSC02846.jpg', '600', '800', 'This was so good, if I could only remember what it was...');
slides[4] = new Slide('../SF & Napa 2006_files/DSC02849.jpg', '600', '800', 'cheese plate!  ');
slides[5] = new Slide('../SF & Napa 2006_files/DSC02856.jpg', '800', '600', 'Ferry Building');
slides[6] = new Slide('../SF & Napa 2006_files/DSC02857.jpg', '800', '600', 'Market Bar, Ferry Buidling');
slides[7] = new Slide('../SF & Napa 2006_files/DSC02866.jpg', '800', '600', 'wohoo San Fran!');
slides[8] = new Slide('../SF & Napa 2006_files/DSC02861.jpg', '600', '800', 'Love this town!');
slides[9] = new Slide('../SF & Napa 2006_files/DSC02873.jpg', '800', '600', 'The Slanted Door');
slides[10] = new Slide('../SF & Napa 2006_files/DSC02874.jpg', '600', '800', 'YUM!');
slides[11] = new Slide('../SF & Napa 2006_files/DSC02876.jpg', '600', '800', 'shops in Ferry Buiding');
slides[12] = new Slide('../SF & Napa 2006_files/DSC02882.jpg', '800', '600', 'OYSTER BAR!!!!!!!');
slides[13] = new Slide('../SF & Napa 2006_files/DSC02884.jpg', '800', '600', 'oysters');
slides[14] = new Slide('../SF & Napa 2006_files/DSC02887.jpg', '800', '600', 'Champagne!');
slides[15] = new Slide('../SF & Napa 2006_files/DSC02888.jpg', '600', '800', 'More Oysters!');
slides[16] = new Slide('../SF & Napa 2006_files/DSC02890.jpg', '800', '600', 'Ferry Building at night');
slides[17] = new Slide('../SF & Napa 2006_files/DSC02914.jpg', '800', '600', 'Dinner at Michael Mina');
slides[18] = new Slide('../SF & Napa 2006_files/DSC02930.jpg', '600', '800', 'Everything in threes!');
slides[19] = new Slide('../SF & Napa 2006_files/DSC02931.jpg', '600', '800', 'Everything');
slides[20] = new Slide('../SF & Napa 2006_files/DSC02939.jpg', '600', '800', 'Even desert');
slides[21] = new Slide('../SF & Napa 2006_files/DSC02966.jpg', '600', '800', 'really pretty murals, can’t remember where tho...');
slides[22] = new Slide('../SF & Napa 2006_files/DSC02990.jpg', '600', '800', 'Jeff’s Arty photography!');
slides[23] = new Slide('../SF & Napa 2006_files/DSC03000.jpg', '800', '600', 'DSC03000.JPG');
slides[24] = new Slide('../SF & Napa 2006_files/DSC03005.jpg', '600', '800', 'Sashimi!');
slides[25] = new Slide('../SF & Napa 2006_files/DSC03029.jpg', '600', '800', 'driving to Napa!');
slides[26] = new Slide('../SF & Napa 2006_files/DSC03030.jpg', '600', '800', 'Trees are good, but where’s the Wine???');
slides[27] = new Slide('../SF & Napa 2006_files/DSC03038.jpg', '800', '600', 'still looking for the wine!');
slides[28] = new Slide('../SF & Napa 2006_files/DSC03042.jpg', '600', '800', 'Artesa winery');
slides[29] = new Slide('../SF & Napa 2006_files/DSC03040.jpg', '600', '800', 'Artesa, very pretty!');
slides[30] = new Slide('../SF & Napa 2006_files/DSC03041.jpg', '600', '800', 'DSC03041.JPG');
slides[31] = new Slide('../SF & Napa 2006_files/DSC03043.jpg', '600', '800', 'Almost there...');
slides[32] = new Slide('../SF & Napa 2006_files/DSC03046.jpg', '600', '800', 'Oh my god it’s Lynn!');
slides[33] = new Slide('../SF & Napa 2006_files/DSC03051.jpg', '800', '600', 'it’s totally her!');
slides[34] = new Slide('../SF & Napa 2006_files/DSC03073.jpg', '600', '800', 'Opus One!');
slides[35] = new Slide('../SF & Napa 2006_files/DSC03074.jpg', '600', '800', 'Check out the guard, we’re already in trouble!');
slides[36] = new Slide('../SF & Napa 2006_files/DSC03078.jpg', '600', '800', 'I’m so thirsty for a $25 glass of wine!');
slides[37] = new Slide('../SF & Napa 2006_files/DSC03080.jpg', '800', '600', 'So we going in or what?');
slides[38] = new Slide('../SF & Napa 2006_files/DSC03083.jpg', '600', '800', 'Pumpkin?!  I want wine!');
slides[39] = new Slide('../SF & Napa 2006_files/DSC03085.jpg', '600', '800', 'Oh, Jeff found it!');
slides[40] = new Slide('../SF & Napa 2006_files/DSC03084.jpg', '600', '800', 'checkout the preppies!');
slides[41] = new Slide('../SF & Napa 2006_files/DSC03092.jpg', '600', '800', 'Look how money my husband looks!');
slides[42] = new Slide('../SF & Napa 2006_files/DSC03090.jpg', '600', '800', 'View from the roof deck at Opus One!');
slides[43] = new Slide('../SF & Napa 2006_files/DSC03096.jpg', '600', '800', 'Great architecture.');
slides[44] = new Slide('../SF & Napa 2006_files/DSC03097.jpg', '600', '800', 'who dat?');
slides[45] = new Slide('../SF & Napa 2006_files/DSC03098.jpg', '600', '800', 'woohooo we’re in NAPA!');
slides[46] = new Slide('../SF & Napa 2006_files/DSC03100.jpg', '600', '800', 'bye Opus One!  We are happily $25 poorer!');
slides[47] = new Slide('../SF & Napa 2006_files/DSC03110.jpg', '600', '800', 'Dude, it’s totally Heitz!');
slides[48] = new Slide('../SF & Napa 2006_files/DSC03101.jpg', '600', '800', 'Are my teeth grey?');
slides[49] = new Slide('../SF & Napa 2006_files/DSC03112.jpg', '800', '600', 'I’m totally lost!');
slides[50] = new Slide('../SF & Napa 2006_files/DSC03102.jpg', '600', '800', 'are my eyes red?');
slides[51] = new Slide('../SF & Napa 2006_files/DSC03104.jpg', '600', '800', 'We found a fake old guy!');
slides[52] = new Slide('../SF & Napa 2006_files/DSC03118.jpg', '600', '800', 'pretty!');
slides[53] = new Slide('../SF & Napa 2006_files/DSC03116.jpg', '800', '600', 'Lets drink!');
slides[54] = new Slide('../SF & Napa 2006_files/DSC03130.jpg', '600', '800', 'Carneros Inn');
slides[55] = new Slide('../SF & Napa 2006_files/DSC03131.jpg', '600', '800', 'cabins at the Inn');
slides[56] = new Slide('../SF & Napa 2006_files/DSC03134.jpg', '600', '800', 'Restaurant at The Carneros Inn');
slides[57] = new Slide('../SF & Napa 2006_files/DSC03170.jpg', '600', '800', 'I Found the Hotel Bar!!!!');
slides[58] = new Slide('../SF & Napa 2006_files/DSC03177.jpg', '800', '600', 'yeah I finished it already, so?');
slides[59] = new Slide('../SF & Napa 2006_files/DSC03183.jpg', '800', '600', 'Dinner at Bouchon');
slides[60] = new Slide('../SF & Napa 2006_files/DSC03181.jpg', '800', '600', 'French food rocks!');
slides[61] = new Slide('../SF & Napa 2006_files/DSC03185.jpg', '600', '800', 'Bouchon!');
slides[62] = new Slide('../SF & Napa 2006_files/DSC03192.jpg', '600', '800', 'Onion Soup');
slides[63] = new Slide('../SF & Napa 2006_files/DSC03189.jpg', '800', '600', 'French Wine Rocks!');
slides[64] = new Slide('../SF & Napa 2006_files/DSC03196.jpg', '600', '800', 'Boon Fly, Carneros Inn');
slides[65] = new Slide('../SF & Napa 2006_files/DSC03205.jpg', '600', '800', 'breakfast at Boon Fly');
slides[66] = new Slide('../SF & Napa 2006_files/DSC03204.jpg', '600', '800', 'yum!');
slides[67] = new Slide('../SF & Napa 2006_files/DSC03211.jpg', '600', '800', 'Pam & Richard!');
slides[68] = new Slide('../SF & Napa 2006_files/DSC03213.jpg', '800', '600', 'Joseph Phelps');
slides[69] = new Slide('../SF & Napa 2006_files/DSC03215.jpg', '600', '800', 'Aawww!!!');
slides[70] = new Slide('../SF & Napa 2006_files/DSC03216.jpg', '600', '800', 'DSC03216.JPG');
slides[71] = new Slide('../SF & Napa 2006_files/DSC03217.jpg', '600', '800', 'oooh pretty');
slides[72] = new Slide('../SF & Napa 2006_files/DSC03221.jpg', '600', '800', 'Scharmsberg tour.');
slides[73] = new Slide('../SF & Napa 2006_files/DSC03222.jpg', '800', '600', 'scarry!');
slides[74] = new Slide('../SF & Napa 2006_files/DSC03226.jpg', '800', '600', 'Pam, lets find the boos!');
slides[75] = new Slide('../SF & Napa 2006_files/DSC03227.jpg', '800', '600', 'Happy birthday Richard!');
slides[76] = new Slide('../SF & Napa 2006_files/DSC03229.jpg', '600', '800', 'champagne tasting hundreds of feet below ground!');
slides[77] = new Slide('../SF & Napa 2006_files/DSC03231.jpg', '600', '800', 'DSC03231.JPG');
slides[78] = new Slide('../SF & Napa 2006_files/DSC03230.jpg', '600', '800', 'Melvile!');
slides[79] = new Slide('../SF & Napa 2006_files/DSC03232.jpg', '600', '800', 'DSC03232.JPG');
slides[80] = new Slide('../SF & Napa 2006_files/DSC03233.jpg', '600', '800', 'DSC03233.JPG');
slides[81] = new Slide('../SF & Napa 2006_files/DSC03234.jpg', '600', '800', 'DSC03234.JPG');
slides[82] = new Slide('../SF & Napa 2006_files/DSC03235.jpg', '600', '800', 'DSC03235.JPG');
slides[83] = new Slide('../SF & Napa 2006_files/DSC03237.jpg', '600', '800', 'DSC03237.JPG');
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);
        }
    }
}

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

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", "SF & Napa 2006_files/transparent.gif");
    fixupIEPNG("id2", "SF & Napa 2006_files/transparent.gif");
    fixupIEPNG("id3", "SF & Napa 2006_files/transparent.gif");
    fixupIEPNG("id4", "SF & Napa 2006_files/transparent.gif");
    fixupIEPNG("id5", "SF & Napa 2006_files/transparent.gif");
    fixupIEPNG("id6", "SF & Napa 2006_files/transparent.gif");
    fixupIEPNG("id7", "SF & Napa 2006_files/transparent.gif");
    fixupIEPNG("id8", "SF & Napa 2006_files/transparent.gif");
    adjustStrokeHeight("id9", 6, 6, 4);
    fixupAllIEPNGBGs();
    fixupIEPNG("id10", "SF & Napa 2006_files/transparent.gif");
    fixupIEPNG("id11", "SF & Napa 2006_files/transparent.gif");
    fixupIEPNG("id12", "SF & Napa 2006_files/transparent.gif");
    fixupIEPNG("id13", "SF & Napa 2006_files/transparent.gif");
    return true;
}

