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('../LOPPET VIKING 2009 - Album 1_files/The Viking clubhouse.jpg', '800', '534', 'The Viking clubhouse');
slides[1] = new Slide('../LOPPET VIKING 2009 - Album 1_files/Waxing.jpg', '800', '534', 'Waxing');
slides[2] = new Slide('../LOPPET VIKING 2009 - Album 1_files/Bus arrives at Viking.jpg', '534', '800', 'Bus arrives at Viking');
slides[3] = new Slide('../LOPPET VIKING 2009 - Album 1_files/Patroller.jpg', '534', '800', 'Patroller');
slides[4] = new Slide('../LOPPET VIKING 2009 - Album 1_files/Waiting for the start 33k.jpg', '534', '800', 'Waiting for the start 33k');
slides[5] = new Slide('../LOPPET VIKING 2009 - Album 1_files/Officials at the start line.jpg', '590', '800', 'Officials at the start line');
slides[6] = new Slide('../LOPPET VIKING 2009 - Album 1_files/Waiting at the start - 33k.jpg', '546', '800', 'Waiting at the start - 33k');
slides[7] = new Slide('../LOPPET VIKING 2009 - Album 1_files/Waiting for the gun - 33k start.jpg', '534', '800', 'Waiting for the gun - 33k start');
slides[8] = new Slide('../LOPPET VIKING 2009 - Album 1_files/33k races get the gun.jpg', '534', '800', '33k races get the gun');
slides[9] = new Slide('../LOPPET VIKING 2009 - Album 1_files/33k start 5.jpg', '596', '800', '33k start 5');
slides[10] = new Slide('../LOPPET VIKING 2009 - Album 1_files/33k start 2.jpg', '534', '800', '33k start 2');
slides[11] = new Slide('../LOPPET VIKING 2009 - Album 1_files/33k start 7.jpg', '534', '800', '33k start 7');
slides[12] = new Slide('../LOPPET VIKING 2009 - Album 1_files/33k start 3.jpg', '534', '800', '33k start 3');
slides[13] = new Slide('../LOPPET VIKING 2009 - Album 1_files/33k start 4.jpg', '534', '800', '33k start 4');
slides[14] = new Slide('../LOPPET VIKING 2009 - Album 1_files/The bus at 10k start.jpg', '800', '534', 'The bus at 10k start');
slides[15] = new Slide('../LOPPET VIKING 2009 - Album 1_files/bus at 10k.jpg', '800', '534', 'bus at 10k');
slides[16] = new Slide('../LOPPET VIKING 2009 - Album 1_files/Sylvie.jpg', '534', '800', 'Sylvie');
slides[17] = new Slide('../LOPPET VIKING 2009 - Album 1_files/10k Start 5.jpg', '534', '800', '10k Start 5');
slides[18] = new Slide('../LOPPET VIKING 2009 - Album 1_files/The Snow Queen leads the way 2.jpg', '591', '800', 'The Snow Queen leads the way 2');
slides[19] = new Slide('../LOPPET VIKING 2009 - Album 1_files/The Snow Queen and her followers.jpg', '534', '801', 'The Snow Queen and her followers');
slides[20] = new Slide('../LOPPET VIKING 2009 - Album 1_files/10k Start 4.jpg', '534', '800', '10k Start 4');
slides[21] = new Slide('../LOPPET VIKING 2009 - Album 1_files/10k Start 2.jpg', '534', '800', '10k Start 2');
slides[22] = new Slide('../LOPPET VIKING 2009 - Album 1_files/10k Start.jpg', '534', '800', '10k Start');
slides[23] = new Slide('../LOPPET VIKING 2009 - Album 1_files/More 10Kers.jpg', '534', '800', 'More 10Kers');
slides[24] = new Slide('../LOPPET VIKING 2009 - Album 1_files/The 10Kers pack.jpg', '534', '800', 'The 10Kers pack');
slides[25] = new Slide('../LOPPET VIKING 2009 - Album 1_files/The 10Kers moving out.jpg', '576', '800', 'The 10Kers moving out');
slides[26] = new Slide('../LOPPET VIKING 2009 - Album 1_files/10 kers move off.jpg', '534', '800', '10 kers move off');
slides[27] = new Slide('../LOPPET VIKING 2009 - Album 1_files/The 10Kers getting into their stride.jpg', '534', '800', 'The 10Kers getting into their stride');
slides[28] = new Slide('../LOPPET VIKING 2009 - Album 1_files/106 gets underway.jpg', '587', '800', '#106 gets underway');
slides[29] = new Slide('../LOPPET VIKING 2009 - Album 1_files/106 moves off.jpg', '801', '534', '#106 moves off');
slides[30] = new Slide('../LOPPET VIKING 2009 - Album 1_files/10 k underway.jpg', '534', '800', '10 k underway');
slides[31] = new Slide('../LOPPET VIKING 2009 - Album 1_files/Young starter on the 10K loppet.jpg', '534', '800', 'Young starter on the 10K loppet');
slides[32] = new Slide('../LOPPET VIKING 2009 - Album 1_files/Only 10K Sylvie.jpg', '577', '800', 'Only 10K Sylvie');
slides[33] = new Slide('../LOPPET VIKING 2009 - Album 1_files/019 on the home stretch.jpg', '534', '800', '#019 on the home stretch');
slides[34] = new Slide('../LOPPET VIKING 2009 - Album 1_files/10k winners.jpg', '800', '534', '10k winners');
slides[35] = new Slide('../LOPPET VIKING 2009 - Album 1_files/over the 10k finish line.jpg', '534', '800', 'over the 10k finish line');
slides[36] = new Slide('../LOPPET VIKING 2009 - Album 1_files/A 10k finisher.jpg', '800', '534', 'A 10k finisher');
slides[37] = new Slide('../LOPPET VIKING 2009 - Album 1_files/124 -just  a few yards to go.jpg', '800', '533', '#124 -just  a few yards to go');
slides[38] = new Slide('../LOPPET VIKING 2009 - Album 1_files/Nearly home.jpg', '800', '534', 'Nearly home');
slides[39] = new Slide('../LOPPET VIKING 2009 - Album 1_files/135 a few yards to go.jpg', '800', '563', '#135 a few yards to go');
slides[40] = new Slide('../LOPPET VIKING 2009 - Album 1_files/434 comes to the finish line.jpg', '800', '533', '#434 comes to the finish line');
slides[41] = new Slide('../LOPPET VIKING 2009 - Album 1_files/439 comes to the finish line.jpg', '800', '425', '#439 comes to the finish line');
slides[42] = new Slide('../LOPPET VIKING 2009 - Album 1_files/33k first home.jpg', '800', '534', '33k first home');
slides[43] = new Slide('../LOPPET VIKING 2009 - Album 1_files/127  10K finish.jpg', '801', '534', '#127  10K finish');
slides[44] = new Slide('../LOPPET VIKING 2009 - Album 1_files/117 10K finish.jpg', '800', '534', '#117 10K finish');
slides[45] = new Slide('../LOPPET VIKING 2009 - Album 1_files/077 finishes.jpg', '800', '537', '#077 finishes');
slides[46] = new Slide('../LOPPET VIKING 2009 - Album 1_files/Home after 10K.jpg', '534', '800', 'Home after 10K');
slides[47] = new Slide('../LOPPET VIKING 2009 - Album 1_files/up to the finish line.jpg', '800', '534', 'up to the finish line');
slides[48] = new Slide('../LOPPET VIKING 2009 - Album 1_files/102 10K finish.jpg', '800', '533', '#102 10K finish');
slides[49] = new Slide('../LOPPET VIKING 2009 - Album 1_files/004 comes in.jpg', '800', '534', '004 comes in');
slides[50] = new Slide('../LOPPET VIKING 2009 - Album 1_files/024 10K finish.jpg', '800', '534', '#024 10K finish');
slides[51] = new Slide('../LOPPET VIKING 2009 - Album 1_files/10k finisher 2.jpg', '800', '542', '10k finisher 2');
slides[52] = new Slide('../LOPPET VIKING 2009 - Album 1_files/049 10K finish.jpg', '801', '534', '#049 10K finish');
slides[53] = new Slide('../LOPPET VIKING 2009 - Album 1_files/tired but happy.jpg', '534', '800', 'tired but happy');
slides[54] = new Slide('../LOPPET VIKING 2009 - Album 1_files/10k finisher 1.jpg', '801', '534', '10k finisher 1');
slides[55] = new Slide('../LOPPET VIKING 2009 - Album 1_files/Viking at the finish line.jpg', '800', '534', 'Viking at the finish line');
slides[56] = new Slide('../LOPPET VIKING 2009 - Album 1_files/10k finisher.jpg', '800', '534', '10k finisher');
slides[57] = new Slide('../LOPPET VIKING 2009 - Album 1_files/10 ker at the finish.jpg', '800', '534', '10 ker at the finish');
slides[58] = new Slide('../LOPPET VIKING 2009 - Album 1_files/Waiting the first arrivals.jpg', '800', '534', 'Waiting the first arrivals');
slides[59] = new Slide('../LOPPET VIKING 2009 - Album 1_files/10k finish line.jpg', '801', '539', '10k finish line');
slides[60] = new Slide('../LOPPET VIKING 2009 - Album 1_files/402 at the finish.jpg', '801', '534', '#402 at the finish');
slides[61] = new Slide('../LOPPET VIKING 2009 - Album 1_files/33k finisher 5.jpg', '800', '534', '33k finisher 5');
slides[62] = new Slide('../LOPPET VIKING 2009 - Album 1_files/33k finisher.jpg', '800', '534', '33k finisher');
slides[63] = new Slide('../LOPPET VIKING 2009 - Album 1_files/young 10k finisher.jpg', '800', '534', 'young 10k finisher');
slides[64] = new Slide('../LOPPET VIKING 2009 - Album 1_files/Finish area.jpg', '800', '534', 'Finish area');
slides[65] = new Slide('../LOPPET VIKING 2009 - Album 1_files/10K family finish.jpg', '558', '800', '10K family finish');
slides[66] = new Slide('../LOPPET VIKING 2009 - Album 1_files/33k finisher 4.jpg', '800', '534', '33k finisher 4');
slides[67] = new Slide('../LOPPET VIKING 2009 - Album 1_files/33k finisher 6.jpg', '800', '534', '33k finisher 6');
slides[68] = new Slide('../LOPPET VIKING 2009 - Album 1_files/another 33ker almost home.jpg', '800', '534', 'another 33ker almost home');
slides[69] = new Slide('../LOPPET VIKING 2009 - Album 1_files/Family finish.jpg', '582', '800', 'Family finish');
slides[70] = new Slide('../LOPPET VIKING 2009 - Album 1_files/468 comes home.jpg', '800', '534', '468 comes home');
slides[71] = new Slide('../LOPPET VIKING 2009 - Album 1_files/477 just yards to go.jpg', '800', '519', '#477 just yards to go');
slides[72] = new Slide('../LOPPET VIKING 2009 - Album 1_files/Finish line in sight.jpg', '800', '534', 'Finish line in sight');
slides[73] = new Slide('../LOPPET VIKING 2009 - Album 1_files/Cruising home.jpg', '534', '800', 'Cruising home');
slides[74] = new Slide('../LOPPET VIKING 2009 - Album 1_files/Snow Queen 3.jpg', '800', '557', 'Snow Queen 3');
slides[75] = new Slide('../LOPPET VIKING 2009 - Album 1_files/Snow Queen 2.jpg', '800', '594', 'Snow Queen 2');
slides[76] = new Slide('../LOPPET VIKING 2009 - Album 1_files/Corina and Rebecca 2.jpg', '800', '546', 'Corina and Rebecca 2');
slides[77] = new Slide('../LOPPET VIKING 2009 - Album 1_files/Corina and Rebecca.jpg', '534', '800', 'Corina and Rebecca');
slides[78] = new Slide('../LOPPET VIKING 2009 - Album 1_files/20 finish 1.jpg', '800', '535', '20 finish 1');
slides[79] = new Slide('../LOPPET VIKING 2009 - Album 1_files/20Ker checking his time.jpg', '800', '534', '20Ker checking his time');
slides[80] = new Slide('../LOPPET VIKING 2009 - Album 1_files/Snow Queen 1.jpg', '800', '534', 'Snow Queen 1');
slides[81] = new Slide('../LOPPET VIKING 2009 - Album 1_files/10k finish 2.jpg', '540', '800', '10k finish 2');
slides[82] = new Slide('../LOPPET VIKING 2009 - Album 1_files/10k finish 1.jpg', '534', '800', '10k finish 1');
slides[83] = new Slide('../LOPPET VIKING 2009 - Album 1_files/456 just yards to go.jpg', '800', '534', '#456 just yards to go');
slides[84] = new Slide('../LOPPET VIKING 2009 - Album 1_files/33ker almost home.jpg', '800', '534', '33ker almost home');
slides[85] = new Slide('../LOPPET VIKING 2009 - Album 1_files/20 finish.jpg', '800', '534', '20 finish');
slides[86] = new Slide('../LOPPET VIKING 2009 - Album 1_files/20 finish 2.jpg', '800', '534', '20 finish 2');
isPureISOLatin1 = true;
contentEncodingConstant = 4;
feedbackURL = "TODO";
showFeedbackButton = false;
feedbackEnabled = true;

