$(document).ready(function() {
	
	
	
	//not done with the site yet... have to build out portfolio. show messages temporarily
	//this is very sloppy... so bad. Punch me.
	$('a.portfolio-item').attr("href", "#stillworking");
	$('a.portfolio-item-locked').attr("href", "#lockedmessage");

	
	
	
	$('.portfolio-items-wrap').append("<div class='ajaxcontent'></div>");
	
	/*** setup fancybox on links ****/
	$('a.portfolio-item').fancybox();
	$('a.portfolio-item-locked').fancybox();
	
	/*************************************************
	
	Click Handlers
	
	**************************************************/ 
	$('a#btn-load-more').click(function(e) {
		$(this).fadeOut('slow');	
		e.preventDefault();
		$('.ajaxcontent').hide().load('portfolio-2012-items.html', function() {
			$('.ajaxcontent a').hide().appendTo('.portfolio-items-wrap');
			$('.portfolio-items-wrap a:hidden').each(function(i){
				var time = i*500;
				$(this).delay(time).fadeIn('fast');
			});
			// more sloppy code for temporary messages so I can push this live.
			$('a.portfolio-item').attr("href", "#stillworking");
			$('a.portfolio-item-locked').attr("href", "#lockedmessage");
			$('a.portfolio-item').fancybox();
			$('a.portfolio-item-locked').fancybox();
			
		});
	});
	
	
	
	

/**********************************************************
***********************************************************
***********************************************************
***********************************************************

RESPONSIVE & PARALLAX STUFF

***********************************************************
***********************************************************
***********************************************************
***********************************************************/

	
	$("#explode").fitText(0.421);
	$(".sayhello").fitText(0.8);
	
	
	
	var scrollorama = $.scrollorama({
	    blocks:'.scrollblock'
	});
	
	scrollorama.animate('#explode',{ duration: 300, property:'zoom', end: 3 });
	scrollorama.animate('#explode',{ duration: 200, property:'top', end: 300 });
	$('#explode span').each(function() {
		scrollorama.animate($(this),{ duration: 200, property:'top', end: Math.random()*220-280 });
		scrollorama.animate($(this),{ duration: 200, property:'rotate', start:0, end:Math.random()*720-360 });
		scrollorama.animate($(this),{ duration: 500, property:'opacity', end:0 });
	});
	
	scrollorama.animate('#mywork-titletext span.mywork-title-block',{ delay: 500, duration: 600, property:'letter-spacing', start:18 });


});




