// Filename: shared.js in NTShared.chm // Version post beta 3 (7) // version 07.01.99 //************************************************ EVENT HANDLING ******************************************** //******************************************************************************************************************* // re-directs to the proper event-driven functions. window.onload= loadPage; document.onclick= onclickTriage; document.onmouseover= gettingHot; document.onmouseout= gettingCold; window.onunload=saveChecklistState; window.onresize= resizeDiv; window.onbeforeprint= set_to_print; window.onafterprint= reset_form; //******************************************** USER-DEFINED GLOBAL VARIABLES ************************************ //******************************************************************************************************************** // The images listed below can all be changed by the user. var sPreviousTip= "Previous topic"; var sNextTip= "Next topic"; var sExpandTip= "Expand/collapse"; var sPopupTip= "View definition"; var sShortcutTip= ""; var moniker= "ms-its:"; // moniker= ""; for flat files var sSharedCHM= moniker+"DomainMig.chm::/"; var closed = sSharedCHM + "plusCold.gif"; //image used for collapsed item in callExpand() var closedHot = sSharedCHM + "plusHot.gif"; //hot image used for collapsed item in callExpand() var expand = sSharedCHM + "minusCold.gif"; //image used for expanded item in callExpand() var expandHot = sSharedCHM + "minusHot.gif"; //hot image used for expanded item in callExpand() var previousCold= sSharedCHM + "previousCold.gif"; var previousHot= sSharedCHM + "previousHot.gif"; var nextCold= sSharedCHM + "nextCold.gif"; var nextHot= sSharedCHM + "nextHot.gif"; var shortcutCold= sSharedCHM + "shortcutCold.gif"; var shortcutHot= sSharedCHM + "shortcutHot.gif"; var popupCold= sSharedCHM + "popupCold.gif"; var popupHot= sSharedCHM + "popupHot.gif"; var emptyImg= sSharedCHM + "empty.gif"; //image used for empty expand var noteImg= sSharedCHM + "note.gif"; //image used for notes var tipImg= sSharedCHM + "tip.gif"; //image used for tips var warningImg= sSharedCHM + "warning.gif"; //image used for warnings var cautionImg= sSharedCHM + "caution.gif"; //image used for cautions var importantImg= sSharedCHM + "important.gif"; //image used for important notice var relTopicsImg= sSharedCHM + "rel_top.gif"; //image used for important notice var branchImg= sSharedCHM + "elle.gif"; var branchImg_RTL= sSharedCHM + "elle_rtl.gif"; //******************************************** GLOBAL VARIABLES ****************************************** //******************************************************************************************************** var printing = "FALSE"; var single = "FALSE"; var scroller = "FALSE"; var isRTL= (document.dir=="rtl"); var imgStyleRTL= ""; if (isRTL) imgStyleRTL=" style='filter:flipH' "; var sActX_TDC= "CLASSID='CLSID:333C7BC4-460F-11D0-BC04-0080C7055A83'"; //Tabular Data Control for reusable text data var sSharedReusableTextFile= sSharedCHM + "shared.txt"; // common reusable text file var sSharedReusableTextFileRecord= "para"; //reusable text record var numbers= /\d/g; //javascript regular expression var spaces= /\s/g; //javascript regular expression var semicolon= /;/g; //javascript regular expression var isIE5= (navigator.appVersion.indexOf("MSIE 5")>0) || (navigator.appVersion.indexOf("MSIE")>0 && parseInt(navigator.appVersion)> 4); var isPersistent= false; //******************************************** INITIALIZATION ************************************************* //****************************************************************************************************************** //*** loadPage ********************************************************************************************** // Adds the default image tags and re-usable text to the HTML page. function loadPage(){ isPersistent= (document.all.item("checklist")!=null) && (isIE5); setPreviousNext(); resizeDiv(); if (isPersistent) getChecklistState(); addReusableText(); insertImages(); } //****** setPreviousNext ************************************************************************ ********************************************************************************************* // insert previous/next navbar // called by:
function setPreviousNext(){ var oNav = document.all.item("nav"); if (oNav == null ) return; var sPreviousALT= sPreviousTip; var sNextALT= sNextTip; var sHTMLfile= oNav.innerHTML; var imgPrev= ""; var imgNext= ""; var previousNextObject= ""; oNav.innerHTML= "" +imgPrev + " | " +imgNext+ " |
" +sThumbnailText+"
"; if (isRTL) thumbDiv.style.styleFloat= "right"; } document.anchors[i].innerHTML = imgInsert + document.anchors[i].innerHTML; if (isRTL) document.anchors[i].dir="rtl"; } } //***** onclickTriage **************************************************************************************** // redirects to the appropriate function based on the ID of the clicked tag. function onclickTriage(){ var e= window.event.srcElement; // if the innerHTML in the tag is encapsulated by a style tag or hightlighted in the word seach, // the parentElement is called. for (var i=0; i < 5; i++) if (e.tagName!="A" && e.parentElement!=null) e= e.parentElement; eID= e.id.toLowerCase(); if (popupOpen) closePopup(); // expand image in a new window if (eID=="thumbnail" || eID=="pophtm") popNewWindow(e); else if (eID=="thumbnailweb") callThumbnailWeb(e); else if (eID=="wpopup") callPopup(e); else if (eID=="wpopupweb") callPopupWeb(e); else if (eID=="shortcut") callShortcut(e); else if (eID=="reltopics") callRelatedTopics(e); else if (eID=="altloc") callAltLocation(e); else if (eID=="expand") callExpand(e); return; } //*** gettingHot **************************************************************************************** // Makes all the required changes for mouseover. function gettingHot() { var e = window.event.srcElement; if (e.id.toLowerCase()=="cold") e.id ="hot"; else if (e.src== previousCold) e.src = previousHot; else if (e.className.toLowerCase()=="navbar" && e.children.tags("IMG")(0).src== previousCold) e.children.tags("IMG")(0).src= previousHot; else if (e.src== nextCold) e.src = nextHot; else if (e.className.toLowerCase()=="navbar" && e.children.tags("IMG")(0).src== nextCold) e.children.tags("IMG")(0).src= nextHot; else if (e.className.toLowerCase()=="shortcut" && e.tagName=="IMG") e.src = shortcutHot; // tags have a class else if (e.id.toLowerCase()=="shortcut") e.children.tags("IMG")(0).src = shortcutHot; // tags have an ID else if (e.className.toLowerCase()=="popup" && e.tagName=="IMG") e.src = popupHot; // tags have a class else if (e.className.toLowerCase()=="popupicon") e.children.tags("IMG")(0).src = popupHot; // tags have an ID else if ((e.className.toLowerCase()=="expand" && e.tagName=="IMG") ||( e.id.toLowerCase()=="expand")) expandGoesHot(e); } //*** gettingCold ************************************************************************************** // Initial state for mouseout. function gettingCold() { var e = window.event.srcElement; if (e.id.toLowerCase()=="hot") e.id ="cold"; else if (e.src== previousHot) e.src = previousCold; else if (e.className.toLowerCase()=="navbar" && e.children.tags("IMG")(0).src== previousHot) e.children.tags("IMG")(0).src= previousCold; else if (e.src== nextHot) e.src = nextCold; else if (e.className.toLowerCase()=="navbar" && e.children.tags("IMG")(0).src== nextHot) e.children.tags("IMG")(0).src= nextCold; else if (e.className.toLowerCase()=="shortcut" && e.tagName=="IMG") e.src = shortcutCold; // tags have a class else if (e.id.toLowerCase()=="shortcut") e.children.tags("IMG")(0).src= shortcutCold; // tags have an ID else if (e.className.toLowerCase()=="popup" && e.tagName=="IMG") e.src = popupCold; // tags have a class else if (e.className.toLowerCase()=="popupicon") e.children.tags("IMG")(0).src= popupCold; // tags have an ID else if ((e.className.toLowerCase()=="expand" && e.tagName=="IMG") ||( e.id.toLowerCase()=="expand")) expandGoesCold(e); } //****************************************** OBJECT CONSTRUCTION ************************************** //***************************************************************************************************** // Uses an A tag to pass parameters between an HTML page and this script. // Creates an ActiveX Object from these parameters, appends the Object to the end of the page, // and clicks it. These objects relate to HTMLHelp environment and information about them can be found on the http://HTMLHelp site. // Object construction variables ********************************************************************* var sParamCHM,sParamFILE, sParamEXEC, sParamMETA,iEND; var sActX_HH= " type='application/x-oleobject' classid='clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11' "; //*** callPopup *************************************************************************************** // creates an object from an tag HREF, the object inserts a winhelp popup // called by: @@Popup text@@ function callPopup(eventSrc) { var e= eventSrc; var eH= unescape(e.href); var eH_= eH.toLowerCase(); event.returnValue = false; var iTOPIC = eH_.lastIndexOf("topic="); if (iTOPIC==-1) return; sParamTOPIC = eH.substring((iTOPIC+6),eH.length); // extracts the topic for item2 var iHELP = eH_.lastIndexOf("help="); if (iHELP==-1) return; sParamHELP = eH.substring(iHELP+5,iTOPIC); // extracts the help file for item1 if (document.hhPopup) document.hhPopup.outerHTML = ""; // if hhPopup object exists, clears it var h= ""; document.body.insertAdjacentHTML("beforeEnd", h); document.hhPopup.hhclick(); } //*** callAltLocation****************************************************************************** // creates an object from an tag HREF, the object will navigate to the alternate location if the first location is not found. // called from: @@Link text here@@ function callAltLocation(eventSrc) { var e= eventSrc; var eH= unescape(e.href); var eH_= eH.toLowerCase(); var sFILEarray,sCHMarray; event.returnValue = false; var sParamTXT= e.innerHTML; sParamTXT= sParamTXT.replace(semicolon,""); var iFILE = eH_.lastIndexOf("file="); if (iFILE==-1) return; sParamFILE= eH.substring((iFILE+5),eH.length); // extracts the 2 HTM files sParamFILE= sParamFILE.replace(spaces,""); iSPLIT= sParamFILE.match(semicolon); if (iSPLIT) sFILEarray = sParamFILE.split(";"); // separates the 2 HTM files else return; var iCHM = eH_.lastIndexOf("chm="); if(iCHM==-1) return; else sParamCHM = eH.substring(iCHM+4,iFILE); // extracts the 2 CHM's sParamCHM= sParamCHM.replace(spaces,""); iSPLIT= sParamCHM.match(semicolon); if (iSPLIT) sCHMarray= sParamCHM.split(";"); // separates the 2 CHM's else return; sParamFILE= moniker + sCHMarray[0]+ "::/" + sFILEarray[0] + ";" + moniker + sCHMarray[1]+ "::/" + sFILEarray[1]; if (document.hhAlt) document.hhAlt.outerHTML = ""; // if hhAlt object exists, clears it var h= ""; document.body.insertAdjacentHTML("beforeEnd", h); document.hhAlt.hhclick(); } //*** callRelatedTopics****************************************************************************** // creates an object from an tag HREF, the object inserts a popup of the related topics to select // called from: Related Topics function callRelatedTopics(eventSrc) { var e= eventSrc; var eH= unescape(e.href); var eH_= eH.toLowerCase(); event.returnValue = false; var iMETA = eH_.lastIndexOf("meta="); if (iMETA==-1) return; sParamMETA = eH.substring((iMETA+5),eH.length); // extracts the META keywords for item2 var iCHM = eH_.lastIndexOf("chm="); if(iCHM==-1) sParamCHM = ""; else sParamCHM = eH.substring(iCHM+4,iMETA); // extracts the CHM files for item1 if (document.hhRel) document.hhRel.outerHTML = ""; // if hhRel object exists, clears it var h= ""; document.body.insertAdjacentHTML("beforeEnd", h); document.hhRel.hhclick(); } //*** popNewWindow*************************************************************************************** // creates an object from an tag HREF, the object then opens a new window from the image URL found in the HREF // called from: @@alt text here@@ // the thumbnail image is loaded by loadPage(); function popNewWindow(eventSrc) { var eH= eventSrc.href; event.returnValue = false; // extracts the thumbnail image URL from the tag HREF sParamFILE = getURL(eH); if (sParamFILE=="") return; // if the hhWindow object exists, clears it if (document.hhWindow) document.hhWindow.outerHTML = ""; var h = ""; document.body.insertAdjacentHTML("beforeEnd", h); document.hhWindow.hhclick(); } //*** callShortcut *************************************************************************************** // creates an object from an tag, the object then calls the executable code // called from: @@Shortcut text@@ // the shortcut image is loaded by loadInitialImg(); function callShortcut(eventSrc) { var e= eventSrc; var eH= unescape(e.href); var eH_= eH.toLowerCase(); event.returnValue = false; // extracts the error file URL from the tag HREF iEND= eH.length; sParamFILE = getURL(eH); //code added to redirect if shortcut is nonexisting var con_mmc; var doc_mmc; doc_mmc = sParamFILE.toLowerCase(); con_mmc = doc_mmc.indexOf("mmc.chm"); if (con_mmc != -1){ doc_mmc = " " + document.location; con_mmc = doc_mmc.indexOf("mmc.chm"); if (con_mmc == -1){ sParamFILE = "Domainmig.chm::/alt_url_deux.htm" } } // ************************************************* var iEXEC = eH_.lastIndexOf("exec="); if (iEXEC==-1) return; else sParamEXEC = eH.substring(iEXEC+5,iEND); // extracts the executable for item1 if (document.hhShortcut) document.hhShortcut.outerHTML = ""; // if the hhShortcut object exists, clears it var h = ""; document.body.insertAdjacentHTML("beforeEnd", h); document.hhShortcut.hhclick(); } //**************************************** EXPAND FUNCTIONS ********************************************************* //******************************************************************************************************************** //** callExpand ************************************************************************************************** // This expands & collapses (based on current state) "expandable" nodes as they are clicked. // Called by: @@Hot text@@ // Followed by: