This is the function that loads during "onUnload".
function einde ()
{
inisiasie=sele.join(",");
inisiasie=strreplace(inisiasie,",,",",");
if (inisiasie.charAt(0)==",") inisiasie=inisiasie.substring(1,(inisiasie.length) );
if (inisiasie.charAt(inisiasie.length)==",") inisiasie=inisiasie.substring(0,(inisiasie.length-1));
SetCookie("temp_array",inisiasie);
}
But for some reason a simply redirect doesnt change the cookie value, which is should, cause the page runs the function on page unload. First Refresh and then redirect