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

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

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

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	
//-- Gyro Stack v1.2 by Joe Workman --//

$(document).ready(function() {

	// Create the ribbon HTML
	createPager = function(){	
        $("#stacks_in_3_page14 .gyro_image_reel img").each(function(index) {
            $('<a href="#" rel="' + (index+1) + '">' + (index+1) + '</a>').appendTo('#stacks_in_3_page14 div.gyro_ribbon_middle');
        });
		// Need to swap the bragrounds when the ribbon is on the left
		if ('right' == 'left') {
			$('#stacks_in_3_page14 .gyro_ribbon_start').css("background", "url('rw_common/plugins/stacks/images/ribbon0/gyro_ribbon_right_end_0.png') no-repeat");
			$('#stacks_in_3_page14 .gyro_ribbon_end').css("background", "url('rw_common/plugins/stacks/images/ribbon0/gyro_ribbon_right_start_0.png') no-repeat");			
		}
		// This is to set some CSS styles for ribbons that don't  fit into the defaults set in the CSS file
		/* if ('0' == 2 || '0' == 3 || '0' == 4) {
			$('#stacks_in_3_page14 .gyro_ribbon').css("right", "-13px");
		}
		if ('0' == 5 || '0' == 6) {
			$('#stacks_in_3_page14 .gyro_ribbon_end').css("width", "32px");
		} */
	}; 
	createPager(); //Run function on launch

	//Set Default State of each portfolio piece
	 $("#stacks_in_3_page14 .gyro_ribbon").show();
	$("#stacks_in_3_page14 .gyro_ribbon a:first").addClass("active");

	//Get size of images, how many there are, then determin the size of the image reel.
	var imageHeight = $("#stacks_in_3_page14 .gyro_image_reel img:first").height();
	var imageWidth = $("#stacks_in_3_page14 .gyro_image_reel img:first").width();
	var imageSum = $("#stacks_in_3_page14 .gyro_image_reel img").size();
	var imageReelWidth = imageWidth * imageSum;
	
	//Adjust the image reel to its new size
	$("#stacks_in_3_page14 .gyro_container").css({'width' : imageWidth});
	$("#stacks_in_3_page14 .gyro_window").css({'width' : imageWidth});
	$("#stacks_in_3_page14 .gyro_window").css({'height' : imageHeight});
	$("#stacks_in_3_page14 .gyro_image_reel").css({'width' : imageReelWidth});
			
	//ribbon + Slider Function
	rotate = function(){	
		var triggerID = $active.attr("rel") - 1; //Get number of times to slide
		var image_reelPosition = triggerID * imageWidth; //Determines the distance the image reel needs to slide

		$("#stacks_in_3_page14 .gyro_ribbon a").removeClass('active'); //Remove all active class
		$active.addClass('active'); //Add active class (the $active is declared in the rotateSwitch function)
		
		//Slider Animation
		$("#stacks_in_3_page14 .gyro_image_reel").animate({ 
			left: -image_reelPosition
		}, 1000 );		
	}; 
	
	var play;
	//Rotation + Timing Event
	rotateSwitch = function(){		
		play = setInterval(function(){ //Set timer - this will repeat itself every 3 seconds
			$active = $('#stacks_in_3_page14 .gyro_ribbon a.active').next();
			if ( $active.length === 0) { //If ribbon reaches the end...
				$active = $('#stacks_in_3_page14 .gyro_ribbon a:first'); //go back to first
			}
			rotate(); //Trigger the ribbon and slider function
		}, 10065); //Timer speed in milliseconds
	};
	rotateSwitch(); //Run function on launch
	
	//On Hover
	$("#stacks_in_3_page14 .gyro_image_reel a").hover(function() {
		clearInterval(play); //Stop the rotation
	}, function() {
		rotateSwitch(); //Resume rotation
	});	

	//On Click
	$("#stacks_in_3_page14 .gyro_ribbon a").click(function() {	
		$active = $(this); //Activate the clicked ribbon
		//Reset Timer
		clearInterval(play); //Stop the rotation
		rotate(); //Trigger rotation immediately
		if (false) {
			clearInterval(play); //Stop the rotation
		}
		else {
			rotateSwitch(); // Resume rotation
		}
		return false; //Prevent browser jump to link anchor
	});	
});

//-- End Gyro Stack --//
	return stack;
})(stacks.stacks_in_3_page14);


// Javascript for stacks_in_16_page14
// ---------------------------------------------------------------------

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

