///////////////////////
//	EFFECTS.JS - REQUIRES JQUERY 3x
//	Please do not steal.
//	Every time you steal, An angry Scotsman punches a puppy in the face! A really cute puppy!

//WAIT FOR THE PAGE TO BE READY
$(document).ready(function(){
// Begin jQuery goodness

	noClick = false;
	firstLoad = true;

	$('#work_header p.more a').click(function(){
		if($(this).attr('class')!='active' && noClick == false){
			noClick = true;
			if(firstLoad == true){
				firstLoad = false;
				$('#work_header div.expand').show(0.0001, function(){
					newHeight = $(this).height();
					$(this).css({height:0}).animate({height:newHeight}, 1000, 'easeInOutExpo', function(){
						noClick = false;
					});
					//this.style.removeAttribute('filter');

				});
			}else{
				$('#work_header div.expand').animate({height:newHeight}, 1000, 'easeInOutExpo', function(){
					noClick = false;
				});
			}
			$(this).html('&mdash;Hide').addClass('active');
		}else if(noClick == false){
			noClick = true;
			$('#work_header div.expand').animate({height:0}, 1000, 'easeInOutExpo', function(){
				noClick = false;
			});
			$(this).html('&mdash;Read more').removeClass('active');
		}
		return false;
	});
	
	$('#work_1').cycle({
		fx:			'fade',
		timeout:	6000,
		speed:		2000,
		delay:		-2000
	});

	$('#work_2').cycle({
		fx:	'fade',
		timeout:	6000,
		speed:		2000,
		delay:		-500
	});


// End jQuery goodness
});

// t: current time, b: begInnIng value, c: change In value, d: duration
jQuery.easing['jswing'] = jQuery.easing['swing'];

jQuery.extend( jQuery.easing,
{
	easeInOutExpo: function (x, t, b, c, d) {
		if (t==0) return b;
		if (t==d) return b+c;
		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
	},
	easeInExpo: function (x, t, b, c, d) {
		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
	},
	easeOutExpo: function (x, t, b, c, d) {
		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
	}

});