var main_div = "";
var webshop = false;
var org_bottom = 0;
var grow_height = 0;

window.onload = function(){
	setContent();
}
function setContent(){
	var hoofdhoogte = document.getElementById('header').clientHeight;;
	var contenthoogte = document.getElementById('content').clientHeight;
	var bottomheight = document.getElementById('bottom').clientHeight;
	var bottom_start_old = document.getElementById('bottom').offsetTop;
	var bottom_start_old2 = document.getElementById('bottom').style.top;
	
	var content_start = document.getElementById('content').offsetTop;
	var oldTotlaal = content_start + contenthoogte;
	
	if(oldTotlaal > org_bottom){
		min_terug = bottom_start_old - org_bottom;
	} else {
		min_terug = 0;
	}
	
	var verschil = 0;
	var gewenst_hoogte_content = document.getElementById(main_div).scrollHeight	;
	gewenst_hoogte_content = gewenst_hoogte_content + document.getElementById(main_div).offsetTop;
	gewenst_hoogte_content = gewenst_hoogte_content - hoofdhoogte;
	
	if(document.getElementById('cat_inhoud') != null){
		if(document.getElementById('cat_inhoud').clientHeight > gewenst_hoogte_content){
			gewenst_hoogte_content = document.getElementById('cat_inhoud').clientHeight;
		}
	}
	
	if(grow_height > gewenst_hoogte_content) { gewenst_hoogte_content = grow_height; }
	verschil = gewenst_hoogte_content - contenthoogte;
	document.getElementById('content').style.height = gewenst_hoogte_content + 'px';
		
	document.getElementById(main_div).style.overflow = 'visible';

	var bottom_start = document.getElementById('bottom').offsetTop;
	array_dom = document.getElementById('hoofd').childNodes;
	
	for(i = 0; i < array_dom.length; i++){
		if(array_dom[i].className == 'static' || array_dom[i].className == 'stxt' || array_dom[i].className == 'stat' || array_dom[i].className == 'imgs'){
			_startx = array_dom[i].offsetLeft; 
			_starty = array_dom[i].offsetTop;
			_height = array_dom[i].clientHeight;
			_totalstart = _starty + _height;

			if((_totalstart > bottom_start_old) && (verschil > 0)){
				array_dom[i].style.top = ( _starty + verschil - min_terug) + 'px';
			} 
		} else {
			if(typeof(array_dom[i].id) != 'undefined' && array_dom[i].className != 'txt'){
				//array_dom[i].style.overflow = 'hidden';
			}
		}
	}
}

$(function() {
	 $('#gallery a').lightBox();
});

$("#pageflip").hover(function() { //On hover...
	$("#pageflip img , .msg_block").stop()
		.animate({ //Animate and expand the image and the msg_block (Width + height)
			width: '307px',
			height: '319px'
		}, 500);
	} , function() {
	$("#pageflip img").stop() //On hover out, go back to original size 50x52
		.animate({
			width: '50px',
			height: '52px'
		}, 220);
	$(".msg_block").stop() //On hover out, go back to original size 50x50
		.animate({
			width: '50px',
			height: '50px'
		}, 200); //Note this one retracts a bit faster (to prevent glitching in IE)
});