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('../Photos_files/IMG_0289.jpg', '600', '800', 'Toledo Air');
slides[1] = new Slide('../Photos_files/IMG_0285.jpg', '600', '800', 'Storm Clouds');
slides[2] = new Slide('../Photos_files/IMG_0280.jpg', '600', '800', 'T-town Skyline');
slides[3] = new Slide('../Photos_files/DSCF1011.jpg', '600', '800', 'Football Field');
slides[4] = new Slide('../Photos_files/IMG_0019.jpg', '600', '800', 'First Snowfall 08');
slides[5] = new Slide('../Photos_files/P1020309.jpg', '600', '800', 'Stealth Bomber');
slides[6] = new Slide('../Photos_files/P1020312.jpg', '600', '800', 'Blimp it');
slides[7] = new Slide('../Photos_files/sportsarenawall.jpg', '600', '800', 'Sports Arena Ice');
slides[8] = new Slide('../Photos_files/deadleaves.jpg', '600', '800', 'Leaves');
slides[9] = new Slide('../Photos_files/sky1115.jpg', '600', '800', 'Beautiful Blue');
slides[10] = new Slide('../Photos_files/walbridgesky.jpg', '600', '800', 'Walbridge Sky');
slides[11] = new Slide('../Photos_files/goodsign.jpg', '378', '254', 'Reynold Rd.');
slides[12] = new Slide('../Photos_files/jeffswanton.jpg', '257', '500', 'Swanton Bomb');
slides[13] = new Slide('../Photos_files/5740_121931892305_601282305_2917669_2708483_n.jpg', '384', '480', 'Will Power?');
slides[14] = new Slide('../Photos_files/19d86fb4f0b4__1249510991000.jpg', '384', '480', 'Mommas Baby');
slides[15] = new Slide('../Photos_files/5740_121933497305_601282305_2917698_2686314_n.jpg', '604', '453', 'Red Head Randy');
slides[16] = new Slide('../Photos_files/n601282305_1897274_2375.jpg', '453', '604', 'Octo! Stanley Cup 08');
slides[17] = new Slide('../Photos_files/n601282305_1921778_4010.jpg', '453', '604', 'Igloo');
slides[18] = new Slide('../Photos_files/45a459a76223__1241807629000.jpg', '360', '480', 'Passed out');
slides[19] = new Slide('../Photos_files/23280020.jpg', '800', '531', 'Put em up');
slides[20] = new Slide('../Photos_files/DSCF0754.jpg', '600', '800', 'Heffran in PItt');
slides[21] = new Slide('../Photos_files/DSCF0248.jpg', '600', '800', 'Little Drummer Boy');
slides[22] = new Slide('../Photos_files/DSCF0923.jpg', '600', '800', 'Harry');
slides[23] = new Slide('../Photos_files/PICT6012.jpg', '480', '640', 'Rock on');
slides[24] = new Slide('../Photos_files/superseth.jpg', '600', '800', 'Super Seth');
slides[25] = new Slide('../Photos_files/000001.jpg', '311', '343', 'First Kickoff');
slides[26] = new Slide('../Photos_files/SDC10050.jpg', '600', '800', 'First kickoff');
slides[27] = new Slide('../Photos_files/23280016.jpg', '422', '400', 'Weding Bells');
slides[28] = new Slide('../Photos_files/DSCF0748.jpg', '600', '800', 'Holy Grail');
slides[29] = new Slide('../Photos_files/l_19b6724752367f2c9e342b21395257f0.jpg', '450', '600', 'Warrior Deep');
slides[30] = new Slide('../Photos_files/P8200129.jpg', '599', '800', 'Mosh Pit');
slides[31] = new Slide('../Photos_files/society2.jpg', '600', '800', 'The Society');
slides[32] = new Slide('../Photos_files/oo4.jpg', '600', '800', 'OnceOver Nate');
slides[33] = new Slide('../Photos_files/PA140211.jpg', '599', '800', 'Regiment Ryan');
slides[34] = new Slide('../Photos_files/oo8.jpg', '600', '800', 'OnceOver Dave');
slides[35] = new Slide('../Photos_files/P8200136.jpg', '599', '800', 'Axiomatic MT');
slides[36] = new Slide('../Photos_files/Picture14-021.jpg', '599', '800', 'mWo Staff');
slides[37] = new Slide('../Photos_files/WIOT-FM_32669_32.jpg', '337', '449', 'New Years Revolution 07 mWo/WIOT');
slides[38] = new Slide('../Photos_files/DSCF0206.jpg', '600', '800', 'HED PE');
isPureISOLatin1 = true;
contentEncodingConstant = 4;
feedbackURL = "TODO";
showFeedbackButton = false;
feedbackEnabled = true;

