function isValidEmailAddress(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);
}
function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
$(document).ready(function() { 
        
		
	
		
		// check of we een mobiel iets zijn.. dan doorsturen
		if(readCookie("forceViewFullSite") !== "true") {
			if(DetectMobileQuick()) {
				document.location.href=$('#mobileRef').val();
			}
		}
		
		$('ul.split').easyListSplitter({ 
			colNumber: 3,
			direction: 'vertical'
		});	
		 $("ul#menu li div").append("<div class='shadow'></div>");
		 $('ul#menu').superfish({ 
            delay:       1,                            // one second delay on mouseout 
            animation:   {opacity:'show',height:'show'},  // fade-in and slide-down animation 
            speed:       'fast',                          // faster animation speed 
            autoArrows:  false,                           // disable generation of arrow mark-up 
            dropShadows: false                            // disable drop shadows 
        }); 	
		// Roep de slideshow aan
		$('.slideshow').divSlideShow({delay: $('#slideSpeed').val()}); 
		// Roep de carousel aan
		$("#carousel").jcarousel();
		// Bereken de totale breedte van de scrollbar div
 		totalContent = $("div#scrollable div").length * 320;
		($('div#services #scrollable').css('width',totalContent));
		// Roep de custom scrollbar aan.
		$(function()
		{
		$('#services').jScrollPane();
		$('div.pagings').quickPager();
		});
		
		if( $("div#columnMiddle").is(':visible') ) {
			
			
 $("a[rel=fancyvideo]").click(function() {
	$.fancybox({
			'padding'		: 0,
			'autoScale'		: false,
			'transitionIn'	: 'none',
			'transitionOut'	: 'none',
			'title'			: this.title,
			'width'		    : 640,
			'height'		: 390,
			'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
			'type'			: 'swf',
			'swf'			: {
			   	 'wmode'		: 'transparent',
				'allowfullscreen'	: 'true'
			}
		});

	return false;
});	


		}
		else {
    	
		}
	
	$("a[rel=review_photo]").fancybox({
		
    'transitionIn'    : 'none',
    'transitionOut'    : 'none',
    'titlePosition'   : 'inside',
	 'showNavArrows'   : 'true',
    'titleFormat'    : function(title, currentArray, currentIndex, currentOpts) {
    return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
    }
  });
  
		var orgFormValues = [];
		$('#formSolliciteer input').each(function() {
			orgFormValues[$(this).attr('id')] = $(this).val();
		});
		
		// reset standaard waarden sollicatie formulier bij klik
		$('#formSolliciteer input').focus(function() {
			if($(this).val() == orgFormValues[$(this).attr('id')]) { $(this).val(""); }
		});
		$('#formSolliciteer input').focusout(function() {
			if($(this).val() == "") { $(this).val(orgFormValues[$(this).attr('id')]); }
		});
	
		$('div.choosefile input').change(function() {
			$('#fileInfo').html($(this).val());
		});
		$('input.fEmail').change(function() {
			if(!isValidEmailAddress($(this).val())) {
				$('span.mMsg').remove();
				$(this).after('<span class="mMsg">E-mail adres is onjuist.</span>');
			}
		});
	

}); 
