var show = {
  initialize:function(){
    show.loadZoomed();
//    show.preLoadImages();
    var hover = $('div.zoomed');
    setInterval(show.slideLeft, 5000);
    /*
    $('#presentation div.gallery a').live('mouseenter', function(){
      $(hover).clearQueue();
      $(hover).stop();
      $(hover).show();
      $(hover).css('opacity', '1');
      var offset = $(this).offset();
      var src = $(this).attr('href');
      var image1 = $('<img />').attr('src', src);
      image1.bind('load',function(){
        image1.width(145).height(100);
        $(hover).empty().append(image1);
        $(hover).offset(offset).show();
        $(image1).animate({
          width: '200px',
          height:'150px',
        }, 500);
        $(hover).animate({
          left: '-=25',
          top: '-=15',
        }, 500)
      })
    });
    $('#banner').live('mouseleave', function(){
      $(hover).fadeOut();
    })
    */
    },
      loadZoomed:function(){
      var zoomedHtml = "<div class='zoomed'></div>"
      $('#banner').prepend(zoomedHtml);
    $('.zoomed').css({
      width:'200px',
      height: '150px',
      display: 'none',
      position: 'absolute',
      'z-index': '70',
    });
    
  },
  
    
  preLoadImages:function(){
    $('#presentation div.gallery a').each(function(){
      var src = $(this).attr('href');
      var img = $('<img />').attr('src', src);
      img.bind('load');
    })
  },
  slideLeft:function(){
    if ($('.zoomed:hidden').length > 0){
      var l = $('#presentation div.gallery').css('left');
      $('#presentation div.gallery').animate({
        left: '-=145',
      }, 1000, function(){
        var i = 11;
        $('#presentation .gallery a:nth-child(12n+1)').each(function(ii){
          if (ii < 4){
            if (ii < 2){
              $('#presentation div.gallery a:nth-child('+i+')').after($(this).clone());
            }else{
              $('#presentation div.gallery a:last').after($(this).clone());
            }
            i =i+ 12;
          }
        })
        $('#presentation div.gallery').css('left', l).find('a:nth-child(12n+1)').remove();
      })
    }
  }
}
