$(function () { 
	// Stack initialize
	var openspeed = 300;
	var closespeed = 300;
	$('.stack>img').toggle(function(){
		var vertical = 0;
		var horizontal = 0;
		var $el=$(this);
		$el.next().children().each(function(){
			$(this).animate({top: '-' + vertical + 'px', left: horizontal + 'px'}, openspeed);
			vertical = vertical + 70; //spacing between each icon
			horizontal = (horizontal+0);//*1.15; //curvature
		});
		$el.next().animate({top: '400px', left: '-200px'}, openspeed).addClass('openStack')
		   .find('li a>img').animate({width: '30px'/*zoom*/, marginLeft: '0px'}, openspeed);
		$el.animate({paddingTop: '0px'}); //movement of menu image down on click
		
	}, function(){
		//reverse above
		var $el=$(this);
		$el.next().removeClass('openStack').children('li').animate({top: '-400px', left: '200px'}, closespeed);
		$el.next().find('li a>img').animate({width: '10px', marginLeft: '10px', marginTop: '0px'}, closespeed);
		$el.animate({paddingTop: '0px'/*height movement for base menu image*/});
	});
	
	// Stacks additional animation
	$('.stack li a').hover(function(){
		$("img",this).animate({width: '45px'}, 100);
		$("span",this).animate({marginLeft: '10px'}); //text bouce distance out
	},function(){
		$("img",this).animate({width: '40px'}, 100);
		$("span",this).animate({marginLeft: '0'}); //text bounce
	});
});