$(document).ready(function() {
	/** Makkelijk plaatjes hoveren **/
  	$('img').each(function(index, value) {
    	if($(this).hasClass('btn_flip') && !$(this).hasClass('active')) {
    		// Mouseover binden
			$($(this)).bind('mouseover', function() {
        		$(this).attr('src',$(this).attr('src').substr(0,($(this).attr('src').length-5)) + '1' + $(this).attr('src').substr(($(this).attr('src').length-4),4));;
    		});
    		
    		// Mouseout binden
			$($(this)).bind('mouseout', function() {
        		$(this).attr('src',$(this).attr('src').substr(0,($(this).attr('src').length-5)) + '0' + $(this).attr('src').substr(($(this).attr('src').length-4),4));;
    		});
    	}
   	});
   	
   	//scherm_overlaag
   	$('#header > .menu > ul > li').bind('mouseover', function() {
   		if($(this).find('.submenu').length > 0) {
   			toggleOverlaag(true);
   		}
	});
	$('#header > .menu > ul > li').bind('mouseleave', function() {
		toggleOverlaag(false);
	});
});
var overlaag_visible = false;
function toggleOverlaag(tonen) {
	overlaag_visible = tonen;
	if(tonen == true) {
		initOverlaag();
		toggleFlash(false);
		$('#scherm_overlaag').fadeIn('fast');
	} else {
		if($('#scherm_overlaag').css('display') == "block") {
			$('#scherm_overlaag').fadeOut('fast');
			toggleFlash(true);
		}
		
	}
}
function initOverlaag() {
	$('#scherm_overlaag').width($('body').width());
	$('#scherm_overlaag').height($(document).height() - $('#header').height());
}

function toggleFlash(show) {
	if(show == false) {
		// hiden
		$('.flash_box').each(function(index, value) {
			$(this).hide();
		});
	} else {
		// showen
		$('.flash_box').each(function(index, value) {
			$(this).show();
		});
	}
}
