jQuery(document).ready(function($) {
	
//Carousel
	$(function() {
    		$(".carousel").jCarouselLite({
			btnNext: ".nextImage",
			btnPrev: ".previous",
			visible: 3
   		});
	});
	
//Popup
	$('#closeButton').click(function() {
		$('.carousel2').hide('fast', function() {
			// Animation complete.
		});
	});
	
//Popup Carousel
	$(function() {
    		$(".carousel2").jCarouselLite({
			btnNext: ".nextImage2",
			btnPrev: ".previous2",
			visible: 1,
     			auto: 8000,
			speed: 1000
   		});
	});
	
//Slideshow Text
	//$('.slideshow-text').animate({width:'toggle'},2000);
	
//Gallery Homepage
	$("#galleria2").galleria({
		autoplay: 4000,
		transition: 'fade',
		transitionSpeed: 1500,
		thumbnails: false,
		showCounter: false,
		showInfo: false
	});

//Gallery
	$("#galleria").galleria({
		autoplay: 4000,
		transition: 'fade',
		transitionSpeed: 1500,
		thumbnails: false,
		showCounter: false,
		showInfo: false
	});
	
// Show / Hide homepage
	var clicked = false;

	$("#showHide").click(function() {
	    //check what the margin is originally
		var thisParent = $(this).parent();
		var ulParent = $(thisParent).parent();
		if (clicked) {
			$(ulParent).children().animate({
			    marginTop: "190px"
			}, '400', 'easeOutQuint');
		}
		if($(thisParent).css("margin-top")=="190px") {
			$(this).parent().animate({
			      marginTop: "0px"
			}, 400, 'easeOutQuint');
			clicked = true;
		} else {
			$(this).parent().animate({
			      marginTop: "190px"
			}, 400, 'easeOutQuint');
			clicked = false;
		}
	});
	
});
