$(document).ready(function() {

	// add body class
	$('body').addClass('js');
	
	// faq accordion
	$('#faq h3').css('cursor', 'pointer');
	$("#faq").accordion({
		autoHeight:false,
		collapsible:true
	});

	// gallery slideshow
	var container = $('.gallery');
	var ul = $('.ngg-galleryoverview', container);
	var itemsWidth = ul.innerWidth() - container.outerWidth() - 20;
	
	$('.slider', container).slider({
		min: 0,
		max: itemsWidth,
		stop: function (event, ui) {
			ul.animate({'left' : ui.value * -1}, 500);
		},
		slide: function (event, ui) {
		//console.log(ui.value);
			ul.css('left', ui.value * -1);
		}
	});
	
	$('.gallery .ngg-galleryoverview a').lightBox();
	
	// testimonials slider for lots of text
	var testCont = '#testimonials .quote .info .content';
	
	$(testCont + ' p:first-child').nextAll().wrap('<div class="more" />');
	$(testCont + ' div.more').hide();
	
	$(testCont + ' div.more:last-child').after('<p><a href="#" class="readmore">Read on...</a></p>');
	
	$(testCont + ' p a.readmore').click(function() {
		if($(this).text() == 'Less again...') {
			$(this).text('Read on...');
		} else {
			$(this).text('Less again...');
		}
		$(this).closest('div.quote').find('div.more').slideToggle();
		return false;
	});
	
});