jQuery(function(){
	jQuery("a.shuffle").hide().css('left', function(index){
		return 496 - (jQuery(this).outerWidth() / 2) + "px";
	});
	jQuery(".middle_section").addClass("loading");
	jQuery(window).load(function(){
		jQuery(".middle_section").removeClass("loading");
		jQuery("a.shuffle:eq(2)").fadeIn(1000, function(){
			jQuery("a.shuffle").show();
			jQuery("a.shuffle:eq(0)").animate({left: 0}, 2000);
			jQuery("a.shuffle:eq(1)").animate({left: 150}, 2000);
			jQuery("a.shuffle:eq(3)").animate({left: 584}, 2000);
			jQuery("a.shuffle:eq(4)").animate({left: 791}, 2000);
			jQuery("a.shuffle:eq(5)").animate({left: 60}, 2000);
			jQuery("a.shuffle:eq(6)").animate({left: 678}, 2000);
			jQuery("a.shuffle").hover(function(){
				jQuery(this).animate({marginTop: '-=5'}, 200);
			}, function(){
				jQuery(this).animate({marginTop: '+=5'}, 200);
			});
			jQuery("a.shuffle").click(shuffle);			
		});
	});
});
function shuffle(evt) {
	var t = jQuery(this);
	if(!t.hasClass("pos3"))
	{
	if(!jQuery("a.shuffle").is(":animated"))
	{
	var o = jQuery(".pos3");
	var z = t.css('zIndex');
	var pos = t.position();
	var h = t.height();
	var w = t.width();
	t.trigger("blur");
	t.css('zIndex', 20);
	o.css('zIndex', z);
	t.addClass("no_shadow");
	o.addClass("no_shadow");
	t.animate({opacity: 0.8}, 0);
	o.animate({opacity: 0.8}, 0, function(){
		t.animate({top: 10, left: 335, height: 400, width: 324 }, 700);
		o.animate({top: pos.top, left: pos.left, height: h, width: w }, 700, function() {
	    	o.removeClass('pos3');
	    	t.addClass('pos3');
			t.removeClass("no_shadow");
			o.removeClass("no_shadow");
	    	t.animate({opacity: 1.0}, 200);
	    	o.animate({opacity: 1.0}, 200);
		});		
	});
	}
	evt.preventDefault();
	}
}

