// JavaScript Document
$(document).ready(function() {


//Stel background in
	var bgnr = $('#define_bg').html();
	
	$('html').css('background-image','url(siteimages/background_'+bgnr+'.jpg)');

//Zet de blockquote in het verticale midden van de banner div
	if($('#banner blockquote')){
	
		var bq_height = $('#banner blockquote').height();
		var bn_height = $('#banner').height();
		var margin_top = ((bn_height-bq_height)/2)-20;
		$('#banner blockquote').css('margin-top',margin_top);
	
	}

//Slideshow homepagina
	$('#slideshow img:gt(0)').hide();
    setInterval(function(){
      $('#slideshow :first-child').fadeOut(1000)
         .next('img').fadeIn(1000)
         .end().appendTo('#slideshow');}, 
      3000);
	  
//Fancybox
	$('a.zoom').each(function(){
	
		$(this).fancybox({
			'titlePosition'	: 'over'
		});
	
	});

//Cursor pointer voor loep
	
	$('#loep').bind('mouseover', function(){
			
			$(this).css('cursor','pointer');
			
		})
		
		.bind('mouseout', function(){
			
			$(this).css('cursor','default');
			
		});
		
//Value voor zoekinput en focus
	
	//Standaard waarde van de input
	var defaultValue = $('#zoekwaardedefault').html();
	
	$('#sitesearch input[type="text"]').bind('focus', function(){
	
	//Stel de textkleur donkerder bij focus
		$(this).css('color','#777');
	
	//Als de defaulttext er staat, verwijder die dan bij focus
		if($(this).attr('value') == defaultValue){
			
			$(this).attr('value','');
			
		}
	
	})
	
	.bind('blur', function(){
	
	//Stel de achtergrond kleur weer licht in bij blur
		$(this).css('color','#ccc');
		
	//Zet de defaulttext terug als de input leeg is
		if($(this).attr('value') == ''){
			
			$(this).attr('value',defaultValue)
			
		}
	
	});
	
//Stel scroll in voor google directions

	if($('#directions iframe')){
		
		$('#directions iframe').attr('scrolling','auto')
	}

});
