well, here's my solution...
I left the line:
$RepeatSelectionCounter_1_Iterations = "5";
and then added the variable line below it:
$RepeatSelectionCounter_1_Iterations = $imagesPerRow;
works fine... DW warning gone...
Thanks again for all your help!