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('../Wien_files/01_Stephandom.jpg', '800', '600', '01_Stephandom.JPG');
slides[1] = new Slide('../Wien_files/02_Stephandom.jpg', '600', '800', '02_Stephandom.JPG');
slides[2] = new Slide('../Wien_files/03_Stephandom.jpg', '600', '800', '03_Stephandom.JPG');
slides[3] = new Slide('../Wien_files/04_Stephandom.jpg', '600', '800', '04_Stephandom.JPG');
slides[4] = new Slide('../Wien_files/05_Stephandom.jpg', '600', '800', '05_Stephandom.JPG');
slides[5] = new Slide('../Wien_files/06_Stephandom.jpg', '800', '600', '06_Stephandom.JPG');
slides[6] = new Slide('../Wien_files/07_Stephandom.jpg', '800', '600', '07_Stephandom.JPG');
slides[7] = new Slide('../Wien_files/08_Stephandom.jpg', '800', '600', '08_Stephandom.JPG');
slides[8] = new Slide('../Wien_files/09_Stephandom.jpg', '800', '600', '09_Stephandom.JPG');
slides[9] = new Slide('../Wien_files/10_Stephandom.jpg', '800', '600', '10_Stephandom.JPG');
slides[10] = new Slide('../Wien_files/11_Stephandom.jpg', '800', '600', '11_Stephandom.JPG');
slides[11] = new Slide('../Wien_files/12_Stephandom.jpg', '800', '600', '12_Stephandom.JPG');
slides[12] = new Slide('../Wien_files/13_Stephandom.jpg', '800', '600', '13_Stephandom.JPG');
slides[13] = new Slide('../Wien_files/14_Stephandom.jpg', '800', '600', '14_Stephandom.JPG');
slides[14] = new Slide('../Wien_files/15_Stephandom.jpg', '800', '600', '15_Stephandom.JPG');
slides[15] = new Slide('../Wien_files/16_Stephandom_destroyed.jpg', '800', '600', '16_Stephandom_destroyed.JPG');
slides[16] = new Slide('../Wien_files/17_Stephandom.jpg', '600', '800', '17_Stephandom.JPG');
slides[17] = new Slide('../Wien_files/18_Stephandom_Miniature.jpg', '600', '800', '18_Stephandom_Miniature.JPG');
slides[18] = new Slide('../Wien_files/19_Stephandom.jpg', '600', '800', '19_Stephandom.JPG');
slides[19] = new Slide('../Wien_files/20_Stephandom.jpg', '800', '600', '20_Stephandom.JPG');
slides[20] = new Slide('../Wien_files/21_Stephandom.jpg', '800', '600', '21_Stephandom.JPG');
slides[21] = new Slide('../Wien_files/22_Stephandom_Miniature.jpg', '800', '600', '22_Stephandom_Miniature.JPG');
slides[22] = new Slide('../Wien_files/23_Stephandom_Miniature.jpg', '800', '600', '23_Stephandom_Miniature.JPG');
slides[23] = new Slide('../Wien_files/24_Stephandom_Miniature.jpg', '800', '600', '24_Stephandom_Miniature.JPG');
slides[24] = new Slide('../Wien_files/25_Stephandom_Miniature.jpg', '800', '600', '25_Stephandom_Miniature.JPG');
slides[25] = new Slide('../Wien_files/26_Stephandom_Miniature.jpg', '600', '800', '26_Stephandom_Miniature.JPG');
slides[26] = new Slide('../Wien_files/27_Haas-Haus.jpg', '600', '800', '27_Haas-Haus.JPG');
slides[27] = new Slide('../Wien_files/28_Vienna_Downtown.jpg', '600', '800', '28_Vienna_Downtown.JPG');
slides[28] = new Slide('../Wien_files/29_Vienna_Downtown.jpg', '800', '600', '29_Vienna_Downtown.JPG');
slides[29] = new Slide('../Wien_files/30_Vienna_Downtown.jpg', '800', '600', '30_Vienna_Downtown.JPG');
slides[30] = new Slide('../Wien_files/31_Vienna_Downtown.jpg', '800', '600', '31_Vienna_Downtown.JPG');
slides[31] = new Slide('../Wien_files/32_Vienna_Downtown.jpg', '800', '600', '32_Vienna_Downtown.JPG');
slides[32] = new Slide('../Wien_files/33_Vienna_Downtown.jpg', '800', '600', '33_Vienna_Downtown.JPG');
slides[33] = new Slide('../Wien_files/34_Hofburg.jpg', '600', '800', '34_Hofburg.JPG');
slides[34] = new Slide('../Wien_files/35_Hofburg_Map.jpg', '800', '600', '35_Hofburg_Map.JPG');
slides[35] = new Slide('../Wien_files/36_Hofburg_Map.jpg', '600', '800', '36_Hofburg_Map.JPG');
slides[36] = new Slide('../Wien_files/37_Hofburg.jpg', '800', '600', '37_Hofburg.JPG');
slides[37] = new Slide('../Wien_files/38_Michaelerplatz.jpg', '600', '800', '38_Michaelerplatz.JPG');
slides[38] = new Slide('../Wien_files/39_Hofburg.jpg', '600', '800', '39_Hofburg.JPG');
slides[39] = new Slide('../Wien_files/40_Hofburg.jpg', '800', '600', '40_Hofburg.JPG');
slides[40] = new Slide('../Wien_files/41_Alte_Hofburg.jpg', '600', '800', '41_Alte_Hofburg.JPG');
slides[41] = new Slide('../Wien_files/42_Alte_Hofburg_Sisi_House.jpg', '800', '600', '42_Alte_Hofburg_Sisi_House.JPG');
slides[42] = new Slide('../Wien_files/43_Sisi_Museum.jpg', '800', '600', '43_Sisi_Museum.JPG');
slides[43] = new Slide('../Wien_files/44_Alte_Hofburg.jpg', '800', '600', '44_Alte_Hofburg.JPG');
slides[44] = new Slide('../Wien_files/45_Alte_Hofburg.jpg', '600', '800', '45_Alte_Hofburg.JPG');
slides[45] = new Slide('../Wien_files/46_Alte_Hofburg.jpg', '600', '800', '46_Alte_Hofburg.JPG');
slides[46] = new Slide('../Wien_files/47_Alte_Hofburg.jpg', '800', '600', '47_Alte_Hofburg.JPG');
slides[47] = new Slide('../Wien_files/48_Neue_Hofburg.jpg', '800', '600', '48_Neue_Hofburg.JPG');
slides[48] = new Slide('../Wien_files/49_Neue_Hofburg.jpg', '600', '800', '49_Neue_Hofburg.JPG');
slides[49] = new Slide('../Wien_files/50_Alte_Hofburg.jpg', '800', '600', '50_Alte_Hofburg.JPG');
slides[50] = new Slide('../Wien_files/51_Alte_Hofburg.jpg', '800', '600', '51_Alte_Hofburg.JPG');
slides[51] = new Slide('../Wien_files/52_National_Library.jpg', '600', '800', '52_National_Library.JPG');
slides[52] = new Slide('../Wien_files/53_Heldenplatz.jpg', '600', '800', '53_Heldenplatz.JPG');
slides[53] = new Slide('../Wien_files/54_Volksgarten_und_Rathaus_Town_Hall.jpg', '600', '800', '54_Volksgarten_und_Rathaus_Town_Hall.JPG');
slides[54] = new Slide('../Wien_files/55_Alte_Hofburg.jpg', '600', '800', '55_Alte_Hofburg.JPG');
slides[55] = new Slide('../Wien_files/56_National_Library.jpg', '600', '800', '56_National_Library.JPG');
slides[56] = new Slide('../Wien_files/57_Rathaus_Town_Hall.jpg', '600', '800', '57_Rathaus_Town_Hall.JPG');
slides[57] = new Slide('../Wien_files/58_Theseus_Tempel.jpg', '600', '800', '58_Theseus_Tempel.JPG');
slides[58] = new Slide('../Wien_files/59_National_Library.jpg', '600', '800', '59_National_Library.JPG');
slides[59] = new Slide('../Wien_files/60_Kunsthistorisches_Museum_History_of_art.jpg', '600', '800', '60_Kunsthistorisches_Museum_History_of_art.JPG');
slides[60] = new Slide('../Wien_files/61_Heldentor.jpg', '600', '800', '61_Heldentor.JPG');
slides[61] = new Slide('../Wien_files/62_Kunsthistorisches_Museum_History_of_art.jpg', '600', '800', '62_Kunsthistorisches_Museum_History_of_art.JPG');
slides[62] = new Slide('../Wien_files/63_Naturhistorisches_Museum_Natural History.jpg', '600', '800', '63_Naturhistorisches_Museum_Natural History.JPG');
slides[63] = new Slide('../Wien_files/64_Museums_Quartier.jpg', '600', '800', '64_Museums_Quartier.JPG');
slides[64] = new Slide('../Wien_files/65_Naturhistorisches_Museum_Natural History.jpg', '600', '800', '65_Naturhistorisches_Museum_Natural History.JPG');
slides[65] = new Slide('../Wien_files/66_Maria-Theresien_Platz.jpg', '800', '600', '66_Maria-Theresien_Platz.JPG');
slides[66] = new Slide('../Wien_files/67_Kunsthistorisches_Museum_History_of_art.jpg', '600', '800', '67_Kunsthistorisches_Museum_History_of_art.JPG');
slides[67] = new Slide('../Wien_files/68_Staatsoper_City_Opera.jpg', '600', '800', '68_Staatsoper_City_Opera.JPG');
slides[68] = new Slide('../Wien_files/69_Staatsoper_City_Opera.jpg', '600', '800', '69_Staatsoper_City_Opera.JPG');
slides[69] = new Slide('../Wien_files/70_Staatsoper_City_Opera.jpg', '800', '600', '70_Staatsoper_City_Opera.JPG');
slides[70] = new Slide('../Wien_files/71_Albertina.jpg', '600', '800', '71_Albertina.JPG');
slides[71] = new Slide('../Wien_files/72_Albertina.jpg', '600', '800', '72_Albertina.JPG');
slides[72] = new Slide('../Wien_files/73_Staatsoper_City_Opera.jpg', '600', '800', '73_Staatsoper_City_Opera.JPG');
slides[73] = new Slide('../Wien_files/74_Starbucks_yeah.jpg', '600', '800', '74_Starbucks_yeah.JPG');
slides[74] = new Slide('../Wien_files/75_Riesenrad.jpg', '600', '800', '75_Riesenrad.JPG');
slides[75] = new Slide('../Wien_files/76_Riesenrad.jpg', '600', '800', '76_Riesenrad.JPG');
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", "Wien_files/transparent.gif");
    fixupIEPNG("id2", "Wien_files/transparent.gif");
    fixupIEPNG("id3", "Wien_files/transparent.gif");
    fixupIEPNG("id4", "Wien_files/transparent.gif");
    fixupIEPNG("id5", "Wien_files/transparent.gif");
    fixupIEPNG("id6", "Wien_files/transparent.gif");
    fixupIEPNG("id7", "Wien_files/transparent.gif");
    return true;
}

