function makeNavOnImage(){
  var img = $('.post img:first');
  var w  = Math.round(img.width()/4)-20; // -20 pour le padding
  var h = img.height()-20;
  var linkprev = $('.archive_nav .left a').attr('href');
  var linknext = $('.archive_nav .right a').attr('href');
  var testprev = typeof(linkprev) == 'string';
  var testnext = typeof(linknext) == 'string';

  $('.post')
    .css('position', 'relative')
    .append('<a class="imgnav" id="imgprev" />')
    .append('<a class="imgnav" id="imgnext" />')
    .find('.imgnav').css({
      display: 'block',
      position: 'absolute',
      top: 0,
      padding: '10px',
      border: '0px solid red',
      width: w+'px',
      height: h+'px',
      fontSize: '160px',
      lineHeight: h+'px',
      fontWeight: 'bold',
      color: '#fff',
      opacity: .4
    });

  if (testprev) {
    $('#imgprev').css('left', 0).attr('href', linkprev)
      .mouseover(function(){ $(this).text('<'); })
      .mouseout(function(){ $(this).text(' '); });
  } else {
    $('#imgprev').remove();
  }
  
  if (testnext) {
    $('#imgnext').css({right: 0, textAlign: 'right'}).attr('href', linknext)
      .mouseover(function(){ $(this).text('>'); })
      .mouseout(function(){ $(this).text(' '); });
  } else {
    $('#imgnext').remove();
  }
  
  $(document).keydown(function(event) {
    if (event.keyCode == '37') {
      if (testprev) window.location.href = linkprev;
    }
    if (event.keyCode == '39') {
      if (testnext) window.location.href = linknext;
    }
  });

}


$(document).ready(function(){
  makeNavOnImage();
});