var main_div = "";
var webshop = false;
var org_bottom = 0;
var grow_height = 0;

function windowOnload(){
	setContent();
};
function setContent(){
	
	// CONTENT
	var offset			= $('#content').offset();
	var height			= $('#content').height();
	
	var content			= {};
		content.height  = height;
		content.bottom	= offset.top + height;
			
	// FOOTER
	var offset			= $('#bottom').offset();
	
	var footer			= {};
		footer.top		= offset.top;
	
	// VERSCHIL
	var _correctie		= _correctie||0;
	var org_bottom		= org_bottom||0;
	
	var cnt_max = 0;
	$('#hoofd div').each(function(index){
		switch($(this).attr('id')) {
		case 'header':
		case 'content':
		case 'bottom':
			// skipp
			break;
		default:
			var offset 			= $(this).offset();
			var height 			= $(this).height() + offset.top;
			if(offset.top<footer.top) {
			cnt_max				= (height>cnt_max?height:cnt_max);
			}
		}
	});
	
	// producten in txt element
	$('.txt div').each(function(index){
		// alleen als parent txt top < footer.top
		if($(this).parent().offset().top<footer.top) {
			var offset 			= $(this).offset();
			var height 			= $(this).height() + offset.top;
			cnt_max				= (height>cnt_max?height:cnt_max);
		}
	});
	
	var verschil		= cnt_max - footer.top + _correctie;
	
	if(verschil>0) {
		verschil += 20; // ruimte tussen main en footer
		
		// increase content height
		$('#content').css('height',content.height + verschil);
		
		$('#hoofd div').each(function(index){
			var className = $(this).attr('class');
			switch(className) {
				case 'static':
				case 'stxt':
				case 'stat':
				case 'imgs':
				case 'simg':
				case 'show':
					// DIV
					var offset 			= $(this).offset();
					var div				= {};
						div.top			= offset.top;
	
					// 100 == fix voor kruisweg
					if((div.top+100)>footer.top) {
					$(this).css('top',div.top + verschil);
					}
					
					break;
				default:
					// nothing
			}
		});
	}
}

$(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)
});
