IMpreload('contents_files', 'shapeimage_1', '0');
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('../contents_files/brainy_1-2,post,lightblue_30x36.jpg', '800', '640', 'brainy #1-2,post, light blue 30x36, 2010');
slides[1] = new Slide('../contents_files/lucky_1-2,generalmills,redorange_30x36.jpg', '800', '640', 'lucky #1-2, general mills, redorange 30x36, 2010');
slides[2] = new Slide('../contents_files/sonny1-3,generalmills,pink_30x36.jpg', '800', '640', 'sonny #1-3, general mills, pink 30x36, 2010');
slides[3] = new Slide('../contents_files/tony1-3,kellogs,darkblue_30x36.jpg', '800', '640', 'tony #1-3, kellogs, darkblue 30x36, 2010');
slides[4] = new Slide('../contents_files/stayscrunchycompilationIII.jpg', '800', '727', 'stays crunchy in milk\ncollection 30 x 36, 2010');
slides[5] = new Slide('../contents_files/mickey3-1,generalmills,black_30x40.jpg', '800', '640', 'mickey#3-1, general mills, black 30x40, 2010');
slides[6] = new Slide('../contents_files/mickey3-2,generalmills,pink_11x14.jpg', '800', '640', 'mickey #3-2, general mills, pink 11x14, 2010');
slides[7] = new Slide('../contents_files/brainy_1-3,post,black_16x20.jpg', '800', '640', 'brainy #1-3, post, black 16x20, 2010');
slides[8] = new Slide('../contents_files/mickey3-3,generalmills,black_9x12.jpg', '800', '640', 'mickey#3-3,general mills, black 9x12, 2010');
slides[9] = new Slide('../contents_files/sonny1-3,generalmills,black_11x14.jpg', '800', '640', 'sonny#1-3,general mills, black 11x14, 2010');
slides[10] = new Slide('../contents_files/tony1-4,kellogs,black_18x24.jpg', '800', '640', 'tony #1-4, kellogs, black 18x24, 2010');
slides[11] = new Slide('../contents_files/stays crunchy collection, black.jpg', '594', '800', 'stays crunchy collection-black\nmisc. sizes, 2010');
slides[12] = new Slide('../contents_files/sunrise_series_eggs_16x16.jpg', '800', '758', 'sunrise series, eggs, 2010\n 16x16');
slides[13] = new Slide('../contents_files/sunrise_series_guns_12x12.jpg', '800', '758', 'sunrise series, guns, 2010\n12x12');
slides[14] = new Slide('../contents_files/sunrise_series_longboards_40x40.jpg', '800', '743', 'sunrise series, longboards, 2010 \n40x40');
slides[15] = new Slide('../contents_files/sunrise_series_longboards&shortboards_12x12.jpg', '800', '758', 'sunrise series, longboards & shortboards, 2010\n12x12');
slides[16] = new Slide('../contents_files/sunrise_series_shortboards_24x24.jpg', '800', '758', 'sunrise series, shortboards, 2010\n24x24');
slides[17] = new Slide('../contents_files/sunrise_collection.jpg', '457', '801', 'sunrise series, 2010\n5 of 10 piece collection');
slides[18] = new Slide('../contents_files/I_need_more_of_you,No.jpg', '800', '751', 'I need more of you,\nNo.3. 36 X 36, 2010\nvarnished giclee print on stretched canvas');
slides[19] = new Slide('../contents_files/I\u0027m_lost_without_you,No.jpg', '800', '751', 'I\u0027m lost without you,\nNo.3. 36 X 36, 2010\nvarnished giclee print on stretched canvas');
slides[20] = new Slide('../contents_files/It\u0027s_not_you_it\u0027s_you,No.jpg', '800', '751', 'It\u0027s not you it\u0027s you,\nNo.3.. 36 X 36, 2010\nvarnished giclee print on stretched canvas');
slides[21] = new Slide('../contents_files/we\u0027re_going_nowhere,No.jpg', '800', '751', 'we\u0027re going nowhere,\nNo.3. 36 X 36, 2010\nvarnished giclee print on stretched canvas');
slides[22] = new Slide('../contents_files/why_all_the_negativity,No.jpg', '800', '751', 'why all the negativity,\nNo.3. 36 X 36, 2010\nvarnished giclee print on stretched canvas');
slides[23] = new Slide('../contents_files/wish_you_were_here,No.jpg', '800', '751', 'wish you were here,\nNo.3. 36 X 36, 2010\nvarnished giclee print on stretched canvas');
slides[24] = new Slide('../contents_files/wormholes collection 36x36.jpg', '593', '800', 'wormholes collection #3\n36x36, 2010\nvarnished giclee print on stretched canvas');
slides[25] = new Slide('../contents_files/I_need_more_of_you,No_1.jpg', '800', '747', 'I need more of you,\nNo.4. 10 X 10, 2010\nvarnished giclee print on stretched canvas');
slides[26] = new Slide('../contents_files/I\u0027m_lost_without_you,No_1.jpg', '800', '747', 'I\u0027m lost without you,\nNo.4. 10 X 10, 2010\nvarnished giclee print on stretched canvas');
slides[27] = new Slide('../contents_files/it\u0027s_not_you_it\u0027s_you,No_1.jpg', '800', '747', 'it\u0027s not you it\u0027s you,\nNo.4. 10 X 10, 2010\nvarnished giclee print on stretched canvas');
slides[28] = new Slide('../contents_files/we\u0027re_going_nowhere,No_1.jpg', '800', '747', 'we\u0027re going nowhere,\nNo.4. 10 X 10, 2010\nvarnished giclee print on stretched canvas');
slides[29] = new Slide('../contents_files/why_all_the_negativity,No_1.jpg', '800', '747', 'why all the negativity,\nNo.4. 10 X 10, 2010\nvarnished giclee print on stretched canvas');
slides[30] = new Slide('../contents_files/wish_you_were_here,No_1.jpg', '800', '747', 'wish you were here,\nNo.4. 10 X 10, 2010\nvarnished giclee print on stretched canvas');
slides[31] = new Slide('../contents_files/wormholes collection 4 10x10.jpg', '800', '594', 'wormholes collection #4\n10x10, 2010\n');
slides[32] = new Slide('../contents_files/tomahawks,rayguns,and_the_west_coast_offense.jpg', '800', '638', 'tomahawks,rayguns, and the west\ncoast offense, 2009\nplastic figurines, acrylic & resin on wood\n16.25 x 12.5');
slides[33] = new Slide('../contents_files/IMG_3576.jpg', '800', '600', 'tomahawks,rayguns, and the west\ncoast offense, 2009 (detail)\nplastic figurines, acrylic & resin on wood\n16.25 x 12.5');
slides[34] = new Slide('../contents_files/IMG_3561.jpg', '600', '800', 'tomahawks,rayguns, and the west\ncoast offense, 2009 (detail)\nplastic figurines, acrylic & resin on wood\n16.25 x 12.5');
slides[35] = new Slide('../contents_files/IMG_3531.jpg', '536', '800', 'tomahawks,rayguns, and the west\ncoast offense, 2009 (detail)\nplastic figurines, acrylic & resin on wood\n16.25 x 12.5');
slides[36] = new Slide('../contents_files/IMG_3570.jpg', '801', '549', 'tomahawks,rayguns, and the west\ncoast offense, 2009 (detail)\nplastic figurines, acrylic & resin on wood\n16.25 x 12.5');
slides[37] = new Slide('../contents_files/IMG_3533.jpg', '559', '800', 'tomahawks,rayguns, and the west\ncoast offense, 2009 (detail)\nplastic figurines, acrylic & resin on wood\n16.25 x 12.5');
slides[38] = new Slide('../contents_files/field_of_blue_soldiers_(he_hit_me_first).jpg', '800', '640', 'field of blue soldiers (he hit me first), 2009\n15.625 x 12.25\nplastic figurines, acrylic & resin on wood\n');
slides[39] = new Slide('../contents_files/IMG_3644.jpg', '800', '690', 'field of blue soldiers (he hit me first), 2009\n15.625 x 12.25\nplastic figurines, acrylic & resin on wood\n');
slides[40] = new Slide('../contents_files/IMG_3647.jpg', '554', '800', 'field of blue soldiers (he hit me first), 2009\n(detail) 15.625 x 12.25\nplastic figurines, acrylic & resin on wood\n');
slides[41] = new Slide('../contents_files/IMG_3650.jpg', '600', '800', 'field of blue soldiers (he hit me first), 2009\n(detail) 15.625 x 12.25\nplastic figurines, acrylic & resin on wood\n');
isPureISOLatin1 = true;
contentEncodingConstant = 4;
feedbackURL = "TODO";
showFeedbackButton = false;
feedbackEnabled = true;

