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('../Box_patents_files/boxpatents2.jpg', '606', '800', '1870. Cardboard box covered with thin layer of Spanish cedar. Ends perforated to allow moisture \nto escape from cigars.\n[5202]');
slides[1] = new Slide('../Box_patents_files/boxpatents3.jpg', '789', '801', '1870. Box made of “common wood” covered with thin veneer. Note overall lid and bottom. Ultimately a high percentage of boxes were made this way.\n[5203]');
slides[2] = new Slide('../Box_patents_files/boxpatents4.jpg', '630', '800', '1870.  Wood and cardboard with metal corners.\n[5204]');
slides[3] = new Slide('../Box_patents_files/boxpatents5.jpg', '800', '601', '1870.  Box designed to prevent fraud by allowing customers and Federal tax officials to count the number of cigars in the box. Tax stamp to be applied over one of the hooks.\n[5205]');
slides[4] = new Slide('../Box_patents_files/boxpatents6.jpg', '800', '543', '1871.  Application of the tax stamp across added slat C and through the slot at bottom of the lid permits the box to be opened for inspection without breaking the tax stamp. Very expensive and cumbersome customer assurance.  [5206]');
slides[5] = new Slide('../Box_patents_files/boxpatents7.jpg', '622', '800', '1872.  Top and two ends are made of wood. Front, bottom and back are formed from a single sheet of “thick paper, termed paper-board” to which paper printed to look like wood is glued. This was clever\nand actually made commercially. [5207]');
slides[6] = new Slide('../Box_patents_files/boxpatents8.jpg', '673', '801', '1872  Cardboard box that “can be opened at the top or bottom for the purpose of packing, and when the same is filled, can be securely and quickly closed and fastened for transportation.”\n[5208]');
slides[7] = new Slide('../Box_patents_files/boxpatents9.jpg', '800', '568', '1872.  A new latch and a complex system using muslin, cotton, and “tar board” to brace a \ncigar box so it won’t warp.\n[5209]');
slides[8] = new Slide('../Box_patents_files/boxpatents10.jpg', '680', '800', '1872.  “The chief object of my invention is to provide better means than have heretofore been provided for packing cigars in small bundles.” Similar boxes were used in the 1880’s and again today.\n[5210]');
slides[9] = new Slide('../Box_patents_files/boxpatents11.jpg', '672', '800', '1873.  Method of opening a box to inspect contents without breaking the revenue stamp. Fraudulent contents were an obvious concern with buyers.\n[5211]');
slides[10] = new Slide('../Box_patents_files/boxpatents12.jpg', '800', '745', '1873.  Inventor  uses wood to strengthen \na cardboard box.\n[5212]');
slides[11] = new Slide('../Box_patents_files/boxpatents13.jpg', '800', '514', '1877.  Double lid, inside one of glass, permits viewing of the cigars. A similar box was used\nand is illustrated in the NCM glass exhibit.\n[5213]');
slides[12] = new Slide('../Box_patents_files/boxpatents14.jpg', '673', '800', '1877.  Insets the lid by beveling the sides and top. Design used by BROMO SELTZER and at least \none other brand of cigars.\n[5214]');
slides[13] = new Slide('../Box_patents_files/boxpatents15.jpg', '765', '800', '1877.  Drop front box with metal swing latch corners was manufactured and used. Retailers didn’t \nlike the design.\n[5215]');
slides[14] = new Slide('../Box_patents_files/boxpatents16.jpg', '800', '614', '1877.  Box with built-in cigar cutter.\n[5216]');
slides[15] = new Slide('../Box_patents_files/boxpatents17.jpg', '800', '702', '1877.  Mix of wood, tin and cardboard to improve on the tin box by allowing the cigars to dry, providing a surface for the brand and ID, for removing the “objectionable appearance of sheet tin boxes,” and creating a box reusable when empty. [5217]');
slides[16] = new Slide('../Box_patents_files/boxpatents18.jpg', '800', '554', '1877.  Complicated two level compartmentalized double-hinged lid box, designed too permit inspection of contents.\n[5218]');
slides[17] = new Slide('../Box_patents_files/boxpatents19.jpg', '800', '554', '1877.  Bottle-shaped cigar box “made of any suitable material” with cigars stacked in 3 tiers. In the head of each cigar is a pin, the withdrawal of which opens the draft channel for smoking. The tier “improves drying” of the cigars.  [5219]');
slides[18] = new Slide('../Box_patents_files/boxpatents20.jpg', '800', '571', '1877.  Overly complicated impractical design revents fraudulently reusing the box by making \nit impossible to remove the next row of cigars without destroying the box. \n[5220]');
slides[19] = new Slide('../Box_patents_files/boxpatents21.jpg', '800', '616', '1878.  Double lidded box permits two colors of cigars, or other choice. Lids support each other\nin upright position. You can see this box in the\nNCM display of novelty game-related boxes.\n[5221]');
slides[20] = new Slide('../Box_patents_files/boxpatents22.jpg', '800', '601', '1878.  Spring loaded pivoting box to hold cigars,\ncigarettes or matches.\n[5222]');
slides[21] = new Slide('../Box_patents_files/boxpatents23.jpg', '800', '710', '1878.  Movable partition to keep cigars from rattling around, especially in boxes carried by salesmen.\n[5223]');
slides[22] = new Slide('../Box_patents_files/boxpatents24.jpg', '800', '571', '1878.  This design exposes the ends of the cigars for quality inspection.\n[5224]');
slides[23] = new Slide('../Box_patents_files/boxpatents25.jpg', '800', '535', '1878.  Six-sided cigar box to facilitate packing of cigars in space-saving triangular bundles. Two glass inserts permit viewing of cigars. Ads say this went into manufacture. The NCM would like to find one.\n[5225]');
slides[24] = new Slide('../Box_patents_files/boxpatents26.jpg', '800', '476', '1879.  Boxes of 100 are deep, so it is difficult to see the bottom 20 or so cigars. This, in effect, builds two boxes of 50 bottom to bottom, permitting the box to be turned upside down when half empty. This box\nwent into production and is on exhibit.  [5226]');
slides[25] = new Slide('../Box_patents_files/boxpatents27.jpg', '800', '524', '1879.  Spring hinge and clasp to hold the lid upright “to prevent strain upon the hinge.”\n[5227]');
slides[26] = new Slide('../Box_patents_files/boxpatents29.jpg', '800', '552', '1879.  Doublle-hinged lid that folds under the box to save space in the showcase.\n[5229]');
slides[27] = new Slide('../Box_patents_files/boxpatents30.jpg', '800', '502', '1879.  “...a cigar box having an inclined glass top secured within the hinged frame, said box being provided with a series of perforations, and short transverse portions and vertical pieces arranged in pyramidal form in combination with the receptacle, sponge and rear door...” Egad. [5230]');
slides[28] = new Slide('../Box_patents_files/boxpatents31.jpg', '800', '502', '1879.  “The object of the invention is to devise a cigar-box that will at all times appear full even though there may be only a single layer therein.”\n[5231]');
slides[29] = new Slide('../Box_patents_files/boxpatents32.jpg', '800', '506', '1879.  A fairly popular latch used on nailed wood boxes during the 1880’s and 1890’s. Note the standard NWH hinges. See the NCM exhibit of\nhinges and latches.\n[5232]');
slides[30] = new Slide('../Box_patents_files/boxpatents33.jpg', '800', '520', '1879.  Drop front permits inspection of second row of cigars.\n[5233]');
slides[31] = new Slide('../Box_patents_files/boxpatents34.jpg', '800', '515', '1880.  Device which, in effect, nails the cigars into the box in such a way as to prevent refilling or removing cigars without destroying the stamp.\n[5234]');
slides[32] = new Slide('../Box_patents_files/boxpatents35.jpg', '800', '614', '1880.  Ventilated box permits shipping moist green cigars without molding.\n[5235]');
slides[33] = new Slide('../Box_patents_files/boxpatents37.jpg', '800', '622', '1881.  Box requiring trapezoidal bundles \n“for maximum display.”\n[5237]');
slides[34] = new Slide('../Box_patents_files/boxpatents38.jpg', '800', '500', '1881.  Box unfolds to offer choice of three\ndifferent color cigars. NCM has one of\nthese on display under the brand\nname TRICOLOR.\n[5238]');
slides[35] = new Slide('../Box_patents_files/boxpatents39.jpg', '674', '800', '1882.  Popular catch used on nailed wood boxes during the late 19th century. Can be seen in the NCM exhibit of box hardware.\n[5239]');
slides[36] = new Slide('../Box_patents_files/boxpatents40.jpg', '800', '517', '1882.  Unusual method of attaching a lid to save space yet display the brand name.\n[5240]');
slides[37] = new Slide('../Box_patents_files/boxpatents41.jpg', '800', '565', '1882.  Lid removable to permit pre-packed cigars to have custom labels added at the last minute.\n[5241]');
slides[38] = new Slide('../Box_patents_files/boxpatents42.jpg', '800', '627', '1883.  Version of inset (drop-in) lid that is more expensive to make because it is difficult to cut\nand manufacture. \n[5242]');
slides[39] = new Slide('../Box_patents_files/boxpatents43.jpg', '800', '546', '1884.  Odd (is this really needed?) device for holding and serving from two cigar boxes.\n[5243]');
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", "Box_patents_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;
    }
}

