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('../Londres_files/100_0855.jpg', '600', '800', 'London Bridge');
slides[1] = new Slide('../Londres_files/100_0859.jpg', '600', '800', 'Perdidos...');
slides[2] = new Slide('../Londres_files/100_0860.jpg', '600', '800', 'taxi chat');
slides[3] = new Slide('../Londres_files/100_0862.jpg', '600', '800', 'ready to practice');
slides[4] = new Slide('../Londres_files/100_0863.jpg', '600', '800', 'The Studio');
slides[5] = new Slide('../Londres_files/n1355338100_30083465_9457.jpg', '453', '604', 'Un descansito...');
slides[6] = new Slide('../Londres_files/100_0866.jpg', '600', '800', 'impresionado...');
slides[7] = new Slide('../Londres_files/100_0868.jpg', '600', '800', 'turn it on!');
slides[8] = new Slide('../Londres_files/100_0869.jpg', '600', '800', 'los pedales');
slides[9] = new Slide('../Londres_files/100_0871.jpg', '600', '800', 'Preparation');
slides[10] = new Slide('../Londres_files/n1355338100_30083455_6542.jpg', '453', '604', 'Ready to Jam...');
slides[11] = new Slide('../Londres_files/100_0873.jpg', '600', '800', 'conecting kesh...');
slides[12] = new Slide('../Londres_files/100_0874.jpg', '600', '800', 'My board');
slides[13] = new Slide('../Londres_files/DSCN0028.jpg', '600', '800', 'our friend');
slides[14] = new Slide('../Londres_files/DSCN0031.jpg', '600', '800', 'checking celebrities');
slides[15] = new Slide('../Londres_files/n1355338100_30083474_2097.jpg', '453', '604', '5min to Wood Green');
slides[16] = new Slide('../Londres_files/100_0945.jpg', '600', '800', 'waiting D’bus');
slides[17] = new Slide('../Londres_files/100_0948.jpg', '600', '800', 'waiting d’over ground');
slides[18] = new Slide('../Londres_files/100_0954.jpg', '600', '800', 'vamos, vamos, vamos...');
slides[19] = new Slide('../Londres_files/100_0944.jpg', '600', '800', 'Walthamstow');
slides[20] = new Slide('../Londres_files/DSCN0024.jpg', '600', '800', 'reading something');
slides[21] = new Slide('../Londres_files/100_1118.jpg', '600', '800', 'London');
slides[22] = new Slide('../Londres_files/100_1139.jpg', '600', '800', 'St.Paul cathedral');
slides[23] = new Slide('../Londres_files/100_1138.jpg', '600', '800', 'another view');
slides[24] = new Slide('../Londres_files/100_1136.jpg', '600', '800', 'cerrando las puertas');
slides[25] = new Slide('../Londres_files/100_1128.jpg', '600', '800', 'La Cathedral');
slides[26] = new Slide('../Londres_files/100_1127.jpg', '600', '800', 'Majestuosa');
slides[27] = new Slide('../Londres_files/100_1131.jpg', '600', '800', 'Consultorio Dental');
slides[28] = new Slide('../Londres_files/100_1132.jpg', '800', '600', 'Ese soy yo');
slides[29] = new Slide('../Londres_files/100_1125.jpg', '600', '800', 'las calles de Londres');
slides[30] = new Slide('../Londres_files/100_1117.jpg', '600', '800', 'from the taxi...');
slides[31] = new Slide('../Londres_files/100_0937.jpg', '600', '800', 'Less than a pound?');
slides[32] = new Slide('../Londres_files/100_0938.jpg', '600', '800', 'Everything fresh... ');
slides[33] = new Slide('../Londres_files/100_1121.jpg', '600', '800', 'Lost?');
slides[34] = new Slide('../Londres_files/100_1153.jpg', '600', '800', 'Veggi Food');
slides[35] = new Slide('../Londres_files/100_1150.jpg', '600', '800', 'Camden');
slides[36] = new Slide('../Londres_files/s828025570_4210387_7377.jpg', '130', '97', 'The look in High Park');
slides[37] = new Slide('../Londres_files/n828025570_4210271_5335.jpg', '270', '360', 'Panorama UK');
slides[38] = new Slide('../Londres_files/s828025570_4230848_3775.jpg', '130', '97', 'Vibes');
slides[39] = new Slide('../Londres_files/100_1146.jpg', '600', '800', 'Randy,Tony and Tim');
slides[40] = new Slide('../Londres_files/100_1143.jpg', '600', '800', 'with them...');
slides[41] = new Slide('../Londres_files/100_1158.jpg', '600', '800', 'Celcius Bar');
slides[42] = new Slide('../Londres_files/n815395606_4169562_3992.jpg', '402', '604', 'Poison UK Fete 2008');
slides[43] = new Slide('../Londres_files/100_1224.jpg', '600', '800', 'Momos');
slides[44] = new Slide('../Londres_files/100_1222.jpg', '600', '800', 'real Food...');
slides[45] = new Slide('../Londres_files/100_1227.jpg', '600', '800', 'smoking Hookah');
slides[46] = new Slide('../Londres_files/100_1229.jpg', '600', '800', 'like an Egyptian');
slides[47] = new Slide('../Londres_files/100_1232.jpg', '600', '800', 'ahhhhhh!');
slides[48] = new Slide('../Londres_files/100_1233.jpg', '600', '800', 'Kiwan waiting...');
slides[49] = new Slide('../Londres_files/n828025570_4027737_6918.jpg', '270', '360', 'Con Jiselle y Ronda');
slides[50] = new Slide('../Londres_files/n1355338100_30083454_6277.jpg', '453', '604', 'Una cervecita');
slides[51] = new Slide('../Londres_files/n828025570_4115260_3462.jpg', '270', '360', 'La fiesta de despedida...');
slides[52] = new Slide('../Londres_files/n828025570_4109451_5878.jpg', '270', '360', 'Our Landlady Jane');
slides[53] = new Slide('../Londres_files/n828025570_4103100_9439.jpg', '270', '360', 'Liming, lime, lime...');
slides[54] = new Slide('../Londres_files/n828025570_4109458_7699.jpg', '270', '360', 'Party,Party...');
slides[55] = new Slide('../Londres_files/n828025570_4102908_3006.jpg', '270', '360', 'Otra cerveza?');
slides[56] = new Slide('../Londres_files/n828025570_3697786_2900.jpg', '453', '604', 'La mafia...');
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 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 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;
    }
}

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("id2");
    adjustFontSizeIfTooBig("id2");
    adjustLineHeightIfTooBig("id6");
    adjustFontSizeIfTooBig("id6");
    adjustLineHeightIfTooBig("id8");
    adjustFontSizeIfTooBig("id8");
    adjustLineHeightIfTooBig("id9");
    adjustFontSizeIfTooBig("id9");
    fixupIEPNG("id1", "Londres_files/transparent.gif");
    fixupIEPNG("id3", "Londres_files/transparent.gif");
    fixupIEPNG("id4", "Londres_files/transparent.gif");
    fixupIEPNG("id5", "Londres_files/transparent.gif");
    fixupIEPNG("id7", "Londres_files/transparent.gif");
    fixupIEPNG("id10", "Londres_files/transparent.gif");
    return true;
}

