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('../Sculpture_files/Custom-Portrait-Bust-gag-gift.jpg', '600', '800', 'Classical style sculpture created for a CEO who requested busts of himself as a devil for his annual holiday gag-gift.');
slides[1] = new Slide('../Sculpture_files/Leeweb.jpg', '552', '800', 'Likeness bust of a young Christopher Lee. Sculpted and finished to be part of a client\u0027s wax museum-style statue.');
slides[2] = new Slide('../Sculpture_files/Mummy-Portrait-Sculpture-Bust.jpg', '637', '800', 'Our portrait bust of Lon Chaney Jr. as the Mummy, created for a lifesized display at Monsterpalooza');
slides[3] = new Slide('../Sculpture_files/Mummy-Fullsize-Statue.jpg', '537', '800', 'A look at the Mummy of Monsterpalooza featuring the head created by Tom Spina and a body built by Kelly Delcambre');
slides[4] = new Slide('../Sculpture_files/HyenaWEB.jpg', '621', '800', '"the Hyena", a character from the comic "The Were" brought to life in 3-D form as a trade show piece.');
slides[5] = new Slide('../Sculpture_files/Tom-Hyena-web.jpg', '713', '800', 'Artist Tom Spina poses with the finished piece');
slides[6] = new Slide('../Sculpture_files/BartenderWEB.jpg', '535', '800', 'A great example of our realistic sculpting, hair and paint work for likeness busts (recent personal project)');
slides[7] = new Slide('../Sculpture_files/CushingBaronweb.jpg', '581', '800', 'Peter Cushing, a tribute display bust.  An early custom likeness sculpture');
slides[8] = new Slide('../Sculpture_files/CushingPrisoner8.jpg', '659', '800', 'An example of a different finish on the same sculpt... this time as a tormented prisoner!');
slides[9] = new Slide('../Sculpture_files/wolfheadWEB1.jpg', '460', '800', 'the head sculpture for our life-sized werewolf, now available in the shop as a limited edition statue.');
slides[10] = new Slide('../Sculpture_files/wolffull2.jpg', '705', '800', 'The finished full-size brown werewolf sculpture by Tom Spina & Richard Riley');
slides[11] = new Slide('../Sculpture_files/PaleMoon-lifesize-werewolf-statue-comp.jpg', '800', '800', '"Pale Moon" a shock-white version of our custom werewolf statue by Tom Spina & Richard Riley');
slides[12] = new Slide('../Sculpture_files/wolfhandWEB.jpg', '565', '800', 'one of the custom sculpted oversized hands for the werewolf project.');
slides[13] = new Slide('../Sculpture_files/FRONKONSTEEN.jpg', '552', '800', '“Fronkonsteen”\na custom sculpture in black and white - tribute bust (personal project by Tom)');
slides[14] = new Slide('../Sculpture_files/HammerSculptWeb.jpg', '606', '800', 'head sculpt created to complete the display of a screen used costume from the movie 13 Ghosts');
slides[15] = new Slide('../Sculpture_files/13Ghosts-child-portrait-sculpture-bust.jpg', '700', '800', 'Portrait sculpture, created to enhance the display of 13 Ghosts wardrobe. Visit our DISPLAYS page for more info and photos!');
slides[16] = new Slide('../Sculpture_files/Davidweb.jpg', '763', '800', '“David’s Nightmare”\nA display bust with custom glass eyes and wig (personal project by Tom)');
slides[17] = new Slide('../Sculpture_files/DjasPuhrWeb.jpg', '609', '800', 'A somewhat 50\u0027s looking alien based on an old Rick Baker design. Custom sculpted display mask. (personal project)');
slides[18] = new Slide('../Sculpture_files/DSC05483.jpg', '600', '800', 'A pair of personal projects, custom sculpted latex display busts with realistic hair and paint');
slides[19] = new Slide('../Sculpture_files/WampaPuppetCompile.jpg', '720', '576', 'Latex snow creature puppet - 15” tall bust with glass eyes & realistic ice weathering. A personal project from the 90\u0027s');
slides[20] = new Slide('../Sculpture_files/treeWEB.jpg', '700', '799', 'The 22” tall sculpt and our original designs for a Puppet Tree face created for the show, “Kid Fitness”');
slides[21] = new Slide('../Sculpture_files/treeOnSet1.jpg', '534', '800', 'Installed and in action on set with cameras rolling!\u2028The puppet featured moving mouth and eyes');
slides[22] = new Slide('../Sculpture_files/Sh! cameleon.jpg', '720', '576', '“Pete Chameleon” a different kind of custom sculpture: a patterned foam puppet');
slides[23] = new Slide('../Sculpture_files/minitor1.jpg', '567', '800', 'Minotaur display for a mythology museum. A LARGE SCALE custom sculpted character');
slides[24] = new Slide('../Sculpture_files/minitor2.jpg', '543', '788', 'Richard Riley steps in the shot for some scale and a closer look at the details of his incredible custom work of art');
slides[25] = new Slide('../Sculpture_files/Trex4web.jpg', '422', '800', '5 foot long T-Rex head custom fabricated for a haunted attraction.  Visit “the Lab” this halloween!  www.theLabHaunt.com');
slides[26] = new Slide('../Sculpture_files/harpy3.jpg', '645', '477', 'Dynamically posed Harpy. Large scale art, created for a mythology museum. Features hundreds of feathers');
slides[27] = new Slide('../Sculpture_files/Pegasus3.jpg', '621', '800', 'Another mythology project... this time featuring nearly 2000 hand-laid feathers! ');
slides[28] = new Slide('../Sculpture_files/spider2.jpg', '519', '720', 'And a giant custom sculpted spider about to eat one of our artists!  (look out Richard!)');
slides[29] = new Slide('../Sculpture_files/hammer.jpg', '451', '800', 'Spider swatter?  A giant hammer, custom fabricated by Richard.');
slides[30] = new Slide('../Sculpture_files/headlessonhorse.jpg', '800', '407', 'Headless Horseman static display. Now available in the SHOP\ncustom versions available');
slides[31] = new Slide('../Sculpture_files/InfinityAlien1.jpg', '444', '720', 'Infinity Illusion! Great for haunts & museums. We can do this with Aliens, animals, zombies, mummies and more!');
slides[32] = new Slide('../Sculpture_files/obelisk3.jpg', '527', '633', 'We can custom create faux gravestones, markers & monuments.  This one\u0027s been finished to look like real stone');
slides[33] = new Slide('../Sculpture_files/Cemetery-arch-foam-sculpt-web.jpg', '562', '800', 'A huge foam sculpture!  11 foot tall cemetery gate sculpt in a faux stone finish.  An incredible Halloween display!');
slides[34] = new Slide('../Sculpture_files/RobotMannequins.jpg', '611', '800', 'Alien Robots took over a mannequin factory! Original art by Richard for a Lowry Park Zoo Halloween Attraction');
slides[35] = new Slide('../Sculpture_files/Logo-faux-stone-Wall-Plaque-carved-stryofoam-fiberglass4.jpg', '618', '770', 'have your logo "carved in stone" with one of our custom faux stone plaques now available in our SHOP  ');
slides[36] = new Slide('../Sculpture_files/Logo-wall-plaque-carved-styrofoam-fiberglass2.jpg', '512', '800', 'Another custom EPS logo plaque - sample only, not for sale... but we can do your logo for your office, home theater or shop!');
slides[37] = new Slide('../Sculpture_files/Logo-faux-stone-Wall-Plaque-carved-stryofoam-fiberglass1.jpg', '743', '792', 'Another example of a large faux-stone plaque. Great for haunted or pirate themes, home offices, shops and more');
slides[38] = new Slide('../Sculpture_files/Ymir16web.jpg', '720', '800', 'A classic creature custom sculpture by Richard. Over six feet tall!!');
slides[39] = new Slide('../Sculpture_files/Custom-snow-Creature-foam-sculpture.jpg', '638', '800', 'A personal project...\nthis piece of custom sculpture shows the great level of detail that can be achieved!');
slides[40] = new Slide('../Sculpture_files/band.jpg', '543', '720', 'And the band played on!  A trio of custom sculptures by Richard as a personal project');
slides[41] = new Slide('../Sculpture_files/Lifesized-carved-Styrofoam-Sculpture-theme-prop-Jabba.jpg', '695', '783', 'Rich with one of his first large scale custom sculptures! (personal project)');
isPureISOLatin1 = true;
contentEncodingConstant = 4;
feedbackURL = "TODO";
showFeedbackButton = false;
feedbackEnabled = 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;
    }
}

