GALLERIES_AJAX_URL = '/common/ajax/front/components/Galleries/ajax.php';

function fncGalleriesComponent_Gallery_Load(offset, object){
	
	divElement = $(object).up('div');
	UniqID     = divElement.id.replace('gallery_', '');
	
	var loadingholder = 'gallery_loading_'+UniqID;
	
	new Ajax.Updater({success : divElement, failure : null}, GALLERIES_AJAX_URL, {
	  parameters: {
	  	action     : 'Gallery_Load',
	  	offset     : offset,
	  	uniqid     : UniqID
	  },
	  evalScripts : true,
	  				  		
	  onSuccess: function(transport){
		 if($(loadingholder) != null) {
			 $(loadingholder).hide().innerHTML = '';
		 }
	  },
	  onLoading: function(){
		  if($(loadingholder) != null) {
			  $(loadingholder).show().innerHTML = '<center>Loading <img src="/common/templates/default/images/icons_modules/loadingsmall.gif" /></center>';
		  }
	  },
	  onComplete: function(transport){
		  if($(loadingholder) != null) {
			  $(loadingholder).hide().innerHTML = '';
		  }
	  }
	});
	
	
}

function fncGalleriesComponent_Gallery_Select(gallery_picture_id, object){
	
	divElement = $(object).up('div');
	UniqID = divElement.id.replace('gallery_', '');
	
	new Ajax.Updater({success : divElement, failure : null}, GALLERIES_AJAX_URL, {
	  parameters: {
	  	action             : 'Gallery_Select',
	  	gallery_picture_id : gallery_picture_id,
	  	uniqid             : UniqID
	  },
	  evalScripts : true,
	  				  		
	  onSuccess: function(transport){
	  },
	  
	  onFailure: function(transport){
	  }
	});
	
}