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('../Zabid_files/zabidfrmroof.jpg', '536', '800', 'Zabid, The town was divided into 4 sections, each is inhabited by traders, scholars, dignitaries and artisans.');
slides[1] = new Slide('../Zabid_files/zasheroutside.jpg', '536', '800', 'Zabid city center, Zabid is away from the Red Sea by 25km');
slides[2] = new Slide('../Zabid_files/DSC_0304.jpg', '536', '800', 'Zabid, The town has 29 mosques and 53 Koran schools');
slides[3] = new Slide('../Zabid_files/thunderstik.jpg', '536', '800', 'Zabid mosque');
slides[4] = new Slide('../Zabid_files/threebldg.jpg', '536', '800', 'Zabid');
slides[5] = new Slide('../Zabid_files/zSC_0113.jpg', '536', '800', 'Zabid');
slides[6] = new Slide('../Zabid_files/DSC_0083.jpg', '536', '800', 'House, Zabid');
slides[7] = new Slide('../Zabid_files/insidehousefasac.jpg', '536', '800', 'Zabid, the plastering of Norah inside the houses walls ');
slides[8] = new Slide('../Zabid_files/zSC_0314.jpg', '536', '800', 'The old Indigo working place, Zabid');
slides[9] = new Slide('../Zabid_files/DSC_0872.jpg', '536', '800', '');
slides[10] = new Slide('../Zabid_files/DSC_0876.jpg', '536', '800', '');
slides[11] = new Slide('../Zabid_files/youefhous.jpg', '536', '800', 'The house of Lawyer Yousef in Zabid');
slides[12] = new Slide('../Zabid_files/DSC_0387.jpg', '536', '800', 'Zabid combined the architectural splendors in many domains along the succession of its rule by the different dynasty each of which added some of its special affinities in the different domains. \n');
slides[13] = new Slide('../Zabid_files/YYY_0621.jpg', '536', '800', '');
slides[14] = new Slide('../Zabid_files/insddoor.jpg', '536', '800', 'Zabid door');
slides[15] = new Slide('../Zabid_files/YYY_0509.jpg', '536', '800', '');
slides[16] = new Slide('../Zabid_files/YYY_0747.jpg', '536', '800', '');
slides[17] = new Slide('../Zabid_files/thousndngh.jpg', '536', '800', 'Zabid ceilings');
slides[18] = new Slide('../Zabid_files/clng.jpg', '536', '800', 'Zabid ceiling');
slides[19] = new Slide('../Zabid_files/zbd3.jpg', '536', '800', 'The history of this city was of magnificent status during the medieval period.');
slides[20] = new Slide('../Zabid_files/zSC_0336.jpg', '536', '800', 'Zabid');
slides[21] = new Slide('../Zabid_files/DSC_0029.jpg', '536', '800', 'House, Zabid');
slides[22] = new Slide('../Zabid_files/scdstory.jpg', '536', '800', 'Zabid');
slides[23] = new Slide('../Zabid_files/clngbl.jpg', '536', '800', 'Zabid, the drawing of Noah ark above the door');
slides[24] = new Slide('../Zabid_files/rom.jpg', '536', '800', 'Zabid house');
slides[25] = new Slide('../Zabid_files/slgwal.jpg', '536', '800', 'Zabid combined the architectural splendors in many domains along the succession of its rule by the different dynasty each of which added some of its special affinities in the different domains. ');
slides[26] = new Slide('../Zabid_files/sdecling.jpg', '536', '800', 'Zabid');
slides[27] = new Slide('../Zabid_files/zbdcelng.jpg', '536', '800', 'Zabid ceilings');
slides[28] = new Slide('../Zabid_files/clnmg.jpg', '536', '800', 'Zabid ceiling');
slides[29] = new Slide('../Zabid_files/wevng.jpg', '536', '800', 'Zabid was a center for the weaving-dyeing and tanning industries');
slides[30] = new Slide('../Zabid_files/mosq.jpg', '536', '800', 'As the poet says, “ if you pray in Al Asha’ir Mosque and you extrolled God several times at pulpits, then you will smell the odor of Eden while Allah the Almighty is watching you.”');
slides[31] = new Slide('../Zabid_files/asharmosq.jpg', '536', '800', 'The Al Asha’ir mosque was established by the Prophet’s companion Abu Mousa Al Asha’ri in 629 A.D. ');
slides[32] = new Slide('../Zabid_files/strdavd.jpg', '536', '800', 'One of the first mosques in Yemen, it was built immediatly after the Yemenis embraced Islam \nand hence hold cosuderable spiritual and historical importance.');
slides[33] = new Slide('../Zabid_files/chairzabid.jpg', '536', '800', 'Inside the mosque the old wooden chair made in 1520 A.D for the recital of the Prophet’s Traditions.');
slides[34] = new Slide('../Zabid_files/msqcanda.jpg', '536', '800', 'The Ash’er Mosque, Its library still contain many rare manuscripts and books in various sciences. ');
slides[35] = new Slide('../Zabid_files/ashrcelng.jpg', '536', '800', 'he Ash’er Mosque wooden ceiling');
isPureISOLatin1 = true;
contentEncodingConstant = 4;
feedbackURL = "TODO";
showFeedbackButton = false;
feedbackEnabled = 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 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 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 onPageLoad()
{
    detectBrowser();
    fixupIEPNG("id1", "Zabid_files/transparent.gif");
    fixupIEPNG("id2", "Zabid_files/transparent.gif");
    fixupAllIEPNGBGs();
    fixupIEPNG("id3", "Zabid_files/transparent.gif");
    fixupIEPNG("id4", "Zabid_files/transparent.gif");
    fixupIEPNG("id5", "Zabid_files/transparent.gif");
    fixupIEPNG("id6", "Zabid_files/transparent.gif");
    fixupIEPNG("id7", "Zabid_files/transparent.gif");
    fixupIEPNG("id8", "Zabid_files/transparent.gif");
    fixupIEPNG("id9", "Zabid_files/transparent.gif");
    fixupIEPNG("id10", "Zabid_files/transparent.gif");
    return true;
}

