/* --------------------------------------------------------------- 
   Author : Remi Palard
   October 2008
   remi.palard@gmail.com  
--------------------------------------------------------------- */

document.observe("dom:loaded", function() {
  
  // Get layer
  if ($('pageactu')) {
    el = 'pageactu';
    delta = 275;
  } else {
    el = 'page'; 
    delta = 0;    
  }

  // Calc
  var dim = document.viewport.getDimensions();
  var dimel = $(el).getDimensions();  
  calcx = (dim.width/2) - (dimel.width/2) + delta;
  calcy = (dim.height/2) - (dimel.height/2) -115 ;
  var x = (calcx > 0) ? calcx : 0;
  var y = (calcy > 0) ? calcy : 0;  
   
  // Assign
  $(el).style.left = x + 'px';
  $(el).style.top = y + 'px';  
  $(el).show();
  
});

/* --------------------------------------------------------------- */		

var slide = {
  start: function(el) {
    var  n = parseInt(el.textContent);
    
    // img
    $$('#imgContent img').each(function(img){
      if ('el_'+n == img.id) $(img.id).show();
      else $(img.id).hide();
    });
    
    // tabs
    $$('#slider td').each(function(td){
      if ('tab_'+n == td.id) $(td.id).className='on';
      else $(td.id).className='off';
    });    
  },
  
  actu: function(el) {
    var  n = parseInt(el.textContent);
    // actu
    ['actu_1','actu_2','actu_3'].each(function(a){
      if ('actu_'+n == a) $(a).show();
      else $(a).hide();
    });
    
    // tabs
    $$('#actuslider td').each(function(td){
      if ('tab_'+n == td.id) $(td.id).className='on';
      else $(td.id).className='off';
    });    
  }    
  
};

/* --------------------------------------------------------------- */		
