function changeCase(index)
{
    for(i = 0;i <= 9 ; i++) {
        if(i == index)
            $('#case' + i).css('backgroundColor','#ffffff'); 
        else
            $('#case' + i).css('backgroundColor','#ffb741'); 
    }
    
}

function ajoutSelection(franchise,obj)
{
    ouvrirSelection();
    
    $.get("ajax_ajoute_franchise_selection.php",{id:franchise},function(data){        
        $("#selectionEnCours").html($("#selectionEnCours").html() + data);
        etendreSelection();
    });
    //alert(obj.getAttribute("src"));
    var reg = new RegExp("btn-ajouter-reseau");
    var reg2 = new RegExp("bt_ajout_Ok_h_ani");
    
    if(obj.getAttribute("src").match(reg) ||
    obj.getAttribute("src").match(reg2))
        obj.setAttribute("src","img/bt_ajout_Ok_h_ani.gif");
    else
        obj.setAttribute("src","/images/bt_ajout_Ok_ani.gif");
    
    return false;
}
function fermerContact()
{
    
        $('#contact').animate({ width:0 },'slow');
        $('#maSelection').animate({ right:0 },'slow' );
        fermerSelection();
    
}
function ouvrirContact(id_franchise,nom_franchise)
{
        if(nom_franchise)
            $("#titreContact").html("Demande de documentation à "+nom_franchise);
        else
            $("#titreContact").html("Demande de documentation à ma sélection");
            
        if(nom_franchise)    
            $("#idAContacter").val(id_franchise);
        else
            $("#idAContacter").val(0);
        //$('#maSelection').css('right','400px');
        $('#contact').animate({ width:400 },'slow' ,function(){
          //  $("#overDiv").focus();
          //$("#head_form").focus();
           $("#form_nom").focus();
        });
        if(!nom_franchise) {
            $('#maSelection').animate({ right:400 },'slow' );
            $('#espace').animate({ height:$('#contact').height()-35 }, 'slow' ,
            function(){
                $('#maSelection').animate({ width:234 },'slow' );
                
            });
        } 
        
        return false;
    
}
function fermerSelection()
{
    $('#maSelection').animate({ width:15 },'slow', function(){ 
        $('#espace').animate({ height:0 },'slow');
    });
}
function ouvrirSelection()
{
    $('#espace').animate({ height:$('#maSelection').height()-35 }, 'slow' ,
        function(){
        $('#maSelection').animate({ width:234 },'slow' );
    });
}
function effaceSelection(id)
{
 //   alert(id);
    $("#" + id).animate({ opacity: 'hide' }, 
        'slow', function(){
         $('#espace').animate({ height:'-='+$("#" + id).height() },'slow');
         $("#" + id).empty();
    });    
    $.get("ajax_supp_franchise_selection.php",{franchise: id});
    
    
}
function etendreSelection()
{
     $('#espace').animate({ height:$('#maSelection').height()-35 }, 'slow');
}
