function cufonInit(){
	Cufon.replace('#content h2');
	Cufon.replace('h3');
	Cufon.replace('#content h4');
	Cufon.replace('#menu:has(ul) > li a', {hover: true});
	Cufon.replace('#submenu li a', {hover: true});
	//Cufon.replace('.labelinhoud');
	Cufon.replace('.terug', {hover: true});
	Cufon.replace('.knop');
	Cufon.replace('#footermenu li a');
	Cufon.replace('.bottom a');
	
}

var formVeranderd = 0;

$(document).ready(function(){
	/*
	$('#kolom2 .vlak').each(function(){
		var hoogtes = new Array(170,195,220,245,270,295,320,345,370,395,420,445,470,495,520,545,570,595,620);
		var hoogte = this.offsetHeight;
		for (i in hoogtes){
			if (hoogte<hoogtes[i] || hoogtes[i]==620){
				var nieuwehoogte = hoogtes[i]-parseInt($(this).css('paddingTop'))-parseInt($(this).css('paddingBottom'));
				$(this).css('background-image','url(/media/images/zijmenu'+hoogtes[i]+'.gif)').css('height',nieuwehoogte+'px');
				break;
			}
		}
	});
	*/
	if ($('.medewerker').length){
		//setTimeout("$('.medewerker').fadeOut(3000);",500);
		so_init();
		so_init2();
	}

	if($('#kolom2').is(':empty'))
	{
		$('#kolom2').hide();
		$('#kolom1').css('width','930px');
	}
});

var meldingVerbergen = 0;

// Variabele en functie om te controleren of een pagina gewijzigd is
function confirmExit(melding) {
	if (formVeranderd && !confirm(melding)) {
		return false;
	}
	else {
		return true;
	}
}

function carouselInit(){
    $("#slides").jCarouselLite({
        btnNext: ".next",
        btnPrev: ".prev",
        pause: ".pause",
        auto:3000,
        speed:700,
        start: 0,
        visible:2
    });
}

// fader voor homepagina
var d=document, imgs = new Array(), imgs2 = new Array(), zInterval = null, current=0, current2=0, pause=false, wachten = 5000;

function so_init() {
	if(!d.getElementById || !d.createElement)return;

	imgs = $('.medewerker');
	for(i=1;i<imgs.length;i++)
		imgs[i].xOpacity = 0;
	imgs[0].style.display = "block";
	imgs[0].xOpacity = .99;

	setTimeout(so_xfade,wachten);
}
function so_xfade() {
	cOpacity = imgs[current].xOpacity;
	nIndex = imgs[current+1]?current+1:0;

	nOpacity = imgs[nIndex].xOpacity;

	cOpacity-=.07;
	nOpacity+=.07;

	imgs[nIndex].style.display = "block";
	imgs[current].xOpacity = cOpacity;
	imgs[nIndex].xOpacity = nOpacity;

	setOpacity(imgs[current]);
	setOpacity(imgs[nIndex]);

	if(cOpacity<=0) {
		imgs[current].style.display = "none";
		current = nIndex;
		setTimeout(so_xfade,wachten);
	} else {
		setTimeout(so_xfade,25);
	}

	function setOpacity(obj) {
		if(obj.xOpacity>.99) {
			obj.xOpacity = .99;
			return;
		}
		obj.style.opacity = obj.xOpacity;
		obj.style.MozOpacity = obj.xOpacity;
		obj.style.filter = "alpha(opacity=" + (obj.xOpacity*100) + ")";
	}
}

function so_init2() {
	if(!d.getElementById || !d.createElement)return;

	imgs2 = $('.labelinhoud');
	for(i=1;i<imgs2.length;i++)
		imgs2[i].xOpacity = 0;
	imgs2[0].style.display = "block";
	imgs2[0].xOpacity = .99;

	setTimeout(so_xfade2,wachten);
}
function so_xfade2() {
	cOpacity = imgs2[current2].xOpacity;
	nIndex = imgs2[current2+1]?current2+1:0;

	nOpacity = imgs2[nIndex].xOpacity;

	cOpacity-=.07;
	nOpacity+=.07;

	imgs2[nIndex].style.display = "block";
	imgs2[current2].xOpacity = cOpacity;
	imgs2[nIndex].xOpacity = nOpacity;

	setOpacity(imgs2[current2]);
	setOpacity(imgs2[nIndex]);

	if(cOpacity<=0) {
		imgs2[current2].style.display = "none";
		current2 = nIndex;
		setTimeout(so_xfade2,wachten);
	} else {
		setTimeout(so_xfade2,25);
	}

	function setOpacity(obj) {
		if(obj.xOpacity>.99) {
			obj.xOpacity = .99;
			return;
		}
		obj.style.opacity = obj.xOpacity;
		obj.style.MozOpacity = obj.xOpacity;
		obj.style.filter = "alpha(opacity=" + (obj.xOpacity*100) + ")";
	}
}

(function($) { 
        $.fn.customFadeIn = function(speed, callback) { 
                $(this).fadeIn(speed, function() { 
                        if(jQuery.browser.msie) 
                                $(this).get(0).style.removeAttribute('filter'); 
                        if(callback != undefined) 
                                callback(); 
                }); 
        }; 
        $.fn.customFadeOut = function(speed, callback) { 
                $(this).fadeOut(speed, function() { 
                        if(jQuery.browser.msie) 
                                $(this).get(0).style.removeAttribute('filter'); 
                        if(callback != undefined) 
                                callback(); 
                }); 
        }; 
})(jQuery); 
