$(function() {
	/**
	 * IE 6 check
	 */
	if ($.browser.msie)
	{
		$('html').addClass('ie');
	
		if($.browser.version.substr(0,1)<7) {
			
	        $("header").before('<div id="IE6check" style="margin-bottom:10px;text-align:center;background-color: #FFFFCC;"><span id="close" class="close" style="cursor:pointer;"><img src="public/img/cross-ie6.gif" width="16" height="16" alt="Sluiten" /></span>U gebruikt momenteel Internet Explorer 6. Wij raden u aan zo spoedig mogelijk de broser te upgraden naar een moderne browser omdat wij de functionaliteit in uw verouderde browser niet kunnen garanderen. Download <a href="http://www.getfirefox" target="_blank" style="text-decoration:underline;">Firefox &raquo;</a> of de laatste versie van <a href="http://www.microsoft.com/windows/internet-explorer/default.aspx" target="_blank" style="text-decoration:underline;">Internet Explorer &raquo;</a>.</div>');
	        $("#close").click(function () { 
	            $(this).parent().slideUp('slow'); 
	        });
		}
	}

	/**
	 * ANTI-SPAM
	 */
	$('.emailReplacement')
		.html(AppConfig['email'])
		.bind( 'click', function(){
			window.location.href = "mailto:"+AppConfig['email'];
		});

	$('.wiw')//wie is wie
		.find('.maskEmail')
		.css('cursor', 'pointer')
		.bind( 'click', function(){
			window.location.href = "mailto:"+$(this).attr('rel')+ AppConfig['domain'];
		});

	$('.cta')//call to action
		.find('.maskEmail')
		.html( $(this).find('.maskEmail').attr('rel') + '@' + AppConfig['domain'])
		.css('cursor', 'pointer')
		.bind( 'click', function(){
			window.location.href = "mailto:"+$(this).attr('rel') + '@' + AppConfig['domain'];
		});

	/**
	 * Lees meer... linkje in content pagina's
	 */
	$('#extraButton').bind ( 'click', function () {
		$('#extraContent').slideToggle();
	})

	/**
	 * Messages weergeven
	 *   trekt aandacht door animatie
	 */
	$('.msg').slideDown();
	
	/**
	 * INLINE labels in form 
  	 */
	$('#formLabel').find('input[title]').each(function() {
		var $this = $(this);
		if($this.val() === '')
			$this.val($this.attr('title')).addClass('inactive');	
		
		$this.focus(function() {
			if($this.val() == $this.attr('title'))
				$this.val('').removeClass('inactive');	
		});
		
		$this.blur(function() {
			if($this.val() === '')
				$this.val($this.attr('title')).addClass('inactive');	
		});
	});
	/**
	 *	FancyBox voor afbeeldingen
	 **/
	if ( typeof($.fn.fancybox) != 'undefined' )
		$('div.content a.fancybox:has(> img)').fancybox( { overlayColor: '#333' } );

	/**
	 * Font resizer cookie
	 */
	
	if ( $('.setSmall').length > 0  ) {
		$('.setSmall').bind('click', function ( e ) {
			e.preventDefault();
			$.cookie ( 'fontSize', 'small');
			if ( $('body').hasClass('frontpage') )
				$('body').removeClass().addClass ( 'frontpage small' );
			else 
				$('body').removeClass().addClass ( 'small' );
		});		
	}
	if ( $('.setRegular').length > 0  ) {
		$('.setRegular').bind('click', function ( e ) {
			e.preventDefault();
			$.cookie ( 'fontSize', 'regular');
			if ( $('body').hasClass('frontpage') )
				$('body').removeClass().addClass ( 'frontpage regular' );
			else 
				$('body').removeClass().addClass ( 'regular' );
		});		
	}
	if ( $('.setLarge').length > 0  ) {
		$('.setLarge').bind('click', function ( e ) {
			e.preventDefault();
			$.cookie ( 'fontSize', 'large');
			if ( $('body').hasClass('frontpage') )
				$('body').removeClass().addClass ( 'frontpage large' );
			else 
				$('body').removeClass().addClass ( 'large' );
		});		
	}
	
	// NAK logo
	if( $('header .promoSliderWrapper').length == 0 ) {
		$('#logo h1').height('125px');
	}
	
	/**
	 *	FancyBox voor afbeeldingen
	 **/
	if ( typeof($.fn.fancybox) != 'undefined' )
		$('a.fancybox:has(> img)').fancybox( { overlayColor: '#333' } );
});
