$(document).ready(function(){
	
	$('#portfolioContent .portfolio-list li').addClass('on');
		
});

$(function(){
	//trim the margin of every 5th child so the pixels fit exactly the width of the content container
	for (var i=5; i<100; i=i+5) {
		$('ul.portfolio-list>li:nth-child('+i+')').css('marginRight', '0');
		$('ul.portfolio-list >li:nth-child('+i+') div.lightbox').css('right', '0');
		$('ul.portfolio-list >li:nth-child('+(i-1)+') div.lightbox').css('right', '0');
	}
	
	//subnav click behavior
	/*$('#portfolioNav a').click(function(){
		//switch highlighted nav square
		$(this).parent().siblings('.current').removeClass('current');
		$(this).parent().addClass('current');
		
		//parse which button was clicked
		var selection = $(this).text().toLowerCase();
		
		if (selection == "all")
		{
			$('#portfolioContent div.shader').hide();
			$('#portfolioContent .portfolio-list li').removeClass('off');
			$('#portfolioContent .portfolio-list li').addClass('on');
		}
		else
		{
			$('#portfolioContent div.shader').hide();
			$('#portfolioContent .portfolio-list li').removeClass('off');
			$('#portfolioContent .portfolio-list li').addClass('on');
			$('#portfolioContent li:not(.'+selection+') div.shader').show();
			$('#portfolioContent li:not(.'+selection+')').removeClass('on');
			$('#portfolioContent li:not(.'+selection+')').addClass('off');
		}
		
		//stop default a tag behavior
		return false;
	});*/
	
	//mouseover lightboxes
	$('#portfolioContent .portfolio-list li').hover(function(){
		if ( $(this).hasClass('on') ) {
			$(this).children('div.lightbox').show();
			$(this).css('z-index','1000');
		}
	}, function(){
		$(this).children('div.lightbox').hide();
		$(this).css('z-index','1');
	});
	
});



//Current Portfolio Sorting

$(function(){
	//select IT by default
	$('#portfolioContentAll').addClass('current');
	$('.subnav-owned>div.content:not(#portfolioContentAll)').hide();
	
	//subnav click behaviors
	$('#portfolioNav a').click(function(){
		//switch highlighted nav square
		$(this).parent().siblings('.current').removeClass('current');
		$(this).parent().addClass('current');
		
		//parse which button was clicked
		var selection = "#portfolioContent" + $(this).text();
		
		//hide all content except selected
		$('.subnav-owned div.content').hide()
		$('.subnav-owned div.content'+selection).show();
		
		//prevent default a tag behavior
		return false;
	});
});
