/* SLIDESHOW
-------------------------*/
$(document).ready(function() {
	$('.slideshow').cycle({
		fx: 'fade',
		timeout: 8000
	});
});

/* Afbeeldingen float left + float right
		Subtitels moeten zo worden geplaatst dat afbeeldingen met model 
		float:left en float:right gewoon geplaatst kunnen worden, en dat de titel er 
		nog in het geheel boven komt
*/

$(function() {
	$("div.afb_links + h2, div.afb_rechts + h2, div.afb_links2 + h2, div.afb_rechts2 + h2").each(function() {
		$(this).insertBefore($(this).prev());
	});
});

/* CUFON
-------------------------*/
Cufon.replace('h1, h2, h3, .bulletsubtitlestyle', { fontFamily: 'Myriad Pro' });
Cufon.replace('ul#menu li a span', { fontFamily: 'Myriad Pro' });

/* PRETTYPHOTO
-------------------------*/
$(document).ready(function(){

	$("a[rel^='prettyPhoto']").prettyPhoto({
		animationSpeed: 'fast', /* fast/slow/normal */
		padding: 40, /* padding for each side of the picture */
		opacity: 0.35, /* Value betwee 0 and 1 */
		showTitle: false, /* true/false */
		allowresize: true, /* true/false */
		counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
		theme: 'light_rounded', /* light_rounded / dark_rounded / light_square / dark_square */
		hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */
		modal: false, /* If set to true, only the close button will close the window */
		changepicturecallback: function(){}, /* Called everytime an item is shown/changed */
		callback: function(){} /* Called when prettyPhoto is closed */
	});
});

/* 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();
/*
	//Switch the "Open" and "Close" state per click
	$("span.trigger").toggle(function(){
		$(this).addClass("active");
		}, function(){
		$(this).removeClass("active");
	});

	//Slide up and down on click
	$("span.trigger").toggle(function(){
		//$(this).next(".toggle_container").slideToggle();
		$(this).next(".toggle_container").hide();
		}, function(){
		$(this).next(".toggle_container").css("display", "inline-block");
	});*/




	$("span.trigger").click(function(){
		if ($(this).attr("active") == "true") {
			$(this).removeAttr("active");
			$(this).removeClass("active").next(".toggle_container").slideToggle("slow");
			//$(this).removeClass("active").next(".toggle_container").hide();
		} else {
			$("span.trigger").removeClass("active").removeAttr("active");	
			$(this).attr("active", "true");
			$(".toggle_container").slideUp();
			$(this).addClass("active").next(".toggle_container").slideToggle("slow");
			//$(this).next(".toggle_container").show();
		}
		//Cufon.refresh();
	});
	//$("span.trigger").eq(0).click();
});

function initCarousel(carousel) {
	carousel.scroll(1);
}

/* LI-SCROLLER
-------------------------*/
$(function(){
	$("ul#ticker01").liScroll({travelocity: 0.03});
}); 

/* INPUT
-------------------------*/
(function($) {
	$.fn.defaultValue = function() {
		return this.each(function() {

			$(this).data("originalText", $(this).val());

			$(this).blur(function() {
				if ($(this).val() == "") {
					$(this).val($(this).data("originalText"));
					$(this).removeClass("enabled");
				}
			});

			$(this).focus(function() {
				if ($(this).val() == $(this).data("originalText")) {
					$(this).val("");
					$(this).addClass("enabled");
				}
			});

		});
	}
})(jQuery);


$(document).ready(function() {
	$("#saddr").defaultValue();
});

/* ZOEKEN
-------------------------*/
$(function(){
	$(".btn-slide").click(function(){
		$("#panel").slideToggle("fast");
		$(this).toggleClass("active"); return false;
	});
});