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('../Vineyard Collection_files/fall vineyard.jpg', '600', '720', '“Fall Vineyard”');
slides[1] = new Slide('../Vineyard Collection_files/Winter Vineyards.jpg', '600', '800', '“Winter Vineyards”');
slides[2] = new Slide('../Vineyard Collection_files/morning glow rsmtn.jpg', '600', '800', '“Morning Glow Rattlesnake Mountain”');
slides[3] = new Slide('../Vineyard Collection_files/Fall Under the Vines.jpg', '324', '800', 'Fall Under the Vines');
slides[4] = new Slide('../Vineyard Collection_files/vineyard mist.jpg', '488', '800', 'Vineyard Mist');
slides[5] = new Slide('../Vineyard Collection_files/7 Hills Vineyards.jpg', '336', '800', '7 Hills Vineyards');
slides[6] = new Slide('../Vineyard Collection_files/P1053536_4780.jpg', '708', '600', '“Cheers”');
slides[7] = new Slide('../Vineyard Collection_files/sagemore-2.jpg', '495', '700', 'Sagemore ll');
slides[8] = new Slide('../Vineyard Collection_files/Red Mtn.jpg', '600', '800', '“Red Mtn Vineyards”');
slides[9] = new Slide('../Vineyard Collection_files/red mtn-kiona-1.jpg', '407', '800', 'Stormy Light Red Mtn.');
slides[10] = new Slide('../Vineyard Collection_files/N.E.jpg', '800', '600', '“N.E. Viogione”');
slides[11] = new Slide('../Vineyard Collection_files/Summer Cirrus Artz Vineyards.jpg', '355', '800', 'Summer Cirrus Artz Vineyards');
slides[12] = new Slide('../Vineyard Collection_files/fall at red mtn.jpg', '600', '800', '“Fall at Red Mountain”');
slides[13] = new Slide('../Vineyard Collection_files/Artz Vineyard Summer.jpg', '360', '800', 'Artz Vineyard Summer');
slides[14] = new Slide('../Vineyard Collection_files/sage-grapes sky1.jpg', '526', '700', 'Sage Grapes Sky');
slides[15] = new Slide('../Vineyard Collection_files/Misty Vines.jpg', '450', '800', 'Misty Vines');
slides[16] = new Slide('../Vineyard Collection_files/kiona fall pano.jpg', '233', '800', '“Kiona Fall Panorama”');
slides[17] = new Slide('../Vineyard Collection_files/chandler mist verticle-ap.jpg', '723', '600', '“Chandler Mist”');
slides[18] = new Slide('../Vineyard Collection_files/Fall Patterns Red Mtn.jpg', '525', '700', 'Fall Patterns Red Mtn');
slides[19] = new Slide('../Vineyard Collection_files/Fall Patterns-2.jpg', '800', '600', '“Fall Patterns 2”');
slides[20] = new Slide('../Vineyard Collection_files/October Twilight-Red Mtn.jpg', '531', '700', 'October Twilight-Red Mtn.');
slides[21] = new Slide('../Vineyard Collection_files/wine label-12.jpg', '600', '800', '“Wine Label”');
slides[22] = new Slide('../Vineyard Collection_files/post and vine.jpg', '700', '549', 'Post and Vine');
slides[23] = new Slide('../Vineyard Collection_files/PB151439.jpg', '600', '800', '“Riesling Ready”');
slides[24] = new Slide('../Vineyard Collection_files/PA016608a.jpg', '800', '600', '“Heart of the Harvest”');
slides[25] = new Slide('../Vineyard Collection_files/PB151440.jpg', '600', '800', '“Riesling Pair”');
slides[26] = new Slide('../Vineyard Collection_files/PA016624a.jpg', '800', '400', '“Lemberger Cluster”');
slides[27] = new Slide('../Vineyard Collection_files/lembergerfall.jpg', '800', '600', '“Lemberger Fall”');
slides[28] = new Slide('../Vineyard Collection_files/PA016594a.jpg', '800', '600', '“Fall Curl”');
slides[29] = new Slide('../Vineyard Collection_files/PA016637.jpg', '800', '600', '“Hidden Harvest”');
slides[30] = new Slide('../Vineyard Collection_files/PA016632.jpg', '800', '526', '“Fall Crush”');
slides[31] = new Slide('../Vineyard Collection_files/_A113329.jpg', '679', '600', '“Sunset Road Sunrise”');
slides[32] = new Slide('../Vineyard Collection_files/P9020307.jpg', '600', '450', '“The Love of Wine”');
slides[33] = new Slide('../Vineyard Collection_files/PC141867.jpg', '600', '800', '“Spiked II”');
slides[34] = new Slide('../Vineyard Collection_files/winter gold.jpg', '800', '600', '“Winter Gold”');
slides[35] = new Slide('../Vineyard Collection_files/PC308521.jpg', '600', '799', '“Vine Designs”');
slides[36] = new Slide('../Vineyard Collection_files/Iced.jpg', '800', '457', 'Iced');
slides[37] = new Slide('../Vineyard Collection_files/PC051599.jpg', '800', '600', '“Iced Merlot”');
slides[38] = new Slide('../Vineyard Collection_files/P9020298.jpg', '600', '450', '“Vintner’s Pride”');
slides[39] = new Slide('../Vineyard Collection_files/kiona fall-31.jpg', '338', '800', '“Kiona Fall Panorama”');
slides[40] = new Slide('../Vineyard Collection_files/kiona-05 fall-south view.jpg', '600', '800', '“Kiona Fall”');
slides[41] = new Slide('../Vineyard Collection_files/arntz vineyard fall-mergecanvas-master.jpg', '309', '800', '“Artz Vineyard Fall”');
slides[42] = new Slide('../Vineyard Collection_files/P6094498.jpg', '800', '600', '“Vine Silhouette”');
slides[43] = new Slide('../Vineyard Collection_files/P6094499a.jpg', '600', '800', '“Vine Silhouette III”');
slides[44] = new Slide('../Vineyard Collection_files/P6094496.jpg', '600', '450', '“Vine S II”');
slides[45] = new Slide('../Vineyard Collection_files/twilight cluster-kiona.jpg', '800', '600', '“Twilight Cluster”');
slides[46] = new Slide('../Vineyard Collection_files/PA200472aa copy.jpg', '600', '800', '“Artz Vineyard Fall - Full Shot”');
slides[47] = new Slide('../Vineyard Collection_files/P9020308.jpg', '800', '378', '“Heart Cluster”');
slides[48] = new Slide('../Vineyard Collection_files/PA056863.jpg', '600', '800', '“Red Platter”');
slides[49] = new Slide('../Vineyard Collection_files/lens vine-3.jpg', '600', '450', '“A Vineyard Perspective”');
slides[50] = new Slide('../Vineyard Collection_files/PA056835.jpg', '600', '800', '“Orange Platter”');
slides[51] = new Slide('../Vineyard Collection_files/P9020317.jpg', '600', '450', '“Golden Grapes”');
slides[52] = new Slide('../Vineyard Collection_files/PA200447-a.jpg', '450', '600', '“Red Highlights”');
slides[53] = new Slide('../Vineyard Collection_files/golden grapes vert.jpg', '700', '327', '“Golden Grapes Vertical”');
slides[54] = new Slide('../Vineyard Collection_files/Purple Harvest.jpg', '485', '600', '“Purple Harvest”');
slides[55] = new Slide('../Vineyard Collection_files/monson vineyard dawn.jpg', '414', '700', '“Monson Vineyard Dawn”');
slides[56] = new Slide('../Vineyard Collection_files/paris vives fall.jpg', '450', '600', '“Paris Vineyard Fall”');
slides[57] = new Slide('../Vineyard Collection_files/PB151434.jpg', '600', '450', '“Ready to Burst”');
slides[58] = new Slide('../Vineyard Collection_files/PA270792-1.jpg', '700', '373', '“Harvest Ready”');
slides[59] = new Slide('../Vineyard Collection_files/PA200490.jpg', '600', '450', '“Purple and Gold”');
slides[60] = new Slide('../Vineyard Collection_files/PA200456.jpg', '450', '600', '“Fall at Red Mountain”');
slides[61] = new Slide('../Vineyard Collection_files/PA200470.jpg', '600', '450', '“Lemberger Red”');
slides[62] = new Slide('../Vineyard Collection_files/fall clusterjpg.jpg', '800', '600', '“Fall Cluster”');
slides[63] = new Slide('../Vineyard Collection_files/PA200432.jpg', '600', '450', '“Hidden Clusters”');
slides[64] = new Slide('../Vineyard Collection_files/pal-2-chandler.jpg', '600', '450', '“Chandler Reach Impressions”');
slides[65] = new Slide('../Vineyard Collection_files/P9020322.jpg', '450', '600', '“Sangiovese”');
slides[66] = new Slide('../Vineyard Collection_files/grapecluster paris.jpg', '600', '359', '“Paris Grape Cluster”');
slides[67] = new Slide('../Vineyard Collection_files/PA056875.jpg', '600', '800', '“Lemberger Vine”');
slides[68] = new Slide('../Vineyard Collection_files/-a.jpg', '600', '450', '“Viognier”');
slides[69] = new Slide('../Vineyard Collection_files/Winters Coat.jpg', '612', '700', 'Winters Coat');
slides[70] = new Slide('../Vineyard Collection_files/frostedchardonay.jpg', '600', '800', '“Frosted Chardonnay”');
slides[71] = new Slide('../Vineyard Collection_files/Frosted Chardonnay ll.jpg', '525', '700', 'Frosted Chardonnay ll');
slides[72] = new Slide('../Vineyard Collection_files/Winter Perspective.jpg', '700', '517', 'Winter Perspective');
slides[73] = new Slide('../Vineyard Collection_files/PC051590.jpg', '450', '600', '“Iced Merlot”');
slides[74] = new Slide('../Vineyard Collection_files/PC051588.jpg', '600', '450', '“Frosted”');
slides[75] = new Slide('../Vineyard Collection_files/Winters Burden.jpg', '700', '548', 'Winters Burden');
slides[76] = new Slide('../Vineyard Collection_files/Red Mtn_1.jpg', '468', '700', 'Red Mtn. Sky.jpg');
slides[77] = new Slide('../Vineyard Collection_files/winter Sweets.jpg', '700', '560', 'winter Sweets');
slides[78] = new Slide('../Vineyard Collection_files/PA081497_3189.jpg', '800', '600', 'PA081497');
slides[79] = new Slide('../Vineyard Collection_files/Purple-Red-2art.jpg', '406', '800', 'Purple-Red art');
slides[80] = new Slide('../Vineyard Collection_files/lemberger glow.jpg', '700', '551', 'Lemberger Glow\n\n\nlemberger Glow');
slides[81] = new Slide('../Vineyard Collection_files/golden dew.jpg', '800', '600', 'Golden Dew');
slides[82] = new Slide('../Vineyard Collection_files/PA081519_3210.jpg', '800', '468', 'Three');
isPureISOLatin1 = true;
contentEncodingConstant = 4;
feedbackURL = "TODO";
showFeedbackButton = false;
feedbackEnabled = 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;
    }
}

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

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

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 onPageLoad()
{
    detectBrowser();
    fixupAllIEPNGBGs();
    fixupIEPNG("id1", "Vineyard Collection_files/transparent.gif");
    fixupIEPNG("id2", "Vineyard Collection_files/transparent.gif");
    fixupIEPNG("id3", "Vineyard Collection_files/transparent.gif");
    fixupIEPNG("id4", "Vineyard Collection_files/transparent.gif");
    return true;
}


