

		    /* <![CDATA[ */

				var oldBox = 1; //set the deafault featured village

				var stopAnimation = "false";

	

				$(document).ready(function(){
					 $("#ad2").slideUp(1);
					 $("#ad3").slideUp(1);
					 $("#ad4").slideUp(1);
					 $("#ad5").slideUp(1);
					automate();
				});

				

				// function for changing the small ad on the home page
				function fade(adBox, stopMotion){


					if ((adBox) != oldBox){

						var villageIn = ('#ad'+adBox); //set div id to a string for animation
						var villageOut = ('#ad'+oldBox);

						$(villageOut).slideUp("slow", function(){ $(villageIn).slideDown("slow"); } );
						oldBox = adBox; //set adBox as the oldBox so we now what to fade out next time

						automate();
					}

   				}; //close fade


				//sets which box to load and to fade
				function setBox(){

					adBox = (oldBox+1); // adds 1 to the current box
					if (adBox >= 5){									   
						adBox = 1;
					} 
					fade(adBox); // starts the function fade as if it was clicked with a adBox to load
				};


				var animationTimer = '';
				function automate(change){
					//alert('auto');
						if (stopAnimation == "false"){
							animationTimer = window.setTimeout(function() { setBox(); }, 8000); // set time
						}
				};

				

				// pauses animation on mouse over

				function mouseOver(){ 
					if (stopAnimation != "clicked"){
						stopAnimation = "true";
						window.clearTimeout(animationTimer);
					}
				};

				// unpauses animation on mouse out
				function mouseOut(){ 
					if (stopAnimation != "clicked"){
						stopAnimation = "false";
						automate();
					}
				};

			/* ]]> */

 