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('../Scrapbook_files/CIMG2487.jpg', '600', '800', 'Coffee and Compost with Becky Bartovics');
slides[1] = new Slide('../Scrapbook_files/CIMG2493.jpg', '800', '600', 'Coffee and Compost in the Red Barn');
slides[2] = new Slide('../Scrapbook_files/CIMG2505.jpg', '600', '800', 'Christie Hallowell teaching Kindermusik');
slides[3] = new Slide('../Scrapbook_files/102_1499.jpg', '603', '800', 'Photo Camp with Jon Bailey');
slides[4] = new Slide('../Scrapbook_files/101_1503.jpg', '603', '800', 'Berit Strong classical guitar performance');
slides[5] = new Slide('../Scrapbook_files/101_1514.jpg', '603', '800', 'Coffee and Compost with Margot Woodworth');
slides[6] = new Slide('../Scrapbook_files/101_1525.jpg', '603', '800', 'Dutch Soccer Academy');
slides[7] = new Slide('../Scrapbook_files/101_0927.jpg', '603', '800', 'Senior Coffee');
slides[8] = new Slide('../Scrapbook_files/101_0935.jpg', '603', '800', 'The Centre Streeters');
slides[9] = new Slide('../Scrapbook_files/101_0942.jpg', '800', '603', 'Boondock Blues Band 4th of July Concert');
slides[10] = new Slide('../Scrapbook_files/101_0945.jpg', '800', '603', 'Boondock Blues Band');
slides[11] = new Slide('../Scrapbook_files/101_0949.jpg', '603', '800', '4th of July Concert');
slides[12] = new Slide('../Scrapbook_files/101_1037.jpg', '800', '603', 'Chase Brock Experience rehearsal');
slides[13] = new Slide('../Scrapbook_files/101_1045.jpg', '603', '800', 'Chase Brock Experience');
slides[14] = new Slide('../Scrapbook_files/101_1049.jpg', '603', '800', 'Chase Brock Experience');
slides[15] = new Slide('../Scrapbook_files/101_1062.jpg', '603', '800', 'Chase Brock Experience');
slides[16] = new Slide('../Scrapbook_files/101_1073.jpg', '603', '800', 'Chase Brock Experience');
slides[17] = new Slide('../Scrapbook_files/101_1082.jpg', '603', '800', 'Chase Brock Experience');
slides[18] = new Slide('../Scrapbook_files/101_1100.jpg', '603', '800', 'Chase Brock teaching a dance class');
slides[19] = new Slide('../Scrapbook_files/101_1117.jpg', '603', '800', 'Chase Brock dance class');
slides[20] = new Slide('../Scrapbook_files/101_1137.jpg', '603', '800', 'Chase Brock Experience');
slides[21] = new Slide('../Scrapbook_files/101_1159.jpg', '603', '800', 'Ashley teaching dance');
slides[22] = new Slide('../Scrapbook_files/101_1180.jpg', '603', '800', 'Celebrating Chase Brock');
slides[23] = new Slide('../Scrapbook_files/101_1182.jpg', '603', '800', 'Chase Brock Reception');
slides[24] = new Slide('../Scrapbook_files/101_1200.jpg', '603', '800', 'Chase Brock Reception');
slides[25] = new Slide('../Scrapbook_files/101_1202.jpg', '603', '800', 'Chase Brock dancers after opening night performance');
slides[26] = new Slide('../Scrapbook_files/101_1204.jpg', '800', '603', 'John Wulp and Chase Brock');
slides[27] = new Slide('../Scrapbook_files/101_1208.jpg', '800', '603', 'Chase Brock Merchandise');
slides[28] = new Slide('../Scrapbook_files/101_1225.jpg', '603', '800', 'Fisheries Talk with Hannah Pingree');
slides[29] = new Slide('../Scrapbook_files/101_1227.jpg', '603', '800', 'Theater Camp with Courtney Naliboff');
slides[30] = new Slide('../Scrapbook_files/101_1228.jpg', '603', '800', 'Theater Camp with Courtney Naliboff');
slides[31] = new Slide('../Scrapbook_files/100_5800.jpg', '600', '800', 'Theater Camp Production of Alice in Wonderland');
slides[32] = new Slide('../Scrapbook_files/100_5801.jpg', '600', '800', 'Theater Camp Production of Alice in Wonderland');
slides[33] = new Slide('../Scrapbook_files/101_1258.jpg', '603', '800', 'The Red Barn');
slides[34] = new Slide('../Scrapbook_files/101_0221.jpg', '600', '800', 'Betsy Sweet one woman comedy show');
slides[35] = new Slide('../Scrapbook_files/101_0223.jpg', '600', '800', 'Swim Camp');
slides[36] = new Slide('../Scrapbook_files/101_0216.jpg', '600', '800', 'Kelly Thorndike teaching En Plein Air Adult workshop');
slides[37] = new Slide('../Scrapbook_files/100_1192.jpg', '600', '800', 'Photo Camp with Jon Bailey');
slides[38] = new Slide('../Scrapbook_files/100_1188.jpg', '533', '800', 'Photo Camp with Jon Bailey');
slides[39] = new Slide('../Scrapbook_files/100_5749.jpg', '600', '800', 'Amanda Thorndike at School of Fish');
slides[40] = new Slide('../Scrapbook_files/100_5750.jpg', '800', '600', 'Bailey Cabot at School of Fish');
slides[41] = new Slide('../Scrapbook_files/100_5757.jpg', '800', '600', 'Bret Waterman');
slides[42] = new Slide('../Scrapbook_files/100_5772.jpg', '600', '800', 'Cindy Bullens Concert');
slides[43] = new Slide('../Scrapbook_files/100_5783.jpg', '800', '600', 'Plant Dyeing workshop with Julie Record');
slides[44] = new Slide('../Scrapbook_files/100_5786.jpg', '600', '800', 'Plant Dyeing Workshop with Julie Record');
slides[45] = new Slide('../Scrapbook_files/100_5796.jpg', '800', '600', 'Plant Dyeing Workshop with Julie Record');
slides[46] = new Slide('../Scrapbook_files/Freshwater copy copy.jpg', '800', '598', 'Freshwater Poster designed by David Wilson');
slides[47] = new Slide('../Scrapbook_files/IMG_4689.jpg', '800', '534', 'Courtney Naliboff’s summer production of Freshwater');
slides[48] = new Slide('../Scrapbook_files/IMG_4728.jpg', '534', '800', 'Courtney Naliboff’s summer production of Freshwater');
slides[49] = new Slide('../Scrapbook_files/IMG_4734.jpg', '800', '771', 'Bob Lovell and David Wilson in Freshwater');
slides[50] = new Slide('../Scrapbook_files/IMG_4736.jpg', '800', '534', 'David Wilson and Dave Macy in Freshwater');
slides[51] = new Slide('../Scrapbook_files/IMG_4771.jpg', '800', '534', 'Rowan Wade and Eva Hopkins in Freshwater');
slides[52] = new Slide('../Scrapbook_files/100_5932.jpg', '600', '800', 'Mike Dowling in Concert');
slides[53] = new Slide('../Scrapbook_files/101_0252.jpg', '600', '800', 'School of Fish Lemonade Stand');
slides[54] = new Slide('../Scrapbook_files/100_5804.jpg', '600', '800', 'School of Fish: Audrey and Brett');
slides[55] = new Slide('../Scrapbook_files/100_5806.jpg', '800', '600', 'School of Fish: Brett Waterman');
slides[56] = new Slide('../Scrapbook_files/100_5808.jpg', '800', '600', 'School of Fish: Hannah White');
slides[57] = new Slide('../Scrapbook_files/100_5811.jpg', '600', '800', 'School of Fish: Brett, Audrey and Hannah');
slides[58] = new Slide('../Scrapbook_files/100_5817.jpg', '600', '800', 'School of Fish: Brett and Bud Waterman');
slides[59] = new Slide('../Scrapbook_files/100_6074.jpg', '600', '800', 'First Annual Red Barn Flower Show');
slides[60] = new Slide('../Scrapbook_files/100_5951.jpg', '600', '800', 'First Annual Red Barn Flower Show');
slides[61] = new Slide('../Scrapbook_files/100_5955.jpg', '600', '800', 'Flower Wreath Making');
slides[62] = new Slide('../Scrapbook_files/100_5976.jpg', '600', '800', 'David Wilson');
slides[63] = new Slide('../Scrapbook_files/100_6068.jpg', '800', '600', 'First Annual Red Barn Flower Show');
slides[64] = new Slide('../Scrapbook_files/100_6063.jpg', '600', '800', 'First Annual Red Barn Flower Show');
slides[65] = new Slide('../Scrapbook_files/100_6062.jpg', '800', '600', 'First Annual Red Barn Flower Show');
slides[66] = new Slide('../Scrapbook_files/100_6072.jpg', '800', '600', 'First Annual Red Barn Flower Show');
slides[67] = new Slide('../Scrapbook_files/100_6077.jpg', '800', '600', 'First Annual Red Barn Flower Show');
slides[68] = new Slide('../Scrapbook_files/IMG_0910.jpg', '600', '800', 'Community Days Contradance');
slides[69] = new Slide('../Scrapbook_files/IMG_0914.jpg', '600', '800', 'Community Days Contradance');
slides[70] = new Slide('../Scrapbook_files/101_0230.jpg', '600', '800', 'Chewonki Foundation: Owl Presentation');
slides[71] = new Slide('../Scrapbook_files/DSCF0472.jpg', '600', '800', 'Coffee and Compost: Turner Farm Then and Now');
slides[72] = new Slide('../Scrapbook_files/101_0240.jpg', '800', '600', 'Mina Bartovics: Art in the Red Barn Camp');
slides[73] = new Slide('../Scrapbook_files/100_6167.jpg', '600', '800', 'Joel Rowland: Outdoor Adventures Camp');
slides[74] = new Slide('../Scrapbook_files/100_5920.jpg', '600', '800', 'Art and Music Camp');
slides[75] = new Slide('../Scrapbook_files/100_6101.jpg', '600', '800', 'Foy Brown: Shellfish Camp');
slides[76] = new Slide('../Scrapbook_files/100_6102.jpg', '600', '800', 'Shellfish Camp');
slides[77] = new Slide('../Scrapbook_files/100_6108.jpg', '800', '600', 'Foy Brown: Shellfish Camp');
slides[78] = new Slide('../Scrapbook_files/100_6104.jpg', '600', '800', 'Shellfish Camp');
slides[79] = new Slide('../Scrapbook_files/100_6154.jpg', '600', '800', 'Basket Weaving with Towanda Brown');
slides[80] = new Slide('../Scrapbook_files/100_6156.jpg', '800', '600', 'Basket Weaving with Towanda Brown');
slides[81] = new Slide('../Scrapbook_files/P8163838_2.jpg', '468', '800', 'Herb Parsons and Charlie Shaw Concert');
slides[82] = new Slide('../Scrapbook_files/100_6207.jpg', '600', '800', 'The Toughcats with Ketch Secor');
slides[83] = new Slide('../Scrapbook_files/100_6241.jpg', '600', '800', 'Colin Gulley and Ketch Secor');
slides[84] = new Slide('../Scrapbook_files/100_6203.jpg', '600', '800', 'Colin Gulley and Ketch Secor');
slides[85] = new Slide('../Scrapbook_files/100_6199.jpg', '600', '800', 'Joe Nelson');
slides[86] = new Slide('../Scrapbook_files/6295_963753074019_6829782_53588477_3954172_n.jpg', '404', '604', 'Jacob Greenlaw');
slides[87] = new Slide('../Scrapbook_files/6295_963752994179_6829782_53588464_1971108_n.jpg', '404', '604', 'The Toughcats');
slides[88] = new Slide('../Scrapbook_files/100_6216.jpg', '600', '800', 'House Manager Rachael Garbowski');
slides[89] = new Slide('../Scrapbook_files/5213_512715861743_60201206_30513253_1501288_n.jpg', '453', '604', 'Boom! Times Five written and directed by Adam Alexander');
slides[90] = new Slide('../Scrapbook_files/5896_126533575807_558160807_2841376_5223795_n.jpg', '403', '604', 'Boom! Times Five: Good Morning');
slides[91] = new Slide('../Scrapbook_files/5896_126533625807_558160807_2841384_6354888_n.jpg', '403', '604', 'Boom! Times Five: Boredom, Dread, and Despair');
slides[92] = new Slide('../Scrapbook_files/5896_126533535807_558160807_2841368_6883162_n.jpg', '403', '604', 'Boom! Times Five: Holy Crap! O, Our Immediate Destruction');
slides[93] = new Slide('../Scrapbook_files/5896_126533570807_558160807_2841375_15882_n.jpg', '403', '604', 'Boom! Times Five: Living Hell');
slides[94] = new Slide('../Scrapbook_files/5896_126533590807_558160807_2841379_7838552_n.jpg', '403', '604', 'Boom! Times Five: Heavens to Betsy');
isPureISOLatin1 = true;
contentEncodingConstant = 4;
feedbackURL = "TODO";
showFeedbackButton = false;
feedbackEnabled = true;