IMpreload('contents_files', 'shapeimage_14', '0');
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 getChildOfType(oParent, sNodeName, requestedIndex)
{
    var childrenOfType = oParent.getElementsByTagName(sNodeName);
    return (requestedIndex < childrenOfType.length) ?
           childrenOfType.item(requestedIndex) : null;
}

function onPageLoad()
{
    detectBrowser();
    adjustLineHeightIfTooBig("id1");
    adjustFontSizeIfTooBig("id1");
    adjustLineHeightIfTooBig("id3");
    adjustFontSizeIfTooBig("id3");
    adjustLineHeightIfTooBig("id16");
    adjustFontSizeIfTooBig("id16");
    fixupIEPNG("shapeimage_1_link_0", "contents_files/transparent.gif");
    fixupIEPNG("shapeimage_1", "contents_files/transparent.gif");
    fixupIEPNG("id2", "contents_files/transparent.gif");
    fixupIEPNG("id4", "contents_files/transparent.gif");
    fixupIEPNG("id5", "contents_files/transparent.gif");
    fixupIEPNG("id6", "contents_files/transparent.gif");
    fixupIEPNG("id7", "contents_files/transparent.gif");
    fixupIEPNG("id8", "contents_files/transparent.gif");
    fixupIEPNG("id9", "contents_files/transparent.gif");
    fixupIEPNG("id10", "contents_files/transparent.gif");
    fixupIEPNG("id11", "contents_files/transparent.gif");
    fixupIEPNG("id12", "contents_files/transparent.gif");
    fixupIEPNG("id13", "contents_files/transparent.gif");
    fixupIEPNG("id14", "contents_files/transparent.gif");
    fixupIEPNG("id15", "contents_files/transparent.gif");
    fixupIEPNG("shapeimage_14_link_0", "contents_files/transparent.gif");
    fixupIEPNG("shapeimage_14", "contents_files/transparent.gif");
    fixupIEPNG("id17", "contents_files/transparent.gif");
    return true;
}

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 IMpreload(path, name, areaIndex)
{
    var rolloverName = name+'_rollover_'+areaIndex;
    var rolloverPath = path+'/'+rolloverName+'.png';
    self[rolloverName] = new Image();
    self[rolloverName].src = rolloverPath;

    var linkName = name+'_link_'+areaIndex;
    var linkPath = path+'/'+linkName+'.png';
    self[linkName] = new Image();
    self[linkName].src = linkPath;
    return true;
}

function IMmouseover(name, areaIndex)
{
    var rolloverName = name+'_rollover_'+areaIndex;
    var linkName = name+'_link_'+areaIndex;
    var img  = document.getElementById(linkName);
    if (img)
    {
        img.src = self[rolloverName].src;
    }
    return true;
}

function IMmouseout(name, areaIndex)
{
    var linkName = name+'_link_'+areaIndex;
    var img  = document.getElementById(linkName);
    if (img)
    {
        img.src = self[linkName].src;
    }
    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;
    }
}

