var index = 1;
//var num_tombs = 18;
var run_init = true;
// interval is in milliseconds 
// X * 1000 = X seconds
// 2 * 1000 = 2 seconds
var interval = 1.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');
  $('#tomb_container img#tomb_1').css('opacity', '1');
  //switch_tomb();
  setTimeout('switch_tomb();', interval);
  
});

function switch_tomb()
{
	
	if(index == num_tombs)
	{
	
	  tomb_to_hide = index;
	  tomb_to_show = 1;
	  index = 1;
	  //$('#tomb_container img').css('opacity', '0');
	  
	  
	  
	}
	else
	{
	
	   tomb_to_hide = index;
       tomb_to_show = (index + 1);
       index++;
	
	}
		
    $("#tomb_" + tomb_to_hide).fadeTo(1000, 0, function () {
    
        $("#tomb_" + tomb_to_show).fadeTo(1000, 1, function () { 
        
            
            setTimeout('switch_tomb()', interval)
            
        });
    
    });

}
