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('../Cigar-cases_files/cigarcase.jpg', '392', '257', 'Cigar case made of leather and hand painted papier maché. Portraits, nudes, classical references and military or historic scenes were especially popular.\nNot in the NCM collection.');
slides[1] = new Slide('../Cigar-cases_files/562.jpg', '351', '344', 'Two traditional shapes are found, both designed to hold three or four cigars. Cases are typically painted on only one side, with the word “Segars” or “Cigars”  painted in gold on the reverse. \nNot in the NCM collection.');
slides[2] = new Slide('../Cigar-cases_files/A6A2BF5009AF11DD.jpg', '423', '799', 'Wonderful painting of the Hamburg fire which destroyed a good portion of the city, including the cigar district, in 1842.\n[K1107]');
slides[3] = new Slide('../Cigar-cases_files/AA4ECF6A09AF11DD.jpg', '412', '799', 'Unusual, finely detailed map on the reverse, showing the fire damaged portion of the\ncity in red. Historical scenes are among\nthose most prized by collectors.\n[K1108]');
slides[4] = new Slide('../Cigar-cases_files/11790.jpg', '578', '286', 'Two-piece sturdy leather case for three cigars manufactured by L. & E. Butler. Manuscript on one side gives the case as a gift in 1847. On the reverse someone else gives the case as a gift in 1857.\n[11790]');
slides[5] = new Slide('../Cigar-cases_files/11798.jpg', '487', '600', 'Case was registered in May of 1844.\n[11798]');
slides[6] = new Slide('../Cigar-cases_files/11796.jpg', '558', '275', 'Improved version of the previous case. A lever\non a spring provides just enough pressure to \nkeep one or two cigars from flopping around\nand getting damaged when the case isn’t full.\n[11796]');
slides[7] = new Slide('../Cigar-cases_files/11797.jpg', '546', '600', 'Butler Bros. & Co. are given as makers of the\n“Improved Cigar Case with Spring.” No date.\nProbably 1850’s,\n[11797]');
slides[8] = new Slide('../Cigar-cases_files/11791.jpg', '567', '283', 'Double-ended case with place for segars on one end and matches on the other. Metal plate provided for monogramming. c1850.\n[11791]');
slides[9] = new Slide('../Cigar-cases_files/11790_2.jpg', '607', '259', 'Pushing either end, allows the other to clam-shell open on a lightweight spring.\n[11790c]');
slides[10] = new Slide('../Cigar-cases_files/london by.jpg', '652', '800', 'Standard elegant case by\nCharles Asprey of London.\nNot in the NCM collection.');
slides[11] = new Slide('../Cigar-cases_files/chas Asprey.jpg', '707', '792', 'Previous, displayed open.');
slides[12] = new Slide('../Cigar-cases_files/426d_1_b.jpg', '359', '203', 'Identified as a cigar case, but the fancy rosettes seem impractical for a man to carry in his pocket.\nA lovely piece made of leather with metal studding. Not in the NCM Collection.');
slides[13] = new Slide('../Cigar-cases_files/42ce_1.jpg', '268', '310', 'Previous case, open. Seems effeminate, \nthough quite lovely. Since it’s not in the\nNCM collection I can’t verify its authenticity\nbut show it as a work of art.');
slides[14] = new Slide('../Cigar-cases_files/4dd0_1.jpg', '261', '370', 'Nice hard leather case. Initialed. \nNot in the NCM collection.');
slides[15] = new Slide('../Cigar-cases_files/522c_1.jpg', '287', '295', 'Interior of previous.');
slides[16] = new Slide('../Cigar-cases_files/11796_2.jpg', '628', '264', 'Adding fluting by means of pressure die stamping wet leather provides protection for the cigars.\n[11796c]');
slides[17] = new Slide('../Cigar-cases_files/11787.jpg', '600', '293', 'Called tortoise shell, this two-piece case is in \nOriental motif popular mid century. This appears\nto be a mismatch, or re-marriage.\n[11787]');
slides[18] = new Slide('../Cigar-cases_files/11873.jpg', '440', '600', 'A contemporary leather case no cigar smoker\ncould resist. Stamped PUROS HABANOS, \nthese were given away at the official reception\nput on by COHIBA for attendees of the 1992 Havana conference honoring the 500th anniversary of the discovery of tobacco. [11873]');
slides[19] = new Slide('../Cigar-cases_files/11874.jpg', '440', '600', 'Case came complete with hidden treasures.\n[11874]');
slides[20] = new Slide('../Cigar-cases_files/11785.jpg', '393', '600', 'An early hinged hard papier Maché case.\n[11785]');
slides[21] = new Slide('../Cigar-cases_files/36misc73.jpg', '542', '800', 'After machine made cardboard was perfected in the 1850s, it became a medium for many products, including cigar cases. These date to the 1880-1910 era, and were given away by cigar factories:\nLorillard in Virginia, Thomas Thorne in Binghamton, NY and J.I. Lang in Olean, NY.  [3673]');
slides[22] = new Slide('../Cigar-cases_files/case4x2.jpg', '477', '561', 'Pressed cardboard case given away by Buffalo, NY, distributor W.H. Granger. On this side it advertises a New Orleans made 10¢ cigar. This case not in\nthe NCM collection.');
slides[23] = new Slide('../Cigar-cases_files/case1886.jpg', '606', '415', 'Reverse of Granger’s give-away listing other prominent brands for which he is exclusive distributor in the Buffalo area. Case dates\nfrom approximately 1890.');
slides[24] = new Slide('../Cigar-cases_files/papernewjpg8251.jpg', '600', '400', 'German mechanical trade card. 1901\n[8251]');
slides[25] = new Slide('../Cigar-cases_files/papernewjpg8252.jpg', '600', '400', 'Cigar case on a card.\n[8252]');
slides[26] = new Slide('../Cigar-cases_files/36misc82.jpg', '800', '540', 'Two-piece moulded cardboard case given away with GIRL FROM PARIS brand nickel cigars.\n[3682]');
slides[27] = new Slide('../Cigar-cases_files/36misc81.jpg', '800', '430', 'Similar, unbranded, case with bare-breasted woman, not in the NCM collection.\nTypically these cases get soiled over time, but the bottom half remains protected and pristine.\n[3681]');
slides[28] = new Slide('../Cigar-cases_files/36misc76.jpg', '420', '800', 'Leather pouches, both soft and medium, printed with ad copy in gold and silver inks. \nHeld 3 to 5 cigars. 1870-1920.\n[3676]');
slides[29] = new Slide('../Cigar-cases_files/11783.jpg', '800', '514', 'Give-away leather pouch used by American Cigar Company for its best selling anchor nickel cigar. Around 1905.\n[11783]');
slides[30] = new Slide('../Cigar-cases_files/momisc37100.jpg', '800', '406', 'Hard to see, but heavily embossed with logo of TANSILL’S PUNCH a popular late 1800’s cigar. The accordion fold is typical.\n[3700]');
slides[31] = new Slide('../Cigar-cases_files/36misc80.jpg', '800', '565', 'Good looking, heavily embossed, leather pouch given away by cigar-making giant Bondy & Lederer, one of NYC’s larger factories. c1900.\n[3680]');
slides[32] = new Slide('../Cigar-cases_files/11799.jpg', '800', '568', 'typically constructed hard (reinforced?) leather case with gold printing and deep stamping of a comical face. Maker of the ELECTRIC PARK cigar. \n[11799]');
slides[33] = new Slide('../Cigar-cases_files/11806.jpg', '476', '600', 'Tiny leather match holder given by giant West Coast distributor M.A. Gunst, a Tobacco Trust Associate.\nGENERAL ARTHUR was one of the nation’s most\nheavily advertised brands in magazines.\n[11806]');
slides[34] = new Slide('../Cigar-cases_files/11803.jpg', '394', '600', 'Very rare leather postcard that doubled\nas a tobacco pouch. Mailed from Iowa\nin 1907.\n[11803]');
slides[35] = new Slide('../Cigar-cases_files/11804.jpg', '600', '394', 'Reverse of postcard. “Have one on me.”\n[11804]');
slides[36] = new Slide('../Cigar-cases_files/11811.jpg', '588', '296', 'Two-piece silk embroidered cigar case ”...given to Mayor L.H. Chappell by certain Chinese laundrymen of Columbus, GA about 1902 or 1903” according to a note inside.\n[11811]');
slides[37] = new Slide('../Cigar-cases_files/11812.jpg', '597', '313', '\n[11812]');
slides[38] = new Slide('../Cigar-cases_files/0319_2_lg.jpg', '385', '319', 'European decorated silver case.\nNot in the NCM collection.');
slides[39] = new Slide('../Cigar-cases_files/0319_1_lg.jpg', '254', '356', 'Erotica was popular in 1830-1880 cases, but often hidden inside, sometimes behind a false “wall” inside the case. European c. 1840.\nNot in the NCM  collection.');
slides[40] = new Slide('../Cigar-cases_files/DSCF0005.jpg', '762', '635', 'Interesting case with Russian hallmark offered on ebay. Seller notes the clasp has been replaced. I suspect that a lot more than the clasp is not original.');
slides[41] = new Slide('../Cigar-cases_files/DSCF0042.jpg', '622', '800', 'These “charm bracelet” additions are old, but make no logical sequence or relationships to one another or to the original pattern engraved into the silver. They’re random do-dads. These decorations sticking up from the surface would make it difficult to smoothly remove from a suit coat pocket.');
slides[42] = new Slide('../Cigar-cases_files/DSCF0026.jpg', '554', '800', 'Both sides of the case.');
slides[43] = new Slide('../Cigar-cases_files/DSCF0149.jpg', '537', '800', 'Interior, with an emblem the only purpose of which would be to ruin your cigars. An obvious later add-on by a demented jeweler or a student learning how to add embellishments to silver items.');
slides[44] = new Slide('../Cigar-cases_files/11793.jpg', '409', '600', 'Selection of metal cases, made of tin, sterling silver\nand aluminum. Three compartments is\nthe most common design.\n[11793]');
slides[45] = new Slide('../Cigar-cases_files/11786.jpg', '307', '600', 'Tin three cigar case give away by the Edwin Cigar Co., founded by “Morton Edwin” a teen-age boy\nwho went on to head one of the country’s \nlargest mail-order cigar companies.\n[11786]');
slides[46] = new Slide('../Cigar-cases_files/11792.jpg', '426', '800', 'Sterling silver three cigar case. The more valuable the case, the more likely to be monogrammed.\n[11792');
slides[47] = new Slide('../Cigar-cases_files/11810.jpg', '317', '600', 'The NCM owns two very similar aluminum cases. The one seen above was a souvenir sold or given away at the Jamestown Exposition in 1907. This one was given away as ad advertisement for\nNEIL BURGESS cigars, c1905.\n[11810]');
slides[48] = new Slide('../Cigar-cases_files/11809.jpg', '653', '600', 'Cases for single cigars were, for me, surprisingly popular. Seen above are hand-soldered tin, stamped nickel-plated tin, sterling silver and aluminum.\n[11809]');
slides[49] = new Slide('../Cigar-cases_files/11808.jpg', '800', '529', 'The stamped nickel plate is a particularly ornate design, one of the nicest I’ve seen. The sterling\ncase is very plain in contrast. Both 1890-1910.\n[11808]');
slides[50] = new Slide('../Cigar-cases_files/11795.jpg', '307', '600', 'Hand made soldered tin, probably Civil War era.\nThe earliest single cigar case I’ve seen.\n[11795]');
slides[51] = new Slide('../Cigar-cases_files/11789.jpg', '260', '600', 'Aluminum, opened. Probably 1900-1910.\n[11789]');
slides[52] = new Slide('../Cigar-cases_files/12816.jpg', '234', '600', 'Large 7+ inch heavy (12 ounce) “pocket” holder \nwith an H.Upmann logo, but it’s doubtful that\ncompany has anything to do with it.\n[12816]');
slides[53] = new Slide('../Cigar-cases_files/12817.jpg', '254', '600', 'Attractive, but too heavy to be practical to carry \nthanks to a hidden booze flask.\n[12817]');
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", "Cigar-cases_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;
    }
}