IMpreload('Photos_files', 'shapeimage_7', '0');
IMpreload('Photos_files', 'shapeimage_8', '0');
IMpreload('Photos_files', 'shapeimage_9', '0');
IMpreload('Photos_files', 'shapeimage_10', '0');
IMpreload('Photos_files', 'shapeimage_11', '0');
IMpreload('Photos_files', 'shapeimage_12', '0');
IMpreload('Photos_files', 'shapeimage_13', '0');
IMpreload('Photos_files', 'shapeimage_14', '0');
IMpreload('Photos_files', 'shapeimage_15', '0');
IMpreload('Photos_files', 'shapeimage_16', '0');
IMpreload('Photos_files', 'shapeimage_17', '0');
IMpreload('Photos_files', 'shapeimage_18', '0');
IMpreload('Photos_files', 'shapeimage_19', '0');
IMpreload('Photos_files', 'shapeimage_20', '0');
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;
}

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("id10");
    adjustFontSizeIfTooBig("id10");
    adjustLineHeightIfTooBig("id11");
    adjustFontSizeIfTooBig("id11");
    adjustLineHeightIfTooBig("id12");
    adjustFontSizeIfTooBig("id12");
    adjustLineHeightIfTooBig("id13");
    adjustFontSizeIfTooBig("id13");
    adjustLineHeightIfTooBig("id14");
    adjustFontSizeIfTooBig("id14");
    adjustLineHeightIfTooBig("id15");
    adjustFontSizeIfTooBig("id15");
    adjustLineHeightIfTooBig("id16");
    adjustFontSizeIfTooBig("id16");
    adjustLineHeightIfTooBig("id17");
    adjustFontSizeIfTooBig("id17");
    adjustLineHeightIfTooBig("id18");
    adjustFontSizeIfTooBig("id18");
    adjustLineHeightIfTooBig("id19");
    adjustFontSizeIfTooBig("id19");
    adjustLineHeightIfTooBig("id20");
    adjustFontSizeIfTooBig("id20");
    adjustLineHeightIfTooBig("id21");
    adjustFontSizeIfTooBig("id21");
    adjustLineHeightIfTooBig("id22");
    adjustFontSizeIfTooBig("id22");
    adjustLineHeightIfTooBig("id23");
    adjustFontSizeIfTooBig("id23");
    fixupIEPNG("id1", "Photos_files/transparent.gif");
    fixupIEPNG("id2", "Photos_files/transparent.gif");
    fixupIEPNG("id3", "Photos_files/transparent.gif");
    fixupIEPNG("id4", "Photos_files/transparent.gif");
    fixupIEPNG("id5", "Photos_files/transparent.gif");
    fixupIEPNG("id6", "Photos_files/transparent.gif");
    fixupIEPNG("id7", "Photos_files/transparent.gif");
    fixupIEPNG("id8", "Photos_files/transparent.gif");
    fixupIEPNG("id9", "Photos_files/transparent.gif");
    fixupIEPNG("shapeimage_7_link_0", "Photos_files/transparent.gif");
    fixupIEPNG("shapeimage_7", "Photos_files/transparent.gif");
    fixupIEPNG("shapeimage_8_link_0", "Photos_files/transparent.gif");
    fixupIEPNG("shapeimage_8", "Photos_files/transparent.gif");
    fixupIEPNG("shapeimage_9_link_0", "Photos_files/transparent.gif");
    fixupIEPNG("shapeimage_9", "Photos_files/transparent.gif");
    fixupIEPNG("shapeimage_10_link_0", "Photos_files/transparent.gif");
    fixupIEPNG("shapeimage_10", "Photos_files/transparent.gif");
    fixupIEPNG("shapeimage_11_link_0", "Photos_files/transparent.gif");
    fixupIEPNG("shapeimage_11", "Photos_files/transparent.gif");
    fixupIEPNG("shapeimage_12_link_0", "Photos_files/transparent.gif");
    fixupIEPNG("shapeimage_12", "Photos_files/transparent.gif");
    fixupIEPNG("shapeimage_13_link_0", "Photos_files/transparent.gif");
    fixupIEPNG("shapeimage_13", "Photos_files/transparent.gif");
    fixupIEPNG("shapeimage_14_link_0", "Photos_files/transparent.gif");
    fixupIEPNG("shapeimage_14", "Photos_files/transparent.gif");
    fixupIEPNG("shapeimage_15_link_0", "Photos_files/transparent.gif");
    fixupIEPNG("shapeimage_15", "Photos_files/transparent.gif");
    fixupIEPNG("shapeimage_16_link_0", "Photos_files/transparent.gif");
    fixupIEPNG("shapeimage_16", "Photos_files/transparent.gif");
    fixupIEPNG("shapeimage_17_link_0", "Photos_files/transparent.gif");
    fixupIEPNG("shapeimage_17", "Photos_files/transparent.gif");
    fixupIEPNG("shapeimage_18_link_0", "Photos_files/transparent.gif");
    fixupIEPNG("shapeimage_18", "Photos_files/transparent.gif");
    fixupIEPNG("shapeimage_19_link_0", "Photos_files/transparent.gif");
    fixupIEPNG("shapeimage_19", "Photos_files/transparent.gif");
    fixupIEPNG("shapeimage_20_link_0", "Photos_files/transparent.gif");
    fixupIEPNG("shapeimage_20", "Photos_files/transparent.gif");
    fixupIEPNG("id24", "Photos_files/transparent.gif");
    fixupIEPNG("id25", "Photos_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 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 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 IMmouseout(name, areaIndex)
{
    var linkName = name+'_link_'+areaIndex;
    var img  = document.getElementById(linkName);
    if (img)
    {
        img.src = self[linkName].src;
    }
    return true;
}

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

