

function gallery_list(pagina)
{
	if (!document.sending) {
		document.sending = true;
		$('#div_gallery_list').html(MSG_LOADING);
		$.ajax({
			type: "POST",
			url: WEB_PATH + "app/ajax/gallery_list.php",
			data: {p: pagina},
			success: function(response) {
				document.sending = false;
				$('#div_gallery_list').html(response);
			},
			error: function(obj, what_happen, other_obj) {
                document.sending = false;
			}
		});
	}
}
function open_photo_gallery(modulo, id_ref, index)
{
	if (!document.sending) {
		document.sending = true;
		if (index == 0) {
			index = 1;
		}
		jQuery.ajax({
			type: "POST",
			url: WEB_PATH + "app/ajax/gallery_popup.php",
			data: {id_gallery: id_ref, index: index - 1, modulo: modulo},
			success: function(response) {
				document.sending = false;
				$('#container_gallery_popup').html(response);
				$('#container_gallery_popup').dialog({
					modal: true,
					open: function () // evento open
					{
						// Inicializar el carousel del lightbox:
						jQuery('#carousel-article-large-popup').jcarousel({
							vertical: false,
							scroll: 10
						});
						disable_imgs_rightclick(); //deshabilitar click derecho
					}
				});
			},
			error: function(obj, what_happen, other_obj) {
                document.sending = false;
			}
		});
	}
}
function gallery_photo_close()
{	
	$('#container_gallery_popup').dialog('close');
	$('#container_gallery_popup').dialog('destroy');
}
function gallery_photo_refresh(imagen, autor, texto, indice)
{
	$('#gallery_popup_img_current').attr('src', WEB_PATH+'html/img/ajax-loader.gif');
	$('#p_gallery_photo_text').html(texto);
	setTimeout(function() {
		$('#gallery_popup_img_current').attr('src', WEB_PATH+'include/lib/thumb.php?type=proportional-h&w=0&h=400&name='+imagen);
		$('a#galleryImgBig').attr('href', WEB_PATH + imagen);
		$('#gallery_popup_img_index').html(indice + 1);
		if (autor == '') {
			$('#p_gallery_photo_author').hide();
		} else {
			$('#p_gallery_photo_author').show();
			$('#gallery_photo_autor').html(autor);
		}
		galleryPhotoIndiceActual = indice;
	}, 500);
}
/********* Manejo de flechitas de anterior y siguiente: ***************/
function gallery_photo_next()
{	
	var nuevoIndice = galleryPhotoIndiceActual + 1;
	if (nuevoIndice < galleryPhotoCount) {
		gallery_photo_refresh(array_imagenes[nuevoIndice], array_autores[nuevoIndice], array_textos[nuevoIndice], nuevoIndice);
	}
}
function gallery_photo_prev()
{
	var nuevoIndice = galleryPhotoIndiceActual - 1;
	if (nuevoIndice >= 0) {
		gallery_photo_refresh(array_imagenes[nuevoIndice], array_autores[nuevoIndice], array_textos[nuevoIndice], nuevoIndice);
	}
}
/********* FIN Manejo de flechitas de anterior y siguiente: ***************/

$(document).ready(function(){
	

});


function getGaleryPage(page){
	$.ajax({
		dataType:"json",
		type: "POST",
		url: WEB_PATH + "app/ajax/unPHPcualquiera.php",
		data: {page: page},
		success: function(res) {
			$('#tabs-fotos').html(res.data);
		}
	});
}

function getVideoPage(page){
	$.ajax({
		dataType:"json",
		type: "POST",
		url: WEB_PATH + "app/ajax/videosHome.php",
		data: {page: page},
		success: function(res) {
			$('#tabs-videos').html(res.data);
		}
	});
}


