timer management between 2 frames

Hi,
I'm currently trying to manage a session timeout with a 2 frames window.
In both frames I have forms, and my goal is to clear the timer and set it again every time any button on any of both frames is clicked.

Basically, how I handle this right now is:

In the parent's frame:

<head>
<script language="Javascript">
var timer;
</script>
</head>

in the frames' forms:

<form name="myform" action="myaction" method="POST" onSubmit="return resetTimer();">

the resetTimer function:

function resetTimer()
{
var timerval;
parent.timer=clearTimeout(parent.timer);
timerval = GetCookie("timer") * 1000;
parent.timer=setTimeout('logout();',timerval);
}

Now I would expect that this would affect the same timer from both frames, but it seems to consider two seperate timers from both frames. So if I set my timer for 1 minute and that I click on a button on frame1 then wait 30 seconds, click on a button on frame2, I'll have a timeout after 30 more seconds (the 30 remaining seconds of the timer set by frame1) and it goes the same way around too...

Anyone has a clue what I may have done wrong?

thanks in advance
[1334 byte] By [jojolepabo] at [2007-11-18 17:56:44]
# 1 Re: timer management between 2 frames
Ok I had my question answered yesterday evening on another forum, guess I can share my bit of experience:

my main mistake was to call the setTimer and clearTimer at frame level... solution was simply to put

top.setTimeout(top.timer);
top.timer=top.setTimeout("logout();", <timeout delay> );

instead of

setTimeout(top.timer);
top.timer=setTimeout("logout();", <timeout delay> );

also had to make sure the logout() function is implemented in the top...
jojolepabo at 2007-11-8 0:19:06 >