// JavaScript Document
/*
 * jQuery
 *
*/

$(function(){
		
	// VARIABLES
	var $siteURL = $('.logo-top a').attr('href');
	var $easing = 'easeOutQuad';
	var $easing2 = 'easeInOutQuad';
	var $durationNav = 800;
	var $speedOpenClose = 500;
	var $containerBigHeight = 750;
	var $containerSmallHeight = 555;
	var $containerBigVideo = 600;
	var $containerSmallVideo = 455;
	var $bigRes = 1260;
	var $smallRes = 1024;
	var $widthDesc = 422;
	var $widthSmallImgs = 720;
	var $widthBigImgs = 990;
	// Big NAV PREV NEXT BUTTONS
	var $defautAlphaBigNav = .2;
	var $hoverAlphaBigNav = 1;
	var $bgNav = .8;
	
	function projectCss2() {
		$('#prev-wrapper-port').hide(); // desactivate prev
		$('#next-wrapper-port').show(); // activate next
		$('.project-content .project-nav').appendTo('#nav-port').hide().fadeIn(100);		
	}
	
	//If the User resizes the window, adjust the #container height
	function resizeWindow2() {
	
		//$('#container').scrollTo({top:0, left:0} , $durationNav, {easing: $easing});
		$('.gallery .gallery-icon img').each(function(){
		
			var newWindowWidth = $(window).width();
			var imgSrc = $(this).attr('src');
			var bigSrc = imgSrc.replace('-720x509', '');
			var smallSrc = imgSrc.replace('.jpg', '');
			var sizeImg = imgSrc.slice(-12);
					
			if(newWindowWidth >= $bigRes){
				// if image is already resized
				if(sizeImg == '-720x509.jpg'){
				
					var nbrImgs = $('.gallery li').size();
					$('.gallery').css({width: ((nbrImgs*$widthBigImgs) + $widthDesc)}); // resize width gallery
					
					$('#container-port').stop().animate({height: $containerBigHeight}, $speedOpenClose, $easing2); // resize #container height
					
					$('#prev-wrapper-port, #next-wrapper-port').hide().fadeIn(400, function(){
						$(this).css({height: ($containerBigHeight-1)}); // resize Nav Buttons height
						$('#prev-wrapper-port').hide();
					});
							
					$(this).removeAttr('width').removeAttr('height');
					$(this).fadeOut(400, function(){
						$(this).attr('src', bigSrc).fadeIn(400);
					});
				}
			} else if(newWindowWidth <= $smallRes){
				// if image is not resized
				if(sizeImg != '-720x509.jpg'){
				
					var nbrImgs = $('.gallery li').size();
					$('.gallery').css({width: ((nbrImgs*$widthSmallImgs) + $widthDesc)}); // resize width gallery
					
					$(this).removeAttr('width').removeAttr('height');
					$(this).fadeOut(400, function(){
						$(this).attr('src', smallSrc + '-720x509.jpg').fadeIn(400);
						$('#container-port').stop().animate({height: $containerSmallHeight}, $speedOpenClose, $easing2); // resize #container height
						$('#prev-wrapper-port, #next-wrapper-port').hide().fadeIn(400, function(){
							$(this).css({height: ($containerSmallHeight-1)}); // resize Nav Buttons height
							$('#prev-wrapper-port').hide();
						});
					});
				}
			}
		});
	} // End function resizeWindow2()
	
	var resizeTimer = null;
	$(window).bind('resize', function() {
	    if (resizeTimer) clearTimeout(resizeTimer);
	    resizeTimer = setTimeout(resizeWindow2, 200);
	});
	/* END RESIZE TIMER */
	
	// Window width variable
	
		
	// Update #container Height - BIG - SMALL - VIDEO
	function resizeContainerHeight2() {

		var windowWidth = $(window).width();
		var videoExist = $('#post').hasClass('category-video'); // If video exist
		var videoID = $('#post').find('object').attr('id');
		
		if(videoExist == true){
			if(videoID == 'video-player-990'){
			var containerHeight = $containerBigVideo;
			} else if(videoID == 'video-player-720'){
			var containerHeight = $containerSmallVideo;
			}
		} else if(videoExist == false) {
			if(windowWidth >= $bigRes){
			var containerHeight = $containerBigHeight;
			} else if(windowWidth <= $smallRes){
			var containerHeight = $containerSmallHeight;
			}
		}
		
		/* Delay */
		$('#container-port').delay(400).animate({height: containerHeight}, $speedOpenClose, $easing2);
		$('#prev-wrapper-port, #next-wrapper-port').delay(400).animate({height: containerHeight - 1}, $speedOpenClose, $easing2);
		
	} // End function resizeContainerHeight2()

	// THUMBS
	function thumbsActionPort2() {
		
	
		$('#thumbs-port li .wp-post-image').css({opacity: 0.65});
	
		// Hover effect
		$('#thumbs-port li span.title').css({opacity: 0});
		$('#thumbs-port li a').hover(function(){
			$(this).find('.wp-post-image').stop().animate({opacity: 1}, 200);
			$(this).find('.title').stop().animate({top: 145, opacity: 1}, 200);
			$(this).find('.markup').stop().animate({opacity: 0}, 200);
		}, function(){
			$(this).find('.wp-post-image').stop().animate({opacity: .65}, 500);
			$(this).find('.title').stop().animate({top: 140, opacity: 0}, 200);
			$(this).find('.markup').stop().animate({opacity: 1}, 200);
		});

		// Window width variable
		var windowWidth = $(window).width();
						
	} // End thumbsActionPort2()
	
	
	function navButtons2(){
	
		// Paragraph effect
		if (!$.browser.msie){ /* Not Enabled on IE */
			$('.project-content p').css({opacity: .65});
			$('.project-content').hover(function(){
	    		$(this).find('p').stop().animate({opacity: .99}, 600);
	    	}, function(){
	    		$(this).find('p').stop().animate({opacity: .65}, 300);
	    	});
    	}
    	
    	// INNER PREV & NEXT BUTTONS PROJECTS
    	// Hover
    	var allButtons = $('.project-nav .next-project, .project-nav .prev-project, .project-nav .go-website');
    	
    	$(allButtons).append('<span class="hover">hover</span>');
    	$(allButtons).find('.hover').css({opacity: 0});
    	
    	$(allButtons).hover(function(){
    		$(this).find('.hover').stop().animate({opacity: 1}, 500, $easing2);
    		$(this).stop().animate({width: 148}, 300, $easing2);
    	}, function(){
    		$(this).stop().animate({width: 43}, 600, $easing2, function(){
    			$(this).find('.hover').stop().animate({opacity: 0}, 200, $easing2);
    		});
    	});
    	
    	
    	
    	// Window width variable
		var windowWidth = $(window).width();
    	
		// CLOSE HOVER
    	$('.project-nav .close, .project-nav .home').append('<span class="hover">hover</span>');
    	$('.project-nav .close, .project-nav .home').find('.hover').css({opacity: 0});
    	$('.project-nav .close, .project-nav .home').hover(function(){
    		$(this).find('.hover').stop().animate({opacity: 1}, 500, $easing2);
    	}, function(){
    		$(this).find('.hover').stop().animate({opacity: 0}, 200, $easing2);
    	});

    	// Close Project
		$('.project-nav .next-project, .project-nav .prev-project').click(function(){
		
			var postURL = $(this).attr('href');
			
			$('#nav-port .project-nav').fadeOut(200, function(){ $(this).remove(); });
			$('#prev-wrapper-port, #next-wrapper-port').fadeOut(200); // desactivate
				
			$('#post').stop().animate({opacity: 0}, $speedOpenClose, $easing, function(){
				
				$('#container-port').html('').load(postURL + ' #post',{data: windowWidth}, function() {
					
					$(this).find('#post').css({opacity: 0}).stop().animate({opacity: 1}, $speedOpenClose, $easing2);
					projectCss2();
	  	  			navButtons2();
	  	  			
	  	  			resizeContainerHeight2();
				});
			});
			return false;
		})
		
		// Change width #container if smaller images
		var $galleryExist = $('.gallery').size();
		var nbrImgs = $('.gallery li').size();
			
		if($galleryExist == 1){
			var imgSrcName = $('.gallery li img').attr('src').slice(-12); // !important
			if(imgSrcName == '-720x509.jpg'){ // if Small images, resize .gallery
				$('.gallery').css({width: ((nbrImgs*$widthSmallImgs) + $widthDesc)});
			}
		}
		
		
	}
	
	
	projectCss2();
	thumbsActionPort2();
	navButtons2();
	
	
	// CLIENTS - Testify (News Ticker)
	var first = 0;
	var speed = 700;
	var pause = 12000;
	
	function removeFirst2(){
		first = $('ul#listticker li:first').html();
		$('ul#listticker li:first').fadeOut(speed, function() {
			$(this).remove();
			});
		$('ul#listticker li:nth-child(2)').fadeOut(speed);
		addLast2(first);
	}
	function addLast2(first){
		last = first+'';
		$('ul#listticker').append('<li class="quote-wrapper">' + last + '</li>');
		$('ul#listticker li:nth-child(2)').fadeIn(speed);
	}
	
	interval = setInterval(removeFirst2, pause);
		
	// BIG PREV - NEXT BUTTONS : HOVER
	if (!$.browser.msie) { /* Fix defaut alpha bug : IE7 IE8 */
		$('#next-wrapper-port, #prev-wrapper-port').css({opacity: $defautAlphaBigNav});
		$('#next-wrapper-port .bg-arrows, #prev-wrapper-port .bg-arrows').css({opacity: $bgNav});
	}
	
	$('#next-wrapper-port, #prev-wrapper-port').hover(function(){
		$(this).stop().animate({opacity: $hoverAlphaBigNav}, 300);
	}, function(){
		$(this).stop().animate({opacity: $defautAlphaBigNav}, 150);
	});	
		
	// HORIZONTAL SCROLLING
	$('#next-wrapper-port').click(function(){
		$('#prev-wrapper-port').show().stop().animate({opacity: $defautAlphaBigNav}, 600);
		
		var $leftScrollValue = $('#container-port').scrollLeft();
		var $thumbsExist = $('#thumbs-port').size();
		var $galleryExist = $('.gallery').size();
		
		// THUMBS	
		if($thumbsExist == 1){
			$('#thumbs-port li.current').removeClass('current').next().next().next().addClass('current');
			$('#container-port').scrollTo('li.current', $durationNav, {easing: $easing, axis: 'x'});
		}
		
		// GALLERY	
		if($galleryExist == 1){
			if(!$('.gallery li').hasClass('current')){
				$('#next-wrapper-port').fadeOut(100);
			} else {
				$('.gallery li.current').removeClass('current').next().addClass('current');
				$('#container-port').scrollTo('li.current', $durationNav, {easing: $easing, axis: 'x'});
			}
		} 

	});
	// END SCROLLING
	

	// NAV ARROWS - PREV / NEXT
	$('#prev-wrapper-port').click(function(){
	
		$('#next-wrapper-port').show();

		var $thumbsExist = $('#thumbs-port').size();
		var $galleryExist = $('.gallery').size();
		var thirdThumb = $('#thumbs-port li:eq(3)');
		
		// THUMBS	
		if($thumbsExist == 1){
			if(!$('#thumbs-port li').hasClass('current')){ // if not class current
				$('#thumbs-port li:last').addClass('current'); // add one to the last li
			} else if(!$(thirdThumb).hasClass('current')) { // if is not third li
				$('#thumbs-port li.current').removeClass('current').prev().prev().prev().addClass('current'); // continue scrolling left
				$('#container-port').scrollTo('li.current', $durationNav, {easing: $easing, axis: 'x'});
			} else if($(thirdThumb).hasClass('current')) { // if is the third li
				$('#container-port').scrollTo({top: 0, left: 0}, $durationNav, {easing: $easing, axis: 'x'}); // scoll to #container left:0
				$('#thumbs-port li').removeClass('current'); // remove all class 'current'
				$('#thumbs-port li:first').addClass('current'); // attribute 'current' class to first li
				$("#prev-wrapper-port").fadeOut(100);
			}
		}
		// GALLERY	
		if($galleryExist == 1){
			if($('.gallery li.current').hasClass('first')){
				$('#container-port').scrollTo({top: 0, left: 0}, $durationNav, {easing: $easing, axis: 'x'});
			} else {
				$('.gallery li.current').removeClass('current').prev().addClass('current');
				$('#container-port').scrollTo('li.current', $durationNav, {easing: $easing, axis: 'x'});
			}
		}
	});
	
	// NEXT & PREV BUTTONS FOLLOW THE MOUSE 
    $('#prev-wrapper-port').hide();
    
	// next
	$("#next-wrapper-port").mousemove(function(e){
		
		if($('.gallery li.current').hasClass('last')){
			$('#next-wrapper-port').fadeOut(100);
		}
	
		var secondSecondLast = $('#thumbs-port li:last').prev().prev(); 
		var secondLast = $('#thumbs-port li:last').prev();
		var last = $('#thumbs-port li:last'); 
	
		if(secondSecondLast.hasClass('current') || secondLast.hasClass('current') || last.hasClass('current')){
			$('#next-wrapper-port').fadeOut(100);
		}
		
		// Fix for scrolling #thumbs
		// calculate scrolls & width datas
        var $leftScrollValue = $('#container-port').scrollLeft();
		var $contentWidthThumbs = $('#thumbs-port').width();
		var $widthContainer = $('#container-port').width();
		var $paddingLeft = 40;
        
       	//  Hide NEXT WRAPPER if : width container + left scroll pos == width content
		if(($widthContainer + $leftScrollValue - $paddingLeft) == $contentWidthThumbs)
		{
			$('#next-wrapper-port').fadeOut(100);
		};

    });
       
    // prev
    $("#prev-wrapper-port").mousemove(function(e){
    
    	var $scrollListener = $('#container-port').scrollLeft();
    	// Hide #prev-wrapper if scrollLeft == 0
	    if($scrollListener == 0) 
		{
			$("#prev-wrapper-port").fadeOut(100);
		}
	    
    });
    
    // SKILLS - hover effect
    // SAVOIR-FAIRE - hover effect
    var allMenuHover = $('.ul-skills li, .logos-cms li, #social-icons li');
    $('.ul-skills li span').append('<span class="hover">hover</span>');
    $('.logos-cms li').append('<span class="hover">hover</span>');
    $('#social-icons li a').append('<span class="hover">hover</span>');
    
    $(allMenuHover).find('.hover').css({opacity: 0});
    
	$(allMenuHover).hover(function(){
		$(this).find('.hover').stop().animate({opacity: 1}, 100);
	}, function(){
		$(this).find('.hover').stop().animate({opacity: 0}, 500);
	});
			
});









