var itemsTotal:int = 33;
var itemsPerPage:int = 6;
var remainder:int = itemsTotal % itemsPerPage;
var totalOfPages:Number = Math.round(itemsTotal / itemsPerPage);
if ( remainder > 0 )
{
totalOfPages = totalOfPages + 1;
}
trace(remainder + " = how many items are left.");
trace(totalOfPages + " = total of pages");