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('../Gallery Page 1_files/0010  2 Stitched flowers.jpg', '800', '627', '0010  2 Stitched flowers');
slides[1] = new Slide('../Gallery Page 1_files/0020  4 Beaded flowers.jpg', '800', '600', '0020  4 Beaded flowers');
slides[2] = new Slide('../Gallery Page 1_files/0030  4 Flowerpots.jpg', '800', '600', '0030  4 Flowerpots');
slides[3] = new Slide('../Gallery Page 1_files/0040  4 Stitched flowerpots.jpg', '800', '600', '0040  4 Stitched flowerpots');
slides[4] = new Slide('../Gallery Page 1_files/0060  Birthday Flower.jpg', '600', '800', '0060  Birthday Flower');
slides[5] = new Slide('../Gallery Page 1_files/0070  Baby Boy.jpg', '800', '661', '0070  Baby Boy');
slides[6] = new Slide('../Gallery Page 1_files/0080  Baby carriage - girl.jpg', '600', '800', '0080  Baby carriage - girl');
slides[7] = new Slide('../Gallery Page 1_files/0090  Baby Girl.jpg', '800', '673', '0090  Baby Girl');
slides[8] = new Slide('../Gallery Page 1_files/0100  Birthday balloon.jpg', '800', '600', '0100  Birthday balloon');
slides[9] = new Slide('../Gallery Page 1_files/0110  Birthday beaded butterfly.jpg', '800', '600', '0110  Birthday beaded butterfly');
slides[10] = new Slide('../Gallery Page 1_files/0120  Birthday sun stitched.jpg', '800', '600', '0120  Birthday sun stitched');
slides[11] = new Slide('../Gallery Page 1_files/0130  Beaded butterfly thanks.jpg', '800', '600', '0130  Beaded butterfly thanks');
slides[12] = new Slide('../Gallery Page 1_files/0140  Beaded Medallion - Wisteria.jpg', '800', '607', '0140  Beaded Medallion - Wisteria');
slides[13] = new Slide('../Gallery Page 1_files/0150  Beaded Heart leaves.jpg', '800', '644', '0150  Beaded Heart leaves');
slides[14] = new Slide('../Gallery Page 1_files/0160  Beaded Easter Egg.jpg', '800', '600', '0160  Beaded Easter Egg');
slides[15] = new Slide('../Gallery Page 1_files/0170  Beaded Medallion - Fern.jpg', '800', '600', '0170  Beaded Medallion - Fern');
slides[16] = new Slide('../Gallery Page 1_files/0180  Beaded Flower.jpg', '800', '600', '0180  Beaded Flower');
slides[17] = new Slide('../Gallery Page 1_files/0190  Bird with birthday message.jpg', '600', '800', '0190  Bird with birthday message');
slides[18] = new Slide('../Gallery Page 1_files/0210  Birthday Cake.jpg', '800', '595', '0210  Birthday Cake');
slides[19] = new Slide('../Gallery Page 1_files/0220  Birthday Cake1.jpg', '800', '600', '0220  Birthday Cake1');
slides[20] = new Slide('../Gallery Page 1_files/0530  Iris folded colorful car.jpg', '538', '800', '0530  Iris folded colorful car');
slides[21] = new Slide('../Gallery Page 1_files/0540  Colorful shapes design.jpg', '800', '623', '0540  Colorful shapes design');
slides[22] = new Slide('../Gallery Page 1_files/0550  Cupcake.jpg', '800', '641', '0550  Cupcake');
slides[23] = new Slide('../Gallery Page 1_files/0560  Cuppa tea.jpg', '557', '800', '0560  Cuppa tea');
slides[24] = new Slide('../Gallery Page 1_files/0570  Cut and Fold happy faces.jpg', '800', '685', '0570  Cut and Fold happy faces');
slides[25] = new Slide('../Gallery Page 1_files/0580  Cut and Fold thinking of you.jpg', '800', '600', '0580  Cut and Fold thinking of you');
slides[26] = new Slide('../Gallery Page 1_files/0590  Cut and Fold design.jpg', '600', '800', '0590  Cut and Fold design');
slides[27] = new Slide('../Gallery Page 1_files/0600  Daffodil.jpg', '800', '600', '0600  Daffodil');
slides[28] = new Slide('../Gallery Page 1_files/0610  Dolphin.jpg', '600', '800', '0610  Dolphin');
slides[29] = new Slide('../Gallery Page 1_files/0620  Dragon.jpg', '800', '600', '0620  Dragon');
slides[30] = new Slide('../Gallery Page 1_files/0630  Dragonfly.jpg', '800', '600', '0630  Dragonfly');
slides[31] = new Slide('../Gallery Page 1_files/0640  E-jag.jpg', '600', '800', '0640  E-jag');
slides[32] = new Slide('../Gallery Page 1_files/0650  Elaborate green stitched tree.jpg', '800', '563', '0650  Elaborate green stitched tree');
slides[33] = new Slide('../Gallery Page 1_files/0660  Fairy pyramid.jpg', '800', '600', '0660  Fairy pyramid');
slides[34] = new Slide('../Gallery Page 1_files/0670  Fairy Umbrella.jpg', '800', '616', '0670  Fairy Umbrella');
slides[35] = new Slide('../Gallery Page 1_files/0680  Flowery Birthday stitched.jpg', '800', '592', '0680  Flowery Birthday stitched');
slides[36] = new Slide('../Gallery Page 1_files/0690  Thank You Flowers.jpg', '800', '600', '0690  Thank You Flowers');
slides[37] = new Slide('../Gallery Page 1_files/0700  With love.jpg', '800', '618', '0700  With love');
slides[38] = new Slide('../Gallery Page 1_files/0710  Felt kitty.jpg', '600', '800', '0710  Felt kitty');
slides[39] = new Slide('../Gallery Page 1_files/0720  Flower Basket.jpg', '800', '600', '0720  Flower Basket');
slides[40] = new Slide('../Gallery Page 1_files/0730  Flowers for Mammy.jpg', '800', '600', '0730  Flowers for Mammy');
slides[41] = new Slide('../Gallery Page 1_files/0740  Flowery Cut and Fold design.jpg', '800', '600', '0740  Flowery Cut and Fold design');
slides[42] = new Slide('../Gallery Page 1_files/0750  Geisha and stitched vine.jpg', '800', '609', '0750  Geisha and stitched vine');
slides[43] = new Slide('../Gallery Page 1_files/0760  Geisha with tea service.jpg', '800', '599', '0760  Geisha with tea service');
slides[44] = new Slide('../Gallery Page 1_files/0770  Get Well flowers.jpg', '800', '636', '0770  Get Well flowers');
slides[45] = new Slide('../Gallery Page 1_files/0780  Get Well teddy.jpg', '800', '665', '0780  Get Well teddy');
slides[46] = new Slide('../Gallery Page 1_files/0800  Halloween Bat.jpg', '600', '800', '0800  Halloween Bat');
slides[47] = new Slide('../Gallery Page 1_files/0810  Happy 40th Birthday.jpg', '800', '600', '0810  Happy 40th Birthday');
slides[48] = new Slide('../Gallery Page 1_files/0820  Happy 40th Birthday1.jpg', '800', '600', '0820  Happy 40th Birthday1');
slides[49] = new Slide('../Gallery Page 1_files/0830  Hitchhikers Guide 42nd bday.jpg', '600', '800', '0830  Hitchhikers Guide 42nd bday');
slides[50] = new Slide('../Gallery Page 1_files/0840  Indian sun.jpg', '800', '687', '0840  Indian sun');
slides[51] = new Slide('../Gallery Page 1_files/0850  Iris 5-point.jpg', '600', '800', '0850  Iris 5-point');
slides[52] = new Slide('../Gallery Page 1_files/0860  Iris folded car birthday.jpg', '600', '800', '0860  Iris folded car birthday');
slides[53] = new Slide('../Gallery Page 1_files/0870  Iris cat.jpg', '800', '600', '0870  Iris cat');
slides[54] = new Slide('../Gallery Page 1_files/0880  Iris Easter Egg.jpg', '800', '600', '0880  Iris Easter Egg');
slides[55] = new Slide('../Gallery Page 1_files/0890  Iris sun.jpg', '600', '800', '0890  Iris sun');
slides[56] = new Slide('../Gallery Page 1_files/0900  Iris with leaf cutout.jpg', '800', '600', '0900  Iris with leaf cutout');
slides[57] = new Slide('../Gallery Page 1_files/0910  Geisha stitched - with mahogany.jpg', '800', '643', '0910  Geisha stitched - with mahogany');
slides[58] = new Slide('../Gallery Page 1_files/0920  Juggler bunny.jpg', '800', '600', '0920  Juggler bunny');
slides[59] = new Slide('../Gallery Page 1_files/0940  Lace design.jpg', '600', '800', '0940  Lace design');
slides[60] = new Slide('../Gallery Page 1_files/0950  Leaf fairy.jpg', '800', '600', '0950  Leaf fairy');
slides[61] = new Slide('../Gallery Page 1_files/0960  Liquorice Allsorts.jpg', '800', '600', '0960  Liquorice Allsorts');
slides[62] = new Slide('../Gallery Page 1_files/0970  Love swans.jpg', '600', '800', '0970  Love swans');
slides[63] = new Slide('../Gallery Page 1_files/0980  Mermaid.jpg', '800', '600', '0980  Mermaid');
slides[64] = new Slide('../Gallery Page 1_files/0990  Model T.jpg', '600', '800', '0990  Model T');
slides[65] = new Slide('../Gallery Page 1_files/1010  Mothers Day.jpg', '800', '600', '1010  Mothers Day');
slides[66] = new Slide('../Gallery Page 1_files/1020  Pegasus.jpg', '800', '600', '1020  Pegasus');
slides[67] = new Slide('../Gallery Page 1_files/1030  Pumpkin.jpg', '800', '600', '1030  Pumpkin');
slides[68] = new Slide('../Gallery Page 1_files/1040  Puppy.jpg', '600', '800', '1040  Puppy');
slides[69] = new Slide('../Gallery Page 1_files/1050  Purple butterfly.jpg', '800', '600', '1050  Purple butterfly');
slides[70] = new Slide('../Gallery Page 1_files/1060  Purple Flowers w-Border.jpg', '800', '630', '1060  Purple Flowers w-Border');
slides[71] = new Slide('../Gallery Page 1_files/1070  Pyramid flowers.jpg', '800', '597', '1070  Pyramid flowers');
slides[72] = new Slide('../Gallery Page 1_files/1090  Rainbow circle stitched Bday.jpg', '800', '636', '1090  Rainbow circle stitched Bday');
slides[73] = new Slide('../Gallery Page 1_files/1100  Baby rattle.jpg', '600', '800', '1100  Baby rattle');
slides[74] = new Slide('../Gallery Page 1_files/1110  red ferns.jpg', '800', '650', '1110  Red ferns');
slides[75] = new Slide('../Gallery Page 1_files/1120  Scrabble 70th birthday.jpg', '600', '800', '1120  Scrabble 70th birthday');
slides[76] = new Slide('../Gallery Page 1_files/1130  Shamrock.jpg', '800', '652', '1130  Shamrock');
slides[77] = new Slide('../Gallery Page 1_files/1140  Ship reflecting birthday.jpg', '600', '800', '1140  Ship reflecting birthday');
slides[78] = new Slide('../Gallery Page 1_files/1150  Sun Orange.jpg', '579', '800', '1150  Sun Orange');
slides[79] = new Slide('../Gallery Page 1_files/1160  Spirella fuzzy.jpg', '800', '600', '1160  Spirelli fuzzy');
slides[80] = new Slide('../Gallery Page 1_files/1170  Spirella sparkly.jpg', '800', '600', '1170  Spirelli sparkly');
slides[81] = new Slide('../Gallery Page 1_files/1180  Spirella colorful.jpg', '800', '620', '1180  Spirelli colorful');
slides[82] = new Slide('../Gallery Page 1_files/1190  Spirella tall.jpg', '800', '600', '1190  Spirelli tall');
slides[83] = new Slide('../Gallery Page 1_files/1200  Spirella thanks.jpg', '800', '600', '1200  Spirelli thanks');
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();
    fixupIEPNG("id1", "Gallery Page 1_files/transparent.gif");
    fixupIEPNG("id2", "Gallery Page 1_files/transparent.gif");
    fixupIEPNG("id3", "Gallery Page 1_files/transparent.gif");
    fixupAllIEPNGBGs();
    fixupIEPNG("id4", "Gallery Page 1_files/transparent.gif");
    fixupIEPNG("id5", "Gallery Page 1_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 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;
}

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

