$(document).ready(function() {
	$('span.btn input').mouseover(function() {$(this).parent().addClass('selected')})
	$('span.btn input').mouseout(function() {$(this).parent().removeClass('selected')})
	$('span.btn input').focus(function() {$(this).parent().addClass('active')})
	$('span.btn input').blur(function() {$(this).parent().removeClass('active')})
	$('.textfield').focus(function() {$(this).addClass('focus')})
	$('.textfield').blur(function() {$(this).removeClass('focus')})
	$('div.wrapper').each(function() {$(this).children('div.twocols:even').addClass('clear')})
	$('div.wrapper').each(function() {$(this).children('div.twocols:odd').addClass('last')})
	$('div.wrapper').each(function() {$(this).children('div.threecols:nth-child(3n-2)').addClass('clear')})
	$('div.wrapper').each(function() {$(this).children('div.threecols:nth-child(3n)').addClass('last')})
	$('div.wrapper').each(function() {$(this).children('div.fourcols:nth-child(4n-3)').addClass('clear')})
	$('div.wrapper').each(function() {$(this).children('div.fourcols:nth-child(4n)').addClass('last')})
	$('ul li a').each(function() {
		$(this).parent(':first-child').addClass('first')
		$(this).parent(':last-child').addClass('last')
		$(this).html('<span>' + $(this).html() + '</span>')
	})
	$('div.wrapper').each(function() {$(this).children('div.twocols').width(Math.floor(($(this).width()-10)/2))})
	$('div.wrapper').each(function() {$(this).children('div.threecols').width(Math.floor(($(this).width()-20)/3))})
	$('div.wrapper').each(function() {$(this).children('div.fourcols').width(Math.floor(($(this).width()-30)/4))})
	$('div.subnav a br').parent().addClass('tworules');
	$('.bghover').mouseover(function() {$(this).addClass('bggray')})
   $('.bghover').mouseout(function() {$(this).removeClass('bggray')})
	
	$('#faq').find('dd').hide().end().find('dt').click(function() {
		var answer = $(this).next();
		if (answer.is(':visible')) {
			answer.slideUp();
		} else {
			answer.slideDown('fast');
		}
	});
	
	//kan alleen bij frames gebruikt worden
	/*$(document).ready(function() {
		$('div.nav li').click(function() {
			$('div.nav li').removeClass('active')
			$(this).addClass('active')
		})
	})*/
	
	/*equalHeight($(".c3>div"));NIET GOED! nog naar kijken*/
	/*equalHeight($(".c4>div"));NIET GOED!*/
	/*equalHeight($(".c4>div,.c4>div,.c2>div"));NIET GOED!*/
	//equalHeight($(".equalHeight div.borderbox"));
		
	//$(".equalHeight").jHeights();
	
	equalHeight($(".equalHeight div.graybox"));
	
})

function equalHeight(group) {
	var tallest = 0;
	group.each(function() {
		var thisHeight = $(this).height();
		if(thisHeight > tallest) {
			tallest = thisHeight;
		}
	});
	group.height(tallest);
}

/*jQuery.fn.jHeights = function() {
  var tallest = 0;
  this.children().each(function(){
    if ($(this).outerHeight() > tallest) {
      tallest = $(this).outerHeight(); 
    }
  });
  $(this).children().height(tallest);
};*/
