$(document).ready(function(){
	
	$(".scrollable").scrollable({circular: true});
	
	$(".accordion").tabs(".pane", {tabs: 'h2', effect: 'slide'});
	
	$(".contact_tabs").tabs("div.contact_panes > div");
	
	$("#testimonials_container .top").click(function(){
		
		var content = $(this).attr('data-content');
		
		$.fancybox(
			content,
			{
				'autoDimensions'	: true,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none'
			}
		);
	});
	
	var count = -1;
	var last;
	
	//scplit up the gallery into sets of 7 images and populate
	//the scroller root with the newly split sections
	
	$(".ngg-gallery-thumbnail-box").each(function(){
		
		count++;
		
		//once you reach the 7th element restart the counter
		if(count < 4){
			//get the last child DIV of parent .items
			last = $(".items > div:last");
			
			//append the image to the section
			$(last).append(this);
		}else{
			count = 0;
			//add another section to .items
			$('.items').append("<div></div>");
			
			//get the last child DIV of parent .items
			last = $(".items > div:last");
			
			//append the image to the section
			$(last).append(this);
		}
		
	})
	
	$(".ngg-gallery-thumbnail-box a").live('click', function(){
		console.log('you clicked a gallery image');
	})
})
