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('../PORTRAITS_files/Tiananmen Square Photographer_9289.jpg', '504', '335', 'Tiananmen Square Photographer 9289');
slides[1] = new Slide('../PORTRAITS_files/Rebuke of the Son_9302.jpg', '504', '758', 'Rebuke of the Son, Tiananmen 9302');
slides[2] = new Slide('../PORTRAITS_files/Eating Chinese_9573.jpg', '504', '335', 'Eating Chinese, China 9573');
slides[3] = new Slide('../PORTRAITS_files/ManInWhite_9689.jpg', '504', '335', 'Man In White, China 9689');
slides[4] = new Slide('../PORTRAITS_files/UmberllaChinaMan_9696.jpg', '504', '365', 'Umbrella China Man 9696');
slides[5] = new Slide('../PORTRAITS_files/DSC_9751.jpg', '504', '335', 'Chinese Merchant 9751');
slides[6] = new Slide('../PORTRAITS_files/Three Umbrella\u0027s_4371-2.jpg', '504', '336', 'Three Umbrella\u0027s, Xi-An China 4371');
slides[7] = new Slide('../PORTRAITS_files/Kids and Glass_9968.jpg', '504', '758', 'Under Glass, Xi-An China 9968');
slides[8] = new Slide('../PORTRAITS_files/RoundRimglasses0028.jpg', '504', '335', 'Round Rims, China 0028');
slides[9] = new Slide('../PORTRAITS_files/Li_River_Begger_0299.jpg', '504', '335', 'Li River Begger, China  0299');
slides[10] = new Slide('../PORTRAITS_files/Lilly Man Yangshou303 copy.jpg', '504', '335', 'Lilly Man Yangshou, China 303');
slides[11] = new Slide('../PORTRAITS_files/GirlFence86451.jpg', '569', '800', 'Fenced In Bolivia 86451');
slides[12] = new Slide('../PORTRAITS_files/Bol_Girl_2_04-08-23-c-44521.jpg', '533', '800', 'Bolivian Jungle Fire 44521');
slides[13] = new Slide('../PORTRAITS_files/Bol_Bush_Brothers_04-08-24-c-477 copy10.jpg', '446', '383', 'Bolivian Bush Brothers 477');
slides[14] = new Slide('../PORTRAITS_files/Bol_Village_Girls_04-08-25Flat18.jpg', '576', '411', 'Bolivian Village Girls  18');
slides[15] = new Slide('../PORTRAITS_files/Bol_Woman_Goat_196Flat20.jpg', '576', '392', 'Bolivian Shepherd 196');
slides[16] = new Slide('../PORTRAITS_files/Bol_Cream_Girl_Hat_04-08-29-c-180 copy15.jpg', '533', '800', 'Bolivian Sheep Herder 180');
slides[17] = new Slide('../PORTRAITS_files/Bol_Aymara_Woman_ElAlto_04-08-31-c-0834.jpg', '576', '383', 'Bolivian Aymara Woman El Alto 0834');
slides[18] = new Slide('../PORTRAITS_files/PrayingHands5060 copy25.jpg', '576', '383', 'Praying Hands, Honduras 5060');
slides[19] = new Slide('../PORTRAITS_files/GJ975305Flat1.jpg', '576', '392', 'Honduran Query');
slides[20] = new Slide('../PORTRAITS_files/WhiteEarRings656132.jpg', '576', '383', 'Rings A Glow, Honduras 6132');
slides[21] = new Slide('../PORTRAITS_files/OlderWhiteHairMale660318.jpg', '576', '383', 'Elder Statesman, Honduras 0318');
slides[22] = new Slide('../PORTRAITS_files/FrailWoman665411.jpg', '576', '383', 'Frail Woman, Honduras 5411');
slides[23] = new Slide('../PORTRAITS_files/SowingTheSeed699326.jpg', '576', '383', 'Sowing Seed Honduras 9326');
slides[24] = new Slide('../PORTRAITS_files/WhiteTurbanBeard784877.jpg', '540', '359', 'White Turban Africa 4877');
slides[25] = new Slide('../PORTRAITS_files/Serious Friend.jpg', '362', '504', 'Intense Friends, Africa');
slides[26] = new Slide('../PORTRAITS_files/FourEverFriends295025.jpg', '533', '800', 'Four Ever Friends, Africa 5025');
slides[27] = new Slide('../PORTRAITS_files/GateBoy797630.jpg', '540', '359', 'Gate Boy, Africa 7630');
slides[28] = new Slide('../PORTRAITS_files/BestFriends29937.jpg', '540', '359', 'Best Friends, Africa 9937');
slides[29] = new Slide('../PORTRAITS_files/InquiringLad304239.jpg', '540', '359', 'Inquiring Lad, Africa 239');
slides[30] = new Slide('../PORTRAITS_files/Perar317062.jpg', '540', '359', 'Perar, Africa 7062');
slides[31] = new Slide('../PORTRAITS_files/BreakMan318416.jpg', '540', '359', 'Break Man, Africa 318416');
slides[32] = new Slide('../PORTRAITS_files/Boy In Blue 327510.jpg', '540', '359', 'Boy In Blue, Africa 327510');
slides[33] = new Slide('../PORTRAITS_files/GirlInPearls822431.jpg', '540', '359', 'Girl In Pearls, Africa 2431');
slides[34] = new Slide('../PORTRAITS_files/RedCheckeredTurbin836565.jpg', '540', '359', 'Red Checkered Turbin, Africa 6565');
slides[35] = new Slide('../PORTRAITS_files/BlueDressGirl84099.jpg', '540', '359', 'Blue Dress Girl, Africa 4099');
slides[36] = new Slide('../PORTRAITS_files/1Kindergarten_Kids_12030.jpg', '533', '800', 'Kindergarten In Africa 2030');
slides[37] = new Slide('../PORTRAITS_files/BoyRedCup376312.jpg', '533', '800', 'Red Cup and Tea, Africa 376312');
slides[38] = new Slide('../PORTRAITS_files/BoyTightCrop408913.jpg', '533', '800', 'African Portrait Boy 08913');
slides[39] = new Slide('../PORTRAITS_files/ManRedTurbinFull416249.jpg', '540', '359', 'African Red Turbin, Africa 6249');
slides[40] = new Slide('../PORTRAITS_files/HitchHiker435938.jpg', '540', '359', 'African Hitch Hiker435938');
slides[41] = new Slide('../PORTRAITS_files/BanannaLady87492.jpg', '540', '359', 'Bananna Lady, Africa 7492');
slides[42] = new Slide('../PORTRAITS_files/Veggie_Peddler_088821.jpg', '426', '640', 'Veggie Peddler, Kathmandu 8821');
slides[43] = new Slide('../PORTRAITS_files/Rickshaw_Boy_105216.jpg', '800', '533', 'Rickshaw Boy Kathmandu 5216');
slides[44] = new Slide('../PORTRAITS_files/Hindu_Holy_Man_10966.jpg', '800', '533', 'Hindu Holy Man Kathmandu 0966');
slides[45] = new Slide('../PORTRAITS_files/Water_Boy_120722.jpg', '800', '533', 'Water Boy, Kathmandu 0722');
slides[46] = new Slide('../PORTRAITS_files/Barbeque_Steps_14300.jpg', '800', '546', 'Barbeque Steps  Kathmandu 4300');
slides[47] = new Slide('../PORTRAITS_files/Girl_Steps_15545.jpg', '800', '533', 'Girl Steps Kathmandu 15545');
slides[48] = new Slide('../PORTRAITS_files/Women_Square_157723.jpg', '426', '640', 'Women Square, Kathmandu 7723');
slides[49] = new Slide('../PORTRAITS_files/Boy_Hands_2072.jpg', '425', '640', 'Hand Trick for Sale, Kathmandu 2072');
slides[50] = new Slide('../PORTRAITS_files/Market_Boy_210113.jpg', '533', '800', 'Market Girl, Kathmandu 0113');
slides[51] = new Slide('../PORTRAITS_files/Prayerful_Hindu_Girl_2450.jpg', '532', '800', 'Prayerful Hindu Girl Kathmandu 2450');
slides[52] = new Slide('../PORTRAITS_files/Man_Rope_212212.jpg', '800', '533', 'Man Rope, Kathmandu 2212');
slides[53] = new Slide('../PORTRAITS_files/Young_Boy_Thamaksu_4058.jpg', '800', '800', 'Young Boy Thamaksu, Everest 4058');
slides[54] = new Slide('../PORTRAITS_files/Mountain_Man_Dingboche_Color_4410.jpg', '800', '532', 'Mountain Man Dingboche , Everest 4410');
slides[55] = new Slide('../PORTRAITS_files/Boy_Rice_Bowl5632.jpg', '800', '532', 'Rice Boy, Kathmandu 5632');
slides[56] = new Slide('../PORTRAITS_files/Woman_In_Red_Drape_5772.jpg', '532', '800', 'Woman In Red Drape Kathmandu 5772');
slides[57] = new Slide('../PORTRAITS_files/Homeless_In_Green_5985.jpg', '800', '532', 'Homeless In Green, Kathmandu 5985');
slides[58] = new Slide('../PORTRAITS_files/Homeless_In_Purple_Scarf_6014.jpg', '800', '532', 'Homeless In Purple Scarf Kathmandu 6014');
slides[59] = new Slide('../PORTRAITS_files/Lady_Smoking_63829.jpg', '800', '533', 'Lady Smoking Hash, Tibet Border 3829');
slides[60] = new Slide('../PORTRAITS_files/Recycle_Cycle_7527.jpg', '640', '800', 'Recycling Cycler, Kathmandu 7527');
slides[61] = new Slide('../PORTRAITS_files/New_Believer_77_7771.jpg', '800', '598', 'Elder Believer, Kathmandu 7771');
slides[62] = new Slide('../PORTRAITS_files/Produce_Man_8140.jpg', '640', '800', 'Produce Man Kathmandu 8140');
isPureISOLatin1 = true;
contentEncodingConstant = 4;
feedbackURL = "TODO";
showFeedbackButton = false;
feedbackEnabled = true;

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

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

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

function onPageLoad()
{
    detectBrowser();
    fixupAllIEPNGBGs();
    fixupIEPNG("id1", "PORTRAITS_files/transparent.gif");
    fixupIEPNG("id2", "PORTRAITS_files/transparent.gif");
    fixupIEPNG("id3", "PORTRAITS_files/transparent.gif");
    return true;
}

