
  

function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};


$(document).ready(function(){

	$('a.lightbox').colorbox();



	$('#accordion_homepage').easyAccordion({ 
			autoStart: true,
			slideInterval: 5000,
			slideNum:false	
	}); 
	
		
		
// carousel

    $('#aanbod_carousel').jcarousel({
        duration: 'slow',
        scroll: 5,
        auto: 5,
        wrap: 'last',
        easing: 'swing',
        initCallback: mycarousel_initCallback
    });
    
    $('#openhuis_carousel').jcarousel({
        duration: 'slow',
        scroll: 5,
        auto: 5,
        wrap: 'last',
        easing: 'swing',
        initCallback: mycarousel_initCallback
    });



// menu
	
	$("ul#mainnav ul li:has(ul)").find("a:first").append("&nbsp;&raquo;");



// actions

	$("div.clickable").click(function(event) {
	  event.preventDefault();
	  window.location = $(this).attr("url");
	});
		
		
	/* CLEAR INPUT ON FOCUS */
	
	var clearMePrevious = "";
	
	// clear input on focus
	$('.clearMeFocus').focus(function()	{
		if($(this).val() == $(this).attr('title')) {
			clearMePrevious = $(this).val();
			$(this).val("");
		}
	});	
	
	// if field is empty afterward, add text again
	$('.clearMeFocus').blur(function() {
		if($(this).val() == "") {
			$(this).val(clearMePrevious);
		}
	});


//	aanbod rechterkolom

	$(".accordion").accordion( { autoHeight: false, clearStyle: false, active: 0 });

	jScroll( 'aanbodScroller' );
	jScroll( 'openhuisScroller', Array("ohp_up", "ohp_down") );



/* GALLERY ROW */

	$(".row").hover(function() {
		$(this).stop().animate({ backgroundColor: "#f0f8f4" }, 100);
	},function() {
		$(this).animate({ backgroundColor: "white" }, 300);
	});

/* GALLERY GALBOX */

	$(".galbox").hover(function() {
		$(this).stop().animate({ backgroundColor: "#f0f8f4" }, 100);
	},function() {
		$(this).animate({ backgroundColor: "white" }, 300);
	});
	
	$('div.galbox:nth-child(3n+1)').css("margin-right","0");
	$('div.galbox:nth-child(3n+1)').after("<br clear='all' />");
	
	if ($('.div.galbox img').length > 1) {
		$(".adres").css("margin-top","20px");
	}




// end
});
