2 var gaPaths = new Array();
\r
3 var gaAvenues = new Array();
\r
6 var gsStartPage = "";
\r
7 var gsRelCurPagePath = "";
\r
8 var gsSearchFormHref = "";
\r
9 var gnTopicOnly = -1;
\r
10 var gnOutmostTopic = -1;
\r
23 var goShowNav = null;
\r
24 var goHideNav = null;
\r
26 var goWebSearch = null;
\r
28 var gsBtnStyle = "";
\r
29 var gaButtons = new Array();
\r
30 var gaTypes = new Array();
\r
31 var whtopic_foldUnload = null;
\r
32 var gbWhTopic=false;
\r
33 var gbCheckSync=false;
\r
34 var gbSyncEnabled=false;
\r
36 function setButtonFont(sType, sFontName,sFontSize,sFontColor,sFontStyle,sFontWeight,sFontDecoration)
\r
38 var vFont=new whFont(sFontName,sFontSize,sFontColor,sFontStyle,sFontWeight,sFontDecoration);
\r
39 gsBtnStyle += ".whtbtn" + sType + "{"+getFontStyle(vFont) + "}";
\r
42 function writeBtnStyle()
\r
44 if (gaButtons.length > 0)
\r
46 if (gsBtnStyle.length > 0)
\r
48 var sStyle = "<style type='text/css'>";
\r
49 sStyle+= gsBtnStyle + "</style>";
\r
50 document.write(sStyle);
\r
55 function button(sText, nWidth, nHeight)
\r
58 this.nWidth = nWidth;
\r
59 this.nHeight = nHeight;
\r
61 this.aImgs = new Array();
\r
63 while (button.arguments.length > i + 3)
\r
65 this.aImgs[i] = button.arguments[3 + i];
\r
71 function setRelStartPage(sPath)
\r
73 if (gsPPath.length == 0)
\r
75 gsPPath = _getFullPath(_getPath(document.location.href), _getPath(sPath));
\r
76 gsStartPage = _getFullPath(_getPath(document.location.href), sPath);
\r
77 gsRelCurPagePath = _getRelativeFileName(gsStartPage, document.location.href);
\r
81 function getImage(oImage, sType)
\r
84 if (oImage && oImage.aImgs && (oImage.aImgs.length > 0))
\r
86 sImg+="<img alt=\""+ sType + "\" src=\"" + oImage.aImgs[0] + "\"";
\r
87 if (oImage.nWidth > 0)
\r
88 sImg+=" width=" + oImage.nWidth;
\r
89 if (oImage.nHeight > 0)
\r
90 sImg+=" height=" + oImage.nHeight;
\r
91 sImg+=" border=no>";
\r
96 function addTocInfo(sTocPath)
\r
98 gaPaths[gaPaths.length] = sTocPath;
\r
101 function addAvenueInfo(sName, sPrev, sNext)
\r
103 gaAvenues[gaAvenues.length] = new avenueInfo(sName, sPrev, sNext);
\r
106 function addButton(sType, nStyle, sText, sHref, sOnClick, sOnMouseOver, sOnLoad, nWidth, nHeight, sImg1, sImg2, sImg3)
\r
109 var nBtn=gaButtons.length;
\r
110 if (sType == "prev")
\r
114 var sTitle = "Previous Topic";
\r
115 goPrev = new button(sText, nWidth, nHeight, sImg1, sImg2, sImg3);
\r
116 sButton = "<a title=\"" + sTitle + "\" class=\"whtbtnprev\" href=\"javascript:void(0);\" onclick=\"goAvenue(false);return false;\">";
\r
117 if (nStyle == BTN_TEXT)
\r
118 sButton += goPrev.sText;
\r
120 sButton += getImage(goPrev, sTitle);
\r
124 else if (sType == "next")
\r
128 var sTitle = "Next Topic";
\r
129 goNext = new button(sText, nWidth, nHeight, sImg1, sImg2, sImg3);
\r
130 sButton = "<a title=\"" + sTitle + "\" class=\"whtbtnnext\" href=\"javascript:void(0);\" onclick=\"goAvenue(true);return false;\">";
\r
131 if (nStyle == BTN_TEXT)
\r
132 sButton += goNext.sText;
\r
134 sButton += getImage(goNext, sTitle);
\r
138 else if (sType == "show")
\r
142 var sTitle = "Show Navigation Component";
\r
143 goShow = new button(sText, nWidth, nHeight, sImg1, sImg2, sImg3);
\r
144 sButton = "<a title=\"" + sTitle + "\" class=\"whtbtnshow\" href=\"javascript:void(0);\" onclick=\"show();return false;\">";
\r
145 if (nStyle == BTN_TEXT)
\r
146 sButton += goShow.sText;
\r
148 sButton += getImage(goShow, sTitle);
\r
152 else if (sType == "hide")
\r
154 if (!isTopicOnly())
\r
156 var sTitle = "Hide Navigation Component";
\r
157 goHide = new button(sText, nWidth, nHeight, sImg1, sImg2, sImg3);
\r
158 sButton = "<a title=\"" + sTitle + "\" class=\"whtbtnhide\" href=\"javascript:void(0);\" onclick=\"hide();return false;\">";
\r
159 if (nStyle == BTN_TEXT)
\r
160 sButton += goHide.sText;
\r
162 sButton += getImage(goHide, sTitle);
\r
166 else if (sType == "shownav")
\r
169 if (isShowHideEnable())
\r
171 var sTitle = "Show Navigation Component";
\r
172 goShowNav = new button(sText, nWidth, nHeight, sImg1, sImg2, sImg3);
\r
173 sButton = "<a title=\"" + sTitle + "\" class=\"whtbtnshownav\" href=\"javascript:void(0);\" onclick=\"showHidePane(true);return false;\">";
\r
174 if (nStyle == BTN_TEXT)
\r
175 sButton += goShowNav.sText;
\r
177 sButton += getImage(goShowNav, sTitle);
\r
181 else if (sType == "hidenav")
\r
183 if (isShowHideEnable())
\r
185 var sTitle = "Hide Navigation Component";
\r
186 goHideNav = new button(sText, nWidth, nHeight, sImg1, sImg2, sImg3);
\r
187 sButton = "<a title=\"" + sTitle + "\" class=\"whtbtnhidenav\" href=\"javascript:void(0);\" onclick=\"showHidePane(false);return false;\">";
\r
188 if (nStyle == BTN_TEXT)
\r
189 sButton += goHideNav.sText;
\r
191 sButton += getImage(goHideNav, sTitle);
\r
195 else if (sType == "synctoc")
\r
197 if (gaPaths.length > 0)
\r
199 var sTitle = "Sync TOC";
\r
200 goSync = new button(sText, nWidth, nHeight, sImg1, sImg2, sImg3);
\r
201 sButton = "<a title=\""+ sTitle + "\" class=\"whtbtnsynctoc\" href=\"javascript:void(0);\" onclick=\"syncWithShow();return false;\">";
\r
202 if (nStyle == BTN_TEXT)
\r
203 sButton += goSync.sText;
\r
205 sButton += getImage(goSync, sTitle);
\r
209 else if (sType == "websearch")
\r
211 if (gsSearchFormHref.length > 0)
\r
213 var sTitle = "WebSearch";
\r
214 goWebSearch = new button(sText, nWidth, nHeight, sImg1, sImg2, sImg3);
\r
215 sButton = "<a title=\""+ sTitle + "\" class=\"whtbtnwebsearch\" href=\"" + gsSearchFormHref + "\">";
\r
216 if (nStyle == BTN_TEXT)
\r
217 sButton += goWebSearch.sText;
\r
219 sButton += getImage(goWebSearch, sTitle);
\r
223 else if (sType == "searchform")
\r
225 gaButtons[nBtn] = "NeedSearchForm";
\r
226 gaTypes[nBtn] = sType;
\r
228 if (sButton.length != 0)
\r
230 if (nStyle == BTN_TEXT)
\r
231 sButton += " ";
\r
232 gaButtons[nBtn] = "<td>" + sButton + "</td>";
\r
233 gaTypes[nBtn] = sType;
\r
237 function isSyncEnabled()
\r
241 var oMsg=new whMessage(WH_MSG_ISSYNCSSUPPORT,this,1,null);
\r
242 if(SendMessage(oMsg))
\r
244 gbSyncEnabled=oMsg.oParam;
\r
248 return gbSyncEnabled;
\r
251 function isInPopup()
\r
253 return (window.name.indexOf("BSSCPopup") != -1);
\r
256 function getIntopicBar(sAlign)
\r
259 if (gaButtons.length > 0)
\r
261 sHTML += "<div align="+ sAlign + ">";
\r
263 sHTML += "<table cellpadding=\"2\" cellspacing=\"0\" border=\"0\"><tr>";
\r
264 for (var i = 0; i < gaButtons.length; i++)
\r
266 if (gaTypes[i]!="synctoc" || isSyncEnabled())
\r
268 if (gaButtons[i] == "NeedSearchForm")
\r
269 sHTML += getSearchFormHTML();
\r
271 sHTML += gaButtons[i];
\r
274 sHTML += "</tr></table>";
\r
282 function writeIntopicBar(nAligns)
\r
284 if (isInPopup()) return;
\r
285 if (gaButtons.length > 0)
\r
290 sHTML += "<table width=100%><tr>"
\r
292 sHTML += "<td width=33%>" + getIntopicBar("left") + "</td>";
\r
294 sHTML += "<td width=34%>" + getIntopicBar("center") + "</td>";
\r
296 sHTML += "<td width=33%>" + getIntopicBar("right") + "</td>";
\r
297 sHTML += "</tr></table>";
\r
298 document.write(sHTML);
\r
303 function sendAveInfoOut()
\r
306 setTimeout("sendAveInfo();", 100);
\r
309 function sendAveInfo()
\r
311 var oMsg = new whMessage(WH_MSG_AVENUEINFO, this, 1, gaAvenues);
\r
318 var oMsg = new whMessage(WH_MSG_NEXT, this, 1, null);
\r
324 var oMsg = new whMessage(WH_MSG_PREV, this, 1, null);
\r
328 function createSyncInfo()
\r
330 var oParam = new Object();
\r
331 if (gsPPath.length == 0)
\r
332 gsPPath = _getPath(document.location.href);
\r
333 oParam.sPPath = gsPPath;
\r
334 oParam.sTPath = document.location.href;
\r
335 oParam.aPaths = gaPaths;
\r
339 function syncWithShow()
\r
350 function showTocPane()
\r
352 var oMsg = new whMessage(WH_MSG_SHOWTOC, this, 1, null);
\r
356 function sendSyncInfo()
\r
361 if (gaPaths.length > 0)
\r
363 oParam = createSyncInfo();
\r
365 var oMsg = new whMessage(WH_MSG_SYNCINFO, this, 1, oParam);
\r
370 function sendInvalidSyncInfo()
\r
374 var oMsg = new whMessage(WH_MSG_SYNCINFO, this, 1, null);
\r
379 function enableWebSearch(bEnable)
\r
383 var oMsg = new whMessage(WH_MSG_ENABLEWEBSEARCH, this, 1, bEnable);
\r
388 function autoSync(nSync)
\r
390 if (nSync == 0) return;
\r
391 if (isInPopup()) return;
\r
392 if (isOutMostTopic())
\r
396 function isOutMostTopic()
\r
398 if (gnOutmostTopic == -1)
\r
400 var oMessage = new whMessage(WH_MSG_ISINFRAMESET, this, 1 , null);
\r
401 if (SendMessage(oMessage))
\r
402 gnOutmostTopic = 0;
\r
404 gnOutmostTopic = 1;
\r
406 return (gnOutmostTopic == 1);
\r
411 if (gaPaths.length > 0)
\r
413 var oParam = createSyncInfo();
\r
414 var oMessage = new whMessage(WH_MSG_SYNCTOC, this, 1, oParam);
\r
415 SendMessage(oMessage);
\r
420 function avenueInfo(sName, sPrev, sNext)
\r
422 this.sName = sName;
\r
423 this.sPrev = sPrev;
\r
424 this.sNext = sNext;
\r
427 function getCurrentAvenue()
\r
429 var oParam = new Object();
\r
430 oParam.sAvenue = null;
\r
431 var oMessage = new whMessage(WH_MSG_GETCURRENTAVENUE, this, 1, oParam);
\r
432 SendMessage(oMessage);
\r
433 return oParam.sAvenue;
\r
436 function unRegisterListener()
\r
438 sendInvalidSyncInfo();
\r
439 enableWebSearch(false);
\r
440 if (whtopic_foldUnload)
\r
441 whtopic_foldUnload();
\r
444 function onSendMessage(oMsg)
\r
446 var nMsgId = oMsg.nMessageId;
\r
447 if (nMsgId == WH_MSG_GETAVIAVENUES)
\r
449 oMsg.oParam.aAvenues = gaAvenues;
\r
452 else if (nMsgId == WH_MSG_GETTOCPATHS)
\r
454 if (isOutMostTopic())
\r
456 oMsg.oParam.oTocInfo = createSyncInfo();
\r
462 else if (nMsgId == WH_MSG_NEXT)
\r
466 else if (nMsgId == WH_MSG_PREV)
\r
470 else if (nMsgId == WH_MSG_WEBSEARCH)
\r
477 function goAvenue(bNext)
\r
480 var sAvenue = getCurrentAvenue();
\r
482 if (sAvenue != null && sAvenue != "")
\r
484 for (var i = 0; i < gaAvenues.length ; i ++)
\r
486 if (gaAvenues[i].sName == sAvenue)
\r
495 sTopic = gaAvenues[nAvenue].sNext;
\r
497 sTopic = gaAvenues[nAvenue].sPrev;
\r
502 for (var i = 0; i < gaAvenues.length ; i ++)
\r
504 if (gaAvenues[i].sNext != null && gaAvenues[i].sNext.length > 0 && bNext)
\r
506 sTopic = gaAvenues[i].sNext;
\r
509 else if (gaAvenues[i].sPrev != null && gaAvenues[i].sPrev.length > 0 && !bNext)
\r
511 sTopic = gaAvenues[i].sPrev;
\r
517 if (sTopic != null && sTopic != "")
\r
519 if (gsPPath != null && gsPPath != "")
\r
521 sFullTopicPath = _getFullPath(gsPPath, sTopic);
\r
522 document.location = sFullTopicPath;
\r
527 function canGo(bNext)
\r
529 for (var i = 0; i < gaAvenues.length ; i ++)
\r
531 if ((gaAvenues[i].sNext != null && gaAvenues[i].sNext.length > 0 && bNext) ||
\r
532 (gaAvenues[i].sPrev != null && gaAvenues[i].sPrev.length > 0 && !bNext))
\r
540 if (gsStartPage != "")
\r
541 window.location = gsStartPage + "#" + gsRelCurPagePath;
\r
546 if (goFrame != null)
\r
548 goFrame.location = window.location;
\r
552 function isTopicOnly()
\r
554 if (gnTopicOnly == -1)
\r
556 var oParam = new Object();
\r
557 oParam.oFrame = null;
\r
558 var oMsg = new whMessage(WH_MSG_GETSTARTFRAME, this, 1, oParam);
\r
559 if (SendMessage(oMsg))
\r
561 goFrame = oParam.oFrame;
\r
567 if (gnTopicOnly == 1)
\r
573 function websearch()
\r
577 if (document.ehelpform)
\r
578 document.ehelpform.submit();
\r
582 if (window.ehelpform)
\r
583 window.ehelpform.submit();
\r
587 function addSearchFormHref(sHref)
\r
589 gsSearchFormHref = sHref;
\r
590 enableWebSearch(true);
\r
593 function searchB(nForm)
\r
595 var sValue = eval("document.searchForm" + nForm + ".searchString.value");
\r
596 var oMsg = new whMessage(WH_MSG_SEARCHTHIS, this, 1, sValue);
\r
600 function getSearchFormHTML()
\r
604 var sFormName = "searchForm" + gnForm;
\r
605 var sButton = "<form name=\"" + sFormName + "\" method=\"POST\" action=\"javascript:searchB("+ gnForm + ")\">"
\r
606 sButton += "<input type=\"text\" name=\"searchString\" value=\"- Full Text search -\" size=\"20\"/>";
\r
609 sButton+="<a class=\"searchbtn\" href=\"javascript:void(0);\" onclick=\"" + sFormName + ".submit(); return false;\"></a>";
\r
611 else if ("" == "image")
\r
613 sButton+="<a class=\"searchbtn\" href=\"javascript:void(0);\" onclick=\"" + sFormName + ".submit(); return false;\">"
\r
614 sButton+="<img src=\"\" border=0></a>";
\r
616 sButton += "</form>";
\r
617 sHTML ="<td align=\"center\">" + sButton + "</td>";
\r
621 function showHidePane(bShow)
\r
625 oMsg=new whMessage(WH_MSG_SHOWPANE, this, 1, null);
\r
627 oMsg=new whMessage(WH_MSG_HIDEPANE, this, 1, null);
\r
631 function isShowHideEnable()
\r
639 if(window.gbWhUtil&&window.gbWhMsg&&window.gbWhVer&&window.gbWhProxy)
\r
641 RegisterListener("bsscright", WH_MSG_GETAVIAVENUES);
\r
642 RegisterListener("bsscright", WH_MSG_GETTOCPATHS);
\r
643 RegisterListener("bsscright", WH_MSG_NEXT);
\r
644 RegisterListener("bsscright", WH_MSG_PREV);
\r
645 RegisterListener("bsscright", WH_MSG_WEBSEARCH);
\r
646 if (gbMac && gbIE4)
\r
648 if (typeof(window.onunload) != "unknown")
\r
649 whtopic_foldUnload = window.onunload;
\r
653 if (window.onunload)
\r
654 whtopic_foldUnload = window.onunload;
\r
656 window.onunload = unRegisterListener;
\r
657 setButtonFont("show","","10pt","","","","");
\r
662 document.location.reload();