 window.onload = function() {
  if (window.SetTopHr) window.SetTopHr();
 }
 
 window.onresize = function() {
  if (window.SetTopHr) window.SetTopHr();
 }
 
 function SetTopHr() { 
  ClearTopHr()
  var lpos = getObjectY(document.getElementById('top1'));
  var cpos = 0;
  var j = 1;
  
  var Divpos = new Array();
  
  // найдем перенесенные дивы
  for (var i = 2; i <= topcnt; i++) {
   cpos = getObjectY(document.getElementById('top'+i));
   if(cpos != lpos) {
     Divpos[j]=i; 
     j++;
     lpos = cpos;
   }
  }
  
  for (var i = 1; i < Divpos.length; i++) {
   document.getElementById('tophr'+(Divpos[i]-1)).style.display = 'block';
  }
 }
 
 function ClearTopHr() { 
    
  // найдем перенесенные дивы
  for (var i = 1; i <= topcnt; i++) {
   document.getElementById('tophr'+i).style.display = 'none';
  }
 }
 
 function getObjectY(imgElem) { 
     xPos = eval(imgElem).offsetTop;
     tempEl = eval(imgElem).offsetParent;
    while (tempEl != null) {
     xPos += tempEl.offsetTop;
     tempEl = tempEl.offsetParent;
    }
     return xPos;
 }