var MINIMUM_FONT = "10";
var UNITS = "";

function elementFontSize(element)
{
    var fontSize = MINIMUM_FONT; 

    if (document.defaultView)
    {
        var computedStyle = document.defaultView.getComputedStyle(element, null);
        if (computedStyle)
        {
            fontSize = computedStyle.getPropertyValue("font-size");
        }
    }
    else if (element.currentStyle)
    {
        fontSize = element.currentStyle.fontSize;
    }

    if ((UNITS.length == 0) && (fontSize != MINIMUM_FONT))
    {
        UNITS = fontSize.substring(fontSize.length - 2, fontSize.length)
    }

    return parseFloat(fontSize);
}

function adjustFontSizeIfTooBig(idOfElement)
{
    var oTextBoxOuterDiv;
    var oTextBoxMiddleDiv;
    var oTextBoxInnerDiv;
    var oTextBoxOuterDiv = document.getElementById(idOfElement);
    
    if (oTextBoxOuterDiv)
    {
        oTextBoxMiddleDiv = getChildOfType(oTextBoxOuterDiv, "DIV", 0);
        if (oTextBoxMiddleDiv)
        {
            oTextBoxInnerDiv = getChildOfType(oTextBoxMiddleDiv, "DIV", 0);
            if (oTextBoxInnerDiv)
            {
                var offsetHeight = oTextBoxInnerDiv.offsetHeight;
                var specifiedHeight = offsetHeight;
                if (oTextBoxMiddleDiv.style.height != "")
                {
                    specifiedHeight = parseFloat(oTextBoxMiddleDiv.style.height);
                }
                else if (oTextBoxOuterDiv.style.height != "")
                {
                    specifiedHeight = parseFloat(oTextBoxOuterDiv.style.height);
                }
                if (offsetHeight > specifiedHeight)
                {
                    var smallestFontSize = 200;
                    
                    var aParaChildren = getParaDescendants(oTextBoxInnerDiv);
                    var oneLine = false;
                    for (i = 0; i < aParaChildren.length; i++)
                    {
                        var oParagraphDiv = aParaChildren[i];
                        var lineHeight = elementLineHeight(oParagraphDiv);
                        oneLine = oneLine || (lineHeight * 1.5 >= specifiedHeight);
                        if (oParagraphDiv.nodeName == "DIV")
                        {
                            var fontSize = elementFontSize(oParagraphDiv);
                            smallestFontSize = Math.min( smallestFontSize, fontSize );
                            for (j = 0; j < oParagraphDiv.childNodes.length; j++)
                            {
                                var oSpan = oParagraphDiv.childNodes[j];
                                if ((oSpan.nodeName == "SPAN") || (oSpan.nodeName == "A"))
                                {
                                    fontSize = elementFontSize(oSpan);
                                    smallestFontSize = Math.min( smallestFontSize, fontSize );
                                }
                            }
                        }
                    }
                    var minimum = parseFloat(MINIMUM_FONT);
                    
                    var count = 0
                    while ((smallestFontSize > minimum) && (offsetHeight > specifiedHeight) && (count < 10))
                    {
                        ++ count;
                        if (oneLine)
                        {
                            var oldWidth = parseInt(oTextBoxOuterDiv.style.width);
                            oTextBoxInnerDiv.style.width =
                                "" + oldWidth * Math.pow(1.05, count) + "px";
                        }
                        else
                        {
                            var scale = Math.max(0.95, minimum / smallestFontSize);
                            
                            for (i = 0; i < aParaChildren.length; i++)
                            {
                                var oParagraphDiv = aParaChildren[i];
                                if (oParagraphDiv.nodeName == "DIV")
                                {
                                    var paraFontSize = elementFontSize(oParagraphDiv) * scale;
                                    var paraLineHeight = elementLineHeight(oParagraphDiv) * scale;
                                    for (j = 0; j < oParagraphDiv.childNodes.length; j++)
                                    {
                                        var oSpan = oParagraphDiv.childNodes[j];
                                        if ((oSpan.nodeName == "SPAN") || (oSpan.nodeName == "A"))
                                        {
                                            var spanFontSize = elementFontSize(oSpan) * scale;
                                            var spanLineHeight = elementLineHeight(oSpan) * scale;
                                            oSpan.style.fontSize = spanFontSize + UNITS;
                                            oSpan.style.lineHeight = spanLineHeight + UNITS;
                                            smallestFontSize = Math.min( smallestFontSize, spanFontSize );
                                        }
                                    }
                                    oParagraphDiv.style.fontSize = paraFontSize + UNITS;
                                    oParagraphDiv.style.lineHeight = paraLineHeight + UNITS;
                                    smallestFontSize = Math.min( smallestFontSize, paraFontSize );
                                }
                            }
                        }
                        
                        offsetHeight = oTextBoxInnerDiv.offsetHeight;
                    }
                }
            }
        }
    }
}


