window.addEvent('domready', function() {
		$('stap2').setStyle('display', 'none');
		$('stap3').setStyle('display', 'none');
});

function ajaxupdate(url, target){
	new Ajax(url, {
		method: 'get',
		update: target
	}).request();
}

function ajaxformupdate(url, target, form){
	new Ajax(url, {
		method: 'post',
		data: form,
		update: target
	}).request();
}
	
function ShowNext(step, datum){

	var url = 'index.php?ajax=true&random=' + Math.random(0,100) + '&step=' + step + '&datum=' + datum ;  
	if (datum != ""){
		if (step == '2'){
			var ajax = ajaxupdate(url, 'stap2' + 'target');
			$('stap2').setStyle('display', 'inline');
			$('stap3').setStyle('display', 'none');	
		} else 	if (step == '3'){
			var ajax = ajaxupdate(url, 'stap3' + 'target');	
			$('stap3').setStyle('display', 'inline');
		} else if (step == 'formcheck'){			
			var url2 = 'index.php?ajax=true&random=' + Math.random(0,100) + '&step=' + 2 + '&datum=' + datum ; 
			var ajax = ajaxupdate(url2, 'stap2' + 'target');	
			var ajax = ajaxformupdate(url, 'stap3' + 'target', $('stap3') );	
			return false;			
		} else if (step == 'nieuweafspraak'){
			$('afspraakform').send();
			var ajax = ajaxformupdate(url, 'webagendastappen', $('stap3') );	
			return false;
		}
	} else {
		if (step == '2'){
			$('stap2').setStyle('display', 'none');
			$('stap3').setStyle('display', 'none');	
		} else 	if (step == '3'){
			$('stap3').setStyle('display', 'none');		
		}
	}
}
