

/******************************************************************************************************************************************/
//Fonction permettant d afficher des TG de facon aleatoire
function getAffichageTGHP(tab){
    if (tab.length>0){
          setBlocByHtml("titreTGHP","<span>"+titreHP+"</span>");
          if (tab.length >maxNbPrdHome)
            nbrRestants = maxNbPrdHome;
        else
            nbrRestants=tab.length ;
      
         for (i=0;i<nbrRestants ;i++){      
                showBloc(tab[i]);
         }
     }
     else{
        changeBlocClass("blocTGHP","encart-trois-tg-vide");
        setBlocByHtml("titreTGHP","<span> </span>");
     }
 }

/************************************************************************************************************************************/
//Fonction permettant d afficher des TG sur la page rayon
function getAffichageTGRayon(tab){
    if (tab.length>0){
        hideBloc("fleche-gauche");
        if (tab.length<=2){
            hideBloc("fleche-gauche");
            hideBloc("fleche-droite");
        }     
        for (i=0;i<tab.length ;i++){
            showBloc(tab[i]);
        }
        idOngletActif='men1';  	
        idContenuOngletActif='zoneTG';     
        showBloc("zoneTG");       
        showBloc('ongletTG');
    }
    else{
          hideBloc('zoneTG');
    }
}
 
 /******************************************************************************************************************************************/
//Fonction permettant d afficher des TG de facon aleatoire
function getAffichageTGBrandHP(tab){
    if (tab.length>0){
    vstyle=" 1px solid ";
    setBlocByHtml("titreTGHPBrand","<span>"+titreHPBrand+"</span><div/>");
      if (tab.length >maxNbPrdHome)
        nbrRestants = maxNbPrdHome;
    else
        nbrRestants=tab.length ;       
        for (i=0;i<nbrRestants ;i++){              
            Lemodele =  tab[i].substring(tab[i].indexOf("_")+1,tab[i].length);
            showBloc(tab[i]);
            changeBlocColor("promo_"+Lemodele,colorBrand);
            changeBlocColor("dates_"+Lemodele,colorBrand);
            changeBlocColor("apartirde_"+Lemodele,colorBrand);
            changeBlocColor("prix-promo_"+Lemodele,colorBrand);
            changeBlocColor("reductionPourcentage_"+Lemodele,colorBrand);
            changeBlocColor("reductionPrix_"+Lemodele,colorBrand);
            changeBlocColor("prix_"+Lemodele,colorBrand);
            changeBlocColor("nom_"+Lemodele,colorBrand);
            changeBlocColor("description_"+Lemodele,colorBrand);
            changeBlocColorBorder("prix_"+Lemodele,vstyle,colorBrand);
            changeBlocColorBorder("prix-promo_"+Lemodele,vstyle,colorBrand);     
     }
     }
     else{
        setBlocByHtml("titreTGHPBrand","<span> </span>");
     }
 }
 /*################################################################################################
############################## JS DES FONCTIONS POUR LE DEFILEMENT DES TG DE LA PAGERAYON  ###################
/*############################################################################################## */
/* Variables pour le defilement des TG sur la page rayon */
    // Position initiale du bandeau produits
    posx=-260;
    // Deplacement en pixels entre chaque reaffichage
    delta=10;
    // Cas de position initiale - 1 a gauche 2 - au milieu - 3 a droite 
    posp=2;
    // Coordonnees des 3 positions
    posxvaleur = new Array();
    posxvaleur[0]=-786;
    posxvaleur[2]=-523;
    posxvaleur[3]=-260;
    posxvaleur[4]=3;

function defilg() {
    if (posp>2) {posp=posp-1}
    defilgauche()
}

function defilgauche() {
    document.getElementById('bandeau-produits').style.left=posx+"px"
    posx=Math.round(posx-delta)
    if (delta>2) {delta=delta*0.97}
    if (posx>posxvaleur[posp]) {setTimeout("defilgauche(posp)",20);}
    else {delta=10;}
    if (posp==2) {hideBloc('fleche-droite');}
    if (posp==2) {showBloc('fleche-gauche');}
    if (posp==3) {showBloc('fleche-gauche');}
    if (posp==3) {showBloc('fleche-droite');}
    if (posp==4) {hideBloc('fleche-gauche');}
    if (posp==4) {showBloc('fleche-droite');}
}

function defild() {
    if (posp<4) {posp=posp+1}
    defildroite(posp)
}

function defildroite(posp) {
    document.getElementById('bandeau-produits').style.left=posx+"px"
    posx=Math.round(posx+delta)
    if (delta>2) {delta=delta*0.97}
    if (posx<posxvaleur[posp]) {setTimeout("defildroite(posp)",20);}
    else {
    delta=10}
    if (posp==2) {hideBloc('fleche-droite');}
    if (posp==2) {showBloc('fleche-gauche');}
    if (posp==3) {showBloc('fleche-gauche');}
    if (posp==3) {showBloc('fleche-droite');}
    if (posp==4) {hideBloc('fleche-gauche');}
    if (posp==4) {showBloc('fleche-droite');}
}