function elementLineHeight(element)
{
    var lineHeight = MINIMUM_FONT; 
    
    if (document.defaultView)
    {
        var computedStyle = document.defaultView.getComputedStyle(element, null);
        if (computedStyle)
        {
            lineHeight = computedStyle.getPropertyValue("line-height");
        }
    }
    else if (element.currentStyle)
    {
        lineHeight = element.currentStyle.lineHeight;
    }
    
    if ((UNITS.length == 0) && (lineHeight != MINIMUM_FONT))
    {
        UNITS = lineHeight.substring(lineHeight.length - 2, lineHeight.length)
    }
    
    return parseFloat(lineHeight);
}

function adjustLineHeightIfTooBig(idOfElement)
{
    var oTextBoxOuterDiv;
    var oTextBoxMiddleDiv;
    var oTextBoxInnerDiv;
    var oTextBoxOuterDiv = document.getElementById(idOfElement);
    
    if (oTextBoxOuterDiv)
    {
        oTextBoxMiddleDiv = getChildOfType(oTextBoxOuterDiv, "DIV", 0);
        if (oTextBoxMiddleDiv)
        {
            oTextBoxInnerDiv = getChildOfType(oTextBoxMiddleDiv, "DIV", 0);
            if (oTextBoxInnerDiv)
            {
                var offsetHeight = oTextBoxInnerDiv.offsetHeight;
                var specifiedHeight = offsetHeight;
                if (oTextBoxMiddleDiv.style.height != "")
                {
                    specifiedHeight = parseFloat(oTextBoxMiddleDiv.style.height);
                }
                else if (oTextBoxOuterDiv.style.height != "")
                {
                    specifiedHeight = parseFloat(oTextBoxOuterDiv.style.height);
                }
                if (offsetHeight > specifiedHeight)
                {
                    var adjusted = true;
                    var count = 0;
                    while ((adjusted) && (offsetHeight > specifiedHeight) && (count < 10))
                    {
                        adjusted = false;
                        ++ count;
                        
                        var aParaChildren = getParaDescendants(oTextBoxInnerDiv);
                        for (i = 0; i < aParaChildren.length; i++)
                        {
                            var oParagraphDiv = aParaChildren[i];
                            if (oParagraphDiv.nodeName == "DIV")
                            {
                                var fontSize = elementFontSize(oParagraphDiv);
                                var lineHeight = elementLineHeight(oParagraphDiv) * 0.95;
                                if (lineHeight >= (fontSize * 1.1))
                                {
                                    oParagraphDiv.style.lineHeight = lineHeight + UNITS;
                                    adjusted = true;
                                }
                                
                                
                                
                                for (j = 0; j < oParagraphDiv.childNodes.length; j++)
                                {
                                    var oSpan = oParagraphDiv.childNodes[j];
                                    if ((oSpan.nodeName == "SPAN") || (oSpan.nodeName == "A"))
                                    {
                                        var fontSize = elementFontSize(oSpan);
                                        var lineHeight = elementLineHeight(oSpan) * 0.95;
                                        if (lineHeight >= (fontSize * 1.1))
                                        {
                                            oSpan.style.lineHeight = lineHeight + UNITS;
                                            var adjusted = true;
                                        }
                                    }
                                }
                            }
                        }
                        
                        offsetHeight = oTextBoxInnerDiv.offsetHeight;
                    }
                }
            }
        }
    }
}

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 getChildOfType(oParent, sNodeName, requestedIndex)
{
    var childrenOfType = oParent.getElementsByTagName(sNodeName);
    return (requestedIndex < childrenOfType.length) ?
           childrenOfType.item(requestedIndex) : null;
}

