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('../LRBC_files/_DSC4002.jpg', '529', '800', '_DSC4002.NEF');
slides[1] = new Slide('../LRBC_files/DSC_4042.jpg', '529', '800', 'DSC_4042.NEF');
slides[2] = new Slide('../LRBC_files/_DSC4190.jpg', '529', '800', '_DSC4190.NEF');
slides[3] = new Slide('../LRBC_files/DSC_4044.jpg', '529', '800', 'DSC_4044.NEF');
slides[4] = new Slide('../LRBC_files/_DSC4022.jpg', '529', '800', '_DSC4022.NEF');
slides[5] = new Slide('../LRBC_files/_DSC4012.jpg', '529', '800', '_DSC4012.NEF');
slides[6] = new Slide('../LRBC_files/_DSC4015.jpg', '529', '800', '_DSC4015.NEF');
slides[7] = new Slide('../LRBC_files/_DSC4017.jpg', '529', '800', '_DSC4017.NEF');
slides[8] = new Slide('../LRBC_files/_DSC4020.jpg', '529', '800', '_DSC4020.NEF');
slides[9] = new Slide('../LRBC_files/_DSC4103.jpg', '529', '800', '_DSC4103.NEF');
slides[10] = new Slide('../LRBC_files/_DSC4108.jpg', '529', '800', '_DSC4108.NEF');
slides[11] = new Slide('../LRBC_files/DSC_4151.jpg', '529', '800', 'DSC_4151.NEF');
slides[12] = new Slide('../LRBC_files/DSC_4152.jpg', '529', '800', 'DSC_4152.NEF');
slides[13] = new Slide('../LRBC_files/DSC_4155.jpg', '529', '800', 'DSC_4155.NEF');
slides[14] = new Slide('../LRBC_files/_DSC4018.jpg', '529', '800', '_DSC4018.NEF');
slides[15] = new Slide('../LRBC_files/_DSC4019.jpg', '529', '800', '_DSC4019.NEF');
slides[16] = new Slide('../LRBC_files/_DSC4026.jpg', '529', '800', '_DSC4026.NEF');
slides[17] = new Slide('../LRBC_files/_DSC4027.jpg', '529', '800', '_DSC4027.NEF');
slides[18] = new Slide('../LRBC_files/_DSC4028.jpg', '529', '800', '_DSC4028.NEF');
slides[19] = new Slide('../LRBC_files/_DSC4180.jpg', '529', '800', '_DSC4180.NEF');
slides[20] = new Slide('../LRBC_files/_DSC4182.jpg', '529', '800', '_DSC4182.NEF');
slides[21] = new Slide('../LRBC_files/_DSC4184.jpg', '529', '800', '_DSC4184.NEF');
slides[22] = new Slide('../LRBC_files/_DSC4186.jpg', '529', '800', '_DSC4186.NEF');
slides[23] = new Slide('../LRBC_files/_DSC4188.jpg', '529', '800', '_DSC4188.NEF');
slides[24] = new Slide('../LRBC_files/DSC_4147.jpg', '529', '800', 'DSC_4147.NEF');
slides[25] = new Slide('../LRBC_files/DSC_4029.jpg', '529', '800', 'DSC_4029.NEF');
slides[26] = new Slide('../LRBC_files/DSC_4032.jpg', '529', '800', 'DSC_4032.NEF');
slides[27] = new Slide('../LRBC_files/_DSC4061.jpg', '529', '800', '_DSC4061.NEF');
slides[28] = new Slide('../LRBC_files/DSC_4030.jpg', '529', '800', 'DSC_4030.NEF');
slides[29] = new Slide('../LRBC_files/DSC_4034.jpg', '529', '800', 'DSC_4034.NEF');
slides[30] = new Slide('../LRBC_files/DSC_4035.jpg', '529', '800', 'DSC_4035.NEF');
slides[31] = new Slide('../LRBC_files/DSC_4033.jpg', '529', '800', 'DSC_4033.NEF');
slides[32] = new Slide('../LRBC_files/DSC_4036.jpg', '529', '800', 'DSC_4036.NEF');
slides[33] = new Slide('../LRBC_files/DSC_4038.jpg', '529', '800', 'DSC_4038.NEF');
slides[34] = new Slide('../LRBC_files/DSC_4039.jpg', '529', '800', 'DSC_4039.NEF');
slides[35] = new Slide('../LRBC_files/DSC_4040.jpg', '529', '800', 'DSC_4040.NEF');
slides[36] = new Slide('../LRBC_files/DSC_4045.jpg', '529', '800', 'DSC_4045.NEF');
slides[37] = new Slide('../LRBC_files/_DSC4062.jpg', '529', '800', '_DSC4062.NEF');
slides[38] = new Slide('../LRBC_files/_DSC4052.jpg', '529', '800', '_DSC4052.NEF');
slides[39] = new Slide('../LRBC_files/_DSC4055.jpg', '529', '800', '_DSC4055.NEF');
slides[40] = new Slide('../LRBC_files/_DSC4056.jpg', '529', '800', '_DSC4056.NEF');
slides[41] = new Slide('../LRBC_files/_DSC4058.jpg', '529', '800', '_DSC4058.NEF');
slides[42] = new Slide('../LRBC_files/_DSC4064.jpg', '529', '800', '_DSC4064.NEF');
slides[43] = new Slide('../LRBC_files/_DSC4067.jpg', '529', '800', '_DSC4067.NEF');
slides[44] = new Slide('../LRBC_files/_DSC4073.jpg', '529', '800', '_DSC4073.NEF');
slides[45] = new Slide('../LRBC_files/_DSC4079.jpg', '529', '800', '_DSC4079.NEF');
slides[46] = new Slide('../LRBC_files/_DSC4082.jpg', '529', '800', '_DSC4082.NEF');
slides[47] = new Slide('../LRBC_files/_DSC4121.jpg', '529', '800', '_DSC4121.NEF');
slides[48] = new Slide('../LRBC_files/_DSC4130.jpg', '529', '800', '_DSC4130.NEF');
slides[49] = new Slide('../LRBC_files/_DSC4137.jpg', '529', '800', '_DSC4137.NEF');
slides[50] = new Slide('../LRBC_files/_DSC4123.jpg', '529', '800', '_DSC4123.NEF');
slides[51] = new Slide('../LRBC_files/_DSC4134.jpg', '800', '529', '_DSC4134.NEF');
slides[52] = new Slide('../LRBC_files/_DSC4135.jpg', '800', '529', '_DSC4135.NEF');
slides[53] = new Slide('../LRBC_files/_DSC4136.jpg', '529', '800', '_DSC4136.NEF');
slides[54] = new Slide('../LRBC_files/_DSC4128.jpg', '529', '800', '_DSC4128.NEF');
slides[55] = new Slide('../LRBC_files/_DSC4145.jpg', '529', '800', '_DSC4145.NEF');
slides[56] = new Slide('../LRBC_files/_DSC4138.jpg', '529', '800', '_DSC4138.NEF');
slides[57] = new Slide('../LRBC_files/_DSC4144.jpg', '529', '800', '_DSC4144.NEF');
slides[58] = new Slide('../LRBC_files/_DSC4140.jpg', '529', '800', '_DSC4140.NEF');
slides[59] = new Slide('../LRBC_files/_DSC4143.jpg', '529', '800', '_DSC4143.NEF');
slides[60] = new Slide('../LRBC_files/DSC_4158.jpg', '529', '800', 'DSC_4158.NEF');
slides[61] = new Slide('../LRBC_files/DSC_4160.jpg', '529', '800', 'DSC_4160.NEF');
slides[62] = new Slide('../LRBC_files/DSC_4168.jpg', '529', '800', 'DSC_4168.NEF');
slides[63] = new Slide('../LRBC_files/_DSC4170.jpg', '526', '800', '_DSC4170.NEF');
slides[64] = new Slide('../LRBC_files/_DSC4177.jpg', '529', '800', '_DSC4177.NEF');
slides[65] = new Slide('../LRBC_files/_DSC4173.jpg', '529', '800', '_DSC4173.NEF');
slides[66] = new Slide('../LRBC_files/_DSC4178.jpg', '529', '800', '_DSC4178.NEF');
slides[67] = new Slide('../LRBC_files/_DSC4192.jpg', '529', '800', '_DSC4192.NEF');
isPureISOLatin1 = true;
contentEncodingConstant = 4;
feedbackURL = "TODO";
showFeedbackButton = false;
feedbackEnabled = 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 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 onPageLoad()
{
    detectBrowser();
    fixupIEPNG("id1", "LRBC_files/transparent.gif");
    fixupAllIEPNGBGs();
    fixupIEPNG("id2", "LRBC_files/transparent.gif");
    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 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;
    }
}

