var Ex;
window.onload = function () {
	Ex = YAHOO.namespace('paginated');
	Ex.content = YAHOO.util.Dom.get('paginated');
	Ex.handlePagination = function (state) {
		//Ex.content.className = 'page' + state.page;
		for (var i = 0; i < Ex.totalRecords; i++) {
			Ex.containers[i].className = 'paging-hidden';
		}
		Ex.containers[state.page-1].className = 'paging-visible';
		Ex.paginator.setState(state);
	};
	var els = Ex.content.childNodes;
	Ex.containers = [];
	for (var i = 0, j = 0; i < els.length; i++) {		
		if (els[i].nodeName == 'DIV') {
			els[i].className = 'paging-hidden';
			Ex.containers[j++] = els[i];
		}
	}
	Ex.containers[0].className = 'paging-visible';
	Ex.totalRecords = Ex.containers.length;
	Ex.paginator = new YAHOO.widget.Paginator({
		rowsPerPage : 1,
		pageLinks: 20,
		totalRecords : Ex.totalRecords,
		containers : 'paging',
		template : '{PreviousPageLink} {PageLinks} {NextPageLink}',
		previousPageLinkLabel: '&lt;',
		nextPageLinkLabel: '&gt;'
	});

	Ex.paginator.subscribe('changeRequest', Ex.handlePagination);
	Ex.paginator.render();
};
