the delete behaivor:
<?php
$WA_DeleteFileResult2 = false;
if(isset($_POST["Delete"]) || isset($_POST["Delete_x"])){
$WA_DeleteFileResult2 = WA_FileAssist_DeleteFile("../images/slides/", "".((isset($_POST["SLBg"]))?$_POST["SLBg"]:"") ."");
}?>
is set to use the SLBg form element
the onclick event for the delete button:
onClick="document.getElementById('LAYId').value=<?php echo $row_WADAivs_mod_slidecap['idCaption']; ?>;document.getElementById('LAYImg').value='<?php echo $row_WADAivs_mod_slidecap['capPicture']; ?>';"
is setting the value for the LAYImg form element, it needs to set the value for the one being used by the delete behavior, SLBg