// FANCYBOX
//-------------------------------------------------------------

// GALLERY
$(document).ready(function() {
	$("a.group").fancybox({
		'titlePosition'	: 'over',
		'onComplete'	: function() {
			$("#fancybox-wrap").hover(function() {
				$("#fancybox-title").show();
			}, function() {
				$("#fancybox-title").hide();
			});
		}
	});
});


// VIDEOS
$(document).ready(function() {
$("a.video").click(function() {
	$.fancybox({
		'padding'		: 0,
		'autoScale'		: false,
		'transitionIn'	: 'none',
		'transitionOut'	: 'none',
		'title'			: this.title,
		'width'			: 680,
		'height'		: 495,
		'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
		'type'			: 'swf',
		'swf'			: {
			'wmode'		: 'transparent',
			'allowfullscreen'	: 'true'
		}
	});
	return false;
});
});

// GALLERY
//-------------------------------------------------------------
$(function() {
	$('#show').cycle({ 
		fx: 'fade',
		speed: 250, 
		timeout: 5500, 
		next: '#show',
		after: onAfter,
		next: '#next', 
		prev: '#prev' 
	});
});

function onAfter() { 
    $('#output').html("") 
        .append('<h3>' + this.alt + '</h3>'); 
}


// FAQ
//-------------------------------------------------------------
$(function() {
	$('.faq_item').hide();
	$('.faq_container>h3').click(function() {
		$(this).next('.faq_item').slideToggle().parent().siblings('div').find('.entry:visible').slideUp();
	});
});


// NAVIGATION
//-------------------------------------------------------------
$(document).ready(function(){

	//Hide (Collapse) the toggle containers on load
	$(".toggle_container").hide(); 

	//Switch the "Open" and "Close" state per click
	$("h2.trigger").toggle(function(){
		$(this).addClass("active");
		}, function () {
		$(this).removeClass("active");
	});

	//Slide up and down on click
	$("h2.trigger").click(function(){
		$(this).next(".toggle_container").slideToggle("fast");
	});

});