var imgAmount = imageLinesPerPage * imagesPerLine;    
var currentMenuId;
var bubleObj;

function infoPanelUp(obj)   
{   
  currentMenuId=getPopupIndex(obj.id);   
  bubleObj=eltId("imageParamPopup_"+currentMenuId);           
  bubleObj.style.visibility="visible";
  document.onmousemove = mouseMove; 
}

function infoPanelDawn(obj)
{ 
  currentMenuId=getPopupIndex(obj.id); 
  bubleObj=eltId("imageParamPopup_"+currentMenuId);  
  bubleObj.style.visibility="hidden";
  bubleObj.style.top="-1000px";
  document.onmousemove = "";          
}

function mouseMove(evt) {
  evt = (evt) ? evt : (window.event) ? window.event : "";        
  if (evt.pageX) {
    x=evt.pageX;
    y=evt.pageY;
  }else {
    x=evt.clientX;
    y=evt.clientY+getBodyScrollTop();    
  }     
  xy = getAbsolutePosition(eltId('content'));
  
  bubleObj.style.left = -parseInt(xy.x) + x + 15 + "px";
  bubleObj.style.top = -parseInt(xy.y) + y + 15 + "px";
}


  function getAbsolutePosition(element) {
    var r = { x: element.offsetLeft, y: element.offsetTop };
    if (element.offsetParent) {
      var tmp = getAbsolutePosition(element.offsetParent);
      r.x += tmp.x;
      r.y += tmp.y;
    }
    return r;
  };


function getPopupIndex(id) { 
  id=id.substring(id.lastIndexOf("_")+1, id.length);
  return id;
}

function infoPanelsInit() {
  for(i=1; i<=imgAmount; i++)
  {                         
    if (eltId("imgHandler_"+i)){
      eltId("imgHandler_"+i).onmouseover=function() { infoPanelUp(this)};
      eltId("imgHandler_"+i).onmouseout=function() { infoPanelDawn(this);};      
    }           
  }
}

function getBodyScrollTop() {
  return self.pageYOffset || (document.documentElement && document.documentElement.scrollTop) || (document.body && document.body.scrollTop);
}