function foo(){

	// VARIABLES
	var $siteURL = $('.logo-top a').attr('href');
	var $easing = 'easeOutQuad';
	var $easing2 = 'easeInOutQuad';
	var $durationNav = 800;
	var $speedOpenClose = 500;
	var $containerBigHeight = 750;
	var $containerSmallHeight = 555;
	var $containerBigVideo = 600;
	var $containerSmallVideo = 455;
	var $bigRes = 1260;
	var $smallRes = 1024;
	var $widthDesc = 422;
	var $widthSmallImgs = 720;
	var $widthBigImgs = 990;
	// Big NAV PREV NEXT BUTTONS
	var $defautAlphaBigNav = .2;
	var $hoverAlphaBigNav = 1;
	var $bgNav = .8;
	
	function projectCss2() {
		$('#prev-wrapper-port').hide(); // desactivate prev
		$('#next-wrapper-port').show(); // activate next
		$('.project-content .project-nav').appendTo('#nav-port').hide().fadeIn(100);		
	}
	
	//If the User resizes the window, adjust the #container height
	function resizeWindow2() {
	
		//$('#container').scrollTo({top:0, left:0} , $durationNav, {easing: $easing});
		$('.gallery .gallery-icon img').each(function(){
		
			var newWindowWidth = $(window).width();
			var imgSrc = $(this).attr('src');
			var bigSrc = imgSrc.replace('-720x509', '');
			var smallSrc = imgSrc.replace('.jpg', '');
			var sizeImg = imgSrc.slice(-12);
					
			if(newWindowWidth >= $bigRes){
				// if image is already resized
				if(sizeImg == '-720x509.jpg'){
				
					var nbrImgs = $('.gallery li').size();
					$('.gallery').css({width: ((nbrImgs*$widthBigImgs) + $widthDesc)}); // resize width gallery
					
					$('#container-port').stop().animate({height: $containerBigHeight}, $speedOpenClose, $easing2); // resize #container height
					
					$('#prev-wrapper-port, #next-wrapper-port').hide().fadeIn(400, function(){
						$(this).css({height: ($containerBigHeight-1)}); // resize Nav Buttons height
						$('#prev-wrapper-port').hide();
					});
							
					$(this).removeAttr('width').removeAttr('height');
					$(this).fadeOut(400, function(){
						$(this).attr('src', bigSrc).fadeIn(400);
					});
				}
			} else if(newWindowWidth <= $smallRes){
				// if image is not resized
				if(sizeImg != '-720x509.jpg'){
				
					var nbrImgs = $('.gallery li').size();
					$('.gallery').css({width: ((nbrImgs*$widthSmallImgs) + $widthDesc)}); // resize width gallery
					
					$(this).removeAttr('width').removeAttr('height');
					$(this).fadeOut(400, function(){
						$(this).attr('src', smallSrc + '-720x509.jpg').fadeIn(400);
						$('#container-port').stop().animate({height: $containerSmallHeight}, $speedOpenClose, $easing2); // resize #container height
						$('#prev-wrapper-port, #next-wrapper-port').hide().fadeIn(400, function(){
							$(this).css({height: ($containerSmallHeight-1)}); // resize Nav Buttons height
							$('#prev-wrapper-port').hide();
						});
					});
				}
			}
		});
	} // End function resizeWindow2()
	
	var resizeTimer = null;
	$(window).bind('resize', function() {
	    if (resizeTimer) clearTimeout(resizeTimer);
	    resizeTimer = setTimeout(resizeWindow2, 200);
	});
	/* END RESIZE TIMER */
	
	// Window width variable
	
		
	// Update #container Height - BIG - SMALL - VIDEO
	function resizeContainerHeight2() {

		var windowWidth = $(window).width();
		var videoExist = $('#post').hasClass('category-video'); // If video exist
		var videoID = $('#post').find('object').attr('id');
		
		if(videoExist == true){
			if(videoID == 'video-player-990'){
			var containerHeight = $containerBigVideo;
			} else if(videoID == 'video-player-720'){
			var containerHeight = $containerSmallVideo;
			}
		} else if(videoExist == false) {
			if(windowWidth >= $bigRes){
			var containerHeight = $containerBigHeight;
			} else if(windowWidth <= $smallRes){
			var containerHeight = $containerSmallHeight;
			}
		}
		
		/* Delay */
		$('#container-port').delay(400).animate({height: containerHeight}, $speedOpenClose, $easing2);
		$('#prev-wrapper-port, #next-wrapper-port').delay(400).animate({height: containerHeight - 1}, $speedOpenClose, $easing2);
		
	} // End function resizeContainerHeight2()

	// THUMBS
	function thumbsActionPort2() {
		
	
		$('#thumbs-port li .wp-post-image').css({opacity: 0.65});
	
		// Hover effect
		$('#thumbs-port li span.title').css({opacity: 0});
		$('#thumbs-port li a').hover(function(){
			$(this).find('.wp-post-image').stop().animate({opacity: 1}, 200);
			$(this).find('.title').stop().animate({top: 145, opacity: 1}, 200);
			$(this).find('.markup').stop().animate({opacity: 0}, 200);
		}, function(){
			$(this).find('.wp-post-image').stop().animate({opacity: .65}, 500);
			$(this).find('.title').stop().animate({top: 140, opacity: 0}, 200);
			$(this).find('.markup').stop().animate({opacity: 1}, 200);
		});

		// Window width variable
		var windowWidth = $(window).width();
						
	} // End thumbsActionPort2()
	
	
	function navButtons2(){
	
		// Paragraph effect
		if (!$.browser.msie){ /* Not Enabled on IE */
			$('.project-content p').css({opacity: .65});
			$('.project-content').hover(function(){
	    		$(this).find('p').stop().animate({opacity: .99}, 600);
	    	}, function(){
	    		$(this).find('p').stop().animate({opacity: .65}, 300);
	    	});
    	}
    	
    	// INNER PREV & NEXT BUTTONS PROJECTS
    	// Hover
    	var allButtons = $('.project-nav .next-project, .project-nav .prev-project, .project-nav .go-website');
    	
    	$(allButtons).append('<span class="hover">hover</span>');
    	$(allButtons).find('.hover').css({opacity: 0});
    	
    	$(allButtons).hover(function(){
    		$(this).find('.hover').stop().animate({opacity: 1}, 500, $easing2);
    		$(this).stop().animate({width: 148}, 300, $easing2);
    	}, function(){
    		$(this).stop().animate({width: 43}, 600, $easing2, function(){
    			$(this).find('.hover').stop().animate({opacity: 0}, 200, $easing2);
    		});
    	});
    	
    	
    	
    	// Window width variable
		var windowWidth = $(window).width();
    	
		// CLOSE HOVER
    	$('.project-nav .close, .project-nav .home').append('<span class="hover">hover</span>');
    	$('.project-nav .close, .project-nav .home').find('.hover').css({opacity: 0});
    	$('.project-nav .close, .project-nav .home').hover(function(){
    		$(this).find('.hover').stop().animate({opacity: 1}, 500, $easing2);
    	}, function(){
    		$(this).find('.hover').stop().animate({opacity: 0}, 200, $easing2);
    	});

    	// Close Project
		$('.project-nav .next-project, .project-nav .prev-project').click(function(){
		
			var postURL = $(this).attr('href');
			
			$('#nav-port .project-nav').fadeOut(200, function(){ $(this).remove(); });
			$('#prev-wrapper-port, #next-wrapper-port').fadeOut(200); // desactivate
				
			$('#post').stop().animate({opacity: 0}, $speedOpenClose, $easing, function(){
				
				$('#container-port').html('').load(postURL + ' #post',{data: windowWidth}, function() {
					
					$(this).find('#post').css({opacity: 0}).stop().animate({opacity: 1}, $speedOpenClose, $easing2);
					projectCss2();
	  	  			navButtons2();
	  	  			
	  	  			resizeContainerHeight2();
				});
			});
			return false;
		})
		
		// Change width #container if smaller images
		var $galleryExist = $('.gallery').size();
		var nbrImgs = $('.gallery li').size();
			
		if($galleryExist == 1){
			var imgSrcName = $('.gallery li img').attr('src').slice(-12); // !important
			if(imgSrcName == '-720x509.jpg'){ // if Small images, resize .gallery
				$('.gallery').css({width: ((nbrImgs*$widthSmallImgs) + $widthDesc)});
			}
		}
		
		
	}
	
	
	projectCss2();
	thumbsActionPort2();
	navButtons2();
	
	
	// CLIENTS - Testify (News Ticker)
	var first = 0;
	var speed = 700;
	var pause = 12000;
	
	function removeFirst2(){
		first = $('ul#listticker li:first').html();
		$('ul#listticker li:first').fadeOut(speed, function() {
			$(this).remove();
			});
		$('ul#listticker li:nth-child(2)').fadeOut(speed);
		addLast2(first);
	}
	function addLast2(first){
		last = first+'';
		$('ul#listticker').append('<li class="quote-wrapper">' + last + '</li>');
		$('ul#listticker li:nth-child(2)').fadeIn(speed);
	}
	
	interval = setInterval(removeFirst2, pause);
		
	// BIG PREV - NEXT BUTTONS : HOVER
	if (!$.browser.msie) { /* Fix defaut alpha bug : IE7 IE8 */
		$('#next-wrapper-port, #prev-wrapper-port').css({opacity: $defautAlphaBigNav});
		$('#next-wrapper-port .bg-arrows, #prev-wrapper-port .bg-arrows').css({opacity: $bgNav});
	}
	
	$('#next-wrapper-port, #prev-wrapper-port').hover(function(){
		$(this).stop().animate({opacity: $hoverAlphaBigNav}, 300);
	}, function(){
		$(this).stop().animate({opacity: $defautAlphaBigNav}, 150);
	});	
		
	// HORIZONTAL SCROLLING
	
	// END SCROLLING
	

	// NAV ARROWS - PREV / NEXT
	
	
	// NEXT & PREV BUTTONS FOLLOW THE MOUSE 
    $('#prev-wrapper-port').hide();
    
	// next
	$("#next-wrapper-port").mousemove(function(e){
		
		if($('.gallery li.current').hasClass('last')){
			$('#next-wrapper-port').fadeOut(100);
		}
	
		var secondSecondLast = $('#thumbs-port li:last').prev().prev(); 
		var secondLast = $('#thumbs-port li:last').prev();
		var last = $('#thumbs-port li:last'); 
	
		if(secondSecondLast.hasClass('current') || secondLast.hasClass('current') || last.hasClass('current')){
			$('#next-wrapper-port').fadeOut(100);
		}
		
		// Fix for scrolling #thumbs
		// calculate scrolls & width datas
        var $leftScrollValue = $('#container-port').scrollLeft();
		var $contentWidthThumbs = $('#thumbs-port').width();
		var $widthContainer = $('#container-port').width();
		var $paddingLeft = 40;
        
       	//  Hide NEXT WRAPPER if : width container + left scroll pos == width content
		if(($widthContainer + $leftScrollValue - $paddingLeft) == $contentWidthThumbs)
		{
			$('#next-wrapper-port').fadeOut(100);
		};

    });
       
    // prev
    $("#prev-wrapper-port").mousemove(function(e){
    
    	var $scrollListener = $('#container-port').scrollLeft();
    	// Hide #prev-wrapper if scrollLeft == 0
	    if($scrollListener == 0) 
		{
			$("#prev-wrapper-port").fadeOut(100);
		}
	    
    });
    
    // SKILLS - hover effect
    // SAVOIR-FAIRE - hover effect
    var allMenuHover = $('.ul-skills li, .logos-cms li, #social-icons li');
    $('.ul-skills li span').append('<span class="hover">hover</span>');
    $('.logos-cms li').append('<span class="hover">hover</span>');
    $('#social-icons li a').append('<span class="hover">hover</span>');
    
    $(allMenuHover).find('.hover').css({opacity: 0});
    
	$(allMenuHover).hover(function(){
		$(this).find('.hover').stop().animate({opacity: 1}, 100);
	}, function(){
		$(this).find('.hover').stop().animate({opacity: 0}, 500);
	});
			
}
