// JavaScript Document

var oldBox = 1; //set the deafault featured post
						
			jQuery(document).ready(function(){
				  jQuery("#quote2").slideUp(1);
				  jQuery("#quote3").slideUp(1);
				  jQuery("#quote4").slideUp(1);
				  jQuery("#quote5").slideUp(1);
				  jQuery("#quote6").slideUp(1);
				  
				//document.getElementById("box"+oldBox).style.backgroundColor = "#424242";
				automate();
			});
			
			// function to set automation timer
			var animationTimer = '';
			function automate(change){
				animationTimer = window.setTimeout(function() { setBox(); }, 9000); // set time
			};
			
			//sets which box to load and to fade
			function setBox(){
				newBox = (oldBox+1); // adds 1 to the current box
				if (newBox >= 7){									   
					newBox = 1;
				} 
				fade(newBox); // starts the function fade as if it was clicked with a newBox to load
			};
			
			// function for changing the featured post on the home page
			function fade(newBox){
			
				if ((newBox) != oldBox){
					var postIn = ('#quote'+newBox); //set div id to a string for animation
					var postOut = ('#quote'+oldBox);
			
					jQuery(postOut).fadeOut(1000, function() {
						jQuery(postIn).fadeIn(1000);
					});
					
			
					var activeNav = ("quote"+newBox); //set nav div id to a string for animation
					var oldNav = ("quote"+oldBox);
			
					oldBox = newBox; //set newBox as the oldBox so we now what to fade out next time
					automate();
			
				}
			}; //close fade
