Cufon.replace('.nav',{hover: true})('.subnav',{hover: true})('h1')('h2');

$(document).ready(function(){
	
	ulWidth = $('#hoofdnav').width();
	ulLeft = 635 - ulWidth;
	ulChildren = $('#hoofdnav li').length;
	if(ulLeft>0){
		rest = ulLeft%ulChildren;
		pad  = (ulLeft-rest)/ulChildren;
		padrest  = pad%2;
		padleft  = ((pad-padrest)/2) + padrest ;
		padright = (pad-padrest)/2 ;
		$('#hoofdnav li').css({
			paddingLeft: 10+padleft,
			paddingRight: 10+padright
		});
	}		
	
	initLeft 	= $('a.hoofdNavActive').position().left + 215;
	initWidth 	= $('a.hoofdNavActive').width()+10;
	
	$('#hover_element').css({
		left: initLeft, 
		zIndex: 9
	}).find('.hrep').css({
		width: initWidth,
		height: '21px'
	});
	$('#hover_element2').css({
		left: initLeft,
		zIndex: 20
	}).find('.hrep').css({
		width: initWidth,
		height: '21px'
	});
	
	$('a.nav').hover(
		function(){
			
			thisLeft 	= $(this).position().left + 215;
			thisWidth 	= $(this).width()+10;
			
			$('#hover_element').stop(true).animate({
				left: thisLeft
			}, 300).find('.hrep').stop(true).animate({
				width: thisWidth,
				height: '21px'
			}, 300);
		},
		function(){
			$('#hover_element').stop(true).animate({
				left: initLeft
			}, 300).find('.hrep').stop(true).animate({
				width: initWidth,
				height: '21px'
			}, 300);
		}
	);
	teamfototimeout = false;
	$('img.teamfotos').hover(
		function(){
/*
			clearTimeout(teamfototimeout);
*/
			thisLeft 	= $(this).position().left + 60;
			thisTop 	= $(this).position().top - 30;
			divid		= '#'+$(this).attr('divid');
			
			$('div.teamfotodiv').hide();
			
			$(divid).css({
				left: thisLeft,
				top: thisTop,
				zIndex: 100,
				display: 'block'
			})
		},
		function(){
/*
			teamfototimeout = setTimeout(function(){
				$('div.teamfotodiv').hide();}
				,200);
*/
		}
	);
	
});

