home *** CD-ROM | disk | FTP | other *** search
- function Popup_Object(ParamThisAccessor,
- ParamDocReferenceAsString,
- ParamPopupTranslateFunc,
- ParamPopupFormatFunc,
- ParamDivID,
- ParamTextID,
- ParamTimeout,
- ParamOffsetX,
- ParamOffsetY,
- ParamWidth)
- {
- var Agent;
-
-
- this.mThisAccessor = ParamThisAccessor;
- this.mDocRefString = ParamDocReferenceAsString;
- this.mDocReference = null;
- this.mDivID = ParamDivID;
- this.mTextID = ParamTextID;
- this.mTimeout = (ParamTimeout > 0) ? ParamTimeout : 0;
- this.mOffsetX = ParamOffsetX;
- this.mOffsetY = ParamOffsetY;
- this.mWidth = ParamWidth;
- this.mbIE40 = false;
-
- // Determine if this is IE 4.0
- //
- Agent = navigator.userAgent.toLowerCase();
- if (Agent.indexOf("msie") != -1)
- {
- var VersionString;
- var MSIEVersionString;
- var Version;
-
-
- VersionString = navigator.appVersion.toLowerCase();
- MSIEVersionString = VersionString.substring(VersionString.indexOf("msie") + 4);
- Version = parseFloat(MSIEVersionString);
- if ((Version >= 4.0) &&
- (Version < 4.1))
- {
- this.mbIE40 = true;
- }
- }
-
- // Updated when popup triggered
- //
- this.mbVisible = false;
- this.mPositionX = 0;
- this.mPositionY = 0;
- this.mText = "";
-
- this.fTranslate = ParamPopupTranslateFunc;
- this.fFormat = ParamPopupFormatFunc;
- this.fShow = Popup_Show;
- this.fPopup = Popup_Popup;
- this.fHide = Popup_Hide;
- }
-
- function Popup_Show(ParamText,
- ParamEvent)
- {
- // Reset the timeout operation to display the popup
- //
- if (this.mSetTimeoutID != null)
- {
- clearTimeout(this.mSetTimeoutID);
-
- this.mSetTimeoutID = null;
- }
-
- // Check to see if there is anything to display
- //
- if ((ParamText != null) &&
- (ParamEvent != null))
- {
- var bStartTimer = false;
-
-
- // Need to update our reference everytime
- // in case document gets rewritten via JavaScript
- //
- this.mDocReference = eval(this.mDocRefString);
-
- if (this.mDocReference.layers != null)
- {
- this.mPositionX = ParamEvent.layerX;
- this.mPositionY = ParamEvent.layerY;
-
- this.mText = ParamText;
-
- bStartTimer = true;
- }
- else if (this.mDocReference.all != null)
- {
- this.mPositionX = this.mDocReference.body.scrollLeft + ParamEvent.x;
- this.mPositionY = this.mDocReference.body.scrollTop + ParamEvent.y;
-
- // Workaround for IE 4.0 on Windows
- //
- if (this.mbIE40)
- {
- this.mPositionX = ParamEvent.x;
- this.mPositionY = ParamEvent.y;
- }
-
- this.mText = ParamText;
-
- // Setting the position here before it is displayed
- // corrects a bug under IE 5 on the Macintosh
- //
- this.mDocReference.all[this.mDivID].style.pixelLeft = this.mPositionX + this.mOffsetX;
- this.mDocReference.all[this.mDivID].style.pixelTop = this.mPositionY + this.mOffsetY;
-
- bStartTimer = true;
- }
-
- if (bStartTimer == true)
- {
- this.mSetTimeoutID = setTimeout(this.mThisAccessor + ".fPopup()", this.mTimeout);
- }
- }
- }
-
- function Popup_Popup()
- {
- if (this.mSetTimeoutID != null)
- {
- if (this.mDocReference.layers != null)
- {
- var FormattedText;
-
-
- FormattedText = this.fFormat(this.fTranslate(this.mText));
-
- this.mDocReference.layers[this.mDivID].document.open();
- this.mDocReference.layers[this.mDivID].document.write(FormattedText);
- this.mDocReference.layers[this.mDivID].document.close();
-
- // Position the popup
- //
- this.mDocReference.layers[this.mDivID].left = this.mPositionX + this.mOffsetX;
- this.mDocReference.layers[this.mDivID].top = this.mPositionY + this.mOffsetY;
-
- // Show the popup
- //
- this.mDocReference.layers[this.mDivID].visibility = "visible";
-
- this.mbVisible = true;
- }
- else if (this.mDocReference.all != null)
- {
- var TranslatedText;
-
-
- TranslatedText = this.fTranslate(this.mText);
-
- this.mDocReference.all[this.mTextID].innerHTML = TranslatedText;
-
- this.mDocReference.all[this.mDivID].style.pixelLeft = this.mPositionX + this.mOffsetX;
- this.mDocReference.all[this.mDivID].style.pixelTop = this.mPositionY + this.mOffsetY;
-
- this.mDocReference.all[this.mDivID].style.visibility = "visible";
-
- this.mbVisible = true;
- }
- }
-
- // Clear the setTimeout ID tracking field
- // to indicate that we're done.
- //
- this.mSetTimeoutID = null;
- }
-
- function Popup_Hide()
- {
- // Cancel the setTimeout value that would have
- // displayed the popup
- //
- if (this.mSetTimeoutID != null)
- {
- clearTimeout(this.mSetTimeoutID);
-
- this.mSetTimeoutID = null;
- }
-
- // Shutdown the popup
- //
- if (this.mbVisible == true)
- {
- if (this.mDocReference.layers != null)
- {
- this.mDocReference.layers[this.mDivID].visibility = "hidden";
- }
- else if (this.mDocReference.all != null)
- {
- this.mDocReference.all[this.mDivID].style.visibility = "hidden";
- }
- }
-
- this.mbVisible = false;
- }
-