		var windowHeight;
		var pageHeight;
		var Timer;
		var slideTime = 6;
		$(document).ready(function(){
			setFooterItems();
			$('a.email').nospam({ replaceText:true });
			$("#kruimelpad li:last").css("backgroundImage","none");
			$(window).resize(function(){
				footerLocation();
			}).trigger('resize');
			showTabs();
			runSlideShow();
			if($("#submenu li").length < 1) $("#submenu").parent("div:first").hide();
			if($("#note").text().length > 4) $("#note").slideDown();
			$("a, li").focus(function(){
				$(this).blur();
			});
			if($("#submenu ul").length < 1){
				var list = $("#submenu").html();
				$("#submenu").empty();
				var newlist = $("<li><ul></ul></li>");
				$("#submenu").append(newlist).find("ul:first").append(list);
			}
			$("#sitemenu_li_"+activemenuid).addClass("active");
		});
		
		function footerLocation(){
			$("#footer").css({position:'relative'});
			var wrap = "wrapper";
			$("#"+wrap).css("height","auto");
			windowHeight = $(window).height();
			pageHeight = $("#"+wrap).height();
			if(windowHeight > pageHeight){
				$("#footer").css({position:'absolute',bottom:0});
				$("#"+wrap).css("height",windowHeight);
			}
			$("#footer").fadeIn(200);
		}
		
		function setFooterItems(){
			var oplossingenid	= 3;
			var dienstenid		= 12;
			var oplossingenHtml = $("#sitemenu_li_"+oplossingenid).find("ul:first").html();
			var dienstenHtml = $("#sitemenu_li_"+dienstenid).find("ul:first").html();
			$("#footer_oplossingen").html(oplossingenHtml);
			$("#footer_diensten").html(dienstenHtml);
		}
		
		function runSlideShow(){
			clearTimeout(Timer);
			var currentSlide = 0;
			var max = 0;
			var aantal = 0;
			$("#illustraties li").each(function(i){
				aantal++;
				if($(this).hasClass("active")) {
					currentSlide = i;
				}
				max = i;
			});
			if(aantal < 2) return true;
			
			var nextSlide = currentSlide+1;
			if(nextSlide > max) nextSlide = 0;
			var _slideTime = slideTime*1000;
			var next = $("#illustraties li:eq("+nextSlide+")");
			Timer = setTimeout(
							function(){
								showSlide(next, nextSlide);
							},
							_slideTime
						);
		}
		
		function showSlide(obj, num){
				if($(obj).hasClass("active")) return false;
				var mycurrent = $("#illustraties li.active");
				mynext = $(obj);
				mynext.hide();
				mycurrent.fadeOut('slow');
				mynext.fadeIn('slow',function(){
					mycurrent.removeClass("active");
					mynext.addClass("active");
					$("#tab li").removeClass("active");
					$("#tab li:eq("+num+")").addClass("active");
					runSlideShow();
				});
		}

		function showTabs(){
			var active = 0;
			var aantal = 0;
			$("#illustraties li").each(function(i){
				aantal++;
				active = 0;
				if($(this).hasClass("active")) {
					active = 1;
				}
				var j = i+1;
				var tab = $("<li rel='"+i+"'>"+j+"</li>");
				if(active == 1)	$(tab).addClass("active");
				$(tab).appendTo("#tab");
			});
			if(aantal < 2){
				$("#tab").remove();
			}else{
				$("#tab li").each(function(i){
					$(this).click(function(){
						var slide = $("#illustraties li:eq("+i+")");
						showSlide($(slide),i);
					});
				});	
			}
		}
