
//Tabs
		$(function () {
			var tabContainers = $('div.tabBoxContent > div');
			tabContainers.hide().filter(':first').show();
			
			$('div.tabBoxContent ul.tabsContent a').click(function () {
				tabContainers.hide();
				tabContainers.filter(this.hash).show();
				$('div.tabBoxContent ul.tabsContent a').removeClass('selected');
				$(this).addClass('selected');
				return false;
			}).filter(':first').click();
		});		


// slideshows

$(document).ready(function() {
	$('.slideshowHeader').cycle({
		fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
		timeout: 5000
	});
});




//cufon replace
		Cufon.replace('.sansation', {fontFamily: 'Sansation', fontWeight: '700', hover: 'true' });
		Cufon.replace('#contentLeftQuote h3, #contentLeftNieuws h3, #contentLeftNieuwsbrief h3, #contentMidRegular h2', {fontFamily: 'Sansation', fontWeight: '400', hover: 'true' });
		
//clear default		
		$(document).ready(function() {
				$("#emailAddr").clearDefault();
			})	
		$(document).ready(function() {
				$("#zoeken").clearDefault();
			})			

//Nieuwsbrief validator
		$(document).ready(function() {
								   
		isValidEmailAddress = function(emailAddress) {
			var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
			return pattern.test(emailAddress);
		}

		$('#newsletter').submit(function() {
			var email = $("#emailAddr").val();
			
			if(!isValidEmailAddress(email)) {
				alert("Het door u ingevoerde e-mail adres is incorrect.");
				return false;
			}
		});
		
		});

//cleardefault
$(document).ready(function() {
				$(".textNum").clearDefault();
				
				//Nieuwsbrief validator
				isValidEmailAddress = function(emailAddress) {
					var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
					return pattern.test(emailAddress);
				}
				
				$("#Bijzonderheden").clearDefault();
				
				//Nieuwsbrief validator
				isValidEmailAddress = function(emailAddress) {
					var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
					return pattern.test(emailAddress);
				}
		
				

			})

//Cufon
            Cufon.replace('h2', {fontFamily: 'Gill Sans MT', fontWeight: '400' });
			Cufon.replace('h3', {fontFamily: 'Gill Sans MT', fontWeight: '700' });
			Cufon.replace('h4', {fontFamily: 'Gill Sans MT', fontWeight: '400' });
			Cufon.replace('h5', {fontFamily: 'Gill Sans MT', fontWeight: '400' });
			
			Cufon.replace('#topnav li a', { fontFamily: 'Gill Sans MT', hover: true });
			Cufon.replace('#subheader ul li a', { fontFamily: 'Gill Sans MT', hover: true });
			
			(function($) {
			  var cache = [];
			  // Arguments are image paths relative to the current page.
			  $.preLoadImages = function() {
				var args_len = arguments.length;
				for (var i = args_len; i--;) {
				  var cacheImage = document.createElement('img');
				  cacheImage.src = arguments[i];
				  cache.push(cacheImage);
				}
			  }
			})(jQuery)
			
			
			$(document).ready(function() {
				//On Hover Over
				function megaHoverOver(){
					$(this).find(".sub").stop().fadeTo('fast', 1).show(); //Find sub and fade it in
					(function($) {
						//Function to calculate total width of all ul's
						jQuery.fn.calcSubWidth = function() {
							rowWidth = 0;
							//Calculate row
							$(this).find("ul").each(function() { //for each ul...
								rowWidth += $(this).width(); //Add each ul's width together
							});
						};
					})(jQuery); 
				
					if ( $(this).find(".row").length > 0 ) { //If row exists...
				
						var biggestRow = 0;	
				
						$(this).find(".row").each(function() {	//for each row...
							$(this).calcSubWidth(); //Call function to calculate width of all ul's
							//Find biggest row
							if(rowWidth > biggestRow) {
								biggestRow = rowWidth;
							}
						});
				
						$(this).find(".sub").css({'width' :biggestRow}); //Set width
						$(this).find(".row:last").css({'margin':'0'});  //Kill last row's margin
				
					} else { //If row does not exist...
				
						$(this).calcSubWidth();  //Call function to calculate width of all ul's
						$(this).find(".sub").css({'width' : rowWidth}); //Set Width
				
					}
				}
				//On Hover Out
				function megaHoverOut(){
				  $(this).find(".sub").stop().fadeTo('fast', 0, function() { //Fade to 0 opacity
					  $(this).hide();  //after fading, hide it
				  });
				}
				//Set custom configurations
				var config = {
					 sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)
					 interval: 1, // number = milliseconds for onMouseOver polling interval
					 over: megaHoverOver, // function = onMouseOver callback (REQUIRED)
					 timeout: 0, // number = milliseconds delay before onMouseOut
					 out: megaHoverOut // function = onMouseOut callback (REQUIRED)
				};
				
				$("ul#topnav li .sub").css({'opacity':'1'}); //Fade sub nav to 0 opacity on default
				$("ul#topnav li").hoverIntent(config); //Trigger Hover intent with custom configurations
				
				//Nieuwsrief validator
				isValidEmailAddress = function(emailAddress) {
					var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
					return pattern.test(emailAddress);
				}
		
				$('.newsletter').submit(function() {
					var email = $("#Emailadres").val();
		
					if(!isValidEmailAddress(email)) {
						alert("Het door u ingevoerde e-mail adres is incorrect.");
						return false;
					}
				});

		});
		
		$(document).ready(function() {
			if($.cookie('TEXT_SIZE')) {
				$('body').addClass($.cookie('TEXT_SIZE'));	
			}
			$('.resizer a').click(function() {
				var textSize = $(this).parent().attr('class');
				$('body').removeClass('small medium large').addClass(textSize);
				$.cookie('TEXT_SIZE',textSize, { path: '/', expires: 10000 });
				return false;
			});
		});
		
		$(document).ready(function()
		{
		  //hide the all of the element with class msg_body
		  $(".collapseForm").hide();
		  //toggle the componenet with class msg_body
		  $(".collapseHeading").click(function()
		  {
			$(this).next(".collapseForm").slideToggle(600);
		  });
		});

