/* --------------------------- INTUIT CONFIDENTIAL ---------------------------

	allAccounts.js

	Written by		Date 
	Jason Harris	02/25/09
	
	Revised by		Date		Summary of changes

	
	Copyright 2008 Intuit, Inc All rights reserved. Unauthorized
	reproduction is a violation of applicable law. This material contains
	certain confidential and proprietary information and trade secrets of
	Intuit, Inc.
		
	RESTRICTED RIGHTS LEGEND
		
	Use, duplication, or disclosure by the Government is subject to
	restrictions as set forth in subdivision (b) (3) (ii) of the Rights in
	Technical Data and Computer Software clause at 52.227-7013.
		
	Intuit, Inc
	P.O. Box 7850
	Mountain View, CA 94039-7850

----------------------------- INTUIT CONFIDENTIAL ------------------------- */

function AllAccountsInit()
{
	AdjustGraphLabel($("#assetsGraph"));
	AdjustGraphLabel($("#debtGraph"));
	
	$(document).ready(function() {
		$(".actuator").bind("click",function() {
			var el = $(this);
			var parent = el.parent();
			console.log(parent);
			if(parent.hasClass("opened"))
			{
				$(".collapsible",parent).animate({
					opacity: "toggle",
					height: "toggle"
				});
				parent.find(".genreTotal").animate({
					opacity: "toggle"
				});
			}
			else if(parent.hasClass("closed"))
			{
				$(".collapsible",parent).animate({
					opacity: "toggle",
					height: "toggle"
				});
				parent.find(".genreTotal").animate({
					opacity: "toggle"
				});
			}
			parent.toggleClass("opened").toggleClass("closed");
		});
	});
}

function AdjustGraphLabel(graphElement)
{
	var barWidth = graphElement.find("div:first").width();
	var label = graphElement.find("span:first");
	var labelWidth = label.width();
	if (labelWidth >= barWidth - 12)
	{
		label.addClass("outsideGraph");
		label.css("padding-left", barWidth + "px");
	}
}