function wwwautoschadeoranjedorp_screenpos() {
	wwwautoschadeoranjedorp_top  = ($(window).height() - $('#thewhole').height()) / 2;
	wwwautoschadeoranjedorp_left = ($(window).width() - $('#thewhole').width()) / 2;
	if (wwwautoschadeoranjedorp_top < 0) {
		wwwautoschadeoranjedorp_top = 0
	}
	if (wwwautoschadeoranjedorp_left < 0) {
		wwwautoschadeoranjedorp_left = 0
	} 
		$('#thewhole').animate({top: wwwautoschadeoranjedorp_top, left: wwwautoschadeoranjedorp_left}, 1);
}

function GenericClickHandler() {
	wwwautoschadeoranjedorp_pagename = $(this).attr('id');
	LoadPage(wwwautoschadeoranjedorp_pagename);
	return false;
};


function LoadPage(aPageName) {
	$.get('pages/' + aPageName + '.titel.html',function (result) {
		$('#titel').html(result);
		document.title = result;
	});
	$.get('pages/' + aPageName + '.body.html',function (result) {
//*		$('li>a').unbind('click', GenericClickHandler);
		$('#body').html(result);
//*		$('li>a').bind('click', GenericClickHandler);
	});
}


$(document).ready(function(evt) {
	// Events
	$(window).resize(function(evt){
		wwwautoschadeoranjedorp_screenpos();
	});

	// Others
	wwwautoschadeoranjedorp_screenpos();

	// Test
//	LoadPage('uitbreiding');	
//	$.get('parts/menu.html', {}, function (result) {
//		$('.menu').html(result);
//		$('#onderhoud').html('');
//*		$('li>a').bind('click', GenericClickHandler);
//*		$('li>a').click(function(evt){return false});
//	});
});
