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('../Christmas_and_cigars_files/188-9 4112.jpg', '407', '568', '1880’s  My favorite Christmas box. Die cuts are common on Christmas boxes, both inside and out.\nCigars by Riddle, Graff & Co., Delaware, OH\nFact. 22, 11th  Ohio\n[4112]');
slides[1] = new Slide('../Christmas_and_cigars_files/188-9 4111.jpg', '407', '489', 'Interior of previous. Note ribbon which stretched across 25 cigars, and the smaller colored ribbons which banded them. Angels were a popular theme in the days when Christmas was a religious holiday. \nInterior lid is uniquely padded satin. [4111]');
slides[2] = new Slide('../Christmas_and_cigars_files/xmas angel10076.jpg', '375', '570', '1880’s  Plain top as Christmas boxes go.\nFact. 428, 1st Ohio. Unidentified maker.\n[10076]');
slides[3] = new Slide('../Christmas_and_cigars_files/xmas angel10077.jpg', '474', '570', 'Interior of previous. Wonderful snow-suited \ndie-cut angel with triptych style design. Box printed \nin silver, gold, red, and unusual light blue. \nLovely paper lace flaps all around. \nCurator’s favorite.   [10077]');
slides[4] = new Slide('../Christmas_and_cigars_files/188- 4113.jpg', '352', '570', 'c1886  NWHC box with unusual green background for die-cut. Cigars made in Fact. 543 Wisconsin.\n[4113]');
slides[5] = new Slide('../Christmas_and_cigars_files/188- 4114.jpg', '400', '570', 'c1886  Interior of previous. Striking Christmas box with die-cut against a blue and silver background.  Gold foil liner. \n[4114]');
slides[6] = new Slide('../Christmas_and_cigars_files/1885 4123.jpg', '407', '506', '1885 Striking early box made in Fact. 276, \n1st Mich., an unlisted cigar maker.\n[4123]');
slides[7] = new Slide('../Christmas_and_cigars_files/1886 4117.jpg', '400', '570', '1887  Die-cut cat on NW with full hardware.  Slogan reads “May Christmas bring you many comforts.” \nFact. 70, 3rd NYC\n[4117]');
slides[8] = new Slide('../Christmas_and_cigars_files/1886c 4119.jpg', '407', '567', 'c1886  Die-cut of two little girls playing with dolls.\nCigars by Levy Bros., a firm with 500 rollers, located at Avenue C and 18th Street. Fact. 401, 3rd NYC. \n[4119]');
slides[9] = new Slide('../Christmas_and_cigars_files/1887 4106.jpg', '493', '407', '1887  Unusual double sided box with two different die-cuts. How were the cigars held in the box when lid opened?  Fact. 279, 5th NJ\n[4106]');
slides[10] = new Slide('../Christmas_and_cigars_files/1889 4102.jpg', '356', '570', '1889  Unusual die-cut top with silver-printing.\nCigars by Levy Bros., a firm with 500 rollers, located at Avenue C and 18th Street. Fact. 401, 3rd NYC.\nFact. 401, 3rd Dist. NYC. \n[4102]');
slides[11] = new Slide('../Christmas_and_cigars_files/1889 4103.jpg', '407', '526', '1889  Interior of previous.  Robins on a branch makes for an odd theme for a Christmas box. \n[4103]');
slides[12] = new Slide('../Christmas_and_cigars_files/1889 4142.jpg', '407', '533', '1888  Trimmed Nailed Wood box with clasp. Lovely embossed top label.  Cigars by or for F.F. Follett, in short-lived Factory 239, Dist. CT.\n[4142]');
slides[13] = new Slide('../Christmas_and_cigars_files/1889 4141.jpg', '554', '407', '1888  Interior of previous demonstrates not all Christmas boxes carry the holiday theme inside. Note outstanding use of paper lace.\n[4141]');
slides[14] = new Slide('../Christmas_and_cigars_files/189- 4137.jpg', '376', '570', 'c1890  Trimmed nailed wood box used by \nCharles Dittenhoffer of Lancaster, PA,\n Factory 1712, 9th PA. \n[4137]');
slides[15] = new Slide('../Christmas_and_cigars_files/189- 4138.jpg', '407', '549', 'c1890  As especially nice label with heavy use of gold on what appears to be a varnished label. Unusual for inner to match top on Christmas boxes. \n[4138]');
slides[16] = new Slide('../Christmas_and_cigars_files/189- 4139.jpg', '370', '570', 'c1900  Trimmed nailed wood box with clasp and overall lid, with a simulated alligator label printed\nin silver and gold. Fact. 116, 1st Oregon\n[4139]');
slides[17] = new Slide('../Christmas_and_cigars_files/189- 4140.jpg', '407', '497', 'c1900  Interior of previous. Lovely pastel young ladies. Note internal all around flap-style edging which laid on top of the cigars, probably on top of a floating tissue paper flap.  Curator’s favorite. \n[4140]');
slides[18] = new Slide('../Christmas_and_cigars_files/1890c 4131.jpg', '407', '558', 'c1900  Wicker basket weave surface on NWHC box; cigars by Henry Gutsmith, Canton Ave., Baltimore.\nFact. 226, Maryland. \n[4131]');
slides[19] = new Slide('../Christmas_and_cigars_files/189- 4151.jpg', '412', '407', 'c1890  This same charming duo appear on individual 14” die cuts in an ad for Kinney Bros. cigarettes as well as on standee-type posters.\nCigars by Osborn Bros., Fact. 23, 8th Dist. \nDecatur, Illinois.  [4151]');
slides[20] = new Slide('../Christmas_and_cigars_files/1892 4134.jpg', '570', '354', '1892  This book shaped box has a large clasp to keep the lid sealed when the box is stood upright.\nCherubs printed in silver.  Fact. 107, but the state \nis obliterated in the ID.\n[4134]');
slides[21] = new Slide('../Christmas_and_cigars_files/1892 4133.jpg', '407', '517', '1892  Birds and a young girl adorn this, the first book-shaped box and the first Christmas box in my collection. Purchased for an enormous $5 from a Pasadena, CA, antique store in 1953. \n[4133]');
slides[22] = new Slide('../Christmas_and_cigars_files/1895c 4109.jpg', '407', '566', 'c1895  Die-cut snow scene combined with gold printing made an attractive top on this box used by Charles Kurtz of Milville, NJ, Fact. 8, 1st NJ. \n[4109]');
slides[23] = new Slide('../Christmas_and_cigars_files/1895c 4110.jpg', '407', '540', 'c1895  Interior of previous uses another die-cut, centered in gold-printed greetings with unusual use of black ink as shading.\n[4110]');
slides[24] = new Slide('../Christmas_and_cigars_files/1894 4104.jpg', '377', '570', '1894  Horseshoe an unusual theme on a Christmas   box. Box used by W.H. Fischhofer & Co., \n337 East 75th St. NYC.  Fact. 1937, 3rd NY. \n[4104]');
slides[25] = new Slide('../Christmas_and_cigars_files/190- 4135.jpg', '381', '569', 'c1890  Silver and gold ink with an angel die-cut. \nNo, your eyes aren’t deceiving you. The top \ndesign is printed crooked. Not catalogued.\n[4135]');
slides[26] = new Slide('../Christmas_and_cigars_files/9242.jpg', '597', '800', 'Unusual cut Nailed Wood box with full hardware used by Straiton & Storm, whose 1,000 rollers made it one of the nation’s largest cigar factories, \nFact. 11, 3rd Dist NYC.\n[9242]');
slides[27] = new Slide('../Christmas_and_cigars_files/novelty3466.jpg', '492', '569', '1884  Very unusual house-shaped Christmas novelty box made in the Detroit area by an unidentified cigar maker. Fact 276, 1st Dist. Mich.\n[3466]');
slides[28] = new Slide('../Christmas_and_cigars_files/UnNamed5.jpg', '800', '658', 'Rare 12/6 featuring a boy peeing his Christmas greetings in the snow.  Cigars by Chas. Specht Noonday Cigar Co., Fact. 505, 1st Missouri, \nSt. Louis, 1904. A curator’s favorite.\n[3305]');
slides[29] = new Slide('../Christmas_and_cigars_files/1901c 4144sold.jpg', '407', '555', 'c1901 Snow Flake is unusual in that the top and the inside label are both the same design. True of few  Christmas boxes. Cigars by  Josephson Bros, \nFact. 338, 3rd NYCity.\n [4144] Now owned by the family');
slides[30] = new Slide('../Christmas_and_cigars_files/190- 4108.jpg', '570', '329', 'c1905  Book shaped box from the period when they were most popular as gifts. Cigars by L.M. Bement, Clifton Springs, Fact. 973, 28th Western NY. \n[4108]');
slides[31] = new Slide('../Christmas_and_cigars_files/1914c 4107.jpg', '407', '550', 'c1905  Pretty girl inner, one of my favorite \nF.M. Howell, Elmira printer, cigar labels. \n[4107]');
slides[32] = new Slide('../Christmas_and_cigars_files/1901c 4127.jpg', '570', '333', 'c1901  Unusually labeled book-shaped box used by L.C. Schmidt, Appleton, Fact. 382, 1st Dist Wisc. \n[4127]');
slides[33] = new Slide('../Christmas_and_cigars_files/1901c 4152.jpg', '381', '570', '1900 Labels with New Years themes are scarce. Friends giving a midnight toast at the millennium was used by D.E. Woodmansee of Springforge, PA, owner of. Fact. 414, 9th Dist. PA.  \n[4152]');
slides[34] = new Slide('../Christmas_and_cigars_files/1903c 4147.jpg', '369', '570', 'c1903  Interesting basket weave pattern stamped or cut into wood with applied metal corners, hinges and clasps, and fancy centered leaves. Cigars by A.E. John, Fort Madison, Fact. 155, 4th Dist, Iowa.   \n[4147]');
slides[35] = new Slide('../Christmas_and_cigars_files/190- 4148.jpg', '392', '570', 'c1903  Interior of previous. Santa with demented look in his eye appears to be stuffing his bag\nas much as emptying it. \n[4148]');
slides[36] = new Slide('../Christmas_and_cigars_files/Remember Me.jpg', '182', '216', 'c1901 Everything about this box is unusual, from its satiny blue exterior paper and applied corners to its "Remember Me" message, likely  given by a lady to her man friend. Cigars by Ralph Davis, Fact.171, 4th Dist. Moulton, Iowa.   [0000]');
slides[37] = new Slide('../Christmas_and_cigars_files/1901c 4154.jpg', '407', '421', 'c1901  Interior of previous. Cuddly Santa. \n[4154]');
slides[38] = new Slide('../Christmas_and_cigars_files/1901c 4146.jpg', '407', '481', 'c1900 Textual inner advertises TIMM’S MONOGRAM cigars. Floating flap is holiday themed. Gold foil used for liner. Ornate metal trim with die-cut of woman, not untypical of Christmas boxes.Fact. 931, Minnesota   [4146]');
slides[39] = new Slide('../Christmas_and_cigars_files/1911c 4121.jpg', '407', '476', 'c1911  Adding a die cut santa to the interior was a quickie way to jazz up a box. Added later? Possible, but doubtful, given the widespread use of die-cuts on Christmas boxes. Fact. 1133, 1st PA was owned\nby John K. Steffy, Lyons.  [4121]');
slides[40] = new Slide('../Christmas_and_cigars_files/1901c 4156.jpg', '438', '407', 'c1901  Unusual box of 12 cigars with severely trimmed label, lace decorations.  Cigars by \nJohn Tolan, Escanaba, Fact. 311, 4th Michigan. \n[4156]');
slides[41] = new Slide('../Christmas_and_cigars_files/190- 4136.jpg', '407', '561', 'c1901  Same Santa label on a partially trimmed NW box used by an unknown cigarmaker, Fact. 204 MD. \n[4136]');
slides[42] = new Slide('../Christmas_and_cigars_files/1912c 4130.jpg', '417', '407', 'c1912  A sectarian season label was used by H.G. Barnhart, Springvale PA on this 10/5 made in Fact. 1825, 9th PA probably at the request of a wholesaler seeking exactly that.\n[4130]');
slides[43] = new Slide('../Christmas_and_cigars_files/xmas4174.jpg', '407', '494', 'c1900  Jewish immigrants played an important role\nin the industry, but few symbols appear on labels.\n[4174]');
slides[44] = new Slide('../Christmas_and_cigars_files/193- 4145.jpg', '570', '375', 'c1935  Very plain Christmas book made from redwood, used by F.S. Baer, Los Angeles. \nFact., 164, 6th Dist. CA. \n[4145]');
slides[45] = new Slide('../Christmas_and_cigars_files/1927 4126.jpg', '349', '570', '1927   Cardboard BN style with paper hinge made in Fact 305, 5th Kentucky for F.R. Rice Mercantile Co., a major St. Louis wholesale distributor retailer.\nDistinctive non-sectarian inexpensive package.\n[4126]');
slides[46] = new Slide('../Christmas_and_cigars_files/1940 4161.jpg', '383', '570', '1940  Replacing the top label makes for a simple relatively inexpensive holiday box. \n[4161]');
slides[47] = new Slide('../Christmas_and_cigars_files/1940 4162.jpg', '407', '549', '1940   Interior of previous box, with no \nholiday reference. \n[4162]');
slides[48] = new Slide('../Christmas_and_cigars_files/196- 0000.jpg', '345', '570', '1960’s  It became popular to ‘customize’ cigar boxes by Scotch© taping single sheets to the top, creating inexpensive Christmas, Father’s Day, etc. boxes. \n[0000]');
slides[49] = new Slide('../Christmas_and_cigars_files/195- 4164.jpg', '407', '564', '1950’s  Another simple expedient was to add a wax paper like holiday wrap over the box. \n[4164]');
slides[50] = new Slide('../Christmas_and_cigars_files/fulltwo7071.jpg', '407', '548', 'ANTONIO Y CLEOPATRA Clear Havanas made by American Tobacco.  This full sealed box of domestically made Havanas is for sale\nto help fund NCM projects. $400.\n[7071]');
slides[51] = new Slide('../Christmas_and_cigars_files/xmas4178.jpg', '407', '425', 'Lightweight cardboard sleeves to customize boxes were cheaper and faster than wrapping.\n[4178]');
slides[52] = new Slide('../Christmas_and_cigars_files/xmas4179.jpg', '448', '407', '[4179]');
slides[53] = new Slide('../Christmas_and_cigars_files/xmas4180.jpg', '410', '406', 'Gone are any suggestions of religion.\n[4180]');
slides[54] = new Slide('../Christmas_and_cigars_files/xmas4182.jpg', '407', '486', '[4182]');
slides[55] = new Slide('../Christmas_and_cigars_files/xmas4183.jpg', '421', '407', '[4183]');
slides[56] = new Slide('../Christmas_and_cigars_files/xmas4184.jpg', '432', '407', '[4184]');
slides[57] = new Slide('../Christmas_and_cigars_files/xmas4185.jpg', '570', '316', '[4185]');
slides[58] = new Slide('../Christmas_and_cigars_files/xmas4177.jpg', '407', '434', 'Other holidays can quickly replace\nChristmas with the slip of a sleeve.\nLook like your family on father’s day?\n[4177]');
slides[59] = new Slide('../Christmas_and_cigars_files/xmas4181.jpg', '435', '407', 'No clue what this sleeve celebrates.\n[4181]');
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");
    adjustLineHeightIfTooBig("id3");
    adjustFontSizeIfTooBig("id3");
    adjustLineHeightIfTooBig("id4");
    adjustFontSizeIfTooBig("id4");
    fixupAllIEPNGBGs();
    fixupIEPNG("id5", "Christmas_and_cigars_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;
    }
}

