var current_feature = 1;
var num_of_features = 0;
var oldNum = 0;
var newNum = 0;

$(function(){

	num_of_features = $("#pano_container").children().length;
	$("#pano_container").children().css("z-index", "1");
	show_pano();
	
	// =========================================
	//	SET UP TIMER FOR FEATURES
	// =========================================
	$(document).everyTime(5000, function(){
		show_pano();
	});
});

function show_pano()
{
	// while the new number is the same as the old one
	while(oldNum == newNum)
		newNum = Math.floor(Math.random()*num_of_features);
	
	// fade in the new pano
	$("#img_"+newNum).css("z-index", "2");
	$("#img_"+oldNum).css("z-index", "1");
	$("#img_"+newNum).fadeIn(1000, function(){
		//alert("done");
		$("#img_"+oldNum).hide();
		oldNum = newNum;
	});
}
