/* SLIDESHOW
-------------------------*/
$(document).ready(function() {
	$('.slideshow').cycle({
		fx: 'fade',
		timeout: 5000
	});
});

/* SHUFFLE
-------------------------*/
$(document).ready(function() {
	$('.shuffle').randomImage();
});
/* CUFON
-------------------------*/
Cufon.replace('h1, h2, h3, .bulletsubtitlestyle', { fontFamily: 'Myriad Pro' });
Cufon.replace('ul#menu li a span', { fontFamily: 'Myriad Pro' });
Cufon.replace('div.title', { fontFamily: 'Myriad Pro' });

/* JCAROUSEL
-------------------------*/
jQuery.easing['BounceEaseOut'] = function(p, t, b, c, d) {
	if ((t/=d) < (1/2.75)) {
		return c*(7.5625*t*t) + b;
	} else if (t < (2/2.75)) {
		return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
	} else if (t < (2.5/2.75)) {
		return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
	} else {
		return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
	}
};

$(function(){
	jQuery('.cases').jcarousel({
		scroll: 1
	});
});

$(function(){
	jQuery('.gallery').jcarousel({
		scroll: 1,
		auto: 5,
		easing: 'BounceEaseOut',
		animation: 1000
	});
});

/* TOGGLE
-------------------------*/
$(function(){

	$("div.collapse").each(function() {
		if (!$(this).next().next().hasClass("collapse")) {
			$(this).css({
				"margin-bottom": "20px"
			}).find("div.block").css({
				"margin-bottom": 0
			})
		}
	});

	$(".toggle_container").hide();
	
	$("span.trigger").click(function(){
		if ($(this).attr("active") == "true") {
			$(this).removeAttr("active");
			$(this).removeClass("active").next(".toggle_container").slideUp("slow");
		} else {
			$("span.trigger").removeClass("active").removeAttr("active");	
			$(this).attr("active", "true");
			$(".toggle_container").slideUp();
			$(this).addClass("active").next(".toggle_container").slideToggle("slow");
		}
	});
	//$("span.trigger").eq(0).click();
});

function initCarousel(carousel) {
	carousel.scroll(1);
}

/* LI-SCROLLER
-------------------------*/
$(function(){
	$("ul#ticker01").liScroll({travelocity: 0.03});
}); 

/* ZOEKEN
-------------------------*/
$(function(){
	$(".btn-slide").click(function(){
		$("#panel").slideToggle("fast");
		$(this).toggleClass("active"); return false;
	});
});


/* QUICKFLIP */
$(function() {
	$(".contactBlock .flip").click(function() {
		$(this).parent().animate({
			width: 0,
			left: 168
		}, "fast", function() {
				$(this).hide();
				$(this).siblings().css({width: 0, left: 168, display: "block"}).animate({
					width: 336,
					left: 0
				});
		});
		return false;
	});
});
