var index = 1;
//var num_tombs = 18;
var run_init = true;
// interval is in milliseconds 
// X * 1000 = X seconds
// 7 * 1000 = 7 seconds
var interval = 5.5 * 1000;


$(document).ready(function() {

  //hide_morph = new Fx.Morph();
  //show_morph = new Fx.Morph();
  //$('#tomb_18').fadeTo("fast", 0);
  
  num_tombs = $('#tomb_container img').length;
  $('#tomb_container img').css('opacity', '0');
  switch_tomb();
  //setTimeout('switch_tomb();', 1000);
  
});

function switch_tomb()
{
	
	//alert("next_tip_index: " + next_tip_index + " index: " + index);
	
		
    $("#tomb_" + index).fadeTo(2000, 0, function () {
    
        $("#tomb_" + (index + 1)).fadeTo(2000, 1, function () { 
        
            setTimeout('switch_tomb()', interval)
            
        });
    
    });
    
    // Why can't this go into the last callback above?
    index++;
            
    if(index > num_tombs)
	{
	
	  index = 1;
	  
	}
        	
        	

}
