$(function (){
   
   //init the timer

   //on timeout then swap the img

   t=setTimeout("img_swap()",10000);

});

function img_swap(){
	
	container = $(".swap_img");

	var elements = [];

	var visible = 0;

	var tobeshown = 0;

	var total = 0;	
	
	// console.log(container);

	$(container).find(".promo").each(function (count ,element){

		total = count;

		// console.log(element);

		//go through all of them and check to see which is visible 
		elements.push(element);

		if($(element).css("display") != "none"){
			
			//alert("Visible" + count);
			
			visible = count;

		}
		
	})

	//check that the one visible isnt at the end of the list
	if(visible != total){
		
		tobeshown = visible + 1;

	}

	// console.log(total)
	// console.log(visible)
	// console.log(tobeshown)
	
	$(elements[visible]).hide();

	$(elements[tobeshown]).show();

	t=setTimeout("img_swap()",10000);

}
