// Smooth Scroll to Top
$(document).ready(function() {
	$('a[href*=#]').click(function() {
	if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
        && location.hostname == this.hostname) {
            var $target = $(this.hash);
            $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
            if ($target.length) {
                var targetOffset = $target.offset().top;
                $('html,body').animate({scrollTop: targetOffset}, 1000);
				
                return false;
            }
        }
    });
	
	$(window).scroll(function(){
		var min = 100;
		var max = 300;
		var scrollYpos = $(document).scrollTop();
		$('#navigation li > a[class]').css("background","white");
		$('#element[class]').each(function (i) {
			var n = $(this).attr('class');
			var npos = $(this).offset().top;
			if ( (min-$(this).height())< ($(this).offset().top-scrollYpos) && ($(this).offset().top-scrollYpos)<max) {
				$('a.'+n).css("background","yellow");
				//alert (n);
			}
		});

	});

});


