home *** CD-ROM | disk | FTP | other *** search
/ Chip 2009 July / Chip_2009.07_CD.iso / I386 / nusrmgr.cp_ / nusrmgr.cpl / HTML / CREATEPAGE2.JS < prev    next >
Encoding:
Text File  |  2008-04-14  |  1.5 KB  |  71 lines

  1. function PageInit()
  2. {
  3. top.window.PopulateLeftPane(null, idLearnAboutContent.innerHTML);
  4. AttachAccountTypeEvents();
  5. var iAccountType = 0;
  6. if (0 == top.window.CountOwners())
  7. {
  8. idLimited.disabled = true;
  9. idCantChange.style.display = 'block';
  10. }
  11. else if (null != top.window.g_iNewType)
  12. iAccountType = top.window.g_iNewType;
  13. var selection = idRadioGroup.children[iAccountType].firstChild;
  14. selection.click();
  15. selection.focus();
  16. }
  17. function CreateAccount()
  18. {
  19. var szName = top.window.g_szNewName;
  20. top.window.g_szNewName = null;
  21. if (szName && szName.length > 0)
  22. {
  23. var oNewUser = null;
  24. var szLoginName = szName;
  25. for (var n = 2; IsDuplicateLoginName(szLoginName); n++)
  26. szLoginName = szName + "_" + n;
  27. try
  28. {
  29. oNewUser = top.window.g_oUserList.create(szLoginName);
  30. if (szName != szLoginName && !IsDuplicateDisplayName(szName))
  31. oNewUser.setting("DisplayName") = szName;
  32. }
  33. catch (error)
  34. {
  35. top.window.g_szNewName = szName;
  36. if ((error.number & 0xffff) == 2202) 
  37. {
  38. alert(top.window.L_NameNotValid_ErrorMessage);
  39. top.window.g_Navigator.back();
  40. }
  41. else
  42. throw error;
  43. }
  44. if (oNewUser)
  45. {
  46. var nErr = 0;
  47. try
  48. {
  49. SetAccountType(oNewUser);
  50. }
  51. catch (error)
  52. {
  53. nErr = (error.number & 0xffff);
  54. if (1387 == nErr) 
  55. {
  56. top.window.g_oUserList.remove(oNewUser.setting("LoginName"), null);
  57. alert(top.window.L_NameIsComputer_ErrorMessage);
  58. top.window.g_szNewName = szName;
  59. top.window.g_Navigator.back();
  60. }
  61. else
  62. {
  63. throw error;
  64. }
  65. }
  66. if (0 == nErr)
  67. top.window.g_Navigator.navigate("mainpage2.htm", true);
  68. }
  69. }
  70. }
  71.