﻿// Fichier JScript

var Tab = new Array();

function AfficheTab(id, numListe)
{
    document.getElementById("Titre" + numListe).innerHTML =  Tab[numListe][id][1];
    document.getElementById("Texte" + numListe).innerHTML = Tab[numListe][id][2];
    document.getElementById("ImgListe" + numListe).alt = Tab[numListe][id][1];
    document.getElementById("aListe" + numListe).href="javascript:OuvreFen('FicheResult.aspx?id=" + Tab[numListe][id][0] + "',500,635)";
}

function InitLst(numListe)
{
    if (Tab[numListe].length == 1)
    {
        AfficheTab(Tab[numListe].length - 1, numListe);
    }
    else if (Tab[numListe].length > 1)
    {
        DefileTab(0, Tab[numListe].length-1, numListe);
    }
}

function DefileTab(id, nb, numListe)
{
    opacity("TabListe" + numListe, 100, 0, 500);
    setTimeout("AfficheTab(" + id + ", " + numListe + ")", 500);
    setTimeout("opacity('TabListe" + numListe + "', 0, 100, 500)", 1000);
    if (id == nb) {id = 0} else {id = id + 1};
    setTimeout("DefileTab(" + (id) + ", " + nb + ", " + numListe + ")", 8000);
}  

function OverLst(numListe, Couleur)
{
    document.getElementById("ZoneListe" + numListe).style.backgroundColor = Couleur;
}
function OutLst(numListe)
{
    document.getElementById("ZoneListe" + numListe).style.backgroundColor = 'Transparent';
}          

function opacity(id, opacStart, opacEnd, millisec)
{ 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 

    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
    for(i = opacStart; i >= opacEnd; i--) { 
    setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
    timer++; 
    } 
    } else if(opacStart < opacEnd) { 
    for(i = opacStart; i <= opacEnd; i++) 
    { 
    setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
    timer++; 
    } 
    } 
} 

//change the opacity for different browsers 
function changeOpac(opacity, id)
{ 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
} 