// JavaScript Document
var oldBox = 1; //set the deafault featured post
	var stopTest = "false"
	jQuery(document).ready(function(){
		jQuery("#test2").hide();
		jQuery("#test3").hide();
		jQuery("#test4").hide();
		
		moveCount();
		/*
		jQuery(".errorBox").animate( {opacity: 1.0}, 3000, function() {
			jQuery(".errorBox").animate( {opacity: 0.5}, 2000, function() {
				jQuery(".errorBox").slideUp("slow");
			});
		}); 
		*/
	});
	
	var testTimer = '';
	function moveCount(){
		if (stopTest == "false"){
			testTimer = window.setTimeout(function() { setTest(); }, 7000); // set time
		}
	}
	
	//sets which box to load and to fade
	function setTest(){
		newBox = (oldBox+1); // adds 1 to the current box
		if (newBox >= 5){									   
			newBox = 1;
		} 
		changeTest(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 changeTest(newBox){
		if ((newBox) != oldBox){
			var postIn = ('#test'+newBox); //set div id to a string for animation
			var postOut = ('#test'+oldBox);
			
			// animate the old box out and the new box in
			$(postOut).slideUp("slow", function() {
				$(postIn).slideDown("slow");
			});

			oldBox = newBox; //set newBox as the oldBox so we now what to fade out next time
			moveCount();

		}
	}; //close fade
