function submitForm(id,bgColor,textColor){

	var submit = true;
			
	$('#' + id + " .check").each(function() {
    	if($(this).attr('rel') == "required"){
    		if($(this).attr('value') == ''){
    			$(this).css({'background-color': bgColor, 'color': textColor});
    			submit = false;
    		}
    		
    		if($(this).attr('name') == "email" || $(this).attr('name') == "emailto" || $(this).attr('name') == "emailfrom"){
    			var email = $(this).attr('value');
				var filter = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
				
				if (!filter.test(email)) {
	    			$(this).css({'background-color': bgColor, 'color': textColor});
	    			submit = false;
				}
    		}
    	}
    });
    
    if(submit) $('#'+ id).submit();
}


$(function(){


	function removeA(items){
		for (i=0;i<items.length;i++){
		
			var listItem = $('.page-item-' + items[i]);
			var aTxt = listItem.children('a').html();
			listItem.children('a').remove();
			listItem.append('<span>' + aTxt + '</span>');
			listItem.css('cursor','default');
		}
	}
	
	// ALLE ID's die GEEN link mogen zijn!
	var itemsArr = new Array(14,36,38,9,100);
	removeA(itemsArr);
	
	//Diepste menu zwart maken
	$('.page-item-38, .page-item-100').css('background','black');
	
	$('.page-item-89, .page-item-91, .page-item-94').css('height','44px');
	
	
	//BEWEGINGEN HEADER

	$('#headerimgs').mouseover(function(){
		$(this).prev().children().each(function(){
			
			var height = Math.random() * 25;
			var speed = 500 + Math.random() * 1000;
					
			$(this).animate({
				top: '-=' + height
				}, speed, 'easeOutElastic', function() {
		 	});
		 });
	 	
	});
	
	$('#headerimgs').mouseover(function(){
		$(this).prev().children().each(function(){
			switch($(this).attr('id')){
				case 'banaan': 	height = 14; break;
				case 'cola': 	height = 123; break;
				case 'haan': 	height = 107; break;
				case 'haas': 	height = 1; break;
				case 'kaas': 	height = 144; break;
				case 'koe': 	height = 78; break;
				case 'mango': 	height = 9; break;
				case 'vla': 	height = 168; break;
			}
			
			var speed = 500 + Math.random() * 1000;
			$(this).animate({
				top: height
				}, speed, 'easeOutElastic', function() {
		 	});
		 });
	 	
	});
	
	if(!Modernizr.boxshadow){
		$('.media').dropShadow({
			left: 	0,
			top: 	0,
			blur:	3
		});
		
		$('.shadow').dropShadow({
			left: 	0,
			top: 	0,
			blur:	3
		});
	}

	$('#slideshow').cycle({
        fx:       'scrollHorz',
        timeout:   1000,
        prev:    '#prev', 
        next:    '#next',
        after:     function() {
            //$('#caption').html(this.alt);
            //$('#caption').css('display','none').fadeIn('slow');
        }
    });
    
    $('.commentform .check').focus(function(){
    	$(this).css('background-color','white');
    });
});


