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('../Lee Pashley Gallery_files/He\u0027s THe One.jpg', '800', '532', 'He\u0027s THe One');
slides[1] = new Slide('../Lee Pashley Gallery_files/Thats Me..jpg', '800', '532', 'Thats Me..');
slides[2] = new Slide('../Lee Pashley Gallery_files/Re-live Robbie at Knebworth.jpg', '349', '293', 'Re-live Robbie at Knebworth');
slides[3] = new Slide('../Lee Pashley Gallery_files/Let me entertain you!.jpg', '350', '370', 'Let me entertain you!');
slides[4] = new Slide('../Lee Pashley Gallery_files/UR HU HA..jpg', '800', '532', 'UR HU HA..');
slides[5] = new Slide('../Lee Pashley Gallery_files/Lee Goldberg\u0027s Party 3.jpg', '349', '293', 'Lee Goldberg\u0027s Party 3');
slides[6] = new Slide('../Lee Pashley Gallery_files/I Just Wanna Feel.jpg', '800', '532', 'I Just Wanna Feel');
slides[7] = new Slide('../Lee Pashley Gallery_files/Loving The Pink...jpg', '800', '532', 'Loving The Pink...');
slides[8] = new Slide('../Lee Pashley Gallery_files/Lee Goldberg\u0027s Party 2.jpg', '349', '293', 'Lee Goldberg\u0027s Party 2');
slides[9] = new Slide('../Lee Pashley Gallery_files/The Band.jpg', '532', '800', 'The Band');
slides[10] = new Slide('../Lee Pashley Gallery_files/Lying Down On THe Job.jpg', '532', '800', 'Lying Down On THe Job');
slides[11] = new Slide('../Lee Pashley Gallery_files/Put Em Up!!!.jpg', '800', '532', 'Put Em Up!!!');
slides[12] = new Slide('../Lee Pashley Gallery_files/Live Shot.jpg', '532', '800', 'Live Shot');
slides[13] = new Slide('../Lee Pashley Gallery_files/If Ya Think I\u0027m Sexy...jpg', '800', '532', 'If Ya Think I\u0027m Sexy...');
slides[14] = new Slide('../Lee Pashley Gallery_files/Come On Come On Come On...jpg', '536', '800', 'Come On Come On Come On...');
slides[15] = new Slide('../Lee Pashley Gallery_files/Monsoon.jpg', '532', '800', 'Monsoon');
slides[16] = new Slide('../Lee Pashley Gallery_files/Kids.jpg', '349', '293', 'Kids');
slides[17] = new Slide('../Lee Pashley Gallery_files/You Want More.jpg', '800', '536', 'You Want More?');
slides[18] = new Slide('../Lee Pashley Gallery_files/Robbie in Berlin.jpg', '349', '293', 'Robbie in Berlin');
slides[19] = new Slide('../Lee Pashley Gallery_files/Caught In THe Act.jpg', '532', '800', 'Caught In THe Act');
slides[20] = new Slide('../Lee Pashley Gallery_files/Let Me Entertain You.jpg', '349', '293', 'Let Me Entertain You');
slides[21] = new Slide('../Lee Pashley Gallery_files/Pointing!!.jpg', '532', '800', 'Pointing!!');
slides[22] = new Slide('../Lee Pashley Gallery_files/I\u0027ve Been Expecting You.jpg', '349', '293', 'I\u0027ve Been Expecting You');
slides[23] = new Slide('../Lee Pashley Gallery_files/We Will Rock You.jpg', '800', '532', 'We Will Rock You');
slides[24] = new Slide('../Lee Pashley Gallery_files/Nice Arse...jpg', '800', '536', 'Nice Arse...');
slides[25] = new Slide('../Lee Pashley Gallery_files/On Me Knees.jpg', '532', '800', 'On Me Knees');
slides[26] = new Slide('../Lee Pashley Gallery_files/Chatting..jpg', '532', '800', 'Chatting..');
slides[27] = new Slide('../Lee Pashley Gallery_files/Everybody..jpg', '800', '532', 'Everybody..');
slides[28] = new Slide('../Lee Pashley Gallery_files/Let Me Etertain.jpg', '530', '800', 'Let Me Etertain');
slides[29] = new Slide('../Lee Pashley Gallery_files/Pointing in Black..jpg', '532', '800', 'Pointing in Black..');
slides[30] = new Slide('../Lee Pashley Gallery_files/Come And Hold My Hand.jpg', '800', '536', 'Come And Hold My Hand');
slides[31] = new Slide('../Lee Pashley Gallery_files/Angels.jpg', '349', '293', 'Angels');
slides[32] = new Slide('../Lee Pashley Gallery_files/The Band 2.jpg', '800', '536', 'The Band 2');
slides[33] = new Slide('../Lee Pashley Gallery_files/Come On!!.jpg', '532', '800', 'Come On!!');
slides[34] = new Slide('../Lee Pashley Gallery_files/Swing When You\u0027re Winning.jpg', '349', '293', 'Swing When You\u0027re Winning');
slides[35] = new Slide('../Lee Pashley Gallery_files/And Through It All.jpg', '532', '800', 'And Through It All');
slides[36] = new Slide('../Lee Pashley Gallery_files/Up Yours...jpg', '800', '532', 'Up Yours...');
slides[37] = new Slide('../Lee Pashley Gallery_files/Oh Yer..jpg', '536', '800', 'Oh Yer..');
slides[38] = new Slide('../Lee Pashley Gallery_files/Love Supreme.jpg', '349', '293', 'Love Supreme');
slides[39] = new Slide('../Lee Pashley Gallery_files/Hand In Pocket.jpg', '532', '800', 'Hand In Pocket');
slides[40] = new Slide('../Lee Pashley Gallery_files/Intensive Care.jpg', '349', '293', 'Intensive Care');
slides[41] = new Slide('../Lee Pashley Gallery_files/Let him entertain you.jpg', '349', '293', 'Let him entertain you');
slides[42] = new Slide('../Lee Pashley Gallery_files/She\u0027s THe One.jpg', '800', '532', 'She\u0027s THe One');
slides[43] = new Slide('../Lee Pashley Gallery_files/Re-live Robbie at Knebworth 2.jpg', '349', '293', 'Re-live Robbie at Knebworth 2');
slides[44] = new Slide('../Lee Pashley Gallery_files/Lee Goldberg\u0027s Party.jpg', '349', '293', 'Lee Goldberg\u0027s Party');
isPureISOLatin1 = true;
contentEncodingConstant = 4;
feedbackURL = "TODO";
showFeedbackButton = false;
feedbackEnabled = true;

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 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 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 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 getChildOfType(oParent, sNodeName, requestedIndex)
{
    var childrenOfType = oParent.getElementsByTagName(sNodeName);
    return (requestedIndex < childrenOfType.length) ?
           childrenOfType.item(requestedIndex) : null;
}

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

function onPageLoad()
{
    detectBrowser();
    adjustLineHeightIfTooBig("id1");
    adjustFontSizeIfTooBig("id1");
    fixupIEPNG("id2", "Lee Pashley Gallery_files/transparent.gif");
    fixupIEPNG("id3", "Lee Pashley Gallery_files/transparent.gif");
    return true;
}

