home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 40 / IOPROG_40.ISO / SOFT / NETFrameworkSDK.exe / comsdk.cab / cptutorials.chm / html / vs70.js < prev    next >
Encoding:
JavaScript  |  2000-06-23  |  44.0 KB  |  1,472 lines

  1. // VERSION 8877
  2.  
  3. //************************** LOCALIZATION VARIABLES ****************************
  4. var L_GlossaryAlt_ToolTip = "View definition";
  5. var L_BrowserAlert_Message = "You must use IE4 or greater in order to view popup glossary definitions";
  6. var L_NoDefAlertTitle_Text = "definition unavailable";
  7. var L_NoDefAlert_Text = "The glossary term and definition do not exist in the glossary file at this time.";
  8. var L_PopUpBoxStyle_Style = "WIDTH:200PX; PADDING:5px 7px 7px 7px; BACKGROUND-COLOR:#FFFFCC; BORDER:SOLID 1 #999999; VISIBILITY:HIDDEN; POSITION:ABSOLUTE; TOP:0PX; LEFT:0PX; Z-INDEX:2;";
  9. var L_See_Text = "<B>See: </B>"
  10. var L_SeeAlso_Text = "<B>See Also: </B>"
  11.  
  12. //Variables for Feedback links
  13. var L_FeedbackLink = "Send feedback to Visual Studio"
  14. var L_MessageLink = "Microsoft Knowledgebase Link"
  15.  
  16. //*************************** END LOCALIZATION *********************************
  17.  
  18. var InlineImgOn = false;  // if true, puts an image next to glossary items
  19. var xmlGloss = true; // turns on glossary implementation
  20. var BeforeReference = "../../dncommon/html/"; // sets base reference 
  21. var xmlFile = BeforeReference + "vsgloss.xml";
  22. var defContent = ""; // holds glossary definition from txt file
  23. var specialCheck, TermDef, WorkText, AnotherTagIndex;
  24. var noPopupsMsg, ieX, ieY, popOpen, theImg, theDiv, PopUp_InAPopUp, e;
  25. var AnotherCheck, WindowOne, WindowTwo, theTagIndex;
  26. var lastClickedPopUp, ie4, IE5, checkIt2;
  27.  
  28. /*
  29.  * Common code
  30.  */
  31. var ie4 = false;
  32. var advanced = false;
  33. var curLang = null;
  34. var showAll = true;
  35. var cook = null;
  36. var baseUrl = document.scripts[document.scripts.length - 1].src.replace(/[^\/]+.js/, "");
  37.  
  38. if (navigator.appName == "Microsoft Internet Explorer") {
  39.     var ver = navigator.appVersion;
  40.     var v = new Number(ver.substring(0,ver.indexOf(".", 0)));
  41.     if (v >= 4) {
  42.         advanced = true;
  43.         ie4 = true;
  44.  
  45.         // Look for 5.x buried somewhere in the version string.
  46.         var toks = ver.split(/[^0-9.]/);
  47.         if (toks) {
  48.             for (var i = 0; i < toks.length; i++) {
  49.                 var tok = toks[i];
  50.                 if (tok.indexOf(".", 0) > 0) {
  51.                     if (tok >= 5)
  52.                         ie4 = false;
  53.                 }
  54.             }
  55.         }
  56.     }
  57. }
  58. if (advanced)
  59.     window.onload = bodyOnLoad;
  60.     window.onbeforeprint = set_to_print;
  61.     window.onafterprint = reset_form;
  62.  
  63. //XML POPUP CODE
  64. var xmlTermRoot;            //XML term root variable (move into function later)
  65. var xmlPopupContent;      //XML content formatted for popup
  66. var xmlDOM;               //The XMLDOM ActiveX object model
  67. var xmlDOMLoaded = false; //Not loaded til 1st glossary popup. Persists for see alsos
  68. //GLOSSARY GIF VARIABLES
  69. var glossInitial = "";
  70. var popupDIV = "<DIV ID='popUpWindow' STYLE='"+L_PopUpBoxStyle_Style+"'>" + "</DIV>";
  71. var browser = navigator.appName + " " + parseInt(navigator.appVersion);
  72.  
  73. function finishOnLoad(){
  74. //THIS SECTION INSERTS POPUP CODE BETWEEN SPAN TAGS
  75.   var TheSpans = document.all.tags('span'); spanText=""
  76.   for (var i = 0; i < TheSpans.length; i++){
  77.     if (TheSpans[i].className=='gp'){
  78.         spanText=TheSpans[i].innerHTML;
  79.         TheSpans[i].innerHTML="";
  80.         var newElement=document.createElement("<A ID='PopUp' CLASS='glosslink' HREF='#"+TheSpans[i].id+"' title='"+L_GlossaryAlt_ToolTip+"'>");
  81.         newElement.innerHTML = glossInitial + spanText;
  82.         TheSpans[i].appendChild(newElement);
  83.     }
  84.   }
  85. document.onkeypress = ieKey;
  86. window.onresize = closeIE4;
  87. document.body.onclick = bodyOnClick;
  88. //IF THE USER HAS IE4+ THEY WILL BE ABLE TO VIEW POPUP BOXES
  89.   if (advanced){
  90.     document.body.insertAdjacentHTML('beforeEnd', popupDIV);}
  91. return;}
  92.  
  93. function bodyOnClick()
  94. {
  95.     if (advanced) {
  96.         var elem = window.event.srcElement;
  97.         for (; elem; elem = elem.parentElement) {
  98.             if (elem.id == "reftip")
  99.                 return;
  100.         }
  101.         hideTip();
  102.         closeMenu();
  103.         hideSeeAlso();
  104.         resizeBan();
  105.         clickAndDo();
  106.     }
  107. }
  108.  
  109. function clickAndDo(){
  110.   e = window.event.srcElement;
  111.   //CAUSES A CLICK ON THE PAGE TO HIDE THE POPUP WINDOWS
  112.   document.all.popUpWindow.style.visibility = "hidden";
  113.   //SETS POPUP WINDOW'S RESIZE VARIABLES TO FALSE
  114.   WindowOne = false;               //TRUE IF USER CLICKS ON THE ID POPUP
  115.   WindowTwo = false;               //TRUE IF USER CLICKS ON THE ID INNERNAV
  116.   //SETS GLOSSARY POPUP'S NEEDED VARIABLES TO FALSE
  117.   popOpen = false;               //TRUE IF A GLOSSARY POPUP IS VISIBLE
  118.   PopUp_InAPopUp = false;        //TRUE IF USER CLICKS A SEE ALSO GLOSSARY TERM
  119.   specialCheck = false;          //TRUE IF THE GLOSSARY TERM ISN'T IN TXT FILE
  120.   AnotherCheck = false;            //TRUE IF INLINE GIFS OFF AND HELP ADDED HTML
  121.   //DETERMINES IF A CLICK IS ON AN HREF TAG
  122.   for (var a = 0; a < 5; a++){
  123.        if ((e.tagName != 'A') && (e.parentElement != null)){e = e.parentElement;}
  124.     eID = e.id;
  125.     //XML CODE ALLOWS TDC TO COEXIST BECAUSE OF THIS
  126.     xmlTermRoot = "";
  127.     if (e.hash != null){
  128.         xmlTermRoot = e.hash;}
  129.     //DETERMINES IF A CLICK IS ON A GLOSSARY POPUP ITEM
  130.     if (eID.indexOf('PopUp') != -1){
  131.         lastClickedPopUp = e;    //USED BY THE WINDOW RESIZE FUNCTION
  132.         WindowOne = true;
  133.         //THIS CONTROLS THE ONCLICK COLOR OF THE GLOSSARY TEXT
  134.         checkIt2 = true;
  135.         theTagIndex = true;
  136.         theTagIndex = e.sourceIndex;
  137.         AnotherTagIndex = parseInt(theTagIndex);
  138.         //THIS CAPTURES THE HTML THAT CONTAINS THE TERM
  139.         WorkText = e.innerHTML;
  140.         //THIS CHECKS FOR ADDED HTML FROM HTMLHELP SEARCH ENGINE
  141.         if (WorkText.indexOf('BACKGROUND-COLOR:') != -1){
  142.             AnotherCheck = true;
  143.             GetTheRealTerm();}
  144.         else{
  145.             TermDef = e.innerHTML;} 
  146.         //AFTER GRABBING THE PRECISE TERM THE NEXT FUNCTION IS INVOKED
  147.         callGlossary(e, TermDef); break;}
  148.     //DETERMINES WHETHER A CLICK IS ON A SEE ALSO GLOSSARY POPUP ITEM
  149.     else if (eID.indexOf('In_PopuP') != -1){
  150.         //THIS CONTROLS THE ONCLICK COLOR OF THE GLOSSARY TEXT
  151.         checkIt2 = true;
  152.         theTagIndex = parseInt(AnotherTagIndex);
  153.           var changeBack = document.all(theTagIndex);
  154.         //A NEEDED VARIABLE IS SET TO TRUE AND THE TERM IS PICKED UP
  155.         PopUp_InAPopUp = true;
  156.         TermDef = e.innerHTML;
  157.         //AFTER GRABBING THE PRECISE TERM THE NEXT FUNCTION IS INVOKED
  158.         callGlossary(e, TermDef); break;}}
  159.             
  160. return;}
  161.  
  162. function ieKey(){
  163.   if (window.event.keyCode == 27){closeIE4();}
  164. return;}
  165.  
  166. function GetTheRealTerm(){
  167.   var c, d, f;
  168.   //IN THIS CASE WE DONT NEED TO REMOVE ANY IMAGES, INLINE IMGS ARE OFF, SO..
  169.   if (AnotherCheck){
  170.     //THIS REMOVES ALL BUT THE TERM AND THE HTML FROM HTMLHELP
  171.     d = "</FONT>";
  172.     f = WorkText;
  173.     f = f.replace(d,'');}
  174.   else{
  175.     c = WorkText.indexOf('width=12>');
  176.     if (c == -1){return;}            
  177.     d = "</FONT>";
  178.     //THIS REMOVES ALL BUT THE TERM AND THE HTML FROM HTMLHELP
  179.     f = WorkText.substring((c+9),WorkText.length);
  180.     f = f.replace(d,'');}
  181.     //THIS REMOVES THE HTML ADDED BY HTMLHELP LEAVING THE TERM
  182.     var g = f.indexOf('<');
  183.     if (g == -1){return;}
  184.     var h = f.indexOf('>');
  185.     if (h == -1){return;}
  186.     var i = f.substring(g,(h+1));
  187.     f = f.replace(i,'');
  188.     TermDef = f;
  189. return TermDef;}
  190.  
  191. //THIS REMOVES THE IMAGE IF HTMLHELP HASN'T ADDED HTML AND LEAVES THE TERM
  192. function GetTheRealTerm2(){
  193.     var c = WorkText.lastIndexOf('width=12>');
  194.     if (c == -1){return;}
  195.     else {TermDef = WorkText.substring((c+9),WorkText.length);}
  196. return TermDef;}
  197.  
  198. function getImage2(){
  199. //HANDLES GREY STATE OF GLOSSARY AND RELTOPIC POPUPS
  200.     var TheSpot;
  201.     //FOR THE GLOSSARY POPUP
  202.     if ((checkIt2) && (theTagIndex != -1)){
  203.         TheSpot = document.all(theTagIndex);}
  204.     else{return;}
  205.     //DETERMINES IF A CLICK IS ON AN HREF TAG
  206.     for (var a = 0; a < 5; a++){
  207.          if ((TheSpot.tagName != 'A') && (TheSpot.parentElement != null)){TheSpot = TheSpot.parentElement;}
  208.         var elemImg = TheSpot;
  209.         if(elemImg.tagName == 'A'){elemImg = TheSpot.all.tags('IMG')(0); break;}}
  210. return elemImg;}
  211.  
  212. function callGlossary(){
  213.   //PREVENTS NAVIGATION ON HREF TAGS
  214.   event.returnValue = false;
  215.     //THIS SECTION SETS THE X AND Y COORDINATES OF THE POPUP BOX
  216.     if (PopUp_InAPopUp){
  217.         ieX = document.all.popUpWindow.style.left;
  218.         ieY = document.all.popUpWindow.style.top;}
  219.     else{
  220.         if (e.offsetParent.tagName.toLowerCase() == 'body'){
  221.             ieX = e.offsetLeft;
  222.             ieY = ((e.offsetTop) + (e.offsetHeight) + 1);}
  223.         else if (e.offsetParent.offsetParent.tagName.toLowerCase() == 'body'){
  224.             ieX = ((e.offsetLeft) + (e.offsetParent.offsetLeft));
  225.             ieY = ((e.offsetHeight) + (e.offsetTop) + (e.offsetParent.offsetTop) + (1));}
  226.         else if (e.offsetParent.offsetParent.offsetParent.tagName.toLowerCase() == 'body'){
  227.             ieX = ((e.offsetLeft) + (e.offsetParent.offsetLeft) + (e.offsetParent.offsetParent.offsetLeft));
  228.             ieY = ((e.offsetHeight) + (e.offsetTop) + (e.offsetParent.offsetTop) + (e.offsetParent.offsetParent.offsetTop) + (1));}
  229.         else{
  230.             ieX = window.event.clientX;
  231.             ieY = window.event.clientY + document.body.scrollTop;}}
  232.     //IF A POPUP WINDOW IS OPEN PAUSE AND THEN RESTART THIS PROCESS
  233.     if (popOpen){window.setTimeout('callGlossary()', 50);}
  234.     //IF THE USER DOESN'T HAVE IE4+ THIS SENDS A CUSTOM ERROR MESSAGE
  235.     if (!advanced){
  236.         alert (L_BrowserAlert_Message);
  237.         noPopupsMsg = true;
  238.         noPopups = false;}
  239.     //IF THE USER DOESN'T HAVE IE4+ THIS KILLS THE REST OF THE POPUP SCRIPT
  240.     if (noPopupsMsg){return;}
  241.     //IF IE4+ AND NO POPUP OPEN WE GO TO THE NEXT PART OF THE SCRIPT
  242.     if ((advanced) && (!popOpen)){iePopup();}
  243. return;}
  244.  
  245. function iePopup(){
  246.     //DETERMINE IF THE POPUP WILL BE OFFSCREEN AND FIX THIS
  247.      var rightlimit = ieX + document.all.popUpWindow.offsetWidth;
  248.     //IF IT'S OFF SCREEN THIS PART MOVES IT SO IT'S ON SCREEN
  249.     if (rightlimit >= document.body.clientWidth){ieX -= (rightlimit - document.body.clientWidth);}
  250.     //Set And Position PopUpWindow
  251.     document.all.popUpWindow.innerHTML = "";
  252.     document.all.popUpWindow.style.height = 0;
  253.     //TEST FOR XML VS TEXT FILE
  254.     if (xmlGloss){
  255.           // GET FORMATTED POPUP CONTENT OR NOT FOUND
  256.           xmlPopupContent = getXMLPopupContent(xmlTermRoot);
  257.           //LOAD THE POPUP WINDOW
  258.           document.all.popUpWindow.innerHTML = xmlPopupContent;
  259.           //LET THE POPUP FILL
  260.           window.setTimeout ('iePopHeight()', 0);
  261.           //SET POPUP WINDOWS X, Y COORDINATES
  262.           document.all.popUpWindow.style.top = ieY;
  263.           document.all.popUpWindow.style.left = ieX;
  264.           popOpen = true;
  265.         //PREVENT EVENT BUBBLING
  266.         return (false);}
  267.     else{
  268.     //IF THE GLOSSARY OBJECT EXISTS IT IS REMOVED FROM THE PAGE
  269.       if (document.tdcGloss){document.tdcGloss.outerHTML = "";}
  270.     //THIS PART BUILDS THE GLOSSARY OBJECT
  271.     var h = "";
  272.         h = h + "<OBJECT ID='tdcGloss' CLASSID='clsid:333C7BC4-460F-11D0-BC04-0080C7055A83' VIEWASTEXT>";
  273.         h = h + "<PARAM NAME='DataURL' VALUE='"+BeforeReference+"Basics/gloss.txt'>";
  274.            h = h + "<PARAM NAME='UseHeader' VALUE='True'>";
  275.            h = h + "<PARAM NAME='FieldDelim' VALUE=','>";
  276.            h = h + "<PARAM NAME='EscapeChar' VALUE='#'>";
  277.            h = h + "</OBJECT>";
  278.     //THIS PART ADDS THE OBJECT TO THE BOTTOM OF THE PAGE
  279.     document.body.insertAdjacentHTML('beforeEnd', h);
  280.     //IF THE GLOSSARY TERM LIVES IN THE GLOSSARY TEXT FILE GET IT
  281.     var CheckTermDef = tdcGloss.recordset;
  282.     CheckTermDef.moveFirst();
  283.     while (!CheckTermDef.EOF){
  284.         if ((TermDef.toLowerCase()) == (CheckTermDef.fields('Term').value.toLowerCase())){
  285.             specialCheck = true;
  286.             GoToWork();
  287.             break;} 
  288.         CheckTermDef.moveNext();}
  289.     //THIS PART PICKS UP AND STORES THE PROPER DEFINITION
  290.     function GoToWork(){
  291.         defContent = tdcGloss.recordset.fields('Definition').value;
  292.         //IF THERE ARE SEE ALSO'S THEY'RE PICKED UP AND THE HTML IS WRITTEN
  293.         if (tdcGloss.recordset.fields('SeeAlso').value){
  294.             if (tdcGloss.recordset.fields('SeeAlso').value.indexOf('~') != -1){
  295.                 ParseOtherDefs();}
  296.             else{
  297.                 var seeAlsoContent = "";
  298.                 seeAlsoContent = tdcGloss.recordset.fields('SeeAlso').value;
  299.                 document.all.popUpWindow.innerHTML = "<H5 CLASS='GLOSSARY_ITEM'>" +TermDef+ "</H5><P>" +defContent+ "</P><P ID='OtherDefs'><B>See Also: </B><A ID='In_PopuP' HREF='#'>" +seeAlsoContent+ "</A></P>";}}
  300.         else{
  301.             document.all.popUpWindow.innerHTML = "<H5 CLASS='GLOSSARY_ITEM'>" +TermDef+ "</H5><P>" +defContent+ "</P>";}
  302.  
  303.         //TIMEOUT ALLOWS POPUP CONTENT TO FILL AND THEN GET POPUP HEIGHT
  304.         window.setTimeout ('iePopHeight()', 0);}
  305.     //IF THE GLOSSARY DOESN'T CONTAIN THE TERM THIS ALERTS THE USER
  306.     if (!specialCheck){
  307.         document.all.popUpWindow.innerHTML = "<H5 CLASS='GLOSSARY_ITEM'>" +L_NoDefAlertTitle_Text+ "</H5><P>" +L_NoDefAlert_Text+ "</P>";
  308.     //TIMEOUT ALLOWS POPUP CONTENT TO FILL AND THEN GET POPUP HEIGHT
  309.     window.setTimeout ('iePopHeight()', 0);}
  310.     //THIS PART SETS THE X AND Y COORDS OF THE POPUP WINDOW
  311.     document.all.popUpWindow.style.top = ieY;
  312.     document.all.popUpWindow.style.left = ieX;
  313.     //NOW THIS VARIABLE IS SET TO TRUE BECAUSE THE POPUP IS READY
  314.     popOpen = true;
  315. //THIS KILLS THE BUBBLING OF THE EVENT
  316. return false;}}    // Ends the "else" of the "if" introduced above
  317.  
  318. function iePopHeight(){
  319.     var pageBottom = document.body.scrollTop + document.body.clientHeight;
  320.     var popHeight = document.all.popUpWindow.offsetHeight;
  321.     document.all.popUpWindow.style.height = popHeight - 2 * (parseInt(document.all.popUpWindow.style.borderWidth));
  322.     //IF THE POPUP IS LONGER THAN THE VISIBLE WINDOW IT WRITES IT AT COORDS 00**
  323.     if (popHeight + ieY >= pageBottom){
  324.         if (popHeight <= pageBottom){
  325.             document.all.popUpWindow.style.top = pageBottom - popHeight;}
  326.         else{document.all.popUpWindow.style.top = 0;}}
  327.     document.all.popUpWindow.style.visibility = "visible";
  328. return;}
  329.  
  330. function closeIE4(){
  331.     document.all.popUpWindow.style.visibility = "hidden";
  332.     popOpen = false;
  333.     resizeBan();  //also resize the non-scrolling banner
  334. return;}
  335.  
  336. function getXMLPopupContent(theXMLTermRoot){
  337.     var theXMLTerm, theXMLTermID;
  338.     var theEntry;
  339.     var theScopeDefs;
  340.     var theScopes;
  341.     var theDefinition;
  342.     var theSeeAlsos, seeAlsoID, seeAlsoTerm;
  343.     var theSeeEntry, seeID, seeTerm;
  344.     var outText;
  345.     var i, j, k, l, m;
  346.     var scopeFound;
  347.     var noDef = "<H5 CLASS='GLOSSARY_ITEM'>" + L_NoDefAlertTitle_Text + "</H5><P>" + L_NoDefAlert_Text + "</P>";
  348.     //CHECK THAT TERM ROOT EXISTS
  349.     if (theXMLTermRoot.length > 1){
  350.       theXMLTermID = theXMLTermRoot.substring(1, theXMLTermRoot.length);
  351.       i = theXMLTermID.indexOf(":");
  352.       if (i > 0){
  353.         theXMLTerm = theXMLTermID.substring(i+1, theXMLTermID.length);}
  354.       else{
  355.         return (noDef);}}
  356.     else{
  357.       return (noDef);}
  358.     //IF XML OBJECT MODEL NOT LOADED, LOAD IT
  359.     if (!xmlDOMLoaded){
  360.       xmlDOM = new ActiveXObject("Microsoft.XMLDOM");
  361.       //FORCE OBJECT TO FINISH LOADING XML FILE BEFORE RETURNING - NO ASYNCH
  362.       xmlDOM.async = false;
  363.       //FORCE XML * NOT * TO BE VALIDATED BY PARSER
  364.       xmlDOM.validateOnParse = false;
  365.       //LOAD XML INTO THE OBJECT MODEL
  366.       xmlDOM.load(xmlFile);
  367.       //SET UP FOR PERSISTENCE
  368.       xmlDOMLoaded = true;}
  369.     outText = noDef;
  370.     //GO TO ENTRY NODE FOR DESIRED TERM
  371.     theEntry = xmlDOM.nodeFromID(theXMLTerm);
  372.     if (theEntry != null){
  373.       //FOUND THE ENTRY, EXAMINE THE SCOPEDEFS
  374.       theScopeDefs = theEntry.selectNodes("scopeDef");
  375.       scopeFound = false;
  376.       for (i = 0; i < theScopeDefs.length && !scopeFound; i++){
  377.         theScopes = theScopeDefs(i).selectNodes("scope");
  378.         //CHECK FOR OUR SCOP IN THE SCOPEDEF
  379.         for (j = 0; j < theScopes.length; j++){
  380.           if (theScopes(j).attributes.getNamedItem("scopeTermID").text == theXMLTermID){
  381.           //FOUND SCOP IN ENTERY - GET AND FORMAT THE TERM AND DEF DATA
  382.             scopeFound = true;
  383.             outText = formatXMLTerm(theEntry.selectSingleNode("term").text);
  384.             if (theScopeDefs(i).selectSingleNode("def") != null){
  385.               theDefinition = formatXMLDef(theScopeDefs(i).selectSingleNode("def"));
  386.               outText = outText + theDefinition;
  387.               //FORMAT SEE ALSOS - IF ANY EXIST
  388.               theSeeAlsos = theScopeDefs(i).selectNodes("seeAlso");
  389.               seeAlsoID = "";
  390.               seeAlsoTerm = "";
  391.               for (k = 0; k < theSeeAlsos.length; k++){
  392.                 seeAlsoID = theSeeAlsos(k).attributes.getNamedItem("seeAlsoID").text;
  393.                 l = seeAlsoID.indexOf(":");
  394.                 if (l > 0){
  395.                   seeAlsoScope = seeAlsoID.substring(0, l + 1);
  396.                   seeAlsoID = seeAlsoID.substring(l + 1, seeAlsoID.length);}
  397.                 else
  398.                   seeAlsoScope = "";
  399.                 seeAlsoTerm = xmlDOM.nodeFromID(seeAlsoID).selectSingleNode("term").text;
  400.                 //IF K = 0 FORMAT FIRST SEE ALSO
  401.                 outText = outText + formatXMLSeeAlso(seeAlsoScope + seeAlsoID, seeAlsoTerm, (k == 0));}        
  402.               if (k > 0){
  403.                 //IF SEE ALSOS, ADD TRAILING PARAGRAPH MARK
  404.                 outText = outText + "</P>";}}
  405.             else{
  406.               theSeeEntry = theScopeDefs(i).selectSingleNode("seeEntry");
  407.               seeID = theSeeEntry.attributes.getNamedItem("seeID").text;
  408.               k = seeID.indexOf(":");
  409.               if (k > 0){
  410.                 seeScope = seeID.substring(0, k + 1);
  411.                 seeID = seeID.substring(k + 1, seeID.length);}
  412.               else
  413.                 seeScope = "";
  414.               seeTerm = xmlDOM.nodeFromID(seeID).selectSingleNode("term").text;
  415.               outText = outText + formatXMLSee(seeScope + seeID, seeTerm);}}}}}
  416.     else{
  417.       //TERM NOT FOUND - TELL USER WE DIDN'T TEST THIS TERM :)
  418.       outText = noDef;}
  419.       xmlTermRoot = "";    // Clean up the global
  420.       return (outText);}
  421.       // for debugging:  return ("XML -" + xmlTermRoot + "/" + theXMLTerm + "termText:" + termText + "defText:" + defText  + outText);
  422.  
  423. function formatXMLTerm(theTerm){
  424.     return ("<H5 CLASS='GLOSSARY_ITEM'>" + theTerm + "</H5>");}
  425.  
  426. function formatXMLDef(theDef){
  427.     var theParas;
  428.     var i;
  429.     var theDefOut;
  430.     theParas = theDef.selectNodes("para");
  431.     theDefOut = "";
  432.     for (i = 0; i < theParas.length; i++){
  433.       theDefOut = theDefOut + "<P CLASS='GLOSSARY_TEXT'>" + theParas(i).text + "</P>";}        
  434.     return (theDefOut);}
  435.  
  436. function formatXMLSee(theSeeTermID, theSeeTerm){
  437.   var theSeeText;
  438.  
  439.   theSeeText = "<A ID='In_PopuP' HREF='#" + theSeeTermID + "'>" + theSeeTerm + "</A>";
  440.   return ("<P ID='SeeDef'>" + L_See_Text + theSeeText);}
  441.  
  442. function formatXMLSeeAlso(theSeeAlsoTermID, theSeeAlsoTerm, bFirstOne){
  443.     var theSeeAlsoText;
  444.     theSeeAlsoText = "<A ID='In_PopuP' HREF='#" + theSeeAlsoTermID + "'>" + theSeeAlsoTerm + "</A>";
  445.     if (bFirstOne){ 
  446.       return ("<P ID='OtherDefs'>" + L_SeeAlso_Text + theSeeAlsoText);}
  447.     else{
  448.       return (", " + theSeeAlsoText);}}
  449.       
  450. function bodyOnLoad()
  451. {
  452.     if (advanced) {
  453.         var address = location.href;
  454.         var bookmarkStart = address.indexOf("#")
  455.         // If it has a bookmark, check to see if Language is near A Name
  456.         if (bookmarkStart>-1){
  457.             var bookmark = address.substring(bookmarkStart+1);
  458.             curLang = findLanguage(bookmark);
  459.         }
  460.         else {
  461.             // Check the context window for current language.
  462.             var cLang;
  463.             try{
  464.                 for (i=1; i< window.external.ContextAttributes.Count; i++){
  465.                     if(window.external.ContextAttributes(i).Name.toUpperCase()=="DEVLANG"){
  466.                         var b = window.external.ContextAttributes(i).Values.toArray();
  467.                         cLang = b[0].toUpperCase();
  468.                     }
  469.                 }
  470.             }
  471.             catch(e){}
  472.             if (cLang != null){
  473.                 if (cLang.indexOf("VB")!=-1) curLang = "Visual Basic";
  474.                 if (cLang.indexOf("VC")!=-1) curLang = "C++";
  475.                 if (cLang.indexOf("C#")!=-1) curLang = "C#";
  476.                 if (cLang.indexOf("JSCRIPT")!=-1) curLang = "JScript";
  477.                 if (cLang.indexOf("VBSCRIPT")!=-1) curLang = "VBScript";
  478.             }
  479.  
  480.             if (curLang == null){
  481.                 var l = ""
  482.                 // Check to see what the help filter is set to.
  483.                 try {l = window.external.Help.FilterQuery.toUpperCase();}
  484.                 catch(e){}
  485.                 if (l.indexOf("VB")!=-1) curLang = "Visual Basic";
  486.                 if (l.indexOf("VC")!=-1) curLang = "C++";
  487.                 if (l.indexOf("C#")!=-1) curLang = "C#";
  488.                 if (l.indexOf("JSCRIPT")!=-1) curLang = "JScript";
  489.                 if (l.indexOf("VBSCRIPT")!=-1) curLang = "VBScript";
  490.             }
  491.         }
  492.         if (curLang != null)
  493.             showAll = false;
  494.         initLangs();
  495.         resizeBan();
  496.         initReftips();
  497.         initSeeAlso();
  498.     }
  499.  
  500. finishOnLoad();
  501. }
  502.  
  503. function findLanguage(bookmark){
  504. // Find span associated with bookmark
  505.     var found = false
  506.     var aColl = document.all.tags("A");
  507.     for (i=0; i<aColl.length; i++){
  508.         if (aColl(i).name.toUpperCase()==bookmark.toUpperCase()){
  509.             var elem = null
  510.             for(t = 1; t<4; t++){
  511.                 elem = document.all(aColl(i).sourceIndex + t);
  512.                 if (elem.tagName.toUpperCase()=="SPAN")
  513.                     found = true;
  514.                     break;
  515.             }
  516.             break;
  517.         }
  518.     }
  519.  
  520. //if found, filter language
  521.     if (found){
  522.         var lang = elem.innerText
  523.         return lang.substring(lang.indexOf("[") + 1, lang.indexOf("]"));
  524.     }
  525. }
  526.  
  527. /*
  528.  * Language filtering
  529.  */
  530. function initLangs()
  531. {
  532.     var hdr = document.all.hdr;
  533.     if (!hdr)
  534.         return;
  535.  
  536.     var langs = new Array;
  537.     var spans = document.all.tags("SPAN");
  538.     if (spans) {
  539.         var iElem = spans.length;
  540.         for (iElem = 0; iElem < spans.length; iElem++) {
  541.             var elem = spans[iElem];
  542.             if (elem.className == "lang") {
  543.  
  544.                 // Update the array of unique language names.
  545.                 var a = elem.innerText.split(",");
  546.                 for (var iTok = 0; iTok < a.length; iTok++) {
  547.                     if (a[iTok]=="[A]"){
  548.                         langs[0]="A";
  549.                         elem.parentElement.outerText="";
  550.                     }
  551.                     var m = a[iTok].match(/([A-Za-z].*[A-Za-z+#])/);
  552.                     if (m) {
  553.                         var iLang = 0;
  554.                         while (iLang < langs.length && langs[iLang] < m[1])
  555.                             iLang++;
  556.                         if (iLang == langs.length || langs[iLang] != m[1]) {
  557.                             var before = langs.slice(0,iLang);
  558.                             var after = langs.slice(iLang);
  559.                             langs = before.concat(m[1]).concat(after);
  560.                         }
  561.                     }
  562.                 }
  563.             }
  564.         }
  565.     }
  566.  
  567.     if (langs.length > 0) {
  568.         var pres = document.all.tags("PRE");
  569.         if (pres) {
  570.             for (var iPre = 0; iPre < pres.length; iPre++)
  571.                 initPreElem(pres[iPre]);
  572.         }
  573.  
  574.         if (curLang == null){
  575.             var obj = document.all.obj_cook;
  576.             if (obj && obj.object) {
  577.                 cook = obj;
  578.                 var lang = obj.getValue("lang");
  579.                 var iLang = langs.length - 1;
  580.                 while (iLang && langs[iLang] != lang)
  581.                     iLang--;
  582.                 curLang = langs[iLang];
  583.                 if (obj.getValue("lang.all") != "1")
  584.                     showAll = false;
  585.             }
  586.         }
  587.  
  588.         var iLim = document.body.all.length;
  589.         var head = null;
  590.         for (var i = 0; i < iLim; i++) {
  591.             var elem = document.body.all[i];
  592.             if (elem.tagName.match(/^(P)|(PRE)|([DOU]L)$/))
  593.                 break;
  594.             if (elem.tagName.match(/^H[1-6]$/)) {
  595.                 head = elem;
  596.                 head.insertAdjacentHTML('BeforeEnd', '<SPAN CLASS=ilang></SPAN>');
  597.             }
  598.         }
  599.  
  600.         iLang = 0;
  601.         foundA = false;
  602.         while (iLang != langs.length){
  603.             if (langs[iLang]=="A")
  604.                 foundA = true;
  605.             iLang++;
  606.         }
  607.         if (!foundA)
  608.             // don't language button on
  609.             var td = hdr.insertCell(0);
  610.         if (td) {
  611.             // Localizable strings.
  612.             var L_Filter_Tip = "Language Filter";    // tooltip for language button
  613.             var L_Language = "Language";                // heading for menu of programming languages
  614.             var L_Show_All = "Show All";                // label for 'show all languages' menu item
  615.  
  616.             // Add the language button to the button bar.
  617.             td.className = "button1";
  618.             td.onclick = langMenu;
  619.             td.innerHTML = '<IMG SRC="' + baseUrl + 'Filter.gif' + '" ALT="' +
  620.                 L_Filter_Tip + '" BORDER=0>';
  621.  
  622.             // Add the menu.
  623.             var div = '<DIV ID="lang_menu" CLASS=langMenu><B>' + L_Language + '</B><UL>';
  624.             for (var i = 0; i < langs.length; i++)
  625.                 div += '<LI><A HREF="" ONCLICK="chooseLang(this)">' + langs[i] + '</A><BR>';
  626.             div += '<LI><A HREF="" ONCLICK="chooseAll()">' + L_Show_All + '</A></UL></DIV>';
  627.             document.body.insertAdjacentHTML('BeforeEnd', div);
  628.         }
  629.  
  630.         if (!showAll)
  631.             filterLang();
  632.     }
  633. }
  634.  
  635. function initPreElem(pre)
  636. {
  637.     var htm0 = pre.outerHTML;
  638.  
  639.     var reLang = /<span\b[^>]*class="?lang"?[^>]*>/i;
  640.     var iFirst = -1;
  641.     var iSecond = -1;
  642.  
  643.     iFirst = htm0.search(reLang);
  644.     if (iFirst >= 0) {
  645.         iPos = iFirst + 17;
  646.         iMatch = htm0.substr(iPos).search(reLang);
  647.         if (iMatch >= 0)
  648.             iSecond = iPos + iMatch;
  649.     }
  650.  
  651.     if (iSecond < 0) {
  652.         var htm1 = trimPreElem(htm0);
  653.         if (htm1 != htm0) {
  654.             pre.insertAdjacentHTML('AfterEnd', htm1);
  655.             pre.outerHTML = "";
  656.         }
  657.     }
  658.     else {
  659.         var rePairs = /<(\w+)\b[^>]*><\/\1>/gi;
  660.  
  661.         var substr1 = htm0.substring(0,iSecond);
  662.         var tags1 = substr1.replace(/>[^<>]+(<|$)/g, ">$1");
  663.         var open1 = tags1.replace(rePairs, "");
  664.         open1 = open1.replace(rePairs, "");
  665.  
  666.         var substr2 = htm0.substring(iSecond);
  667.         var tags2 = substr2.replace(/>[^<>]+</g, "><");
  668.         var open2 = tags2.replace(rePairs, "");
  669.         open2 = open2.replace(rePairs, "");
  670.  
  671.         pre.insertAdjacentHTML('AfterEnd', open1 + substr2);
  672.         pre.insertAdjacentHTML('AfterEnd', trimPreElem(substr1 + open2));
  673.         pre.outerHTML = "";
  674.     }    
  675. }
  676.  
  677. function trimPreElem(htm)
  678. {
  679.     return htm.replace(/[ \r\n]*((<\/[BI]>)*)[ \r\n]*<\/PRE>/g, "$1</PRE>").replace(
  680.         /\w*<\/SPAN>\w*((<[BI]>)*)\w*\r\n/g, "\r\n</SPAN>$1"
  681.         );
  682. }
  683.  
  684. function getBlock(elem)
  685. {
  686.     while (elem && elem.tagName.match(/^([BIUA]|(SPAN)|(CODE)|(TD))$/))
  687.         elem = elem.parentElement;
  688.     return elem;
  689. }
  690.  
  691. function langMenu()
  692. {
  693.     bodyOnClick();
  694.  
  695.     window.event.returnValue = false;
  696.     window.event.cancelBubble = true;
  697.  
  698.     var div = document.all.lang_menu;
  699.     var lnk = window.event.srcElement;
  700.     if (div && lnk) {
  701.         var x = lnk.offsetLeft + lnk.offsetWidth - div.offsetWidth;
  702.         div.style.pixelLeft = (x < 0) ? 0 : x;
  703.         div.style.pixelTop = lnk.offsetTop + lnk.offsetHeight;
  704.         div.style.visibility = "visible";
  705.     }
  706. }
  707.  
  708. function chooseLang(item)
  709. {
  710.     window.event.returnValue = false;
  711.     window.event.cancelBubble = true;
  712.  
  713.     if (item) {
  714.         closeMenu();
  715.         curLang = item.innerText;
  716.         showAll = false;
  717.     }
  718.  
  719.     if (cook) {
  720.         cook.putValue('lang', curLang);
  721.         cook.putValue('lang.all', '');
  722.     }
  723.  
  724.     filterLang();
  725. }
  726.  
  727. function chooseAll()
  728. {
  729.     window.event.returnValue = false;
  730.     window.event.cancelBubble = true;
  731.  
  732.     closeMenu();
  733.  
  734.     showAll = true;
  735.     if (cook)
  736.         cook.putValue('lang.all', '1');
  737.  
  738.     unfilterLang();
  739. }
  740.  
  741. function closeMenu()
  742. {
  743.     var div = document.all.lang_menu;
  744.     if (div && div.style.visibility != "hidden") {
  745.         var lnk = document.activeElement;
  746.         if (lnk && lnk.tagName == "A")
  747.             lnk.blur();
  748.  
  749.         div.style.visibility = "hidden";
  750.     }
  751. }
  752.  
  753. function getNext(elem)
  754. {
  755.     for (var i = elem.sourceIndex + 1; i < document.all.length; i++) {
  756.         var next = document.all[i];
  757.         if (!elem.contains(next))
  758.             return next;
  759.     }
  760.     return null;
  761. }
  762.  
  763. function filterMatch(text, name)
  764. {
  765.     var a = text.split(",");
  766.     for (var iTok = 0; iTok < a.length; iTok++) {
  767.         var m = a[iTok].match(/([A-Za-z].*[A-Za-z+#])/);
  768.         if (m && m[1] == name)
  769.             return true;
  770.     }
  771.     return false;
  772. }
  773.  
  774. function topicHeading(head)
  775. {
  776.     try{var iLim = nstext.children.length;
  777.     Section = nstext;}
  778.     catch(e){try{var iLim = scrtext.children.length;
  779.         Section = scrtext;}
  780.         catch(e){var iLim = document.body.children.length;
  781.         Section = document.body;
  782.         }
  783.     }
  784.     var idxLim = head.sourceIndex;
  785.     for (var i = 0; i < iLim; i++) {
  786.         var elem = Section.children[i];
  787.         if (elem.sourceIndex < idxLim) {
  788.             if (elem.tagName.match(/^(P)|(PRE)|([DOU]L)$/))
  789.                 return false;
  790.         }
  791.         else
  792.             break;
  793.     }
  794.     return true;
  795. }
  796.  
  797. function filterLang()
  798. {
  799.     var spans = document.all.tags("SPAN");
  800.     for (var i = 0; i < spans.length; i++) {
  801.         var elem = spans[i];
  802.         if (elem.className == "lang") {
  803.             var newVal = filterMatch(elem.innerText, curLang) ? "block" : "none";
  804.             var block = getBlock(elem);
  805.             block.style.display = newVal;
  806.             elem.style.display = "none";
  807.  
  808.             if (block.tagName == "DT") {
  809.                 var next = getNext(block);
  810.                 if (next && next.tagName == "DD")
  811.                     next.style.display = newVal;
  812.             }
  813.             else if (block.tagName == "DIV") {
  814.                 block.className = "filtered2";
  815.             }
  816.             else if (block.tagName.match(/^H[1-6]$/)) {
  817.                 if (topicHeading(block)) {
  818.                     if (newVal != "none") {
  819.                         var tag = null;
  820.                         if (block.children && block.children.length) {
  821.                             tag = block.children[block.children.length - 1];
  822.                             if (tag.className == "ilang") {
  823.                                 tag.innerHTML = (newVal == "block") ?
  824.                                     '  [' + curLang + ']' : "";
  825.                             }
  826.                         }
  827.                     }
  828.                 }
  829.                 else {
  830.                     var next = getNext(block);
  831.                     while (next && !next.tagName.match(/^(H[1-6])|(DIV)$/)) {
  832.                         next.style.display = newVal;
  833.                         next = getNext(next);
  834.                     }
  835.                 }
  836.             }
  837.         }
  838.         else if (elem.className == "ilang") {
  839.             var block = getBlock(elem);
  840.             if (block.tagName == "H1")
  841.                 elem.innerHTML = '  [' + curLang + ']';
  842.         }
  843.     }
  844.  
  845.     if (ie4) {
  846.         document.body.style.display = "none";
  847.         document.body.style.display = "block";
  848.     }
  849.     resizeBan();
  850. }
  851.  
  852. function unfilterLang(name)
  853. {
  854.     var spans = document.all.tags("SPAN");
  855.     for (var i = 0; i < spans.length; i++) {
  856.         var elem = spans[i];
  857.         if (elem.className == "lang") {
  858.             var block = getBlock(elem);
  859.             block.style.display = "block";
  860.             elem.style.display = "inline";
  861.  
  862.             if (block.tagName == "DT") {
  863.                 var next = getNext(block);
  864.                 if (next && next.tagName == "DD")
  865.                     next.style.display = "block";
  866.             }
  867.             else if (block.tagName == "DIV") {
  868.                 block.className = "filtered";
  869.             }
  870.             else if (block.tagName.match(/^H[1-6]$/)) {
  871.                 if (topicHeading(block)) {
  872.                     var tag = null;
  873.                     if (block.children && block.children.length) {
  874.                         tag = block.children[block.children.length - 1];
  875.                         if (tag && tag.className == "ilang")
  876.                             tag.innerHTML = "";
  877.                     }
  878.                 }
  879.                 else {
  880.                     var next = getNext(block);
  881.                     while (next && !next.tagName.match(/^(H[1-6])|(DIV)$/)) {
  882.                         next.style.display = "block";
  883.                         next = getNext(next);
  884.                     }
  885.                 }
  886.             }
  887.         }
  888.         else if (elem.className == "ilang") {
  889.             elem.innerHTML = "";
  890.         }
  891.     }
  892.     resizeBan();
  893. }
  894.  
  895.  
  896. /*
  897.  * Reftips (parameter popups)
  898.  */
  899. function initReftips()
  900. {
  901.     var DLs = document.all.tags("DL");
  902.     var PREs = document.all.tags("PRE");
  903.     if (DLs && PREs) {
  904.         var iDL = 0;
  905.         var iPRE = 0;
  906.         var iSyntax = -1;
  907.         for (var iPRE = 0; iPRE < PREs.length; iPRE++) {
  908.             if (PREs[iPRE].className == "syntax") {
  909.                 while (iDL < DLs.length && DLs[iDL].sourceIndex < PREs[iPRE].sourceIndex)
  910.                     iDL++;            
  911.                 if (iDL < DLs.length) {
  912.                     initSyntax(PREs[iPRE], DLs[iDL]);
  913.                     iSyntax = iPRE;
  914.                 }
  915.                 else
  916.                     break;
  917.             }
  918.         }
  919.  
  920.         if (iSyntax >= 0) {
  921.             var last = PREs[iSyntax];
  922.             last.insertAdjacentHTML(
  923.                 'AfterEnd',
  924.                 '<DIV ID=reftip CLASS=reftip STYLE="position:absolute;visibility:hidden;overflow:visible;"></DIV>'
  925.                 );
  926.         }
  927.     }
  928. }
  929.  
  930. function initSyntax(pre, dl)
  931. {
  932.     var strSyn = pre.outerHTML;
  933.     var ichStart = strSyn.indexOf('>', 0) + 1;
  934.     var terms = dl.children.tags("DT");
  935.     if (terms) {
  936.         for (var iTerm = 0; iTerm < terms.length; iTerm++) {
  937.             var words = terms[iTerm].innerText.replace(/\[.+\]/g, " ").replace(/,/g, " ").split(" ");
  938.             var htm = terms[iTerm].innerHTML;
  939.             for (var iWord = 0; iWord < words.length; iWord++) {
  940.                 var word = words[iWord];
  941.  
  942.                 if (word.length > 0 && htm.indexOf(word, 0) < 0)
  943.                     word = word.replace(/:.+/, "");
  944.  
  945.                 if (word.length > 0) {
  946.                     var ichMatch = findTerm(strSyn, ichStart, word);
  947.                     while (ichMatch > 0) {
  948.                         var strTag = '<A HREF="" ONCLICK="showTip(this)" CLASS="synParam">' + word + '</A>';
  949.  
  950.                         strSyn =
  951.                             strSyn.slice(0, ichMatch) +
  952.                             strTag +
  953.                             strSyn.slice(ichMatch + word.length);
  954.  
  955.                         ichMatch = findTerm(strSyn, ichMatch + strTag.length, word);
  956.                     }
  957.                 }
  958.             }
  959.         }
  960.     }
  961.  
  962.     // Replace the syntax block with our modified version.
  963.     pre.outerHTML = strSyn;
  964. }
  965.  
  966. function findTerm(strSyn, ichPos, strTerm)
  967. {
  968.     var ichMatch = strSyn.indexOf(strTerm, ichPos);
  969.     while (ichMatch >= 0) {
  970.         var prev = (ichMatch == 0) ? '\0' : strSyn.charAt(ichMatch - 1);
  971.         var next = strSyn.charAt(ichMatch + strTerm.length);
  972.         if (prev != '<' && !isalnum(prev) && !isalnum(next)) {
  973.             var ichComment = strSyn.indexOf("/*", ichPos);
  974.             while (ichComment >= 0) {
  975.                 if (ichComment > ichMatch) { 
  976.                     ichComment = -1;
  977.                     break; 
  978.                 }
  979.                 var ichEnd = strSyn.indexOf("*/", ichComment);
  980.                 if (ichEnd < 0 || ichEnd > ichMatch)
  981.                     break;
  982.                 ichComment = strSyn.indexOf("/*", ichEnd);
  983.             }
  984.             if (ichComment < 0) {
  985.                 ichComment = strSyn.indexOf("//", ichPos);
  986.                 while (ichComment >= 0) {
  987.                     if (ichComment > ichMatch) {
  988.                         ichComment = -1;
  989.                         break; 
  990.                     }
  991.                     var ichEnd = strSyn.indexOf("\n", ichComment);
  992.                     if (ichEnd < 0 || ichEnd > ichMatch)
  993.                         break;
  994.                     ichComment = strSyn.indexOf("//", ichEnd);
  995.                 }
  996.             }
  997.             if (ichComment < 0)
  998.                 break;
  999.         }
  1000.         ichMatch = strSyn.indexOf(strTerm, ichMatch + strTerm.length);
  1001.     }
  1002.     return ichMatch;
  1003. }
  1004.  
  1005. function isalnum(ch)
  1006. {
  1007.     return ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9') || (ch == '_') || (ch == '-'));
  1008. }
  1009.  
  1010. function showTip(link)
  1011. {
  1012.     bodyOnClick();
  1013.  
  1014.     var tip = document.all.reftip;
  1015.     if (!tip || !link)
  1016.         return;
  1017.  
  1018.     window.event.returnValue = false;
  1019.     window.event.cancelBubble = true;
  1020.  
  1021.     // Hide the tip if necessary and initialize its size.
  1022.     tip.style.visibility = "hidden";
  1023.     tip.style.pixelWidth = 260;
  1024.     tip.style.pixelHeight = 24;
  1025.  
  1026.     // Find the link target.
  1027.     var term = null;
  1028.     var def = null;
  1029.     var DLs = document.all.tags("DL");
  1030.     for (var iDL = 0; iDL < DLs.length; iDL++) {
  1031.         if (DLs[iDL].sourceIndex > link.sourceIndex) {
  1032.             var dl = DLs[iDL];
  1033.             var iMax = dl.children.length - 1;
  1034.             for (var iElem = 0; iElem < iMax; iElem++) {
  1035.                 var dt = dl.children[iElem];
  1036.                 if (dt.tagName == "DT" && dt.style.display != "none") {
  1037.                     if (findTerm(dt.innerText, 0, link.innerText) >= 0) {
  1038.                         var dd = dl.children[iElem + 1];
  1039.                         if (dd.tagName == "DD") {
  1040.                             term = dt;
  1041.                             def = dd;
  1042.                         }
  1043.                         break;
  1044.                     }
  1045.                 }
  1046.             }
  1047.             break;
  1048.         }
  1049.     }
  1050.  
  1051.     if (def) {
  1052.         window.linkElement = link;
  1053.         window.linkTarget = term;
  1054.         tip.innerHTML = '<DL><DT>' + term.innerHTML + '</DT><DD>' + def.innerHTML + '</DD></DL>';
  1055.         window.setTimeout("moveTip()", 0);
  1056.     }
  1057. }
  1058.  
  1059. function jumpParam()
  1060. {
  1061.     hideTip();
  1062.  
  1063.     window.linkTarget.scrollIntoView();
  1064.     document.body.scrollLeft = 0;
  1065.  
  1066.     flash(3);
  1067. }
  1068.  
  1069. function flash(c)
  1070. {
  1071.     window.linkTarget.style.background = (c & 1) ? "#CCCCCC" : "";
  1072.     if (c)
  1073.         window.setTimeout("flash(" + (c-1) + ")", 200);
  1074. }
  1075.  
  1076. function moveTip()
  1077. {
  1078.     var tip = document.all.reftip;
  1079.     var link = window.linkElement;
  1080.     if (!tip || !link)
  1081.         return; //error
  1082.  
  1083.     var w = tip.offsetWidth;
  1084.     var h = tip.offsetHeight;
  1085.  
  1086.     if (w > tip.style.pixelWidth) {
  1087.         tip.style.pixelWidth = w;
  1088.         window.setTimeout("moveTip()", 0);
  1089.         return;
  1090.     }
  1091.  
  1092.     var maxw = document.body.clientWidth;
  1093.     var maxh = document.body.clientHeight;
  1094.  
  1095.     if (h > maxh) {
  1096.         if (w < maxw) {
  1097.             w = w * 3 / 2;
  1098.             tip.style.pixelWidth = (w < maxw) ? w : maxw;
  1099.             window.setTimeout("moveTip()", 0);
  1100.             return;
  1101.         }
  1102.     }
  1103.  
  1104.     var x,y;
  1105.  
  1106.     var linkLeft = link.offsetLeft - document.body.scrollLeft;
  1107.     var linkRight = linkLeft + link.offsetWidth;
  1108.  
  1109.     var linkTop = link.offsetTop - document.body.scrollTop;
  1110.     var linkBottom = linkTop + link.offsetHeight;
  1111.  
  1112.     var cxMin = link.offsetWidth - 24;
  1113.     if (cxMin < 16)
  1114.         cxMin = 16;
  1115.  
  1116.     if (linkLeft + cxMin + w <= maxw) {
  1117.         x = maxw - w;
  1118.         if (x > linkRight + 8)
  1119.             x = linkRight + 8;
  1120.         y = maxh - h;
  1121.         if (y > linkTop)
  1122.             y = linkTop;
  1123.     }
  1124.     else if (linkBottom + h <= maxh) {
  1125.         x = maxw - w;
  1126.         if (x < 0)
  1127.             x = 0;
  1128.         y = linkBottom;
  1129.     }
  1130.     else if (w <= linkRight - cxMin) {
  1131.         x = linkLeft - w - 8;
  1132.         if (x < 0)
  1133.             x = 0;
  1134.         y = maxh - h;
  1135.         if (y > linkTop)
  1136.             y = linkTop;
  1137.     }
  1138.     else if (h <= linkTop) {
  1139.         x = maxw - w;
  1140.         if (x < 0)
  1141.             x = 0;
  1142.         y = linkTop - h;
  1143.     }
  1144.     else if (w >= maxw) {
  1145.         x = 0;
  1146.         y = linkBottom;
  1147.     }
  1148.     else {
  1149.         w = w * 3 / 2;
  1150.         tip.style.pixelWidth = (w < maxw) ? w : maxw;
  1151.         window.setTimeout("moveTip()", 0);
  1152.         return;
  1153.     }
  1154.     
  1155.     link.style.background = "#CCCCCC";
  1156.     tip.style.pixelLeft = x + document.body.scrollLeft;
  1157.     tip.style.pixelTop = y + document.body.scrollTop;
  1158.     tip.style.visibility = "visible";
  1159. }
  1160.  
  1161. function hideTip()
  1162. {
  1163.     if (window.linkElement) {
  1164.         window.linkElement.style.background = "";
  1165.         window.linkElement = null;
  1166.     }
  1167.  
  1168.     var tip = document.all.reftip;
  1169.     if (tip) {
  1170.         tip.style.visibility = "hidden";
  1171.         tip.innerHTML = "";
  1172.     }
  1173. }
  1174.  
  1175. function beginsWith(s1, s2)
  1176. {
  1177.     // Does s1 begin with s2?
  1178.     return s1.substring(0, s2.length) == s2;
  1179. }
  1180.  
  1181. /*
  1182.  * See Also popups
  1183.  */
  1184. function initSeeAlso()
  1185. {
  1186.     // Localizable strings.
  1187.     var L_See_Also = "See Also";
  1188.     var L_Requirements = "Requirements";
  1189.     var L_QuickInfo = "QuickInfo";
  1190.  
  1191.     var hdr = document.all.hdr;
  1192.     if (!hdr)
  1193.         return;
  1194.  
  1195.     var divS = new String;
  1196.     var divR = new String;
  1197.     var heads = document.all.tags("H4");
  1198.     if (heads) {
  1199.         for (var i = 0; i < heads.length; i++) {
  1200.             var head = heads[i];
  1201.             var txt = head.innerText;
  1202.             if (beginsWith(txt, L_See_Also)) {
  1203.                 divS += head.outerHTML;
  1204.                 var next = getNext(head);
  1205.                 while (next && !next.tagName.match(/^(H[1-4])|(DIV)$/)) {
  1206.                     divS += next.outerHTML;
  1207.                     next = getNext(next);
  1208.                 }
  1209.             }
  1210.             else if (beginsWith(txt, L_Requirements) || beginsWith(txt, L_QuickInfo)) {
  1211.                 divR += head.outerHTML;
  1212.                 var next = getNext(head);
  1213.                 var isValid = true;
  1214.                 while (isValid){
  1215.                     if (next && !next.tagName.match(/^(H[1-4])$/)){
  1216.                         if (next.tagName == "DIV" && next.outerHTML.indexOf("tablediv")==-1)
  1217.                                 isValid = false;
  1218.                         if (isValid){
  1219.                             divR += next.outerHTML;
  1220.                             next = getNext(next);
  1221.                         }
  1222.                     }
  1223.                     else
  1224.                         isValid = false;
  1225.                 }
  1226.             }
  1227.         }
  1228.     }
  1229.  
  1230.     var pos = getNext(hdr.parentElement);
  1231.     if (pos) {
  1232.         if (divR != "") {
  1233.             divR = '<DIV ID=rpop CLASS=sapop>' + divR + '</DIV>';
  1234.             var td = hdr.insertCell(0);
  1235.             if (td) {
  1236.                 td.className = "button1";
  1237.                 td.onclick = showRequirements;
  1238.                 td.innerHTML = '<IMG SRC="' + baseUrl + 'Requirements.gif' + '" ALT="' + L_Requirements + '" BORDER=0>';
  1239.                 if (advanced)
  1240.                     document.body.insertAdjacentHTML('AfterBegin', divR);
  1241.                 else
  1242.                     document.body.insertAdjacentHTML('BeforeEnd', divR);
  1243.             }
  1244.         }
  1245.         if (divS != "") {
  1246.             divS = '<DIV ID=sapop CLASS=sapop>' + divS + '</DIV>';
  1247.             var td = hdr.insertCell(0);
  1248.             if (td) {
  1249.                 td.className = "button1";
  1250.                 td.onclick = showSeeAlso;
  1251.                 td.innerHTML = '<IMG SRC="' + baseUrl + 'SeeAlso.gif' + '" ALT="' + L_See_Also + '" BORDER=0>';
  1252.                 if (advanced)
  1253.                     document.body.insertAdjacentHTML('AfterBegin', divS);
  1254.                 else
  1255.                     document.body.insertAdjacentHTML('BeforeEnd', divS);
  1256.             }
  1257.         }
  1258.     }
  1259. }
  1260.  
  1261. function showSeeAlso()
  1262. {
  1263.     bodyOnClick();
  1264.  
  1265.     window.event.returnValue = false;
  1266.     window.event.cancelBubble = true;
  1267.  
  1268.     var div = document.all.sapop;
  1269.     var lnk = window.event.srcElement;
  1270.  
  1271.     if (div && lnk) {
  1272.         div.style.pixelTop = lnk.offsetTop + lnk.offsetHeight;
  1273.         div.style.visibility = "visible";
  1274.     }
  1275. }
  1276.  
  1277. function showRequirements()
  1278. {
  1279.     bodyOnClick();
  1280.  
  1281.     window.event.returnValue = false;
  1282.     window.event.cancelBubble = true;
  1283.  
  1284.     var div = document.all.rpop;
  1285.     var lnk = window.event.srcElement;
  1286.  
  1287.     if (div && lnk) {
  1288.         div.style.pixelTop = lnk.offsetTop + lnk.offsetHeight;
  1289.         div.style.visibility = "visible";
  1290.     }
  1291. }
  1292.  
  1293. function hideSeeAlso()
  1294. {
  1295.     var div = document.all.sapop;
  1296.     if (div)
  1297.         div.style.visibility = "hidden";
  1298.  
  1299.     var div = document.all.rpop;
  1300.     if (div)
  1301.         div.style.visibility = "hidden";
  1302. }
  1303. //FIND AREA TO EXPAND/COLLAPSE
  1304. function GrabtheExpandDiv(e){
  1305. var theExpandDiv;
  1306.     for (var a = 0; a < 5; a++){
  1307.         var theTag = e.sourceIndex + e.children.length + a;
  1308.         theExpandDiv= document.all(theTag);
  1309.          if ((((theExpandDiv.tagName == 'DIV') || (theExpandDiv.tagName == 'SPAN')) && ((theExpandDiv.className.toLowerCase() == 'expand') || (theExpandDiv.className.toLowerCase() == 'expand2'))) || theTag == document.all.length){break;}}
  1310. return theExpandDiv;}
  1311.  
  1312. //ROLLOVERS'S AND EXPAND/COLLAPSE GET IMAGE
  1313. function getImage(){
  1314.  
  1315.     //DETERMINES IF A CLICK IS ON AN HREF TAG
  1316.     for (var a = 0; a < 5; a++){
  1317.           if ((e.tagName != 'A') && (e.parentElement != null)){e = e.parentElement;}
  1318.         var elemImg = e;
  1319.         if(elemImg.tagName == 'A'){elemImg = e.all.tags('IMG')(0); break;}}
  1320. return elemImg;}
  1321.  
  1322. //DO EXPAND/COLLAPSE
  1323. function callExpand(){
  1324.   e = window.event.srcElement;
  1325.  
  1326.   //PREVENTS NAVIGATION ON HREF TAGS
  1327.   event.returnValue = false;
  1328.  
  1329.     //FIND THE EXPAND/COLLAPSE PORTION AND ASCERTAIN BLOCK VS NONE
  1330.     var theDiv = GrabtheExpandDiv(e);
  1331.         
  1332.     //THIS PART WRITES THE PROPER IMAGE BESIDE THE TEXT
  1333.     if (theDiv.style.display == 'block'){
  1334.         var theImg = getImage(e);
  1335.         theImg.src = "coe.gif";
  1336.         theDiv.style.display = "none";}
  1337.     else {
  1338.         var theImg = getImage(e);
  1339.         theImg.src = "coc.gif";
  1340.         theDiv.style.display = "block";}
  1341. return;}
  1342.  
  1343. function callExpandAll(){
  1344.   e = window.event.srcElement;
  1345.   //PREVENTS NAVIGATION ON HREF TAGS
  1346.   event.returnValue = false;
  1347.     
  1348.     //Expand or Collapse?
  1349.     if (e.innerHTML.indexOf("Expand All") != -1){eOrC="block"}else{eOrC="none"}
  1350.     if (eOrC=="block"){
  1351.         e.innerHTML="<IMG CLASS='ExPand' SRC='coc.gif' HEIGHT='9' WIDTH='12' ALT='Expand/Collapse' BORDER='0'>Collapse All";}
  1352.     else{
  1353.         e.innerHTML="<IMG CLASS='ExPand' SRC='coe.gif' HEIGHT='9' WIDTH='12' ALT='Expand/Collapse' BORDER='0'>Expand All";}
  1354.       for (var a = 0; a < document.all.length; a++){ 
  1355.         e=document.all[a];
  1356.   
  1357.          if (e.id.indexOf('ExPand') != -1){
  1358.             if (e.id.indexOf('ExPandAll') == -1){
  1359.  
  1360.             var theDiv = GrabtheExpandDiv(e);
  1361.             if (eOrC == 'none'){
  1362.                 theImg = getImage(e);
  1363.                 theImg.src = "coe.gif";
  1364.                 theDiv.style.display = eOrC;}
  1365.             else {
  1366.                 theImg = getImage(e);
  1367.                 theImg.src = "coc.gif";
  1368.                 theDiv.style.display = eOrC;}
  1369.             }
  1370.         }
  1371.     }
  1372. return;}
  1373.  
  1374. function resizeBan(){
  1375. //resizes nonscrolling banner
  1376.  
  1377. var obanner= document.all.item("nsbanner");
  1378. var oText= document.all.item("nstext");
  1379. var obannerrow1 = document.all.item("bannerrow1");
  1380. var obannerrow2 = document.all.item("bannerrow2");
  1381.     if (obannerrow1 != null && obannerrow2 != null){
  1382.         var iScrollWidth = bodyID.scrollWidth;
  1383.         bannerrow1.style.marginRight = 0 - iScrollWidth;
  1384.         bannerrow2.style.marginRight = 0 - iScrollWidth;
  1385.     }
  1386.     if (oText ==null) return;
  1387.     if (obanner != null){
  1388.         //Uncomment the following 4 lines for slingshot
  1389.         //if (document.all.tags('iframe') !=null){
  1390.         //    document.body.scroll = "yes"
  1391.         //    return; 
  1392.         //}
  1393.         document.body.scroll = "no"
  1394.         document.all.nstext.style.overflow= "auto";
  1395.          document.all.nsbanner.style.width= document.body.offsetWidth-2;
  1396.         document.all.nstext.style.width= document.body.offsetWidth-4;
  1397.         document.all.nstext.style.top=0;  
  1398.         //The following line of code is temporary for slingshot support
  1399.         //Remove it before ship
  1400. //        if (document.all.tags('iframe') !=null) return;    
  1401.             //end temporary code  
  1402.         if (document.body.offsetHeight > document.all.nsbanner.offsetHeight)
  1403.                 document.all.nstext.style.height= document.body.offsetHeight - (document.all.nsbanner.offsetHeight+4) 
  1404.         else document.all.nstext.style.height=0
  1405.     }    
  1406.  
  1407.  
  1408. function set_to_print(){
  1409. //breaks out of divs to print
  1410.  
  1411.     var i;
  1412.  
  1413.     if (window.text)document.all.text.style.height = "auto";
  1414.             
  1415.     for (i=0; i < document.all.length; i++){
  1416.         if (document.all[i].tagName == "BODY") {
  1417.             document.all[i].scroll = "yes";
  1418.             }
  1419.         if (document.all[i].id == "nsbanner") {
  1420.             document.all[i].style.margin = "0px 0px 0px 0px";
  1421.             }
  1422.         if (document.all[i].id == "nstext") {
  1423.             document.all[i].style.overflow = "visible";
  1424.             document.all[i].style.top = "5px";
  1425.             document.all[i].style.width = "100%";
  1426.             document.all[i].style.padding = "0px 10px 0px 30px";
  1427.             }
  1428.         if (document.all[i].tagName == "A") {
  1429.             document.all[i].outerHTML = "<A HREF=''>" + document.all[i].innerHTML + "</a>";
  1430.             }
  1431.         }
  1432. }
  1433.  
  1434.  
  1435. function reset_form(){
  1436. //returns to the div nonscrolling region after print
  1437.  
  1438.      document.location.reload();
  1439.     
  1440. }
  1441.  
  1442. function writefeedbacklink(){
  1443.     //writes feedback link
  1444.     msdnid = arguments[0];
  1445.     contextid = arguments[1];
  1446.     topictitle = arguments[2];
  1447.     href = "http://testbetaweb2/vstudio/beta/feedback.asp?feedback=doc&msdnid="+msdnid+"&contextid="+contextid+"&topictitle="+topictitle;
  1448.     document.writeln("<a href="+href+">"+L_FeedbackLink+"</a>");
  1449. }
  1450.  
  1451. function writemessagelink(){
  1452.     //Writes jump to PSS web site redirector
  1453.     //code tbd
  1454.     //Use L_MessageLink variable from Localization Variables located at top of script.
  1455.     msdnid = arguments[0];
  1456.     href = "http://www.microsoft.com/contentredirect.asp?prd=vs&pver=7.0&id="+msdnid;
  1457.     document.writeln("<a href="+href+">"+L_MessageLink+"</a>");
  1458.  
  1459. }
  1460.  
  1461. function writemailtolink(){
  1462.     //writes feedback link
  1463.     emailalias = arguments[0];
  1464.     contextid = arguments[1];
  1465.     topictitle = arguments[2];
  1466.  
  1467.     href = "mailto:"+emailalias+"?subject=Feedback%20on%20topic%20-%20"+topictitle+",%20URL%20-%20"+contextid;
  1468. alert(href);
  1469.     document.writeln("<a href="+href+">Internal Feedback Link</a>");
  1470. }
  1471.