AJL = {
  
  images:  ['colloque-AJL-2009-Charles-Rizk01.png',
            'colloque-AJL-2009-02.png',
            'colloque-AJL-2009-03.png',
            'colloque-AJL-2009-Accueil01.png',
            'colloque-AJL-2009-Antoine-Khair01.png',
            'colloque-AJL-2009-Elizabeth-Picard01.png',
            'colloque-AJL-2009-Henry-Laurens01.png',
            'colloque-AJL-2009-Jean-Gicquel01.png'
           ],
  
  displayDur: 5,
  curIdx: 0,
  titles: ['Porter', 'Oeuvrer', 'S\'engager', 'Organiser', 'Développer'],
  features: ['la parole de ses adhérents en France et au Liban',
            'pour la protection des libertés et droits fondamentaux au Liban',
            'à favoriser l’adhésion par le Liban au Statut de Rome',
            'des rencontres, colloques ou formations et procèder à des publications ',
            'les échanges avec toute personne oeuvrant dans le domaine juridique'],
  
  initPage: function(YUIInstance)
  {
    Y = YUIInstance;
    AJL.headingSel = '#bd .mission h1';
    AJL.featureSel = '#bd .mission p';
    AJL.titleAnimIn = new Y.Anim({ node: AJL.headingSel, to: { opacity: 1 } });
    AJL.titleAnimOut = new Y.Anim({ node: AJL.headingSel, to: { opacity: 0 } });
    AJL.featAnimIn = new Y.Anim({ node: AJL.featureSel, to: { opacity: 1 } });
    AJL.featAnimOut = new Y.Anim({ node: AJL.featureSel, to: { opacity: 0 } });

    AJL.featAnimIn.on('end',function(){setTimeout(AJL.switchFeature,AJL.displayDur*1000);});
    AJL.featAnimIn.run();
  },
  
  /*
   Function: switchFeature
   Executes the transition to a new feature text
   */  
  switchFeature: function(index)
  {
    AJL.titleAnimOut.on('end',function(){
                          var idx;
                          do
                            idx = ACT.randomInt(0,AJL.titles.length-1);
                          while(idx==AJL.curIdx);
                          AJL.curIdx = idx;
                          Y.one(AJL.headingSel).set('innerHTML', AJL.titles[idx]);
                          Y.one(AJL.featureSel).set('innerHTML', AJL.features[idx]);
                          AJL.titleAnimIn.run();
                          AJL.featAnimIn.run();
                        });
    AJL.featAnimOut.run();
    AJL.titleAnimOut.run();
  }

}
  
ACT = {
  randomInt: function(min, max)
  {
    return Math.floor(Math.random() * (max - min + 1)) + min;
  }
};
