document.observe("dom:loaded", function() {
  // initially hide all containers for tab content
    //$hide=Element.hide($('visu_ech'));
    });


var Masque = {
    Affiche: function(n,c){
        cible = $("masque");
        IMGpos = $("thumb_"+n).cumulativeOffset();
        IMGwidth = $("thumb_"+n).getWidth();
        IMGheight = $("thumb_"+n).getHeight();
        marge = 5;
        Masque.On();
       new Effect.Parallel([
            new Effect.Move(cible,{x: IMGpos.left-marge, y:IMGpos.top+marge,mode: 'absolute',transition: Effect.Transitions.sinoidal}),
            new Effect.Morph(cible,{style: 'width:'+(IMGwidth+marge*2)+'px; height:'+(IMGheight+marge*2)+'px; background-color:'+c+';'}),
            ],
            { duration: 0.8,queue :'end' }
        );
    },
    Hide: function(n){
       Masque.Off();
    },
    On: function(){
        cible = $("masque");
        var queue =Effect.Queues.get("menuxscope");
        queue.each(function(effect) { effect.cancel(); });
          new Effect.Appear(cible,{duration:0.7,queue: { position: 'top', scope: 'menuxscope',limit: 1 } })
    },
    Off: function(){
        cible = $("masque");
        new Effect.Fade(cible,{duration:0.7,queue: { position: 'top', scope: 'menuxscope',limit: 1 } })
    }
};



//____________________________________________________Generiques

function fnSetImage(id,thesrc){
    new Effect.Appear($(id),{duration:0.7,queue: { position: 'end', scope: 'imgxscope'} })
        Element.writeAttribute($(id),'src',thesrc);
};
function fnSetContent(id,desc){
        Element.update($(id),desc);
};
function update_rea(id_img,thesrc,id_desc,desc){
     Element.writeAttribute($(id_img),'src',thesrc);
     Element.update($(id_desc),desc);
     new Effect.Appear($(id_img),{duration:0.7,queue: { position: 'end', scope: 'imgxscope'} });
}