// ajax script voor vervangen innerHTML van elementen met responseText van XMLHttp-object

// functie voor verschijnen divs
function fadeIn(){
	var wwidth = $(window).width();
	var wheight = $(window).height();
	$("#filter").width(wwidth);
	$("#filter").height(wheight);	
	var main = $("#main");
	main.width(wwidth*0.8);
	main.height(wheight*0.65);
	main.css('top', (wheight*0.15)); 
	main.css('left', (wwidth *0.08));
	var terug = $("#terug");
	terug.css('top', (wheight*0.16));
	terug.css('right', (wwidth *0.09));
	$("#filter").animate({ opacity: 0.90 }, "slow");
	$("#filter").show("slow");
}

// ajax functie
function divSwitcher() 
{
	var args = divSwitcher.arguments;
	switch (args[0]) 
	{
		case "load_page":
		if (document.getElementById)
		{
			var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
		}
		if (x)
		{
			x.onreadystatechange = function ()
			{
				if (x.readyState == 4 && x.status == 200)
				{	
					el = document.getElementById(args[2]);
					
					el.innerHTML = x.responseText;
				}
			}
			x.open("GET", args[1], true);
			x.send(null);
		}
		else 
		{
		         alert("Uw browser ondersteund geen AJAX. Update uw browser...");
		}
		break;

		case "bonhoeffer1a":
		fadeIn();
		divSwitcher('load_page', 'inhoud/Bonhoeffer1a.html', 'main');
		$('#main').animate({scrollTop:0}, 'fast'); 
		break;
		case "bonhoeffer1b":
		fadeIn();
		divSwitcher('load_page', 'inhoud/Bonhoeffer1b.html', 'main');
		$('#main').animate({scrollTop:0}, 'fast'); 
		break;
		case "bonhoeffer2a":
		fadeIn();
		divSwitcher('load_page', 'inhoud/Bonhoeffer2a.html', 'main');
		break;
		case "bonhoeffer2b":
		fadeIn();
		divSwitcher('load_page', 'inhoud/Bonhoeffer2b.html', 'main');
		$('#main').animate({scrollTop:0}, 'fast'); 
		break;
		case "bonhoeffer3a":
		fadeIn();
		divSwitcher('load_page', 'inhoud/Bonhoeffer3a.html', 'main');
		break;
		case "bonhoeffer3b":
		fadeIn();
		divSwitcher('load_page', 'inhoud/Bonhoeffer3b.html', 'main');
		$('#main').animate({scrollTop:0}, 'fast'); 
		break;
		case "nieuwleven":
		fadeIn();
		divSwitcher('load_page', 'inhoud/nieuwleven.html', 'main');
		$('#main').animate({scrollTop:0}, 'fast'); 
		break;
		case "atheoi1":
		fadeIn();
		divSwitcher('load_page', 'inhoud/Atheoi1.html', 'main');
		break;
		case "atheoi2":
		fadeIn();
		divSwitcher('load_page', 'inhoud/Atheoi2.html', 'main');
		$('#main').animate({scrollTop:0}, 'fast'); 
		break;
		case "zondergod1a":
		fadeIn();
		divSwitcher('load_page', 'inhoud/zondergod1a.html', 'main');
		break;
		case "zondergod1b":
		fadeIn();
		divSwitcher('load_page', 'inhoud/zondergod1b.html', 'main');
		$('#main').animate({scrollTop:0}, 'fast'); 
		break;
		case "zondergod2a":
		fadeIn();
		divSwitcher('load_page', 'inhoud/zondergod2a.html', 'main');
		break;
		case "zondergod2b":
		fadeIn();
		divSwitcher('load_page', 'inhoud/zondergod2b.html', 'main');
		$('#main').animate({scrollTop:0}, 'fast'); 
		break;
		case "spinvis1":
		fadeIn();
		divSwitcher('load_page', 'inhoud/Jeweethoe1.html', 'main');
		break;
		case "spinvis2":
		fadeIn();
		divSwitcher('load_page', 'inhoud/Jeweethoe2.html', 'main');
		$('#main').animate({scrollTop:0}, 'fast'); 
		break;
		case "gebed":
		fadeIn();
		divSwitcher('load_page', 'inhoud/gebedvoorkinderen.html', 'main');
		$('#main').animate({scrollTop:0}, 'fast'); 
		break;
		case "goddichtbij":
		fadeIn();
		divSwitcher('load_page', 'inhoud/Goddichtbij.html', 'main');
		$('#main').animate({scrollTop:0}, 'fast'); 
		break;
	}
}




