Cufon.replace('#menu > ul > li > a', { fontFamily: 'Myriad Pro Bold', hover: true });
Cufon.replace('.box h3', { fontFamily: 'Myriad Pro Semibold' });
$(function() {
	$('#menu .submenu').each(function() {
		if($(this).parent().outerWidth() > $(this).find('ul').outerWidth()) {
			$(this).css('width', $(this).parent().outerWidth());
			$(this).find('ul').css('width', $(this).parent().outerWidth() - 25);
			$(this).find('.rounding-center').css('width', $(this).parent().outerWidth() - 10);
		} else {
			$(this).css('width', $(this).find('ul').outerWidth());
			$(this).find('.rounding-center').css('width', $(this).find('ul').outerWidth() - 10);
		}
		$(this).find('li:last').css('background', 'none');
	});
	$('#menu li:first').css('background', 'none');
	$('#menu > ul > li').hover(function() {
		$(this).addClass('hover');
	}, function() {
		$(this).removeClass('hover');
	});
	$('.form-box').each(function() {
		$(this).find('.submit-button').click(function(e) {
			e.preventDefault();
			var valid = true;
			$(this).parent().find('input:text, textarea').each(function() {
				if($.trim($(this).val()) == '' || $(this).val() == 'Dit veld is niet ingevuld') {
					valid = false;
					$(this).val('Dit veld is niet ingevuld');
					$(this).parent().addClass('error');
					$(this).focus(function() {
						$(this).parent().removeClass('error');
						if($(this).val() == 'Dit veld is niet ingevuld') {
							$(this).val('');
						}
					});
				}
			});
			if(valid) {
				$(this).parent().find('form').submit();
			}
		});
	});
	$('#sponsor-box a').attr('target', '_blank');
	$('#credits a').attr('target', '_blank');
	$('.galerij-box a').colorbox();
});
