// JavaScript Document
function setup_Home(TheCount)
	{
	dojo.require("dojo.fx");
	
    dojo.addOnLoad(function() {
		if (TheCount > 1) { setup_HomeAnim(TheCount); } 
		});
	}
	
function setup_HomeAnim(TheCount) {	
	var myAnims = [], x;
	
	// loop once for each bucket
	for (x = 1; x <= TheCount; x++) {
		// first, hide the current balance 
		myAnims.push(dojo.fadeOut({
			node: String("ctrRedBarVal"+x), 
			delay: 2500
			}));
		
		// second, if this is not our last balance, set the current DIV to not display and then display the next DIV.
		// the fadein command will change the opacity of the next DIV so that it displays
		if (x < TheCount) {
			// we have to create a variable that holds callback function so we can lock-in the values (using a local variable)
			var cf = function(x) { 
				var myX=x;
				return(function(){
					dojo.style(dojo.byId(String("ctrRedBarVal"+myX)),"display","none");
					dojo.style(dojo.byId(String("ctrRedBarVal"+(myX+1))),"display","block");
					});
			};
			
			// setup the fadein and pass the callback function we created with the values locked-in
			myAnims.push(dojo.fadeIn({
				node: String("ctrRedBarVal"+(x+1)), 
				delay: 100,
				beforeBegin: cf(x)
				}));

			}
		else
			{
			var cf = function(x) { 
				var myX=x;
				return(function(){
					dojo.style(dojo.byId(String("ctrRedBarVal"+myX)),"display","none");
					dojo.style(dojo.byId("ctrRedBarVal1"),"display","block");
					});
			};
			
			// setup the fadein and pass the callback function we created with the values locked-in
			myAnims.push(dojo.fadeIn({
				node: "ctrRedBarVal1",
				delay: 100,
				beforeBegin: cf(x)
				}));
			}
		}
	
	// sequence the animations
	var anim = dojo.fx.chain(myAnims); 
	// we want this to run forever so we'll setup a looping action such that this function will call itself when the last animation executes
	dojo.connect(anim,"onEnd",function(){ setup_HomeAnim(TheCount); }); 
	// let's do it
	anim.play();
	} 
	
function setup_FundingBucket_Entry() 
	{
    dojo.require("dijit.Tooltip");
    dojo.addOnLoad(function() {
		//dojo.addClass(dojo.query("body"),"tundra");  
        new dijit.Tooltip({
            connectId: "nameLabel",
            label: "Enter a name for the funding bucket."
        	});
		});
	} 
	
function setup_DealerVoucherRequest2()
	{
		
	}
