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('../Patriotic_files/titles05.jpg', '390', '510', '');
slides[1] = new Slide('../Patriotic_files/1405.jpg', '395', '405', '1866. Patriotism ran high in the decades following the Civil War, the period of great cigar industry expansion. Cigars by Mooney & Howe, \n6 Bleeker St., Utica, NY\n[1405]');
slides[2] = new Slide('../Patriotic_files/4403.jpg', '380', '570', '1885. Dropfront box of 250 packed in bundles of 5.\nRoth, Bruner & Feist, giant Cincinnati maker of cheap cigars. Fact. 387, 1st Ohio \n[4403]');
slides[3] = new Slide('../Patriotic_files/2105.jpg', '368', '570', '1902. Misprint gives the flag 14 stripes. James McGahan & Brother, Fact. 12, 14th (Troy) NY.\n[2105]');
slides[4] = new Slide('../Patriotic_files/2106.jpg', '340', '570', '1890’s. This 41 star flag was made by LS Slade, Chelsea, Mass (Fact. 394, 3rd MA) for large \nMaine distributor Twitchell Champlin Co. \nSpace hog NWH 100/25 box which I bought in a\nNew England antique shop in 1970 for 10¢. [2106]');
slides[5] = new Slide('../Patriotic_files/2102.jpg', '395', '551', '1901.  “Stars and Stripes Forever.” Gorgeous box by Henry Breitwieser Fact. 216, 28th (Buffalo) NY.\nA curator’s favorite.  \n[2102]');
slides[6] = new Slide('../Patriotic_files/7391.jpg', '395', '491', 'c1900. Flag misdesigned with white stripes top and bottom and only six red stripes. Cigars by Hahn, Brussel & Co. on 63rd St, NYC, Fact. 8, 3rd NY.\n[7391]');
slides[7] = new Slide('../Patriotic_files/7392.jpg', '395', '458', 'Inner of previous brand. Cigars made for M.F. & Co.\n[7392]');
slides[8] = new Slide('../Patriotic_files/2104.jpg', '395', '506', '1912. Flag, Lady Columbia, eagle, shield...”The Earth’s Best” and “Champions of the World.” Whew! Got it all. Banner Cigar Co. Fact. 722, 1st Mich.\nDetroit box with good looking back panel. \n[2104]');
slides[9] = new Slide('../Patriotic_files/2154.jpg', '395', '496', '1905. Inspired by the Spanish-American War. Label pictures woman hanging flag honoring returning soldiers. Cigars by E. Meisner, Milwaukee, Fact. 679, 1st Dist. Wisconsin.\n[2154]');
slides[10] = new Slide('../Patriotic_files/Numeriser0001.jpg', '582', '800', 'European flap and outer. “La fuga” refers to a \nstate of perfection, hardly appropriate for \neither of these two misdesigned flags. \nNeither label is in the NCM collection.');
slides[11] = new Slide('../Patriotic_files/titles06.jpg', '390', '510', '');
slides[12] = new Slide('../Patriotic_files/5502.jpg', '323', '570', '1874. The eagle is our National Bird, and equally at home on cigar boxes. Cigars by John Krohe, NYC.\n[5502]');
slides[13] = new Slide('../Patriotic_files/1409.jpg', '356', '570', '1875. Yellow paper gives color to a black ink image celebrating the reunion of the country after the Civil War. Cigars by Christopher Schweitzer, 6th Indiana.\n[1409]');
slides[14] = new Slide('../Patriotic_files/10256.jpg', '390', '569', '1881.  George Kent, Binghamton,  Fact. 3, 21st NY used this very typical 1870’s design with central square flanked by decorative panels.\n[10256]');
slides[15] = new Slide('../Patriotic_files/21patriot45.jpg', '342', '570', '1884. Hard to imagine a more gorgeous eagle.\nCatalog card missing.\n[2145]');
slides[16] = new Slide('../Patriotic_files/2155.jpg', '395', '501', '1891.  Three color but dramatic in a showcase.\nHenry Writer, Newberrytown, Fact. 3556, 9th PA.\n[2155]');
slides[17] = new Slide('../Patriotic_files/biglittle444.jpg', '540', '800', '1899. Full color labels are not common on NW250 dropfront boxes of cheap cigars. Civil War battles make this one of the more spectacular.\nRoth, Bruner & Feist, Cincinnati Fact. 387, 1st OH\n[4404]');
slides[18] = new Slide('../Patriotic_files/2150.jpg', '385', '396', '1911. Label is 1870’s style but still used decades later by Henry Mason, Boston Fact. 825, 3rd MA.\nSquare end showing the full label is typical of \nnailed wood 100/10 style boxes.\n[2150]');
slides[19] = new Slide('../Patriotic_files/2148.jpg', '395', '538', 'OLD ABE was the mascot of the 8th Wisconsin infantry regiment in the Civil War and went into combat with the unit. After the war he toured the country. He died in 1881 of smoke inhalation.\n[2148]');
slides[20] = new Slide('../Patriotic_files/2149.jpg', '395', '568', 'c1910. Despite the American theme, the cigars were  made in London, Ontario, Canada, Fact. 14, IRD 32 and sold by the Havana Cigar Co., Toronto.\u2028[2149]');
slides[21] = new Slide('../Patriotic_files/6989.jpg', '395', '540', '1917. Distinctive eagle stands out in a counter.\nGotham Cigar Factory, Fact. 1020, 12th PA.\n[6989]');
slides[22] = new Slide('../Patriotic_files/2152.jpg', '395', '488', '1950. Labels are a lot more simple by the 50’s.\nCatalog card missing.\n[2152]');
slides[23] = new Slide('../Patriotic_files/titles07.jpg', '390', '510', '');
slides[24] = new Slide('../Patriotic_files/patriot25.jpg', '395', '434', '1885. Between the Revolution and the Civil War Brother Jonathan was the symbol of the new Union.\nHulll, Boesger & Co., Fact. 984, 18th Ohio, whose 100 rollers made it Cleveland’s largest cigar factory. [2125]');
slides[25] = new Slide('../Patriotic_files/patriot8.jpg', '310', '570', '1884. Early Uncle Sam image posted on top of a hogshead of leaf and a crate of cigars. \nCigars by Chas. Fellman, Worcester, Mass. \n[2108]');
slides[26] = new Slide('../Patriotic_files/patriot9.jpg', '395', '551', 'Close up of previous. Note striped pants, blue coat, top hat and boots, already his standard garb. He’s accompanied by Lady Liberty on the right.\n[2109]');
slides[27] = new Slide('../Patriotic_files/patriot11.jpg', '395', '494', '1884. UNCLE SAM’S DELIGHT were long 7” cigars. The standard size label requires a lot of white space to fit the oversize box of 50 made by Old Well Cigar Company, So. Norwalk, Connecticut.\n[2111]');
slides[28] = new Slide('../Patriotic_files/patriot10.jpg', '321', '570', 'Sam wears standard garb, here accompanied by an eagle and a giant cigar.\n[2110]');
slides[29] = new Slide('../Patriotic_files/patriot16.jpg', '383', '570', '1880. Stock Currier & Ives trade card used by PATRICIO cigars features Uncle Sam sans hat \nand boots, but with a flag and giant cigar.\n[2116]');
slides[30] = new Slide('../Patriotic_files/patriot14.jpg', '395', '568', '1903. Popular turn-of-the-century patriotic brand featuring Sam’s name, flag, shield and cigar. The cigar seen was a common shape in contrast to modern broomsticks. American Stogie Co. Allegheny, Fact. 231, 23rd PA.  [2114]');
slides[31] = new Slide('../Patriotic_files/patriot7.jpg', '369', '570', '1903. Striped coat, top hat and cigar posed in front of a map of recently conquered Cuba. Cigars by \nS.Z. Barney, Grand Rapids, Fact. 15, 4th Michigan.\n [2107]');
slides[32] = new Slide('../Patriotic_files/patriot20.jpg', '352', '570', '1900. America’s most popular war is celebrated with a cartoon of Uncle Sam throwing Spain out of Cuba.\nCigars by an unknown Wisconsin maker.\n[2120]');
slides[33] = new Slide('../Patriotic_files/patriot19.jpg', '388', '570', '1910. Uncle Sam bloated by newly conquered cigar producers Puerto Rico, Manilla, Santiago & Havana.\nSimple 3-color label by Fact. 202 Kansas. \n[2119]');
slides[34] = new Slide('../Patriotic_files/patriot23.jpg', '395', '480', '1910. Uncle Sam offers cigars “Made in Sanitary Factories by Old Experienced Cigar Makers.”\nA.J. Dimmig, East Greenville, Fact. 353, 1st PA\ndistributed by J.A. Eberts & Co., Bethlehem, PA.\nMatching edging and back flap.  [2123]');
slides[35] = new Slide('../Patriotic_files/patriot24.jpg', '395', '471', '1920. Sam sits with outstretched unsupported legs in front of less than accurate map. Victor Levor “sole owner” of the brand. Fact. 478, 18th Ohio.\n[2124]');
slides[36] = new Slide('../Patriotic_files/patriot18.jpg', '395', '544', '1928. Stern Uncle Sam posed in front of ships and Statue of Liberty, smokestacks billowing to show prosperity.  Cigars by Thos. J. Costello, Syracuse  Fact. 35, 21st New York.\n[2118]');
slides[37] = new Slide('../Patriotic_files/titles08.jpg', '390', '510', '');
slides[38] = new Slide('../Patriotic_files/4421.jpg', '297', '570', '1894. Named after the country itself. Full-color 250 dropfronts are not common as companies cut costs by using cheaper b/w labels for very cheap cigars.\nHernsheim Bros., New Orleans, Fact. 511 Louisiana claimed to have the country’s largest output.  [4421]');
slides[39] = new Slide('../Patriotic_files/patriot53.jpg', '395', '496', '1902. War inspired but irresistible patriotic image so typical of the Spanish American War aftermath.\nJulia Fix (taking over from deceased husband Fred), Dallastown, Fact. 537, 9th PA.\n[2153]');
slides[40] = new Slide('../Patriotic_files/patriot38.jpg', '395', '488', '1903. Exuberant patriotic label featuring Liberty, eagles, flags, stars, money, flowers, victory wreath and cigars. Brand created in 1877 by Seidenberg Fact. 200, 3rd NYC.\n[2138]');
slides[41] = new Slide('../Patriotic_files/patriot41.jpg', '395', '530', '1912. Brand taken over by Lorillard on the breakup of the tobacco trust. Box has notice that bands are omitted to cut production costs of these 3/5¢ cigars.\nP. Lorillard, Fact. 17, 2nd Virginia.  [2141]');
slides[42] = new Slide('../Patriotic_files/patriot43.jpg', '395', '555', 'c1900. Schmidt & Co. sample label.\n[2143]');
slides[43] = new Slide('../Patriotic_files/patriot37.jpg', '395', '562', '1888. Columbia was considered the female manifestation of the United States.\nJ.A. Prist, Lititz had 25 rollers at Fact. 288 9th PA.\n[2137]');
slides[44] = new Slide('../Patriotic_files/patriot36.jpg', '395', '510', '1886. Flags, eagle, the capital building and a bosomy Indian maid in a tropical setting. Cigars by the 55 rollers in Fact. 103, 1st PA by Yocum Bros. for the Geneva Cigar Co. in Geneva, NY.\n[2136]');
slides[45] = new Slide('../Patriotic_files/patriot28.jpg', '409', '395', 'c1928. Lovely composite of American symbols of patriotism, prosperity and beauty. Cigars by Alfred Bossard, St. Paul, Fact. 611 Minnesota for Newburger & Brother, Cincinnati. \n[2128]');
slides[46] = new Slide('../Patriotic_files/patriot27.jpg', '395', '491', 'c1900. Pictorial representation of the abstract concept of the ship of State. Cigars probably by\nHume Bros., Minneapolis, Fact. 734, for Manley & Ball Co., Minneapolis. \n[2127]');
slides[47] = new Slide('../Patriotic_files/patriot30.jpg', '379', '570', 'c1925. This brand was around for nearly half a century with various printed and vanity style labels.\nCatalog card missing.\n[2130]');
slides[48] = new Slide('../Patriotic_files/patriot34.jpg', '395', '517', '1912. From the White House to Lincoln’s log cabin.\nA.W. Servatius, Fond du Lac, Fact. 406, 1st Wisc.\n[2134]');
slides[49] = new Slide('../Patriotic_files/patriot29.jpg', '394', '474', '1881. Inspired by the Centennial, Hesslein Brothers of Chicago began featuring the Liberty Bell, yet another patriotic symbol. Fact. 259, 1st Illinois.\n[2129]');
slides[50] = new Slide('../Patriotic_files/patriot91.jpg', '250', '570', 'The brothers ultimately renamed their factory after their best selling brand.\n[2191]');
slides[51] = new Slide('../Patriotic_files/patriot70.jpg', '395', '454', '1976. Bicentennial box of Consolidated’s\nDUTCH MASTERS cigars.\n[2170]');
slides[52] = new Slide('../Patriotic_files/patriot02.jpg', '376', '600', '1894. A National symbol the founding fathers specifically wished to avoid. Cigars by H. Grone’s Sons, whose 10 rollers made it the biggest factory in Madison. Fact. 104, 2nd tax District, Wisconsin.\n[10972]');
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", "Patriotic_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;
    }
}

