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/IMG_0518.jpg', '800', '600', 'The new fad in Germany, driving on your ceiling.');
slides[1] = new Slide('../Photos_files/IMG_0526.jpg', '600', '800', 'The rear of the Russian sub, those are the torpedo tubes.');
slides[2] = new Slide('../Photos_files/IMG_0527.jpg', '600', '800', 'Rough translation, “Your father was a hamster, and your mother smelt of elderberries.”');
slides[3] = new Slide('../Photos_files/IMG_0528.jpg', '600', '800', 'This is the rear part of the torpedo.');
slides[4] = new Slide('../Photos_files/IMG_0529.jpg', '600', '800', 'A pressure hatch.');
slides[5] = new Slide('../Photos_files/IMG_0530.jpg', '800', '600', 'Small sleeping quarters.');
slides[6] = new Slide('../Photos_files/IMG_0531.jpg', '600', '800', '“Water in section,” “Fire in section”, “leave immediately,” more-like sound code on inside of hatch.');
slides[7] = new Slide('../Photos_files/IMG_0532.jpg', '600', '800', 'The sealing mechanism for the hatch.');
slides[8] = new Slide('../Photos_files/IMG_0534.jpg', '600', '800', 'The sign I referenced in the post.');
slides[9] = new Slide('../Photos_files/IMG_0536.jpg', '600', '800', 'The generator.');
slides[10] = new Slide('../Photos_files/IMG_0537.jpg', '600', '800', 'More in the generator room.');
slides[11] = new Slide('../Photos_files/IMG_0538.jpg', '800', '600', 'Something that looks cool.');
slides[12] = new Slide('../Photos_files/IMG_0541.jpg', '600', '800', 'Signs for tourists in Russian');
slides[13] = new Slide('../Photos_files/IMG_0542.jpg', '600', '800', 'Exit staircase. I imagine this was probably originally a ladder.');
slides[14] = new Slide('../Photos_files/IMG_0544.jpg', '600', '800', 'Big propeller.');
slides[15] = new Slide('../Photos_files/IMG_0547.jpg', '600', '800', 'A sign telling you all sorts of procedures.');
slides[16] = new Slide('../Photos_files/IMG_0545.jpg', '800', '600', 'The submarine, U-434.');
slides[17] = new Slide('../Photos_files/IMG_0548.jpg', '600', '800', 'For Julia’s mom, a hip-hop store. (Julia’s mom works for the hip hop archive at Stanford.)');
slides[18] = new Slide('../Photos_files/IMG_0550.jpg', '600', '800', 'The hotel room. Those are the windows.');
slides[19] = new Slide('../Photos_files/IMG_0551.jpg', '600', '800', 'This safe keys to a credit card or other magnetic strip card.');
slides[20] = new Slide('../Photos_files/IMG_0554.jpg', '800', '600', 'What is it?');
slides[21] = new Slide('../Photos_files/IMG_0552.jpg', '800', '600', 'A toilette, of course.');
slides[22] = new Slide('../Photos_files/IMG_0555.jpg', '800', '600', 'An interesting looking sink.');
slides[23] = new Slide('../Photos_files/IMG_0556.jpg', '800', '600', 'Pretty cool looking (water coming out).');
slides[24] = new Slide('../Photos_files/IMG_0557.jpg', '600', '800', 'A view of the restroom.');
slides[25] = new Slide('../Photos_files/IMG_0523.jpg', '600', '800', 'Clear oxtail soup; served with Chinese glass noodles, bok choi and enoki mushrooms.');
slides[26] = new Slide('../Photos_files/IMG_0559.jpg', '600', '800', 'Red Thai curry soup and lobster wontons; on a wasabi flavoured sweet sour cucumber salad');
slides[27] = new Slide('../Photos_files/IMG_0519.jpg', '600', '800', 'Marinated rack of lamb baked in the tandoori oven; served on abergine tomato tarte with hoi sin black bean sauce.');
slides[28] = new Slide('../Photos_files/IMG_0522.jpg', '600', '800', 'Veal medallions glazed with Sichuan honey; served on leek risotto and plum horseradish chutney.');
slides[29] = new Slide('../Photos_files/IMG_0560.jpg', '600', '800', 'Grilled wagyu ribeye steak; with red wine sauce, garlic puree with carrot emlsion and roasted potato wedges.');
slides[30] = new Slide('../Photos_files/IMG_0520.jpg', '600', '800', 'Crème brûlée of coconut; with mango-maki');
slides[31] = new Slide('../Photos_files/IMG_0521.jpg', '600', '800', 'Chocolate temptation; served with wattle seed ice cream and a chutney of Australian baby lime');
slides[32] = new Slide('../Photos_files/IMG_0558.jpg', '600', '800', 'Vattalapan palm flan from Sri Lanka; served with tandoori pineapple and citrus sorbet');
slides[33] = new Slide('../Photos_files/IMG_0561.jpg', '800', '600', 'Yes sir, the Norman door. Remember, the handle doesn’t turn and you have to push (after inserting the magnetic card).');
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;
    }
}

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

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 onPageLoad()
{
    detectBrowser();
    fixupAllIEPNGBGs();
    fixupIEPNG("id1", "Photos_files/transparent.gif");
    fixupIEPNG("id2", "Photos_files/transparent.gif");
    fixupIEPNG("id3", "Photos_files/transparent.gif");
    fixupIEPNG("id4", "Photos_files/transparent.gif");
    fixupIEPNG("id5", "Photos_files/transparent.gif");
    fixupIEPNG("id6", "Photos_files/transparent.gif");
    fixupIEPNG("id7", "Photos_files/transparent.gif");
    fixupIEPNG("id8", "Photos_files/transparent.gif");
    return true;
}