// 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_16_page14 = (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 $ic = jQuery.noConflict();
$ic(document).ready(function () {
	
	//Show the caption container permanently if required
	$ic('#imageCaptionBoxstacks_in_16_page14').show();
	
	//Hide the caption container on load
	$ic('#imageCaptionBoxstacks_in_16_page14').hide();
	
	//Make caption background transparent using jQuery
	$ic('#imageCaptionBoxstacks_in_16_page14').css('opacity', '0.99');
	
	//Fetches the image width to calculate caption width 
	var captionWidth = $ic('#imageCaptionstacks_in_16_page14 img').width();
	
	//Set width of caption to match image width  
	$ic('#imageCaptionBoxstacks_in_16_page14').css({'width':captionWidth});
	
	//Centers the caption horizontally, based on image size
	var captionCenter = $('#imageCaptionBoxstacks_in_16_page14');
	captionCenter.css({'z-index' : '999', position: 'absolute', left: '50%','margin-left': 0 - (captionCenter.width() / 2)
	});
	   
	$ic('#imageCaptionstacks_in_16_page14').hover(  
		function () {  
		//show caption on hover  
		$ic('#imageCaptionBoxstacks_in_16_page14', this).fadeIn(1);
		},   
		function () {  
		//hide caption again 
		$ic('#imageCaptionBoxstacks_in_16_page14', this).fadeOut(1);          
		}  
	);  
});
	return stack;
})(stacks.stacks_in_16_page14);


// Javascript for stacks_in_22_page14
// ---------------------------------------------------------------------

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

// 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_22_page14 = (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 $ic = jQuery.noConflict();
$ic(document).ready(function () {
	
	//Show the caption container permanently if required
	$ic('#imageCaptionBoxstacks_in_22_page14').show();
	
	//Hide the caption container on load
	$ic('#imageCaptionBoxstacks_in_22_page14').hide();
	
	//Make caption background transparent using jQuery
	$ic('#imageCaptionBoxstacks_in_22_page14').css('opacity', '0.99');
	
	//Fetches the image width to calculate caption width 
	var captionWidth = $ic('#imageCaptionstacks_in_22_page14 img').width();
	
	//Set width of caption to match image width  
	$ic('#imageCaptionBoxstacks_in_22_page14').css({'width':captionWidth});
	
	//Centers the caption horizontally, based on image size
	var captionCenter = $('#imageCaptionBoxstacks_in_22_page14');
	captionCenter.css({'z-index' : '999', position: 'absolute', left: '50%','margin-left': 0 - (captionCenter.width() / 2)
	});
	   
	$ic('#imageCaptionstacks_in_22_page14').hover(  
		function () {  
		//show caption on hover  
		$ic('#imageCaptionBoxstacks_in_22_page14', this).fadeIn(1);
		},   
		function () {  
		//hide caption again 
		$ic('#imageCaptionBoxstacks_in_22_page14', this).fadeOut(1);          
		}  
	);  
});
	return stack;
})(stacks.stacks_in_22_page14);


// Javascript for stacks_in_31_page14
// ---------------------------------------------------------------------

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

// 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_31_page14 = (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 $ic = jQuery.noConflict();
$ic(document).ready(function () {
	
	//Show the caption container permanently if required
	$ic('#imageCaptionBoxstacks_in_31_page14').show();
	
	//Hide the caption container on load
	$ic('#imageCaptionBoxstacks_in_31_page14').hide();
	
	//Make caption background transparent using jQuery
	$ic('#imageCaptionBoxstacks_in_31_page14').css('opacity', '0.99');
	
	//Fetches the image width to calculate caption width 
	var captionWidth = $ic('#imageCaptionstacks_in_31_page14 img').width();
	
	//Set width of caption to match image width  
	$ic('#imageCaptionBoxstacks_in_31_page14').css({'width':captionWidth});
	
	//Centers the caption horizontally, based on image size
	var captionCenter = $('#imageCaptionBoxstacks_in_31_page14');
	captionCenter.css({'z-index' : '999', position: 'absolute', left: '50%','margin-left': 0 - (captionCenter.width() / 2)
	});
	   
	$ic('#imageCaptionstacks_in_31_page14').hover(  
		function () {  
		//show caption on hover  
		$ic('#imageCaptionBoxstacks_in_31_page14', this).fadeIn(1);
		},   
		function () {  
		//hide caption again 
		$ic('#imageCaptionBoxstacks_in_31_page14', this).fadeOut(1);          
		}  
	);  
});
	return stack;
})(stacks.stacks_in_31_page14);


// Javascript for stacks_in_37_page14
// ---------------------------------------------------------------------

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