function onPageLoad()
{
    detectBrowser();
    adjustLineHeightIfTooBig("id3");
    adjustFontSizeIfTooBig("id3");
    adjustLineHeightIfTooBig("id5");
    adjustFontSizeIfTooBig("id5");
    adjustLineHeightIfTooBig("id6");
    adjustFontSizeIfTooBig("id6");
    adjustLineHeightIfTooBig("id8");
    adjustFontSizeIfTooBig("id8");
    fixupAllIEPNGBGs();
    fixupIEPNG("id1", "LOPPET VIKING 2009 - Album 1_files/transparent.gif");
    fixupIEPNG("id2", "LOPPET VIKING 2009 - Album 1_files/transparent.gif");
    fixupIEPNG("id4", "LOPPET VIKING 2009 - Album 1_files/transparent.gif");
    fixupIEPNG("id7", "LOPPET VIKING 2009 - Album 1_files/transparent.gif");
    return true;
}

function getParaDescendants(oAncestor)
{
    var oParaDescendants = new Array();
    var oPotentialParagraphs = oAncestor.getElementsByTagName('DIV');
    for (var iIndex=0; iIndex<oPotentialParagraphs.length; iIndex++)
    {
        var oNode = oPotentialParagraphs.item(iIndex);
        if (oNode.className.lastIndexOf('paragraph') != -1)
        {
            oParaDescendants.push(oNode);
        }
    }
    return oParaDescendants;
}

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;
    }
}

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;
    }
}

