Hi there Hermanisbanken welcome to Webforumz
Having a look at your code, I think that javascript is getting lost in the scope of your variables.
You declare idVanTeBerwerkenObject as a global variable at the top of your page but never actually treat it as such, you use the variable name to pass around in your functions.
Try taking this line
var idVanTeBewerkenObject;
Out of the script entirely and trying again.
Cheers,