At line 145 you have:
$WA_loopedIDField = array("WADA_RepeatID_RepImgID");
but the hidden field on line 291 has:
<input type="hidden" name="WADA_RepeatID_PicID_...
I'm not sure what is going on, but I think those two have to match, so try updating line 145 to:
$WA_loopedIDField = array("WADA_RepeatID_PicID");