$(document).ready(function() {
	
	/** Active accordion panels **/
	//$('.menuAccordion').accordion({ autoHeight: false });
	$('.headlinesAccordion').accordion({ active: 0, autoHeight: false });
	$('.reportAccordion').accordion({ active: 0 });
	$('.mijnAccord').accordion({ active: 0 });
	$('#contentAccordeon').accordion({ active: -1, autoHeight: false });
	
	/** Colapse containers **/
	$('.controlColapse').click( function() 
	{
		
		var getElement = $(this).parent('.boxControl').parent('.boxTop').parent('.box').children('.boxHolder').children('.boxContent');
		
		if ( !$(this).attr('box-height') ) 
		{
			$(this).attr('box-height', getElement.height() );
		}
		
		if ( getElement.height() == 0 )
		{
			getElement.animate({height: $(this).attr('box-height')+'px'});	
		}
		else
		{
			getElement.animate({height: '0px'});	
			
		}
		
	});
	
	/** Sliders **/
	$("#smallPictureSlider").easySlider(
	{
		continuous	: true,
		nextId		: 'smallPictureNext'
	});
	
	$("#courseSlider").easySlider(
	{
		continuous	: true,
		nextId		: 'nextCourse',
		prevId		: 'previousCourse',
		auto		: true,
		speed		: 800,
		pause		: 3000
	});
	
	$("#offerSlider").easySlider(
	{
		continuous	: true,
		nextId		: 'nextOffer',
		prevId		: 'previousOffer',
		auto		: true,
		speed		: 800,
		pause		: 2600
	});
	$("#SMOELENBOX").easySlider(
	{
		continuous	: true,
		nextId		: 'nextOffer',
		prevId		: 'previousOffer',
		auto		: true,
		speed		: 800,
		height		: 220,
		pause		: 2600
	});
	
	$('#boekButton').click(function()
	{
		$("#bookFrame").trigger('click');
	});
	
	
	$("a#bookFrame").fancybox({
		'zoomOpacity'			: true,
		'overlayShow'			: true,
		'hideOnContentClick'	: true,
		'titleShow'				: false,
		'zoomSpeedIn'			: 500,
		'zoomSpeedOut'			: 500,
		'padding'				: 5,
		'easingIn'				: 'easeOutBack',
		'easingOut'				: 'easeInBack',
		'centerOnScroll'		: false,
		'overlayColor'			: '#000'
	});
	
	$("#loadRadar").fancybox({
		'zoomOpacity'			: true,
		'overlayShow'			: true,
		'hideOnContentClick'	: true,
		'titleShow'				: false,
		'zoomSpeedIn'			: 550,
		'zoomSpeedOut'			: 513,
		'padding'				: 5,
		'easingIn'				: 'easeOutBack',
		'easingOut'				: 'easeInBack',
		'centerOnScroll'		: true,
		'type'					: 'image',
		'overlayColor'			: '#000',
		'overlayOpacity'		: 0.6
	});
	
	$('.button img').click(function(){
		
		
		var Error =0;
		
		if ( $('#naam').val() == '' )
		{
			 $('#naam').addClass('inputFieldRed');
			 Error++;
		}
		else
		{
			 $('#naam').removeClass('inputFieldRed');	
		}
		
		if ( $('#email').val() == '' )
		{
			 $('#email').addClass('inputFieldRed');
			 Error++;
		}
		else
		{
			 $('#email').removeClass('inputFieldRed');	
		}
		
		if ( $('#telefoonnummer').val() == '' )
		{
			 $('#telefoonnummer').addClass('inputFieldRed');
			 Error++;
		}
		else
		{
			 $('#telefoonnummer').removeClass('inputFieldRed');	
		}
		
		if ( $('#geboorte datum').val() == '' )
		{
			 $('#geboorte datum').addClass('inputFieldRed');
			 Error++;
		}
		else
		{
			 $('#geboorte datum').removeClass('inputFieldRed');	
		}
		
		
		if ( Error == 0 )
		{
			$('#form').submit()	
		}
		
	}); 
	$('#SMOELENBOX').css({'height' : '220px'});
});



function changeInput(inputVar)
{
	
	inputVar = inputVar.replace(' ', '');
	$('.'+inputVar).fadeOut('fast');
	
	setTimeout(function()
	{
		$('.'+inputVar).attr("disabled", true ).after('<span style="color:red;"> ( Deze cursus zit vol. ) </span>');
		
	},20);
	
	//$('input[value='+inputVar+']').fadeOut('fast');
}

