/*
	===========================================================
	Custom Wordpress Theme - UI Effects - "Crunch.js"
	Author: Anchor Wave Internet Solutions, Anchorwave.com
	===========================================================
	Description: jQuery function initialization.
	===========================================================
*/

jQuery(function( $ ){	
	
// Custom NextGen Time

	// Disable click functionality when JS is enabled in browser
	$('.sbbl-gallery-thumbnail a').click(function(){
		return false;
	})

	// Add initial title text to h2
	initName = $('.sbbl-gallery-thumbnail a:first-child img').attr("alt");
	$('h2#gallery').append(initName);
	$('.ngg-galleryoverview .sbbl-gallery-thumbnail-box:first-child .sbbl-gallery-thumbnail a img').fadeTo(0,0.5);
	
	// Setup hover events for thumbnails
	$('.sbbl-gallery-thumbnail a').hover(function(){
		name = $(this).find('img').attr("alt");
		url = $(this).attr("href");
		
		$('.sbbl-big-image img').attr("src",url);
		$('h2#gallery').html("");
		$('h2#gallery').append(name);
		$(this).find('img').fadeTo(3,0.5);
	},function(){
		$(this).find('img').fadeTo(3,1);
	});
	
	// Portfolio/Sketchbook Events
	// Load Albums into left
	$('.openleft').click(function(){
		ajaxContent = $(this).attr('href');
		$('#left-content').html('');
		$('#left-content').load(ajaxContent+" .ngg-albumoverview");
		return false;
	});
	$('.Link').click(function(){
		ajaxContent = $(this).attr('href');
		$('#left-content').html('');
		$('#left-content').load(ajaxContent+" .ngg-galleryoverview");
		return false;
	});
	
	// Accordions
	$(".accordion").accordion({
		collapsible: true,
		active: false,
		autoHeight: false
	});
	
	// Who We Are Hovers
	$('.team-pic span').fadeOut(0);
	$('.team-pic').hover(function(){
		$(this).find('span').fadeIn('300');
	},function(){
		$(this).find('span').fadeOut('600');
	});	
	$('.team-pic').click(function(){
		if ( $(this).hasClass('team-bob') ){ $('.accordion').accordion('activate',1); }
		if ( $(this).hasClass('team-ken') ){ $('.accordion').accordion('activate',2); }
		if ( $(this).hasClass('team-thomas') ){ $('.accordion').accordion('activate',0); }
	});
	

								  
								  
});
