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('../Tattoos _files/DSC05716.jpg', '800', '534', 'tiki');
isPureISOLatin1 = true;
contentEncodingConstant = 4;
feedbackURL = "TODO";
showFeedbackButton = false;
feedbackEnabled = true;

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('../Tattoos _files/DSC02853.jpg', '800', '534', 'El mariarchi');
slides[1] = new Slide('../Tattoos _files/DSC01872.jpg', '800', '534', 'Dos Pistolas');
slides[2] = new Slide('../Tattoos _files/DSC02427.jpg', '801', '366', 'Mr fanta pants');
slides[3] = new Slide('../Tattoos _files/DSC06018.jpg', '534', '800', 'Heartskullafly');
slides[4] = new Slide('../Tattoos _files/DSC05433.jpg', '535', '800', 'sugar skull');
slides[5] = new Slide('../Tattoos _files/P1010431.jpg', '800', '600', 'Snow man');
slides[6] = new Slide('../Tattoos _files/DSC03549.jpg', '800', '534', 'smokin joe');
slides[7] = new Slide('../Tattoos _files/DSC05426.jpg', '800', '441', 'gama go go');
slides[8] = new Slide('../Tattoos _files/DSC03607.jpg', '800', '534', 'silly monkey');
slides[9] = new Slide('../Tattoos _files/DSC03609.jpg', '800', '534', 'silly monkey');
slides[10] = new Slide('../Tattoos _files/DSC01545.jpg', '534', '800', 'Hear see speak no evil');
slides[11] = new Slide('../Tattoos _files/DSC02628.jpg', '800', '534', 'Incubus Broken heart');
slides[12] = new Slide('../Tattoos _files/DSC00579.jpg', '800', '386', 'Octopus cover up');
slides[13] = new Slide('../Tattoos _files/DSC00580.jpg', '800', '600', 'octopus');
slides[14] = new Slide('../Tattoos _files/DSC06167.jpg', '800', '534', 'Fine koi');
slides[15] = new Slide('../Tattoos _files/DSC03944.jpg', '800', '534', 'koi');
slides[16] = new Slide('../Tattoos _files/DSC07949.jpg', '800', '600', 'Tiger 3/4 sleeve');
slides[17] = new Slide('../Tattoos _files/DSC06183.jpg', '800', '534', 'Bad ass fish');
slides[18] = new Slide('../Tattoos _files/DSC06185.jpg', '800', '534', 'detail');
slides[19] = new Slide('../Tattoos _files/DSC06188.jpg', '800', '534', 'detail');
slides[20] = new Slide('../Tattoos _files/DSC06189.jpg', '800', '534', 'detail');
slides[21] = new Slide('../Tattoos _files/DSC01625.jpg', '800', '534', 'Koi cover up');
slides[22] = new Slide('../Tattoos _files/DSC01626.jpg', '800', '534', 'koi');
slides[23] = new Slide('../Tattoos _files/IMG_0136.jpg', '801', '370', 'Samurai of death');
slides[24] = new Slide('../Tattoos _files/DSC05202.jpg', '800', '534', 'Firebird\n');
slides[25] = new Slide('../Tattoos _files/IMG_0013.jpg', '800', '420', 'cover up');
slides[26] = new Slide('../Tattoos _files/IMG_0017.jpg', '800', '403', 'cover up');
slides[27] = new Slide('../Tattoos _files/DSC05417.jpg', '800', '517', 'El negro gato rosa');
slides[28] = new Slide('../Tattoos _files/DSC06290.jpg', '534', '800', 'Mi Familia');
slides[29] = new Slide('../Tattoos _files/DSC00596.jpg', '800', '600', 'aotearoa');
slides[30] = new Slide('../Tattoos _files/DSC06133.jpg', '534', '800', '‘32 fatboy');
slides[31] = new Slide('../Tattoos _files/DSC06160.jpg', '800', '534', 'memorial ');
slides[32] = new Slide('../Tattoos _files/DSC02445.jpg', '800', '534', 'memorial piece \n');
slides[33] = new Slide('../Tattoos _files/DSC02851.jpg', '800', '534', 'rotas');
slides[34] = new Slide('../Tattoos _files/DSC02826.jpg', '800', '533', 'Miss Demeanor');
slides[35] = new Slide('../Tattoos _files/DSC05427.jpg', '800', '534', 'Miss Behave');
slides[36] = new Slide('../Tattoos _files/DSC02378.jpg', '800', '534', 'dancing in the rain');
slides[37] = new Slide('../Tattoos _files/DSC05547.jpg', '800', '534', 'blood');
slides[38] = new Slide('../Tattoos _files/DSC01534.jpg', '800', '534', 'Chopper chick');
slides[39] = new Slide('../Tattoos _files/DSC01668.jpg', '800', '534', 'angel');
slides[40] = new Slide('../Tattoos _files/DSC01631.jpg', '800', '534', 'christ all mighty');
slides[41] = new Slide('../Tattoos _files/DSC01095.jpg', '800', '534', 'skull');
slides[42] = new Slide('../Tattoos _files/DSC01895.jpg', '800', '534', 'tibetan skull cover up');
slides[43] = new Slide('../Tattoos _files/DSC01752.jpg', '800', '534', 'Blue bird');
slides[44] = new Slide('../Tattoos _files/DSC02310.jpg', '800', '534', 'lotus');
slides[45] = new Slide('../Tattoos _files/IMG_0150.jpg', '800', '598', 'IMG_0150.JPG');
slides[46] = new Slide('../Tattoos _files/DSC00582.jpg', '800', '600', 'before cover up');
slides[47] = new Slide('../Tattoos _files/DSC00584.jpg', '800', '600', 'after cover up');
slides[48] = new Slide('../Tattoos _files/DSC01294.jpg', '800', '534', 'Pray for my heart of glass');
slides[49] = new Slide('../Tattoos _files/DSC03561.jpg', '534', '800', '1830 A.D. ave maria');
slides[50] = new Slide('../Tattoos _files/DSC03573.jpg', '800', '534', '13 flaming dice');
slides[51] = new Slide('../Tattoos _files/DSC01367.jpg', '534', '800', 'raptor');
slides[52] = new Slide('../Tattoos _files/DSC01287.jpg', '534', '800', 'marlin');
slides[53] = new Slide('../Tattoos _files/DSC01639.jpg', '800', '534', 'Falcon portrait');
slides[54] = new Slide('../Tattoos _files/DSC01436.jpg', '800', '534', 'China sparrow');
slides[55] = new Slide('../Tattoos _files/DSC03516.jpg', '800', '534', 'tiger cover up before');
slides[56] = new Slide('../Tattoos _files/DSC03520.jpg', '800', '534', 'during cover up');
slides[57] = new Slide('../Tattoos _files/DSC03620.jpg', '800', '534', 'after cover up');
slides[58] = new Slide('../Tattoos _files/DSC03950.jpg', '800', '534', 'pohutukawa');
slides[59] = new Slide('../Tattoos _files/DSC06037.jpg', '800', '559', 'Bette Paige');
slides[60] = new Slide('../Tattoos _files/DSC02855.jpg', '800', '533', 'Mahumad Ali');
slides[61] = new Slide('../Tattoos _files/DSC05145.jpg', '800', '534', 'Lockey');
slides[62] = new Slide('../Tattoos _files/DSC06028.jpg', '800', '649', 'Wiawai pukarau');
slides[63] = new Slide('../Tattoos _files/IMG_0070.jpg', '800', '599', 'Merril Streep');
slides[64] = new Slide('../Tattoos _files/DSC06002.jpg', '800', '534', 'Audrey Kawasaki');
slides[65] = new Slide('../Tattoos _files/DSC05216.jpg', '800', '534', 'An Ode to cartoon');
slides[66] = new Slide('../Tattoos _files/DSC05212.jpg', '800', '534', 'Mr Cartoon');
slides[67] = new Slide('../Tattoos _files/P1010127.jpg', '800', '600', '6 hours on the ribs!');
slides[68] = new Slide('../Tattoos _files/IMG_0117.jpg', '801', '599', 'tiki ');
slides[69] = new Slide('../Tattoos _files/IMG_0126.jpg', '801', '599', 'Meow');
slides[70] = new Slide('../Tattoos _files/DSC03450.jpg', '800', '534', 'scottish thistle ');
slides[71] = new Slide('../Tattoos _files/DSC01846_1.jpg', '800', '534', 'Fuck yeah! butt rockers');
slides[72] = new Slide('../Tattoos _files/DSC08504.jpg', '600', '800', '');
slides[73] = new Slide('../Tattoos _files/DSC08509.jpg', '800', '600', '');
slides[74] = new Slide('../Tattoos _files/DSC08555.jpg', '800', '600', '');
slides[75] = new Slide('../Tattoos _files/DSC08590.jpg', '800', '600', '');
slides[76] = new Slide('../Tattoos _files/DSC08815.jpg', '800', '600', '');
slides[77] = new Slide('../Tattoos _files/DSC08864.jpg', '601', '800', '');
slides[78] = new Slide('../Tattoos _files/DSC08894.jpg', '601', '800', '');
slides[79] = new Slide('../Tattoos _files/DSC08927.jpg', '800', '600', '');
slides[80] = new Slide('../Tattoos _files/DSC08928.jpg', '800', '600', '');
slides[81] = new Slide('../Tattoos _files/DSC08929.jpg', '800', '600', '');
slides[82] = new Slide('../Tattoos _files/IMG_0782.jpg', '800', '391', '');
slides[83] = new Slide('../Tattoos _files/IMG_0783.jpg', '800', '437', '');
slides[84] = new Slide('../Tattoos _files/DSC09068.jpg', '600', '800', '');
slides[85] = new Slide('../Tattoos _files/DSC09069.jpg', '800', '600', '');
slides[86] = new Slide('../Tattoos _files/DSC09070.jpg', '800', '600', '');
slides[87] = new Slide('../Tattoos _files/DSC09480.jpg', '800', '599', '');
slides[88] = new Slide('../Tattoos _files/DSC09490.jpg', '800', '413', '');
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", "Tattoos _files/transparent.gif");
    return true;
}