// 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_37_page14 = (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 $ic = jQuery.noConflict();
$ic(document).ready(function () {
	
	//Show the caption container permanently if required
	$ic('#imageCaptionBoxstacks_in_37_page14').show();
	
	//Hide the caption container on load
	$ic('#imageCaptionBoxstacks_in_37_page14').hide();
	
	//Make caption background transparent using jQuery
	$ic('#imageCaptionBoxstacks_in_37_page14').css('opacity', '0.99');
	
	//Fetches the image width to calculate caption width 
	var captionWidth = $ic('#imageCaptionstacks_in_37_page14 img').width();
	
	//Set width of caption to match image width  
	$ic('#imageCaptionBoxstacks_in_37_page14').css({'width':captionWidth});
	
	//Centers the caption horizontally, based on image size
	var captionCenter = $('#imageCaptionBoxstacks_in_37_page14');
	captionCenter.css({'z-index' : '999', position: 'absolute', left: '50%','margin-left': 0 - (captionCenter.width() / 2)
	});
	   
	$ic('#imageCaptionstacks_in_37_page14').hover(  
		function () {  
		//show caption on hover  
		$ic('#imageCaptionBoxstacks_in_37_page14', this).fadeIn(1);
		},   
		function () {  
		//hide caption again 
		$ic('#imageCaptionBoxstacks_in_37_page14', this).fadeOut(1);          
		}  
	);  
});
	return stack;
})(stacks.stacks_in_37_page14);


// Javascript for stacks_in_46_page14
// ---------------------------------------------------------------------

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

// 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_46_page14 = (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 $ic = jQuery.noConflict();
$ic(document).ready(function () {
	
	//Show the caption container permanently if required
	$ic('#imageCaptionBoxstacks_in_46_page14').show();
	
	//Hide the caption container on load
	$ic('#imageCaptionBoxstacks_in_46_page14').hide();
	
	//Make caption background transparent using jQuery
	$ic('#imageCaptionBoxstacks_in_46_page14').css('opacity', '0.99');
	
	//Fetches the image width to calculate caption width 
	var captionWidth = $ic('#imageCaptionstacks_in_46_page14 img').width();
	
	//Set width of caption to match image width  
	$ic('#imageCaptionBoxstacks_in_46_page14').css({'width':captionWidth});
	
	//Centers the caption horizontally, based on image size
	var captionCenter = $('#imageCaptionBoxstacks_in_46_page14');
	captionCenter.css({'z-index' : '999', position: 'absolute', left: '50%','margin-left': 0 - (captionCenter.width() / 2)
	});
	   
	$ic('#imageCaptionstacks_in_46_page14').hover(  
		function () {  
		//show caption on hover  
		$ic('#imageCaptionBoxstacks_in_46_page14', this).fadeIn(1);
		},   
		function () {  
		//hide caption again 
		$ic('#imageCaptionBoxstacks_in_46_page14', this).fadeOut(1);          
		}  
	);  
});
	return stack;
})(stacks.stacks_in_46_page14);


// Javascript for stacks_in_52_page14
// ---------------------------------------------------------------------

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

// 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_52_page14 = (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 $ic = jQuery.noConflict();
$ic(document).ready(function () {
	
	//Show the caption container permanently if required
	$ic('#imageCaptionBoxstacks_in_52_page14').show();
	
	//Hide the caption container on load
	$ic('#imageCaptionBoxstacks_in_52_page14').hide();
	
	//Make caption background transparent using jQuery
	$ic('#imageCaptionBoxstacks_in_52_page14').css('opacity', '0.99');
	
	//Fetches the image width to calculate caption width 
	var captionWidth = $ic('#imageCaptionstacks_in_52_page14 img').width();
	
	//Set width of caption to match image width  
	$ic('#imageCaptionBoxstacks_in_52_page14').css({'width':captionWidth});
	
	//Centers the caption horizontally, based on image size
	var captionCenter = $('#imageCaptionBoxstacks_in_52_page14');
	captionCenter.css({'z-index' : '999', position: 'absolute', left: '50%','margin-left': 0 - (captionCenter.width() / 2)
	});
	   
	$ic('#imageCaptionstacks_in_52_page14').hover(  
		function () {  
		//show caption on hover  
		$ic('#imageCaptionBoxstacks_in_52_page14', this).fadeIn(1);
		},   
		function () {  
		//hide caption again 
		$ic('#imageCaptionBoxstacks_in_52_page14', this).fadeOut(1);          
		}  
	);  
});
	return stack;
})(stacks.stacks_in_52_page14);



