jQuery(window).load(function() {
  /* SLIDESHOW */
  jQuery('#slideshow').nivoSlider({
	pauseOnHover: true,
	pauseTime: 5000,
	effect: 'sliceDown',
	slices: 4
	//directionNav: false,
	//controlNav: false
  });
  
  /* MENU */
  jQuery('#menu a span').hover(function(){ 
    jQuery(this).animate({
      opacity: 1
    }, 500);
  }, function(){ 
    jQuery(this).animate({
      opacity: 0
    }, 300);
  });//.each(function(){ jQuery(this).css('opacity', 0); jQuery(this).css('display', 'block'); });
  
  /* REALISATIONS */
  jQuery('a.post, div.post').hover(function(){ 
    jQuery(this).find('div.overlay').stop().animate({opacity: '0.7'}, 250);
    jQuery(this).addClass('post-over');
  }, function(){ 
    jQuery(this).find('div.overlay').stop().animate({opacity: '0'}, 250);
    jQuery(this).removeClass('post-over');
  }).click(function(){
	var anchor = jQuery(this).find('a[rel=link]').get(0);
	if(anchor != undefined)
		window.location.href = anchor.href;
  });
  
  /* FOOTER LINKS */
  jQuery('#footer div[class!=liens] li a').hover(function(){
	/* OVER */
    jQuery(this).stop().animate({
      'padding-left': '12px'
    }, 'fast', 'swing');
    jQuery(this).find('span').stop().animate({
    	'opacity': '1'
    }, 'normal', 'swing');
  }, function(){
	/* OUT */
    jQuery(this).stop().animate({
      'padding-left': '0'
    }, 'normal', 'swing');
    jQuery(this).find('span').stop().animate({
    	'opacity': '0'
    }, 'fast', 'swing');
  });
  jQuery('#footer div.liens li a').hover(function(){
	/* OVER */
    jQuery(this).stop().animate({
      'padding-left': '30px',
      'background-position': '8px top'
    }, 'fast', 'swing');
    jQuery(this).find('span').stop().animate({
    	'opacity': '1'
    }, 'normal', 'swing');
  }, function(){
	  /* OUT */
    jQuery(this).stop().animate({
      'padding-left': '20px',
      'background-position': '-2px top'
    }, 'fast', 'swing');
    jQuery(this).find('span').stop().animate({
    	'opacity': '0'
    }, 'fast', 'swing');
  });
  
  /* SCROLL TO */
  jQuery('a[href^=\\#]').each(function(){
	jQuery(this).click(function(){
	  jQuery.scrollTo(jQuery(this).attr('href'), 500);
	});
  });
});

/* ZOOM */
function makeFancy() {
  jQuery(document).ready(function() {
    jQuery("a[rel|=fancy]").fancybox({
      'transitionIn'  : 'elastic',
      'transitionOut' : 'elastic',
      'speedIn'   : 600, 
      'speedOut'    : 200, 
      'overlayShow' : true,
      'cyclic': true,
      'titleShow': false,
      'centerOnScroll': true
    }).each(function(){
	  $img = jQuery(this).children();
	  jQuery(this).prepend('<div class="overlay-zoom"></div>');
  	}).hover(function(){ 
  	  $img = jQuery(this).find('img');
  	  $overlay = jQuery(this).find('div.overlay-zoom');
  	  $overlay.css('top', $img.offset().top + 'px');
  	  $overlay.css('left', $img.offset().left + 'px');
  	  $overlay.css('width', $img.outerWidth() + 'px');
  	  $overlay.css('height', $img.outerHeight() + 'px');
      jQuery(this).find('div.overlay-zoom').stop().animate({opacity: '0.7'}, 250);
    }, function(){ 
      jQuery(this).find('div.overlay-zoom').stop().animate({opacity: '0'}, 250);
    });
  });
}
makeFancy();

/* MORE */
function makeMore() {
  jQuery(document).ready(function() {
    jQuery("a.more").each(function(){
	  $img = jQuery(this).children();
      jQuery(this).prepend('<div class="overlay" style="top: ' 
      	+ $img.offset().top + 'px; left: ' 
      	+ $img.offset().left + 'px; width: ' 
        + $img.outerWidth() + 'px; height: ' 
        + $img.outerHeight() + 'px;"></div>');
  	}).hover(function(){ 
      jQuery(this).find('div.overlay').stop().animate({opacity: '0.7'}, 250);
    }, function(){ 
      jQuery(this).find('div.overlay').stop().animate({opacity: '0'}, 250);
    });
  });
}
makeMore();
	
	
	
