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('../exercise 3 + exercise 4_files/_MG_5235.jpg', '534', '800', '_MG_5235');
slides[1] = new Slide('../exercise 3 + exercise 4_files/_MG_5236.jpg', '534', '800', '_MG_5236');
slides[2] = new Slide('../exercise 3 + exercise 4_files/_MG_5238.jpg', '534', '800', '_MG_5238');
slides[3] = new Slide('../exercise 3 + exercise 4_files/_MG_5239.jpg', '800', '534', '_MG_5239');
slides[4] = new Slide('../exercise 3 + exercise 4_files/_MG_5240.jpg', '800', '534', '_MG_5240');
slides[5] = new Slide('../exercise 3 + exercise 4_files/_MG_5241.jpg', '800', '534', '_MG_5241');
slides[6] = new Slide('../exercise 3 + exercise 4_files/_MG_5242.jpg', '534', '800', '_MG_5242');
slides[7] = new Slide('../exercise 3 + exercise 4_files/_MG_5243.jpg', '534', '800', '_MG_5243');
slides[8] = new Slide('../exercise 3 + exercise 4_files/_MG_5244.jpg', '534', '800', '_MG_5244');
slides[9] = new Slide('../exercise 3 + exercise 4_files/_MG_5245.jpg', '534', '800', '_MG_5245');
slides[10] = new Slide('../exercise 3 + exercise 4_files/_MG_5246.jpg', '800', '534', '_MG_5246');
slides[11] = new Slide('../exercise 3 + exercise 4_files/_MG_5247.jpg', '534', '800', '_MG_5247');
slides[12] = new Slide('../exercise 3 + exercise 4_files/_MG_5248.jpg', '534', '800', '_MG_5248');
slides[13] = new Slide('../exercise 3 + exercise 4_files/_MG_5249.jpg', '534', '800', '_MG_5249');
slides[14] = new Slide('../exercise 3 + exercise 4_files/_MG_5250.jpg', '534', '800', '_MG_5250');
slides[15] = new Slide('../exercise 3 + exercise 4_files/_MG_5251.jpg', '800', '534', '_MG_5251');
slides[16] = new Slide('../exercise 3 + exercise 4_files/_MG_5252.jpg', '534', '800', '_MG_5252');
slides[17] = new Slide('../exercise 3 + exercise 4_files/_MG_5253.jpg', '534', '800', '_MG_5253');
slides[18] = new Slide('../exercise 3 + exercise 4_files/_MG_5254.jpg', '534', '800', '_MG_5254');
slides[19] = new Slide('../exercise 3 + exercise 4_files/_MG_5255.jpg', '534', '800', '_MG_5255');
slides[20] = new Slide('../exercise 3 + exercise 4_files/_MG_5256.jpg', '800', '534', '_MG_5256');
slides[21] = new Slide('../exercise 3 + exercise 4_files/_MG_5257.jpg', '534', '800', '_MG_5257');
slides[22] = new Slide('../exercise 3 + exercise 4_files/_MG_5258.jpg', '534', '800', '_MG_5258');
slides[23] = new Slide('../exercise 3 + exercise 4_files/_MG_5259.jpg', '800', '534', '_MG_5259');
slides[24] = new Slide('../exercise 3 + exercise 4_files/_MG_5260.jpg', '800', '534', '_MG_5260');
slides[25] = new Slide('../exercise 3 + exercise 4_files/_MG_5261.jpg', '534', '800', '_MG_5261');
slides[26] = new Slide('../exercise 3 + exercise 4_files/_MG_5262.jpg', '534', '800', '_MG_5262');
slides[27] = new Slide('../exercise 3 + exercise 4_files/_MG_5263.jpg', '534', '800', '_MG_5263');
slides[28] = new Slide('../exercise 3 + exercise 4_files/_MG_5264.jpg', '800', '534', '_MG_5264');
slides[29] = new Slide('../exercise 3 + exercise 4_files/_MG_5265.jpg', '800', '534', '_MG_5265');
slides[30] = new Slide('../exercise 3 + exercise 4_files/_MG_5266.jpg', '800', '534', '_MG_5266');
slides[31] = new Slide('../exercise 3 + exercise 4_files/_MG_5267.jpg', '800', '534', '_MG_5267');
slides[32] = new Slide('../exercise 3 + exercise 4_files/_MG_5268.jpg', '800', '534', '_MG_5268');
slides[33] = new Slide('../exercise 3 + exercise 4_files/_MG_5269.jpg', '534', '800', '_MG_5269');
slides[34] = new Slide('../exercise 3 + exercise 4_files/_MG_5270.jpg', '800', '534', '_MG_5270');
slides[35] = new Slide('../exercise 3 + exercise 4_files/_MG_5271.jpg', '800', '534', '_MG_5271');
slides[36] = new Slide('../exercise 3 + exercise 4_files/_MG_5272.jpg', '800', '534', '_MG_5272');
slides[37] = new Slide('../exercise 3 + exercise 4_files/_MG_5273.jpg', '800', '534', '_MG_5273');
slides[38] = new Slide('../exercise 3 + exercise 4_files/_MG_5274.jpg', '800', '534', '_MG_5274');
slides[39] = new Slide('../exercise 3 + exercise 4_files/_MG_5275.jpg', '534', '800', '_MG_5275');
slides[40] = new Slide('../exercise 3 + exercise 4_files/_MG_5276.jpg', '800', '534', '_MG_5276');
slides[41] = new Slide('../exercise 3 + exercise 4_files/_MG_5277.jpg', '534', '800', '_MG_5277');
slides[42] = new Slide('../exercise 3 + exercise 4_files/_MG_5278.jpg', '800', '534', '_MG_5278');
slides[43] = new Slide('../exercise 3 + exercise 4_files/_MG_5279.jpg', '800', '534', '_MG_5279');
slides[44] = new Slide('../exercise 3 + exercise 4_files/_MG_5280.jpg', '534', '800', '_MG_5280');
slides[45] = new Slide('../exercise 3 + exercise 4_files/_MG_5281.jpg', '800', '534', '_MG_5281');
slides[46] = new Slide('../exercise 3 + exercise 4_files/_MG_5282.jpg', '800', '534', '_MG_5282');
slides[47] = new Slide('../exercise 3 + exercise 4_files/_MG_5283.jpg', '800', '534', '_MG_5283');
slides[48] = new Slide('../exercise 3 + exercise 4_files/_MG_5284.jpg', '800', '534', '_MG_5284');
slides[49] = new Slide('../exercise 3 + exercise 4_files/_MG_5285.jpg', '800', '534', '_MG_5285');
slides[50] = new Slide('../exercise 3 + exercise 4_files/_MG_5287.jpg', '534', '800', '_MG_5287');
slides[51] = new Slide('../exercise 3 + exercise 4_files/_MG_5288.jpg', '800', '534', '_MG_5288');
slides[52] = new Slide('../exercise 3 + exercise 4_files/_MG_5289.jpg', '800', '534', '_MG_5289');
slides[53] = new Slide('../exercise 3 + exercise 4_files/_MG_5290.jpg', '534', '800', '_MG_5290');
slides[54] = new Slide('../exercise 3 + exercise 4_files/_MG_5291.jpg', '800', '534', '_MG_5291');
slides[55] = new Slide('../exercise 3 + exercise 4_files/_MG_5292.jpg', '800', '534', '_MG_5292');
slides[56] = new Slide('../exercise 3 + exercise 4_files/_MG_5293.jpg', '800', '534', '_MG_5293');
slides[57] = new Slide('../exercise 3 + exercise 4_files/_MG_5294.jpg', '800', '534', '_MG_5294');
slides[58] = new Slide('../exercise 3 + exercise 4_files/_MG_5295.jpg', '800', '534', '_MG_5295');
slides[59] = new Slide('../exercise 3 + exercise 4_files/_MG_5296.jpg', '534', '800', '_MG_5296');
slides[60] = new Slide('../exercise 3 + exercise 4_files/_MG_5297.jpg', '800', '534', '_MG_5297');
slides[61] = new Slide('../exercise 3 + exercise 4_files/_MG_5298.jpg', '800', '534', '_MG_5298');
slides[62] = new Slide('../exercise 3 + exercise 4_files/_MG_5300.jpg', '800', '534', '_MG_5300');
slides[63] = new Slide('../exercise 3 + exercise 4_files/_MG_5301.jpg', '800', '534', '_MG_5301');
slides[64] = new Slide('../exercise 3 + exercise 4_files/_MG_5302.jpg', '800', '534', '_MG_5302');
slides[65] = new Slide('../exercise 3 + exercise 4_files/_MG_5303.jpg', '800', '534', '_MG_5303');
slides[66] = new Slide('../exercise 3 + exercise 4_files/_MG_5304.jpg', '534', '800', '_MG_5304');
slides[67] = new Slide('../exercise 3 + exercise 4_files/_MG_5307.jpg', '534', '800', '_MG_5307');
slides[68] = new Slide('../exercise 3 + exercise 4_files/_MG_5309.jpg', '534', '800', '_MG_5309');
slides[69] = new Slide('../exercise 3 + exercise 4_files/_MG_5310.jpg', '534', '800', '_MG_5310');
slides[70] = new Slide('../exercise 3 + exercise 4_files/_MG_5312.jpg', '534', '800', '_MG_5312');
slides[71] = new Slide('../exercise 3 + exercise 4_files/_MG_5313.jpg', '534', '800', '_MG_5313');
slides[72] = new Slide('../exercise 3 + exercise 4_files/_MG_5314.jpg', '534', '800', '_MG_5314');
slides[73] = new Slide('../exercise 3 + exercise 4_files/_MG_5316.jpg', '534', '800', '_MG_5316');
slides[74] = new Slide('../exercise 3 + exercise 4_files/_MG_5317.jpg', '534', '800', '_MG_5317');
slides[75] = new Slide('../exercise 3 + exercise 4_files/_MG_5318.jpg', '534', '800', '_MG_5318');
slides[76] = new Slide('../exercise 3 + exercise 4_files/_MG_5320.jpg', '534', '800', '_MG_5320');
slides[77] = new Slide('../exercise 3 + exercise 4_files/_MG_5321.jpg', '800', '534', '_MG_5321');
slides[78] = new Slide('../exercise 3 + exercise 4_files/_MG_5322.jpg', '534', '800', '_MG_5322');
slides[79] = new Slide('../exercise 3 + exercise 4_files/_MG_5233.jpg', '534', '800', '_MG_5233');
slides[80] = new Slide('../exercise 3 + exercise 4_files/_MG_5234.jpg', '534', '800', '_MG_5234');
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 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 onPageLoad()
{
    detectBrowser();
    adjustLineHeightIfTooBig("id1");
    adjustFontSizeIfTooBig("id1");
    adjustLineHeightIfTooBig("id2");
    adjustFontSizeIfTooBig("id2");
    fixupAllIEPNGBGs();
    fixupIEPNG("id3", "exercise 3 + exercise 4_files/transparent.gif");
    fixupIEPNG("id4", "exercise 3 + exercise 4_files/transparent.gif");
    fixupIEPNG("id5", "exercise 3 + exercise 4_files/transparent.gif");
    fixupIEPNG("id6", "exercise 3 + exercise 4_files/transparent.gif");
    fixupIEPNG("id7", "exercise 3 + exercise 4_files/transparent.gif");
    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;
    }
}

