$(window).load(function () {

	$('.left ul li').hover(

	  function () {
		  $(this).find("> ul").css("display", "block");

	  },
	  function () {
		  $(this).find("> ul").css("display", "none");

	  }
		
	)
	
	$("a[rel=external]").each(function(i){
		this.target="_blank";
	});
	
	 setInterval( "switch_image()", 5000 );

	
});


function validate(formid)
{
	var valid = true;
	
	$.each($('.required'), function(index, obj) {
		
		 $(this).removeClass('error');
		
		if(obj.value == '')
		{
	  		  $(this).addClass('error');
	  		  valid = false;
	  		  
	  		$('#form-' + formid).append('<div class="error" style="background: #FFF; padding: 5px;">U bent een veld vergeten in te vullen!</div>');
		}
		  
	});
	
	if(valid) {
		$('#form-' + formid).submit();
	}

	
}

var index = 1;

function switch_image()
{
	if(index == 8) {
		index = 1;
	}
	
	$('#wrapper').removeClass().addClass('bg' + index).fadeIn('slow');
	
	index++;
}


