jQuery(function($){
	
	// IE last-child selectors
	$('.col:last-child').addClass('last');
	$('.sub-slide:last-child').addClass('last');
	$('.col h2:first-child').addClass('first');
	$('.projects ul.sub_nav li:nth-child(2), .project ul.sub_nav li:nth-child(2)').addClass('dropdown-parent');
	$('.sidebar ul.archive li:nth-child(6), .sidebar ul.archive li:last-child').addClass('last');
	
	
	// All carousels (not just home page)
    $('.carousel').cycle({
		fx: 'scrollHorz',
		pause: 1,
		pager: '#pager',
		//random: 1, //uncomment to make slider order random
		timeout: 4000 //set the time between each transition
	});
	

	
	// Project Detail Slider (version C)
	$(".scrollable-wrap").scrollable({
		circular: true
	});
	
	// fade LAB NOTES images on hover
	$('.project-image').hover(function() {
		$(this).find('.caption').fadeTo(100, 1);
	}, function() {
		$(this).find('.caption').fadeTo(100, 0);
	});
	
		
	
	//Sub-nav dropdown slide down on click
    $(".sub_nav li.dropdown a").click(function(){
		$("#subnav-dropdown").slideToggle(200);
		
		if ($(this).parent().hasClass('active')) {
			$(this).parent().removeClass("active");
		} else {
			$(this).parent().addClass("active");
		}
	});
	
	
	
	// fade LAB NOTES images on hover
	$('.lab .project').hover(function() {
		$(this).find('img').fadeTo(200, 0.5);
	}, function() {
		$(this).find('img').fadeTo(200, 1);
	});
	
	// fade PROJECTS images on hover
	$('.projects .threecol .col').hover(function() {
		$(this).find('img').fadeTo(200, 0.5);
	}, function() {
		$(this).find('img').fadeTo(200, 1);
	});
	
	// fade Carousel images on hover
	//$('.carousel a img').hover(function() {
	//	$(this).fadeTo(200, 0.5);
	//}, function() {
	//	$(this).fadeTo(200, 1);
	//});
	
	
	
	// Projects Archive Table Sorting
	$("table#projects-archive").tablesorter({widgets: ['zebra']});
	
    
});

