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('../Framing & Plaster_files/IMG_2383.jpg', '600', '800', '11/15: tarp city');
slides[1] = new Slide('../Framing & Plaster_files/IMG_2384.jpg', '600', '800', '11/15');
slides[2] = new Slide('../Framing & Plaster_files/IMG_2386.jpg', '600', '800', '11/15: snow in the hills');
slides[3] = new Slide('../Framing & Plaster_files/IMG_2397.jpg', '600', '800', '11/15: snow at base of tarps');
slides[4] = new Slide('../Framing & Plaster_files/IMG_2398.jpg', '600', '800', '11/15: extra bales and bags of loose straw');
slides[5] = new Slide('../Framing & Plaster_files/IMG_2389.jpg', '600', '800', '11/15: framing upstairs');
slides[6] = new Slide('../Framing & Plaster_files/IMG_2387.jpg', '600', '800', '11/15: iza’s loft');
slides[7] = new Slide('../Framing & Plaster_files/IMG_2388.jpg', '600', '800', '11/15: framing & electrical upstairs');
slides[8] = new Slide('../Framing & Plaster_files/IMG_2391.jpg', '600', '800', '11/15: framing upstairs');
slides[9] = new Slide('../Framing & Plaster_files/IMG_2394.jpg', '600', '800', '11/15: some windows before installation');
slides[10] = new Slide('../Framing & Plaster_files/IMG_2422.jpg', '800', '600', '11/18: 10 foot window - heavy!!!');
slides[11] = new Slide('../Framing & Plaster_files/IMG_2419.jpg', '600', '800', '11/18: south side windows, heavy french door!!!');
slides[12] = new Slide('../Framing & Plaster_files/IMG_2420.jpg', '800', '600', '11/18: east side windows');
slides[13] = new Slide('../Framing & Plaster_files/IMG_2418.jpg', '600', '800', '11/18: nice sedona casement');
slides[14] = new Slide('../Framing & Plaster_files/IMG_2414.jpg', '600', '800', '11/18: visitor came in but couldn’t get out');
slides[15] = new Slide('../Framing & Plaster_files/IMG_2407.jpg', '600', '800', '11/18: windows from the inside');
slides[16] = new Slide('../Framing & Plaster_files/IMG_2403.jpg', '600', '800', '11/18: 2 exterior doors to be installed 11/20');
slides[17] = new Slide('../Framing & Plaster_files/IMG_2401.jpg', '600', '800', '11/18: windows from the inside');
slides[18] = new Slide('../Framing & Plaster_files/IMG_2400.jpg', '600', '800', '11/18: french door, nice views with blue glow!!');
slides[19] = new Slide('../Framing & Plaster_files/IMG_2396.jpg', '800', '600', '11/18: main electrical panel');
slides[20] = new Slide('../Framing & Plaster_files/IMG_2395.jpg', '600', '800', '11/18: Mis enjoying the dry straw under the tarps');
slides[21] = new Slide('../Framing & Plaster_files/IMG_2424.jpg', '600', '800', '12/06: Tulikivi !');
slides[22] = new Slide('../Framing & Plaster_files/IMG_2425.jpg', '800', '600', '');
slides[23] = new Slide('../Framing & Plaster_files/IMG_2426.jpg', '600', '800', '');
slides[24] = new Slide('../Framing & Plaster_files/IMG_2427.jpg', '600', '800', '');
slides[25] = new Slide('../Framing & Plaster_files/IMG_2428.jpg', '600', '800', '');
slides[26] = new Slide('../Framing & Plaster_files/IMG_2429.jpg', '600', '800', '');
slides[27] = new Slide('../Framing & Plaster_files/IMG_2434.jpg', '600', '800', '');
slides[28] = new Slide('../Framing & Plaster_files/IMG_2431.jpg', '800', '600', '');
slides[29] = new Slide('../Framing & Plaster_files/IMG_2432.jpg', '600', '800', '');
slides[30] = new Slide('../Framing & Plaster_files/IMG_2433.jpg', '600', '800', '');
slides[31] = new Slide('../Framing & Plaster_files/IMG_2435.jpg', '800', '600', '12/07');
slides[32] = new Slide('../Framing & Plaster_files/IMG_2437.jpg', '800', '600', '');
slides[33] = new Slide('../Framing & Plaster_files/IMG_2443.jpg', '600', '800', '');
slides[34] = new Slide('../Framing & Plaster_files/IMG_2444.jpg', '800', '600', '');
slides[35] = new Slide('../Framing & Plaster_files/IMG_2445.jpg', '600', '800', '12/08');
slides[36] = new Slide('../Framing & Plaster_files/IMG_2446.jpg', '800', '600', '');
slides[37] = new Slide('../Framing & Plaster_files/IMG_2447.jpg', '800', '600', '');
slides[38] = new Slide('../Framing & Plaster_files/IMG_2448.jpg', '600', '800', '');
slides[39] = new Slide('../Framing & Plaster_files/IMG_2439.jpg', '600', '800', 'closeup of soapstone');
slides[40] = new Slide('../Framing & Plaster_files/IMG_2465.jpg', '800', '600', '12/31: 2nd firing');
slides[41] = new Slide('../Framing & Plaster_files/IMG_2469.jpg', '600', '800', '01/27: RMax and Pine T&G upstairs');
slides[42] = new Slide('../Framing & Plaster_files/IMG_2470.jpg', '800', '600', '01/27: the bridge between the kids’ rooms');
slides[43] = new Slide('../Framing & Plaster_files/IMG_2473.jpg', '600', '800', '01/27: glass block above the stair landing');
slides[44] = new Slide('../Framing & Plaster_files/IMG_2475.jpg', '600', '800', '01/27: plumbing masterpiece, drains, vents, copper supply');
slides[45] = new Slide('../Framing & Plaster_files/IMG_2477.jpg', '600', '800', '01/27: more plumbing');
slides[46] = new Slide('../Framing & Plaster_files/IMG_2478.jpg', '600', '800', '01/27: demo of birch walls to come');
slides[47] = new Slide('../Framing & Plaster_files/IMG_2483.jpg', '600', '800', '01/30: Kirby helping lift HEAVY madrones');
slides[48] = new Slide('../Framing & Plaster_files/IMG_2499.jpg', '600', '800', '02/03: deck off master');
slides[49] = new Slide('../Framing & Plaster_files/IMG_2501.jpg', '600', '800', '02/11');
slides[50] = new Slide('../Framing & Plaster_files/IMG_2505.jpg', '600', '800', '02/11: kitchen, lime plaster');
slides[51] = new Slide('../Framing & Plaster_files/IMG_2504.jpg', '600', '800', '02/11: kitchen');
slides[52] = new Slide('../Framing & Plaster_files/IMG_2510.jpg', '800', '600', '02/11: looking into the cave shower');
slides[53] = new Slide('../Framing & Plaster_files/IMG_2506.jpg', '600', '800', '02./11: looking at pantry, bathroom, mudroom beyond');
slides[54] = new Slide('../Framing & Plaster_files/IMG_2512.jpg', '600', '800', '02/11: looking from library through reading nook to living room');
slides[55] = new Slide('../Framing & Plaster_files/IMG_2525.jpg', '600', '800', '02/11: looking towards master');
slides[56] = new Slide('../Framing & Plaster_files/IMG_2524.jpg', '600', '800', '02/11: hallway with bridge, Mik’s room, log, chimney pipe');
slides[57] = new Slide('../Framing & Plaster_files/IMG_2523.jpg', '600', '800', '02/11: empty pond below the trees from deck...');
slides[58] = new Slide('../Framing & Plaster_files/IMG_2521.jpg', '600', '800', '02/11: madrone corner looking towards old house');
slides[59] = new Slide('../Framing & Plaster_files/IMG_2518.jpg', '600', '800', '02/11: electrical outlet on bale wall');
slides[60] = new Slide('../Framing & Plaster_files/IMG_2516.jpg', '600', '800', '02/11: in master, looking towards closet and bath');
slides[61] = new Slide('../Framing & Plaster_files/IMG_2517.jpg', '800', '600', '02/11: sound insulation in master walls');
slides[62] = new Slide('../Framing & Plaster_files/IMG_2515.jpg', '600', '800', '02/11: open area, Iza’s room');
slides[63] = new Slide('../Framing & Plaster_files/IMG_2514.jpg', '600', '800', '02/11: Iza’s room, stairway with bridge');
slides[64] = new Slide('../Framing & Plaster_files/IMG_2532.jpg', '600', '800', '03/10: Evelyn, Brian, Chris on the south side');
slides[65] = new Slide('../Framing & Plaster_files/IMG_2535.jpg', '600', '800', '03/10: Brian & Chris on the west side');
slides[66] = new Slide('../Framing & Plaster_files/IMG_2539.jpg', '600', '800', '03/10: James admiring Evelyn’s throwing technique');
slides[67] = new Slide('../Framing & Plaster_files/IMG_2540.jpg', '600', '800', '03/10: James troweling Evelyn’s throw');
slides[68] = new Slide('../Framing & Plaster_files/IMG_2545.jpg', '600', '800', '03/10: Evelyn, James, Ryan, Brian');
slides[69] = new Slide('../Framing & Plaster_files/IMG_2547.jpg', '600', '800', '03/10: James');
slides[70] = new Slide('../Framing & Plaster_files/IMG_2552.jpg', '600', '800', '03/10: Evelyn, Iza, Mik on the north side');
slides[71] = new Slide('../Framing & Plaster_files/IMG_2555.jpg', '600', '800', '03/11: On the south side, mud starting to dry');
slides[72] = new Slide('../Framing & Plaster_files/IMG_2557.jpg', '600', '800', '03/11: Good looking, serious boy and plaster');
slides[73] = new Slide('../Framing & Plaster_files/IMG_2558.jpg', '600', '800', '03/11: South side outside living room');
slides[74] = new Slide('../Framing & Plaster_files/IMG_2560.jpg', '600', '800', '03/11: south side looking east');
slides[75] = new Slide('../Framing & Plaster_files/IMG_2561.jpg', '600', '800', '03/11: west side looking north');
slides[76] = new Slide('../Framing & Plaster_files/IMG_2562.jpg', '600', '800', '03/11: west side looking south');
slides[77] = new Slide('../Framing & Plaster_files/IMG_2563.jpg', '600', '800', '03/11: South side looking east');
slides[78] = new Slide('../Framing & Plaster_files/IMG_2565.jpg', '600', '800', '03/11: South side looking west');
slides[79] = new Slide('../Framing & Plaster_files/IMG_2559.jpg', '600', '800', '03/11: the dry plaster is almost rock hard!!');
slides[80] = new Slide('../Framing & Plaster_files/IMG_2584.jpg', '600', '800', '03/11: Mik’s room and parents’ room on the right');
slides[81] = new Slide('../Framing & Plaster_files/IMG_2589.jpg', '800', '600', '03/11: Bridge with nice birch wall');
slides[82] = new Slide('../Framing & Plaster_files/IMG_2583.jpg', '600', '800', '03/11: Towards Mik’s room');
slides[83] = new Slide('../Framing & Plaster_files/IMG_2579.jpg', '600', '800', '03/11: Towards Iza’s and Mik’s rooms');
slides[84] = new Slide('../Framing & Plaster_files/IMG_2581.jpg', '800', '600', '03/11: Parents’ room looking towards the bath');
slides[85] = new Slide('../Framing & Plaster_files/IMG_2585.jpg', '600', '800', '03/11: Pine, fir and cedar drying for flooring');
slides[86] = new Slide('../Framing & Plaster_files/IMG_2587.jpg', '600', '800', '03/11: Iza’s shelves, window seat and desk');
slides[87] = new Slide('../Framing & Plaster_files/IMG_2575.jpg', '800', '600', '03/11: Entertainment center, dining room in the background');
slides[88] = new Slide('../Framing & Plaster_files/IMG_2572.jpg', '600', '800', '03/11: Dining room shelving and buffet');
slides[89] = new Slide('../Framing & Plaster_files/IMG_2571.jpg', '800', '600', '03/11: Pantry between kitchen and dining');
slides[90] = new Slide('../Framing & Plaster_files/IMG_2574.jpg', '600', '800', '03/11: Kitchen plaster, lime scratch coat');
slides[91] = new Slide('../Framing & Plaster_files/IMG_2569.jpg', '800', '600', '03/11: Entrance into the cave shower');
slides[92] = new Slide('../Framing & Plaster_files/IMG_2570.jpg', '600', '800', '03/11: Raja slate in cave shower');
slides[93] = new Slide('../Framing & Plaster_files/IMG_2568.jpg', '600', '800', '03/11: Entrance closet looking into utility room');
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("id4");
    adjustFontSizeIfTooBig("id4");
    fixupIEPNG("id2", "Framing & Plaster_files/transparent.gif");
    fixupIEPNG("id3", "Framing & Plaster_files/transparent.gif");
    fixupAllIEPNGBGs();
    fixupIEPNG("id5", "Framing & Plaster_files/transparent.gif");
    fixupIEPNG("id6", "Framing & Plaster_files/transparent.gif");
    fixupIEPNG("id7", "Framing & Plaster_files/transparent.gif");
    fixupIEPNG("id8", "Framing & Plaster_files/transparent.gif");
    fixupIEPNG("id9", "Framing & Plaster_files/transparent.gif");
    fixupIEPNG("id10", "Framing & Plaster_files/transparent.gif");
    fixupIEPNG("id11", "Framing & Plaster_files/transparent.gif");
    fixupIEPNG("id12", "Framing & Plaster_files/transparent.gif");
    fixupIEPNG("id13", "Framing & Plaster_files/transparent.gif");
    return 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;
    }
}

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