function adjustStrokeHeight(idOfElement, leftDelta, rightDelta, bottomDelta)
{
    var oTextBoxOuterDiv = document.getElementById(idOfElement);

    if (oTextBoxOuterDiv)
    {
        var offsetHeight = oTextBoxOuterDiv.offsetHeight;

        var leftImage = getChildOfType(oTextBoxOuterDiv, "IMG", 0);
        if (leftImage)
        {
            leftImage.style.height = (offsetHeight - leftDelta) + "px";
        }
        var rightImage = getChildOfType(oTextBoxOuterDiv, "IMG", 1);
        if (rightImage)
        {
            rightImage.style.height = (offsetHeight - rightDelta) + "px";
        }
        var bottomImage = getChildOfType(oTextBoxOuterDiv, "IMG", 3);
        if (bottomImage)
        {
            bottomImage.style.top = (offsetHeight - bottomDelta) + "px";
        }
    }
}

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 onPageLoad()
{
    detectBrowser();
    fixupIEPNG("id1", "Scrapbook_files/transparent.gif");
    fixupIEPNG("id2", "Scrapbook_files/transparent.gif");
    fixupIEPNG("id3", "Scrapbook_files/transparent.gif");
    fixupIEPNG("id4", "Scrapbook_files/transparent.gif");
    fixupAllIEPNGBGs();
    fixupIEPNG("id5", "Scrapbook_files/transparent.gif");
    fixupIEPNG("id6", "Scrapbook_files/transparent.gif");
    fixupIEPNG("id7", "Scrapbook_files/transparent.gif");
    fixupIEPNG("id8", "Scrapbook_files/transparent.gif");
    adjustStrokeHeight("id9", 6, 6, 4);
    fixupIEPNG("id10", "Scrapbook_files/transparent.gif");
    fixupIEPNG("id11", "Scrapbook_files/transparent.gif");
    fixupIEPNG("id12", "Scrapbook_files/transparent.gif");
    fixupIEPNG("id13", "Scrapbook_files/transparent.gif");
    fixupIEPNG("id14", "Scrapbook_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;
    }
}

