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

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

// 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_6_page1 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	
// Image Safe v1.3.0 by Joe Workman
$(document).ready(function() {
	var img_height = $('#protected_stacks_in_6_page1 img').height();
	var img_width = $('#protected_stacks_in_6_page1 img').width();
	$('#protected_stacks_in_6_page1').height(img_height);
	$('#protected_stacks_in_6_page1').width(img_width);
	$('#protected_stacks_in_6_page1 a').height(img_height);

	var image_src = $("#protected_stacks_in_6_page1 img").attr("src");
	$("#protected_stacks_in_6_page1").css({'background-image':'url(' + image_src + ')'});
	$("#product_image_stacks_in_6_page1").height($("#protected_stacks_in_6_page1 img").height());
	$("#protected_stacks_in_6_page1").width($("#protected_stacks_in_6_page1 img").width());
	$("#protected_stacks_in_6_page1 img").remove();
	
    $('img').each(function(index) {
        $(this).hide();
        $(this).wrap('<div id="image_safe_'+ index +'" />');
        $('#image_safe_'+ index ).height($(this).height());
        $('#image_safe_'+ index ).width($(this).width());
        $('#image_safe_'+ index ).css({'background-image':'url(' + $(this).attr('src') + ')'});       
        $('.centered_image #image_safe_'+ index ).css({'margin':'0 auto'});       
        $(this).remove();
    });
});
// End Image Safe
	return stack;
})(stacks.stacks_in_6_page1);



