posY = searchshield.offsetTop(imageElem) + halfY; var pageOffsetX = 0; var pageOffsetY = 0; // normalize pos to 0 -- get amount of scrolling in browser window var scroll = searchshield.scrollSize(imageElem); var pageOffsetX = scroll[0]; var pageOffsetY = scroll[1]; var hasParentFrame = scroll[2]; posX -= pageOffsetX; posY -= pageOffsetY; //compensate for Firefox 3 if (posX < imgRect.left) posX = imgRect.left+halfX; // setup the offsets var offsetX = posX; var offsetY = posY; // calc where to display on page if ((windowX - posX) > posX) { // right offsetX += halfX; locateX = 1; } else { //left offsetX -= (flyoverX + halfX); } if ((windowY - posY) > posY) { // below if (posY < (windowY/4)) { offsetY -= halfY; locateY = 1; } else { offsetY -= (flyoverY / 2) - halfY; locateY = 2; } } else { // above if ((windowY - posY) < (windowY/4)) { offsetY -= (flyoverY - halfY); } else { offsetY -= (flyoverY / 2) + halfY; locateY = 2; } } // make sure we aren't off the screen if (offsetY < 0) offsetY = 0; if ((offsetY + flyoverY) > windowY) { offsetY = windowY - flyoverY; } else if (scrollBarX && ((windowY - (posY + halfY)) < scrollYWidth)) { //verdict overlaps the horizontal scrollbar offsetY = windowY - (flyoverY + scrollYWidth); } // add page offsets back - if not in frame if (!hasParentFrame) { offsetX += pageOffsetX; offsetY += pageOffsetY; } posX += pageOffsetX; posY += pageOffsetY; var paddedOffsetX = 0; //provide space between icon and flyover var padX = 3; if (locateX == 0) paddedOffsetX = offsetX - padX; else paddedOffsetX = offsetX + padX; // set where to put the flyover flyover.style.top = offsetY + "px"; flyover.style.left = paddedOffsetX + "px"; avglsinlineflyover.display(); }, display: function () { var div = document.getElementById('XPLSS_InlineFlyover'); if (div == null) return; // show the flyover div.style.visibility = "visible"; }, imageExists: function(element) { if (element) { // check next siblings children var sibling = element.nextSibling; if ((sibling == null) || (sibling.getElementsByTagName == null)) return false; var images = sibling.getElementsByTagName("IMG"); if (images == null) return false; for (var i = 0; i < images.length; i++) { if (images[i].id == "avg_ls_image") return true; } } return false; }, getImage: function (anchor) { if (anchor) { var imageElem = null; var images = anchor.getElementsByTagName("img"); if (images == null) return imageElem; for (var i = 0; i < images.length; i++) { if (images[i].id == "avg_ls_image") { imageElem = images[i]; break; } } return imageElem; } }, mouseOverHandler: function (e, doc, engine) { if (e && e.srcElement && e.srcElement.href) { // need to keep a reference to the function registered // by the listener to be able to remove it. var handlerFunc = arguments.callee; var element = e.srcElement; var href = e.srcElement.href; // need an engine if (!engine) return; // check if it has an image already if (avglsinlineflyover.imageExists(element)) return; // add the image, returns the anchor not the image var new_element = engine.add_inline_image(doc, element, null, null); // do the check and update in the background setTimeout(function() {avglsinlineflyover.checkAndUpdate(doc, element, new_element,