// Viewport plugin
/*(function($){$.belowthefold=function(element,settings){var fold=$(window).height()+$(window).scrollTop();return fold<=$(element).offset().top-settings.threshold;};$.abovethetop=function(element,settings){var top=$(window).scrollTop();return top>=$(element).offset().top+$(element).height()-settings.threshold;};$.rightofscreen=function(element,settings){var fold=$(window).width()+$(window).scrollLeft();return fold<=$(element).offset().left-settings.threshold;};$.leftofscreen=function(element,settings){var left=$(window).scrollLeft();return left>=$(element).offset().left+$(element).width()-settings.threshold;};$.inviewport=function(element,settings){return!$.rightofscreen(element,settings)&&!$.leftofscreen(element,settings)&&!$.belowthefold(element,settings)&&!$.abovethetop(element,settings);};$.extend($.expr[':'],{"below-the-fold":function(a,i,m){return $.belowthefold(a,{threshold:0});},"above-the-top":function(a,i,m){return $.abovethetop(a,{threshold:0});},"left-of-screen":function(a,i,m){return $.leftofscreen(a,{threshold:0});},"right-of-screen":function(a,i,m){return $.rightofscreen(a,{threshold:0});},"in-viewport":function(a,i,m){return $.inviewport(a,{threshold:0});}});})(jQuery);*/

// Main functions
//$(document).ready(function(){
	
	/*maDiv = document.createElement("div");
	maDiv.id = 'tooltip';
	maDiv.innerHTML = 'infos';
	document.body.appendChild(maDiv);
		
	var top = $('.container').position().top;
	$(window).scroll(function () {
		var y = $(this).scrollTop();
		if (y >= 0 && y <= 356) {
			maDiv.innerHTML = 'STUDIO';
		} else if (y >= 357 && y <= 1020) {
			maDiv.innerHTML = 'REELS';
		} else if (y >= 1021 && y <= 1646) {
			maDiv.innerHTML = 'WORK';
		} else if (y >= 1647) {
			maDiv.innerHTML = 'CONTACT';
		}
	});
	
	// Navbar active class
	$(window).scroll(function () {
		var inview = '#' + $(".container:in-viewport:first").attr('id');
		var $link = $('#menu-top-menu li a').filter('[hash=' + inview + ']');
		var active = $link.is('.highlight');
		if ($link.length && !active) {
			$('#menu-top-menu li a').removeClass('highlight');
			$link.addClass('highlight');
		}
	});*/
	
	//////////////////////////////////////////////////////
	// Navbar active class
	/*$(window).scroll(function () {
		var y = $(this).scrollTop();
		if (y >= 0 && y <= 356) {
			$('#menu-item-26 a').addClass('highlight');
			$('#menu-item-27 a').removeClass('highlight');
			$('#menu-item-28 a').removeClass('highlight');
			$('#menu-item-29 a').removeClass('highlight');
		} else if (y >= 357 && y <= 1020) {
			$('#menu-item-26 a').removeClass('highlight');
			$('#menu-item-27 a').addClass('highlight');
			$('#menu-item-28 a').removeClass('highlight');
			$('#menu-item-29 a').removeClass('highlight');
		} else if (y >= 1021 && y <= 1646) {
			$('#menu-item-26 a').removeClass('highlight');
			$('#menu-item-27 a').removeClass('highlight');
			$('#menu-item-28 a').addClass('highlight');
			$('#menu-item-29 a').removeClass('highlight');
		} else if (y >= 1647) {
			$('#menu-item-26 a').removeClass('highlight');
			$('#menu-item-27 a').removeClass('highlight');
			$('#menu-item-28 a').removeClass('highlight');
			$('#menu-item-29 a').addClass('highlight');
		}
	});*/
	//////////////////////////////////////////////////////
		
//});

$(document).ready(function(){
	
	$("#menu-top-menu li a:first").addClass("highlight");
	
	function a(){
		var d=$(window).scrollTop();
		$(".container").each(function(){
			var e=$(this).offset().top + 65;
			var g=$(this).height() + 65;
			var f=e+g;
			if(f>d){
				c($(this).attr("id"));
				return false;
			}
		})
	}
	
	function c(d){
		$("#menu-top-menu li a").removeClass("highlight");
		$('a[href="#'+d+'"]').addClass("highlight");
	}
	
	$(window).scroll(a);
	
});

