/************* Stepcarrousel ************/
	
	stepcarousel.setup({
		galleryid: 'carrousel-box', //id of carousel DIV
		beltclass: 'carrousel-belt', //class of inner "belt" DIV containing all the panel DIVs
		panelclass: 'carrousel-item', //class of panel DIVs each holding content
		autostep: {enable:true, moveby:1, pause:10000},
		panelbehavior: {speed:500, wraparound:true, persist:false},
		defaultbuttons: {enable: false, moveby: 1, leftnav: ['http://i34.tinypic.com/317e0s5.gif', -5, 80], rightnav: ['http://i38.tinypic.com/33o7di8.gif', -20, 80]},
		statusvars: ['statusA', 'statusB', 'statusC','statusD'], //register 3 variables that contain current panel (start), current panel (last), and total panels
		contenttype: ['inline'] //content setting ['inline'] or ['external', 'path_to_external_file']
	});
	
	$(document).ready(function(){
		initSelectBoxes();
		initSeminarLink();
		initSearch();
		initConversieButtons();
		
		/* Login ovelay */
		$("#toplink-login").click(function(event){
				event.preventDefault();
				$("body").overlay({
					opacity: '75',
					color: '#000',
					window_width: '600',
					window_height: '300',
					src: '<iframe src="/login" class="login-iframe" frameborder="0">Uw browser onderteunt geen iframes</iframe>'
				});
			});
		
		$("#toplink-login-en").click(function(event){
				event.preventDefault();
				$("body").overlay({
					opacity: '75',
					color: '#000',
					window_width: '600',
					window_height: '300',
					src: '<iframe src="/en/login" class="login-iframe" frameborder="0">Uw browser onderteunt geen iframes</iframe>'
				});
			});
		
		
	});
	
	function initSelectBoxes(){
		$(".graphic-select-box").children(".graphic-select-heading").children("a").click(function(e){
			e.preventDefault();
			
			/* bug fix voor resultbox die achter een andere graphic selectbox valt */
			$(".graphic-select-box").css({
				'z-index' : '1'
			});
			
			$(this).parent().parent().css({
				'z-index' : '2'
			});
			
			$(this).parent().siblings(".results-box").toggle();
		});
		/*
		$(".results-box").mouseout(function(){
			hideResultBox($(this));
		});
		*/
	}
	
	function hideResultBox(el){
		window.setTimeout(function(){ $(el).hide(); }, 750); 
	}
	
	function Select(parent) {
		$("." + parent + " :checkbox").attr('checked', true);
	}
	
	function deSelect(parent) {
		$("." + parent + " :checkbox").attr('checked', false);
	}
	
	function initSeminarLink()
	{
		$("#informeer-seminars-link").click(function(e){
			e.preventDefault();
			$("body").overlay({
				window_width: '500',
				window_height: '400'
			});
		});
	}
	
	function openLoginOverlay() {
		$("body").overlay({
			opacity: '75',
			color: '#000',
			window_width: '600',
			window_height: '300',
			src: '<iframe src="/login" class="login-iframe" frameborder="0">Uw browser onderteunt geen iframes</iframe>'
		});
	}
	
	function initSearch(){
		$("#btn-search").click(function(e){
			e.preventDefault();
			var lang = $("#searchLang").val();
			var keyword = $("#search-txt").val();
			toZoeken(lang, keyword);
				
		});
		
		$("#search-txt").keydown(function(e){
			var lang = $("#searchLang").val();
			var keyword = $("#search-txt").val();
			if (e.keyCode == 13)
				toZoeken(lang, keyword);
		});
	}
	
	function toZoeken(site, keyword){
		if (site != null && keyword != null)
		{
			if (site == "nl")
			{
				window.location.href="/nl/zoeken?q="+keyword;
			}
			else if (site == "en")
				window.location.href="/en/search?q="+keyword;
		}
	}

	function initConversieButtons() {
		$("#conversie-buttons").children("li").each(function(){
			if ($(this).html() == "")
				$(this).remove();
		});
	}