home *** CD-ROM | disk | FTP | other *** search
- var g_popup = null;
- function GetPopup()
- {
- var popup = g_popup;
- if (null == popup)
- {
- popup = window.createPopup();
- if (popup)
- {
- popup.document.dir = window.document.dir;
- popup.document.body.style.cssText =
- "{ font:menu; border:'1px solid'; margin:0; padding:2px; color:infotext; background:infobackground; overflow:hidden; }";
- g_popup = popup;
- }
- }
- return popup;
- }
- function HidePopup()
- {
- if (g_popup)
- g_popup.hide();
- }
- function ShowPopup(szText, element, maxWidth)
- {
- var popup = GetPopup();
- if (popup && szText && szText.length > 0 && !popup.isOpen)
- {
- var lineHeight = 3 * element.offsetHeight / 2;
- var popupBody = popup.document.body;
- if (!maxWidth)
- maxWidth = 300;
- popupBody.innerText = szText;
- popup.show(0, lineHeight, maxWidth, 6, element);
- var realWidth = popupBody.scrollWidth + popupBody.offsetWidth - popupBody.clientWidth;
- var realHeight = popupBody.scrollHeight + popupBody.offsetHeight - popupBody.clientHeight;
- if (realHeight < lineHeight && realWidth <= maxWidth)
- {
- popupBody.style.whiteSpace = 'nowrap';
- popup.show(0, lineHeight, 6, realHeight, element);
- realWidth = popupBody.scrollWidth + popupBody.offsetWidth - popupBody.clientWidth;
- popupBody.style.whiteSpace = 'normal';
- }
- var xPos = 0;
- if (window.document.dir == "rtl")
- {
- var rc = element.getBoundingClientRect();
- xPos = element.document.body.offsetWidth - realWidth - (rc.left*2);
- }
- popup.show(xPos, element.offsetHeight, realWidth, realHeight, element);
- }
- }
-