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

91 lines
2.0 KiB

  1. var _iPrevious = -1;
  2. var _iCurrent = 0;
  3. function _ShowDescription(iNew)
  4. {
  5. if (iNew >= 0 && iNew <= idDesc.length)
  6. {
  7. if (_iCurrent != iNew)
  8. idDesc[_iCurrent].style.display = 'none';
  9. _iCurrent = iNew;
  10. idDesc[_iCurrent].style.display = 'block';
  11. }
  12. }
  13. function _OnClick()
  14. {
  15. var iNewType = this.parentElement.cellIndex;
  16. top.window.g_iNewType = iNewType;
  17. _ShowDescription(iNewType);
  18. idOK.disabled = (_iPrevious == iNewType);
  19. }
  20. function _OnFocus()
  21. {
  22. _ShowDescription(this.parentElement.cellIndex);
  23. }
  24. function _OnMouseOver()
  25. {
  26. if (!this.contains(event.fromElement))
  27. _ShowDescription(this.cellIndex);
  28. }
  29. function _OnMouseOut()
  30. {
  31. if (!this.contains(event.toElement))
  32. _ShowDescription(top.window.g_iNewType);
  33. }
  34. function AttachAccountTypeEvents(iPreviousType)
  35. {
  36. if (null != iPreviousType)
  37. _iPrevious = iPreviousType;
  38. var aTypes = idRadioGroup.children;
  39. if (aTypes)
  40. {
  41. var cTypes = aTypes.length;
  42. for (var i = 0; i < cTypes; i++)
  43. {
  44. aTypes[i].onmouseover = _OnMouseOver;
  45. aTypes[i].onmouseout = _OnMouseOut;
  46. aTypes[i].firstChild.onclick = _OnClick;
  47. aTypes[i].firstChild.onfocus = _OnFocus;
  48. }
  49. }
  50. }
  51. function SetAccountType(oUser)
  52. {
  53. var nErr = 0;
  54. try
  55. {
  56. var iNewType = top.window.g_iNewType;
  57. //alert("New account type = " + iNewType); // for debugging only
  58. if (_iPrevious != iNewType)
  59. oUser.setting("AccountType") = (0 == iNewType) ? 3 : 1;
  60. }
  61. catch (error)
  62. {
  63. nErr = (error.number & 0xffff);
  64. if (2220 == nErr) // NERR_GroupNotFound
  65. {
  66. // Show a message, but don't throw this error.
  67. // We want to navigate back to mainpage below.
  68. alert(top.window.L_GroupNotExist_ErrorMessage);
  69. }
  70. else
  71. {
  72. //alert("Error = " + nErr); // for debugging only
  73. throw error;
  74. }
  75. }
  76. top.window.g_iNewType = null;
  77. }