var GALLERY = {
	container: '#gallery',
	url: 'page_details_images',
	delay: 5000,
	load: function() {
		var _gallery = this;
		jQuery.ajax({
			type:"get",
			url: this.url,
			success: function(data) {
				var images = data.split('|');
				jQuery.each(images, function() {
					_gallery.display(this);
				});
			}
            /*,
            beforeSend: function() {
                jQuery(_gallery.container).find('img').fadeOut('slow', function() {jQuery(this).remove();});
            },
            complete: function() {
                setTimeout(function() {
                    _gallery.load();
                }, _gallery.delay);
            }*/
		});
	},
	display: function(image_url) {
		jQuery('<img></img>')
		.attr('src', 'images/' + image_url)
		.hide()
		.load(function() {
			jQuery(this).fadeIn();
		})
		.appendTo(this.container);
	}
}
jQuery(document).ready(function() {
	GALLERY.load();
});
