// 'stacks' is the Stacks global object.
// All of the other Stacks related Javascript will 
// be attatched to it.
var stacks = {};


// this call to jQuery gives us access to the globaal
// jQuery object. 
// 'noConflict' removes the '$' variable.
// 'true' removes the 'jQuery' variable.
// removing these globals reduces conflicts with other 
// jQuery versions that might be running on this page.
stacks.jQuery = jQuery.noConflict(true);

// Javascript for stacks_in_27_page3
// ---------------------------------------------------------------------

// Each stack has its own object with its own namespace.  The name of
// that object is the same as the stack's id.
stacks.stacks_in_27_page3 = {};

// A closure is defined and assined to the stack's object.  The object
// is also passed in as 'stack' which gives you a shorthand for refering
// to this object from elsewhere.
stacks.stacks_in_27_page3 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	
/*	LayerUp Stack jQuery Code 2.0.0  */
/* ***********************************************************************************
	Copyright (c) 2010, Mauricio Sabene. All rights reserved.
/* ***********************************************************************************
*/
var allLayers;
var layerup_comp;

function BuildUp (startDelay){
	var cum_delay= startDelay;
	allLayers.fadeOut(0);
	allLayers.each(function() {
	var ms_top = jQuery(this).data('layerUp_top');
	var ms_left = jQuery(this).data('layerUp_left');
	var ms_delay= jQuery(this).data('layerUp_duration');
	jQuery(this).css({top: ms_top+'px', left: ms_left+'px'});
	jQuery(this).delay(cum_delay).fadeIn(0);
	cum_delay = cum_delay + ms_delay + 0;
	}); return cum_delay;
};

jQuery(window).load(function() {
	allLayers = jQuery('#buildupstacks_in_27_page3 .bu_slide');
	jQuery('#bu_stacks_in_27_page3').css({ backgroundImage: 'none'});
	jQuery('#buildupstacks_in_27_page3').css({ visibility: 'visible' });	
	layerup_comp = jQuery('#buildupstacks_in_27_page3');
	var ms_duration = BuildUp(0000) + 1000;
	for(var i = 1; i < 1; i++) {
	setTimeout(function(){BuildUp(0);}, 0000 + i * (ms_duration - 0000));
	}
	jQuery('#bu_stacks_in_27_page3 .toggleBuildUp').click(function() {layerup_comp.toggle('slow'); return false;});
	jQuery('#bu_stacks_in_27_page3 .reloadBuildUp').click(function() {
		if (!allLayers.parent().children().is(':animated')) {
		layerup_comp.show('slow');
		BuildUp(1000);}
		return false;
	});
});
	return stack;
})(stacks.stacks_in_27_page3);



