// JavaScript Document

YAHOO.util.Event.onDOMReady(function () {

// Set up the application under the YAHOO.example namespace
var Ex = YAHOO.namespace('example');

Ex.content    = YAHOO.util.Dom.get('albumNegocio');

Ex.handlePagination = function (state) {
	Ex.paginator.setState(state);
	cargarImagenAlbum(state.page);
};

// Create the Paginator widget and subscribe to its changeRequest event
Ex.paginator = new YAHOO.widget.Paginator({
    rowsPerPage  : 1,
    totalRecords : document.getElementById('totalImagenes').value,
    containers : 'paginadoAlbum',
	pageLinks : 5,
	firstPageLinkLabel : '',
	previousPageLinkLabel : '< Anterior',
	nextPageLinkLabel : 'Siguiente >',
	lastPageLinkLabel : ''
});

Ex.paginator.subscribe('changeRequest', Ex.handlePagination);

// Render the Paginator into the configured container(s)
Ex.paginator.render();

});

function cargarImagenAlbum(imagen){
	var instante= new Date().getTime();
	var url=""+raiz+"lugar/cargarImagen.php?imagen="+imagen+"&instante="+instante; 
	document.getElementById('pAlbum').innerHTML = '<div align="center">Por favor Espere un segundo</div>';
	var Update = new Ajax.Updater('pAlbum', url);
}

