Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1064 lines
40 KiB

  1. // Filename: shared.js in NTShared.chm
  2. // Version post beta 3 (7)
  3. // version 07.01.99
  4. //************************************************ EVENT HANDLING ********************************************
  5. //*******************************************************************************************************************
  6. // re-directs to the proper event-driven functions.
  7. window.onload= loadPage;
  8. document.onclick= onclickTriage;
  9. document.onmouseover= gettingHot;
  10. document.onmouseout= gettingCold;
  11. window.onunload=saveChecklistState;
  12. window.onresize= resizeDiv;
  13. window.onbeforeprint= set_to_print;
  14. window.onafterprint= reset_form;
  15. //******************************************** USER-DEFINED GLOBAL VARIABLES ************************************
  16. //********************************************************************************************************************
  17. // The images listed below can all be changed by the user.
  18. var sPreviousTip= "Previous topic";
  19. var sNextTip= "Next topic";
  20. var sExpandTip= "Expand/collapse";
  21. var sPopupTip= "View definition";
  22. var sShortcutTip= "";
  23. var moniker= "ms-its:"; // moniker= ""; for flat files
  24. var sSharedCHM= moniker+"DomainMig.chm::/";
  25. var closed = sSharedCHM + "plusCold.gif"; //image used for collapsed item in callExpand()
  26. var closedHot = sSharedCHM + "plusHot.gif"; //hot image used for collapsed item in callExpand()
  27. var expand = sSharedCHM + "minusCold.gif"; //image used for expanded item in callExpand()
  28. var expandHot = sSharedCHM + "minusHot.gif"; //hot image used for expanded item in callExpand()
  29. var previousCold= sSharedCHM + "previousCold.gif";
  30. var previousHot= sSharedCHM + "previousHot.gif";
  31. var nextCold= sSharedCHM + "nextCold.gif";
  32. var nextHot= sSharedCHM + "nextHot.gif";
  33. var shortcutCold= sSharedCHM + "shortcutCold.gif";
  34. var shortcutHot= sSharedCHM + "shortcutHot.gif";
  35. var popupCold= sSharedCHM + "popupCold.gif";
  36. var popupHot= sSharedCHM + "popupHot.gif";
  37. var emptyImg= sSharedCHM + "empty.gif"; //image used for empty expand
  38. var noteImg= sSharedCHM + "note.gif"; //image used for notes
  39. var tipImg= sSharedCHM + "tip.gif"; //image used for tips
  40. var warningImg= sSharedCHM + "warning.gif"; //image used for warnings
  41. var cautionImg= sSharedCHM + "caution.gif"; //image used for cautions
  42. var importantImg= sSharedCHM + "important.gif"; //image used for important notice
  43. var relTopicsImg= sSharedCHM + "rel_top.gif"; //image used for important notice
  44. var branchImg= sSharedCHM + "elle.gif";
  45. var branchImg_RTL= sSharedCHM + "elle_rtl.gif";
  46. //******************************************** GLOBAL VARIABLES ******************************************
  47. //********************************************************************************************************
  48. var printing = "FALSE";
  49. var single = "FALSE";
  50. var scroller = "FALSE";
  51. var isRTL= (document.dir=="rtl");
  52. var imgStyleRTL= "";
  53. if (isRTL) imgStyleRTL=" style='filter:flipH' ";
  54. var sActX_TDC= "CLASSID='CLSID:333C7BC4-460F-11D0-BC04-0080C7055A83'"; //Tabular Data Control for reusable text data
  55. var sSharedReusableTextFile= sSharedCHM + "shared.txt"; // common reusable text file
  56. var sSharedReusableTextFileRecord= "para"; //reusable text record
  57. var numbers= /\d/g; //javascript regular expression
  58. var spaces= /\s/g; //javascript regular expression
  59. var semicolon= /;/g; //javascript regular expression
  60. var isIE5= (navigator.appVersion.indexOf("MSIE 5")>0) || (navigator.appVersion.indexOf("MSIE")>0 && parseInt(navigator.appVersion)> 4);
  61. var isPersistent= false;
  62. //******************************************** INITIALIZATION *************************************************
  63. //******************************************************************************************************************
  64. //*** loadPage **********************************************************************************************
  65. // Adds the default image tags and re-usable text to the HTML page.
  66. function loadPage(){
  67. isPersistent= (document.all.item("checklist")!=null) && (isIE5);
  68. setPreviousNext();
  69. resizeDiv();
  70. if (isPersistent) getChecklistState();
  71. addReusableText();
  72. insertImages();
  73. }
  74. //****** setPreviousNext ************************************************************************ *********************************************************************************************
  75. // insert previous/next navbar
  76. // called by: <div id="nav">@@HTMLsequenceFile.txt or .lst@@</div>
  77. function setPreviousNext(){
  78. var oNav = document.all.item("nav");
  79. if (oNav == null ) return;
  80. var sPreviousALT= sPreviousTip;
  81. var sNextALT= sNextTip;
  82. var sHTMLfile= oNav.innerHTML;
  83. var imgPrev= "<IMG SRC='"+previousCold+"' BORDER=0 ALT='"+ sPreviousALT +"' ALIGN='top' "+ imgStyleRTL +">";
  84. var imgNext= "<IMG SRC='"+nextCold+"' BORDER=0 ALT='"+ sNextALT + "' ALIGN='top' "+ imgStyleRTL +">";
  85. var previousNextObject= "<OBJECT ID='HTMlist' WIDTH=100 HEIGHT=51 " + sActX_TDC +"><param name='DataURL' value='"
  86. +sHTMLfile +"'><param name='UseHeader' value=True></OBJECT>";
  87. oNav.innerHTML= "<TABLE WIDTH='100%' STYLE='margin-top:0;' cellspacing=0>"
  88. + "<TR><TD style='text-align=left; background-color:transparent'><A ID='previousLink' HREF='#' REL='previous' CLASS='navbar'>"
  89. +imgPrev + "</A></TD><TD width='100%' align='center'></td><TD style='text-align=right; background-color:transparent'><A ID='nextLink' HREF='#' REL='next' CLASS='navbar'>"
  90. +imgNext+ "</A></TD></TR></TABLE>";
  91. document.body.innerHTML= document.body.innerHTML + previousNextObject;
  92. findPageSeq();
  93. if (printing == "TRUE") return;
  94. var thisLoc= document.location.href +"#";
  95. if (previousLink.href== thisLoc) previousLink.style.display="none";
  96. else previousLink.style.display="block";
  97. if (nextLink.href== thisLoc) nextLink.style.display="none";
  98. else nextLink.style.display="block";
  99. }
  100. //****** findPageSeq *********************************************************************************************
  101. // finds this page in the "html sequence list" file (filename.lst) and determines the previous & next pages from the list
  102. // the list is created from a tool named "chumper"
  103. function findPageSeq() {
  104. var rs= HTMlist.recordset;
  105. var thisLoc= document.location.href;
  106. var iLoc= thisLoc.lastIndexOf("/");
  107. if (iLoc > 0) thisLoc= thisLoc.substring(iLoc+1, thisLoc.length);
  108. if (nav.style == "[object]") {
  109. nav.style.visibility="hidden";
  110. printing = "FALSE";
  111. }
  112. else
  113. {
  114. printing = "TRUE";
  115. return;
  116. }
  117. rs.moveFirst();
  118. while (!rs.EOF) {
  119. if (thisLoc == rs.fields("HTMfiles").value){
  120. nav.style.visibility="visible";
  121. rs.MoveNext();
  122. break;
  123. }
  124. previousLink.href=rs.fields("HTMfiles").value;
  125. rs.moveNext();
  126. }
  127. if (!rs.EOF) nextLink.href=rs.fields("HTMfiles").value;
  128. }
  129. //******Re-usable text *********************************************************************************************
  130. // Inserts the Tabular Data Control (TDC) object at the end of the page
  131. // Inserts "re-usable text" from the txt file at: <span id="@@CHM_name@@@@index#@@" class="reuse"></span>
  132. // e.g.<span id="printing4" class="reuse"></span> for record#4 in the printing.txt in printing.chm.
  133. function addReusableText(){
  134. var ntsharedAdded= false; // make sure the object is only added once
  135. var CHMspecificAdded= false; // make sure the object is only added once
  136. var coll = document.all.tags("SPAN");
  137. var sIndex,sRecord,sFile,sFileID,dataBindingObject;
  138. // TDC object for ntshared.chm
  139. var coreObject= "WIDTH=100 HEIGHT=51 "+sActX_TDC+"><param name='UseHeader' value=True><param name='FieldDelim' value='~'><param name='sort' value='INDEX'>";
  140. var shareTextObject = "<OBJECT ID='NTsharedText' " + coreObject + "<param name='DataURL' value='"+sSharedReusableTextFile+"'></OBJECT>";
  141. for (var i=0; i< coll.length; i++)
  142. if (coll[i].className.toLowerCase()=="reuse"){
  143. if (isRTL) coll[i].dir= "rtl";
  144. if (coll[i].id == null) return;
  145. sFile= coll[i].id.toLowerCase();
  146. sFile= sFile.replace(spaces,"");
  147. sFileID= sFile;
  148. sFile= sFile.replace(numbers,"");
  149. if (sFile == sSharedReusableTextFileRecord) coll[i].dataSrc= "#NTsharedText";
  150. else coll[i].dataSrc= "#CHMspecificText";
  151. coll[i].dataField= "INDEX";
  152. if (!ntsharedAdded && sFile==sSharedReusableTextFileRecord){
  153. document.body.innerHTML= document.body.innerHTML + shareTextObject;
  154. ntsharedAdded= true;
  155. }
  156. else if (!CHMspecificAdded && sFile !=sSharedReusableTextFileRecord){
  157. dataBindingObject= "<OBJECT ID='CHMspecificText'" + coreObject
  158. + "<param name='DataURL' value='"+sSharedCHM+sFile+".txt'></OBJECT>";
  159. document.body.innerHTML= document.body.innerHTML + dataBindingObject;
  160. CHMspecificAdded= true;
  161. }
  162. if (sFile == sSharedReusableTextFileRecord)
  163. sRecord= NTsharedText.recordset;
  164. else sRecord= CHMspecificText.recordset;
  165. sRecord.moveFirst();
  166. do { sIndex= sRecord.fields("INDEX").value;
  167. sText= sRecord.fields("TEXT").value;
  168. if (sIndex < sFileID) sRecord.moveNext();
  169. else break;
  170. } while (!sRecord.EOF);
  171. if (sIndex == sFileID) coll[i].innerHTML= sText;
  172. }
  173. }
  174. //****** insertImages *********************************************************************************************
  175. // Inserts shared images in User-Defined Variables section and thumbnails.
  176. function insertImages(){
  177. // insert alert icons
  178. var collP = document.all.tags("P");
  179. for (var i=0; i<collP.length; i++) {
  180. if (collP[i].className.toLowerCase()=="note") collP[i].innerHTML ="<img class='alert' src='"+noteImg+"' "+ imgStyleRTL +"> " + collP[i].innerHTML;
  181. else if (collP[i].className.toLowerCase()=="warning") collP[i].innerHTML ="<img class='alert' src='"+warningImg+"'> " + collP[i].innerHTML;
  182. else if (collP[i].className.toLowerCase()=="caution") collP[i].innerHTML ="<img class='alert' src='"+cautionImg+"'> " + collP[i].innerHTML;
  183. else if (collP[i].className.toLowerCase()=="tip") collP[i].innerHTML ="<img class='alert' src='"+tipImg+"'> " + collP[i].innerHTML;
  184. else if (collP[i].className.toLowerCase()=="important") collP[i].innerHTML ="<img class='alert' src='"+importantImg+"'> " + collP[i].innerHTML;
  185. else if (collP[i].className.toLowerCase()=="empty") collP[i].innerHTML ="<img class='alert' src='"+emptyImg+"'> " + collP[i].innerHTML;
  186. else if (collP[i].className.toLowerCase()=="reltopics") collP[i].innerHTML ="<img class='alert' src='"+relTopicsImg+"'> " + collP[i].innerHTML;
  187. }
  188. //indents for Navigation Tree
  189. var collUL = document.all.tags("UL");
  190. for (var i=0; i<collUL.length; i++) {
  191. var indent= 0;
  192. if (collUL[i].className.toLowerCase()=="navtree"){
  193. if (isRTL) collUL[i].style.listStyleImage= "url('" + branchImg_RTL + "')";
  194. else collUL[i].style.listStyleImage= "url('" + branchImg + "')";
  195. for (var j = 0; j < collUL[i].children.length; j++)
  196. if (collUL[i].children[j].className.toLowerCase()=="branch"){
  197. if (isRTL) collUL[i].children[j].style.marginRight= (indent +'em');
  198. else collUL[i].children[j].style.marginLeft= (indent +'em');
  199. indent= indent + 0.75;
  200. }
  201. }
  202. }
  203. for (var i=0; i < document.anchors.length; i++){
  204. var imgInsert="";
  205. var imgStyle= "";
  206. var imgSpace= "<span class='space'></span>";
  207. var oBefore=document.anchors[i].parentElement.tagName;
  208. var oAnchor= document.anchors[i].id.toLowerCase();
  209. // insert RELTOPICS icons
  210. // if (oAnchor=="reltopics")
  211. // if (document.anchors[i].children.tags("IMG")(0) && document.anchors[i].children.tags("IMG")(0).className.toLowerCase() == "reltopics")
  212. // imgInsert= ""; // not to re-insert when persistent
  213. // else imgInsert= "<img class='alert' src='"+relTopicsImg+"'>" + imgSpace;
  214. // insert SHORTCUT icons
  215. if (oAnchor=="shortcut") {
  216. document.anchors[i].title= sShortcutTip;
  217. if (document.anchors[i].children.tags("IMG")(0) && document.anchors[i].children.tags("IMG")(0).className.toLowerCase() == "shortcut")
  218. imgInsert= ""; // not to re-insert when persistent
  219. else imgInsert= "<img class='shortcut' src='"+shortcutCold+"' "+ imgStyleRTL+ ">" + imgSpace;
  220. }
  221. // insert POPUP icons
  222. else if (oAnchor=="wpopup" || oAnchor=="wpopupweb") document.anchors[i].title= sPopupTip;
  223. else if (document.anchors[i].className.toLowerCase()=="popupicon")
  224. if (document.anchors[i].children.tags("IMG")(0) && document.anchors[i].children.tags("IMG")(0).className.toLowerCase() == "popup")
  225. imgInsert= ""; // not to re-insert when persistent
  226. else imgInsert= "<img class='popup' src='"+popupCold+"'>" + imgSpace;
  227. // insert EXPAND icons
  228. else if (oAnchor=="expand") {
  229. document.anchors[i].title= sExpandTip;
  230. if (document.anchors[i].children.tags("IMG")(0) && document.anchors[i].children.tags("IMG")(0).className.toLowerCase() == "expand")
  231. imgInsert= ""; // not to re-insert when persistent
  232. else{
  233. if (document.anchors[i].parentElement.offsetLeft == document.anchors[i].offsetLeft) {
  234. imgSpace= "<span class='space' style='width:0'></span>";
  235. if (isRTL){ document.anchors[i].parentElement.style.marginRight= "1.5em"; imgStyle=" style=margin-right:'-1.5em'";}
  236. else { document.anchors[i].parentElement.style.marginLeft= "1.5em"; imgStyle=" style=margin-left:'-1.5em'";}
  237. }
  238. imgInsert= "<img class='expand' src='"+ closed +"' "+imgStyle+">" +imgSpace;
  239. }
  240. }
  241. // insert thumbnail images
  242. else if (oAnchor=="thumbnail" || oAnchor=="thumbnailweb"){
  243. var sAltText = document.anchors[i].innerHTML;
  244. var sThumbnailText = document.anchors[i].title;
  245. var oImg = document.anchors[i].href.toLowerCase();
  246. if (oAnchor=="thumbnail")
  247. var sThumbnailImg= moniker + getURL(oImg);
  248. else var sThumbnailImg = document.anchors[i].href.toLowerCase();
  249. document.anchors[i].outerHTML = "<DIV id='thumbDiv' class='thumbnail'>"+document.anchors[i].outerHTML+"</div>";
  250. document.anchors[i].innerHTML = "<img class='thumbnail' src='" + sThumbnailImg + "' alt= ' " + sAltText + "'><p>" +sThumbnailText+"</p>";
  251. if (isRTL) thumbDiv.style.styleFloat= "right";
  252. }
  253. document.anchors[i].innerHTML = imgInsert + document.anchors[i].innerHTML;
  254. if (isRTL) document.anchors[i].dir="rtl";
  255. }
  256. }
  257. //***** onclickTriage ****************************************************************************************
  258. // redirects to the appropriate function based on the ID of the clicked <A> tag.
  259. function onclickTriage(){
  260. var e= window.event.srcElement;
  261. // if the innerHTML in the <a> tag is encapsulated by a style tag or hightlighted in the word seach,
  262. // the parentElement is called.
  263. for (var i=0; i < 5; i++)
  264. if (e.tagName!="A" && e.parentElement!=null) e= e.parentElement;
  265. eID= e.id.toLowerCase();
  266. if (popupOpen) closePopup();
  267. // expand image in a new window
  268. if (eID=="thumbnail" || eID=="pophtm") popNewWindow(e);
  269. else if (eID=="thumbnailweb") callThumbnailWeb(e);
  270. else if (eID=="wpopup") callPopup(e);
  271. else if (eID=="wpopupweb") callPopupWeb(e);
  272. else if (eID=="shortcut") callShortcut(e);
  273. else if (eID=="reltopics") callRelatedTopics(e);
  274. else if (eID=="altloc") callAltLocation(e);
  275. else if (eID=="expand") callExpand(e);
  276. return;
  277. }
  278. //*** gettingHot ****************************************************************************************
  279. // Makes all the required changes for mouseover.
  280. function gettingHot() {
  281. var e = window.event.srcElement;
  282. if (e.id.toLowerCase()=="cold") e.id ="hot";
  283. else if (e.src== previousCold) e.src = previousHot;
  284. else if (e.className.toLowerCase()=="navbar" && e.children.tags("IMG")(0).src== previousCold) e.children.tags("IMG")(0).src= previousHot;
  285. else if (e.src== nextCold) e.src = nextHot;
  286. else if (e.className.toLowerCase()=="navbar" && e.children.tags("IMG")(0).src== nextCold) e.children.tags("IMG")(0).src= nextHot;
  287. else if (e.className.toLowerCase()=="shortcut" && e.tagName=="IMG") e.src = shortcutHot; //<img> tags have a class
  288. else if (e.id.toLowerCase()=="shortcut") e.children.tags("IMG")(0).src = shortcutHot; //<a> tags have an ID
  289. else if (e.className.toLowerCase()=="popup" && e.tagName=="IMG") e.src = popupHot; //<img> tags have a class
  290. else if (e.className.toLowerCase()=="popupicon") e.children.tags("IMG")(0).src = popupHot; //<a> tags have an ID
  291. else if ((e.className.toLowerCase()=="expand" && e.tagName=="IMG") ||( e.id.toLowerCase()=="expand")) expandGoesHot(e);
  292. }
  293. //*** gettingCold **************************************************************************************
  294. // Initial state for mouseout.
  295. function gettingCold() {
  296. var e = window.event.srcElement;
  297. if (e.id.toLowerCase()=="hot") e.id ="cold";
  298. else if (e.src== previousHot) e.src = previousCold;
  299. else if (e.className.toLowerCase()=="navbar" && e.children.tags("IMG")(0).src== previousHot) e.children.tags("IMG")(0).src= previousCold;
  300. else if (e.src== nextHot) e.src = nextCold;
  301. else if (e.className.toLowerCase()=="navbar" && e.children.tags("IMG")(0).src== nextHot) e.children.tags("IMG")(0).src= nextCold;
  302. else if (e.className.toLowerCase()=="shortcut" && e.tagName=="IMG") e.src = shortcutCold; //<img> tags have a class
  303. else if (e.id.toLowerCase()=="shortcut") e.children.tags("IMG")(0).src= shortcutCold; //<a> tags have an ID
  304. else if (e.className.toLowerCase()=="popup" && e.tagName=="IMG") e.src = popupCold; //<img> tags have a class
  305. else if (e.className.toLowerCase()=="popupicon") e.children.tags("IMG")(0).src= popupCold; //<a> tags have an ID
  306. else if ((e.className.toLowerCase()=="expand" && e.tagName=="IMG") ||( e.id.toLowerCase()=="expand")) expandGoesCold(e);
  307. }
  308. //****************************************** OBJECT CONSTRUCTION **************************************
  309. //*****************************************************************************************************
  310. // Uses an A tag to pass parameters between an HTML page and this script.
  311. // Creates an ActiveX Object from these parameters, appends the Object to the end of the page,
  312. // and clicks it. These objects relate to HTMLHelp environment and information about them can be found on the http://HTMLHelp site.
  313. // Object construction variables *********************************************************************
  314. var sParamCHM,sParamFILE, sParamEXEC, sParamMETA,iEND;
  315. var sActX_HH= " type='application/x-oleobject' classid='clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11' ";
  316. //*** callPopup ***************************************************************************************
  317. // creates an object from an <A> tag HREF, the object inserts a winhelp popup
  318. // called by: <A ID="wPopup" HREF="HELP=@@file_name.hlp@@ TOPIC=@@topic#@@">@@Popup text@@</A>
  319. function callPopup(eventSrc) {
  320. var e= eventSrc;
  321. var eH= unescape(e.href);
  322. var eH_= eH.toLowerCase();
  323. event.returnValue = false;
  324. var iTOPIC = eH_.lastIndexOf("topic=");
  325. if (iTOPIC==-1) return;
  326. sParamTOPIC = eH.substring((iTOPIC+6),eH.length); // extracts the topic for item2
  327. var iHELP = eH_.lastIndexOf("help=");
  328. if (iHELP==-1) return;
  329. sParamHELP = eH.substring(iHELP+5,iTOPIC); // extracts the help file for item1
  330. if (document.hhPopup) document.hhPopup.outerHTML = ""; // if hhPopup object exists, clears it
  331. var h= "<object id='hhPopup'"+ sActX_HH + "STYLE='display:none'><param name='Command' value='WinHelp, Popup'>";
  332. h= h + "<param name='Item1' value='" + sParamHELP + "'><param name='Item2' value='" + sParamTOPIC + "'></object>";
  333. document.body.insertAdjacentHTML("beforeEnd", h);
  334. document.hhPopup.hhclick();
  335. }
  336. //*** callAltLocation******************************************************************************
  337. // creates an object from an <A> tag HREF, the object will navigate to the alternate location if the first location is not found.
  338. // called from: <A ID="altLoc" HREF="CHM=@@1st_chm_name.chm;Alt_chm_name.chm@@ FILE=@@1st_file_name.htm;Alt_file_name.htm@@">@@Link text here@@</A>
  339. function callAltLocation(eventSrc) {
  340. var e= eventSrc;
  341. var eH= unescape(e.href);
  342. var eH_= eH.toLowerCase();
  343. var sFILEarray,sCHMarray;
  344. event.returnValue = false;
  345. var sParamTXT= e.innerHTML;
  346. sParamTXT= sParamTXT.replace(semicolon,"");
  347. var iFILE = eH_.lastIndexOf("file=");
  348. if (iFILE==-1) return;
  349. sParamFILE= eH.substring((iFILE+5),eH.length); // extracts the 2 HTM files
  350. sParamFILE= sParamFILE.replace(spaces,"");
  351. iSPLIT= sParamFILE.match(semicolon);
  352. if (iSPLIT)
  353. sFILEarray = sParamFILE.split(";"); // separates the 2 HTM files
  354. else return;
  355. var iCHM = eH_.lastIndexOf("chm=");
  356. if(iCHM==-1) return;
  357. else sParamCHM = eH.substring(iCHM+4,iFILE); // extracts the 2 CHM's
  358. sParamCHM= sParamCHM.replace(spaces,"");
  359. iSPLIT= sParamCHM.match(semicolon);
  360. if (iSPLIT)
  361. sCHMarray= sParamCHM.split(";"); // separates the 2 CHM's
  362. else return;
  363. sParamFILE= moniker + sCHMarray[0]+ "::/" + sFILEarray[0] + ";" + moniker + sCHMarray[1]+ "::/" + sFILEarray[1];
  364. if (document.hhAlt) document.hhAlt.outerHTML = ""; // if hhAlt object exists, clears it
  365. var h= "<object id='hhAlt'"+ sActX_HH + "STYLE='display:none'><PARAM NAME='Command' VALUE='Related Topics'>";
  366. h= h + "<param name='Item1' value='" + sParamTXT +";" + sParamFILE + "'></object>";
  367. document.body.insertAdjacentHTML("beforeEnd", h);
  368. document.hhAlt.hhclick();
  369. }
  370. //*** callRelatedTopics******************************************************************************
  371. // creates an object from an <A> tag HREF, the object inserts a popup of the related topics to select
  372. // called from: <A ID="relTopics" HREF="CHM=@@chm_name1.chm;chm_name2.chm@@ META=@@a_filename1;a_filename2@@">Related Topics</A>
  373. function callRelatedTopics(eventSrc) {
  374. var e= eventSrc;
  375. var eH= unescape(e.href);
  376. var eH_= eH.toLowerCase();
  377. event.returnValue = false;
  378. var iMETA = eH_.lastIndexOf("meta=");
  379. if (iMETA==-1) return;
  380. sParamMETA = eH.substring((iMETA+5),eH.length); // extracts the META keywords for item2
  381. var iCHM = eH_.lastIndexOf("chm=");
  382. if(iCHM==-1) sParamCHM = "";
  383. else sParamCHM = eH.substring(iCHM+4,iMETA); // extracts the CHM files for item1
  384. if (document.hhRel) document.hhRel.outerHTML = ""; // if hhRel object exists, clears it
  385. var h= "<object id='hhRel'"+ sActX_HH + "STYLE='display:none'><param name='Command' value='ALink,MENU'>";
  386. h= h + "<param name='Item1' value='" + sParamCHM + "'><param name='Item2' value='" + sParamMETA + "'></object>";
  387. document.body.insertAdjacentHTML("beforeEnd", h);
  388. document.hhRel.hhclick();
  389. }
  390. //*** popNewWindow***************************************************************************************
  391. // creates an object from an <A> tag HREF, the object then opens a new window from the image URL found in the HREF
  392. // called from: <a id="thumbnail" title="Enlarge figure" href="CHM=NTArt.chm FILE=@@image_name.gif@@">@@alt text here@@</A>
  393. // the thumbnail image is loaded by loadPage();
  394. function popNewWindow(eventSrc) {
  395. var eH= eventSrc.href;
  396. event.returnValue = false;
  397. // extracts the thumbnail image URL from the <a> tag HREF
  398. sParamFILE = getURL(eH);
  399. if (sParamFILE=="") return;
  400. // if the hhWindow object exists, clears it
  401. if (document.hhWindow) document.hhWindow.outerHTML = "";
  402. var h = "<object id='hhWindow'"+ sActX_HH +" STYLE='display:none'><param name='Command' value='Related Topics'>";
  403. h = h + "<param name='Window' value='$global_largeart'><param name='Item1' value='$global_largeart;" + moniker + sParamFILE+ "'> </object>";
  404. document.body.insertAdjacentHTML("beforeEnd", h);
  405. document.hhWindow.hhclick();
  406. }
  407. //*** callShortcut ***************************************************************************************
  408. // creates an object from an <A> tag, the object then calls the executable code
  409. // called from: <A ID="shortcut" HREF="EXEC=@@executable_name.exe@@ CHM=ntshared.chm FILE=@@error_file_name.htm@@">@@Shortcut text@@</A>
  410. // the shortcut image is loaded by loadInitialImg();
  411. function callShortcut(eventSrc) {
  412. var e= eventSrc;
  413. var eH= unescape(e.href);
  414. var eH_= eH.toLowerCase();
  415. event.returnValue = false;
  416. // extracts the error file URL from the <a> tag HREF
  417. iEND= eH.length;
  418. sParamFILE = getURL(eH);
  419. //code added to redirect if shortcut is nonexisting
  420. var con_mmc;
  421. var doc_mmc;
  422. doc_mmc = sParamFILE.toLowerCase();
  423. con_mmc = doc_mmc.indexOf("mmc.chm");
  424. if (con_mmc != -1){
  425. doc_mmc = " " + document.location;
  426. con_mmc = doc_mmc.indexOf("mmc.chm");
  427. if (con_mmc == -1){
  428. sParamFILE = "Domainmig.chm::/alt_url_deux.htm"
  429. }
  430. }
  431. // *************************************************
  432. var iEXEC = eH_.lastIndexOf("exec=");
  433. if (iEXEC==-1) return;
  434. else sParamEXEC = eH.substring(iEXEC+5,iEND); // extracts the executable for item1
  435. if (document.hhShortcut) document.hhShortcut.outerHTML = ""; // if the hhShortcut object exists, clears it
  436. var h = "<object id='hhShortcut'"+ sActX_HH +" STYLE='display:none'> <param name='Command' value='ShortCut'>";
  437. if(sParamFILE != "") h = h + "<param name='Window' value='" + moniker + sParamFILE+ "'>";
  438. h = h + "<param name='Item1' value='" + sParamEXEC + "'><param name='Item2' value='msg,1,1'></object>";
  439. document.body.insertAdjacentHTML("beforeEnd", h);
  440. document.hhShortcut.hhclick();
  441. }
  442. //**************************************** EXPAND FUNCTIONS *********************************************************
  443. //********************************************************************************************************************
  444. //** callExpand **************************************************************************************************
  445. // This expands & collapses (based on current state) "expandable" nodes as they are clicked.
  446. // Called by: <A ID="expand" href="#">@@Hot text@@</A>
  447. // Followed by: <div class="expand">
  448. function callExpand(eventSrc) {
  449. var e= eventSrc;
  450. event.returnValue = false; // prevents navigating for <A> tag
  451. var oExpandable = getExpandable(e);
  452. var oImg = getImage(e);
  453. if (oExpandable.style.display == "block")
  454. doCollapse(oExpandable, oImg);
  455. else doExpand(oExpandable, oImg);
  456. }
  457. //** expandGoesHot *********************************************************************************************
  458. // Returns expand image to hot.
  459. function expandGoesHot(eventSrc){
  460. var e= eventSrc;
  461. var oExpandable = getExpandable(e);
  462. var oImg = getImage(e);
  463. if (oExpandable.style.display == "block") oImg.src = expandHot;
  464. else oImg.src = closedHot;
  465. }
  466. //** expandGoesCold *********************************************************************************************
  467. // Returns expand image to cold.
  468. function expandGoesCold(eventSrc){
  469. var e= eventSrc;
  470. var oExpandable = getExpandable(e);
  471. var oImg = getImage(e);
  472. if (oExpandable.style.display == "block") oImg.src = expand;
  473. else oImg.src = closed;
  474. }
  475. //** getExpandable *****************************[used by callExpand, expandGoesHot, expandGoesCold]*******
  476. // Determine if the element is an expandable node or a child of one.
  477. function getExpandable(eventSrc){
  478. var e = eventSrc;
  479. var iNextTag, oExpandable;
  480. for (var i=1;i<4; i++){
  481. iNextTag= e.sourceIndex+e.children.length+i;
  482. oExpandable= document.all(iNextTag);
  483. if (oExpandable.className.toLowerCase()=="expand" || iNextTag == document.all.length)
  484. break;
  485. }
  486. return oExpandable;
  487. }
  488. //** getImage ***********************************[used by callExpand, expandGoesHot, expandGoesCold]*******
  489. // Find the first image in the children of the current srcElement.
  490. // (allows the image to be placed anywhere inside the <A HREF> tag)
  491. function getImage(header) {
  492. var oImg = header;
  493. if(oImg.tagName != "IMG") oImg=oImg.children.tags("IMG")(0);
  494. return oImg;
  495. }
  496. //**** expandAll *******************************************************************************************************
  497. // Will expand or collapse all "expandable" nodes when clicked. [calls closeAll()]
  498. // called by: <A HREF="#" onclick="expandAll();">expand all</A>
  499. var stateExpand = false; //applies to the page
  500. //**** ****************************************************************************************************************
  501. function expandAll() {
  502. var oExpandToggle, oImg;
  503. var expandAllMsg = "expand all"; //message returned when CloseAll() is invoked
  504. var closeAllMsg = "close all"; //message returned when ExpandAll() is invoked
  505. var e= window.event.srcElement;
  506. event.returnValue = false;
  507. for (var i=0; i< document.anchors.length; i++){
  508. oExpandToggle = document.anchors[i];
  509. if (oExpandToggle.id.toLowerCase() == "expand"){
  510. oExpandable = getExpandable(oExpandToggle);
  511. oImg = getImage(oExpandToggle);
  512. if (stateExpand == true) doCollapse(oExpandable, oImg);
  513. else doExpand(oExpandable, oImg);
  514. }
  515. }
  516. if (stateExpand == true) {
  517. stateExpand = false;
  518. e.innerText= expandAllMsg;
  519. }
  520. else {
  521. stateExpand = true;
  522. e.innerText= closeAllMsg;
  523. }
  524. }
  525. //**** doExpand *******************************************************************************************************
  526. // Expands expandable block & changes image
  527. var redo = false;
  528. function doExpand(oToExpand, oToChange) {
  529. var oExpandable= oToExpand;
  530. var oImg= oToChange;
  531. oImg.src = expand;
  532. oExpandable.style.display = "block";
  533. if (!redo && !isIE5) {
  534. redo = true;
  535. focus(oToExpand);
  536. doExpand(oToExpand, oToChange);
  537. }
  538. }
  539. //**** doCollapse *****************************************************************************************************
  540. // Collapses expandable block & changes image
  541. function doCollapse(oToCollapse, oToChange) {
  542. if (printing == "TRUE") return;
  543. var oExpandable= oToCollapse;
  544. var oImg= oToChange;
  545. oExpandable.style.display = "none";
  546. oImg.src = closed;
  547. }
  548. //*******************************************************************************************************
  549. //******* WEB FUNCTIONS **************************************************************************
  550. //*******************************************************************************************************
  551. //**** callThumbnailWeb **************************************************************************************
  552. function callThumbnailWeb(eventSrc) {
  553. var e= eventSrc;
  554. event.returnValue = false;
  555. var thumbnailWin= window.open (e.href, "$global_largeart", "height=450, width=600, left=10, top=10, dependent=yes, resizable=yes, status=no, directories=no, titlebar=no, toolbar=yes, menubar=no, location=no","true");
  556. thumbnailWin.document.write ("<html><head><title>Windows 2000</title></head><body><img src='"+e.href+"'></body></html>");
  557. return;
  558. }
  559. //*********************************************************************************************************
  560. //*********************************************************************************************************
  561. var popupOpen= false; //state of popups
  562. var posX, posY; //coordinates of popups
  563. var oPopup; //object to be used as popup content
  564. //**** callPopupWeb **************************************************************************************
  565. // the web popups have been converted from the object winHelp popup for the web.
  566. // called by: <A ID="wPopupWeb" HREF="#">@@Popup text@@</A>
  567. // followed by: <div class="popup">Popup content</div>
  568. function callPopupWeb(eventSrc) {
  569. var e= eventSrc;
  570. // find the popup <div> that follows <a id="wPopupWeb"></a>
  571. findPopup(e);
  572. positionPopup(e)
  573. oPopup.style.visibility = "visible";
  574. popupOpen = true;
  575. return;
  576. }
  577. //**** findPopup ****************************************************************************************
  578. function findPopup(oX){
  579. var e= oX;
  580. var iNextTag;
  581. for (var i=1;i<4; i++){
  582. iNextTag= e.sourceIndex + i;
  583. oPopup= document.all(iNextTag);
  584. if (oPopup.className.toLowerCase()=="popup" || iNextTag == document.all.length)
  585. break;
  586. }
  587. if (iNextTag != document.all.length) {
  588. posX = window.event.clientX;
  589. posY = window.event.clientY + document.body.scrollTop+10;
  590. }
  591. else closePopup();
  592. }
  593. //**** positionPopup ************************************************************************************
  594. // Set size and position of popup.
  595. // If it is off the page, move up, but not past the very top of the page.
  596. function positionPopup(oX){
  597. var e= oX;
  598. var popupOffsetWidth = oPopup.offsetWidth;
  599. //determine if popup will be offscreen to right
  600. var rightlimit = posX + popupOffsetWidth;
  601. if (rightlimit >= document.body.clientWidth)
  602. posX -= (rightlimit - document.body.clientWidth);
  603. if (posX < 0) posX = 0;
  604. //position popup
  605. oPopup.style.top = posY;
  606. oPopup.style.left = posX;
  607. var pageBottom = document.body.scrollTop + document.body.clientHeight;
  608. var popupHeight = oPopup.offsetHeight;
  609. if (popupHeight + posY >= pageBottom) {
  610. if (popupHeight <= document.body.clientHeight)
  611. oPopup.style.top = pageBottom - popupHeight;
  612. else
  613. oPopup.style.top = document.body.scrollTop;
  614. }
  615. }
  616. //**** closePopup ****************************************************************************************
  617. // Close Popup
  618. function closePopup() {
  619. oPopup.style.visibility = "hidden";
  620. popupOpen = false;
  621. return;
  622. }
  623. //********************************************* GENERAL FUNCTIONS ************************************************
  624. //**************************************************************************************************************************
  625. //***ajustImg *************************************************************************************************************
  626. // expands an image to the with of the window or shrinks it to 90px
  627. function ajustImg(eventSrc) {
  628. var e= eventSrc;
  629. var fullWidth= document.body.offsetWidth;
  630. fullWidth = fullWidth - 50;
  631. if (e.style.pixelWidth==90)
  632. e.style.pixelWidth=fullWidth;
  633. else e.style.pixelWidth=90;
  634. }
  635. //** getURL **************************************[used in callShortcut, popNewWindow& loadPage]********
  636. // extracts the file location (CHM::/HTM) URL
  637. function getURL(sHREF) {
  638. var spaces= /\s/g
  639. var eH = unescape(sHREF);
  640. eH = eH.replace(spaces,"");
  641. var eH_= eH.toLowerCase();
  642. var sParamFILE= "";
  643. var sParamCHM= "";
  644. var iFILE= eH_.lastIndexOf("file=");
  645. if (iFILE!=-1){
  646. iEND= iFILE +1;
  647. sParamFILE = eH.substring(iFILE+5,eH.length);
  648. }
  649. var iCHM = eH_.lastIndexOf("chm=");
  650. if (iCHM!=-1){
  651. iEND = iCHM +1; // iEND used by callShortcut
  652. sParamCHM = eH.substring(iCHM+4, iFILE);
  653. sParamFILE= sParamCHM+"::/"+sParamFILE;
  654. }
  655. return sParamFILE;
  656. }
  657. //****************************************************************************************************************************
  658. //******************************************** IE5 PERSISTENCE *************************************************************
  659. //****************************************************************************************************************************
  660. var oTD,iTD; // persistence
  661. //****** Persistence for userData *********************************************************************************************
  662. function getChecklistState(){
  663. var pageID= addID();
  664. if (checklist.all== "[object]") {
  665. oTD=checklist.all.tags("INPUT");
  666. iTD= oTD.length;
  667. }
  668. else
  669. {
  670. printing = "TRUE";
  671. isPersistent = false;
  672. return;
  673. }
  674. if (iTD == 0){
  675. printing = "TRUE";
  676. isPersistent = false;
  677. return;
  678. }
  679. // routine added to fix a bug in the ocx 06/14/99
  680. lct = document.location + ".";
  681. xax = 10;
  682. xax = lct.indexOf("mk:@MSITStore");
  683. if (xax != -1) {
  684. lct = "ms-its:" + lct.substring(14,lct.length-1);
  685. isPersistent = false;
  686. document.location.replace(lct);
  687. isPersistent = true;
  688. // alert("after reload : " + document.location);
  689. }
  690. else
  691. {
  692. checklist.load("oXMLStore");
  693. }
  694. // routine added to fix a bug in the ocx 06/14/99
  695. xax = 10;
  696. xax = pageID.indexOf("~");
  697. if (xax == -1) {
  698. if (checklist.getAttribute("sPersist"+pageID+"0"))
  699. for (i=0; i<iTD; i++){
  700. if (oTD[i].type =="checkbox" || oTD[i].type =="radio"){
  701. checkboxValue= checklist.getAttribute("sPersist"+pageID+i);
  702. if (checkboxValue=="yes") oTD[i].checked=true;
  703. else oTD[i].checked=false;
  704. }// if
  705. if (oTD[i].type =="text")
  706. oTD[i].value= checklist.getAttribute("sPersist"+pageID+i);
  707. }// for
  708. }
  709. } // end persistence
  710. //** saveChecklistState *************************************************************************************************************
  711. function saveChecklistState(){
  712. var pageID= addID();
  713. if (!isPersistent) return;
  714. // you will need this document.location
  715. xax = 10;
  716. xax = pageID.indexOf("~");
  717. if (xax == -1) {
  718. for (i=0; i<iTD; i++){
  719. if (oTD[i].type =="checkbox" || oTD[i].type =="radio"){
  720. if (oTD[i].checked) checkboxValue="yes";
  721. else checkboxValue="no";
  722. checklist.setAttribute("sPersist"+pageID+i, checkboxValue);
  723. }// if
  724. if (oTD[i].type =="text")
  725. checklist.setAttribute("sPersist"+pageID+i, oTD[i].value);
  726. } // for
  727. }
  728. // routine added to fix a bug in the ocx 06/14/99
  729. lct = document.location + ".";
  730. xax = 10;
  731. xax = lct.indexOf("mk:@MSITStore");
  732. if (xax != -1) {
  733. lct = "ms-its:" + lct.substring(14,lct.length-1);
  734. isPersistent = false;
  735. document.location.replace(lct);
  736. isPersistent = true;
  737. // alert("after reload : " + document.location);
  738. }
  739. else
  740. {
  741. checklist.save("oXMLStore");
  742. }
  743. // routine added to fix a bug in the ocx 06/14/99
  744. }//end function
  745. //** resizeDiv *******************************[used with callPopupWeb, setPreviousNext}****************************************************
  746. // resize the page when the <div class=nav></div> && <div class=text></div> are found
  747. function resizeDiv(){
  748. if (printing == "TRUE") return;
  749. var oNav = document.all.item("nav");
  750. var oText= document.all.item("text");
  751. if (popupOpen) closePopup();
  752. if (oText == null) return;
  753. if (oNav != null){
  754. document.all.nav.style.width= document.body.offsetWidth;
  755. document.all.text.style.width= document.body.offsetWidth-4;
  756. document.all.text.style.top= document.all.nav.offsetHeight;
  757. if (document.body.offsetHeight > document.all.nav.offsetHeight)
  758. document.all.text.style.height= document.body.offsetHeight - document.all.nav.offsetHeight;
  759. else document.all.text.style.height=0;
  760. }
  761. }
  762. //** addID *************************************************************************************************************
  763. function addID(){
  764. var locID = document.location.href;
  765. var iHTM = locID.lastIndexOf(".htm");
  766. var iName=locID.lastIndexOf("/");
  767. locID = locID.substring(iName+1,iHTM);
  768. return locID;
  769. }
  770. //** set_to_print ***************
  771. function set_to_print(){
  772. var i;
  773. printing = "TRUE";
  774. if (window.text) {
  775. if (!window.text.style){
  776. scroller = "FALSE";
  777. }
  778. else
  779. {
  780. document.all.text.style.height = "auto";
  781. scroller = "TRUE";
  782. }
  783. }
  784. for (i=0; i < document.all.length; i++){
  785. if (document.all[i].id == "expand") {
  786. callExpand(document.all[i]);
  787. single = "TRUE";
  788. }
  789. if (document.all[i].tagName == "BODY") {
  790. document.all[i].scroll = "auto";
  791. }
  792. if (document.all[i].tagName == "A" && scroller != "TRUE") {
  793. document.all[i].outerHTML = "<A HREF=''>" + document.all[i].innerHTML + "</a>";
  794. }
  795. }
  796. }
  797. //** used to reset a page if needed ********************
  798. function reset_form(){
  799. if (single == "TRUE") document.location.reload();
  800. if (scroller = "TRUE") document.location.reload();
  801. }
  802. //** on error routine *********************************
  803. function errorHandler() {
  804. // alert("Error Handled");
  805. return true;
  806. }