function loadImages(holder,urlpath,offset){	$.ajax({ type: "GET", url: urlpath, dataType: "xml", success:
		function(xml) {
			var cnt = 0;
			var pos = 1;
			var duration = new Array ();
			var interval = 0;

			$(xml).find('item').each(function(){
				var photo = $(this).find('photo').text();
				cnt++;
				$(holder+' a').append ( "<img src="+photo+" width='98' height='98' rel='"+cnt+"' />" );
				duration[cnt] = $(this).find('duration').text();
				interval += Number(duration[cnt]);
			});
			pos = cnt;

			$(holder + ' a img[rel='+pos+']').show();
			setTimeout (
				function () {					setInterval ( function () {						swapImages(holder,cnt,duration);
					}, interval );
					swapImages(holder,cnt,duration);
				}
			, offset );
		}
	});
}

function swapImages (holder,cnt,duration) {	var pos = cnt;	var offset = 0;
	for (i=1;i<=cnt;i++) {		setTimeout(
			function () {				$(holder + ' a img[rel='+pos+']').fadeOut();
				if ( pos == cnt ) {
					pos = 1;
				}
				else {
					pos = $(holder + ' a img[rel='+pos+']').next().attr('rel');
				}

				$(holder + ' a img[rel='+pos+']').fadeIn();
			}
		, offset );
		offset += Number(duration[i]);
	}
}
