i have one page which has two frames. my page structure is :

test.asp is main file which has two frameset:
a. top frame
b. main frame.

topframe shows one header file where clock is ticking
mainframe shows questions.

header.asp includes a script file names script.js
my last page which shows is review.asp

problem : i have written this code for autoclose of test, here x is time value
if(x == 0)
window.parent.mainFrame.location.href = "review.asp";
function endTest()
window.top.mainFrame.document.finalSubmit.hiddenAn swers.value = window.top.getConclude();
window.top.mainFrame.document.finalSubmit.hiddenMa rksheet.value = window.top.prepareMarkSheet();
window.top.mainFrame.document.finalSubmit.submit() ;
my review.asp page contains: form named : finalSubmit, here is the code

<form action="Conclude.asp" method="post" name="finalSubmit">
<input name="hiddenAnswers" type="hidden" value="" />
<input name="hiddenMarksheet" type="hidden" value="" />
<input name="btnSubmit" type="submit" value="submit form" style="visibility:hidden" />
but when i see error in ErrorConsole in Mozilla firefox. it says..

window.top.mainFrame.document.finalSubmit is undefined

i am new to javascript, please help me out..

thanks for your consideration .

best regards