function weblogNextBlok() {
	var bloks = $(document).find('.weblogblok');
	var secties = Math.ceil(bloks.length / 4);
	var actief = '';

	for(var i=1;i < (secties+1);i++) {
		if($('.weblogblok'+i).css('display') == 'block') {
			actief = i;
		}
	}
	var volgende = parseInt(actief+1);
	if(volgende > secties) {
		volgende = 1;
	}
	$('.weblogblok'+actief).fadeOut('fast',function(){
		$('.weblogblok'+volgende).fadeIn('fast');
	});
}

function weblogPreviousBlok() {
	var bloks = $(document).find('.weblogblok');
	var secties = Math.ceil(bloks.length / 4);
	var actief = '';

	for(var i=1;i < (secties+1);i++) {
		if($('.weblogblok'+i).css('display') == 'block') {
			actief = i;
		}
	}
	var vorige = parseInt(actief-1);
	if(vorige < 1) {
		vorige = secties;
	}
	$('.weblogblok'+actief).fadeOut('fast',function(){
		$('.weblogblok'+vorige).fadeIn('fast');
	});
}

function themaNextBlok() {
	var bloks = $(document).find('.themablok');
	var secties = Math.ceil(bloks.length / 4);
	var actief = '';

	for(var i=1;i < (secties+1);i++) {
		if($('.themablok'+i).css('display') == 'block') {
			actief = i;
		}
	}
	var volgende = parseInt(actief+1);
	if(volgende > secties) {
		volgende = 1;
	}
	$('.themablok'+actief).fadeOut('fast',function(){
		$('.themablok'+volgende).fadeIn('fast');
	});
}

function themaPreviousBlok() {
	var bloks = $(document).find('.themablok');
	var secties = Math.ceil(bloks.length / 4);
	var actief = '';

	for(var i=1;i < (secties+1);i++) {
		if($('.themablok'+i).css('display') == 'block') {
			actief = i;
		}
	}
	var vorige = parseInt(actief-1);
	if(vorige < 1) {
		vorige = secties;
	}
	$('.themablok'+actief).fadeOut('fast',function(){
		$('.themablok'+vorige).fadeIn('fast');
	});
}

function fotoNextBlok() {
	var bloks = $(document).find('.fotoblok');
	var secties = Math.ceil(bloks.length / 4);
	var actief = '';

	for(var i=1;i < (secties+1);i++) {
		if($('.fotoblok'+i).css('display') == 'block') {
			actief = i;
		}
	}
	var volgende = parseInt(actief+1);
	if(volgende > secties) {
		volgende = 1;
	}
	$('.fotoblok'+actief).fadeOut('fast',function(){
		$('.fotoblok'+volgende).fadeIn('fast');
	});
}

function fotoPreviousBlok() {
	var bloks = $(document).find('.fotoblok');
	var secties = Math.ceil(bloks.length / 4);
	var actief = '';

	for(var i=1;i < (secties+1);i++) {
		if($('.fotoblok'+i).css('display') == 'block') {
			actief = i;
		}
	}
	var vorige = parseInt(actief-1);
	if(vorige < 1) {
		vorige = secties;
	}
	$('.fotoblok'+actief).fadeOut('fast',function(){
		$('.fotoblok'+vorige).fadeIn('fast');
	});
}

function printContent(content) {
	var disp_setting =  "toolbar=yes,location=no,directories=yes,menubar=yes,";
		disp_setting += "scrollbars=yes,width=650, height=600, left=100, top=25";

	var docprint = window.open("","",disp_setting);
	docprint.document.open();
	docprint.document.write('<html><head><title>Controllersmagazine.nl</title>');
	docprint.document.write('<link rel="stylesheet" href="/print.css" type="text/css" />');
	docprint.document.write('</head><body onload="self.print()">');
	docprint.document.write('<img src="/images/controllersmagazine_zwwkopie.gif"><br /><br />'+content);
	docprint.document.write('</body></html>');
	docprint.document.close();
	docprint.focus();
}

function resizeTextUp(obj) {
	var currentFontSize = $('#printContent').css('font-size');
    var currentFontSizeNum = parseFloat(currentFontSize, 10);

    if( currentFontSizeNum == 10 ) {
   		$('#printContent').css('font-size', '11px');
  		$('#printContent').css('line-height', '15px');
	}

    if( currentFontSizeNum == 11 ) {
   		$('#printContent').css('font-size', '12px');
  		$('#printContent').css('line-height', '17px');
	}

	if( currentFontSizeNum == 12 ) {
   		$('#printContent').css('font-size', '13px');
  		$('#printContent').css('line-height', '19px');
	}
	if( currentFontSizeNum == 13 ) {
   		$('#printContent').css('font-size', '14px');
   		$('#printContent').css('line-height', '20px');
	}
}

function resizeTextDown(obj) {
	var currentFontSize = $('#printContent').css('font-size');
    var currentFontSizeNum = parseFloat(currentFontSize, 10);

    if( currentFontSizeNum == 14 ) {
   		$('#printContent').css('font-size', '13px');
  		$('#printContent').css('line-height', '19px');
	}

    if( currentFontSizeNum == 13 ) {
   		$('#printContent').css('font-size', '12px');
  		$('#printContent').css('line-height', '17px');
	}

	if( currentFontSizeNum == 12 ) {
   		$('#printContent').css('font-size', '11px');
  		$('#printContent').css('line-height', '15px');
	}
	if( currentFontSizeNum == 11 ) {
   		$('#printContent').css('font-size', '10px');
   		$('#printContent').css('line-height', '14px');
	}
}

function meldReactie(idcontentreactie) {
	$.ajax({
		type: "POST",
		url: "/ajax/ajax.post.php",
		data: "act=meldReactie&idcontentreactie="+idcontentreactie+'&uri='+document.location,
		success: function(msg) {
			//alert('Bedankt, er is een melding gemaakt van deze reactie.');
			$('#melden'+idcontentreactie).html(' Bedankt, er is een melding gemaakt van deze reactie');
		}
	});
}

function clearField(obj,value) {
	if($(obj).val() == value) {
		$(obj).val('');
	} else if( $(obj).val() == '' ) {
		$(obj).val(value);
	}
}

function stuurdoorEmail() {
	$('.alertBox').css('display','none');
	$('.alertBoxGreen').css('display','none');
	jQuery.ajax({
		type: "POST",
		url: "/ajax/ajax.post.php",
		data: "act=stuurdoor&"+$('#stuurdoorform').formSerialize(),
		success: function(msg) {
			if(msg == 'go') {
				$('.alertBoxGreen')
				.fadeIn('slow')
				.animate({opacity: 1.0}, 2000);
				$('.alertBoxGreen').html('Je e-mail is met succes verzonden.');
			} else {
				$('.alertBox')
				.fadeIn('slow')
				.animate({opacity: 1.0}, 2000);
				$('.alertBox').html(msg);
			}
		}
	});
}

function gotoDate(id) {
	var maand = $('#'+id+' [name=maand]').fieldValue();
	var jaar = $('#'+id+' [name=jaar]').fieldValue();
	if(jaar != '' && maand != '') {
		document.location = '/carriere/educatie/'+jaar+'/'+maand;
	}
}