GALLERY_MINI_AJAX_URL = '/common/ajax/front/components/GalleryMini/ajax.php';

function fncGalleryMini_LoadImage(gallery_id, direction, sortby, width, height, display_caption){

	$('galleryImageHolder_'+gallery_id).innerHTML = "<div style=\"height:"+height+"px;\"><br><br><br><br><br><center>Loading Gallery<br><br><img src=\"/common/templates/default/images/icons_modules/loadingsmall.gif\" /></center></div>";
	
	if(!sortby) { sortby = 0; }
	
	new Ajax.Updater({success: 'galleryImageHolder_'+gallery_id}, GALLERY_MINI_AJAX_URL, {
		parameters : {
			action 				: 'GalleryMini_LoadImage',
			direction   		: direction,
			gallery_id 			: gallery_id,
			width 				: width,
			height 				: height,
			display_caption		: display_caption,
			sortby				: sortby
		},
		evalScripts : true,
		onComplete: function(transport){
			// lightbox has to be called here otherwise it wont work
			initLightbox();
		}, 
		onFailure: function(transport){
			Error.alert('Failure in communication to the server, please try again later.');
		}
	});
}

