﻿    var lienXML = "/en/shopping/brands/brand-list?xml=true";

    var pointeurSurvol = false;

    var arrayImage = new Array("arrayImage");
    var arrayLien = new Array("arrayLien");
    var arrayNom = new Array("Nom");
    var arrays = new Array(arrayImage, arrayLien, arrayNom);

    var longueur = 0;

    var xmlDocLogo;
    var xmlElm;
    var xmllogohttp;


    


    function imageLogoLoad(image) {
        longueur += $(image).width();
    }


    function Timer() {

        if (pointeurSurvol == false) {
            if ($('#listeLogo').css("left").replace(/[^-\d\.]/g, '') <= (-longueur / 4) * 2) {
                $('#listeLogo').css("left", "0");
                setTimeout("Timer()", 15);
            } else {
                $('#listeLogo').stop().animate({ "left": "-=1" }, 1, 'linear');
                setTimeout("Timer()", 15);
            }
        }

    }


    $(document).ready(function () {

        $.ajax({
            type: "GET",
            url: lienXML,
            dataType: "xml",
            success: function (xml) {

                var leHTML = "<div id='listeDeLogos'><ul onload='detectLongueur()'>";

                $(xml).find('BrandsInfoForXml').each(function () {

                    if ($(this).find('Url').text() == "#" || $(this).find('Url').text() == "http://#" || $(this).find('Url').text() == "http://") {

                        leHTML += "<li><a href='" + $(this).find('BrandDetailUrl').text() + "'><img onload='imageLogoLoad(this)' class='imageLogoListe' alt='" + $(this).find('Name').text() + "' id='imageLogo' src='http://media.idigit.netdna-cdn.com" + $(this).find('Logo').text() + "'></a></li>";

                    } else {

                        leHTML += "<li><a href='" + $(this).find('Url').text() + "'><img onload='imageLogoLoad(this)' class='imageLogoListe' alt='" + $(this).find('Name').text() + "' id='imageLogo' src='http://media.idigit.netdna-cdn.com" + $(this).find('Logo').text() + "'></a></li>";
                    
                    }

                });

                $(xml).find('BrandsInfoForXml').each(function () {

                    if ($(this).find('Url').text() == "#" || $(this).find('Url').text() == "http://#" || $(this).find('Url').text() == "http://") {

                        leHTML += "<li><a href='" + $(this).find('BrandDetailUrl').text() + "'><img onload='imageLogoLoad(this)' class='imageLogoListe' alt='" + $(this).find('Name').text() + "' id='imageLogo' src='http://media.idigit.netdna-cdn.com" + $(this).find('Logo').text() + "'></a></li>";

                    } else {

                        leHTML += "<li><a href='" + $(this).find('Url').text() + "'><img onload='imageLogoLoad(this)' class='imageLogoListe' alt='" + $(this).find('Name').text() + "' id='imageLogo' src='http://media.idigit.netdna-cdn.com" + $(this).find('Logo').text() + "'></a></li>";

                    }

                });

                leHTML += "</ul></div>";

                setTimeout("Timer()", 15);

                document.getElementById("listeLogo").innerHTML = leHTML;

            }


        });

        $('#listeLogo').mouseover(function () {
            pointeurSurvol = true;
        });

        $('div#ourBrandFrame').mouseout(function () {
            pointeurSurvol = false;
            Timer();
        });

    });


