2 var gaProj=new Array();
9 var gServerEnabled=false;
15 if (navigator.currentNavPen)
16 gsFirstPane = navigator.currentNavPen;
23 goDiv.innerHTML=gsHTML;
29 function whCom(sName,sComFile)
32 this.msDivId=sName+"Div";
33 this.msIFrameId=sName+"IFrame";
34 this.msComFile=sComFile;
37 this.show=function(bShow)
39 if(this.mbShow!=bShow)
41 if(bShow&&!this.mbloaded)
46 var oDiv=getElement(this.msDivId);
49 if(gbIE55||(gbIE5&&gbMac))
51 var oIframe=getElement(this.msIFrameId);
59 oIframe.style.zIndex=3;
61 oIframe.style.visibility="visible";
69 oIframe.style.zIndex=2;
71 oIframe.style.visibility="hidden";
77 oDiv.style.visibility=(bShow==true)?'visible':'hidden';
87 if(this.msComFile.length>0){
88 var strFile= _getFullPath(getPath(), this.msComFile);
89 var oDiv=getElement(this.msDivId);
92 var nIFrameHeight=oDiv.style.pixelHeight;
93 var nIFrameWidth=oDiv.style.pixelWidth;
94 var sHTML="<IFRAME ID="+this.msIFrameId+" title=\"" + this.msName + "\" SRC=\""+strFile+"\" BORDER=0 FRAMEBORDER=no STYLE=\"width:";
96 sHTML+=nIFrameWidth+"px;height:"+nIFrameHeight+"px;\"></IFRAME>";
98 sHTML+="100%; height:100%;\"></IFRAME>";
100 oDiv.innerHTML=sHTML;
102 gsHTML="<IFRAME ID="+this.msIFrameId+" title=\"" + this.msName + "\" SRC=\""+strFile+"\" BORDER=0 FRAMEBORDER=no STYLE=\"width:100%;border:0;height:100%;\"></IFRAME>";
104 setTimeout("delayLoad()", 100);
111 this.unload=function()
113 var oDiv=getElement(this.msDivId);
117 this.getDivHTML=function()
121 sHTML+="<DIV ID="+this.msDivId+" ALIGN=left STYLE=\"position:absolute;z-index:1;left:0;top:0;width:100%;height:100%;margin:0;padding:0;border:0;\">";
123 sHTML+="<DIV ID="+this.msDivId+" ALIGN=left STYLE=\"position:absolute;z-index:1;left:0;top:0;width:100%;height:100%;\">";
124 else if(gbIE4||gbWindows)
125 sHTML+="<DIV ID="+this.msDivId+" ALIGN=left STYLE=\"position:absolute;z-index:1;left:0;top:0;width:100%;height:100%;visibility:hidden\">";
127 sHTML+="<DIV ID="+this.msDivId+" ALIGN=left STYLE=\"position:absolute;z-index:1;left:0;top:0;width:100%;height:100%;visibility:hidden\">";
136 this.maCom=new Array();
137 this.addCom=function(sName,sComFile)
139 var owhCom=new whCom(sName,sComFile);
140 this.maCom[this.maCom.length]=owhCom;
145 for(var i=0;i<this.maCom.length;i++)
147 sHTML+=this.maCom[i].getDivHTML();
149 document.body.insertAdjacentHTML("beforeEnd",sHTML);
152 this.showById=function(nId)
154 for(var s=0;s<this.maCom.length;s++)
157 this.maCom[s].show(false);
159 this.maCom[nId].show(true);
161 this.show=function(sName)
163 navigator.currentNavPen = sName;
165 for(var i=0;i<this.maCom.length;i++)
167 if(sName==this.maCom[i].msName)
179 this.unload=function()
181 for(var i=0;i<this.maCom.length;i++)
183 this.maCom[i].unload();
186 this.getCurrent=function()
196 gsPath=location.href;
197 gsPath=_replaceSlash(gsPath);
198 var nPosFile=gsPath.lastIndexOf("/");
199 gsPath=gsPath.substring(0,nPosFile+1);
204 goMan=new whComMan();
205 function addPane(sName,sFileName)
207 var oParam=new Object();
209 var oMsg=new whMessage(WH_MSG_GETPANE, this, 1, oParam);
210 if (SendMessage(oMsg))
212 if (oMsg.oParam.bEnable)
213 goMan.addCom(sName,sFileName);
216 goMan.addCom(sName,sFileName);
219 function setShowPane(sName, bForce)
221 if ((gsFirstPane == "") || bForce)
223 var oMsg=new whMessage(WH_MSG_GETDEFPANE, this, 1, null);
224 if (SendMessage(oMsg))
227 gsFirstPane = oMsg.oParam;
236 function window_OnLoad()
238 var oMsg=new whMessage(WH_MSG_GETCMD,this,1,null);
240 if (SendMessage(oMsg))
246 else if(oMsg.oParam==2)
248 else if(oMsg.oParam==3)
250 else if(oMsg.oParam==4)
253 else if(oMsg.oParam==0)
260 loadData2(gsProjName);
264 var oMsg1=new whMessage(WH_MSG_HIDEPANE, this, 1, null)
270 goMan.show(gsFirstPane);
276 function setServerEnabled()
278 gServerEnabled = true;
281 function loadData2(strFile)
284 loadDataXML(strFile);
289 function addProject(bPreferXML,sXMLName,sHTMLName)
291 var bLoadXML=bPreferXML;
292 if(!gbIE4&&!gbNav6&&!gbOpera7)
303 addProjectXML(sXMLName);
305 addProjectHTML(sHTMLName);
308 function addProjectHTML(sName)
314 function addProjectXML(sName)
320 function window_MyBunload()
326 function putDataXML(xmlDoc,sdocPath)
330 var projectNode=xmlDoc.getElementsByTagName("project")[0];
333 var aRProj=new Array();
334 aRProj[0]=new Object();
335 aRProj[0].sPPath=_getPath(sdocPath);
336 var sLangId=projectNode.getAttribute("langid");
339 aRProj[0].sLangId=sLangId;
341 var sDPath=projectNode.getAttribute("datapath");
344 if(sDPath.lastIndexOf("/")!=sDPath.length-1)
346 aRProj[0].sDPath=sDPath;
350 aRProj[0].sToc=projectNode.getAttribute("toc");
351 aRProj[0].sIdx=projectNode.getAttribute("index");
352 aRProj[0].sFts=projectNode.getAttribute("fts");
353 aRProj[0].sGlo=projectNode.getAttribute("glossary");
354 var RmtProject=projectNode.getElementsByTagName("remote");
356 for (var i=0;i<RmtProject.length;i++)
358 var sURL=RmtProject[i].getAttribute("url");
361 if(sURL.lastIndexOf("/")!=sURL.length-1)
363 aRProj[nCount]=new Object();
364 aRProj[nCount++].sPPath=_getFullPath(aRProj[0].sPPath,sURL);
367 putProjectInfo(aRProj);
371 // on Netscape 6.0 under some situation the xml file cannot be loaded.
372 // so we use pure html instead.
374 setTimeout("redirectToList();",100);
378 setTimeout("checkRemoteProject();", 1);
384 function onLoadXMLError()
387 setTimeout("checkRemoteProject();", 1);
390 function redirectToList()
393 document.location=gsNavReDirect;
395 parent.document.location=gsNavReDirect;
398 function putProjectInfo(aRProj)
400 if(gnChecked==0||isSamePath(gaProj[gnChecked].sPPath,aRProj[0].sPPath))
404 if(aRProj[0].sLangId!=gaProj[0].sLangId)
405 alert("The merged Help system "+aRProj[0].sPPath+" is using a different language from the master Help system, which will cause the index and full-text search functionality to be disabled in the merged Help system.");
407 gaProj[gnChecked]=aRProj[0];
408 for(var i=1;i<aRProj.length;i++)
411 for(var j=0;j<gaProj.length;j++)
413 if(isSamePath(gaProj[j].sPPath,aRProj[i].sPPath))
421 gaProj[gaProj.length]=aRProj[i];
425 setTimeout("checkRemoteProject();", 1);
428 alert("Could not load correctly, please click Refresh.");
431 function isSamePath(sPath1,sPath2)
433 return (sPath1.toLowerCase()==sPath2.toLowerCase());
436 function checkRemoteProject()
438 if(gaProj.length!=gnChecked)
440 setTimeout("cancelProj("+gnChecked+");",10000);
441 loadData2(gaProj[gnChecked].sPPath+gsProjName);
444 var oMsg=new whMessage(WH_MSG_PROJECTREADY,this,1,null);
450 function cancelProj(i)
455 setTimeout("checkRemoteProject();", 1);
459 function window_resize()
461 for(var i=0;i<goMan.maCom.length;i++)
463 var oFrame=getElement(goMan.maCom[i].msIFrameId);
466 oFrame.style.height=document.body.clientHeight;
467 oFrame.style.width=document.body.clientWidth;
473 function window_resize2()
477 if(document.body.clientWidth > 1 && document.body.clientHeight>1)
479 var oMsg = new whMessage(WH_MSG_RESIZEPANE, this, 1, null);
485 function window_unload()
487 UnRegisterListener2(this,WH_MSG_GETPROJINFO);
488 UnRegisterListener2(this,WH_MSG_SHOWTOC);
489 UnRegisterListener2(this,WH_MSG_SHOWIDX);
490 UnRegisterListener2(this,WH_MSG_SHOWFTS);
491 UnRegisterListener2(this,WH_MSG_SHOWGLO);
492 UnRegisterListener2(this,WH_MSG_GETPANEINFO);
495 function onSendMessage(oMsg)
499 var nMsgId=oMsg.nMessageId;
500 if(nMsgId==WH_MSG_GETPROJINFO)
504 var oProj=new Object();
512 else if(nMsgId==WH_MSG_SHOWTOC)
516 var onMsg=new whMessage(WH_MSG_PANEINFO, this, 1, "toc");
518 onMsg = new whMessage(WH_MSG_SHOWPANE, this, 1, null);
521 else if(nMsgId==WH_MSG_SHOWIDX)
525 var onMsg=new whMessage(WH_MSG_PANEINFO, this, 1, "idx");
527 onMsg = new whMessage(WH_MSG_SHOWPANE, this, 1, null);
530 else if(nMsgId==WH_MSG_SHOWFTS)
534 var onMsg=new whMessage(WH_MSG_PANEINFO, this, 1, "fts");
536 onMsg = new whMessage(WH_MSG_SHOWPANE, this, 1, null);
539 else if(nMsgId==WH_MSG_SHOWGLO)
543 var onMsg=new whMessage(WH_MSG_PANEINFO, this, 1, "glo");
545 onMsg = new whMessage(WH_MSG_SHOWPANE, this, 1, null);
548 else if(nMsgId==WH_MSG_GETPANEINFO)
550 oMsg.oParam=goMan.getCurrent();
557 if(window.gbWhUtil&&window.gbWhMsg&&window.gbWhVer&&window.gbWhProxy)
559 RegisterListener2(this,WH_MSG_GETPROJINFO);
560 RegisterListener2(this,WH_MSG_SHOWTOC);
561 RegisterListener2(this,WH_MSG_SHOWIDX);
562 RegisterListener2(this,WH_MSG_SHOWFTS);
563 RegisterListener2(this,WH_MSG_SHOWGLO);
564 RegisterListener2(this,WH_MSG_GETPANEINFO);
566 if((gbMac&&gbIE4)||(gbSunOS&&gbIE5)||gbOpera7)
568 window.onresize=window_resize;
572 window.onresize=window_resize2;
574 window.onload=window_OnLoad;
575 window.onbeforeunload=window_MyBunload;
576 window.onunload=window_unload;
580 document.location.reload();