2 <script language="javascript1.2" src="whver.js"></script>
3 <script language="javascript1.2" src="whmozemu.js"></script>
4 <script language="javascript1.2" src="whutils.js"></script>
5 <script language="javascript1.2">
9 document.write("<body></body>");
13 document.write("<frameset rows=\"100%,*\"><frame name=\"data_frm\" src=\"about:blank\"><frame name=\"dumb_frm\" src=\"about:blank\"></frameset>");
15 var gCSHFileName="whcshdata.htm";
17 var gHomePage="Salome_Study_Manager_User_s_Guide.htm";
18 var gaProj=new Array();
19 gaProj[0]=new Object();
20 gaProj[0].sProjPath=_replaceSlash(_getPath(document.location.href));
21 gaProj[0].nLoadState=0;
30 var CMD_SHOWGLOSSARY=4;
33 var RHWO_LOCATION=0x01; /*need location bar?*/
34 var RHWO_MENUBAR=0x02; /*need menubar?*/
35 var RHWO_RESIZABLE=0x04; /*resizable window?*/
36 var RHWO_TOOLBAR=0x08; /*need toolbar?*/
37 var RHWO_STATUS=0x10; /*need statusbar?*/
38 var RHWO_SCROLLBARS=0x20; /*need scrollbars?*/
46 var goWnd=new Object();
47 goWnd.sName="whCshDefault";
48 goWnd.nBOptions=RHWO_RESIZABLE|RHWO_SCROLLBARS;
54 var goFullWnd=new Object();
55 goFullWnd.sName="whDefault";
56 goFullWnd.nBOptions=RHWO_RESIZABLE|RHWO_SCROLLBARS;
57 goFullWnd.sBLeft="20%";
59 goFullWnd.sBWidth="79%";
60 goFullWnd.sBHeight="79%";
67 function showCSH(sParam)
73 //with the format #<a=xxx>>b=xxx>>c=xxx...
80 if(gaProj[0].nLoadState==0)
82 var sCshFile=_getFullPath(gaProj[0].sProjPath,gCSHFileName);
83 gaProj[0].nLoadState=1;
84 setTimeout("loadFail("+0+");",3000);
85 loadDataCsh(sCshFile);
101 sURL=_getPath(document.location.href)+gHomePage+"#"+gsTopicURL;
107 sURL=_getPath(document.location.href)+gHomePage+"#>>cmd="+gnCommand;
109 sURL=_getPath(document.location.href)+gHomePage;
116 if(gaProj[gnCurProj].aWnd)
118 var aWnd=gaProj[gnCurProj].aWnd;
120 for(var i=0;i<aWnd.length;i++)
122 if(aWnd[i].sName.toLowerCase()==gsWindow.toLowerCase())
129 if(!bFound&&gnCurProj!=0)
131 var aWnd=gaProj[0].aWnd;
132 for(var j=0;j<aWnd.length;j++)
134 if(aWnd[j].sName.toLowerCase()==gsWindow.toLowerCase())
148 strURLOpt+=">>cap="+oWnd.sCaption;
150 strURLOpt+=">>pan="+oWnd.nPanes;
151 else if(oWnd.nPanes==2)
153 strURLOpt+=">>pan="+oWnd.nPanes;
155 strURLOpt+=">>pot="+oWnd.nPOptions;
157 strURLOpt+=">>pbs="+oWnd.sPButtons;
159 strURLOpt+=">>pdb="+oWnd.sPDefBtn;
163 if(sURL.indexOf("#")==-1)
169 var strOpt=getBrowserOptionString(oWnd);
170 var sNewName=convertWindowName(oWnd.sName);
176 goNewWnd=window.open("about:blank",sNewName,strOpt);
177 setTimeout("postWindowNSOpen();",100);
181 window.open("about:blank",sNewName,strOpt);
182 var oNewWnd=window.open(sURL,sNewName);
191 window.open("about:blank",sNewName,strOpt);
192 goNewWnd=window.open(sURL,sNewName);
196 gsURL = sURL; // IE4 had hard time to handle bookmark.
197 goNewWnd=window.open("about:blank",sNewName,strOpt);
199 setTimeout("postWindowOpen();",100);
203 document.location=sURL;
208 function convertWindowName(strName)
210 var strNewName = strName;
211 var strResultName = "";
212 var re=new RegExp("_","g");
213 strNewName = strName.replace(re,"__");
214 for (var i=0;i<strNewName.length;i++)
215 if (!(strNewName[i] == '_' ||
216 (strNewName[i] <= '9' && strNewName[i] >= '0') ||
217 (strNewName[i] <= 'z' && strNewName[i] >= 'a') ||
218 (strNewName[i] <= 'Z' && strNewName[i] >= 'A')))
220 strResultName += "_" + strNewName.charCodeAt(i);
223 strResultName += strNewName[i];
224 return strResultName;
227 function postWindowNSOpen()
232 goNewWnd.document.location.href=gsURL;
238 function postWindowOpen()
242 if (gsURL&&!gbIE5&&gbIE4)
243 goNewWnd.document.location.href=gsURL;
248 function parseParam(sParam)
255 var nPos=sParam.indexOf(">>",nBPos);
260 var sPart=sParam.substring(nBPos,nPos);
267 var sPart=sParam.substring(nBPos);
271 }while(nBPos<sParam.length);
275 function parsePart(sPart)
277 if(sPart.toLowerCase().indexOf("id=")==0)
279 fetchURLById(sPart.substring(3));
282 else if(sPart.toLowerCase().indexOf("str=")==0)
284 fetchURLByStr(sPart.substring(4));
287 else if(sPart.toLowerCase().indexOf("url=")==0)
289 gsTopicURL=sPart.substring(4);
292 else if(sPart.toLowerCase().indexOf("cmd=")==0)
294 var sCmd=sPart.substring(4);
295 if(sCmd.toLowerCase()=="toc")
297 gnCommand=CMD_SHOWTOC;
299 else if(sCmd.toLowerCase()=="idx")
301 gnCommand=CMD_SHOWINDEX;
303 else if(sCmd.toLowerCase()=="fts")
305 gnCommand=CMD_SHOWSEARCH;
307 else if(sCmd.toLowerCase()=="glo")
309 gnCommand=CMD_SHOWGLOSSARY;
311 else if(sCmd.toLowerCase()=="none")
313 gnCommand=CMD_SHOWNONE;
317 else if(sPart.toLowerCase().indexOf("wnd=")==0)
319 gsWindow=_browserStringToText(sPart.substring(4));
321 else if(sPart.toLowerCase().indexOf("java=")==0)
323 gsJava=sPart.substring(5);
327 function fetchURLById(sId)
329 var nId=parseInt(sId);
331 fetchURL("",nId,false);
334 function fetchURLByStr(sStr)
337 fetchURL(sStr,0,true);
340 function fetchURL(sStr,nId,bUseStr)
344 for(var i=0;i<gaProj.length;i++)
346 if(gaProj[i].nLoadState==3)
350 for(var j=0;j<gaProj[i].aCsh.length;j++)
355 if(gaProj[i].aCsh[j].strAliasId.toLowerCase()==sStr.toLowerCase())
356 sTopicURL=gaProj[i].aCsh[j].strUrl;
360 if(gaProj[i].aCsh[j].nTopicNum==nId)
361 sTopicURL=gaProj[i].aCsh[j].strUrl;
368 if(gaProj[i].sProjPath.indexOf(gaProj[0].sProjPath)==0)
370 var sRelPath=gaProj[i].sProjPath.substring(gaProj[0].sProjPath.length);
371 gsTopicURL=sRelPath+sTopicURL;
374 gsTopicURL=gaProj[i].sProjPath+sTopicURL;
377 gsTopicURL=sTopicURL;
385 else if(gaProj[i].nLoadState==0)
390 var sCshFile=_getFullPath(gaProj[i].sProjPath,gCSHFileName);
391 gaProj[i].nLoadState=1;
392 setTimeout("loadFail("+i+");",3000);
393 loadDataCsh(sCshFile);
396 if(bFound||bNeedLoad)
406 function loadDataCsh(sFile)
412 window.frames[0].location=sFile;
416 function loadFail(nProj)
418 if(gaProj[nProj].nLoadState==1)
420 gaProj[nProj].nLoadState=2;
422 fetchURL(gsStr,gnId,gbUseStr);
428 function putCshData(strProj,aCsh,aWnd,aRmtProj)
432 strProj=_replaceSlash(strProj);
433 if(strProj.lastIndexOf("/")!=strProj.length-1)
435 for(var i=0;i<gaProj.length;i++)
437 if(gaProj[i].sProjPath)
439 if(isSamePath(gaProj[i].sProjPath,strProj))
441 gaProj[i].nLoadState=3;
448 if(aRmtProj&&aRmtProj.length)
450 for(var j=0;j<aRmtProj.length;j++)
452 var strRPath=_getFullPath(strProj,aRmtProj[j]);
454 for (var k=0;k<gaProj.length;k++)
456 if(gaProj[k].sProjPath)
458 if(isSamePath(gaProj[k].sProjPath,strRPath))
467 var len=gaProj.length;
468 gaProj[len]=new Object();
469 gaProj[len].sProjPath=strRPath;
470 gaProj[len].nLoadState=0;
475 fetchURL(gsStr,gnId,gbUseStr);
482 function isSamePath(strPath1,strPath2)
484 return strPath1.toLowerCase()==strPath2.toLowerCase();
487 function getRelHomePage(strLocation)
489 var strCurPPath=_getPath(strLocation);
490 var strOriPPath=_getPath(getHomePage());
491 var strRelPath=_getRelativeFileName(strOriPPath,strCurPPath);
492 var strURL=getHomePage()+"#"+strRelPath;
496 function getHomePage()
499 var strTmp=location.toString();
500 var nPos=strTmp.indexOf("#");
503 strHomePage=strTmp.substring(0,nPos);
512 function getBrowserOptionString(oWnd)
517 if(oWnd.nBOptions&RHWO_LOCATION)
518 strOpts+="location=yes";
520 strOpts+="location=no";
521 if(oWnd.nBOptions&RHWO_TOOLBAR)
522 strOpts+=",toolbar=yes";
524 strOpts+=",toolbar=no";
525 if(oWnd.nBOptions&RHWO_MENUBAR)
526 strOpts+=",menubar=yes";
528 strOpts+=",menubar=no";
529 if(oWnd.nBOptions&RHWO_STATUS)
530 strOpts+=",status=yes";
532 strOpts+=",status=no";
533 if(oWnd.nBOptions&RHWO_SCROLLBARS)
534 strOpts+=",scrollbars=yes";
536 strOpts+=",scrollbars=no";
537 if(oWnd.nBOptions&RHWO_RESIZABLE)
538 strOpts+=",resizable=yes";
540 strOpts+=",resizable=no";
543 var nTop=getSValue(oWnd.sBTop,screen.height);
544 strOpts+=",top="+nTop;
545 strOpts+=",screenY="+nTop;
549 var nLeft=getSValue(oWnd.sBLeft,screen.width);
550 strOpts+=",left="+nLeft;
551 strOpts+=",screenX="+nLeft;
555 var nWidth=getSValue(oWnd.sBWidth,screen.width);
556 strOpts+=",width="+nWidth;
557 strOpts+=",outerWidth="+nWidth;
561 var nHeight=getSValue(oWnd.sBHeight,screen.height);
562 strOpts+=",height="+nHeight;
563 strOpts+=",outerHeight="+nHeight;
568 function getSValue(sValue,nLength)
571 var nPos=sValue.indexOf("%");
576 var nPart=parseInt(sValue.substring(0,nPos));
577 nValue=nLength*nPart/100;
581 nValue=parseInt(sValue);
586 window.onload=window_OnLoad;
588 function window_OnLoad()
590 if(document.location.hash.length>0)
592 showCSH(document.location.hash.substring(1));
596 window.moveTo(screen.width,screen.height);