function onPageLoad()
{
    detectBrowser();
    adjustLineHeightIfTooBig("id3");
    adjustFontSizeIfTooBig("id3");
    adjustLineHeightIfTooBig("id4");
    adjustFontSizeIfTooBig("id4");
    adjustLineHeightIfTooBig("id5");
    adjustFontSizeIfTooBig("id5");
    adjustLineHeightIfTooBig("id7");
    adjustFontSizeIfTooBig("id7");
    adjustLineHeightIfTooBig("id8");
    adjustFontSizeIfTooBig("id8");
    adjustLineHeightIfTooBig("id9");
    adjustFontSizeIfTooBig("id9");
    adjustLineHeightIfTooBig("id10");
    adjustFontSizeIfTooBig("id10");
    adjustLineHeightIfTooBig("id12");
    adjustFontSizeIfTooBig("id12");
    adjustLineHeightIfTooBig("id16");
    adjustFontSizeIfTooBig("id16");
    adjustLineHeightIfTooBig("id17");
    adjustFontSizeIfTooBig("id17");
    adjustLineHeightIfTooBig("id18");
    adjustFontSizeIfTooBig("id18");
    adjustLineHeightIfTooBig("id19");
    adjustFontSizeIfTooBig("id19");
    adjustLineHeightIfTooBig("id20");
    adjustFontSizeIfTooBig("id20");
    adjustLineHeightIfTooBig("id22");
    adjustFontSizeIfTooBig("id22");
    adjustLineHeightIfTooBig("id23");
    adjustFontSizeIfTooBig("id23");
    adjustLineHeightIfTooBig("id25");
    adjustFontSizeIfTooBig("id25");
    adjustLineHeightIfTooBig("id27");
    adjustFontSizeIfTooBig("id27");
    adjustLineHeightIfTooBig("id29");
    adjustFontSizeIfTooBig("id29");
    adjustLineHeightIfTooBig("id30");
    adjustFontSizeIfTooBig("id30");
    adjustLineHeightIfTooBig("id31");
    adjustFontSizeIfTooBig("id31");
    adjustLineHeightIfTooBig("id32");
    adjustFontSizeIfTooBig("id32");
    adjustLineHeightIfTooBig("id34");
    adjustFontSizeIfTooBig("id34");
    adjustLineHeightIfTooBig("id35");
    adjustFontSizeIfTooBig("id35");
    fixupIEPNG("id1", "Sculpture_files/transparent.gif");
    fixupIEPNG("id2", "Sculpture_files/transparent.gif");
    fixupAllIEPNGBGs();
    fixupIEPNG("id6", "Sculpture_files/transparent.gif");
    fixupIEPNG("id11", "Sculpture_files/transparent.gif");
    fixupIEPNG("id13", "Sculpture_files/transparent.gif");
    fixupIEPNG("id14", "Sculpture_files/transparent.gif");
    fixupIEPNG("id15", "Sculpture_files/transparent.gif");
    fixupIEPNG("id21", "Sculpture_files/transparent.gif");
    fixupIEPNG("id24", "Sculpture_files/transparent.gif");
    fixupIEPNG("id26", "Sculpture_files/transparent.gif");
    fixupIEPNG("id28", "Sculpture_files/transparent.gif");
    fixupIEPNG("id33", "Sculpture_files/transparent.gif");
    return 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;
    }
}

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;
}

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;
                    }
                }
            }
        }
    }
}

function getChildOfType(oParent, sNodeName, requestedIndex)
{
    var childrenOfType = oParent.getElementsByTagName(sNodeName);
    return (requestedIndex < childrenOfType.length) ?
           childrenOfType.item(requestedIndex) : null;
}

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)
        {
        }
    }
}

