$(document).ready(function(){

	if ($('ul.content_list.specifiek').length) {
		//specifiekListHeight = $('ul.content_list.specifiek').height() + 20;
		//inhoudHeight = $('#inhoud').height();
		//$('#inhoud').height(inhoudHeight + specifiekListHeight);
		//footerMarginTop = $('#footer').css('margin-top').replace('px','');
		//alert(specifiekListHeight);
		//$('#footer').css('margin-top', 118+'px');
		//positionFooter();
	}

	$('a#specifiek').click(function() {
	    if ($(this).attr('class') == '')
	    {
	    	$('a#specifiek').text('Specifieke informatie');
			$(this).addClass('active');
			marginAdjuster = $('ul.content_list.specifiek').height() + 20;
			footerMarginTop = $('#footer').css('margin-top').replace('px','');
			footerMarginTop = footerMarginTop - marginAdjuster + 77;
			$('#footer').css('margin-top', footerMarginTop+'px');
			$('ul.content_list.specifiek').animate({
			  opacity: 1,
			  height: 'toggle'
			}, 500, function() {
                if ( $.browser.msie )
                {
                    this.style.removeAttribute('filter');
                }
			});
		}
		else
		{
			$('a#specifiek').text('Klik hier voor specifieke informatie');
			$(this).removeClass('active');
			marginAdjuster = $('ul.content_list.specifiek').height() + 20;
		    footerMarginTop = $('#footer').css('margin-top').replace('px','');
			footerMarginTop = parseInt(footerMarginTop) + parseInt(marginAdjuster)  - 77;
		  	$('#footer').css('margin-top', footerMarginTop+'px');
			$('ul.content_list.specifiek').animate({
			  opacity: 0,
			  height: 'toggle'
			}, 500, function() {
                if ( $.browser.msie )
                {
	                this.style.removeAttribute('filter');
                }
			});
		}
	});
});

function positionFooter() {
	var contentheight = document.body.clientHeight;
	var fullsize = (document.getElementById&&!document.all) ? this.innerHeight : document.documentElement.clientHeight;
	var sizeto = (fullsize > contentheight) ? fullsize : contentheight;

	var box = document.getElementById('box');
	box.style.height = (sizeto) + 'px';
	if (fullsize > contentheight)
	{
		var inhoudsize = document.getElementById('inhoud').clientHeight;
		var leftsize = document.getElementById('left').clientHeight;
		var footer = document.getElementById('footer');
		//alert(sizeto + ' ' + inhoudsize + ' ' + leftsize);
		sizeto = sizeto - 10;
		if ((inhoudsize + 80) > leftsize)
		{
			if (sizeto > (inhoudsize + 80 + 126)) footer.style.marginTop = (sizeto - inhoudsize - 80 - 126) + 'px';
		} else
		{
			if ((sizeto - leftsize - 68 - 126)> 0) footer.style.marginTop = (sizeto - leftsize - 68 - 126) + 'px';
			if ((sizeto - leftsize - 68 - 126)< 0) footer.style.marginTop = (sizeto - leftsize - 126 + 36) + 'px';
		}
	}
	else
	{
		var footer = document.getElementById('footer');
		footer.style.marginTop = 50 + 'px';
	}
}
