// image slider

$(document).ready(function() {
    $('#slider').cycle({
		fx: 'fade',
		next: $('#nextBtn'),
		prev: $('#prevBtn')
	});
	
	$('#news').cycle({
		fx: 'fade'
	});
});

// content sliders

$('p.drop').click(function() { 
	$(this).toggleClass('open').next().slideToggle();
});

$('span.expand').click(function() { 
	$('p.drop').addClass('open').next().slideDown();
});

$('span.collapse').click(function() { 
	$('p.drop').removeClass('open').next().slideUp();
});

$('.single-gallery p.galleryExpand span.expand').click(function() { 
	$(this).parent().next().slideDown();
	$('.galleryThumb:nth-of-type(1n+15)').slideDown();
});

$('.single-gallery p.galleryExpand span.collapse').click(function() { 
	$(this).parent().next().slideUp();
});

$('.single-gallery p.table span.expand').click(function() { 
	$(this).parents().find('table tr').slideDown();
});

$('.single-gallery p.table span.collapse').click(function() { 
	$(this).parents().find('table tr').slideUp();
});

$('.category-featured span.expand, .single-post span.expand').click(function() { 
	$(this).parents().find('.otherProjects p').slideDown();
});

$('.category-featured span.collapse, .single-post span.collapse').click(function() { 
	$(this).parents().find('.otherProjects p').slideUp();
});

// Table Hider

$('.single-gallery table tr:nth-of-type(1n+5), .galleryContainer .galleryThumb:nth-of-type(1n+16)').hide();

$('.seeMore').click(function(event) { 
	$(this).parent().find('table tr:nth-of-type(1n+5), .galleryContainer .galleryThumb:nth-of-type(1n+16), p:nth-of-type(1n+4)').slideDown();
	$(this).hide();
	event.preventDefault();
});



// Google Analytics

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-27179598-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
