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('../Photo gallery 1_files/DSCN8021.jpg', '480', '640', 'where it’s at!');
slides[1] = new Slide('../Photo gallery 1_files/P7250048.jpg', '480', '640', 'HA! i’m supposed to be flying this thing.');
slides[2] = new Slide('../Photo gallery 1_files/P1010046.jpg', '480', '558', 'pre test through OZ!');
slides[3] = new Slide('../Photo gallery 1_files/P1010038.jpg', '479', '640', 'surf is up!');
slides[4] = new Slide('../Photo gallery 1_files/P1010014.jpg', '479', '640', 'poor little apostle!');
slides[5] = new Slide('../Photo gallery 1_files/P4290018.jpg', '479', '640', 'A hippopotamus');
slides[6] = new Slide('../Photo gallery 1_files/P4280012.jpg', '479', '640', 'Limpopo in Swaziland');
slides[7] = new Slide('../Photo gallery 1_files/P5140038.jpg', '479', '640', 'weeping willow in kruger, who would have thought it?');
slides[8] = new Slide('../Photo gallery 1_files/P5010037.jpg', '479', '640', 'platypus in kruger!');
slides[9] = new Slide('../Photo gallery 1_files/P5150044.jpg', '480', '359', 'honey badger.');
slides[10] = new Slide('../Photo gallery 1_files/P5160047.jpg', '391', '640', 'A banksia.');
slides[11] = new Slide('../Photo gallery 1_files/P6070001.jpg', '479', '640', 'sall in Lesotho');
slides[12] = new Slide('../Photo gallery 1_files/P6070002.jpg', '479', '640', 'sall admiring the view');
slides[13] = new Slide('../Photo gallery 1_files/P6080010.jpg', '479', '640', 'sall and i trying to keep warm.');
slides[14] = new Slide('../Photo gallery 1_files/P6080005.jpg', '479', '640', 'sall flying solo!');
slides[15] = new Slide('../Photo gallery 1_files/P6180003.jpg', '479', '640', 'floods at Ifafa beach');
slides[16] = new Slide('../Photo gallery 1_files/P6160019.jpg', '479', '640', 'OOPS!');
slides[17] = new Slide('../Photo gallery 1_files/P6160020.jpg', '479', '640', 'shit a brick!');
slides[18] = new Slide('../Photo gallery 1_files/P6160017_1.jpg', '479', '640', 'Na! she’s just showing off, and flashing.');
slides[19] = new Slide('../Photo gallery 1_files/P6180011.jpg', '479', '640', 'buggerit not again!');
slides[20] = new Slide('../Photo gallery 1_files/P1000205.jpg', '480', '640', 'mere cats yawning');
slides[21] = new Slide('../Photo gallery 1_files/P1000401.jpg', '600', '800', 'A dingo and pup.');
slides[22] = new Slide('../Photo gallery 1_files/P1000256.jpg', '480', '640', 'Margreets southern rite whale.');
slides[23] = new Slide('../Photo gallery 1_files/P1000763.jpg', '480', '640', 'hump back whale');
slides[24] = new Slide('../Photo gallery 1_files/P1000741.jpg', '480', '640', 'YEP! pancakes');
slides[25] = new Slide('../Photo gallery 1_files/P1000774.jpg', '480', '360', 'Bendy!');
slides[26] = new Slide('../Photo gallery 1_files/P6250012.jpg', '480', '359', 'shit!not mining again!');
slides[27] = new Slide('../Photo gallery 1_files/P1010028.jpg', '480', '640', 'camping at bald spot, he he');
slides[28] = new Slide('../Photo gallery 1_files/P1010027.jpg', '480', '640', 'still at bald spot.');
slides[29] = new Slide('../Photo gallery 1_files/P1010030.jpg', '480', '640', 'Yep! you guessed it.');
slides[30] = new Slide('../Photo gallery 1_files/P1010081.jpg', '480', '640', 'Moonbi on a mid winters morn');
slides[31] = new Slide('../Photo gallery 1_files/P1010077.jpg', '600', '800', 'most southern tip of africa ca ca');
slides[32] = new Slide('../Photo gallery 1_files/P4290014.jpg', '479', '640', 'an appaloosa.');
slides[33] = new Slide('../Photo gallery 1_files/P4280003.jpg', '479', '640', 'a parliament of crows');
slides[34] = new Slide('../Photo gallery 1_files/P6240008.jpg', '479', '640', 'the rare thylacine');
slides[35] = new Slide('../Photo gallery 1_files/P6240006.jpg', '479', '640', 'pygmy hippo');
isPureISOLatin1 = true;
contentEncodingConstant = 4;
feedbackURL = "TODO";
showFeedbackButton = false;
feedbackEnabled = true;

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", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id2", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id3", "Photo gallery 1_files/transparent.gif");
    fixupAllIEPNGBGs();
    fixupIEPNG("id4", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id5", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id6", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id7", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id8", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id9", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id10", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id11", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id12", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id13", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id14", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id15", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id16", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id17", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id18", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id19", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id20", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id21", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id22", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id23", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id24", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id25", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id26", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id27", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id28", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id29", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id30", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id31", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id32", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id33", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id34", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id35", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id36", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id37", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id38", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id39", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id40", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id41", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id42", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id43", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id44", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id45", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id46", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id47", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id48", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id49", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id50", "Photo gallery 1_files/transparent.gif");
    fixupIEPNG("id51", "Photo gallery 1_files/transparent.gif");
    return 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 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;
}

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

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 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;
}


