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('../Early_Cuban_labels_II_files/xx049.jpg', '498', '369', 'Vertical style usually pasted flat on the top of boxes.\n[xx049]');
slides[1] = new Slide('../Early_Cuban_labels_II_files/xx050.jpg', '369', '454', 'Small end and inner label with unusually\nheavy (out of proportion?) border.\n[xx050]');
slides[2] = new Slide('../Early_Cuban_labels_II_files/xx051.jpg', '426', '369', 'Label printed for cigarettes made for the Russian market of a mix of domestic and Turkish tobacco. \n[xx051]');
slides[3] = new Slide('../Early_Cuban_labels_II_files/xx055.jpg', '391', '397', 'Similar to label seen in first exhibit, but printed on a different color paper. Note octagonal cut by hand.\n[xx055]');
slides[4] = new Slide('../Early_Cuban_labels_II_files/xx056.jpg', '292', '397', 'The mahogany tree. Another very heavy\nborder and use of broadside like type font\narrangement, with each line a different face.\n[xx056]');
slides[5] = new Slide('../Early_Cuban_labels_II_files/xx057.jpg', '293', '397', 'The sweet pineapple. Oval inner with \nhand-done octagonal cut.\n[xx057]');
slides[6] = new Slide('../Early_Cuban_labels_II_files/xx058.jpg', '682', '482', 'Top label with maker’s warrantee.\n[xx058]');
slides[7] = new Slide('../Early_Cuban_labels_II_files/xx094.jpg', '580', '510', 'King palm, an island staple.\n[xx094]');
slides[8] = new Slide('../Early_Cuban_labels_II_files/xx059.jpg', '670', '482', 'The label style that ultimately “wins” and\nbecomes the standard outer in the U.S.\nand Cuba during the 1860’s and 1870’s\nfor boxes of 100.  [xx059]');
slides[9] = new Slide('../Early_Cuban_labels_II_files/xx089.jpg', '632', '425', 'Same label on brown ink on odd green paper. The square picture fit the end of a box of 100 and\nthe text overlapped onto the top of the box.\n[xx089]');
slides[10] = new Slide('../Early_Cuban_labels_II_files/xx070.jpg', '153', '482', 'Fabrica de tobacos translates as “cigar factory.”\nHow exactly this label was used is unknown.\n[xx070]');
slides[11] = new Slide('../Early_Cuban_labels_II_files/xx080.jpg', '352', '510', 'Black on yellow was a readable and attractive\nearly combination.\n[xx080]');
slides[12] = new Slide('../Early_Cuban_labels_II_files/xx082.jpg', '282', '709', 'Another label with exact use unknown.\nDepicts the type of boat making weekly runs to Cuba from NY and Philadelphia during most.of the 19th century.   [xx082]');
slides[13] = new Slide('../Early_Cuban_labels_II_files/xx091.jpg', '430', '425', '“The Design” is stylish design. Round labels\nwere used as both inners and outers.\n[xx091]');
slides[14] = new Slide('../Early_Cuban_labels_II_files/xx092.jpg', '310', '425', 'Brand of Francisco Perez del Rio,\nan important early manufacturer.\nOval inner with octagonal hand-cut.\n[xx092]');
slides[15] = new Slide('../Early_Cuban_labels_II_files/xx093.jpg', '311', '510', '“Loyalty” exemplified by a man and his dog by Morejon y Roxas, makers of cigarettes and “segars of every description” according to their inner.\n[xx093]');
slides[16] = new Slide('../Early_Cuban_labels_II_files/xx096.jpg', '341', '454', 'The Count of Nesselrode, a negotiator of Treaty of Paris ending the US Revolutionary War. Strange\nversions of Russian and US flags. Very early\nlabel honoring important diplomat.  [xx096]');
slides[17] = new Slide('../Early_Cuban_labels_II_files/xx098.jpg', '326', '425', 'Supporter of Queen Regent Maria Christina \nagainst pretender Don Carlos in the 1830’s.\nEarly topical label.  [xx098]');
slides[18] = new Slide('../Early_Cuban_labels_II_files/xx097.jpg', '307', '425', 'Oval inner with octagonal cut. A lot of\nextra work with questionable benefit.\n[xx097]');
slides[19] = new Slide('../Early_Cuban_labels_II_files/xx095.jpg', '279', '425', 'Simple small label reading Cigar Factory of Don Fernando Rodriguez del Valle outside the wall.\n[xx095]');
slides[20] = new Slide('../Early_Cuban_labels_II_files/xx099.jpg', '407', '539', 'Simple use of maker’s name and bi-lingual\nSpanish and French text for the European market.\n[xx099]');
slides[21] = new Slide('../Early_Cuban_labels_II_files/xx100.jpg', '413', '624', 'Probably colloquial use of El Espeso, since it’s literally thick, dense, gross, heavy, slovenly...\n[xx100]');
slides[22] = new Slide('../Early_Cuban_labels_II_files/xx102.jpg', '303', '425', 'A common form of label in Cuba, simply giving \nthe maker’s name and signature in Spanish\nand in the language where marketed. Oval inner.\n[xx102]');
slides[23] = new Slide('../Early_Cuban_labels_II_files/xx103.jpg', '379', '510', 'Typical Spanish English label, but announcing\na change of name and address.\n[xx103]');
slides[24] = new Slide('../Early_Cuban_labels_II_files/xx132.jpg', '704', '482', 'Blue on white depiction of the deadly hurricane of 1844 which destroyed the tobacco crop.\n[xx132]');
slides[25] = new Slide('../Early_Cuban_labels_II_files/xx137.jpg', '752', '510', 'Red depiction of the same event.\n[xx137]');
slides[26] = new Slide('../Early_Cuban_labels_II_files/xx101.jpg', '673', '454', 'Inevitable combination of the two. Certainly\none of the earliest two color cigar labels.\n[xx101]');
slides[27] = new Slide('../Early_Cuban_labels_II_files/xx104.jpg', '734', '510', 'Spanish-English-French label with ultimately\nodd ratio of picture to text.\n[xx104]');
slides[28] = new Slide('../Early_Cuban_labels_II_files/xx106.jpg', '339', '425', 'English material manufacturer turned economist\nand writer who traveled extensively. Elected to Parliament as anti-corn law rep. in 1840’s.\nEarly use of contemporary politician. [xx106]');
slides[29] = new Slide('../Early_Cuban_labels_II_files/xx107.jpg', '289', '425', 'Simple unattractive oval with 8 different typefaces, a common practice carried over from handbills and posters. [xx107]');
slides[30] = new Slide('../Early_Cuban_labels_II_files/xx108.jpg', '322', '425', 'Blank ink on colored paper, makers name and address, decorative border and each line a different font. Oval design with octagonal cut. [xx108]');
slides[31] = new Slide('../Early_Cuban_labels_II_files/xx109.jpg', '322', '425', 'Sweetness of smell on a French, English\nand Spanish label with decorative border and maker’s name and address.  [xx109]');
slides[32] = new Slide('../Early_Cuban_labels_II_files/xx131.jpg', '733', '482', 'Young Black. Text on top of a picture on\na vertical label is the style that predominates\nin later decades, but not in this ratio.\n[xx131]');
slides[33] = new Slide('../Early_Cuban_labels_II_files/xx133.jpg', '694', '482', 'Major-General commanding Indian army in early 1840’s. Picture on top, text below is a short-lived\nlabel design, not practical except as a top label. Useless inside or on the end. [xx133]');
slides[34] = new Slide('../Early_Cuban_labels_II_files/xx135.jpg', '682', '510', 'Punctuality or preciseness, possibly referring to uniformity of hand-made product. Soon to be\ndiscarded label style. [xx135]');
slides[35] = new Slide('../Early_Cuban_labels_II_files/xx138.jpg', '734', '510', 'The eagle is the most common of cigar label birds. Rare mention of the cigar factory as wholesalers is on this “eight-sided” but uncut label. \n[xx138]');
slides[36] = new Slide('../Early_Cuban_labels_II_files/xx136.jpg', '566', '510', 'Literary characters appeared on labels early.\nFrench and Spanish.\n[xx136]');
slides[37] = new Slide('../Early_Cuban_labels_II_files/xx139.jpg', '464', '510', 'Lithographer signed label emphasizing the island’s connection to the mother country. Lit. de Gobierno.  Cigars by Ramon Diaz y Ca (and company).\n[xx139]');
slides[38] = new Slide('../Early_Cuban_labels_II_files/xx143.jpg', '703', '510', 'The brand name can mean competence and also competition. Cigars by Juan Suarez. Octagonal design and cut was not common. \n[xx143]');
slides[39] = new Slide('../Early_Cuban_labels_II_files/xx153.jpg', '718', '510', 'Label looks the same except for paper color but close inspection shows the die from which it was\nprinted is very close but different. No lithographer’s\nmark on the label on the right.  [xx153]');
slides[40] = new Slide('../Early_Cuban_labels_II_files/xx147.jpg', '336', '425', 'Resolution, determination of Pablo Valdes.\nSix fonts on a small oval is typical of the period.\n[xx147]');
slides[41] = new Slide('../Early_Cuban_labels_II_files/xx148.jpg', '334', '425', 'Close examination of the label collection reveals a limited number of fonts, used repeatedly. There were only a few lithographers. \n[xx148]');
slides[42] = new Slide('../Early_Cuban_labels_II_files/xx146.jpg', '305', '425', 'More ornate than most borders. English text\nuses “segars” spelling. Words run together\nin second line of type. Infiesta?\n[xx146]');
slides[43] = new Slide('../Early_Cuban_labels_II_files/xx169.jpg', '384', '482', 'ASEO is cleanliness, a good name for a cigar\nin days when that was a concern. Fancy border, eight typefaces in 13 lines. Spanish, English and French text. [xx169]');
slides[44] = new Slide('../Early_Cuban_labels_II_files/xx175.jpg', '375', '482', 'When borders take over. Experimental placement of the brand name within a very thick border. \nSuccessful?  You decide.  [xx175]');
slides[45] = new Slide('../Early_Cuban_labels_II_files/xx182.jpg', '306', '425', 'Octagonal cut around a typical oval label. Bendueles? \n[xx182]');
slides[46] = new Slide('../Early_Cuban_labels_II_files/xx149.jpg', '393', '397', 'The Globe cigar factory of Manuel Nora. \nTercera are the lowest quality cigars.\nPicture-frame border.\n[xx149]');
slides[47] = new Slide('../Early_Cuban_labels_II_files/xx154.jpg', '332', '425', 'The Globe cigar factory used a fancier label with a more decorative border for their Bueno (good) grade  of cigars. Still not the highest possible grade. \nI wonder what that label looked like.  [xx154]');
slides[48] = new Slide('../Early_Cuban_labels_II_files/xx165.jpg', '529', '425', 'Heavy border in odd double-signed label\ntouting the tobacco as “from the Leeward Coast,” \na perhaps unique declaration.\n[xx165]');
slides[49] = new Slide('../Early_Cuban_labels_II_files/xx141.jpg', '562', '680', 'A statue of the three graces decorates this triptych design for LA VICTORIA cigars. Text in Spanish, English and German. Lit. del Gobierno[?].\n[xx141]');
slides[50] = new Slide('../Early_Cuban_labels_II_files/xx167.jpg', '668', '567', 'Flor is one of the better grades of cigar.\nEstefan Dominguez Diazl uses a florid decorative\nborder, suitable given the use of Flora (same meaning as in English) as a brand name. [xx167]');
slides[51] = new Slide('../Early_Cuban_labels_II_files/xx170.jpg', '364', '482', 'No brand name or maker’s name, just a factory address on this unusual label with cut rounded corners. Text in Spanish, English and French.\n[xx170]');
slides[52] = new Slide('../Early_Cuban_labels_II_files/xx178.jpg', '386', '709', 'One of Cuba’s oldest cigar brands, mentioned in an 1838 Boston newspaper advertisement.\nSpanish, French and English text.\n[xx178]');
slides[53] = new Slide('../Early_Cuban_labels_II_files/xx179.jpg', '393', '510', 'Decorative border on small (4” mas o menos)\nlabels which could be used as inner or outer. Eight fonts were used on this Spanish-English label.\n[xx179]');
slides[54] = new Slide('../Early_Cuban_labels_II_files/xx183.jpg', '800', '560', 'Square bottom image with text above, the style which ultimately is adopted for nearly all outer labels.  Lithograph of spinning woman is \nby Luis Marquier.  [xx183]');
slides[55] = new Slide('../Early_Cuban_labels_II_files/xx184.jpg', '744', '567', 'Spanish, English and German text highlight this vertical label used by Joaquin Diaz.\n[xx184]');
slides[56] = new Slide('../Early_Cuban_labels_II_files/xx229.jpg', '335', '454', 'Early labels, like this, often indicated that the tobacco comes from the manufacturer’s own\nvega (farm) in the Vuelta Abajo (Cuba’s best\ntobacco region).  [xx229]');
slides[57] = new Slide('../Early_Cuban_labels_II_files/xx230.jpg', '375', '510', 'First label of long-lived important brand’s top\ngrade of cigar. Anselmo Gonzales del Valle\nwas maker of other brands seen in the first exhibit. [xx230]');
slides[58] = new Slide('../Early_Cuban_labels_II_files/xx234.jpg', '378', '510', 'Tri-lingual label with maker identified\nonly as A.F.\n[xx234]');
slides[59] = new Slide('../Early_Cuban_labels_II_files/xx235.jpg', '337', '454', 'Triple-layered border on an all-Spanish label \nnamed after, but not picturing, a brunette.\nMaker not identified. \n[xx235]');
slides[60] = new Slide('../Early_Cuban_labels_II_files/xx237.jpg', '401', '567', 'Astronomical brand name: Sirius or the dog-star\nappears on this all Spanish label.\n[xx237]');
slides[61] = new Slide('../Early_Cuban_labels_II_files/xx238.jpg', '370', '567', 'Good taste or good pleasure in Spanish,\nEnglish and German.\n[xx238]');
slides[62] = new Slide('../Early_Cuban_labels_II_files/xx244.jpg', '331', '482', 'Ambrosia is the same in many languages. Text in Spanish, English, and French. Highly unusual use\nof “cigarros” to mean cigars when it is more commonly translated as cigarettes.  [xx244]');
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", "Early_Cuban_labels_II_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;
    }
}


