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('../texas ranch adventure 3.07_files/DSC00075.jpg', '588', '800', 'DSC00075.JPG');
slides[1] = new Slide('../texas ranch adventure 3.07_files/DSC00077.jpg', '596', '800', 'DSC00077.JPG');
slides[2] = new Slide('../texas ranch adventure 3.07_files/DSC00079.jpg', '600', '800', 'DSC00079.JPG');
slides[3] = new Slide('../texas ranch adventure 3.07_files/DSC00082.jpg', '594', '800', 'DSC00082.JPG');
slides[4] = new Slide('../texas ranch adventure 3.07_files/DSC00085.jpg', '591', '800', 'DSC00085.JPG');
slides[5] = new Slide('../texas ranch adventure 3.07_files/DSC00086.jpg', '599', '800', 'DSC00086.JPG');
slides[6] = new Slide('../texas ranch adventure 3.07_files/DSC00094.jpg', '600', '800', 'DSC00094.JPG');
slides[7] = new Slide('../texas ranch adventure 3.07_files/DSC00096.jpg', '600', '800', 'DSC00096.JPG');
slides[8] = new Slide('../texas ranch adventure 3.07_files/DSC00097.jpg', '600', '800', 'DSC00097.JPG');
slides[9] = new Slide('../texas ranch adventure 3.07_files/DSC00100.jpg', '597', '800', 'DSC00100.JPG');
slides[10] = new Slide('../texas ranch adventure 3.07_files/DSC00101.jpg', '597', '800', 'DSC00101.JPG');
slides[11] = new Slide('../texas ranch adventure 3.07_files/DSC00102.jpg', '600', '800', 'DSC00102.JPG');
slides[12] = new Slide('../texas ranch adventure 3.07_files/SANY0013.jpg', '599', '800', 'SANY0013.JPG');
slides[13] = new Slide('../texas ranch adventure 3.07_files/SANY0017.jpg', '599', '800', 'SANY0017.JPG');
slides[14] = new Slide('../texas ranch adventure 3.07_files/SANY0018.jpg', '599', '800', 'SANY0018.JPG');
slides[15] = new Slide('../texas ranch adventure 3.07_files/SANY0020.jpg', '593', '800', 'SANY0020.JPG');
slides[16] = new Slide('../texas ranch adventure 3.07_files/SANY0021.jpg', '578', '800', 'SANY0021.JPG');
slides[17] = new Slide('../texas ranch adventure 3.07_files/SANY0022.jpg', '559', '800', 'SANY0022.JPG');
slides[18] = new Slide('../texas ranch adventure 3.07_files/SANY0023.jpg', '545', '800', 'SANY0023.JPG');
slides[19] = new Slide('../texas ranch adventure 3.07_files/SANY0024.jpg', '592', '800', 'SANY0024.JPG');
slides[20] = new Slide('../texas ranch adventure 3.07_files/SANY0034.jpg', '563', '800', 'SANY0034.JPG');
slides[21] = new Slide('../texas ranch adventure 3.07_files/SANY0039.jpg', '597', '800', 'SANY0039.JPG');
slides[22] = new Slide('../texas ranch adventure 3.07_files/SANY0043.jpg', '599', '800', 'SANY0043.JPG');
slides[23] = new Slide('../texas ranch adventure 3.07_files/SANY0044.jpg', '588', '800', 'SANY0044.JPG');
slides[24] = new Slide('../texas ranch adventure 3.07_files/SANY0045.jpg', '599', '800', 'SANY0045.JPG');
slides[25] = new Slide('../texas ranch adventure 3.07_files/SANY0048.jpg', '579', '800', 'SANY0048.JPG');
slides[26] = new Slide('../texas ranch adventure 3.07_files/SANY0053.jpg', '599', '800', 'SANY0053.JPG');
slides[27] = new Slide('../texas ranch adventure 3.07_files/SANY0055.jpg', '489', '800', 'SANY0055.JPG');
slides[28] = new Slide('../texas ranch adventure 3.07_files/SANY0057.jpg', '535', '800', 'SANY0057.JPG');
slides[29] = new Slide('../texas ranch adventure 3.07_files/SANY0068.jpg', '588', '800', 'SANY0068.JPG');
slides[30] = new Slide('../texas ranch adventure 3.07_files/SANY0069.jpg', '583', '800', 'SANY0069.JPG');
slides[31] = new Slide('../texas ranch adventure 3.07_files/SANY0073.jpg', '583', '800', 'SANY0073.JPG');
slides[32] = new Slide('../texas ranch adventure 3.07_files/SANY0075.jpg', '528', '800', 'SANY0075.JPG');
slides[33] = new Slide('../texas ranch adventure 3.07_files/SANY0076.jpg', '577', '800', 'SANY0076.JPG');
slides[34] = new Slide('../texas ranch adventure 3.07_files/SANY0002.jpg', '599', '800', 'SANY0002.JPG');
slides[35] = new Slide('../texas ranch adventure 3.07_files/SANY0017_2.jpg', '578', '800', 'SANY0017.JPG');
slides[36] = new Slide('../texas ranch adventure 3.07_files/SANY0018_2.jpg', '590', '800', 'SANY0018.JPG');
slides[37] = new Slide('../texas ranch adventure 3.07_files/SANY0023_2.jpg', '570', '800', 'SANY0023.JPG');
slides[38] = new Slide('../texas ranch adventure 3.07_files/SANY0024_2.jpg', '599', '800', 'SANY0024.JPG');
slides[39] = new Slide('../texas ranch adventure 3.07_files/SANY0026.jpg', '599', '800', 'SANY0026.JPG');
slides[40] = new Slide('../texas ranch adventure 3.07_files/IMG_1392.jpg', '600', '800', 'IMG_1392');
slides[41] = new Slide('../texas ranch adventure 3.07_files/IMG_1393.jpg', '600', '800', 'IMG_1393');
slides[42] = new Slide('../texas ranch adventure 3.07_files/IMG_1394.jpg', '600', '800', 'IMG_1394');
slides[43] = new Slide('../texas ranch adventure 3.07_files/IMG_1395.jpg', '600', '800', 'IMG_1395');
slides[44] = new Slide('../texas ranch adventure 3.07_files/IMG_1403.jpg', '600', '800', 'IMG_1403');
slides[45] = new Slide('../texas ranch adventure 3.07_files/IMG_1407.jpg', '600', '800', 'IMG_1407');
slides[46] = new Slide('../texas ranch adventure 3.07_files/IMG_1408.jpg', '600', '800', 'IMG_1408');
slides[47] = new Slide('../texas ranch adventure 3.07_files/IMG_1409.jpg', '600', '800', 'IMG_1409');
slides[48] = new Slide('../texas ranch adventure 3.07_files/IMG_1411.jpg', '600', '800', 'IMG_1411');
slides[49] = new Slide('../texas ranch adventure 3.07_files/IMG_1412.jpg', '600', '800', 'IMG_1412');
slides[50] = new Slide('../texas ranch adventure 3.07_files/IMG_1414.jpg', '600', '800', 'IMG_1414');
slides[51] = new Slide('../texas ranch adventure 3.07_files/IMG_1417.jpg', '600', '800', 'IMG_1417');
slides[52] = new Slide('../texas ranch adventure 3.07_files/IMG_1420.jpg', '600', '800', 'IMG_1420');
slides[53] = new Slide('../texas ranch adventure 3.07_files/IMG_1422.jpg', '600', '800', 'IMG_1422');
slides[54] = new Slide('../texas ranch adventure 3.07_files/IMG_1428.jpg', '600', '800', 'IMG_1428');
slides[55] = new Slide('../texas ranch adventure 3.07_files/IMG_1436.jpg', '600', '800', 'IMG_1436');
slides[56] = new Slide('../texas ranch adventure 3.07_files/IMG_1437.jpg', '600', '800', 'IMG_1437');
slides[57] = new Slide('../texas ranch adventure 3.07_files/IMG_1442.jpg', '600', '800', 'IMG_1442');
slides[58] = new Slide('../texas ranch adventure 3.07_files/IMG_1444.jpg', '600', '800', 'IMG_1444');
slides[59] = new Slide('../texas ranch adventure 3.07_files/IMG_1446.jpg', '600', '800', 'IMG_1446');
slides[60] = new Slide('../texas ranch adventure 3.07_files/IMG_1448.jpg', '600', '800', 'IMG_1448');
slides[61] = new Slide('../texas ranch adventure 3.07_files/IMG_1451.jpg', '600', '800', 'IMG_1451');
slides[62] = new Slide('../texas ranch adventure 3.07_files/IMG_1455.jpg', '800', '600', 'IMG_1455');
slides[63] = new Slide('../texas ranch adventure 3.07_files/IMG_1458.jpg', '600', '800', 'IMG_1458');
slides[64] = new Slide('../texas ranch adventure 3.07_files/IMG_1460.jpg', '600', '800', 'IMG_1460');
slides[65] = new Slide('../texas ranch adventure 3.07_files/IMG_1462.jpg', '600', '800', 'IMG_1462');
slides[66] = new Slide('../texas ranch adventure 3.07_files/IMG_1467.jpg', '600', '800', 'IMG_1467');
slides[67] = new Slide('../texas ranch adventure 3.07_files/IMG_1476.jpg', '600', '800', 'IMG_1476');
slides[68] = new Slide('../texas ranch adventure 3.07_files/IMG_1477.jpg', '600', '800', 'IMG_1477');
slides[69] = new Slide('../texas ranch adventure 3.07_files/IMG_1478.jpg', '600', '800', 'IMG_1478');
slides[70] = new Slide('../texas ranch adventure 3.07_files/IMG_1479.jpg', '600', '800', 'IMG_1479');
slides[71] = new Slide('../texas ranch adventure 3.07_files/IMG_1480.jpg', '600', '800', 'IMG_1480');
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;
    }
}

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", "texas ranch adventure 3.07_files/transparent.gif");
    fixupIEPNG("id2", "texas ranch adventure 3.07_files/transparent.gif");
    fixupIEPNG("id3", "texas ranch adventure 3.07_files/transparent.gif");
    fixupIEPNG("id4", "texas ranch adventure 3.07_files/transparent.gif");
    fixupAllIEPNGBGs();
    fixupIEPNG("id5", "texas ranch adventure 3.07_files/transparent.gif");
    fixupIEPNG("id6", "texas ranch adventure 3.07_files/transparent.gif");
    fixupIEPNG("id7", "texas ranch adventure 3.07_files/transparent.gif");
    fixupIEPNG("id8", "texas ranch adventure 3.07_files/transparent.gif");
    return true;
}

