
var first;
var active;

$( document ).ready( function ()
{
  $( function()
  {
    initialize();
  });
});

function initialize()
{
  showFirst();
  setInterval( "switchSlides()", 3000 );
}

function showFirst()
{
  first = $( '#image_container_profile img:first' );
  active = first;
  active.css( {'opacity': 1.0, 'z-index': 9 } );
}

function switchSlides()
{
  var next = ( active.next().length == 1 ) ? active.next() : first;
  next.css( {'opacity': 0.0, 'z-index': 10 } );
  next.animate( { 'opacity': 1.0 }, 1000, function()
  {
    active.css( { 'opacity': 0.0, 'z-index': 9 } );
    next.css( { 'opacity': 1.0, 'z-index': 9 } );
    active = next;
  });
}
