Getting Error on recursion with settimeout?

I get an error of "omniKeepSessionAlive is not defined" on the internal settimeout of the function:

setTimeout("omniKeepSessionAlive()",50000);

And I don't know why? Any ideas?
function omniKeepSessionAlive(){

		if (typeof(s_ea.prop5)!="undefined"){
		   var p5Val = "ebisu"
  		   if(p5Val.indexOf(s_ea.prop5.toLowerCase())!=-1){
		       if(!timerStarted){
			     initSessionTimerValues();
				 timerStarted = 1;
			   }
			   var currTime = getCurrMin();
			   if (targetMinCnt == currTime){
			   document.write("*** CUSTOM LINK SENT *** targetMinCnt: "+ targetMinCnt + " <--> currTime: "+ currTime+ "<br>");
			     timerStarted = 0;
				 omniLinkCall('extendSession');
				}
				document.write("targetMinCnt: "+ targetMinCnt + " <--> currTime: " + currTime + "<br>");
		   	  alert("settimeout");
			  setTimeout("omniKeepSessionAlive()",50000);

		   }
  		    
		 }
};
setTimeout("omniKeepSessionAlive()",10000);//kicks off timer onload

Open in new window

894359Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

894359Author Commented:
If you want rest of code then:

var currStartMin = -1;//current start min for session extention
var targetMinCnt = -1;//target min session extention
var timerStarted = 0;//flag for sesiin timing started

function initSessionTimerValues(){

currStartMin = getCurrMin();
var sessionTimeMin = 28;
var timeThreshold = 31
var minAdj = 32;

if (currStartMin <= timeThreshold){
  targetMinCnt = currStartMin + sessionTimeMin;
}else{
  targetMinCnt = currStartMin - minAdj;
}
};

function getCurrMin(){
var currentTime = new Date()
var minStart = currentTime.getMinutes();
return minStart;
}
0
CCSOFlagCommented:
Which call are you getting the error on?  The internal call or the call after the function
0
894359Author Commented:
internal call but I noticed if I removed my testing code (doc writes and alerts) I don't get the error any more?!?!
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

HainKurtSr. System AnalystCommented:
I dont see any issue

have a look at this tiny sample

do you have any link to produce the issue?
<script>
function a(){
  alert('a');
  setTimeout("a()",3000);
}
a();
</script>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CCSOFlagCommented:
O.o

Really?  I don't see anything wrong with the said lines, so not sure why they would cause anything.
0
CCSOFlagCommented:
Take those lines out one at a time and see which one is causing the error.
0
894359Author Commented:
For some reason it was the document writes causing the issue?  Oh well!
0
CCSOFlagCommented:
well at least you figured out there's nothing wrong with the function call. :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.