
// '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_43_page5
// ---------------------------------------------------------------------

// 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_43_page5 = {};

// A closure is defined and assigned to the stack's object.  The object
// is also passed in as 'stack' which gives you a shorthand for referring
// to this object from elsewhere.
stacks.stacks_in_43_page5 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	
var $tb = jQuery.noConflict();
$tb(document).ready(function(){

//Scroll page up on iOS to bring TopBox into view
if((navigator.userAgent.match(/iPhone/i))||(navigator.userAgent.match(/iPad/i))) { 
$tb('[rel=]').each(function() { 
	$tb(this).click(function() { 
		setTimeout(scrollTo, 0, 0, 1); 
		}); 
	}); 
}
	
//Append TopBox and window shade onto the page body tag
$tb('#topBoxContentstacks_in_43_page5').css({display: 'block'});
$tb('body').append('<div id="topBoxstacks_in_43_page5" class="topBox"></div><div id="shadestacks_in_43_page5"></div>');


//Move Stack content up into the TopBox and block display the hidden content
$tb('#topBoxContentstacks_in_43_page5').appendTo('#topBoxstacks_in_43_page5');

//Trigger TopBox when user clicks on a link with matching REL tag and prevent anchor jump
$tb('[rel=]').click(function (e) {
		e.preventDefault();

//Fetches the screen height and width to calculate shade size
var shadeHeight = $tb(document).height();  
var shadeWidth = $tb(window).width();

//Centers the TopBox horizontally, based on screen size
var topboxHori = $tb('#topBoxstacks_in_43_page5');
topboxHori.css({position: 'fixed', left: '50%','margin-left': 0 - (topboxHori.width() / 2)
});

//Centers the TopBox vertically, based on screen size
var topboxVert = $tb('#topBoxstacks_in_43_page5');
topboxVert.css({position: 'fixed', top: '50%','margin-top': 0 - (topboxVert.height() / 2)
});

//IE6 has weak CSS support, so we have to use absolute positioning and a fixed window shade size
if ($tb.browser.msie && $tb.browser.version.substr(0,1)<7) {
  $tb('#topBoxstacks_in_43_page5').css({position: 'absolute'});
}
      
//Set height and width of shade to fill up the whole screen
$tb('#shadestacks_in_43_page5').css({'width':shadeWidth,'height':shadeHeight,'opacity':.85});

//Fade in window shade and TopBox on click and set fade speed
$tb('#shadestacks_in_43_page5, #topBoxstacks_in_43_page5').fadeIn(500);
});

//Fade out window shade and TopBox by clicking on window shade  
$tb('#shadestacks_in_43_page5').click(function(){
$tb('#shadestacks_in_43_page5, #topBoxstacks_in_43_page5').fadeOut(500);
})

//Fade out window shade and TopBox by clicking on close button  
$tb('.topBoxClose').click(function(){
$tb('#shadestacks_in_43_page5, #topBoxstacks_in_43_page5').fadeOut(500);
})

//Optional - fade out window shade and TopBox using keyboard ESC key
$tb(document).keydown( function( e ) { 
   if( e.which == 27) {
     $tb('#shadestacks_in_43_page5, #topBoxstacks_in_43_page5').fadeOut('500');
   } 
 }); 

});

//Recalculate the window shade size when the window is resized.
$tb(window).resize(function() {

	//Fetches the screen height and width to calculate shade size
	var shadeHeight = $tb(document).height();  
	var shadeWidth = $tb(window).width();

    $tb('#shadestacks_in_43_page5').css({'width':shadeWidth,'height':shadeHeight,'opacity':.85});
});
	return stack;
})(stacks.stacks_in_43_page5);


// Javascript for stacks_in_47_page5
// ---------------------------------------------------------------------

// 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_47_page5 = {};

// A closure is defined and assigned to the stack's object.  The object
// is also passed in as 'stack' which gives you a shorthand for referring
// to this object from elsewhere.
stacks.stacks_in_47_page5 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	
var $tb = jQuery.noConflict();
$tb(document).ready(function(){

//Scroll page up on iOS to bring TopBox into view
if((navigator.userAgent.match(/iPhone/i))||(navigator.userAgent.match(/iPad/i))) { 
$tb('[rel=]').each(function() { 
	$tb(this).click(function() { 
		setTimeout(scrollTo, 0, 0, 1); 
		}); 
	}); 
}
	
//Append TopBox and window shade onto the page body tag
$tb('#topBoxContentstacks_in_47_page5').css({display: 'block'});
$tb('body').append('<div id="topBoxstacks_in_47_page5" class="topBox"></div><div id="shadestacks_in_47_page5"></div>');


//Move Stack content up into the TopBox and block display the hidden content
$tb('#topBoxContentstacks_in_47_page5').appendTo('#topBoxstacks_in_47_page5');

//Trigger TopBox when user clicks on a link with matching REL tag and prevent anchor jump
$tb('[rel=]').click(function (e) {
		e.preventDefault();

//Fetches the screen height and width to calculate shade size
var shadeHeight = $tb(document).height();  
var shadeWidth = $tb(window).width();

//Centers the TopBox horizontally, based on screen size
var topboxHori = $tb('#topBoxstacks_in_47_page5');
topboxHori.css({position: 'fixed', left: '50%','margin-left': 0 - (topboxHori.width() / 2)
});

//Centers the TopBox vertically, based on screen size
var topboxVert = $tb('#topBoxstacks_in_47_page5');
topboxVert.css({position: 'fixed', top: '50%','margin-top': 0 - (topboxVert.height() / 2)
});

//IE6 has weak CSS support, so we have to use absolute positioning and a fixed window shade size
if ($tb.browser.msie && $tb.browser.version.substr(0,1)<7) {
  $tb('#topBoxstacks_in_47_page5').css({position: 'absolute'});
}
      
//Set height and width of shade to fill up the whole screen
$tb('#shadestacks_in_47_page5').css({'width':shadeWidth,'height':shadeHeight,'opacity':.85});

//Fade in window shade and TopBox on click and set fade speed
$tb('#shadestacks_in_47_page5, #topBoxstacks_in_47_page5').fadeIn(500);
});

//Fade out window shade and TopBox by clicking on window shade  
$tb('#shadestacks_in_47_page5').click(function(){
$tb('#shadestacks_in_47_page5, #topBoxstacks_in_47_page5').fadeOut(500);
})

//Fade out window shade and TopBox by clicking on close button  
$tb('.topBoxClose').click(function(){
$tb('#shadestacks_in_47_page5, #topBoxstacks_in_47_page5').fadeOut(500);
})

//Optional - fade out window shade and TopBox using keyboard ESC key
$tb(document).keydown( function( e ) { 
   if( e.which == 27) {
     $tb('#shadestacks_in_47_page5, #topBoxstacks_in_47_page5').fadeOut('500');
   } 
 }); 

});

//Recalculate the window shade size when the window is resized.
$tb(window).resize(function() {

	//Fetches the screen height and width to calculate shade size
	var shadeHeight = $tb(document).height();  
	var shadeWidth = $tb(window).width();

    $tb('#shadestacks_in_47_page5').css({'width':shadeWidth,'height':shadeHeight,'opacity':.85});
});
	return stack;
})(stacks.stacks_in_47_page5);



