{ 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 = offsetX + "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; } }, getUrlFromQueryString: function (inUrl) { var url = inUrl; var uri = searchshield.parseLink(unescape(inUrl)); if (uri.source != null) { // regexp failed so used split to parse url var qsUrl = uri.source.indexOf("?url="); if (qsUrl != -1) url = uri.source.substring(qsUrl + 5); else url = uri.source; } else if ((uri.qsArray.url != null) && (uri.qsArray.url.length > 0)) { url = uri.qsArray.url; } return url; }, 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, engine, handlerFunc)}, 1); } }, checkAndUpdate: function (doc, element, new_element, engine, handlerFunc) { if (!engine) return; try { // remove the listener and get final url element.detachEvent("onmouseover", handlerFunc, false); var finalUrl = searchshield.avgCallFunc(doc, 'GetFinalUrl', element.href); } catch(e) {} if ((typeof(finalUrl) != 'undefined') && finalUrl) { // if still a tiny url check for final url embedded in querystring if (searchshield.FilterUrl(finalUrl, engine.shortened_urls) &&