home *** CD-ROM | disk | FTP | other *** search
/ Practical Internet Web Designer 86 / PIWD86.iso / pc / contents / dreamweaver / software / dwmx2004.exe / Disk1 / data1.cab / Configuration_En / Commands / ServerObject-MenuProps.js < prev    next >
Encoding:
JavaScript  |  2003-09-05  |  19.9 KB  |  752 lines

  1.  
  2. // Copyright 2001, 2002, 2003 Macromedia, Inc. All rights reserved. 
  3.  
  4.  
  5. //************************GLOBALS**************************
  6.  
  7. var helpDoc = MM.HELP_soMenuProps;
  8.  
  9. var _MenuGrid;
  10. var _ManualLayer;
  11. var _DatabaseLayer;
  12. var _ColumnText;
  13. var _ColumnValue;
  14. var _DefaultManual;
  15. var _DefaultDatabase;
  16. var _PopulateRadio;
  17. var _ElemUp, _ElemDown, _ElemAdd, _ElemDel;
  18. var _RecordsetName = new RecordsetMenu("InsertRecord.htm","RecordsetName");
  19. var _MenuLabels = new RecordsetFieldMenu("InsertRecord.htm", "MenuLabels", "", "_RecordsetName");
  20. var _MenuValues = new RecordsetFieldMenu("InsertRecord.htm", "MenuValues", "", "_RecordsetName");
  21. var _BindDataButton;
  22. var SITE_DEFINED;
  23.  
  24. // The following variable is need by the UI.  Setting here,
  25. //  rather than changing the UI file.
  26. var TF_DEFAULT_DATABASE = "";
  27.  
  28. //********************API FUNCTIONS**************************
  29. //--------------------------------------------------------------------
  30. // FUNCTION:
  31. //   commandButtons
  32. //
  33. // DESCRIPTION:
  34. //   Returns the list of buttons which should appear on the right hand
  35. //   side of the dialog
  36. //
  37. // ARGUMENTS:
  38. //   none
  39. //
  40. // RETURNS:
  41. //   Array - pairs of button name and function call
  42. //--------------------------------------------------------------------
  43. function commandButtons()
  44. {
  45.  
  46.   return new Array(MM.BTN_OK,    "clickedOK()",
  47.                    MM.BTN_Cancel,"clickedCancel()",
  48.                    MM.BTN_Help, "displayHelp()"); 
  49. }
  50.  
  51.  
  52. //--------------------------------------------------------------------
  53. // FUNCTION:
  54. //   displayHelp
  55. //
  56. // DESCRIPTION:
  57. //   This function is called when the user clicks the HELP button
  58. //
  59. // ARGUMENTS:
  60. //   none
  61. //
  62. // RETURNS:
  63. //   nothing
  64. //--------------------------------------------------------------------
  65.  
  66. function displayHelp()
  67. {
  68.   dwscripts.displayDWHelp(helpDoc);
  69. }
  70.  
  71.  
  72. //******************LOCAL FUNCTIONS**************************
  73.  
  74. //--------------------------------------------------------------------
  75. // FUNCTION:
  76. //   clickedOK
  77. //
  78. // DESCRIPTION:
  79. //   This function is called when the user clicks OK
  80. //
  81. // ARGUMENTS:
  82. //   none
  83. //
  84. // RETURNS:
  85. //   nothing
  86. //--------------------------------------------------------------------
  87. function clickedOK()
  88. {
  89.   if (_ManualLayer.visibility == "visible")
  90.   { 
  91.     // static menu object created
  92.     var allRows = _MenuGrid.list, nRows = allRows.length, currRowText, dividerInd;
  93.     var textArr = new Array(),valArr = new Array();
  94.     var defaultVal = "";
  95.  
  96.     for (i=0;i<nRows;i++)
  97.     {
  98.       currRowText = allRows[i];
  99.       dividerInd = currRowText.indexOf("|");
  100.       textArr.push(currRowText.substring(0,dividerInd));
  101.       valArr.push(currRowText.substring(dividerInd +1));
  102.     }
  103.  
  104.     if (_DefaultManual){
  105.       defaultVal = _DefaultManual.value
  106.   }
  107.  
  108.     MM.commandReturnValue = new eoMenu(textArr,valArr,defaultVal);
  109.   }
  110.   else
  111.   { 
  112.     // dynamic menu object created
  113.     dynMenuObj = new eoDynamicMenu();
  114.     dynMenuObj.recordset = _RecordsetName.getValue();
  115.     dynMenuObj.textCol = _MenuLabels.getValue();
  116.     dynMenuObj.valCol = _MenuValues.getValue();
  117.     dynMenuObj.defaultSelected = (_DefaultDatabase)?_DefaultDatabase.value:"";
  118.  
  119.     MM.commandReturnValue = dynMenuObj;
  120.   }
  121.  
  122.   clearUI();
  123.   window.close();
  124. }
  125.  
  126.  
  127. function clearUI()
  128. {
  129.   _MenuGrid.setAllRows(new Array(),new Array());
  130.   _ColumnText.value = "";
  131.   _ColumnValue.value = "";
  132.   if (_DefaultManual)
  133.     _DefaultManual.value = ""; 
  134.   if (_DefaultDatabase)
  135.     _DefaultDatabase.value = "";
  136.  
  137.   _ManualLayer.visibility="hidden";
  138.   _DatabaseLayer.visibility="hidden";
  139. }
  140.  
  141. //--------------------------------------------------------------------
  142. // FUNCTION:
  143. //   clickedCancel
  144. //
  145. // DESCRIPTION:
  146. //   This function is called when CANCEL is clicked
  147. //
  148. // ARGUMENTS:
  149. //   none
  150. //
  151. // RETURNS:
  152. //   nothing
  153. //--------------------------------------------------------------------
  154. function clickedCancel()
  155. {
  156.   MM.commandReturnValue = "";
  157. //  dwscripts.findDOMObject("RecordsetName").selectedIndex = _RecordsetName.listControl.getIndex();
  158. //  dwscripts.findDOMObject("MenuLabels").selectedIndex = _MenuLabels.listControl.getIndex();
  159. //  dwscripts.findDOMObject("MenuValues").selectedIndex = _MenuValues.listControl.getIndex();    
  160.   clearUI();
  161.   window.close();
  162. }
  163.  
  164. //--------------------------------------------------------------------
  165. // FUNCTION:
  166. //   initializeUI
  167. //
  168. // DESCRIPTION:
  169. //   This function is called in the onLoad event.  It is responsible
  170. //   for initializing the UI.
  171. //
  172. // ARGUMENTS:
  173. //   none
  174. //
  175. // RETURNS:
  176. //   nothing
  177. //--------------------------------------------------------------------
  178. function initializeUI()
  179. {
  180.   // Some callers pass just the type, some pass an array w/ type and display name
  181.   var menuInfoObj = MM.commandArgument;
  182.   var serverModel = dw.getDocumentDOM().serverModel.getServerName();
  183.  
  184.   _ManualLayer   = document.layers["manualLayer"];
  185.   _DatabaseLayer = document.layers["databaseLayer"];
  186.  
  187.   _PopulateRadio = dwscripts.findDOMObject("Populate");
  188.   _MenuGrid = new TreeControlWithNavControls("MenuGrid",_ManualLayer,true);
  189.   _MenuGrid.setColumnNames(MM.LABEL_MenuGrid);
  190.  
  191.   _ColumnText = dwscripts.findDOMObject("MenuText",_ManualLayer);
  192.   _ColumnValue = dwscripts.findDOMObject("MenuValue",_ManualLayer);
  193.   _DefaultManual = dwscripts.findDOMObject("DefaultValueManual", _ManualLayer);
  194.  
  195.   var displayNameSpan = dwscripts.findDOMObject("RecordsetDisplayName", _DatabaseLayer);
  196.   displayNameSpan.innerHTML = dwscripts.getRecordsetDisplayName();
  197.  
  198.   _DefaultDatabase = dwscripts.findDOMObject("DefaultValueDatabase",_DatabaseLayer);
  199.   TF_DEFAULT_DATABASE = _DefaultDatabase;
  200.   _BindDataButton = dwscripts.findDOMObject("bindDynData");
  201.   
  202.  
  203.   if (dw.getSiteRoot() != ""){
  204.     _RecordsetName.initializeUI();
  205.     _MenuLabels.initializeUI();
  206.     _MenuValues.initializeUI();
  207.     _PopulateRadio[1].removeAttribute("disabled");
  208.     if (_DefaultManual && _BindDataButton){
  209.        _BindDataButton.removeAttribute("disabled");
  210.        _BindDataButton.setAttribute("src","../Shared/UltraDev/Images/Boltup.gif");
  211.     }
  212.     SITE_DEFINED = true;
  213.   }else{
  214.     dwscripts.findDOMObject('MenuValues',_DatabaseLayer).setAttribute("disabled","true");
  215.     dwscripts.findDOMObject('MenuLabels',_DatabaseLayer).setAttribute("disabled","true");
  216.     dwscripts.findDOMObject('RecordsetName',_DatabaseLayer).setAttribute("disabled","true");
  217.     _PopulateRadio[1].setAttribute("disabled","true");
  218.     if (_DefaultManual && _BindDataButton){
  219.        _BindDataButton.setAttribute("disabled","true");
  220.        _BindDataButton.setAttribute("src","../Shared/MM/Images/Bolt_dis.gif");
  221.     }
  222.     SITE_DEFINED = false;
  223.   }
  224.  
  225.   _ElemUp = dwscripts.findDOMObject("elemUp");
  226.   _ElemDown = dwscripts.findDOMObject("elemDown");
  227.   _ElemAdd = dwscripts.findDOMObject("elemAdd");
  228.   _ElemDel = dwscripts.findDOMObject("elemDel");
  229.  
  230.   if (menuInfoObj.type == "menu" )
  231.   { 
  232.     // if a static menu
  233.     initManualLayer();
  234.     showDifferentLayer("manual");
  235.     _PopulateRadio[0].checked = true;
  236.     if (menuInfoObj.textArr != "" || menuInfoObj.defaultSelected != "")
  237.     { 
  238.       if (serverModel == "Cold Fusion")
  239.       {
  240.         menuInfoObj.defaultSelected = dwscripts.stripCFOutputTags(menuInfoObj.defaultSelected);          
  241.       } 
  242.       else if (serverModel == "PHP") 
  243.       {
  244.         menuInfoObj.defaultSelected = dwscripts.stripScriptDelimiters(menuInfoObj.defaultSelected);       
  245.       }
  246.       else 
  247.       {
  248.         // other server models go here  
  249.       }
  250.  
  251.  
  252.       // if there are prior values
  253.       var nOptions = menuInfoObj.textArr.length,i;
  254.       var gridDisplayArr = new Array();
  255.       var textArr = menuInfoObj.textArr;
  256.       var valArr  = menuInfoObj.valArr;
  257.       for (i=0;i<nOptions;i++)
  258.       {
  259.         gridDisplayArr[i] = textArr[i] + "|";
  260.         if (valArr[i])
  261.           gridDisplayArr[i] += valArr[i];
  262.       }
  263.  
  264.       if (gridDisplayArr.length && gridDisplayArr.length > 0)
  265.       {
  266.         _MenuGrid.setAllRows(gridDisplayArr);
  267.         _MenuGrid.setRowIndex(0);
  268.         displayGridValues();
  269.       }
  270.  
  271.       _ColumnText.focus();
  272.       if (_ColumnText.value != "")
  273.         _ColumnText.select();
  274.       if (_DefaultManual)
  275.         _DefaultManual.value = menuInfoObj.defaultSelected;
  276.     }
  277. //    EnableDisableUpDownBtns();
  278. //    EnableDisableAddDelBtns();      
  279.   }
  280.   else if (SITE_DEFINED)
  281.   { 
  282.     // if a dynamic menu
  283.     _PopulateRadio[1].checked = true;
  284.     initDatabaseLayer();
  285.     showDifferentLayer('database');
  286.     if (menuInfoObj.recordset)
  287.     { 
  288.       _RecordsetName.pickValue(menuInfoObj.recordset);
  289.       updateColumns();
  290.       _MenuLabels.pickValue(menuInfoObj.textCol);
  291.       _MenuValues.pickValue(menuInfoObj.valCol);      
  292.       if (_DefaultDatabase)
  293.         _DefaultDatabase.value = menuInfoObj.defaultSelected;
  294.     }
  295.   }
  296. }
  297.  
  298.  
  299. //--------------------------------------------------------------------
  300. // FUNCTION:
  301. //   initDatabaseLayer
  302. //
  303. // DESCRIPTION:
  304. //   This function is called in the onLoad event.  It is responsible
  305. //   for initializing the UI.
  306. //
  307. // ARGUMENTS:
  308. //   none
  309. //
  310. // RETURNS:
  311. //   nothing
  312. //--------------------------------------------------------------------
  313. function initDatabaseLayer()
  314. {
  315.   updateColumns();
  316.   if (_DefaultDatabase)
  317.     _DefaultDatabase.value = "";
  318.   if (_DefaultManual && _DefaultDatabase && _DefaultManual.value != "")
  319.   {
  320.     _DefaultDatabase.value = _DefaultManual.value;
  321.   }
  322. }
  323.  
  324.  
  325. //--------------------------------------------------------------------
  326. // FUNCTION:
  327. //   addNewRow
  328. //
  329. // DESCRIPTION:
  330. //   This function is called in the onLoad event.  It is responsible
  331. //   for initializing the UI.
  332. //
  333. // ARGUMENTS:
  334. //   none
  335. //
  336. // RETURNS:
  337. //   nothing
  338. //--------------------------------------------------------------------
  339. function addNewRow()
  340. {
  341.   _MenuGrid.addRow(MM.LABEL_menuPropLabelPrefix + "|");
  342.   displayGridValues();
  343.   var newLabel = getUniqueLabel(MM.LABEL_menuPropLabelPrefix);
  344.   _ColumnText.value = newLabel;
  345.   updateGridRow();
  346.   _ColumnText.focus();
  347.   _ColumnText.select();
  348. //  EnableDisableUpDownBtns();
  349. //  EnableDisableAddDelBtns();   
  350. }
  351.  
  352. //--------------------------------------------------------------------
  353. // FUNCTION:
  354. //   delRow
  355. //
  356. // DESCRIPTION:
  357. //  This function deletes a row in the grid control.
  358. //
  359. // ARGUMENTS:
  360. //   none
  361. //
  362. // RETURNS:
  363. //   nothing
  364. //--------------------------------------------------------------------
  365. function delRow()
  366. {
  367.   _MenuGrid.delRow();
  368.   displayGridValues();
  369.   updateGridRow();  
  370. //  EnableDisableUpDownBtns();
  371. //  EnableDisableAddDelBtns();     
  372. }
  373.  
  374. //--------------------------------------------------------------------
  375. // FUNCTION:
  376. //   moveRowUp
  377. //
  378. // DESCRIPTION:
  379. //  This function moves the selected row up in the grid control.
  380. //
  381. // ARGUMENTS:
  382. //   none
  383. //
  384. // RETURNS:
  385. //   nothing
  386. //--------------------------------------------------------------------
  387. function moveRowUp()
  388. {
  389.   _MenuGrid.moveRowUp();
  390. //  EnableDisableUpDownBtns();
  391. //  EnableDisableAddDelBtns();       
  392. }
  393.  
  394. //--------------------------------------------------------------------
  395. // FUNCTION:
  396. //   moveRowDown
  397. //
  398. // DESCRIPTION:
  399. //  This function moves the selected row down in the grid control.
  400. //
  401. // ARGUMENTS:
  402. //   none
  403. //
  404. // RETURNS:
  405. //   nothing
  406. //--------------------------------------------------------------------
  407. function moveRowDown()
  408. {
  409.   _MenuGrid.moveRowDown();
  410. //  EnableDisableUpDownBtns();
  411. //  EnableDisableAddDelBtns();       
  412. }
  413.  
  414.  
  415. //--------------------------------------------------------------------
  416. // FUNCTION:
  417. //   initManualLayer
  418. //
  419. // DESCRIPTION:
  420. //   This function is called in the onLoad event.  It is responsible
  421. //   for initializing the UI.
  422. //
  423. // ARGUMENTS:
  424. //   none
  425. //
  426. // RETURNS:
  427. //   nothing
  428. //--------------------------------------------------------------------
  429. function initManualLayer()
  430. {
  431.   if (_MenuGrid.list.length == 0)
  432.   {
  433.     if (_DefaultManual)
  434.       _DefaultManual.value = "";
  435.     addNewRow();
  436.     _MenuGrid.setRowIndex(0);
  437. //    EnableDisableUpDownBtns();
  438. //    EnableDisableAddDelBtns();    
  439.   }
  440.   else
  441.   {
  442.     if (_MenuGrid.list.length == 1 && _MenuGrid.getRow() == "|")
  443.     {
  444.       _MenuGrid.setRow(" |");
  445.       _MenuGrid.setRowIndex(0);
  446.     }
  447.     _ColumnText.focus();
  448.     _ColumnText.select();
  449.   }
  450.  
  451.   if (_DefaultDatabase && _DefaultDatabase.value !="" && _DefaultManual)
  452.   {
  453.     _DefaultManual.value = _DefaultDatabase.value;
  454.   }
  455. }
  456.  
  457. //--------------------------------------------------------------------
  458. // FUNCTION:
  459. //   showDifferentLayer
  460. //
  461. // DESCRIPTION:
  462. //   This function is called in the onLoad event.  It is responsible
  463. //   for initializing the UI.
  464. //
  465. // ARGUMENTS:
  466. //   none
  467. //
  468. // RETURNS:
  469. //   nothing
  470. //--------------------------------------------------------------------
  471. function showDifferentLayer(whichOne)
  472. {
  473.   if (whichOne == 'database')
  474.   {
  475.     if (dwscripts.getRecordsetNames().length == 0)
  476.     {
  477.       alert (dwscripts.sprintf(MM.MSG_NeedRecordsetForOption, dwscripts.getRecordsetDisplayName()));
  478.       _PopulateRadio[0].checked = true;
  479.       return;
  480.     }
  481.     _ManualLayer.visibility   = "hidden";
  482.     _DatabaseLayer.visibility = "visible";
  483.     initDatabaseLayer();
  484.   }
  485.   else
  486.   {
  487.     _DatabaseLayer.visibility = "hidden";
  488.     _ManualLayer.visibility   = "visible";
  489.     initManualLayer();
  490.   }
  491.  
  492. }
  493.  
  494.  
  495. //--------------------------------------------------------------------
  496. // FUNCTION:
  497. //   updateGridRow
  498. //
  499. // DESCRIPTION:
  500. //   This function is called in the onLoad event.  It is responsible
  501. //   for initializing the UI.
  502. //
  503. // ARGUMENTS:
  504. //   none
  505. //
  506. // RETURNS:
  507. //   nothing
  508. //--------------------------------------------------------------------
  509. function updateGridRow()
  510. {
  511.   _MenuGrid.setRow(_ColumnText.value + "|" + _ColumnValue.value);
  512. }
  513.  
  514.  
  515. //--------------------------------------------------------------------
  516. // FUNCTION:
  517. //   displayGridValues
  518. //
  519. // DESCRIPTION:
  520. //   This function is called in the onLoad event.  It is responsible
  521. //   for initializing the UI.
  522. //
  523. // ARGUMENTS:
  524. //   none
  525. //
  526. // RETURNS:
  527. //   nothing
  528. //--------------------------------------------------------------------
  529. function displayGridValues()
  530. {
  531.   var currRow = _MenuGrid.getRow();
  532.   var dividerIndex = currRow.indexOf("|");
  533.   _ColumnText.value = currRow.substring( 0,dividerIndex);
  534.   _ColumnValue.value = currRow.substring(dividerIndex+1);
  535. //  EnableDisableUpDownBtns();
  536. //  EnableDisableAddDelBtns();   
  537. }
  538.  
  539.  
  540. //--------------------------------------------------------------------
  541. // FUNCTION:
  542. //   displayDynamicDataDialog
  543. //
  544. // DESCRIPTION:
  545. //   This function pops up the dialog allowing the user to choose 
  546. //   dynamic data
  547. //
  548. // ARGUMENTS:
  549. //   none
  550. //
  551. // RETURNS:
  552. //   nothing
  553. //--------------------------------------------------------------------
  554. function displayDynamicDataDialog(textFieldObj)
  555. {
  556.   var serverModel = dw.getDocumentDOM().serverModel.getServerName();
  557.   var expression = dw.showDynamicDataDialog(textFieldObj.value);
  558.  
  559.   if (expression)
  560.   {
  561.     if (serverModel == "Cold Fusion")
  562.     {
  563.       expression = dwscripts.stripCFOutputTags(expression);
  564.     }
  565.     textFieldObj.value = expression;
  566.   }
  567. }
  568.  
  569.  
  570. //--------------------------------------------------------------------
  571. // FUNCTION:
  572. //   updateColumns
  573. //
  574. // DESCRIPTION:
  575. //   This function pops up the dialog allowing the user to choose 
  576. //   dynamic data
  577. //
  578. // ARGUMENTS:
  579. //   none
  580. //
  581. // RETURNS:
  582. //   nothing
  583. //--------------------------------------------------------------------
  584. function updateColumns()
  585. {
  586.   _MenuLabels.updateUI();
  587.   _MenuValues.updateUI();   
  588. }
  589.  
  590.  
  591. //--------------------------------------------------------------------
  592. // FUNCTION:
  593. //   getUniqueLabel
  594. //
  595. // DESCRIPTION:
  596. //   This function pops up the dialog allowing the user to choose 
  597. //   dynamic data
  598. //
  599. // ARGUMENTS:
  600. //   none
  601. //
  602. // RETURNS:
  603. //   nothing
  604. //--------------------------------------------------------------------
  605. function getUniqueLabel()
  606. {
  607.   var label, i, num=1, isUnique;
  608.  
  609.   for (isUnique=false; !isUnique; num++)
  610.   {
  611.     label = TEXT_defaultItemText + num;
  612.     isUnique = true;
  613.     for (i=0; i<GarrMenuOptions.length && isUnique; i++)
  614.       if (GarrMenuOptions[i][0] == label) isUnique=false;
  615.   }
  616.   return label;
  617. }
  618.  
  619.  
  620. //--------------------------------------------------------------------
  621. // FUNCTION:
  622. //   getUniqueLabel
  623. //
  624. // DESCRIPTION:
  625. //   This function pops up the dialog allowing the user to choose 
  626. //   dynamic data
  627. //
  628. // ARGUMENTS:
  629. //   none
  630. //
  631. // RETURNS:
  632. //   nothing
  633. //--------------------------------------------------------------------
  634. function getUniqueLabel(baseName)
  635. {
  636.   var label, i, num=1, isUnique,rowText,menuLabel;
  637.  
  638.   for (isUnique=false; !isUnique; num++)
  639.   {
  640.     label = baseName + num; 
  641.     isUnique = true;
  642.     for (i=0; i<_MenuGrid.list.length && isUnique; i++)
  643.     {
  644.       rowText = _MenuGrid.list[i]; 
  645.       menuLabel = rowText.substring(0,rowText.indexOf("|"));
  646.       if (menuLabel == label) isUnique=false;
  647.     }
  648.   }
  649.   return label;
  650. }
  651.  
  652. //--------------------------------------------------------------------
  653. // FUNCTION:
  654. //   EnableDisableUpDownBtns
  655. //
  656. // DESCRIPTION:
  657. //   Enable/disables the elemUp and elemDown buttons
  658. //
  659. // ARGUMENTS:
  660. //   None
  661. //
  662. // RETURNS:
  663. //   Nothing
  664. //--------------------------------------------------------------------
  665. function EnableDisableUpDownBtns()
  666. {
  667.   // Check if there are any columns
  668.   if (_MenuGrid.list.length == 0 || _MenuGrid.getRowIndex() == -1)
  669.   {
  670.     _ElemUp.setAttribute("disabled", true);
  671.     _ElemUp.src = "../Shared/MM/Images/btnUp_dis.gif";   
  672.  
  673.     _ElemDown.setAttribute("disabled", true);
  674.     _ElemDown.src = "../Shared/MM/Images/btnDown_dis.gif";        
  675.   }
  676.   else
  677.   {
  678.     if(_MenuGrid.list.length == 1)
  679.       {
  680.       // first row, so disable the up and down buttons
  681.       _ElemDown.setAttribute("disabled", true);
  682.       _ElemDown.src = "../Shared/MM/Images/btnDown_dis.gif";
  683.  
  684.       _ElemUp.setAttribute("disabled", true);
  685.       _ElemUp.src = "../Shared/MM/Images/btnUp_dis.gif";
  686.     }
  687.     else if(_MenuGrid.list.length-1 == _MenuGrid.getRowIndex())
  688.     {
  689.       // last row, so disable the down button and enable the up button
  690.       _ElemDown.setAttribute("disabled", true);
  691.       _ElemDown.src = "../Shared/MM/Images/btnDown_dis.gif";
  692.  
  693.       _ElemUp.setAttribute("disabled", false);
  694.       _ElemUp.src = "../Shared/MM/Images/btnUp.gif";
  695.     }    
  696.     // first row, if it is disable up button and enable the down button
  697.     else if (_MenuGrid.getRowIndex() == 0)
  698.     {
  699.       _ElemUp.setAttribute("disabled", true);
  700.       _ElemUp.src = "../Shared/MM/Images/btnUp_dis.gif";
  701.  
  702.       _ElemDown.setAttribute("disabled", false);
  703.       _ElemDown.src = "../Shared/MM/Images/btnDown.gif";      
  704.     }
  705.     else
  706.     {
  707.       //enable both up and down buttons
  708.       _ElemDown.setAttribute("disabled", false);
  709.       _ElemDown.src = "../Shared/MM/Images/btnDown.gif";
  710.  
  711.       _ElemUp.setAttribute("disabled", false);
  712.       _ElemUp.src = "../Shared/MM/Images/btnUp.gif";      
  713.     }
  714.   }
  715. }
  716.  
  717.  
  718. //--------------------------------------------------------------------
  719. // FUNCTION:
  720. //   EnableDisableAddDelBtns
  721. //
  722. // DESCRIPTION:
  723. //   Enable/disables the elemAdd and elemDel buttons
  724. //
  725. // ARGUMENTS:
  726. //   None
  727. //
  728. // RETURNS:
  729. //   Nothing
  730. //--------------------------------------------------------------------
  731. function EnableDisableAddDelBtns()
  732. {
  733.   // if there is no selection, disable the del button and make sure you 
  734.   // enable the add button...
  735.   if (_MenuGrid.getRowIndex() == -1)
  736.   {
  737.     _ElemAdd.setAttribute("disabled", false);
  738.     _ElemAdd.src = "../Shared/MM/Images/btnAdd.gif";   
  739.  
  740.     _ElemDel.setAttribute("disabled", true);
  741.     _ElemDel.src = "../Shared/MM/Images/btnDel_dis.gif";        
  742.   }
  743.   else
  744.   {
  745.     _ElemAdd.setAttribute("disabled", false);
  746.     _ElemAdd.src = "../Shared/MM/Images/btnAdd.gif";   
  747.  
  748.     _ElemDel.setAttribute("disabled", false);
  749.     _ElemDel.src = "../Shared/MM/Images/btnDel.gif";          
  750.   }
  751. }
  752.