var g_images2 = [];
var g_slideIndex2 = 0;

function showSlide2()
{
  $('imgItem2').hide();

  var height = 166;
  var width = ( height / g_images2[ g_slideIndex2 ].height ) * g_images2[ g_slideIndex2 ].width;

  $('imgItem2').src = g_images2[ g_slideIndex2 ].src;
  $('imgItem2').width = width;
  $('imgItem2').height = height;

  $('imgItem2').show();
  
  g_slideIndex2++;
  if ( g_slideIndex2 >= g_images2.length )
    g_slideIndex2 = 0;
}

new Ajax.Request( 'xml/images2.xml', { 
  method: 'get',
  onSuccess: function( transport ) {
    var imageTags = transport.responseXML.getElementsByTagName( 'image' );

    for( var b = 0; b < imageTags.length; b++ ) {
      g_images2.push( {
        src: imageTags[b].getAttribute('src'),
        width: imageTags[b].getAttribute('width'),
        height: imageTags[b].getAttribute('height')
      } );
    }
    
    showSlide2();
    
    window.setInterval( showSlide2, 7000 );
  }
} );