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('../Horseracing_files/eb0884.jpg', '507', '570', 'Early 1880’s box featuring a quartet of champions, Iroquois and Foxhall from the world of thoroughbreds and sulky horses St. Julien and Maud S.  Cigars by Straiton & Storm, Fact. 13, 3rd Dist NYC.  [0884]');
slides[1] = new Slide('../Horseracing_files/ec0717.jpg', '476', '600', 'Made in PA for a Sioux City, Iowa, distributor, the brand features six prize horses: Alix, Robert J, Imp, Flying Jib, Star Pointer, and Salvator. File card with\nfurther data missing.\n[0717]');
slides[2] = new Slide('../Horseracing_files/horserace18.jpg', '497', '600', 'Hambletonian features the most important race for sulky drivers, but no named horses. Cigars made in Fact. 15, 3rd Mass. for R.N. Messer of West Andover, NH around 1903. \n[0718]');
slides[3] = new Slide('../Horseracing_files/ne0703.jpg', '366', '600', 'Generic horse racing label from early 1880’s, Name refers to horse and cigar as being leaders, a phrase in the cigar world meaning a big seller. \nCatalog card missing.\n[0703]');
slides[4] = new Slide('../Horseracing_files/nb5577.jpg', '487', '600', 'Generic horse racing label. A dark horse is one given little chance to win, but sometimes does.\nFact. 97, 26th Dist. NY, 1881.\n[5577]');
slides[5] = new Slide('../Horseracing_files/cf0702.jpg', '315', '600', 'Wasn’t able to trace Great Tom as a horse but  the cigars were made in the 500 roller factory of the Levy Brothers at 13th and Ave. C in NYC\nin the early 1880’s.\n[0702]');
slides[6] = new Slide('../Horseracing_files/birds5573.jpg', '507', '599', 'TEN BROECK was an important 1870’s champion, winner of 5 of his 8 races at age 3 and 4 of 5 a year later. Called “last of the great four milers” as races were often much longer than today. b1872-d1887. Unusually fancy box for 1876.  [5573]');
slides[7] = new Slide('../Horseracing_files/birds5574.jpg', '389', '600', 'TEN BROECK box interior (he’s the dark colored horse at right). Cigar price “1 for 5¢” penciled upside down below label. Cigars by Krohn Feiss & Co., Fact. 14, 1st Dist. Ohio.\n[5574]');
slides[8] = new Slide('../Horseracing_files/cc8389.jpg', '348', '600', 'California champion in the 1870’s owned by P. Lorillard of tobacco fame and named after one of his brands of chewing tobacco. Famous stakes race in which he beat five year old TEN BROECK, the latter’s only loss in 10 races that year. [8389]');
slides[9] = new Slide('../Horseracing_files/cc8388.jpg', '347', '600', 'Unusually detailed NWH style cigar box registered in 1879 not long after his stakes race against the Eastern wonder horse. Both PAROLE and TEN BROECK  are in the racing Hall of Fame.\n[8388]');
slides[10] = new Slide('../Horseracing_files/ce0714.jpg', '348', '600', 'Harris label from 1880’s pictures horse in exaggerated stride. Name is letterpressed on a stock label that could represent any horse. Who was Shenandoah? ¿Quien sabe? Cigars made in Fact. 110, 6th District of Virginia.  [0714]');
slides[11] = new Slide('../Horseracing_files/cd0719.jpg', '444', '600', 'Winner of various European stakes races in the 1870’s, plus two places and a show in the three most important meets. Fact. 415 2nd Dist CT. Unusual NWH box with a full size BW label.\n[0719]');
slides[12] = new Slide('../Horseracing_files/ce0716.jpg', '507', '566', 'American horse racing in Europe to enormous success in 1880’s including Ascot Gold Cup. Only American horse to ever win Grand Prix de Paris.\nNamed after the owner’s son, Foxhall Keene. \nBondy & Lederer, Fact. 294, 3rd NYC.  [0716]');
slides[13] = new Slide('../Horseracing_files/dc0706.jpg', '363', '600', 'Born 1869; discovered pulling a milk wagon, bought for $600. At age 7 won all six races; world record holder at 11.  Cigars by R.N. Ewell, whose 125 rollers made it KY’s largest factory. Fact. 341, \n5th District, Louisville. [0706]');
slides[14] = new Slide('../Horseracing_files/dc0704.jpg', '365', '600', 'Born 1874, MAUD S was once the world’s fastest harness horse, known as “Queen of the Turf.” Sold as 4 year old for $21,000 to William Vanderbilt who used her as a road horse. In 1884 she resumed racing, lowering the record once again. [0704]');
slides[15] = new Slide('../Horseracing_files/dc0705.jpg', '378', '600', 'Maud as celebrity spokes-animal: “More Horses are ruined by the use of cheap cut nails, than by hard driving. The best horsemen the world over use only The Putnam Hot-Forged and Hammer-Pointed Nail.”  [0705]');
slides[16] = new Slide('../Horseracing_files/gg0709.jpg', '451', '600', 'Born in 1896, in ten years this famous pacer never lost a race. Many tracks wouldn’t accept bets on him. Ultimately set records in every class and distance. Raced mostly exhibitions because \nhorses wouldn’t run against him.  [0709]');
slides[17] = new Slide('../Horseracing_files/gj0715.jpg', '507', '524', 'Some enterprising cheat pasted the name DAN PATCH on a SAN ARDO box in an effort to boost popularity and sales. It wasn’t until the 1980’s that horses ran as fast so Dan Patch was still well known. Fact. 47 Wisconsin, 1944. [0715]');
slides[18] = new Slide('../Horseracing_files/kc0722.jpg', '455', '600', 'Local horses that won races frequently ended up\non cigar boxes. C.W. Rose in Mason, Michigan\nFact. 453, 1st Dist. Michigan, made these  c.1903.\nVanity (photographic) labels were easily made.\n[0722]');
slides[19] = new Slide('../Horseracing_files/ke0724.jpg', '484', '600', 'S.C. Chambers of Chambers and Owen, a retail outlet in Milton Junction, Wisconsin, was proud of his horse and ordered a vanity (photographic) label in his honor. Cigars made in Fact. 954, 1st Mich.\n[0724]');
slides[20] = new Slide('../Horseracing_files/kg0725.jpg', '443', '600', 'This cigar brand picturing a harness horse was registered to Jacob Vanden Berg, owner of Fact. 168, 4th Mich in Grand Rapids in 1900. Whose horse or what she did is unknown to me.\n[0725]');
slides[21] = new Slide('../Horseracing_files/kj0707.jpg', '414', '600', '“One of the most noted of pacing mares” driven by Ed Abrams d1938 “one of the coolest and most calculating drivers.” The horse’s record is one full second faster than what’s on the label. Unlisted\ncigar maker Fact. 58 Michigan. 1945.  [0707]');
slides[22] = new Slide('../Horseracing_files/gk0708.jpg', '399', '600', 'I’ve found roads, towns and schools named Hazel Patch but no record of her record. Cigars made by Oscar Leistikon, Fact. 719, 2nd Milwaukee, WI\nin the 1920’s \n[0708]');
slides[23] = new Slide('../Horseracing_files/hg0720.jpg', '464', '600', 'In 1934, the year of this box, COLD CASH was the “world champion two year old pacer” and a decade later still held the record for a 3-heat race. Unknown cigar maker for distributor Niles & Moser.\n[0720]');
slides[24] = new Slide('../Horseracing_files/fc4680.jpg', '507', '543', 'California born in 1883, harness horse ALCAZAR became one of the two best known cigar label horses, appearing for half a century. Rarely found with its beautiful flap intact. Louis Kindling of Milwaukee, Fact 653, 1st WI made cigars. [4680]');
slides[25] = new Slide('../Horseracing_files/fd0710.jpg', '446', '600', 'In 1885, San Gabriel trained ALCAZAR became the 1st two year old to hold the record. Early versions of horse labels include their record. As their times get eclipsed, the records tend to get dropped. Alcazar’s remain for the duration.  [0710]');
slides[26] = new Slide('../Horseracing_files/fe0711.jpg', '427', '600', 'The 1934 version has an NRA sticker and shows\nthe early 30’s price drop. Now made by Jos. Kerns’ Quality Cigar Co. Fact. 505 Milwaukee, Wisconsin.\n[0711]');
slides[27] = new Slide('../Horseracing_files/ff0712.jpg', '448', '600', 'Late 30’s version. Note the changes in color of the title. There is a later cardboard version (not pictured) made in the 1950’s in Fact. 237 1st Pennsylvania by Schwartz Bros. \n[0712]');
slides[28] = new Slide('../Horseracing_files/jd0726.jpg', '468', '600', 'Winner of a handful of races, the horse was named THE HARVESTER tho cigar smokers usually drop the first word. His half mile record set in 1925 still stood in 1944. Catalog card missing.\n[0726]');
slides[29] = new Slide('../Horseracing_files/jf0727.jpg', '446', '600', 'In 1933, the price, like that of many other brands, was cut in half. Banners touted the drop. The NRA sticker identifies it as 1934. \n[0727]');
slides[30] = new Slide('../Horseracing_files/jm0728.jpg', '446', '600', 'By the late 1930’s his record was gone as was “The” in his name. Price adjustments during WWII would raise the price back to a dime. \n[0728]');
slides[31] = new Slide('../Horseracing_files/jq0729.jpg', '434', '600', 'Price reduced from a dime in the late 1940’s. Brand now made by Consolidated Cigar Corp, in Lancaster\nPennsylvania. Brand continues into the 1960’s and 70’s with totally redesigned boxes.\n[0729]');
slides[32] = new Slide('../Horseracing_files/hc0721.jpg', '409', '600', 'Champion trotter of the early 1920’s. \nCigars probably made by William Muehlhauser in Fact. 1739, 1st Quakertown PA.\n[0721]');
slides[33] = new Slide('../Horseracing_files/he0713.jpg', '406', '600', 'Later version of the label doesn’t include record.\n[0713]');
slides[34] = new Slide('../Horseracing_files/km0730.jpg', '422', '600', 'The horse on this 1912 vanity box was called “the guideless wonder” with a 2:10 record. Cigars by Barnes, Smith & Co Fact. 1239, 21st Dist. NY, Binghamton. Distributed by G.W. Croucher.  \n[0730]');
slides[35] = new Slide('../Horseracing_files/km0731.jpg', '422', '600', 'Later version which is available on loose labels but rarely found on boxes.\n[0731]');
slides[36] = new Slide('../Horseracing_files/nk0732.jpg', '491', '600', 'Red Lion’s Neff & Co., Fact 533, made the cigars \nfilling this distinctive horse racing box in 1941.\n[0732]');
slides[37] = new Slide('../Horseracing_files/nl0733.jpg', '490', '600', 'Canada’s best known box with a horse racing theme. From the 1950’s. \n[0733]');
slides[38] = new Slide('../Horseracing_files/np0734.jpg', '600', '498', 'By the early 1960’s label design had been simplified but horse racing remained an advertising theme.\nInexpensive cigarillo type cigars were very popular in the 1950’s and 60’s. \n[0734]');
slides[39] = new Slide('../Horseracing_files/sports30.jpg', '560', '800', 'An early form of harness racing made its way\nto cigar boxes in the 1880’s. Cigars by J.D. Morris Sharpsburg in Fact. 42, 23rd PA.\n[0830]');
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", "Horseracing_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;
    }
}


