try something like this in your code:
/**
* hypeDocument.isPlayingOrAtEndTimelineNamed 1.0
* @param {String} name of timeline
* @return {Boolean} true if playing or at end of timeline else false
*/
hypeDocument.isPlayingOrAtEndTimelineNamed = function (name) {
var isPlaying = this.isPlayingTimelineNamed(name);
var time = this.currentTimeInTimelineNamed(name);
var duration = this.durationForTimelineNamed(name);
return isPlaying || (time>0 && time==duration);
}
var timelinen0 = hypeDocument.isPlayingOrAtEndTimelineNamed('Main Timeline')
var timelinen1 = hypeDocument.isPlayingOrAtEndTimelineNamed('Timeline1')
var timelinen2 = hypeDocument.isPlayingOrAtEndTimelineNamed('Timeline2')
var lightbox = (element.id)
/* your introducing a hierarchy here hope your aware of that, also look into hypeDocument.setInnerHtmlByClass */
if (lightbox == "ovl-1" && timelinen0) {
hypeDocument.getElementById('txt').innerHTML = "MainTimeline Text";
}
if (lightbox == "ovl-1" && timelinen1) {
hypeDocument.getElementById('txt').innerHTML = "Timeline1 Text";
}
if (lightbox == "ovl-1" && timelinen2) {
hypeDocument.getElementById('txt').innerHTML = "Timeline2 Text";
}
Optional information on hypeDocument.setInnerHtmlByClass (better for scene and layout wide replacements)