// JavaScript Document

jQuery(document).ready(function(){
$("#page > .buckets ul li h2").click(
function(){
	if($(this).parent().hasClass("active")){
		$(this).parent().find(".expanded").fadeOut(100);
		$("#page > .buckets ul li").removeClass("active").animate({width: "241px"}, {queue: false, duraction: 400});
		$("#page > .buckets ul li#bucket-member").animate({left: "9px"}, {duration: 600});
		$("#page > .buckets ul li#bucket-directory").animate({left: "255px"}, {duration: 400});
		$("#page > .buckets ul li#bucket-lounge").animate({right: "255px"}, {duraction: 600});
		$("#page > .buckets ul li#bucket-selloff").animate({right: "9px"}, {duraction: 600});
		$(this).parent().find(".closed").delay(800).css({"color" : "#666666"});
	} else {
		$("#page > .buckets ul li.active h2").not(this).parent().find(".expanded").fadeOut(200);
		$("#page > .buckets ul li.active").find(".closed").css({"color" : "#666666"});
		$("#page > .buckets ul li.active h2").not(this).parent().removeClass("active");
		if($(this).parent().is("#bucket-member")){
			$(this).parent().find(".closed").css({"color" : "#FFFFFF"});
			$("#page > .buckets ul li#bucket-directory").delay(200).animate({left: "434px", width: "181px"}, {duration: 600});
			$("#page > .buckets ul li#bucket-lounge").delay(200).animate({right: "196px", width: "181px"}, {duration: 600});
			$("#page > .buckets ul li#bucket-selloff").delay(200).animate({right: "9px", width: "181px"}, {duration: 600});
			$(this).parent().addClass("active").delay(200).animate({left: "9px", width: "420px"}, {duration: 600})
			$(this).parent().find(".expanded").delay(800).fadeIn(400);
		}
		if($(this).parent().is("#bucket-directory")){
			$(this).parent().find(".closed").css({"color" : "#FFFFFF"});
			$("#page > .buckets ul li#bucket-member").delay(200).animate({left: "9px", width: "181px"}, {duration: 600});
			$("#page > .buckets ul li#bucket-lounge").delay(200).animate({right: "196px", width: "181px"}, {duration: 600});
			$("#page > .buckets ul li#bucket-selloff").delay(200).animate({right: "9px", width: "181px"}, {duration: 600});
			$(this).parent().addClass("active").delay(200).animate({left: "196px", width: "420px"}, {duration: 600});
			$(this).parent().find(".expanded").delay(800).fadeIn(400);
		}
		if($(this).parent().is("#bucket-lounge")){
			$(this).parent().find(".closed").css({"color" : "#FFFFFF"});
			$("#page > .buckets ul li#bucket-member").delay(200).animate({left: "9px", width: "181px"}, {duration: 600});
			$("#page > .buckets ul li#bucket-directory").delay(200).animate({left: "196px", width: "181px"}, {duration: 600});
			$("#page > .buckets ul li#bucket-selloff").delay(200).animate({right: "9px", width: "181px"}, {duration: 600});
			$(this).parent().addClass("active").delay(200).animate({right: "196px", width: "420px"}, {duration: 600});
			$(this).parent().find(".expanded").delay(800).fadeIn(400);
		}
		if($(this).parent().is("#bucket-selloff")){
			$(this).parent().find(".closed").css({"color" : "#FFFFFF"});
			$("#page > .buckets ul li#bucket-member").delay(200).animate({left: "9px", width: "181px"}, {duration: 600});
			$("#page > .buckets ul li#bucket-directory").delay(200).animate({left: "196px", width: "181px"}, {duration: 600});
			$("#page > .buckets ul li#bucket-lounge").delay(200).animate({right: "434px", width: "181px"}, {duration: 600});
			$(this).parent().addClass("active").delay(200).animate({right: "9px", width: "420px"}, {duration: 600});
			$(this).parent().find(".expanded").delay(800).fadeIn(400);
		}
	}
});
$("#content .buckets ul li h2").click(
function(){
	if($(this).parent().hasClass("active")){
		$(this).parent().find(".bucket_inner").slideUp(400);
		$(this).parent().removeClass("active");
	} else {
		$(this).parent().find(".bucket_inner").slideDown(400);
		$(this).parent().addClass("active");
	}
});
});
