code:mite be a bit of overkill, but I use xml/xsl fer galleries, just pass in the screen rez as a variable into the style sheet to tell me how many columns to make.
First intention, then enlightenment..
Ars Pyronomica
" Life is programmed. Whether death is programmed or not is yet to be determined."