home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 2003 September / PC Answers September 2003.iso / Software / trial / MonitorIT 5.2.06 / monitorit_fullsetup.exe / data1.cab / Js / ReportTemplate.js < prev    next >
Encoding:
JavaScript  |  2003-06-24  |  37.2 KB  |  1,029 lines

  1. /* ======================================================================
  2. DESC: Common Alert Functions for the Administer/Analyze Operations
  3.  
  4. PLATFORMS: >= MS IE 4.0
  5.  
  6. USAGE NOTES: 
  7. ====================================================================== */
  8.  
  9. // Process Customize Template Button Press
  10. var savALMode = "";
  11. function processNewTemplateButton() {
  12.     savALMode = ALMode; // save current mode
  13.     PopUpContextOpen();
  14.     TemplateDef.style.display = "";
  15.     processObjectLookupRequest();
  16. }
  17. // Process Close Customize Template Button Press
  18. function processTemplateDoneButton() {
  19.     processTemplateResetButton();
  20.     TemplateDef.style.display = "none";
  21.     ALMode = savALMode; // restore current mode
  22.     PopUpContextClose();
  23.     if (ALMode == "New") {
  24.         processPopulateTemplateSelect();
  25.     }
  26.     else if (ALMode == "Edit") {
  27.         getSelectSaName_Desc(AR_RptStoreArr[(RptSelectIdx*ReportRecLength)+4]);
  28.         processPopulateTemplateSelect();
  29.     }
  30.     else if ( AR_RptSel.style.visibility != "hidden" ) {
  31.         AR_RptSel.focus(); 
  32.     }
  33. }
  34.  
  35. // Process Object Lookup
  36. var ObjectLUPreqd = true;
  37. var ObjectLupRecCount = 0;
  38. var LastObjectName = null;
  39. var CurObjName = "";
  40. function processObjectLookupRequest() {
  41.     if ( ObjectLUPreqd ) { // Need to Lookup Objects
  42.         ObjectLupRecCount = 0; // clear Lookup record counter
  43.         AL_OCStoreArr.length = 0;
  44.         if ( RpmCC_AL.ObjectLookupForObjCompArray("*") ) {
  45.             ALMode = "";
  46.             top.Rstatus.Pstat("Unable to start the Object LOOKUP request",true);
  47.         }
  48.         else {
  49.             ALMode = "ObjectLookup"; // set Mode of operation
  50.             top.Rstatus.Pstat("One moment while Object LOOKUP request completes");
  51.             return;
  52.         }
  53.     }
  54.     else {
  55.         processCustomInit();
  56.     }
  57. }
  58.  
  59. // Process Object Lookup Record Event 
  60. var ObjectRecLength = 6; // Object Lookup record length
  61. var AL_OCStoreArr = new Array();
  62. function processObjectLookup(ONme,ODesc,OCIdA) {
  63.     var onme = "", inme = "";
  64.     var warr0 = new Array(); var warr1 = new Array();
  65.     var i = ObjectLupRecCount * ObjectRecLength;
  66.     AL_OCStoreArr[i++] = ONme; 
  67.     AL_OCStoreArr[i++] = ODesc; 
  68.     AL_OCStoreArr[i++] = OCIdA;
  69.     AL_OCStoreArr[i++] = null;
  70.  
  71.     // Parse out Instance name from Object name
  72.     onme = ""; inme = "";
  73.     warr0 = ONme.split("{");
  74.     onme = warr0[0]; // Object name
  75.     if ( warr0.length == 2 ) {
  76.         warr1 = warr0[1].split("}");
  77.         inme = warr1[0]; // Instance name
  78.     }
  79.     else if ( warr0.length > 2  ) {
  80.         warr1 = warr0[2].split("}");
  81.         inme = warr0[1]+" {"+warr1[0]+"}";
  82.     }
  83.     AL_OCStoreArr[i++] = onme;
  84.     AL_OCStoreArr[i] = inme;
  85.  
  86.     ++ObjectLupRecCount; // bump record received counter
  87. }
  88.  
  89. function processObjectOpComplete() {
  90.     if (ObjectLupRecCount == 0) { // check if any Object records found
  91.         top.Rstatus.Pstat("No record matches found for Object LOOKUP request");    
  92.         alert("No Object/Counter data in the MonitorIT database\n -Install at least one MonitorIT Agent on a server you want to monitor\n -See `Configure Servers/Agents & Devices` to install an Agent");
  93.         processCustomInit();
  94.     }
  95.     else {
  96.         top.Rstatus.Pstat("Done");
  97.         // Get name of Last Object in Store
  98.         LastObjectName = AL_OCStoreArr[(ObjectLupRecCount-1)*ObjectRecLength];
  99.         ObjectLUPreqd = false;
  100.         TreeHTML = "";
  101.         processCustomInit();
  102.     }
  103. }
  104.  
  105. var CurTemplateStoreIdx = 0;
  106. function processCustomInit() {
  107.     AR_TemplateName.style.display = "none";
  108.    AR_TemplateSelect.selectedIndex = 0;
  109.     CurTemplateStoreIdx = 0;  
  110.     AR_TemplateSelect.style.display = "";    
  111.     if ( AR_SaStoreArr.length == 0 ) { // if no Templates
  112.         AL_CCOne.innerHTML = ""; // initialize
  113.         AL_CSelectStore.innerHTML = "";
  114.         if ( ObjectLUPreqd ) { // Need to Lookup Objects
  115.             SetButtonState(TNewButton,"1");
  116.         }
  117.         else {        
  118.             SetButtonState(TNewButton,"0");
  119.         }
  120.         SetButtonState(TEditButton,"1");
  121.         SetButtonState(TDeleteButton,"1");
  122.         SetButtonState(TUpdateButton,"1");
  123.         SetButtonState(TResetButton,"1");
  124.     }
  125.     else {
  126.         populateInputCustom(0);
  127.     }
  128. }
  129. function processTemplateSelect() {
  130.     var i = AR_TemplateSelect.selectedIndex * SaRecLth;
  131.    if ( i != CurTemplateStoreIdx ) {// if different from current
  132.         CurTemplateStoreIdx = i; // Set current selected Sa to just selected one
  133.         populateInputCustom(i);
  134.     }
  135. }
  136. function populateInputCustom(Cidx) {
  137.     AR_TemplateDesc.value = AR_SaStoreArr[Cidx+2];
  138.     if ( RpmCC_AL.CounterDictRecsByAnalysisID(AR_SaStoreArr[Cidx+1]) ) {
  139.         ALMode = "";
  140.         top.Rstatus.Pstat("Unable to start the Counter Dictionary Lookup request",true);
  141.     }
  142.     else {
  143.         ALMode = "CounterDictionaryLookup"; // set Mode of operation
  144.         top.Rstatus.Pstat("One moment while Counter Dictionary LOOKUP request completes");
  145.     }
  146. }
  147. var CdictArrEntryLength = 18; // size of a dictionary record
  148. var CounterParmsNumber = 10;
  149. var CdictArr = new Array();
  150. function processCounterDictionaryLookup(CdictStrg) {
  151. var DescParse = new Array();
  152.     if ( CdictStrg != "" ) {
  153.         CdictArr = CdictStrg.split("~");
  154.     }
  155.     AL_CCOne.innerHTML = ""; // initialize
  156.     AL_CSelectStore.innerHTML = "";
  157.       
  158.     FOps = "<table border='0' cellpadding='1' cellSpacing='1' width='100%'><tr>";
  159.     FOps += "<td width='36%' align='center' style='background-color:graytext;color:captiontext' class='optextb'>";
  160.     FOps += "Object" + "</td>";
  161.     FOps += "<td width='36%' align='center' style='background-color:graytext;color:captiontext' class='optextb'>";
  162.     FOps += "Counter" + "</td>";
  163.     FOps += "<td width='28%' align='center' style='background-color:graytext;color:captiontext' class='optextb'>";
  164.     FOps += "Dscription" + "</td>";
  165.     FOps += "</tr></table>";
  166.     AL_CCOne.insertAdjacentHTML("afterBegin",FOps);
  167.     for ( var i=1; i<CdictArr.length-1; i+=CdictArrEntryLength ) {
  168.         var OIname = CdictArr[i+3]+" "+CdictArr[i+5];
  169.         OIname = (OIname.length >= 28) ? OIname.substring(0,28)+"...." : OIname;
  170.         FOps = "<div>";
  171.         FOps += "<table border='0' cellpadding='1' cellSpacing='1' width='100%'><tr>";
  172.         FOps += "<td width='36%' class='optext' title='"+ CdictArr[i+3]+" "+CdictArr[i+5] +"'>";
  173.         FOps += OIname + "</td>";
  174.         FOps += "<td width='36%' class='optext'>";
  175.         FOps += CdictArr[i+4] + "</td>";
  176.         DescParse = CdictArr[i+16].split("'");
  177.         CdictArr[i+16] = DescParse.join("`");
  178.         FOps += "<td width='28%' class='optext' title='"+CdictArr[i+16]+"'>";
  179.         FOps += ( (CdictArr[i+16].length > 22) ? CdictArr[i+16].substring(0,22)+"...." : CdictArr[i+16])+"</td>";
  180.         FOps += "</tr></table></div>";
  181.         AL_CCOne.insertAdjacentHTML("beforeEnd",FOps);
  182.         addElementToSelect(AL_CSelectStore,OIname+"  -  "+CdictArr[i+4]);
  183.      }
  184.     if ( CurSelTab ==  "ParmTab" ) {
  185.         AR_ObjCSelect.innerHTML = "";
  186.         for (var i=0; i < AL_CSelectStore.length; ++i) {
  187.             addElementToSelect(AR_ObjCSelect,AL_CSelectStore.options[i].text);
  188.         }
  189.         AR_ObjCSelect.selectedIndex = 0;
  190.     }
  191.  
  192.     currCSelectIndex = 0;
  193.      processObjCSelect(); // go display parameters for 1st Object-Counter
  194.     if ( ObjectLUPreqd ) { // Need to Lookup Objects
  195.         SetButtonState(TNewButton,"1");
  196.     }
  197.     else {        
  198.         SetButtonState(TNewButton,"0");
  199.     }
  200.     var ix = AR_TemplateSelect.selectedIndex*SaRecLth; // index to current Template selected
  201.     if ( AR_SaStoreArr[ix+3] == OCXName ) { // if selected Template is a custome one, allow edit&delete
  202.         SetButtonState(TEditButton,"0");
  203.         SetButtonState(TDeleteButton,"0");
  204.     }
  205.     else { // other no edit/delet of shipping templates
  206.         SetButtonState(TEditButton,"1");
  207.         SetButtonState(TDeleteButton,"1");
  208.     }    
  209.     SetButtonState(TUpdateButton,"1");
  210.     SetButtonState(TResetButton,"1");
  211.     processGeneralClick(CounterTab);
  212.     AR_TemplateSelect.focus();
  213.     top.Rstatus.Pstat("Done");
  214.     AL_CCOne.style.overflow = (AL_CCOne.scrollHeight >= AL_CCOne.clientHeight) ? "scroll" : "";
  215. }
  216.  
  217. var prevCSelectIndex = -1;
  218. var currCSelectIndex = -1;
  219. var Oix = 0;
  220. var PrmObj = null;
  221. function processPreObjCSelect() {
  222.     currCSelectIndex = AR_ObjCSelect.selectedIndex;
  223.     processObjCSelect();
  224. }
  225.  
  226. function processObjCSelect() {
  227.     var warr = new Array;
  228.       if ( ALMode == "TNew" || ALMode == "TEdit" ) {
  229.           if ( prevCSelectIndex != -1 && prevCSelectIndex != currCSelectIndex ) { // save current new values
  230.             PrmObj.options[Oix+0].text = AR_Scale.value;
  231.             PrmObj.options[Oix+1].text = AR_SampleRate.value;
  232.             PrmObj.options[Oix+2].text = AR_AvgValue.value;
  233.             PrmObj.options[Oix+3].text = AR_MaxValue.value;
  234.             PrmObj.options[Oix+4].text = AR_Comment0.value;
  235.             PrmObj.options[Oix+5].text = AR_Comment1.value;
  236.             PrmObj.options[Oix+6].text = AR_Comment2.value;
  237.             PrmObj.options[Oix+7].text = AR_Comment3.value;
  238.             PrmObj.options[Oix+8].text = AR_Comment4.value;
  239.             PrmObj.options[Oix+9].text = AR_Comment5.value;
  240.         }
  241.         Oix = AR_ObjCSelect.options[currCSelectIndex].value;
  242.         warr = Oix.split("~"); // get Object and Counter indices
  243.         PrmObj = document.all["cparms"+warr[0]]
  244.         Oix = CounterParmsNumber * parseInt(warr[1],10);
  245.         AR_Scale.value = PrmObj.options[Oix+0].text;
  246.         AR_Scale.value = (AR_Scale.value == "") ? document.all[("cima"+warr[0]+"_"+warr[1])].defscale : AR_Scale.value;
  247.         AR_SampleRate.value = PrmObj.options[Oix+1].text;
  248.         AR_SampleRate.value = (AR_SampleRate.value == "" || AR_SampleRate.value == "0") ? "30" : AR_SampleRate.value;
  249.         AR_AvgValue.value = PrmObj.options[Oix+2].text;
  250.         AR_AvgValue.value = (AR_AvgValue.value == "") ? "0" : AR_AvgValue.value;
  251.         AR_MaxValue.value = PrmObj.options[Oix+3].text;
  252.         AR_MaxValue.value = (AR_MaxValue.value == "") ? "0" : AR_MaxValue.value;
  253.         AR_Comment0.value = AR_Comment0.title = PrmObj.options[Oix+4].text;
  254.         AR_Comment1.value = AR_Comment1.title = PrmObj.options[Oix+5].text;
  255.         AR_Comment2.value = AR_Comment2.title = PrmObj.options[Oix+6].text;
  256.         AR_Comment3.value = AR_Comment3.title = PrmObj.options[Oix+7].text;
  257.         AR_Comment4.value = AR_Comment4.title = PrmObj.options[Oix+8].text;
  258.         AR_Comment5.value = AR_Comment5.title = PrmObj.options[Oix+9].text;
  259.         prevCSelectIndex = AR_ObjCSelect.selectedIndex; // save as previous
  260.     }
  261.     else {
  262.         Oix = 1 + (CdictArrEntryLength * currCSelectIndex);
  263.         AR_Scale.value = CdictArr[Oix+17];
  264.         AR_SampleRate.value = CdictArr[Oix+6];
  265.         AR_AvgValue.value = AR_AvgValue.title = CdictArr[Oix+8];
  266.         AR_MaxValue.value = AR_MaxValue.title = CdictArr[Oix+9];
  267.         AR_Comment0.value = AR_Comment0.title = CdictArr[Oix+10];
  268.         AR_Comment1.value = AR_Comment1.title = CdictArr[Oix+11];
  269.         AR_Comment2.value = AR_Comment2.title = CdictArr[Oix+12];
  270.         AR_Comment3.value = AR_Comment3.title = CdictArr[Oix+13];
  271.         AR_Comment4.value = AR_Comment4.title = CdictArr[Oix+14];
  272.         AR_Comment5.value = AR_Comment5.title = CdictArr[Oix+15];
  273.     }
  274. }
  275.  
  276. /* Process Click on selected Tab */
  277. var CurSelTab = null; // current selected tab
  278. function processGeneralClick(th) {
  279.     CounterUI.style.display="none";
  280.     ParmUI.style.display="none";
  281.     CounterTab.className="TabUnsel";
  282.     ParmTab.className="TabUnsel";
  283.     th.className="TabSel";
  284.  
  285.     CurSelTab = th.id;
  286.     switch ( th.id ) {
  287.    case "CounterTab" : 
  288.       AR_ObjCSelect.style.display = "none";
  289.       CounterUI.style.display=""; // Enable this Tab's view
  290.         AL_CCOne.style.overflow = (AL_CCOne.scrollHeight >= AL_CCOne.clientHeight) ? "scroll" : "";
  291.       break;
  292.    case "ParmTab" : 
  293.        if ( ALMode == "TNew" || ALMode == "TEdit" ) {
  294.            if ( procCheckedCounterParms() != 0 ) {
  295.                  prevCSelectIndex = -1;
  296.                 currCSelectIndex = AR_ObjCSelect.selectedIndex;
  297.                   processObjCSelect();
  298.               }
  299.         }
  300.         else {
  301.             AR_ObjCSelect.innerHTML = "";
  302.             for (var i=0; i < AL_CSelectStore.length; ++i) {
  303.                 addElementToSelect(AR_ObjCSelect,AL_CSelectStore.options[i].text);
  304.             }
  305.             AR_ObjCSelect.selectedIndex = 0;
  306.         }
  307.        AR_ObjCSelect.style.display = "";
  308.           ParmUI.style.display = ""; // Enable this Tab's view
  309.        AR_ObjCSelect.focus();
  310.         AL_ParmTable.style.overflow = (AL_ParmTable.scrollHeight >= AL_ParmTable.clientHeight) ? "scroll" : "";
  311.       break;
  312.     }
  313. }
  314.  
  315. // Process New Template Button
  316. function processTemplateNewButton() {
  317.     ALMode = "TNew"; // Set Mode of operation
  318.     AR_TemplateName.value = ""; // clear Name field
  319.     AR_TemplateName.style.display = "";
  320.     AR_TemplateSelect.style.display = "none"
  321.     AR_TemplateDesc.value = ""; // clear Description field
  322.     AR_SampleRate.value = "30"; // prime Sample rate field
  323.  
  324.     commonTemplateNew_Edit(); // Do common processing
  325.     AR_TemplateName.focus();
  326. }            
  327. // Process Edit Template Button
  328. function processTemplateEditButton() {
  329.     ALMode = "TEdit"; // Set Mode of operation
  330.     AR_TemplateName.style.display = "";
  331.     AR_TemplateName.value = AR_TemplateSelect.options[AR_TemplateSelect.selectedIndex].text;
  332.     AR_TemplateSelect.style.display = "none";
  333.     commonTemplateNew_Edit(); // Do common processing
  334.     TEScdix = 1, TESobjix = 0; // init index
  335.     TESmode = true; // set mode
  336.     prevONIN = null;
  337.     SetCursor("wait");
  338.     top.banner.processStartComm();
  339.      PopUpMoment.style.display = "";
  340. }
  341. var TEScdix = 0; // CounterDictionary Array index
  342. var TESobjix = 0; // Object store index
  343. var TESmode = false;    
  344. var prevONIN = null; // previous Object+Instance name
  345. var TSid = null; 
  346. var ONo = null; // current Object 
  347. var OInme = ""; // current Object+Instance name
  348. function processTemplateEditSetup() {
  349.     TSid = null;
  350.     var onme = "", inme = "", ix = 0;
  351.     // Expand All Selected Objects and Check Associated Counters
  352.     for ( var i=TEScdix; i<CdictArr.length-1; i+=CdictArrEntryLength ) {
  353.         OInme = CdictArr[i+3]+CdictArr[i+5]; // Object+Instance name
  354.         if (  OInme == prevONIN ) {
  355.            continue; // get next
  356.        }
  357.        prevONIN = OInme; // save as previous
  358.        for ( var j=TESobjix; j<ObjectLupRecCount; j++ ) {
  359.            //ONo = document.all["oexp"+j]; // 
  360.            ix = j * ObjectRecLength;
  361.             onme = AL_OCStoreArr[ ix + 4];
  362.             inme = AL_OCStoreArr[ ix + 5];
  363.            //if ( OInme != ONo.objnme+ONo.instnme ) {
  364.            if ( OInme != onme+inme ) {
  365.                continue;
  366.            }
  367.            // go expand Object
  368.            goObjImgClick(document.all["oima"+j]);
  369.             TEScdix = i; // save current indices
  370.            TESobjix = j;
  371.               return;
  372.         }
  373.      }
  374.      TESmode = false;
  375.      PopUpMoment.style.display = "none";
  376.     SetCursor("auto");
  377.       top.banner.processStopCommX();
  378. }
  379. function processTemplateEditSetupCounter() {
  380.     TSid = null; // clear
  381.     var PmObj = null; var Oix = 0;
  382.     // For this Object/Counter entry in the CounterDictionary Array
  383.     for ( var i=TEScdix; i<CdictArr.length-1; i+=CdictArrEntryLength ) {
  384.         OInme = CdictArr[i+3]+CdictArr[i+5]; // Object+Instance name
  385.         if (  OInme != prevONIN ) { // if this Object name different than previous
  386.            break; // done counters for this expanded Object
  387.        }
  388.         // Find this Counter
  389.         for ( var k=0; k<ONo.cntrcount; k++ ) {
  390.             COb = document.all["cima"+TESobjix+"_"+k];
  391.             if ( COb.CntrNme == CdictArr[i+4] ) { // Counter found
  392.                 procCntrImgClick(COb); // go set Counter checked
  393.                 PmObj = document.all["cparms"+TESobjix]; // save parameters
  394.                 Oix = CounterParmsNumber * k;
  395.                 PmObj.options[Oix+0].text = CdictArr[i+17]; // Scale value
  396.                 PmObj.options[Oix+1].text = CdictArr[i+6]; // Sample Rate
  397.                 PmObj.options[Oix+2].text = CdictArr[i+8]; // Avg value
  398.                 PmObj.options[Oix+3].text = CdictArr[i+9]; // Max value
  399.                 PmObj.options[Oix+4].text = CdictArr[i+10]; // Comment0
  400.                 PmObj.options[Oix+5].text = CdictArr[i+11];
  401.                 PmObj.options[Oix+6].text = CdictArr[i+12];
  402.                 PmObj.options[Oix+7].text = CdictArr[i+13];
  403.                 PmObj.options[Oix+8].text = CdictArr[i+14];
  404.                 PmObj.options[Oix+9].text = CdictArr[i+15]; // Comment 6
  405.                 break;
  406.             }
  407.         }
  408.     }
  409.    TEScdix = i; // bump indices for next
  410.    ++TESobjix;
  411.     TSid = setTimeout("processTemplateEditSetup()",100); // go set the Objects and Counters selected
  412. }
  413.  
  414. function commonTemplateNew_Edit() { //Common processing for New and Edit
  415.     processGeneralClick(CounterTab); // set Counter Tab view
  416.     SetButtonState(TNewButton,"1");
  417.     SetButtonState(TEditButton,"1");
  418.     SetButtonState(TDeleteButton,"1");
  419.     SetButtonState(TUpdateButton,"0");
  420.     SetButtonState(TResetButton,"0");
  421.  
  422.     AR_ObjCSelect.innerHTML = "";
  423.     AR_ObjCSelect.className = "";
  424.     
  425.     AL_CCOne.innerHTML = "";
  426.     AL_CCOne.style.backgroundColor = "white";
  427.  
  428.     /* enable input fields */
  429.     AR_TemplateName.className = "";
  430.     AR_TemplateDesc.className = "";    
  431.  
  432.     AR_Scale.className = "";
  433.     AR_SampleRate.className = "";
  434.     AR_AvgValue.className = "";
  435.     AR_MaxValue.className = "";
  436.     AR_Comment0.className = "";
  437.     AR_Comment1.className = "";
  438.     AR_Comment2.className = "";
  439.     AR_Comment3.className = "";
  440.     AR_Comment4.className = "";
  441.     AR_Comment5.className = "";
  442.  
  443.     prevCSelectIndex = -1;
  444.     currCSelectIndex = -1;
  445.     PrmObj = null; // reset
  446.     
  447.     // Go display Object Tree view
  448.     OLUPindex = 0;
  449.     SetCursor("wait");
  450.     top.banner.processStartComm();
  451.     setOutTemplateHeader("Object : Counter Tree"); // define output table header    
  452.     processAATree();
  453. }
  454.  
  455. // Process Template Reset Button
  456. function processTemplateResetButton() {
  457.     ALMode = ""; // Reset Mode of operation
  458.  
  459.     AR_TemplateName.style.display = "none";
  460.     AR_TemplateSelect.style.display = ""
  461.     
  462.     AR_ObjCSelect.innerHTML = "";
  463.     AR_ObjCSelect.className = "idis";
  464.     
  465.     AL_CCOne.style.backgroundColor = "activeborder";
  466.  
  467.     /* enable input fields */
  468.     AR_TemplateDesc.className = "idis";    
  469.     AR_Scale.className = "idis";
  470.     AR_SampleRate.className = "idis";
  471.     AR_AvgValue.className = "idis";
  472.     AR_MaxValue.className = "idis";
  473.     AR_Comment0.className = "idis";
  474.     AR_Comment1.className = "idis";
  475.     AR_Comment2.className = "idis";
  476.     AR_Comment3.className = "idis";
  477.     AR_Comment4.className = "idis";
  478.     AR_Comment5.className = "idis";
  479.     
  480.     // Reset 
  481.     for ( var i=3, j=ObjectLupRecCount * ObjectRecLength; i<j; i+=ObjectRecLength ) {
  482.        AL_OCStoreArr[i] = null;
  483.     }
  484.  
  485.     if ( AR_SaStoreArr.length == 0 ) { // if no Templates
  486.         AL_CCOne.innerHTML = ""; // initialize
  487.         AL_CSelectStore.innerHTML = "";
  488.         if ( ObjectLUPreqd ) { // Need to Lookup Objects
  489.             SetButtonState(TNewButton,"1");
  490.         }
  491.         else {        
  492.             SetButtonState(TNewButton,"0");
  493.         }
  494.         SetButtonState(TEditButton,"1");
  495.         SetButtonState(TDeleteButton,"1");
  496.         SetButtonState(TUpdateButton,"1");
  497.         SetButtonState(TResetButton,"1");
  498.     }
  499.     else {
  500.         AR_TemplateDesc.value = AR_SaStoreArr[CurTemplateStoreIdx+2];
  501.         processCounterDictionaryLookup("");
  502.     }
  503. }
  504.  
  505. // Process template Update Button
  506. var OSSelect = "95,98,NTS4,NTS5,NTWS4,NTWS5";
  507. var OCXName = "MIAnalyze.MIAnalyze1Ctrl.1";    
  508. var SAaddStrg = "";
  509. var SADid = ""; // Template ID being deleted
  510. function processTemplateUpdateButton() {
  511.     if (AR_TemplateName.value.length == 0) { // if no name entered
  512.         top.Rstatus.Pstat("Please enter a Template name",true);        
  513.         alert("Please enter a Template name");        
  514.         AR_TemplateName.focus();
  515.         return;
  516.     }
  517.     if ( procCheckedCounterParms() == 0 ) {
  518.         top.Rstatus.Pstat("Please select at least one Counter",true);        
  519.         alert("Please select at least one Counter");        
  520.         return;
  521.     }
  522.     // Check if any parmeters entered 
  523.     if ( ALMode == "TNew" && PrmObj == null ) {
  524.         /*if ( !confirm("You have not defined parameters for any of the selected Counters.\n -Press OK to continue anyway\n -Press Cancel to stop and go back to add parameters") ) {
  525.             return;
  526.         }*/
  527.     }
  528.     else     if ( PrmObj != null ) { // make sure last parameters entered are saved
  529.         prevCSelectIndex = -2;
  530.         processPreObjCSelect();
  531.     }
  532.     SAaddStrg = AR_TemplateName.value+"~"+AR_TemplateDesc.value+"~"+OSSelect+"~"+OCXName+"~0~0~";
  533.     if (ALMode == "TNew") {
  534.         rstat = RpmCC_AL.SupportAnalysisAdd(SAaddStrg);
  535.     }
  536.     else { // "Edit" -  Delete then Add
  537.          SADid = AR_SaStoreArr[(AR_TemplateSelect.selectedIndex*SaRecLth)+1]; // ID
  538.         rstat = RpmCC_AL.SupportAnalysisDelete(SADid);
  539.         SAaddStrg += "~"+SADid;
  540.     }
  541.     if ( rstat ) { // if unable to initiate request        
  542.         top.Rstatus.Pstat("Unable to start the UPDATE request",true);
  543.         processTemplateResetButton();
  544.     }
  545.     else { // waiting for OperationCompleteEvent
  546.         ignoreDBChangeEvent = true;
  547.         top.Rstatus.Pstat("One moment while UPDATE request completes");
  548.     }
  549. }
  550. var SAAid = ""; // SupportAnalysis Template ID for last added record
  551. function processSupportAnalaysisAddOpComplete(AddResp) {
  552.     var warr = new Array();
  553.     warr = AddResp.split("~"); // parse response
  554.     if ( warr[1] == "OK" ) { // if successful
  555.         SAAid = warr[0]; // save ID for Template just added
  556.         processCounterDictionaryAdd(); // go add Counters to the dictionary
  557.         RIDadjIx = 0; // initialize index for ID adjustment
  558.         // Schedule Template ID adjust for this "Edited" one in existing Reports
  559.         TSid = setTimeout("processReportIDAdjustment()",10); 
  560.    }
  561.     else {
  562.         alert("Template Add Unsuccessful!\n"+AddResp);
  563.         processTemplateResetButton();
  564.     }
  565. }
  566. function processCounterDictionaryAdd() {
  567.     var OCix = "";    var ParmObj = null; var newSR = 15;
  568.     var warr = new Array(); var warr1 = new Array(); 
  569.     var onme = "", inme = "";
  570.     
  571.     // Build Counter dictionary add string
  572.     var CDAstrg = SAAid+"~"+OSSelect;
  573.     // Get paramerts for each selected Counter
  574.     for ( var i=0; i<AR_ObjCSelect.length; i++ ) {
  575.         OCix = AR_ObjCSelect.options[i].value;
  576.         warr = OCix.split("~"); // get Object and Counter indices
  577.         warr1 = AR_ObjCSelect.options[i].text.split("  -  "); // Split Object Name - CounterName
  578.         ParmObj = document.all["cparms"+warr[0]]
  579.         OCix = CounterParmsNumber * parseInt(warr[1],10);
  580.  
  581.         onme = AL_OCStoreArr[ (warr[0] * ObjectRecLength) + 4 ];
  582.         inme = AL_OCStoreArr[ (warr[0] * ObjectRecLength) + 5 ];
  583.         //CDAstrg += "~"+document.all["oexp"+warr[0]].objnme+"~"; // Object Name
  584.         CDAstrg += "~"+onme+"~"; // Object Name
  585.         CDAstrg += warr1[1]+"~"; // Counter Name
  586.         //CDAstrg += document.all["oexp"+warr[0]].instnme+"~"; // Instance Name
  587.         CDAstrg += inme+"~"; // Instance Name
  588.         newSR = ParmObj.options[OCix+1].text; // Sample Rate
  589.         newSR = (newSR == "0" || newSR == "") ? "30" : newSR; // Don't let Sample Rate = 0
  590.  
  591.         newScale = ParmObj.options[OCix+0].text;
  592.         newScale = (newScale == "") ? document.all[("cima"+warr[0]+"_"+warr[1])].defscale : newScale;
  593.         
  594.         CDAstrg += newSR+"~"; // Sample Rate
  595.         CDAstrg += "0~"; // Suggested Monitor Duration
  596.         CDAstrg += ParmObj.options[OCix+2].text+"~"; // Avg Value
  597.         CDAstrg += ParmObj.options[OCix+3].text+"~"; // Max value
  598.         CDAstrg += ParmObj.options[OCix+4].text+"~"; // Comment0
  599.         CDAstrg += ParmObj.options[OCix+5].text+"~"; // Comment1
  600.         CDAstrg += ParmObj.options[OCix+6].text+"~"; // Comment2
  601.         CDAstrg += ParmObj.options[OCix+7].text+"~"; // Comment3
  602.         CDAstrg += ParmObj.options[OCix+8].text+"~"; // Comment4
  603.         CDAstrg += ParmObj.options[OCix+9].text+"~"; // Comment5
  604.         CDAstrg += document.all["cimb"+warr[0]+"_"+warr[1]].title+"~"; // Description
  605.         CDAstrg += newScale; // Scale
  606.     }
  607.     rstat = RpmCC_AL.CounterDictionaryAdd(CDAstrg);
  608.     if ( rstat ) { // if unable to initiate request        
  609.         top.Rstatus.Pstat("Unable to start the UPDATE request",true);
  610.         processTemplateResetButton();
  611.     }
  612.     else { // waiting for OperationCompleteEvent
  613.         ignoreDBChangeEvent = true;
  614.         top.Rstatus.Pstat("One moment while UPDATE request completes");
  615.     }    
  616. }
  617. function processCounterDictionaryAddOpComplete(AddResp) {
  618.     var warr = new Array();
  619.     warr = AddResp.split("~"); // parse response
  620.     if ( warr[0] == "OK" ) { // if successful
  621.         processTSALookup("Add"); // go relookup the Templates
  622.    }
  623.     else {
  624.         alert("Template Counter Dictionary Add Unsuccessful!\n"+AddResp);
  625.         processTemplateResetButton();
  626.     }
  627. }
  628. function processTSALookup(Sarg) {
  629.     SALop = Sarg; // save last function type, Add or Delete
  630.     AR_SaStoreArr.length = 0; // clear
  631.     AR_TemplateSelect.innerHTML = ""; // reset
  632.     SALupRecCount = 0; // clear Lookup record counter
  633.     if ( RpmCC_AL.SupportAnalysisLookup("","") ) {
  634.         top.Rstatus.Pstat("Unable to start the Template LOOKUP request",true);
  635.         processTemplateResetButton();
  636.     }
  637.     else {
  638.         ALMode = "TLookupSA"; // set Mode of operation
  639.         top.Rstatus.Pstat("One moment while Template LOOKUP request completes");
  640.     }
  641. }
  642. var SALop = "";
  643. function    processTemplateLookupComplete() {
  644.     if (SALupRecCount == 0) { // check if any records found
  645.         top.Rstatus.Pstat("No record matches found for Template LOOKUP request",true);
  646.     }
  647.     else {
  648.         // look for Template just added
  649.         AR_TemplateSelect.selectedIndex = 0; // select 1st by default
  650.         if ( SALop == "Add" ) {
  651.             for ( var i=0; i<AR_TemplateSelect.length; i++ ) {
  652.                 if ( AR_TemplateSelect.options[i].text == AR_TemplateName.value ) {
  653.                     AR_TemplateSelect.selectedIndex = i; // select it
  654.                     break;
  655.                 }
  656.             }
  657.         }
  658.         CurTemplateStoreIdx = -1; // force a lookup
  659.         processTemplateSelect(); // display selected entry
  660.     }
  661.      processTemplateResetButton();
  662. }
  663.  
  664. // Process Template Delete Button
  665. function processTemplateDeleteButton() {
  666.     ALMode = "TDelete"; // Set Mode of operation
  667.     if ( !confirm("Are you sure you want to delete the Template named '"+AR_TemplateSelect.options[AR_TemplateSelect.selectedIndex].text+"'?\n -Press OK to Delete\n -Press Cancel to Stop") ) {
  668.          return;
  669.      }  
  670.      var TDid = AR_SaStoreArr[(AR_TemplateSelect.selectedIndex*SaRecLth)+1]; // ID
  671.     rstat = RpmCC_AL.SupportAnalysisDelete(TDid);
  672.     if ( rstat ) { // if unable to initiate request        
  673.         top.Rstatus.Pstat("Unable to start the DELETE request",true);
  674.         processTemplateResetButton();
  675.     }
  676.     else { // waiting for OperationCompleteEvent
  677.         ignoreDBChangeEvent = true;
  678.         top.Rstatus.Pstat("One moment while DELETE request completes");
  679.     }     
  680. }            
  681. function processSupportAnalysisDeleteOpComplete(DelResp) {
  682.     var warr = new Array();
  683.     warr = DelResp.split("~"); // parse response
  684.     if ( warr[1] == "OK" ) { // if successful
  685.         if (ALMode == "TEdit") { // If Edit, go do add
  686.             rstat = RpmCC_AL.SupportAnalysisAdd(SAaddStrg);
  687.             if ( rstat ) { // if unable to initiate request        
  688.                 top.Rstatus.Pstat("Unable to start the UPDATE request",true);
  689.                 processTemplateResetButton();
  690.             }
  691.             else { // waiting for OperationCompleteEvent
  692.                 ignoreDBChangeEvent = true;
  693.                 top.Rstatus.Pstat("One moment while UPDATE request completes");
  694.             }
  695.         }
  696.         else {
  697.             processTSALookup("Del"); // go relookup the Templates
  698.         }
  699.    }
  700.     else {
  701.         alert("Template Delete Unsuccessful!\n"+warr[1]);
  702.         processTemplateResetButton();
  703.     }
  704. }
  705. // Find Report Records with ID of Template Just Edited (Deleted then Re-Added) and Replace with The Added One
  706. var RIDadjIx = 0;
  707. function processReportIDAdjustment() {
  708.     TSid = null; // clear
  709.     for ( var i=RIDadjIx; i<AR_RptStoreArr.length; i+=ReportRecLength ) {
  710.         if ( AR_RptStoreArr[i+4] == SADid ) {
  711.             AR_RptStoreArr[i+4] = SAAid; // Update template ID in the Store & in the DB
  712.             rstat = RpmCC_AL.AdminReportsReplace(AR_RptStoreArr[i+1], // Report ID
  713.                        AR_RptStoreArr[i+0], // Report Name
  714.                           AR_RptStoreArr[i+2], // Report Desc
  715.                              SAAid, // ID of Newly Added Template
  716.                                AR_RptStoreArr[i+5]);
  717.             if ( rstat ) { // if unable to initiate request    
  718.                 continue; // if NG on this, check next    
  719.             }
  720.             else { // waiting for OperationCompleteEvent
  721.                 RIDadjIx = ++i; // save index
  722.                 ignoreDBChangeEvent = true;
  723.                 return; // do next on OpComplete
  724.             }
  725.         }
  726.     }
  727.     RIDadjIx = 0; // Clear/reset index/flag
  728. }
  729.  
  730. function getComputerName(Cid) {
  731.     for ( var i=0; i<AC_CompStoreArr.length; i+=CompRecLength ) {
  732.         if ( AC_CompStoreArr[i] == Cid ) {
  733.             return AC_CompStoreArr[i+2]; 
  734.         }
  735.     }
  736.     return "";
  737. }
  738.  
  739. // Process and Display the Object:Counter:Computer Tree
  740. var ALupMode = "";
  741. var OLUPindex = 0;
  742. var AATreeBusy = false;
  743. function processAATree() {
  744. var warr0 = new Array();
  745. var warr1 = new Array();
  746.     Tid = null; // clear timeout ID
  747.     AATreeBusy = true;
  748.     if ( AC_CompStoreArr.length == 0 ) {
  749.          processInitialLookup("DRCompLookup");
  750.          return;
  751.     }
  752.     AATreeBusy = true;
  753.     var i = OLUPindex; 
  754.     var j = i * ObjectRecLength;
  755.     var loopcount = 0;
  756.     for ( ; i<ObjectLupRecCount && loopcount < 25; loopcount++, i++, j+=ObjectRecLength) {
  757.         // Get description
  758.         Odsc = AL_OCStoreArr[j+1]; // get description
  759.         if ( Odsc.charAt(0) == "{" ) { // if instance
  760.             var k = j; // get/preserve Object index
  761.             while ( (k-=ObjectRecLength) >= 0 ) { // find decription for the instance
  762.                 if ( AL_OCStoreArr[k+1] == Odsc ) {
  763.                     continue; // if another instance
  764.                 }
  765.                 else {
  766.                     Odsc = AL_OCStoreArr[k+1];
  767.                     break;
  768.                 }                            
  769.             } // end While
  770.        }
  771.        
  772.        Odsc += "\n\nObject Available on Following Servers/Workstations:";
  773.        var carr = new Array(); var ocar = new Array(); var csortarr = new Array(); var ocid;        
  774.        carr = AL_OCStoreArr[j+2].split(";");       
  775.        for ( var n=0; n<carr.length; n++ ) {
  776.            ocar = carr[n].split(",");
  777.            csortarr[n] = getComputerName(ocar[1]).toUpperCase();   
  778.         }
  779.         csortarr.sort();
  780.        for ( var n=0, p=0; n<carr.length; n++ ) {
  781.            if ( csortarr[n] == "" ) 
  782.                continue;
  783.            if ( p%3 == 0 ) 
  784.                Odsc += "\n"+csortarr[n];   
  785.            else
  786.                Odsc += ",  "+csortarr[n]; 
  787.            ++p;           
  788.         }
  789.        
  790.         CCEs += "<table border='0' cellpadding='0' cellSpacing='0' width='550'>";
  791.         CCEs += "<tr title='" + Odsc + "'><td width='15'> </td>";
  792.         
  793.         if ( LastObjectName == AL_OCStoreArr[j] ) { // if last Object
  794.            Iprefx = "L";
  795.          }    
  796.         else {
  797.            Iprefx = "T";
  798.         }
  799.  
  800.           CCEs += "<td width='20' align='center'><img id='oima" + i + "' expanded='0' src='images/" + Iprefx + "plus.gif' style='cursor:hand' onclick='procObImgClick(this)' width='19' height='20'></td>";
  801.         CCEs += "<td width='20' align='center'><img id='oimb" + i + "' src='images/Objects.gif' style='cursor:hand' onclick='procObImgClick(this)' width='16' height='16'></td>";
  802.         // Parse out Instance name from Object name
  803.         //var onme = "", inme = "";
  804.         //warr0 = AL_OCStoreArr[j].split("{");
  805.         //onme = warr0[0]; // Object name
  806.         //if ( warr0.length == 2 ) {
  807.         //    warr1 = warr0[1].split("}");
  808.         //    inme = warr1[0]; // Instance name
  809.         //}
  810.         //else if ( warr0.length > 2  ) {
  811.         //    warr1 = warr0[2].split("}");
  812.         //    inme = warr0[1]+" {"+warr1[0]+"}";
  813.         //}
  814.         onme = AL_OCStoreArr[ (i * ObjectRecLength) + 4];
  815.         inme = AL_OCStoreArr[ (i * ObjectRecLength) + 5];
  816.         
  817.         CCEs += "<td width='495' class='optext'>" + onme+" "+inme + "</td>";
  818.         CCEs += "</tr></table>";
  819.         CCEs += "<div id='oexp" + i + "' objnme='"+onme+"' instnme='"+inme+"' cntrcount='0' cntrchkcount='0'></div>";
  820.          CCEs += "<select style='display:none' id='cparms" + i + "' init='0'></select>";
  821.      }
  822.     AL_CCOne.insertAdjacentHTML("beforeEnd",CCEs);
  823.     AL_CCOne.style.overflow = "scroll";
  824.     OLUPindex = i;
  825.     CCEs = "";
  826.     if ( i < ObjectLupRecCount ) { // not done
  827.         TSid = setTimeout("processAATree()",50); // delay 50 ms. then continue process Tree        
  828.         return;   
  829.     }
  830.     //Done
  831.     AATreeBusy = false;
  832.     if ( ALMode == "TEdit" ) {
  833.         TSid = setTimeout("processTemplateEditSetup()",50); // go set the Objects and Counters selected
  834.     }    
  835.     SetCursor("auto");
  836.       top.banner.processStopCommX();
  837. }
  838. /* Display Header for Service and Object:Counter Trees */
  839. function setOutTemplateHeader(Tstrg) {
  840.     CCEs = "<table border='0' cellpadding='0' cellSpacing='0' width='550'>";
  841.       CCEs += "<tr><td width='15'> </td><td width='20' height='20' align='center'><img src='images/topopen.gif' width='19' height='20'></td><td colspan='2' width='515' class='optextb'>" + Tstrg + "</td></tr></table>";
  842. }
  843.  
  844. /* Process Click to Expand or Contract an Object */
  845. function procObImgClick(OIm) {
  846.     if ( PopUpMoment.style.display == "" || AATreeBusy ) {
  847.         return; // ignore   
  848.     }
  849.     goObjImgClick(OIm);
  850. }
  851. function goObjImgClick(OIm) {
  852.     isx = OIm.id;  
  853.     if ( isx.charAt(0) != "o" || ALupMode != "") // if not a "oimaxx"
  854.                 return;
  855.     isx = isx.substring(4,isx.length); // Strip off storage index
  856.     cx = eval(isx); // Index for object
  857.     var WrkArr = new Array(); // working array
  858.     var OCWrkArr = new Array(); // working array
  859.  
  860.     CurObjIx = cx;
  861.     CurObjName = AL_OCStoreArr[cx*ObjectRecLength]; //Object Expanded
  862.     Oprfx = ( LastObjectName == CurObjName ) ? "L" : "T"; // Determine if last object
  863.     
  864.     var OObj = document.all["oima"+CurObjIx];
  865.     var EObj = document.all["oexp"+CurObjIx];
  866.     var CPObj = document.all["cparms"+CurObjIx];
  867.     // save Object that was "touched" by an Expand/Contract
  868.     AL_OCStoreArr[ (CurObjIx * ObjectRecLength) + 3 ] = EObj;
  869.  
  870.     if ( OObj.expanded == "1" ) { // if currently expanded
  871.         OObj.src = "images/" + Oprfx + "plus.gif";
  872.        OObj.expanded = "0"; // Set contracted
  873.         EObj.style.display = "none";
  874.     }
  875.     else { // otherwise Expand
  876.         OObj.src = "images/" + Oprfx + "minus.gif";
  877.        OObj.expanded = "1"; // Set expanded
  878.  
  879.         if ( CPObj.init == "0" ) { // if need to looked up counters
  880.             /* Lookup Counter Name and Description */
  881.             //CLOs = getObjIDArr(CurObjIx);
  882.             CCEs = ""; // initialize output string and counter
  883.             CurCntrIx = 0; 
  884.             var Wrk = new Array();
  885.             var OCA = AL_OCStoreArr[(ObjectRecLength*CurObjIx)+2].split(";"); //ObjID,CmpID 
  886.             Wrk = OCA[0].split(","); // get Object ID from pair of "ObjID,CompID"
  887.             if ( RpmCC_AL.CounterLookupForObjCntrArray("ObjectID,"+Wrk[0]) ) {
  888.                  ALupMode = "";
  889.                 top.Rstatus.Pstat("Unable to start the Counter LOOKUP request",true);
  890.             }
  891.              else {
  892.                 ALupMode = "CounterLookupEdit"; // set Mode of operation
  893.                 top.Rstatus.Pstat("One moment while Counter LOOKUP request completes");
  894.             }
  895.         }
  896.         else {
  897.             EObj.style.display = "";
  898.         }
  899.     }
  900. }
  901.  
  902. /* Compute an ObjectID string array from the ObjId,CompID array in the Store */
  903. //function getObjIDArr(COix) {
  904. //    var Wrk0 = new Array();
  905. //    var OCA = AL_OCStoreArr[(ObjectRecLength*COix)+2].split(";"); //ObjID,CmpID 
  906.     /* Compute Array of Computer IDs */
  907.     //var scid = ""; // Object ID Array
  908.     //var smax = --OCA.length; // adjust for null last entry
  909.     //for ( var i=0; i<smax; i++ ) {
  910.     //    Wrk0 = OCA[i].split(","); // get Object ID from pair of "ObjID,CompID"
  911.     //    if ( i > 0) {
  912.    //        scid += ","; // array id separator
  913.     //    }
  914.     //    scid += Wrk0[0];
  915.     //}
  916. //    Wrk0 = OCA[0].split(",");
  917. //    var scid = Wrk0[0];
  918. //    return scid;
  919. //}
  920.  
  921. function processCounterLookup(CntrNme,CntrDesc,OA) {
  922. var wrkarr = new Array();
  923. var wrkarr1 = new Array();
  924.     CCEs += "<table border='0' cellpadding='0' cellSpacing='0' width='550'>";
  925.     linG = (LastObjectName == CurObjName) ? "White" : "I";
  926.  
  927.     var CDs = CntrDesc.split("'"); // filter out single-quotes by convereting
  928.     CntrDesc = CDs.join("`");
  929.     wrkarr = OA.split(";"); // get typical default scale value for this Counter
  930.     wrkarr1 = wrkarr[0].split(",");
  931.     var defscale = (wrkarr1.length >= 3) ? wrkarr1[2] : "0";
  932.     CCEs += "<tr title='"+ CntrDesc + "'>";
  933.     CCEs += "<td width='15'> </td>"
  934.     CCEs += "<td width='20' height='20' align='center'><img src='images/" + linG + ".gif' width='19' height='20'></td>";
  935.     CCEs += "<td width='20' height='20' align='center'><img id='cima" + CurObjIx + "_" + CurCntrIx;
  936.     CCEs += "' src='images/Unchecked.gif' checked='0' CntrNme='"+ CntrNme;
  937.     CCEs += "' defscale='"+defscale+"' style='cursor:hand' onclick='procCntrImgClick(this)' width='9' height='9'></td>";
  938.     CCEs += "<td width='20' align='center'><img id='cimb" + CurObjIx + "_" + CurCntrIx + "' src='images/Counter.gif' style='cursor:hand' onclick='procCntrImgClick(this)' width='17' height='16' </td>";
  939.     CCEs += "<td width='474' class='optext'>" + CntrNme + "</td>";
  940.     CCEs += "</tr></table>";
  941.     ++CurCntrIx; // bump index
  942. }
  943.  
  944. /* Read of Counters complete; Output formatted Counters */
  945. function processCounterOpComplete() {
  946.     if ( CurCntrIx == 0 ) { // if no counters 
  947.         ALupMode = "";
  948.         top.Rstatus.Pstat("No Counters for this Object",true);
  949.         return;
  950.     }
  951.  
  952.     //EObj = document.all["oexp"+CurObjIx];
  953.     EObj = AL_OCStoreArr[ (CurObjIx * ObjectRecLength) + 3 ];
  954.     EObj.insertAdjacentHTML("AfterBegin",CCEs);
  955.     document.all["oima"+CurObjIx].scrollIntoView(true);
  956.     EObj.style.display = "";
  957.     EObj.cntrcount = CurCntrIx; // save count of counters
  958.     //refrCCOne = AL_CCOne.innerHTML; // refresh to elimninate blank line after expanded counters
  959.     //AL_CCOne.innerHTML = refrCCOne;
  960.     var CPObj = document.all["cparms"+CurObjIx];
  961.     if ( CPObj.init == "0" ) { // initilaize Counter parameter storage
  962.         var Pmax = CounterParmsNumber * CurCntrIx;
  963.         for ( var i=0; i<Pmax; i++ ) {
  964.              addElementToSelect(CPObj,"");
  965.         }
  966.         CPObj.init = "1";
  967.     }
  968.     ALupMode = "";
  969.     top.Rstatus.Pstat("Request Completed");
  970.     if ( TESmode ) { // if Template Edit Setup
  971.         ONo = EObj; // save object
  972.         TSid = setTimeout("processTemplateEditSetupCounter()",50); // get next Object expand
  973.     }
  974. }
  975.  
  976. /* Process Click to Check or Uncheck a Counter */
  977. function procCntrImgClick(CmpIm) {
  978.     isx = CmpIm.id;  
  979.     if ( isx.charAt(0) != "c") // if not a "cimaxx_yy"
  980.                 return;
  981.     var cx = isx.substring(4,isx.length); // Strip off index
  982.     lx = cx.lastIndexOf("_"); // derive suffix to the Object DIV ID
  983.     var dx = cx.substring(0,lx);
  984.     
  985.     CObj = document.all["cima"+cx]; // Clicked Counter Entry
  986.     //DObj = document.all["oexp"+dx]; // Associated Object    
  987.     DObj = AL_OCStoreArr[ (dx * ObjectRecLength) + 3 ];
  988.  
  989.     if ( CObj.checked == "1" ) { // if currently Checked, Uncheck
  990.         CObj.src = "images/Unchecked.gif";
  991.        CObj.checked = "0"; // Set Unchecked
  992.        --DObj.cntrchkcount; // decrement count of counters checked
  993.    }
  994.     else { // otherwise Check
  995.         CObj.src = "images/Checked.gif";
  996.        CObj.checked = "1"; // Set Checked
  997.           ++DObj.cntrchkcount; // increment count of computers checked
  998.     }
  999. }
  1000.  
  1001. function procCheckedCounterParms() {
  1002.     var POb = null, COb = null;
  1003.     var OIname = "";
  1004.     AR_ObjCSelect.innerHTML = "";
  1005.     for ( var i=0, k=0; i<ObjectLupRecCount; i++) {
  1006.         //POb = document.all["oexp"+i];
  1007.         POb = AL_OCStoreArr[ (i * ObjectRecLength) + 3 ];
  1008.         if ( POb == null ) {
  1009.             continue;
  1010.         }
  1011.         if ( POb.cntrchkcount > 0 ) {
  1012.             for ( var j=0, n=0; j<POb.cntrcount; j++ ) {
  1013.                 COb = document.all["cima"+i+"_"+j];
  1014.                 if ( COb.checked == "1" ) {
  1015.                     OIname = POb.objnme+" "+POb.instnme;
  1016.                     OIname = (OIname.length >= 28) ? OIname.substring(0,28)+"...." : OIname;
  1017.                     addElementToSelect(AR_ObjCSelect,OIname+"  -  "+COb.CntrNme);
  1018.                     AR_ObjCSelect.options[k++].value = i+"~"+j; // save Object and Counter Indices
  1019.                     if ( ++n >= POb.cntrchkcount) {
  1020.                         break; // stop if already found all the checked Counters for this Object
  1021.                     }
  1022.                 }
  1023.             }
  1024.         }
  1025.     }
  1026.     return k; // return number of checked counters
  1027. }
  1028.  
  1029.