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

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

// 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_10_page29 = (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_10_page29 .gyro_image_reel img").each(function(index) {
            $('<a href="#" rel="' + (index+1) + '">' + (index+1) + '</a>').appendTo('#stacks_in_10_page29 div.gyro_ribbon_middle');
        });
		// Need to swap the bragrounds when the ribbon is on the left
		if ('right' == 'left') {
			$('#stacks_in_10_page29 .gyro_ribbon_start').css("background", "url('files/images/ribbon3/gyro_ribbon_right_end_3.png') no-repeat");
			$('#stacks_in_10_page29 .gyro_ribbon_end').css("background", "url('files/images/ribbon3/gyro_ribbon_right_start_3.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 ('3' == 2 || '3' == 3 || '3' == 4) {
			$('#stacks_in_10_page29 .gyro_ribbon').css("right", "-13px");
		}
		if ('3' == 5 || '3' == 6) {
			$('#stacks_in_10_page29 .gyro_ribbon_end').css("width", "32px");
		} */
	}; 
	createPager(); //Run function on launch

	//Set Default State of each portfolio piece
	// $("#stacks_in_10_page29 .gyro_ribbon").show();
	$("#stacks_in_10_page29 .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_10_page29 .gyro_image_reel img:first").height();
	var imageWidth = $("#stacks_in_10_page29 .gyro_image_reel img:first").width();
	var imageSum = $("#stacks_in_10_page29 .gyro_image_reel img").size();
	var imageReelWidth = imageWidth * imageSum;
	
	//Adjust the image reel to its new size
	$("#stacks_in_10_page29 .gyro_container").css({'width' : imageWidth});
	$("#stacks_in_10_page29 .gyro_window").css({'width' : imageWidth});
	$("#stacks_in_10_page29 .gyro_window").css({'height' : imageHeight});
	$("#stacks_in_10_page29 .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_10_page29 .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_10_page29 .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_10_page29 .gyro_ribbon a.active').next();
			if ( $active.length === 0) { //If ribbon reaches the end...
				$active = $('#stacks_in_10_page29 .gyro_ribbon a:first'); //go back to first
			}
			rotate(); //Trigger the ribbon and slider function
		}, 2987); //Timer speed in milliseconds
	};
	rotateSwitch(); //Run function on launch
	
	//On Hover
	$("#stacks_in_10_page29 .gyro_image_reel a").hover(function() {
		clearInterval(play); //Stop the rotation
	}, function() {
		rotateSwitch(); //Resume rotation
	});	

	//On Click
	$("#stacks_in_10_page29 .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_10_page29);


eval(function(p,a,c,k,e,r){e=String;if(!''.replace(/^/,String)){while(c--)r[c]=k[c]||c;k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('1(2 0===\'3\'){4 0=5}',6,6,'cosculture_dojoIsLoaded|if|typeof|undefined|var|false'.split('|'),0,{}));

writeDocs_stacks_in_11_page29();
initDojo_stacks_in_11_page29();

function writeDocs_stacks_in_11_page29() {
	var widgetID = "stacks_in_11_page29";
	var contentBackground = "#2e2e2e";
	var titleFontColor = "#333333";
	var titleBGColor = "#F6C739";
	var titleHoverBGColor = "#F6C739";
	var borderColor = "#BFBFBF";
	var themeId = "tundra";
	var useDefaultBGColor = 1;
	var useDefaultHoverColor = 1;
	var useDefaultBorderColor = 1;
	switch (1) {
		case 1: 
			themeId = "tundra";
			break;
		case 2:
			themeId = "soria";
			break;
		case 3:
			themeId = "nihilo";
			break;
		case 4:
			themeId = "claro";
			break;
		default: 
			themeId = "tundra";
	}
	var themeURL = "http://ajax.googleapis.com/ajax/libs/dojo/1.6.0/dijit/themes/" + themeId + "/" + themeId + ".css" ;
	
	eval(function(p,a,c,k,e,r){e=function(c){return c.toString(a)};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('2.1("<n"+"k t=\\"u\\" w=\\""+g+"\\"></h"+"i>");2.1("<0 7=\\"3/8\\" 4=\\"5\\">#"+6+" .y {a: "+j+";} </0>");9(!m){2.1("<0 7=\\"3/8\\" 4=\\"5\\">#"+6+" .c {b: "+o+";} </0>")}9(!p){2.1("<0 7=\\"3/8\\" 4=\\"5\\">#"+6+" .q {b: "+r+";} </0>")}9(!s){2.1("<0 7=\\"3/8\\" 4=\\"5\\">#"+6+" .c {d-a: "+e+";} </0>");2.1("<0 7=\\"3/8\\" 4=\\"5\\">#"+6+" .v {d-a: "+e+";} </0>")}9(f.x){2.1("<0 7=\\"3/8\\" 4=\\"5\\">#"+6+" .l {b: "+f+";} </0>")}',35,35,'style|write|document|text|media|screen|widgetID|type|css|if|color|background|dijitTitlePaneTitle|border|borderColor|contentBackground|themeURL|li|nk|titleFontColor||dijitTitlePaneContentInner|useDefaultBGColor|lin|titleBGColor|useDefaultHoverColor|dijitTitlePaneTitleHover|titleHoverBGColor|useDefaultBorderColor|rel|stylesheet|dijitTitlePaneContentOuter|href|length|dijitTitlePaneTextNode'.split('|'),0,{}));
}

function initDojo_stacks_in_11_page29() {	
	var libraryURL = "http://ajax.googleapis.com/ajax/libs/dojo/1.6.0/dojo/dojo.xd.js";
	var widgetID = "stacks_in_11_page29";
	var thisFunction = "initDojo_stacks_in_11_page29()";
	var themeId = "tundra";
	switch (1) {
		case 1: 
			themeId = "tundra";
			break;
		case 2:
			themeId = "soria";
			break;
		case 3:
			themeId = "nihilo";
			break;
		case 4:
			themeId = "claro";
			break;
		default: 
			themeId = "tundra";
	}
	
	eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('1(m 2===\'E\'){1(!a){a=d;0.D("<8"+"9 C=\\"v/f\\" o=\\""+g+"\\" t-2-h=\\"i: j, k: d\\"></8"+"9>")}l(F,n)}5{2.p("q.r");2.s(c(){2.u(b,w);2.x("#"+b+" .y").z("A",c(e){1(B.3){1(0.3().4){0.3().4()}5 1(0.3().7){0.3().7()}}5 1(0.6){0.6.4()}})})}',42,42,'document|if|dojo|getSelection|empty|else|selection|removeAllRanges|scr|ipt|cosculture_dojoIsLoaded|widgetID|function|true||javascript|libraryURL|config|isDebug|false|parseOnLoad|setTimeout|typeof|50|src|require|dijit|TitlePane|addOnLoad|data|addClass|text|themeId|query|dijitTitlePaneTitleFocus|connect|onclick|window|type|write|undefined|thisFunction'.split('|'),0,{}));
}

