﻿var numeroSemaine=0;
var nbSemaine=3;
var suffixeDivLaUne='Une';

function semainePrecedente()
{
    if (numeroSemaine == 1) {
        return;
    }
    var numEditionDiv = lastEdition + numeroSemaine;
    var nomDivMasque = '#' + suffixeDivLaUne + numEditionDiv;
    numeroSemaine = numeroSemaine - 1;
    numEditionDiv = lastEdition + numeroSemaine;
    var nomDivAffchiche = '#' + suffixeDivLaUne + (numEditionDiv);

    //alert('Nom du div A Masque :' + nomDivMasque);
    //alert('Nom du div a afficher :' + nomDivAffchiche);

    $(nomDivMasque).fadeOut('slow', function() {
        $(nomDivAffchiche).fadeIn('slow', function() {
            // Animation complete
        });

    });


    //alert('Nom du div a afficher :' + numeroSemaine);
    if (numeroSemaine == (-nbSemaine + 1)) {
        $('#LaUneZoneGauche').hide();
    }
    $('#LaUneZoneDroite').show();
}

function semaineSuivante() {

    //alert('Numero semaine :' + numeroSemaine);
    //alert('Nombre semaine :' + nbSemaine);

    if (numeroSemaine == nbSemaine) {
        return;
    }

    var numEditionDiv = lastEdition + numeroSemaine;
    var nomDivMasque = '#' + suffixeDivLaUne + numEditionDiv;
    numeroSemaine = numeroSemaine + 1;
    numEditionDiv = lastEdition + numeroSemaine;
    var nomDivAffchiche = '#' + suffixeDivLaUne + (numEditionDiv);
    //alert('Nombre semaine :' + nomDivAffchiche);
    //alert('Nom du div A Masque :' + nomDivMasque);
    //alert('Nom du div a afficher :' + nomDivAffchiche);

    $(nomDivMasque).fadeOut('slow', function() {
        $(nomDivAffchiche).fadeIn('slow', function() {
            // Animation complete
        });

    });

    if (numeroSemaine == 0 ) {
        $('#LaUneZoneDroite').hide();
    }
    $('#LaUneZoneGauche').show();
}

function blocPrecedent(div, current, max) {
    if (currentBloc[current] == 1) {
        return;
    }

    var nomDivMasque = '#' + div + '_' + currentBloc[current];
    currentBloc[current] = currentBloc[current] - 1;
    var nomDivAffchiche = '#' + div + '_' + currentBloc[current];

    //alert('Nom du div A Masque :' + nomDivMasque);
    //alert('Nom du div a afficher :' + nomDivAffchiche);

    $(nomDivMasque).fadeOut('slow', function() {
        $(nomDivAffchiche).fadeIn('slow', function() {
            // Animation complete
        });
    });
    $('#' + current).text(currentBloc[current]);
}

function blocSuivant(div, current, max) {
    if (currentBloc[current] == max) {
        return;
    }

    var nomDivMasque = '#' + div + '_' + currentBloc[current];
    currentBloc[current] = currentBloc[current] + 1;
    var nomDivAffchiche = '#' + div + '_' + currentBloc[current];

    //alert('Nom du div A Masque :' + nomDivMasque);
    //alert('Nom du div a afficher :' + nomDivAffchiche);

    $(nomDivMasque).fadeOut('slow', function() {
        $(nomDivAffchiche).fadeIn('slow', function() {
            // Animation complete
        });

    });
    $('#' + current).text(currentBloc[current]);
}





function blocPrecedentBrvHome(div, max, divPrecedent,divSuivant) {
    var nomDivMasque = '#' + div + '_2';
    var nomDivAffchiche = '#' + div + '_1';


    var nomDivSuivant = '#' + divSuivant;
    var nomDivPreced = '#' + divPrecedent;
    
    $(nomDivMasque).fadeOut('slow', function() {
        $(nomDivAffchiche).fadeIn('slow', function() {
            // Animation complete
        });

    });

    $(nomDivPreced).fadeOut('slow', function() {
    $(nomDivSuivant).fadeIn('slow', function() {
            // Animation complete
        });

    });
}

function blocSuivantBrvHome(div, max, divPrecedent, divSuivant) 
{
    
    var nomDivMasque = '#' + div + '_1';
    var nomDivAffchiche = '#' + div + '_2';

    var nomDivSuivant = '#' + divSuivant;
    var nomDivPreced = '#' + divPrecedent;

    $(nomDivMasque).fadeOut('slow', function() {
        $(nomDivAffchiche).fadeIn('slow', function() {
            // Animation complete
        });

    });



    $(nomDivSuivant).fadeOut('slow', function() {
    $(nomDivPreced).fadeIn('slow', function() {
            // Animation complete
        });

    });
}

