//gallery item hover overshadow
$(document).ready(function() {
	$(".portfolioFeature li").hover(function(){
		var overlay = $(this).children(".overlay");						
		$(this).stop().children(".overlay").animate({opacity: "show"}, "slow").css('cursor', 'pointer');  
		
		//get link object so we can click through and call fancybox
		var linkObj = $(this).find("a");	
		var target = linkObj.attr('href');									
		
		overlay.click(function(){						
			window.location = target;			
        });
		
	},function(){
		$(this).stop().children(".overlay").animate({opacity: "hide"}, "slow").css('cursor', 'pointer');  
	});
});


//portfolio item hover overshadow
$(document).ready(function() {
	$(".portfolioItem").hover(function(){
		var overlay = $(this).children(".overlay");						
		$(this).stop().children(".overlay").animate({opacity: "show"}, "slow").css('cursor', 'pointer');  
		
		//get link object so we can click through and call fancybox
		var linkObj = $(this).next().find("a.details");	
		var target = linkObj.attr('href');									
		
		overlay.click(function(){						
			window.location = target;			
        });
		
	},function(){
		$(this).stop().children(".overlay").animate({opacity: "hide"}, "slow").css('cursor', 'pointer');  
	});
});


//portfolio toggle stuff
$(document).ready(function() {
	   
   //option has been clicked
   /*
   1. Get the link text of the item and set the selected text to it
   2. Toggle the currently shown element in place with the chosen element
   3. Set the clicked link to the class 'visible'
   */
   $('#portfolioNav li a').click(function(e) {
   		  		   		
   		var hash = $(this).attr('href').split('#')[1]; //should map to the id of the content to show
   		//console.log('#' + hash);  		
   		
   		$('#portfolioNav li a').removeClass('selected');
   		$(this).addClass('selected');   	
   		   		
   		   		   		
   		//hide currently visible content   		   		
   		$('.portfolio').find(".visibleContent").animate({opacity: "hide"}, "fast").removeClass('visibleContent').addClass('invisible');
   		
   		//show the div we want
   		$('#' + hash).animate({opacity: "show"}, "fast").addClass('visibleContent').removeClass('invisible');
   		
   		return false;
   });   
});

$(document).ready(function() {
		$(function()
		{
			// Call stylesheet init so that all stylesheet changing functions 
			// will work.
			$.stylesheetInit();
			
			// This code loops through the stylesheets when you click the link with 
			// an ID of "toggler" below.
			$('#toggler').bind(
				'click',
				function(e)
				{
					$.stylesheetToggle();
					return false;
				}
			);
			
			// When one of the styleswitch links is clicked then switch the stylesheet to
			// the one matching the value of that links rel attribute.
			$('.styleswitch').bind(
				'click',
				function(e)
				{
					$.stylesheetSwitch(this.getAttribute('rel'));
					return false;
				}
			);
		}
	);
});
