// fbh means: find belenusHome
var undef;
var belenusHome;
var current = parent;
var loopSteps = 4;

while(current.belenusHome == undef && loopSteps-- > 0) {
  current = current.parent;
} 
// belenusHome is probably not in this popup
if(current.belenusHome) { 
  belenusHome = current.belenusHome; 
} else if(top.opener) {
  // next loops...
  // BUG
  if(top.opener.belenusHome) { 
    belenusHome = top.opener.belenusHome;
  } else {
    loopSteps = 4;
    current = top.opener;
    while(current.belenusHome == undef && loopSteps-- > 0) {
      current = current.parent;
    }             
    if(current.belenusHome) belenusHome = current.belenusHome;
  }
} else {
 alert("No idea where the belenusHome is to find!");
 self.location = "about:blank";
}