$(function() {
	

	var windowHeight = $(window).height()-50
	$('body .newPage').css('min-height',windowHeight+'px');
	$('body .newPage:last').css('min-height',(windowHeight-500)+'px');
	$('#helloworld').css('min-height',windowHeight+'px');

	var pageHeight = $('#bottomLine').offset().top-27;
	$('#pagesContainer').css('height',pageHeight+80+'px');
	$('#pagesContainer').css('overflow','hidden');

});




	var scrolling = 0;
	function scrollToId(theId) {
		
		
	var pageHeight = $('#bottomLine').offset().top-27;
	$('#pagesContainer').css('height',pageHeight+80+'px');
	$('#pagesContainer').css('overflow','hidden');

		if(theId=="kompetencer" && scrolling==0) {
			$('body #skill').css('display','none')	
		}
		

		
		var offPlus;
		if (theId=="pagesContainer") {
			offPlus = 0;	
		} else {
			offPlus = 25;
		}
		$('html,body').animate({scrollTop: ($("#"+theId).offset().top)+offPlus},1000,function() {
			if(theId=="kompetencer" && scrolling==0) {
				
				var numberOfSkills = $('body #skill').size();
				for (var i=0;i < numberOfSkills;i++) {
					var thisWidth = $('body #skill:eq('+i+')').width();
					$('body #skill:eq('+i+')').css('display','block');
					$('body #skill:eq('+i+')').css('width','0px');
					$('body #skill:eq('+i+')').animate({width:thisWidth+'px'},2000);				
				}
				scrolling = 1;
			}
		});
	}

