Leaked source code of windows server 2003
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.

3788 lines
103 KiB

  1. <HTML>
  2. <HEAD>
  3. <TITLE>Microsoft Out-of-Box Experience</TITLE>
  4. <META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  5. <LINK REL="stylesheet" TYPE="text/css" HREF="actsetup\aregstyl.css">
  6. <script language=jscript src="oobeutil.js"></script>
  7. <script language=jscript src="dialmgr.js"></script>
  8. <script language=jscript src="error.js"></script>
  9. <script language=jscript src="icsmgr.js"></script>
  10. <script language=jscript>
  11. // This is intended to hold all the script needed
  12. // in the default & offline OOBE HTML pages.
  13. //
  14. // We want to separate the layout (HTML) from the script.
  15. // At the same time, it's helpful to have all the code
  16. // in one place to make it easier to understand the flow
  17. // from page to page.
  18. // Status location constants
  19. var STATUS_MSN = 0;
  20. var STATUS_OEM = 1;
  21. var STATUS_NONE = 2;
  22. var STATUS_OFF = 3;
  23. var STATUS_MAX = 4;
  24. var SNDX_WELCOME = 0;
  25. var SNDX_MSN_ISP = 1;
  26. var SNDX_MSN_REG = 2;
  27. var SNDX_MSN_FINISH = 3;
  28. var SNDX_OEM_REG = 1;
  29. var SNDX_OEM_ISP = 2;
  30. var SNDX_OEM_FINISH = 3;
  31. var SNDX_NONE_REG = 1;
  32. var SNDX_NONE_FINISH = 2;
  33. var SNDX_OFF_EULA = 1;
  34. var SNDX_OFF_PID = 2;
  35. var SNDX_OFF_FINISH = 3;
  36. function CheckPoint(strURL, i1, i2, i3, i4)
  37. {
  38. this.strURL = strURL;
  39. this.rgindex = new Array(STATUS_MAX);
  40. this.rgindex[STATUS_MSN] = i1;
  41. this.rgindex[STATUS_OEM] = i2;
  42. this.rgindex[STATUS_NONE] = i3;
  43. this.rgindex[STATUS_OFF] = i4;
  44. }
  45. // Types of dialing using ISP files. e.g. Dial to registration, ISP, referral server
  46. var CONNECTED_REFFERAL = 1;
  47. var CONNECTED_ISP_SIGNUP = 2;
  48. var CONNECTED_ISP_MIGRATE = 3;
  49. var CONNECTED_REGISTRATION = 4;
  50. // Checkpoint constants
  51. var CKPT_ACTIV = 1;
  52. var CKPT_ACTDONE = 2;
  53. var CKPT_ACTIVERR = 3;
  54. var CKPT_ACTIVSVC = 4;
  55. var CKPT_REGISTER1 = 5;
  56. var CKPT_REGISTER3 = 6;
  57. var CKPT_ACTCONN = 7;
  58. var CKPT_ACTLAN = 8;
  59. var CKPT_REGDIAL = 9;
  60. var CKPT_ACT_MSG = 10;
  61. var CKPT_DONE = 11;
  62. var CKPT_MAX = 12; // ALWAYS set this to be the biggest value!
  63. var CKPT_ISPDIAL = CKPT_MAX;
  64. var CKPT_REFDIAL = CKPT_MAX;
  65. var CKPT_MIGDIAL = CKPT_MAX;
  66. var CKPT_ISPSIGNUP = CKPT_DONE;
  67. var dnCKPT = new Array(CKPT_MAX);
  68. // Checkpoint breadcrumbs
  69. var g_CurrentCKPT = null;
  70. var g_DialCKPT = null;
  71. var HKEY_LOCAL_MACHINE = 0x80000002;
  72. var OOBE_MAIN_REG_KEY = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\OOBE";
  73. var CKPT_REG_KEY = "\\CKPT";
  74. var TOS_REG_VALUE = "TOS";
  75. // CheckDialReady errors
  76. var ERR_COMM_NO_ERROR = 0;
  77. var ERR_COMM_OOBE_COMP_MISSING = 1;
  78. var ERR_COMM_UNKNOWN = 2; // Unknow error, check input parameters
  79. var ERR_COMM_NOMODEM = 3; // There is no modem installed
  80. var ERR_COMM_RAS_TCP_NOTINSTALL = 4;
  81. var ERR_COMM_ISDN = 5;
  82. var ERR_COMM_PHONE_AND_ISDN = 6;
  83. // Dialing errors. Look at raserror.h for details
  84. var DERR_DIALTONE = 680;
  85. var DERR_BUSY = 676;
  86. var DERR_VOICEANSWER = 677;
  87. var DERR_NOANSWER = 678;
  88. var DERR_NO_CARRIER = 679;
  89. var DERR_HARDWARE_FAILURE = 630; // modem turned off
  90. var DERR_PORT_ALREADY_OPEN = 602; // procomm/hypertrm/RAS has COM port
  91. var DERR_PORT_OR_DEVICE = 692; // got this when hypertrm had the device open -- jmazner
  92. var DERR_PPP_TIMEOUT = 718;
  93. var DERR_REMOTE_DISCONNECT = 629; // Connection interrupted
  94. // Finish errors
  95. var FINISH_OK = 0x00000000;
  96. var FINISH_REBOOT = 0x00000001;
  97. var FINISH_BAD_PID = 0x00000002;
  98. var FINISH_BAD_EULA = 0x00000004;
  99. var FINISH_BAD_STAMP = 0x00000008;
  100. // keycode consts
  101. var KeyEsc = 0x1B;
  102. var KeyEnter = 0xD;
  103. var KeyBackSpc = 0x8;
  104. var KeyDelete = 0x2E;
  105. var KeyTab = 0x9;
  106. var KeyDwnArrow = 0x28;
  107. var KeyUpArrow = 0x26;
  108. var KeyLeftArrow = 0x25;
  109. var KeyRightArrow = 0x27;
  110. // Language reboot return codes
  111. var LANGUAGE_REBOOT_NEVER = 0;
  112. var LANGUAGE_REBOOT_NOW = 1;
  113. var LANGUAGE_REBOOT_END = 2;
  114. // on-the-fly button hiding
  115. var HIDE_BACK = 0x0001;
  116. var HIDE_NEXT = 0x0002;
  117. var HIDE_CANCEL = 0x0004;
  118. var HIDE_RESTORE = 0x0008;
  119. // BUGBUG temp GUIDs
  120. var NOLAUNCHISPSIGNUP = "{C37D92A5-CA34-11d2-B71C-00C04F794977}";
  121. var MSNCOMPLETED = "{1C0A22F2-CB6B-11d2-B544-00A0C949DA70}";
  122. // window.external object caches
  123. var TapiObj = null;
  124. var InfoObj = null;
  125. var EulaObj = null;
  126. var LangObj = null;
  127. var PidObj = null;
  128. var StatusObj = null;
  129. var DirObj = null;
  130. var ApiObj = null;
  131. var RegisterObj = null;
  132. // general globals and status
  133. var g_strISPFile = "";
  134. var g_bStartup;
  135. var g_LastButtonText = null;
  136. var g_FirstFocusElement = null;
  137. var g = null;
  138. var g_SpecialChars = ".'-` ";
  139. var g_bRedial = false;
  140. var g_LineProblem = 0;
  141. var g_bFirstServerError = true;
  142. var g_status = STATUS_OFF;
  143. var g_ServerErrorCount = 0;
  144. var g_IMEExists = false;
  145. var g_OEMAddBackURL = "";
  146. var g_DialingAvailableInCountry = true;
  147. var g_ModalDialogUp = false;
  148. var MS_REGISTRATION = "{1C956940-8617-11D3-8B99-00A0C91E7F3C}";
  149. var OEM_REGISTRATION = "{ECD24360-B210-11D3-8B99-00A0C91E7F3C}";
  150. var g_bTapiDone = false;
  151. var g_OEMNameStr=window.external.Signup.get_OEMName();
  152. var g_Activation_Install_ID = "";
  153. var g_PID_ENTERED_ONRECORD = "";
  154. var g_Activation_CODE_ENTERED = "";
  155. var g_Activation_CODE_ENTERED_status = "";
  156. var g_InitAutodial = false;
  157. var g_CameFromFirstPage = false;
  158. var L_CheckConnectivity_Text = "Checking for connectivity...";
  159. var L_BlankTitle_Text = "";
  160. var ACTIVATION_TIMEOUT = 1800000; // 30 minutes
  161. // Mandatory Initialization Code
  162. if (null == ApiObj)
  163. {
  164. ApiObj = new Object;
  165. ApiObj = window.external.API;
  166. }
  167. if (null == StatusObj)
  168. {
  169. StatusObj = new Object;
  170. StatusObj = window.external.Status;
  171. }
  172. if (null == DirObj)
  173. {
  174. DirObj = new Object;
  175. DirObj = window.external.Directions;
  176. }
  177. if (null == InfoObj)
  178. {
  179. InfoObj = new Object;
  180. InfoObj = window.external.UserInfo;
  181. }
  182. if (null == RegisterObj)
  183. {
  184. RegisterObj = new Object;
  185. RegisterObj = window.external.Register;
  186. }
  187. if (null == TapiObj)
  188. {
  189. TapiObj = new Object;
  190. TapiObj = window.external.Tapi;
  191. }
  192. if (null == LangObj)
  193. {
  194. LangObj = new Object;
  195. LangObj = window.external.Language;
  196. }
  197. // END Initialization Code
  198. // AGENT: SelectClick is used by Agent
  199. function OnSelectClick() {}
  200. // AGENT: OnClick is used by Agent
  201. function OnClick() {}
  202. // AGENT: Focus functions are used by Agent
  203. function OnFocus() {}
  204. // these handle next/back navigation for non-checkpoint pages
  205. function ShowSimpleNavBack()
  206. {
  207. g.window.history.back();
  208. SetTimerShowIFrame(100);
  209. }
  210. function SimpleNavBack()
  211. {
  212. ShowIFrame('False');
  213. window.setTimeout("ShowSimpleNavBack();",500);
  214. }
  215. function HandleTextAreaFocus() {
  216. g.event.srcElement.style.borderStyle="ridge";
  217. }
  218. function HandleTextAreaBlur() {
  219. g.event.srcElement.style.borderStyle="";
  220. }
  221. function CheckContrastMode()
  222. {
  223. try
  224. {
  225. var InHighContrastMode = window.external.InHighContrastMode();
  226. }
  227. catch(e)
  228. {
  229. var L_HighContrastMode1_Text = "InHighContrastMode API not available";
  230. alert(L_HighContrastMode1_Text);
  231. InHighContrastMode = false;
  232. }
  233. if (InHighContrastMode)
  234. {
  235. g.deskstyle1.disabled = true;
  236. g.deskstyle2.disabled = false;
  237. }
  238. }
  239. function GetPageTitle()
  240. {
  241. Span_WPA_MainTitle.innerText = g.Title_Text.innerText;
  242. }
  243. //////////////////////////////////////////////////////////////////////////////////////
  244. // actdone.htm
  245. //////////////////////////////////////////////////////////////////////////////////////
  246. function Actdone_LoadMe()
  247. {
  248. InitFrameRef();
  249. GetPageTitle();
  250. CheckContrastMode();
  251. g_FirstFocusElement = g.btnQuit;
  252. InitButtons();
  253. if (g_FirstFocusElement != null)
  254. window.setTimeout("DoFocus();",1000);
  255. }
  256. //////////////////////////////////////////////////////////////////////////////////////
  257. // activ.htm
  258. //////////////////////////////////////////////////////////////////////////////////////
  259. function DoFocus()
  260. {
  261. //
  262. // During the transition between pages, the pages are hidden and focus()
  263. // will fail. If this happens we try again after a short delay.
  264. //
  265. try
  266. {
  267. if (g_FirstFocusElement != null)
  268. {
  269. g_FirstFocusElement.focus();
  270. }
  271. }
  272. catch(e)
  273. {
  274. window.setTimeout("DoFocus();",1000);
  275. }
  276. }
  277. function Activ_BtnTelephoneHandler()
  278. {
  279. GoNavigate(CKPT_ACTIVSVC);
  280. }
  281. var g_ActivationRadioSticky = null;
  282. function Activation_LoadMe()
  283. {
  284. g_CameFromFirstPage = false;
  285. InitFrameRef();
  286. GetPageTitle();
  287. CheckContrastMode();
  288. if (g_ActivationRadioSticky == null)
  289. g.btnNext.disabled = true;
  290. else if (g_ActivationRadioSticky == 1)
  291. g.rb_act_1.checked = true;
  292. else if (g_ActivationRadioSticky == 2)
  293. g.rb_act_2.checked = true;
  294. else if (g_ActivationRadioSticky == 3)
  295. g.rb_act_3.checked = true;
  296. if (g_ActivationRadioSticky != null)
  297. {
  298. WPA_ActivationRadioClicked();
  299. }
  300. var ndaysleft = ""
  301. try
  302. {
  303. ndaysleft = window.external.GetActivationDaysLeft();
  304. }
  305. catch(e)
  306. {
  307. ndaysleft = "0";
  308. }
  309. var L_LogMeOff_Text = "N<u>o</u>, log me off";
  310. if (ndaysleft == "0")
  311. {
  312. g.act_par01_ZeroDays.style.display = "inline";
  313. g.act_spn3.innerHTML = L_LogMeOff_Text;
  314. if (window.external.HasTablet())
  315. {
  316. g.act_par03_Tablet.style.display = "inline";
  317. }
  318. }
  319. else
  320. {
  321. g.act_par01_HaveDays.style.display = "inline";
  322. g.act_par02_HaveDays.style.display = "inline";
  323. g.NumberDaysLeft1.innerText = ndaysleft;
  324. }
  325. InitButtons();
  326. if (g_ActivationRadioSticky == null)
  327. g_FirstFocusElement = g.document.body;
  328. else
  329. g_FirstFocusElement = g.btnNext;
  330. window.setTimeout("DoFocus();",1000);
  331. }
  332. function WPA_ActivationRadioClicked()
  333. {
  334. if (g.rb_act_1.checked)
  335. g_ActivationRadioSticky = 1;
  336. else if (g.rb_act_2.checked)
  337. g_ActivationRadioSticky = 2;
  338. else
  339. g_ActivationRadioSticky = 3;
  340. if (g.btnNext.disabled)
  341. {
  342. g.btnNext.disabled = false;
  343. g.btnNext.onclick = GoNext;
  344. g.btnNext.focus();
  345. }
  346. }
  347. //////////////////////////////////////////////////////////////////////////////////////
  348. // activerr.htm
  349. //////////////////////////////////////////////////////////////////////////////////////
  350. function Activerr_RetryBtnHandler()
  351. {
  352. DisableAllButtons();
  353. if (CheckForAnyConnection())
  354. GoNavigate(CKPT_ACTIV);
  355. else
  356. GoNavigate(CKPT_ACTIVERR);
  357. }
  358. function ActivationErr_LoadMe()
  359. {
  360. InitFrameRef();
  361. GetPageTitle();
  362. CheckContrastMode();
  363. InitButtons();
  364. g.btnTelephone.onmouseover = HandleButtonMouseOver;
  365. g.btnTelephone.onmouseout = HandleButtonMouseOut;
  366. g.btnTelephone.onclick = GoNext;
  367. g.btnNext.onclick = Activerr_RetryBtnHandler;
  368. g_FirstFocusElement = g.btnNext;
  369. if (g_FirstFocusElement != null)
  370. window.setTimeout("DoFocus();",1000);
  371. }
  372. //////////////////////////////////////////////////////////////////////////////////////
  373. // actconn.htm
  374. //////////////////////////////////////////////////////////////////////////////////////
  375. var g_ActConnRadioSticky = 1;
  376. function ActConn_LoadMe()
  377. {
  378. InitFrameRef();
  379. GetPageTitle();
  380. CheckContrastMode();
  381. if (g_ActConnRadioSticky == 1)
  382. {
  383. g_FirstFocusElement = g.rb_conn_lan;
  384. g.rb_conn_lan.checked = true;
  385. }
  386. else
  387. {
  388. g_FirstFocusElement = g.rb_conn_modem;
  389. g.rb_conn_modem.checked = true;
  390. }
  391. InitButtons();
  392. window.setTimeout("DoFocus();",1000);
  393. }
  394. //////////////////////////////////////////////////////////////////////////////////////
  395. // actlan.htm
  396. //////////////////////////////////////////////////////////////////////////////////////
  397. var ProxySettingsObj = null;
  398. function ProxySettings(ConfigString)
  399. {
  400. this.UseAuto = false;
  401. this.UseScript = false;
  402. this.ScriptUrl = "";
  403. this.UseProxy = false;
  404. this.Server = "";
  405. this.Port = "";
  406. if (ConfigString != null)
  407. {
  408. var i, j;
  409. var Args = ConfigString.split(/ /);
  410. for (i = 0; i < Args.length; i++)
  411. {
  412. switch (Args[i])
  413. {
  414. case 'u':
  415. var ProxyList = Args[++i];
  416. var HttpProxy = null;
  417. // only care about proxy server for HTTP
  418. if (ProxyList.indexOf("=") == -1)
  419. {
  420. HttpProxy = ProxyList;
  421. }
  422. else
  423. {
  424. var Proxys = ProxyList.split(/;/);
  425. if (Proxys != null)
  426. {
  427. for (j = 0; j < Proxys.length; j++)
  428. {
  429. if (Proxys[j].indexOf("http=") == 0)
  430. {
  431. HttpProxy = Proxys[j].substring(5, Proxys[j].length);
  432. break;
  433. }
  434. }
  435. }
  436. }
  437. if (HttpProxy)
  438. {
  439. j = HttpProxy.lastIndexOf(':');
  440. if (j == -1)
  441. {
  442. this.Server = HttpProxy;
  443. }
  444. else
  445. {
  446. this.Server = HttpProxy.substring(0, j);
  447. this.Port = HttpProxy.substring(j+1, HttpProxy.length);
  448. }
  449. }
  450. break;
  451. case 'a':
  452. this.UseAuto = true;
  453. break;
  454. case 'm':
  455. this.UseProxy = true;
  456. break;
  457. }
  458. }
  459. }
  460. }
  461. function ActLan_LoadMe()
  462. {
  463. InitFrameRef();
  464. GetPageTitle();
  465. CheckContrastMode();
  466. InitButtons();
  467. if (ProxySettingsObj == null)
  468. {
  469. var ConfigString = window.external.get_ProxySettings();
  470. ProxySettingsObj = new ProxySettings(ConfigString);
  471. }
  472. g.cb_auto_detect.checked = ProxySettingsObj.UseAuto;
  473. g.cb_use_proxy.checked = ProxySettingsObj.UseProxy;
  474. g.txt_proxy_url.value = ProxySettingsObj.Server;
  475. g.txt_proxy_port.value = ProxySettingsObj.Port;
  476. ActLan_upClickHandler();
  477. g_FirstFocusElement = g.btnNext;
  478. window.setTimeout("DoFocus();",1500);
  479. }
  480. function ActLan_upClickHandler()
  481. {
  482. if (g.cb_use_proxy.checked)
  483. {
  484. g.txt_proxy_url.style.backgroundColor = "#ffffff";
  485. g.txt_proxy_url.disabled = false;
  486. g.txt_proxy_port.style.backgroundColor = "#ffffff";
  487. g.txt_proxy_port.disabled = false;
  488. }
  489. else
  490. {
  491. g.txt_proxy_url.style.backgroundColor = "#dddddd";
  492. g.txt_proxy_url.disabled = true;
  493. g.txt_proxy_port.style.backgroundColor = "#dddddd";
  494. g.txt_proxy_port.disabled = true;
  495. }
  496. }
  497. function ActLan(Stage)
  498. {
  499. if (Stage == null)
  500. {
  501. //
  502. // Do the internet connectivity checking ...
  503. //
  504. Span_WPA_MainTitle.innerText = L_BlankTitle_Text;
  505. ShowIFrame('False', L_CheckConnectivity_Text);
  506. ResetConnectedToInternetEx();
  507. ConnectedToInternetEx(true, "ActLan(1);");
  508. }
  509. else
  510. {
  511. //
  512. // Use the existing connectivity value
  513. //
  514. if (ConnectedToInternetEx(false))
  515. {
  516. IcsConnect(ICS_CONN_TYPE_REG);
  517. SetTimerShowIFrame(ACTIVATION_TIMEOUT);
  518. }
  519. else
  520. {
  521. g_ActivationStatus = ERR_ACT_NETWORK_FAILURE;
  522. GoNavigate(CKPT_ACT_MSG);
  523. }
  524. }
  525. }
  526. //////////////////////////////////////////////////////////////////////////////////////
  527. // PID functions
  528. //////////////////////////////////////////////////////////////////////////////////////
  529. var g_TabForward = false;
  530. var g_TabBackward = false;
  531. var g_LastFocusedPidBox;
  532. var g_SelectionExistsBeforeKeyPress=null;
  533. var g_keyPressKeyCode = 0;
  534. var g_CharCode0_plus1=("0".charCodeAt(0))+1;
  535. function RetrievePid()
  536. {
  537. // retrieves the pid if avialable.
  538. var strPid = PidObj.get_PID();
  539. // if there is no PID then we set the
  540. // focus to the first field
  541. if (strPid.length == 0)
  542. {
  543. g.edtProductKey[0].focus();
  544. }
  545. // else we populate the fields with the
  546. // sections of the PID
  547. else
  548. {
  549. var re = new RegExp("(.*)-(.*)-(.*)-(.*)-(.*)","");
  550. if(re.exec(strPid) == null) {
  551. throw "Internal error: RegExp pattmatch failed!";
  552. }
  553. g.edtProductKey[0].value = RegExp.$1;
  554. g.edtProductKey[1].value = RegExp.$2;
  555. g.edtProductKey[2].value = RegExp.$3;
  556. g.edtProductKey[3].value = RegExp.$4;
  557. g.edtProductKey[4].value = RegExp.$5;
  558. }
  559. }
  560. function PID_CheckLength(KnownIncomplete)
  561. {
  562. // call this only if box reaches length 5 for speed?
  563. if(KnownIncomplete) {
  564. g.btnNext.disabled = true;
  565. g.btnNext.className="buttons-disabled";
  566. return;
  567. }
  568. var TotLength=g.edtProductKey[0].value.length+g.edtProductKey[1].value.length+
  569. g.edtProductKey[2].value.length+g.edtProductKey[3].value.length+
  570. g.edtProductKey[4].value.length;
  571. if (TotLength == 25)
  572. {
  573. g.btnNext.disabled = false;
  574. g.btnNext.className="buttons";
  575. }
  576. else
  577. {
  578. g.btnNext.disabled = true;
  579. g.btnNext.className="buttons-disabled";
  580. }
  581. }
  582. function PIDBox_HandleBlur() {
  583. g_LastFocusedPidBox=g.event.srcElement;
  584. }
  585. function PIDBox_HandleFocus() {
  586. g_LastFocusedPidBox=g.event.srcElement;
  587. OnFocus();
  588. }
  589. function IsProductIDKey(keyCode)
  590. {
  591. var str = String.fromCharCode(keyCode);
  592. var result = str.match(/B|C|D|F|G|H|J|K|M|P|Q|R|T|V|W|X|Y|2|3|4|6|7|8|9/);
  593. return (null != result);
  594. }
  595. function CursorAtEndOfField(currentEdit) {
  596. // assumes selection is current edit field
  597. var tr = g.edtProductKey[currentEdit].createTextRange();
  598. var tr2 = g.document.selection.createRange();
  599. tr2.moveStart("textedit",-1);
  600. if(tr.isEqual(tr2)){
  601. return true;
  602. } else {
  603. return false;
  604. }
  605. }
  606. function ProductIDKeyDown()
  607. {
  608. try
  609. {
  610. if (g.event == null)
  611. return;
  612. }
  613. catch(e)
  614. {
  615. return;
  616. }
  617. var keyCode = g.event.keyCode;
  618. g_SelectionExistsBeforeKeyPress=(g.document.selection.type!="None");
  619. if(g.event.srcElement.tagName=="INPUT") {
  620. var i=g.event.srcElement.id.charCodeAt(3)-g_CharCode0_plus1;
  621. } else {
  622. var i=-1;
  623. }
  624. switch(keyCode) {
  625. case KeyTab:
  626. if(g.event.srcElement == g.edtProductKey[i]) {
  627. if(g.event.shiftKey)
  628. TabBackward(i,true);
  629. else TabForward(i,true);
  630. g.event.returnValue = false;
  631. g.event.keyCode = 0;
  632. g.event.cancelBubble = true;
  633. break;
  634. }
  635. break;
  636. case KeyLeftArrow:
  637. if((i>0) && CursorAtStartOfField(i)) {
  638. TabBackward(i,false);
  639. g.event.returnValue = false;
  640. }
  641. break;
  642. case KeyRightArrow:
  643. if((i<4) && CursorAtEndOfField(i)) {
  644. TabForward(i,false);
  645. g.event.returnValue = false;
  646. }
  647. break;
  648. case KeyBackSpc:
  649. case KeyDelete:
  650. // if there is already 5 characters in a field, and the user puts the cursor in it, we want to
  651. // fill in the next box with the character. we have to do this here because there is no propertychange,
  652. // and keyup is too late
  653. //if(g.edtProductKey[i].value.length == 5 && IsProductIDKey(keyCode) && g.document.selection==null)
  654. // TabForward(i);
  655. // cgeorges note: I enabled this feature tried it and didnt like it
  656. ////////
  657. // we want the delete/backspace to move the previous edit box if:
  658. // there is 0 characters, and the user puts the cursor in it, and selection is non-null
  659. // OR backspc && cursor is at start of field
  660. if ((i > 0) &&
  661. ( ((g.document.selection.type=="None") && (g.edtProductKey[i].value.length == 0))
  662. ||((keyCode==KeyBackSpc)&& CursorAtStartOfField(i)))) {
  663. TabBackward(i,false);
  664. g.event.returnValue = false; // so no deletion occurs when backspace moves to prev pidbox
  665. g.event.keyCode = 0;
  666. }
  667. break;
  668. case KeyEnter:
  669. if((g.btnNext.disabled == false)&&(g.event.srcElement!=g.btnBack)) {
  670. g.btnNext.click();
  671. g.event.returnValue = false;
  672. g.event.keyCode = 0;
  673. g.event.cancelBubble = true;
  674. }
  675. break;
  676. }
  677. }
  678. function ProductIDPropertyChange()
  679. {
  680. try
  681. {
  682. if (g.event == null)
  683. return;
  684. }
  685. catch(e)
  686. {
  687. return;
  688. }
  689. // enable Next Btn when PID is full, and automatically move to
  690. // next/previous field when entering/deleting chars
  691. if ("value" == g.event.propertyName) {
  692. // find the index at which we are.
  693. var i=g.event.srcElement.id.charCodeAt(3)-g_CharCode0_plus1;
  694. // our g_Tab variables can be booleans instead of counts because they can
  695. // have a max value of 1, becase there will only ever be 1 call to OnPropertyChange if the
  696. // length of the edit is 0 or 5
  697. switch(g.edtProductKey[i].value.length) {
  698. case 5:
  699. g_TabForward = (i<4); // dont tab forward if on last PID box
  700. PID_CheckLength(false);
  701. break;
  702. case 4:
  703. case 0:
  704. case 1:
  705. PID_CheckLength(true); //change from 25char-state could have occurred with any of these lengths
  706. }
  707. // see if we want to tab backward
  708. // if pixbox is empty, and last keypress was not a pidkey (which adds a char),
  709. // and nothing was selected.
  710. // BUGBUG: this currently only fully works for the delete key. when backspace
  711. // is pressed, g.document.selection.type is always "None" even if there was a selection
  712. if ((g.edtProductKey[i].value.length == 0) && (i > 0) &&
  713. (g_keyPressKeyCode==KeyBackSpc)&&(g_keyPressKeyCode==KeyDelete)&&
  714. (g.document.selection.type=="None")) {
  715. g_TabBackward = true; // IsProd check is to handle the case where they select everything then press a 2, etc.
  716. }
  717. }
  718. g_keyPressKeyCode = 0;
  719. }
  720. function ProductIDKeyPress()
  721. {
  722. try
  723. {
  724. if (g.event == null)
  725. return;
  726. }
  727. catch(e)
  728. {
  729. return;
  730. }
  731. if (g.event.keyCode == KeyBackSpc) {
  732. ProductIDKeyDown();
  733. return;
  734. }
  735. KeyCodeToUpper();
  736. g_keyPressKeyCode = g.event.keyCode;
  737. if (!IsProductIDKey(g_keyPressKeyCode)) {
  738. g.event.keyCode = 0;
  739. return;
  740. } else {
  741. var i=g.event.srcElement.id.charCodeAt(3)-g_CharCode0_plus1;
  742. if((i<4) && (g.edtProductKey[i].value.length == 5) && CursorAtEndOfField(i) && (!g_SelectionExistsBeforeKeyPress)) {
  743. TabForward(i,false);
  744. }
  745. }
  746. }
  747. function ProductIDKeyUp()
  748. {
  749. try
  750. {
  751. if (g.event == null)
  752. return;
  753. }
  754. catch(e)
  755. {
  756. return;
  757. }
  758. if((!g_TabForward) && (!g_TabBackward)) {
  759. return;
  760. }
  761. var i=g.event.srcElement.id.charCodeAt(3)-g_CharCode0_plus1;
  762. if (g_TabBackward) {
  763. TabBackward(i,false);
  764. return;
  765. } else
  766. if(g_TabForward) {
  767. TabForward(i,false);
  768. }
  769. }
  770. function TabForward(currentEdit,DoSelectAll)
  771. {
  772. g_TabForward = false;
  773. if(currentEdit==4) {
  774. // deselect any existing selection before moving focus to back button
  775. if(g.document.selection.type!="None") {
  776. g.document.selection.empty();
  777. }
  778. g.btnTelephone.focus();
  779. return;
  780. }
  781. currentEdit++;
  782. g.edtProductKey[currentEdit].focus();
  783. if(DoSelectAll) {
  784. g.edtProductKey[currentEdit].select();
  785. return;
  786. }
  787. var tr = g.edtProductKey[currentEdit].createTextRange();
  788. tr.collapse(true);
  789. tr.moveStart("word", 0);
  790. tr.select();
  791. }
  792. function TabBackward(currentEdit,DoSelectAll)
  793. {
  794. g_TabBackward = false;
  795. if (currentEdit == 0) {
  796. // deselect any existing selection before moving focus to button
  797. if(g.document.selection.type!="None") {
  798. g.document.selection.empty();
  799. }
  800. if(g.btnNext.disabled) {
  801. g.btnQuit.focus();
  802. } else {
  803. g.btnNext.focus();
  804. }
  805. return;
  806. }
  807. currentEdit--;
  808. g.edtProductKey[currentEdit].focus();
  809. if(DoSelectAll) {
  810. g.edtProductKey[currentEdit].select();
  811. return;
  812. }
  813. var tr = g.edtProductKey[currentEdit].createTextRange();
  814. tr.collapse(false);
  815. tr.moveStart("word", 1);
  816. tr.select();
  817. }
  818. function CursorAtStartOfField(currentEdit) {
  819. var tr = g.edtProductKey[currentEdit].createTextRange();
  820. var tr2 = g.document.selection.createRange();
  821. tr2.moveEnd("textedit",1);
  822. if(tr.isEqual(tr2)){
  823. return true;
  824. } else {
  825. return false;
  826. }
  827. }
  828. function CursorAtEndOfField(currentEdit) {
  829. // assumes selection is current edit field
  830. var tr = g.edtProductKey[currentEdit].createTextRange();
  831. var tr2 = g.document.selection.createRange();
  832. tr2.moveStart("textedit",-1);
  833. if(tr.isEqual(tr2)){
  834. return true;
  835. } else {
  836. return false;
  837. }
  838. }
  839. //////////////////////////////////////////////////////////////////////////////////////
  840. // adeskerr.htm
  841. //////////////////////////////////////////////////////////////////////////////////////
  842. function Activation_ResetNetworking()
  843. {
  844. if (window.external.CheckOnlineStatus)
  845. {
  846. ResetDialing();
  847. }
  848. if (g_InitAutodial)
  849. {
  850. window.external.InternetAutodialHangup();
  851. g_InitAutodial = false;
  852. }
  853. }
  854. function Activation_RetryBtnHandler()
  855. {
  856. DisableAllButtons();
  857. if ((g_ActivationStatus == ERR_ACT_INVALID_PID) ||
  858. (g_ActivationStatus == ERR_ACT_USED_PID) ||
  859. (g_ActivationStatus == ERR_ACT_BLOCKED_PID) ||
  860. (g_ActivationStatus == ERR_ACT_DEDICATED_PID_ENTRY))
  861. {
  862. StorePid();
  863. if (PidObj.get_PID.length != 0 && PidObj.ValidatePID())
  864. {
  865. window.external.ResetLicenseAgent();
  866. if (ReturnToTelephonePage)
  867. {
  868. // Must reload our Installation ID since we're successful in updating our PID
  869. g_Load_InstallID = true;
  870. // Also clear out the confirmation ID boxes
  871. g_ConfirmID_A = "";
  872. g_ConfirmID_B = "";
  873. g_ConfirmID_C = "";
  874. g_ConfirmID_D = "";
  875. g_ConfirmID_E = "";
  876. g_ConfirmID_F = "";
  877. g_ConfirmID_G = "";
  878. GoNavigate(CKPT_ACTIVSVC); // This is where we go when we click on "Update" to change our product key in the update PID page
  879. }
  880. else
  881. GoNavigate(CKPT_REGDIAL);
  882. }
  883. else
  884. {
  885. // Must show "Invalid PID" page
  886. g_ActivationStatus = ERR_ACT_INVALID_PID;
  887. GoNavigate(CKPT_ACT_MSG);
  888. }
  889. }
  890. else
  891. {
  892. // If our error has nothing to do with the PID, then the RETRY button should fall here...
  893. GoNavigate(CKPT_REGDIAL);
  894. }
  895. }
  896. var L_EnterNewKey_Text = "Enter new key:";
  897. var L_EnterKey_Text = "Enter key:";
  898. var L_NewKey_Text = "New key:";
  899. var L_MessageNumber_Text = "Message number: %1";
  900. var L_FinishButton_Text = "OK";
  901. var L_UpdateButton_Text = " <u>U</u>pdate ";
  902. function act_desktop_error_LoadMe()
  903. {
  904. var L_AccesskeyU_Text = "U";
  905. var L_AccesskeyO_Text = "O";
  906. InitFrameRef();
  907. GetPageTitle();
  908. CheckContrastMode();
  909. Activation_ResetNetworking();
  910. var ndaysleft = ""
  911. try
  912. {
  913. ndaysleft = window.external.GetActivationDaysLeft();
  914. }
  915. catch(e)
  916. {
  917. ndaysleft = "0";
  918. }
  919. if (g_ActivationStatus == ERR_ACT_SUCCESS)
  920. {
  921. var L_ActThankYou_Text = "Thank You!";
  922. Span_WPA_MainTitle.innerText = L_ActThankYou_Text;
  923. if (g_PostToMS)
  924. g.acterror_description_SUCCESS1.style.display="inline";
  925. else
  926. g.acterror_description_SUCCESS2.style.display="inline";
  927. }
  928. else if (g_ActivationStatus == ERR_ACT_INACCESSIBLE)
  929. {
  930. var L_ActUnable1_Text = "Unable to activate Windows";
  931. Span_WPA_MainTitle.innerText = L_ActUnable1_Text;
  932. if (ndaysleft == "0")
  933. {
  934. g.acterror_description1Post.style.display="inline";
  935. }
  936. else
  937. {
  938. g.acterror_description1Pre.style.display="inline";
  939. g.NumberDaysLeft1.innerText = ndaysleft;
  940. }
  941. }
  942. else if (g_ActivationStatus == ERR_ACT_INVALID_PID)
  943. {
  944. var L_ActIncorrectKey_Text = "Incorrect product key";
  945. Span_WPA_MainTitle.innerText = L_ActIncorrectKey_Text;
  946. var WPAOEMMode01 = window.external.IsOemSKU();
  947. if (WPAOEMMode01)
  948. {
  949. // OEM
  950. g.acterror_description2_OEM.style.display="inline";
  951. g.acterror_after_pid_entry_OEMText.style.display="inline";
  952. }
  953. else
  954. {
  955. // Retail
  956. g.acterror_description2_RETAIL.style.display="inline";
  957. }
  958. g.acterror_pid_entry.style.display="inline";
  959. g.acterror_after_pid_entry_text1.style.display="inline";
  960. g.acterror_description_verify_key.innerHTML = L_NewKey_Text;
  961. }
  962. else if (g_ActivationStatus == ERR_ACT_USED_PID)
  963. {
  964. var L_ActProductKey_Text = "Product key";
  965. Span_WPA_MainTitle.innerText = L_ActProductKey_Text;
  966. var WPAOEMMode02 = window.external.IsOemSKU();
  967. if (WPAOEMMode02)
  968. {
  969. // OEM
  970. g.acterror_description3OEM.style.display="inline";
  971. g.acterror_after_pid_entry_OEMText.style.display="inline";
  972. }
  973. else
  974. {
  975. // Retail
  976. g.acterror_description3Retail.style.display="inline";
  977. }
  978. g.acterror_pid_entry.style.display="inline";
  979. g.acterror_description_verify_key.innerHTML = L_NewKey_Text;
  980. g.acterror_after_pid_entry_text2.style.display="inline";
  981. }
  982. else if (g_ActivationStatus == ERR_ACT_INTERNAL_WINDOWS_ERR)
  983. {
  984. var L_ActUnable2_Text = "Unable to activate Windows";
  985. Span_WPA_MainTitle.innerText = L_ActUnable2_Text;
  986. if (ndaysleft == "0")
  987. {
  988. g.acterror_description4Post.style.display="inline";
  989. }
  990. else
  991. {
  992. g.acterror_description4Pre.style.display="inline";
  993. g.NumberDaysLeft2.innerText = ndaysleft;
  994. }
  995. }
  996. else if (g_ActivationStatus == ERR_ACT_BLOCKED_PID)
  997. {
  998. var L_ActUnauthorKey_Text = "Unauthorized product key";
  999. Span_WPA_MainTitle.innerText = L_ActUnauthorKey_Text;
  1000. var WPAOEMMode03 = window.external.IsOemSKU();
  1001. if (WPAOEMMode03)
  1002. {
  1003. // OEM
  1004. g.acterror_description5OEM.style.display="inline";
  1005. g.acterror_after_pid_entry_OEMText.style.display="inline";
  1006. }
  1007. else
  1008. {
  1009. // Retail
  1010. g.acterror_description5Retail.style.display="inline";
  1011. }
  1012. g.acterror_pid_entry.style.display="inline";
  1013. g.acterror_description_verify_key.innerHTML = L_NewKey_Text;
  1014. g.acterror_after_pid_entry_text2.style.display="inline";
  1015. }
  1016. else if (g_ActivationStatus == ERR_ACT_CORRUPTED_PID)
  1017. {
  1018. g.acterror_description6.style.display="inline";
  1019. g.NumberDaysLeft3.innerText = ndaysleft;
  1020. }
  1021. else if (g_ActivationStatus == ERR_ACT_NETWORK_FAILURE)
  1022. {
  1023. g.acterror_description7.style.display="inline";
  1024. }
  1025. else if (g_ActivationStatus == ERR_ACT_DEDICATED_PID_ENTRY)
  1026. {
  1027. var L_ActUpdateKey_Text = "Change product key";
  1028. Span_WPA_MainTitle.innerText = L_ActUpdateKey_Text;
  1029. var WPAOEMMode04 = window.external.IsOemSKU();
  1030. if (WPAOEMMode04)
  1031. {
  1032. // OEM
  1033. g.acterror_description_dedicated_pid_OEM.style.display="inline";
  1034. g.acterror_after_pid_entry_OEMText.style.display="inline";
  1035. }
  1036. else
  1037. {
  1038. // Retail
  1039. g.acterror_description_dedicated_pid_RETAIL.style.display="inline";
  1040. }
  1041. g.acterror_pid_entry.style.display="inline";
  1042. g.acterror_description_verify_key.innerHTML = L_NewKey_Text;
  1043. g.btnNext.innerHTML = L_UpdateButton_Text;
  1044. g.btnNext.accessKey = L_AccesskeyU_Text;
  1045. }
  1046. else
  1047. {
  1048. g.acterror_description4.style.display="inline";
  1049. g.NumberDaysLeft2.innerText = ndaysleft;
  1050. }
  1051. if (g_ActivationStatus != ERR_ACT_SUCCESS)
  1052. {
  1053. if ((g_act_specific_error != 0) && (g_act_specific_error != null))
  1054. {
  1055. g.acterror_specific_error_code.innerText = ApiObj.FormatMessage(L_MessageNumber_Text, g_act_specific_error.toString());
  1056. g.acterror_specific_error_code.style.display = "inline";
  1057. }
  1058. }
  1059. InitButtons();
  1060. if (g_ActivationStatus != ERR_ACT_SUCCESS)
  1061. {
  1062. if ((g_ActivationStatus == ERR_ACT_INVALID_PID) ||
  1063. (g_ActivationStatus == ERR_ACT_USED_PID) ||
  1064. (g_ActivationStatus == ERR_ACT_BLOCKED_PID) ||
  1065. (g_ActivationStatus == ERR_ACT_DEDICATED_PID_ENTRY))
  1066. {
  1067. if (null == PidObj)
  1068. {
  1069. PidObj = new Object;
  1070. PidObj = window.external.ProductID;
  1071. }
  1072. g_FirstFocusElement = g.edtProductKey[0];
  1073. ShowIFrame();
  1074. RetrievePid();
  1075. var rangefocus = g_FirstFocusElement.createTextRange();
  1076. rangefocus.collapse();
  1077. rangefocus.moveStart("word", 0);
  1078. rangefocus.select();
  1079. g_TabForward = false;
  1080. g_TabBackward = false;
  1081. PID_CheckLength(false);
  1082. for (i = 0; i <= 4; i++)
  1083. {
  1084. g.edtProductKey[i].onblur=PIDBox_HandleBlur;
  1085. g.edtProductKey[i].onfocus=PIDBox_HandleFocus;
  1086. }
  1087. g_LastFocusedPidBox=g.edtProductKey[0];
  1088. }
  1089. else
  1090. {
  1091. g_FirstFocusElement = g.btnNext;
  1092. ShowIFrame();
  1093. }
  1094. g.btnTelephone.onmouseover = HandleButtonMouseOver;
  1095. g.btnTelephone.onmouseout = HandleButtonMouseOut;
  1096. g.btnTelephone.onclick = GoNext;
  1097. g.btnNext.onclick = Activation_RetryBtnHandler;
  1098. }
  1099. else
  1100. {
  1101. g.btnTelephone.style.visibility = "hidden";
  1102. g.btnQuit.style.visibility = "hidden";
  1103. g.btnNext.innerHTML = L_FinishButton_Text;
  1104. g.btnNext.accessKey = L_AccesskeyO_Text;
  1105. g_FirstFocusElement = g.btnNext;
  1106. ShowIFrame();
  1107. }
  1108. window.setTimeout("DoFocus();",1000);
  1109. }
  1110. //////////////////////////////////////////////////////////////////////////////////////
  1111. // activsvc.htm
  1112. //////////////////////////////////////////////////////////////////////////////////////
  1113. function ValidateConfirmIDBox(Box_Number)
  1114. {
  1115. var Box_Value = null;
  1116. var Box_Valid = null;
  1117. if (Box_Number=='1')
  1118. Box_Value = g.ActCodeBox1.value;
  1119. if (Box_Number=='2')
  1120. Box_Value = g.ActCodeBox2.value;
  1121. if (Box_Number=='3')
  1122. Box_Value = g.ActCodeBox3.value;
  1123. if (Box_Number=='4')
  1124. Box_Value = g.ActCodeBox4.value;
  1125. if (Box_Number=='5')
  1126. Box_Value = g.ActCodeBox5.value;
  1127. if (Box_Number=='6')
  1128. Box_Value = g.ActCodeBox6.value;
  1129. if (Box_Number=='7')
  1130. Box_Value = g.ActCodeBox7.value;
  1131. Box_Valid = window.external.VerifyCheckDigits(Box_Value);
  1132. if (!Box_Valid)
  1133. {
  1134. var L_ConfirmIDInvalid1_Text = "The confirmation ID entered in this field is invalid. Please check the number and try again.";
  1135. alert(L_ConfirmIDInvalid1_Text);
  1136. // Set focus on the invalid confirmation id box
  1137. if (Box_Number=='1')
  1138. {
  1139. g.ActCodeBox1.focus();
  1140. g.ActCodeBox1.select();
  1141. g_DoFieldChecking = false;
  1142. }
  1143. if (Box_Number=='2')
  1144. {
  1145. g.ActCodeBox2.focus();
  1146. g.ActCodeBox2.select();
  1147. g_DoFieldChecking = false;
  1148. }
  1149. if (Box_Number=='3')
  1150. {
  1151. g.ActCodeBox3.focus();
  1152. g.ActCodeBox3.select();
  1153. g_DoFieldChecking = false;
  1154. }
  1155. if (Box_Number=='4')
  1156. {
  1157. g.ActCodeBox4.focus();
  1158. g.ActCodeBox4.select();
  1159. g_DoFieldChecking = false;
  1160. }
  1161. if (Box_Number=='5')
  1162. {
  1163. g.ActCodeBox5.focus();
  1164. g.ActCodeBox5.select();
  1165. g_DoFieldChecking = false;
  1166. }
  1167. if (Box_Number=='6')
  1168. {
  1169. g.ActCodeBox6.focus();
  1170. g.ActCodeBox6.select();
  1171. g_DoFieldChecking = false;
  1172. }
  1173. if (Box_Number=='7')
  1174. {
  1175. g.ActCodeBox7.focus();
  1176. g.ActCodeBox7.select();
  1177. g_DoFieldChecking = false;
  1178. }
  1179. }
  1180. else
  1181. {
  1182. // Set focus on the next confirmation id box if valid
  1183. if (Box_Number=='1')
  1184. g.ActCodeBox2.focus();
  1185. if (Box_Number=='2')
  1186. g.ActCodeBox3.focus();
  1187. if (Box_Number=='3')
  1188. g.ActCodeBox4.focus();
  1189. if (Box_Number=='4')
  1190. g.ActCodeBox5.focus();
  1191. if (Box_Number=='5')
  1192. g.ActCodeBox6.focus();
  1193. if (Box_Number=='6')
  1194. g.ActCodeBox7.focus();
  1195. if (Box_Number=='7')
  1196. {
  1197. // Do nothing, focusing will be done automatically by IsConfirmIDComplete() when this function returns.
  1198. // Note: Don't take out the curly braces here...
  1199. }
  1200. g_DoFieldChecking = true;
  1201. }
  1202. }
  1203. function UpdateConfirmIDFields(FieldToEdit)
  1204. {
  1205. if (FieldToEdit == '1')
  1206. {
  1207. g_ConfirmID1 = g.ActCodeBox1.value;
  1208. }
  1209. if (FieldToEdit == '2')
  1210. {
  1211. g_ConfirmID2 = g.ActCodeBox2.value;
  1212. }
  1213. if (FieldToEdit == '3')
  1214. {
  1215. g_ConfirmID3 = g.ActCodeBox3.value;
  1216. }
  1217. if (FieldToEdit == '4')
  1218. {
  1219. g_ConfirmID4 = g.ActCodeBox4.value;
  1220. }
  1221. if (FieldToEdit == '5')
  1222. {
  1223. g_ConfirmID5 = g.ActCodeBox5.value;
  1224. }
  1225. if (FieldToEdit == '6')
  1226. {
  1227. g_ConfirmID6 = g.ActCodeBox6.value;
  1228. }
  1229. if (FieldToEdit == '7')
  1230. {
  1231. g_ConfirmID7 = g.ActCodeBox7.value;
  1232. }
  1233. // If user presses Backspace, move focus to previous field if current field is empty. Unless we are in field 1.
  1234. if (g_DoBackSpace)
  1235. {
  1236. g_DoBackSpace = false;
  1237. var tr = null;
  1238. if (FieldToEdit == '1')
  1239. {
  1240. // Do nothing.
  1241. }
  1242. else if (FieldToEdit == '2')
  1243. {
  1244. if (g.ActCodeBox2.value == "")
  1245. tr = g.ActCodeBox1.createTextRange();
  1246. }
  1247. else if (FieldToEdit == '3')
  1248. {
  1249. if (g.ActCodeBox3.value == "")
  1250. tr = g.ActCodeBox2.createTextRange();
  1251. }
  1252. else if (FieldToEdit == '4')
  1253. {
  1254. if (g.ActCodeBox4.value == "")
  1255. tr = g.ActCodeBox3.createTextRange();
  1256. }
  1257. else if (FieldToEdit == '5')
  1258. {
  1259. if (g.ActCodeBox5.value == "")
  1260. tr = g.ActCodeBox4.createTextRange();
  1261. }
  1262. else if (FieldToEdit == '6')
  1263. {
  1264. if (g.ActCodeBox6.value == "")
  1265. tr = g.ActCodeBox5.createTextRange();
  1266. }
  1267. else if (FieldToEdit == '7')
  1268. {
  1269. if (g.ActCodeBox7.value == "")
  1270. tr = g.ActCodeBox6.createTextRange();
  1271. }
  1272. // This will cause the insertion point to move to the end of the text range
  1273. if ((FieldToEdit != '1') && (tr != null))
  1274. {
  1275. tr.collapse(false);
  1276. tr.moveStart("word", 1);
  1277. tr.select();
  1278. }
  1279. }
  1280. }
  1281. function DeleteLastCharacter(FieldToEdit)
  1282. {
  1283. if (FieldToEdit == '1')
  1284. {
  1285. g.ActCodeBox1.value = g_ConfirmID1;
  1286. }
  1287. if (FieldToEdit == '2')
  1288. {
  1289. g.ActCodeBox2.value = g_ConfirmID2;
  1290. }
  1291. if (FieldToEdit == '3')
  1292. {
  1293. g.ActCodeBox3.value = g_ConfirmID3;
  1294. }
  1295. if (FieldToEdit == '4')
  1296. {
  1297. g.ActCodeBox4.value = g_ConfirmID4;
  1298. }
  1299. if (FieldToEdit == '5')
  1300. {
  1301. g.ActCodeBox5.value = g_ConfirmID5;
  1302. }
  1303. if (FieldToEdit == '6')
  1304. {
  1305. g.ActCodeBox6.value = g_ConfirmID6;
  1306. }
  1307. if (FieldToEdit == '7')
  1308. {
  1309. g.ActCodeBox7.value = g_ConfirmID7;
  1310. }
  1311. var L_OnlyNumbersAllowed_Text = "Only numbers can be used for the confirmation ID.";
  1312. alert(L_OnlyNumbersAllowed_Text);
  1313. if (FieldToEdit == '1')
  1314. g.ActCodeBox1.focus();
  1315. else if (FieldToEdit == '2')
  1316. g.ActCodeBox2.focus();
  1317. else if (FieldToEdit == '3')
  1318. g.ActCodeBox3.focus();
  1319. else if (FieldToEdit == '4')
  1320. g.ActCodeBox4.focus();
  1321. else if (FieldToEdit == '5')
  1322. g.ActCodeBox5.focus();
  1323. else if (FieldToEdit == '6')
  1324. g.ActCodeBox6.focus();
  1325. else if (FieldToEdit == '7')
  1326. g.ActCodeBox7.focus();
  1327. }
  1328. var g_ConfirmID1 = "";
  1329. var g_ConfirmID2 = "";
  1330. var g_ConfirmID3 = "";
  1331. var g_ConfirmID4 = "";
  1332. var g_ConfirmID5 = "";
  1333. var g_ConfirmID6 = "";
  1334. var g_ConfirmID7 = "";
  1335. var g_DoBackSpace = false;
  1336. var g_DoFieldChecking = true;
  1337. function activate_OnKeyUp(WhatField)
  1338. {
  1339. var keyCode = g.event.keyCode;
  1340. var str = String.fromCharCode(keyCode);
  1341. // Evidently, numkeypad 0 with the NumLock on gives us x60 or single back quote
  1342. // LocStudio doesn't understand regexp, so we refer to this character by ascii code \x60
  1343. // The small letters a-i represent the keycodes for the numeric keypad 1-9 (If Numlock is on).
  1344. // We only allow "Numbers" to be entered in the Confirmation ID fields.
  1345. var result = str.match(/\x60|a|b|c|d|e|f|g|h|i|1|2|3|4|5|6|7|8|9|0/);
  1346. var NonNumericresult = str.match(/A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z/);
  1347. var BackSpc = str.match(/\x08/);
  1348. var validchar = false;
  1349. if (null != result)
  1350. {
  1351. validchar = true;
  1352. }
  1353. else
  1354. {
  1355. validchar = false;
  1356. if (null != NonNumericresult)
  1357. {
  1358. DeleteLastCharacter(WhatField);
  1359. }
  1360. else
  1361. {
  1362. if (null != BackSpc)
  1363. g_DoBackSpace = true;
  1364. UpdateConfirmIDFields(WhatField);
  1365. }
  1366. }
  1367. if (validchar)
  1368. {
  1369. if (WhatField == '1')
  1370. {
  1371. g_ConfirmID1 = g.ActCodeBox1.value;
  1372. if (g.ActCodeBox1.value.length == 6)
  1373. {
  1374. ValidateConfirmIDBox(WhatField);
  1375. }
  1376. }
  1377. if (WhatField == '2')
  1378. {
  1379. g_ConfirmID2 = g.ActCodeBox2.value;
  1380. if (g.ActCodeBox2.value.length == 6)
  1381. {
  1382. ValidateConfirmIDBox(WhatField);
  1383. }
  1384. }
  1385. if (WhatField == '3')
  1386. {
  1387. g_ConfirmID3 = g.ActCodeBox3.value;
  1388. if (g.ActCodeBox3.value.length == 6)
  1389. {
  1390. ValidateConfirmIDBox(WhatField);
  1391. }
  1392. }
  1393. if (WhatField == '4')
  1394. {
  1395. g_ConfirmID4 = g.ActCodeBox4.value;
  1396. if (g.ActCodeBox4.value.length == 6)
  1397. {
  1398. ValidateConfirmIDBox(WhatField);
  1399. }
  1400. }
  1401. if (WhatField == '5')
  1402. {
  1403. g_ConfirmID5 = g.ActCodeBox5.value;
  1404. if (g.ActCodeBox5.value.length == 6)
  1405. {
  1406. ValidateConfirmIDBox(WhatField);
  1407. }
  1408. }
  1409. if (WhatField == '6')
  1410. {
  1411. g_ConfirmID6 = g.ActCodeBox6.value;
  1412. if (g.ActCodeBox6.value.length == 6)
  1413. {
  1414. ValidateConfirmIDBox(WhatField);
  1415. }
  1416. }
  1417. if (WhatField == '7')
  1418. {
  1419. g_ConfirmID7 = g.ActCodeBox7.value;
  1420. if (g.ActCodeBox7.value.length == 6)
  1421. {
  1422. ValidateConfirmIDBox(WhatField);
  1423. }
  1424. }
  1425. if (g_DoFieldChecking)
  1426. IsConfirmIDComplete();
  1427. // We set focus here instead of inside the IsConfirmIDComplete() function to have
  1428. // proper focus behaviour when we use certain keys like Tab, space, arrow keys...
  1429. if (!g.btnNext.disabled)
  1430. g.btnNext.focus();
  1431. }
  1432. else
  1433. {
  1434. IsConfirmIDComplete();
  1435. }
  1436. }
  1437. function IsConfirmIDComplete()
  1438. {
  1439. if ((g.ActCodeBox1.value.length == 6) && (g.ActCodeBox2.value.length == 6) && (g.ActCodeBox3.value.length == 6) && (g.ActCodeBox4.value.length == 6) && (g.ActCodeBox5.value.length == 6) && (g.ActCodeBox6.value.length == 6) && (g.ActCodeBox7.value.length == 6))
  1440. {
  1441. g.btnNext.onmouseover = HandleButtonMouseOver;
  1442. g.btnNext.onmouseout = HandleButtonMouseOut;
  1443. g.btnNext.className="buttons";
  1444. g.btnNext.disabled = false;
  1445. g.btnNext.onclick = ActivationSvc_NextBtnHandler;
  1446. }
  1447. else
  1448. {
  1449. g.btnNext.className="buttons-disabled";
  1450. g.btnNext.disabled = true;
  1451. }
  1452. }
  1453. var g_ActivSvc_Reload = true;
  1454. function ActivationSvc_NextBtnHandler()
  1455. {
  1456. g_Activation_CODE_ENTERED = g.ActCodeBox1.value + '-' +
  1457. g.ActCodeBox2.value + '-' +
  1458. g.ActCodeBox3.value + '-' +
  1459. g.ActCodeBox4.value + '-' +
  1460. g.ActCodeBox5.value + '-' +
  1461. g.ActCodeBox6.value + '-' +
  1462. g.ActCodeBox7.value;
  1463. g_ConfirmID_A = g.ActCodeBox1.value;
  1464. g_ConfirmID_B = g.ActCodeBox2.value;
  1465. g_ConfirmID_C = g.ActCodeBox3.value;
  1466. g_ConfirmID_D = g.ActCodeBox4.value;
  1467. g_ConfirmID_E = g.ActCodeBox5.value;
  1468. g_ConfirmID_F = g.ActCodeBox6.value;
  1469. g_ConfirmID_G = g.ActCodeBox7.value;
  1470. try
  1471. {
  1472. g_Activation_CODE_ENTERED_status = window.external.SetConfirmationID(g_Activation_CODE_ENTERED);
  1473. }
  1474. catch(e)
  1475. {
  1476. g_Activation_CODE_ENTERED_status = 0;
  1477. }
  1478. DisableAllButtons();
  1479. if (g_Activation_CODE_ENTERED_status == 0)
  1480. {
  1481. GoNavigate(CKPT_DONE);
  1482. }
  1483. else
  1484. {
  1485. g_Load_InstallID = false;
  1486. var L_ConfirmIDInvalid_Text = "The confirmation ID is invalid. Please check the number and try again.";
  1487. alert(L_ConfirmIDInvalid_Text);
  1488. g_ActivSvc_Reload = false;
  1489. GoNavigate(CKPT_ACTIVSVC);
  1490. }
  1491. }
  1492. function ActivationSvc_ProdkeyBtnHandler()
  1493. {
  1494. DisableAllButtons();
  1495. ReturnToTelephonePage = true;
  1496. g_Load_InstallID = false;
  1497. // Must also remember the Contents of the confirmation ID typed in by the user.
  1498. g_ConfirmID_A = g.ActCodeBox1.value;
  1499. g_ConfirmID_B = g.ActCodeBox2.value;
  1500. g_ConfirmID_C = g.ActCodeBox3.value;
  1501. g_ConfirmID_D = g.ActCodeBox4.value;
  1502. g_ConfirmID_E = g.ActCodeBox5.value;
  1503. g_ConfirmID_F = g.ActCodeBox6.value;
  1504. g_ConfirmID_G = g.ActCodeBox7.value;
  1505. g_ActivationStatus = ERR_ACT_DEDICATED_PID_ENTRY;
  1506. GoNavigate(CKPT_ACT_MSG);
  1507. }
  1508. function PhoneCountries_Changed()
  1509. {
  1510. g.ChosenPhoneNumber.innerHTML = "<B>" + g_Phone_Number_Array[g.selPhoneCountry.selectedIndex] + "</B>";
  1511. g.ChosenTollNumber.innerHTML = "<B>" + g_Toll_Number_Array[g.selPhoneCountry.selectedIndex] + "</B>";
  1512. // We want to remember the country selected whenever we go back to the Telephone page (activsvc.htm)
  1513. g_Country_Selected_Index = g.selPhoneCountry.selectedIndex;
  1514. }
  1515. var g_Country_Selected_Index = 0;
  1516. var g_Phone_Number_Array = new Array(500);
  1517. var g_Toll_Number_Array = new Array(500);
  1518. function GetPhoneCountries()
  1519. {
  1520. var g_PhoneCountries = "";
  1521. try
  1522. {
  1523. g_PhoneCountries = LangObj.get_PhoneCountries();
  1524. }
  1525. catch(e)
  1526. {
  1527. g_PhoneCountries = "API call error: get_PhoneCountries";
  1528. }
  1529. var i;
  1530. var PhoneOption;
  1531. var ModulusResult;
  1532. var PhoneCounter=0;
  1533. var TollCounter =0;
  1534. var regexp1=/\t/; // Define our regexp1 to a "TAB" keycode.
  1535. var Opt_PhoneCountry_Array = g_PhoneCountries.split(regexp1); // Let's split our tab delimited g_PhoneCountries string and put it into an array.
  1536. var L_SelectYourLocation_Text = "Select your location";
  1537. // Add the "Select your location" option in the select list
  1538. PhoneOption = g.document.createElement("OPTION");
  1539. PhoneOption.text = L_SelectYourLocation_Text;
  1540. g.selPhoneCountry.add(PhoneOption);
  1541. g_Toll_Number_Array[TollCounter] = "";
  1542. g_Phone_Number_Array[PhoneCounter] = "";
  1543. TollCounter = TollCounter + 1;
  1544. PhoneCounter = PhoneCounter + 1;
  1545. for(i=0; i < Opt_PhoneCountry_Array.length; i++)
  1546. {
  1547. ModulusResult = i % 3;
  1548. if (ModulusResult == 0)
  1549. {
  1550. PhoneOption = g.document.createElement("OPTION");
  1551. PhoneOption.text = Opt_PhoneCountry_Array[i];
  1552. g.selPhoneCountry.add(PhoneOption);
  1553. }
  1554. else if (ModulusResult == 1)
  1555. {
  1556. g_Toll_Number_Array[TollCounter] = Opt_PhoneCountry_Array[i];
  1557. TollCounter = TollCounter + 1;
  1558. }
  1559. else
  1560. {
  1561. g_Phone_Number_Array[PhoneCounter] = Opt_PhoneCountry_Array[i];
  1562. PhoneCounter = PhoneCounter + 1;
  1563. }
  1564. }
  1565. g.ChosenPhoneNumber.innerHTML = "<B>" + g_Phone_Number_Array[g_Country_Selected_Index] + "</B>";
  1566. g.ChosenTollNumber.innerHTML = "<B>" + g_Toll_Number_Array[g_Country_Selected_Index] + "</B>";
  1567. g.selPhoneCountry.selectedIndex = g_Country_Selected_Index;
  1568. }
  1569. function BackBtnHandler()
  1570. {
  1571. GoNavigate(CKPT_ACTIV);
  1572. }
  1573. var ReturnToTelephonePage = false;
  1574. var g_ConfirmID_A = "";
  1575. var g_ConfirmID_B = "";
  1576. var g_ConfirmID_C = "";
  1577. var g_ConfirmID_D = "";
  1578. var g_ConfirmID_E = "";
  1579. var g_ConfirmID_F = "";
  1580. var g_ConfirmID_G = "";
  1581. var g_Load_InstallID = true;
  1582. var g_Activation_Install_ID_Full = "";
  1583. function ActivationSvc_LoadMe()
  1584. {
  1585. InitFrameRef();
  1586. GetPageTitle();
  1587. CheckContrastMode();
  1588. ReturnToTelephonePage = false;
  1589. if (g_Load_InstallID)
  1590. {
  1591. try
  1592. {
  1593. g_Activation_Install_ID = window.external.GetInstallationID();
  1594. }
  1595. catch(e)
  1596. {
  1597. g_Activation_Install_ID = "NOT FOUND.";
  1598. }
  1599. var i;
  1600. g_Activation_Install_ID_Full = "";
  1601. for (i = 0; i < g_Activation_Install_ID.length-6; i += 6)
  1602. {
  1603. //
  1604. // Form all the groups of 6 digits, separated by "-"
  1605. //
  1606. g_Activation_Install_ID_Full += g_Activation_Install_ID.substring(i,i+6) + "-";
  1607. }
  1608. //
  1609. // Add the last group of digits, which may not form a full group of 6
  1610. //
  1611. g_Activation_Install_ID_Full += g_Activation_Install_ID.substring(i,g_Activation_Install_ID.length);
  1612. }
  1613. g.spn_install_id.innerText = g_Activation_Install_ID_Full;
  1614. // We want to pre-populate the Confirmation ID fields with values entered by the user, on an event this page is loaded the second time around.
  1615. g.ActCodeBox1.value = g_ConfirmID_A;
  1616. g.ActCodeBox2.value = g_ConfirmID_B;
  1617. g.ActCodeBox3.value = g_ConfirmID_C;
  1618. g.ActCodeBox4.value = g_ConfirmID_D;
  1619. g.ActCodeBox5.value = g_ConfirmID_E;
  1620. g.ActCodeBox6.value = g_ConfirmID_F;
  1621. g.ActCodeBox7.value = g_ConfirmID_G;
  1622. // Show "Back" button if we came from the first page.
  1623. if (g_CameFromFirstPage)
  1624. {
  1625. g.btnBack.style.display = "inline";
  1626. }
  1627. InitButtons();
  1628. // Override basic button behavior.
  1629. // We want to force the back button to navigate to the first page "literally".
  1630. if (g_CameFromFirstPage)
  1631. {
  1632. g.btnBack.onclick = BackBtnHandler;
  1633. }
  1634. IsConfirmIDComplete(); // Enable the Next button if all the Confirmation ID fields are complete
  1635. GetPhoneCountries();
  1636. g.btnProdkey.onclick = ActivationSvc_ProdkeyBtnHandler;
  1637. g.btnProdkey.onmouseover = HandleButtonMouseOver;
  1638. g.btnProdkey.onmouseout = HandleButtonMouseOut;
  1639. if (g_Country_Selected_Index==0)
  1640. {
  1641. g_FirstFocusElement = g.selPhoneCountry;
  1642. }
  1643. else if (!g.btnNext.disabled)
  1644. {
  1645. g_FirstFocusElement = g.btnNext;
  1646. }
  1647. else
  1648. {
  1649. g_FirstFocusElement = g.ActCodeBox1;
  1650. }
  1651. if (g_FirstFocusElement != null)
  1652. window.setTimeout("DoFocus();",1000);
  1653. }
  1654. //// areg1.htm ///////////////////////
  1655. var g_Reg1RadioSticky = null;
  1656. function areg1_LoadMe()
  1657. {
  1658. InitFrameRef();
  1659. GetPageTitle();
  1660. CheckContrastMode();
  1661. if (g_Reg1RadioSticky == null)
  1662. g.btnNext.disabled = true;
  1663. else if (g_Reg1RadioSticky == 1)
  1664. g.rb_reg_1.checked = true;
  1665. else if (g_Reg1RadioSticky == 2)
  1666. g.rb_reg_2.checked = true;
  1667. InitButtons();
  1668. if (g.btnNext.disabled)
  1669. g_FirstFocusElement = g.btnBack;
  1670. else
  1671. g_FirstFocusElement = g.btnNext;
  1672. window.setTimeout("DoFocus();",1500);
  1673. }
  1674. function WPA_Reg1RadioClicked()
  1675. {
  1676. // if they click on either button, enable the Next button
  1677. if(g.btnNext.disabled && (g.rb_reg_1.checked || g.rb_reg_2.checked))
  1678. {
  1679. if (g.rb_reg_1.checked)
  1680. g_Reg1RadioSticky = 1;
  1681. else if (g.rb_reg_2.checked)
  1682. g_Reg1RadioSticky = 2;
  1683. g.btnNext.disabled = false;
  1684. g.btnNext.onclick = GoNext;
  1685. g.btnNext.focus();
  1686. }
  1687. }
  1688. //// reg3.htm ///////////////////////
  1689. var StateAbbrevs = new Array("","AL","AK","AZ","AR","CA","CO","CT","DC","DE","FL","GA","HI","ID","IL","IN","IA","KS","KY","LA","ME","MD","MA","MI","MN","MS","MO","MT","NE","NV","NH","NJ","NM","NY","NC","ND","OH","OK","OR","PA","PR","RI","SC","SD","TN","TX","UT","VT","VA","WA","WV","WI","WY");
  1690. var FullStateNames = new Array("Alabama","Alaska","Arizona","Arkansas","California","Colorado","Connecticut","Washington, D.C.","Delaware","Florida","Georgia","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New Hampshire","New Jersey","New Mexico","New York","North Carolina","North Dakota","Ohio","Oklahoma","Oregon","Pennsylvania","Puerto Rico","Rhode Island","South Carolina","South Dakota","Tennessee","Texas","Utah","Vermont","Virginia","Washington","West Virginia","Wisconsin","Wyoming");
  1691. var ProvinceNames = new Array("","Alberta","British Columbia","Manitoba","New Brunswick","Newfoundland","Northwest Territories","Nova Scotia","Nunavut","Ontario","Prince Edward Island","Quebec","Saskatchewan","Yukon");
  1692. // need ability to map state name string to index into StateAbbrevs
  1693. var g_StateName2IndexMap= new ActiveXObject("Scripting.Dictionary");
  1694. var g_ProvinceName2IndexMap= new ActiveXObject("Scripting.Dictionary");
  1695. g_ProvinceName2IndexMap.CompareMode = 1; // text compare
  1696. g_StateName2IndexMap.CompareMode = 1; // text compare
  1697. // init hash table
  1698. var ii;
  1699. for(ii=1;ii<=FullStateNames.length;ii++) {
  1700. // add both full name and abbrev to hash table
  1701. g_StateName2IndexMap.Add(FullStateNames[ii-1].toUpperCase(),ii);
  1702. g_StateName2IndexMap.Add(StateAbbrevs[ii].toUpperCase(),ii);
  1703. if(ii < ProvinceNames.length) {
  1704. g_ProvinceName2IndexMap.Add(ProvinceNames[ii].toUpperCase(),ii);
  1705. }
  1706. }
  1707. var L_Postal_Text = "Postal or <u>Z</u>IP code:";
  1708. var L_AsteriskPostal_Text = "*Postal or <u>Z</u>IP code:";
  1709. var L_Province_Text= "State/<u>P</u>rovince:";
  1710. var L_AsteriskProvince_Text= "*State/<u>P</u>rovince:";
  1711. var L_Canada_Text="Canada";
  1712. var L_UnitedStates_Text="United States";
  1713. function Reg3UserCountryChanged() {
  1714. // AGENT: notify Agent of the change
  1715. g_Country=g.selCountry.options(g.selCountry.selectedIndex).text;
  1716. if(g_Country == L_UnitedStates_Text) {
  1717. if(g.selUSState.style.display!="inline") {
  1718. g.selUSState.style.display="inline";
  1719. }
  1720. g.selCAProvince.style.display="none";
  1721. g.UserStateTextBox.style.display="none";
  1722. // when changing to US, try to translate any textbox string to state index
  1723. if(g.UserStateTextBox.value!="") {
  1724. var res=g_StateName2IndexMap.Item(g.UserStateTextBox.value.toUpperCase());
  1725. if(res!=null) {
  1726. g.selUSState.selectedIndex=res;
  1727. }
  1728. }
  1729. g.LabelZIP.innerHTML = L_AsteriskPostal_Text;
  1730. g.StateLabel.innerHTML = L_AsteriskProvince_Text;
  1731. } else if(g_Country == L_Canada_Text) {
  1732. g.selUSState.style.display="none";
  1733. g.selCAProvince.style.display="inline";
  1734. g.UserStateTextBox.style.display="none";
  1735. // when changing to Canada, try to translate any textbox string to province index
  1736. if(g.UserStateTextBox.value!="") {
  1737. var res=g_ProvinceName2IndexMap.Item(g.UserStateTextBox.value.toUpperCase());
  1738. if(res!=null) {
  1739. g.selCAProvince.selectedIndex=res;
  1740. }
  1741. }
  1742. g.LabelZIP.innerHTML = L_AsteriskPostal_Text;
  1743. g.StateLabel.innerHTML = L_AsteriskProvince_Text;
  1744. } else {
  1745. g.selUSState.style.display="none";
  1746. g.selCAProvince.style.display="none";
  1747. g.UserStateTextBox.style.display="inline";
  1748. g.LabelZIP.innerHTML = L_Postal_Text;
  1749. g.StateLabel.innerHTML = L_Province_Text;
  1750. }
  1751. g_CountryIdx=g.selCountry.selectedIndex;
  1752. Reg3UserStateChanged();
  1753. }
  1754. var L_FullName_Text="*<u>F</u>ull Name:";
  1755. function Reg3UserStateChanged() {
  1756. // AGENT: notify Agent of the change
  1757. // BUGBUG: ok for no notify on change to textbox?
  1758. if(g.selUSState.style.display!="none")
  1759. {
  1760. g_StateIdx=g.selUSState.selectedIndex;
  1761. g_State=g.selUSState.options(g.selUSState.selectedIndex).text;
  1762. g.StateLabel.htmlFor="selUSState";
  1763. }
  1764. else if (g.selCAProvince.style.display!="none")
  1765. {
  1766. g_StateIdx=g.selCAProvince.selectedIndex;
  1767. g_State=g.selCAProvince.options(g.selCAProvince.selectedIndex).text;
  1768. g.StateLabel.htmlFor="selCAProvince";
  1769. }
  1770. else
  1771. {
  1772. g_State = g.UserStateTextBox.value;
  1773. g.StateLabel.htmlFor="UserStateTextBox";
  1774. }
  1775. }
  1776. // store field info here:
  1777. var g_FirstName=InfoObj.get_FirstName();
  1778. //var g_MiddleName=InfoObj.get_MiddleInitial(); // InfoObj.get_MiddleName(); BUGBUG need to add this fn
  1779. var g_LastName=InfoObj.get_LastName();
  1780. var g_Address1=InfoObj.get_Address1();
  1781. var g_Address2=InfoObj.get_Address2();
  1782. var g_City=InfoObj.get_City();
  1783. var g_ZipCode=InfoObj.get_Zip();
  1784. var g_EmailAddr= InfoObj.get_PrimaryEmail();
  1785. var g_Country=InfoObj.get_Country();
  1786. var g_CountryIdx=-1;
  1787. var g_State=InfoObj.get_State();
  1788. var g_StateIdx=0;
  1789. function Reg3SaveSettings() {
  1790. g_FirstName=g.UserFirstName.value;
  1791. //g_MiddleName=g.UserMiddleName.value;
  1792. if (IsKoreanLocale())
  1793. g_LastName="";
  1794. else
  1795. g_LastName=g.UserLastName.value;
  1796. g_Address1=g.UserAddress.value;
  1797. g_Address2=g.UserAddress2.value;
  1798. g_ZipCode=g.UserZipCode.value;
  1799. g_EmailAddr=g.UserEmailAddress.value;
  1800. g_City=g.UserCity.value;
  1801. g_Country=g.selCountry.options(g.selCountry.selectedIndex).text;
  1802. if(g.UserStateTextBox.style.display!="none")
  1803. {
  1804. g_State=g.UserStateTextBox.value;
  1805. }
  1806. else if (g.selUSState.style.display!="none")
  1807. {
  1808. g_State=g.selUSState.options(g.selUSState.selectedIndex).text;
  1809. }
  1810. else
  1811. {
  1812. g_State=g.selCAProvince.options(g.selCAProvince.selectedIndex).text;
  1813. }
  1814. InfoObj.set_FirstName(g_FirstName);
  1815. InfoObj.set_LastName(g_LastName);
  1816. // InfoObj.set_MiddleInitial(g_MiddleName);
  1817. InfoObj.set_Country(g_Country);
  1818. InfoObj.set_State(g_State);
  1819. InfoObj.set_Address1(g_Address1);
  1820. InfoObj.set_Address2(g_Address2);
  1821. InfoObj.set_PrimaryEmail(g_EmailAddr);
  1822. InfoObj.set_Zip(g_ZipCode);
  1823. InfoObj.set_City(g_City);
  1824. TapiObj.set_CountryIndex(g.selCountry.selectedIndex);
  1825. InfoObj.set_CountryID(TapiObj.get_CountryID());
  1826. // Microsoft policy states that MSupdate should always be true whenever a user registers.
  1827. InfoObj.set_MSUpdate(true);
  1828. InfoObj.set_MSOffer(false);
  1829. if ((g_PostToMS==true) && (g.sharems.checked))
  1830. InfoObj.set_MSOffer(true);
  1831. InfoObj.set_OtherOffer(false);
  1832. if ((g_PostToMS==true) && (g.sharemsPartners.checked))
  1833. InfoObj.set_OtherOffer(true);
  1834. }
  1835. // We want the Reg3 checkboxes to be unchecked by default.
  1836. InfoObj.set_MSOffer(false);
  1837. InfoObj.set_OtherOffer(false);
  1838. function Reg3_LoadMe()
  1839. {
  1840. InitFrameRef();
  1841. CheckContrastMode();
  1842. GetPageTitle();
  1843. g_FirstFocusElement = g.UserFirstName;
  1844. if (IsFarEastLocale())
  1845. {
  1846. /*For JPN, CHT, CHS,
  1847. Last Name
  1848. First Name
  1849. Country/Region
  1850. Province
  1851. City
  1852. Address
  1853. Zip
  1854. E-Mail
  1855. For KOR only,
  1856. Full Name
  1857. Country/Region
  1858. Province
  1859. City
  1860. Address
  1861. Zip
  1862. E-Mail
  1863. */
  1864. g.MainPageCell.style.display="none"; // hide while we change order
  1865. // no middle name for far east langs
  1866. //g.MiddleNameRow.style.display="none";
  1867. g.FieldTable.moveRow(1,0); // move lastname in front of first
  1868. g.FieldTable.moveRow(6,2); // move country to after firstname
  1869. g.FieldTable.moveRow(6,3); // move province to after country
  1870. g.FieldTable.moveRow(6,4); // move city to after province
  1871. g.FE_ZIPLabel.innerHTML=g.LabelRight.innerHTML;
  1872. g.FE_ZIPInput.innerHTML=g.MenuRight.innerHTML;
  1873. g.FE_ZIPRow.style.display="inline";
  1874. g.LabelRight.innerHTML="";
  1875. g.MenuRight.innerHTML="";
  1876. // no reason to limit these lengths for FE, so just make them match others
  1877. g.UserZipCode.size=30;
  1878. g.UserZipCode.maxlength=120;
  1879. g.UserStateTextBox.size=30;
  1880. g.UserStateTextBox.maxlength=120;
  1881. g_FirstFocusElement = g.UserLastName;
  1882. if (IsKoreanLocale()) {
  1883. g.LastNameRow.style.display="none";
  1884. g.LabelFirstName.innerHTML=L_FullName_Text;
  1885. g_FirstFocusElement = g.UserFirstName;
  1886. }
  1887. g.MainPageCell.style.display="inline";
  1888. }
  1889. // limit width of country menu since some text options are very long
  1890. g.selCountry.style.width=g.UserEmailAddress.offsetWidth;
  1891. g.UserFirstName.value=g_FirstName;
  1892. //g.UserMiddleName.value=g_MiddleName;
  1893. g.UserLastName.value=g_LastName;
  1894. g.UserAddress.value=g_Address1;
  1895. g.UserAddress2.value=g_Address2;
  1896. g.UserZipCode.value=g_ZipCode;
  1897. g.UserEmailAddress.value=g_EmailAddr;
  1898. g.UserCity.value=g_City;
  1899. // placeholder idx 0 option is needed to fix 101447
  1900. // Due to a possible mshtml bug, the cursor is shifted right when the menu
  1901. // expands to its full width.
  1902. g.selUSState.remove(0);
  1903. for (var i = 0; i < StateAbbrevs.length; i++) {
  1904. var oOption = g.document.createElement("OPTION");
  1905. oOption.text = StateAbbrevs[i];
  1906. if (StateAbbrevs[i] == g_State)
  1907. {
  1908. g_StateIdx = i;
  1909. }
  1910. g.selUSState.add(oOption);
  1911. }
  1912. for (i = 0; i < ProvinceNames.length; i++) {
  1913. oOption = g.document.createElement("OPTION");
  1914. oOption.text = ProvinceNames[i];
  1915. if (ProvinceNames[i] == g_State)
  1916. {
  1917. g_StateIdx = i;
  1918. }
  1919. g.selCAProvince.add(oOption);
  1920. }
  1921. var fTapi = TapiObj.IsTAPIConfigured(); // init TAPI
  1922. /*
  1923. var ilen = TapiObj.get_NumOfCountry(); // get num of countries, also inits COM obj storage
  1924. for (var i = 0; i < ilen; i++)
  1925. {
  1926. var oOption = g.document.createElement("OPTION");
  1927. oOption.text = TapiObj.get_CountryNameForIndex(i);
  1928. g.selCountry.add(oOption);
  1929. }
  1930. */
  1931. g_CountryIdx = TapiObj.get_CountryIndex();
  1932. if(g_CountryIdx>=0)
  1933. {
  1934. g.selCountry.selectedIndex=g_CountryIdx;
  1935. if(g_Country == L_UnitedStates_Text)
  1936. {
  1937. g.selUSState.selectedIndex=g_StateIdx;
  1938. }
  1939. else if(g_Country == L_Canada_Text)
  1940. {
  1941. g.selCAProvince.selectedIndex=g_StateIdx;
  1942. }
  1943. else
  1944. g.UserStateTextBox.value=g_State;
  1945. }
  1946. else
  1947. {
  1948. // get default value
  1949. g.selCountry.selectedIndex = TapiObj.get_CountryIndex();
  1950. }
  1951. Reg3UserCountryChanged();
  1952. Reg3UserStateChanged();
  1953. var MSoffer_Checked = InfoObj.get_MSOffer();
  1954. if (MSoffer_Checked)
  1955. g.sharems.checked = true;
  1956. else
  1957. g.sharems.checked = false;
  1958. var MSotheroffer_Checked = InfoObj.get_OtherOffer();
  1959. if (MSotheroffer_Checked)
  1960. g.sharemsPartners.checked = true;
  1961. else
  1962. g.sharemsPartners.checked = false;
  1963. InitButtons();
  1964. g.error_mesg.innerHTML = L_RequiredField_Text;
  1965. g.error_mesg.style.display="inline";
  1966. var L_CNIL_Text = "<p>";
  1967. var L_CnilStyleDisplay_Text = "none";
  1968. g.cnil_mesg.innerHTML = L_CNIL_Text;
  1969. g.cnil_mesg.style.display=L_CnilStyleDisplay_Text;
  1970. window.setTimeout("DoFocus();",1000);
  1971. }
  1972. function GetCurrentProvince() {
  1973. if(g.selCountry.options(g.selCountry.selectedIndex).text == L_UnitedStates_Text) {
  1974. return g.selUSState.options(g.selUSState.selectedIndex).text;
  1975. } else if(g.selCountry.options(g.selCountry.selectedIndex).text == L_Canada_Text) {
  1976. return g.selCAProvince.options(g.selCAProvince.selectedIndex).text;
  1977. } else return g.UserStateTextBox.value;
  1978. }
  1979. function GetCurrentCountry() {
  1980. return g.selCountry.options(g.selCountry.selectedIndex).text;
  1981. }
  1982. var L_Email_Text="Please enter a valid E-mail address or leave the E-mail text box empty.";
  1983. var L_EnterValid_Text=" * Please fill in the required fields.";
  1984. var L_RequiredField_Text="* indicates required information";
  1985. var g_PostToMS = false;
  1986. var g_PostToOEM = false; // no oem stuff when we are in appmode.
  1987. var POST_TO_OEM = 1;
  1988. var POST_TO_MS = 2;
  1989. var bPostChkBxStateSaved = false;
  1990. // Update status pane and navigate
  1991. function ShownavigatetoPrivacy()
  1992. {
  1993. Navigate("actsetup\\aprvcyMS.htm");
  1994. SetTimerShowIFrame(100);
  1995. }
  1996. function navigatetoPrivacy(PrivPage)
  1997. {
  1998. if (g_CurrentCKPT == CKPT_REGISTER3)
  1999. Reg3SaveSettings();
  2000. if (g_CurrentCKPT == CKPT_REGISTER1)
  2001. {
  2002. if (g.rb_reg_1.checked)
  2003. g_Reg1RadioSticky = 1;
  2004. else if (g.rb_reg_2.checked)
  2005. g_Reg1RadioSticky = 2;
  2006. else
  2007. g_Reg1RadioSticky = null;
  2008. }
  2009. ShowIFrame('False');
  2010. window.setTimeout("ShownavigatetoPrivacy();",500);
  2011. }
  2012. function ShownavigatetoActPolicy()
  2013. {
  2014. Navigate("actsetup\\apolicy.htm");
  2015. SetTimerShowIFrame(100);
  2016. }
  2017. function navigatetoActPolicy()
  2018. {
  2019. if (g.rb_act_1.checked)
  2020. g_ActivationRadioSticky = 1;
  2021. else if (g.rb_act_2.checked)
  2022. g_ActivationRadioSticky = 2;
  2023. else if (g.rb_act_3.checked)
  2024. g_ActivationRadioSticky = 3;
  2025. else
  2026. g_ActivationRadioSticky = null;
  2027. ShowIFrame('False');
  2028. window.setTimeout("ShownavigatetoActPolicy();",500);
  2029. }
  2030. function VerifyReg3Fields() {
  2031. g.error_mesg.style.display="none";
  2032. var LastErrorField = null;
  2033. var CurReg3ErrStringArray = new Array();
  2034. // user needs to complete input of address/name
  2035. // this dynamically builds the list of erroneous fields to give to the user
  2036. if(g.UserEmailAddress.value != "") {
  2037. // do some validation on email address
  2038. // Note special regexpr char like '\S' must be double-\'d because they are inside a string
  2039. var re = new RegExp("^\\s*\\S+@\\S+\\.\\S\\S+","");
  2040. if(re.exec(g.UserEmailAddress.value) == null) {
  2041. LastErrorField = g.UserEmailAddress;
  2042. g.LabelEmail.className = "text-error";
  2043. } else {
  2044. g.LabelEmail.className = "text-primary";
  2045. }
  2046. }
  2047. var CurCountry=GetCurrentCountry();
  2048. // dont require state or zip except for US/Canada
  2049. if ((CurCountry == L_UnitedStates_Text)||(CurCountry == L_Canada_Text)) {
  2050. if(g.UserZipCode.value == "") {
  2051. LastErrorField = g.UserZipCode;
  2052. g.LabelZIP.className = "text-error";
  2053. } else {
  2054. g.LabelZIP.className = "text-primary";
  2055. }
  2056. if(GetCurrentProvince() == "") {
  2057. if(g.selUSState.style.display!="none") {
  2058. LastErrorField = g.selUSState;
  2059. } else {
  2060. LastErrorField = g.selCAProvince;
  2061. }
  2062. g.StateLabel.className = "text-error";
  2063. } else {
  2064. g.StateLabel.className = "text-primary";
  2065. }
  2066. }
  2067. if(g.UserCity.value == "") {
  2068. LastErrorField = g.UserCity;
  2069. g.LabelCity.className = "text-error";
  2070. } else {
  2071. g.LabelCity.className = "text-primary";
  2072. }
  2073. if(g.UserAddress.value == "") {
  2074. LastErrorField = g.UserAddress;
  2075. g.LabelAddress.className = "text-error";
  2076. } else {
  2077. g.LabelAddress.className = "text-primary";
  2078. }
  2079. if((g.UserLastName.value == "") && (g.LastNameRow.style.display!="none")) {
  2080. LastErrorField = g.UserLastName;
  2081. g.LabelLastName.className = "text-error";
  2082. } else {
  2083. g.LabelLastName.className = "text-primary";
  2084. }
  2085. if(g.UserFirstName.value == "") {
  2086. g.LabelFirstName.className = "text-error";
  2087. LastErrorField = g.UserFirstName;
  2088. } else {
  2089. g.LabelFirstName.className = "text-primary";
  2090. }
  2091. if(LastErrorField==null) {
  2092. return true;
  2093. }
  2094. // handle error
  2095. if(LastErrorField==g.UserEmailAddress) {
  2096. g.error_mesg.innerText = L_Email_Text;
  2097. } else {
  2098. g.error_mesg.innerText = L_EnterValid_Text;
  2099. }
  2100. g.error_mesg.className = "text-error";
  2101. g.error_mesg.style.display="inline";
  2102. try
  2103. {
  2104. g.btnNext.disabled=false;
  2105. }
  2106. catch(e) {}
  2107. try
  2108. {
  2109. g.btnBack.disabled=false;
  2110. }
  2111. catch(e) {}
  2112. try
  2113. {
  2114. g.btnSkip.disabled=false;
  2115. }
  2116. catch(e) {}
  2117. InitButtons();
  2118. LastErrorField.focus();
  2119. return false;
  2120. }
  2121. // Function: Start_CheckEnableNextButton
  2122. // Description: This function is called everytime a keyup
  2123. // event fires on a edit box for first, middle, or last
  2124. // name. We then see if we should enable or disable the
  2125. // next button based on if every field has a value.
  2126. // First || Last
  2127. //
  2128. function Start_CheckEnableNextButton()
  2129. {
  2130. try
  2131. {
  2132. if (g.event == null)
  2133. return;
  2134. }
  2135. catch(e)
  2136. {
  2137. return;
  2138. }
  2139. if (Start_CheckLengthRequirement() &&
  2140. Start_CheckLengthNotEqualSpaces())
  2141. {
  2142. g.btnNext.disabled = false;
  2143. }
  2144. else
  2145. {
  2146. g.btnNext.disabled = true;
  2147. }
  2148. InitButtons();
  2149. }
  2150. function Start_CheckLengthRequirement()
  2151. {
  2152. if ((g.edt_FirstName.value.length != 0) ||
  2153. (g.edt_LastName.value.length != 0))
  2154. return true;
  2155. else
  2156. return false;
  2157. }
  2158. function Start_CheckLengthNotEqualSpaces()
  2159. {
  2160. if ((g.edt_FirstName.value.length != NumberOfSpaces(g.edt_FirstName.value)) ||
  2161. (g.edt_LastName.value.length != NumberOfSpaces(g.edt_LastName.value)))
  2162. return true;
  2163. else
  2164. return false;
  2165. }
  2166. // END start.htm
  2167. //////////////////////////////////////////////////////////////////////////////////////
  2168. // General Default LoadMe function
  2169. //////////////////////////////////////////////////////////////////////////////////////
  2170. function _Default_LoadMe(SimpleBack, SimpleNext)
  2171. {
  2172. InitFrameRef();
  2173. CheckContrastMode();
  2174. if (g.btnNext != null)
  2175. g_FirstFocusElement = g.btnNext;
  2176. else if (g.btnSkip != null)
  2177. g_FirstFocusElement = g.btnSkip;
  2178. else if (g.btnBack != null)
  2179. g_FirstFocusElement = g.btnBack;
  2180. InitButtons(SimpleBack, SimpleNext);
  2181. if (g_FirstFocusElement != null)
  2182. window.setTimeout("DoFocus();",1000);
  2183. else
  2184. g.document.body.focus();
  2185. }
  2186. function New_Default_LoadMe(SimpleBack, SimpleNext)
  2187. {
  2188. InitFrameRef();
  2189. GetPageTitle();
  2190. CheckContrastMode();
  2191. if (g.btnNext != null)
  2192. g_FirstFocusElement = g.btnNext;
  2193. else if (g.btnSkip != null)
  2194. g_FirstFocusElement = g.btnSkip;
  2195. else if (g.btnBack != null)
  2196. g_FirstFocusElement = g.btnBack;
  2197. InitButtons(SimpleBack, SimpleNext);
  2198. window.setTimeout("DoFocus();",1000);
  2199. }
  2200. //////////////////////////////////////////////////////////////////////////////////////
  2201. // MISC Functions
  2202. //////////////////////////////////////////////////////////////////////////////////////
  2203. // Page Navigation
  2204. // InitCKPT, PushCKPT, PopCKPT, CKPTFromVal are meant to handle the behavior for GoBack.
  2205. // We only go back to certain pages (i.e., Mouse Tutorial, Sound Check).
  2206. // And on some of the pages, we only go back if they haven't been
  2207. // completed (i.e., EULA, PID).
  2208. //
  2209. // So, we push checkpoints if we intend to all coming back to that page.
  2210. // We pop checkpoints if we no longer want to come back (e.g., we've
  2211. // completed that page.
  2212. function InitCKPT()
  2213. {
  2214. dnCKPT[CKPT_ACTIV] = new CheckPoint("actsetup\\activ.htm", 0, 0, 0, 0);
  2215. dnCKPT[CKPT_ACTDONE] = new CheckPoint("actsetup\\actdone.htm", 0, 0, 0, 0);
  2216. dnCKPT[CKPT_ACTIVERR] = new CheckPoint("actsetup\\activerr.htm", 0, 0, 0, 0);
  2217. dnCKPT[CKPT_ACTIVSVC] = new CheckPoint("actsetup\\activsvc.htm", 0, 0, 0, 0);
  2218. dnCKPT[CKPT_REGISTER1] = new CheckPoint("actsetup\\areg1.htm", 0, 0, 0, 0);
  2219. dnCKPT[CKPT_REGISTER3] = new CheckPoint("actsetup\\ausrinfo.htm", 0, 0, 0, 0);
  2220. dnCKPT[CKPT_ACTCONN] = new CheckPoint("actsetup\\actconn.htm", 0, 0, 0, 0);
  2221. dnCKPT[CKPT_ACTLAN] = new CheckPoint("actsetup\\actlan.htm", 0, 0, 0, 0);
  2222. dnCKPT[CKPT_REGDIAL] = new CheckPoint("actsetup\\adrdyreg.htm", 0, 0, 0, 0);
  2223. dnCKPT[CKPT_ACT_MSG] = new CheckPoint("actsetup\\adeskerr.htm", 0, 0, 0, 0);
  2224. dnCKPT[CKPT_DONE] = new CheckPoint("actsetup\\aregdone.htm", 0, 0, 0, 0);
  2225. PopCKPT();
  2226. }
  2227. function PushCKPT(ckpt)
  2228. {
  2229. if (ckpt > 0 && ckpt < CKPT_MAX)
  2230. {
  2231. var tos = 0;
  2232. try
  2233. {
  2234. tos = ApiObj.get_RegValue(HKEY_LOCAL_MACHINE, OOBE_MAIN_REG_KEY + CKPT_REG_KEY, TOS_REG_VALUE);
  2235. }
  2236. catch (e) {}
  2237. ApiObj.set_RegValue(HKEY_LOCAL_MACHINE, OOBE_MAIN_REG_KEY + CKPT_REG_KEY, tos.toString(), ckpt);
  2238. ApiObj.set_RegValue(HKEY_LOCAL_MACHINE, OOBE_MAIN_REG_KEY + CKPT_REG_KEY, TOS_REG_VALUE, ++tos);
  2239. g_CurrentCKPT = ckpt;
  2240. }
  2241. }
  2242. function PopCKPT(ckptCheck)
  2243. {
  2244. var ckpt = 0;
  2245. try
  2246. {
  2247. var tos = ApiObj.get_RegValue(HKEY_LOCAL_MACHINE, OOBE_MAIN_REG_KEY + CKPT_REG_KEY, TOS_REG_VALUE);
  2248. if (tos > 0)
  2249. {
  2250. ckpt = ApiObj.get_RegValue(HKEY_LOCAL_MACHINE, OOBE_MAIN_REG_KEY + CKPT_REG_KEY, (tos - 1).toString());
  2251. if (null == ckptCheck || ckpt == ckptCheck)
  2252. {
  2253. ApiObj.set_RegValue(HKEY_LOCAL_MACHINE, OOBE_MAIN_REG_KEY + CKPT_REG_KEY, TOS_REG_VALUE, --tos);
  2254. ApiObj.DeleteRegValue(HKEY_LOCAL_MACHINE, OOBE_MAIN_REG_KEY + CKPT_REG_KEY, tos.toString());
  2255. }
  2256. }
  2257. }
  2258. catch (e) {}
  2259. if (ckpt > 0 && ckpt < CKPT_MAX)
  2260. {
  2261. g_CurrentCKPT = ckpt;
  2262. }
  2263. else
  2264. g_CurrentCKPT = null;
  2265. }
  2266. function URLFromCKPT(ckpt)
  2267. {
  2268. var str = "";
  2269. if (ckpt > 0 && ckpt < CKPT_MAX)
  2270. {
  2271. str = dnCKPT[ckpt].strURL;
  2272. }
  2273. return str;
  2274. }
  2275. function IndexFromCKPT(ckpt, status)
  2276. {
  2277. var index = 0;
  2278. if (ckpt > 0 && ckpt < CKPT_MAX)
  2279. {
  2280. var checkpoint = dnCKPT[ckpt];
  2281. index = checkpoint.rgindex[status];
  2282. }
  2283. return index;
  2284. }
  2285. function IsLocalFile()
  2286. {
  2287. try
  2288. {
  2289. return (-1 != g.location.protocol.indexOf("file"));
  2290. }
  2291. catch (e)
  2292. {
  2293. return false;
  2294. }
  2295. }
  2296. //////////////////////////////////////////////////////////////////////////////////////
  2297. // public navigation APIs
  2298. //////////////////////////////////////////////////////////////////////////////////////
  2299. function SetBack(strURL)
  2300. {
  2301. g_OEMAddBackURL = strURL;
  2302. }
  2303. function GoCancel(ckpt)
  2304. {
  2305. trace("GoCancel: CurrentCKPT = " + g_CurrentCKPT);
  2306. try
  2307. {
  2308. if (IsLocalFile() && g.event == null)
  2309. return;
  2310. }
  2311. catch(e)
  2312. {
  2313. return;
  2314. }
  2315. DisableAllButtons();
  2316. switch (g_CurrentCKPT)
  2317. {
  2318. case CKPT_REGDIAL:
  2319. if (InActivation_AppMode())
  2320. {
  2321. g_DoActivation = false;
  2322. ShowIFrame('False');
  2323. window.setTimeout("ExitWPA();",1000);
  2324. }
  2325. else
  2326. {
  2327. GoNavigate(CKPT_DONE);
  2328. }
  2329. break;
  2330. case CKPT_REGISTER3:
  2331. g_PostToMS = false;
  2332. GoNavigate(CKPT_REGDIAL);
  2333. break;
  2334. case CKPT_ACTLAN:
  2335. ActLan();
  2336. break;
  2337. }
  2338. }
  2339. function GoBack(ckpt)
  2340. {
  2341. trace("GoBack: CurrentCKPT = " + g_CurrentCKPT);
  2342. try
  2343. {
  2344. if (IsLocalFile() && g.event == null)
  2345. return;
  2346. }
  2347. catch(e)
  2348. {
  2349. return;
  2350. }
  2351. DisableAllButtons();
  2352. if (g_CurrentCKPT == g_DialCKPT)
  2353. ResetDialing();
  2354. if(g_CurrentCKPT == CKPT_REGISTER1)
  2355. {
  2356. if (g.rb_reg_1.checked)
  2357. g_Reg1RadioSticky = 1;
  2358. else if (g.rb_reg_2.checked)
  2359. g_Reg1RadioSticky = 2;
  2360. else
  2361. g_Reg1RadioSticky = null;
  2362. }
  2363. if(g_CurrentCKPT == CKPT_REGISTER3)
  2364. {
  2365. Reg3SaveSettings(); // save field settings in case we return to page
  2366. }
  2367. var ckptPrevious = g_CurrentCKPT;
  2368. PopCKPT();
  2369. if (ckptPrevious == g_CurrentCKPT)
  2370. {
  2371. // This handles the case where the current page pushed itself on the stack.
  2372. PopCKPT();
  2373. }
  2374. if (g_CurrentCKPT > 0 && g_CurrentCKPT < CKPT_MAX)
  2375. {
  2376. GoNavigate(g_CurrentCKPT);
  2377. }
  2378. }
  2379. function StatusNavigate()
  2380. {
  2381. var iMove = IndexFromCKPT(g_CurrentCKPT, g_status) - window.external.get_StatusIndex;
  2382. while (iMove > 0)
  2383. {
  2384. window.external.MoveNext();
  2385. --iMove;
  2386. }
  2387. while (iMove < 0)
  2388. {
  2389. window.external.MovePrevious();
  2390. ++iMove;
  2391. }
  2392. }
  2393. ////////////////////////////////////////////////////////////////////
  2394. // DON'T MUCK WITH THE POSITIONING OF THE CASES IN THE SWITCHS BELOW
  2395. ////////////////////////////////////////////////////////////////////
  2396. function ShowGoNavigate()
  2397. {
  2398. var ckptGoHere = g_ckpt_target;
  2399. switch (ckptGoHere)
  2400. {
  2401. case CKPT_REGDIAL:
  2402. trace("GoNavigate: CKPT_REGDIAL");
  2403. // Check if we are already connected
  2404. ResetConnectedToInternetEx();
  2405. if (!ConnectedToInternetEx(true))
  2406. {
  2407. // If not, try AutoDial
  2408. window.external.InternetAutodial();
  2409. // Check again. InternetAutodial returns success if the user cancels
  2410. ResetConnectedToInternetEx();
  2411. if (!ConnectedToInternetEx(true))
  2412. {
  2413. // We can't assume user has modem here
  2414. if (HasNetwork() && HasModem())
  2415. {
  2416. GoNavigate(CKPT_ACTCONN);
  2417. }
  2418. else if (HasNetwork())
  2419. {
  2420. GoNavigate(CKPT_ACTLAN);
  2421. }
  2422. else if (HasModem())
  2423. {
  2424. PushCKPT(ckptGoHere); // sets g_CurrentCKPT = ckptGoHere;
  2425. Navigate(URLFromCKPT(CKPT_REGDIAL));
  2426. }
  2427. else
  2428. {
  2429. GoNavigate(CKPT_ACTIVERR);
  2430. }
  2431. SetTimerShowIFrame(15000);
  2432. break;
  2433. }
  2434. else
  2435. {
  2436. g_InitAutodial = true;
  2437. }
  2438. }
  2439. IcsConnect(ICS_CONN_TYPE_REG);
  2440. SetTimerShowIFrame(ACTIVATION_TIMEOUT);
  2441. break;
  2442. case CKPT_ACT_MSG:
  2443. trace("GoNavigate: CKPT_ACT_MSG");
  2444. PushCKPT(ckptGoHere); // sets g_CurrentCKPT = ckptGoHere;
  2445. Navigate(URLFromCKPT(ckptGoHere));
  2446. SetTimerShowIFrame(5000);
  2447. break;
  2448. default:
  2449. trace("GoNavigate: default (" + ckptGoHere + " = " +
  2450. URLFromCKPT(ckptGoHere) + ")");
  2451. PushCKPT(ckptGoHere); // sets g_CurrentCKPT = ckptGoHere;
  2452. Navigate(URLFromCKPT(ckptGoHere));
  2453. SetTimerShowIFrame(1200);
  2454. break;
  2455. }
  2456. }
  2457. var g_ckpt_target = null;
  2458. var g_AfterConnectionDone = false;
  2459. function GoNavigate(ckptGoHere)
  2460. {
  2461. try
  2462. {
  2463. if (g_bStartup == false)
  2464. {
  2465. if (IsLocalFile())
  2466. {
  2467. if (g.event != null)
  2468. {
  2469. g.event.returnValue = false;
  2470. g.event.cancelBubble = true;
  2471. }
  2472. }
  2473. }
  2474. else
  2475. g_bStartup = false;
  2476. }
  2477. catch(e)
  2478. {
  2479. return;
  2480. }
  2481. g_ckpt_target = ckptGoHere;
  2482. var L_GeneratingInstall_Text = "Generating new Installation ID...";
  2483. var L_RetrievingCountry_Text = "Retrieving Installation ID...";
  2484. var L_ValidatingConn_Text = "Verifying activation...";
  2485. if (ckptGoHere==CKPT_REGDIAL)
  2486. {
  2487. ShowIFrame('False', L_CheckConnectivity_Text);
  2488. Span_WPA_MainTitle.innerText = L_BlankTitle_Text;
  2489. }
  2490. else if (ckptGoHere==CKPT_ACTIVSVC)
  2491. {
  2492. if (g_ActivSvc_Reload)
  2493. {
  2494. if (g_Load_InstallID)
  2495. ShowIFrame('False', L_GeneratingInstall_Text);
  2496. else
  2497. ShowIFrame('False', L_RetrievingCountry_Text);
  2498. Span_WPA_MainTitle.innerText = L_BlankTitle_Text;
  2499. }
  2500. else
  2501. {
  2502. g_ActivSvc_Reload = true;
  2503. }
  2504. }
  2505. else if (ckptGoHere==CKPT_ACT_MSG)
  2506. {
  2507. if (g_AfterConnectionDone)
  2508. {
  2509. g_AfterConnectionDone = false;
  2510. ShowIFrame('False', L_ValidatingConn_Text);
  2511. Span_WPA_MainTitle.innerText = L_BlankTitle_Text;
  2512. }
  2513. else
  2514. ShowIFrame('False');
  2515. }
  2516. else
  2517. {
  2518. ShowIFrame('False');
  2519. }
  2520. window.setTimeout("ShowGoNavigate();",500);
  2521. }
  2522. function ExitWPA()
  2523. {
  2524. window.external.Finish();
  2525. }
  2526. // Description: Disable all the buttons
  2527. // Used to prevent script error caused by
  2528. // double clicking or rapid clicking
  2529. // of two different buttons. E.g. when someone click
  2530. // next and back quickly.
  2531. //
  2532. function DisableAllButtons()
  2533. {
  2534. g.document.body.style.cursor="wait";
  2535. try
  2536. {
  2537. g.btnNext.className="buttons-disabled";
  2538. g.btnNext.disabled=true;
  2539. }
  2540. catch(e) {}
  2541. try
  2542. {
  2543. g.btnBack.className="buttons-disabled";
  2544. g.btnBack.disabled=true;
  2545. }
  2546. catch(e) {}
  2547. try
  2548. {
  2549. g.btnSkip.className="buttons-disabled";
  2550. g.btnSkip.disabled=true;
  2551. }
  2552. catch(e) {}
  2553. try
  2554. {
  2555. g.btnProdkey.className="buttons-disabled";
  2556. g.btnProdkey.disabled=true;
  2557. }
  2558. catch(e) {}
  2559. try
  2560. {
  2561. g.btnQuit.className="buttons-disabled";
  2562. g.btnQuit.disabled=true;
  2563. }
  2564. catch(e) {}
  2565. try
  2566. {
  2567. g.btnTelephone.className="buttons-disabled";
  2568. g.btnTelephone.disabled=true;
  2569. }
  2570. catch(e) {}
  2571. }
  2572. function GoQuit()
  2573. {
  2574. trace("GoQuit: CurrentCKPT = " + g_CurrentCKPT);
  2575. // var L_strCloseWindow_Text ="Click OK to exit registration reminder.";
  2576. // if (confirm(L_strCloseWindow_Text))
  2577. DisableAllButtons();
  2578. window.external.Finish();
  2579. }
  2580. function GoNext()
  2581. {
  2582. trace("GoNext: CurrentCKPT = " + g_CurrentCKPT);
  2583. try
  2584. {
  2585. if (IsLocalFile() && g.event == null)
  2586. return;
  2587. }
  2588. catch(e)
  2589. {
  2590. return;
  2591. }
  2592. DisableAllButtons();
  2593. switch (g_CurrentCKPT)
  2594. {
  2595. case CKPT_ACTIV:
  2596. if (g.rb_act_1.checked)
  2597. {
  2598. g_ActivationRadioSticky = 1;
  2599. g_DoActivation = true;
  2600. if (CheckForAnyConnection())
  2601. {
  2602. if (TapiObj.IsTapiServiceRunning())
  2603. {
  2604. GoNavigate(CKPT_REGISTER1);
  2605. }
  2606. else
  2607. {
  2608. GoNavigate(CKPT_REGDIAL);
  2609. }
  2610. }
  2611. else
  2612. {
  2613. g_PostToMS = false;
  2614. GoNavigate(CKPT_ACTIVERR);
  2615. }
  2616. }
  2617. else if (g.rb_act_2.checked)
  2618. {
  2619. g_ActivationRadioSticky = 2;
  2620. g_DoActivation = false;
  2621. g_CameFromFirstPage = true;
  2622. GoNavigate(CKPT_ACTIVSVC);
  2623. }
  2624. else
  2625. {
  2626. g_ActivationRadioSticky = 3;
  2627. g_DoActivation = false;
  2628. ShowIFrame('False');
  2629. window.setTimeout("ExitWPA();",1000);
  2630. }
  2631. break;
  2632. case CKPT_REGISTER1:
  2633. if (g.rb_reg_1.checked)
  2634. {
  2635. g_Reg1RadioSticky = 1;
  2636. g_PostToMS = true;
  2637. GoNavigate(CKPT_REGISTER3);
  2638. }
  2639. else
  2640. {
  2641. g_Reg1RadioSticky = 2;
  2642. g_PostToMS = false;
  2643. GoNavigate(CKPT_REGDIAL);
  2644. }
  2645. break;
  2646. case CKPT_ACTIVERR:
  2647. GoNavigate(CKPT_ACTIVSVC);
  2648. break;
  2649. case CKPT_ACTIVSVC:
  2650. GoNavigate(CKPT_DONE);
  2651. break;
  2652. case CKPT_REGISTER3:
  2653. if(VerifyReg3Fields())
  2654. {
  2655. Reg3SaveSettings();
  2656. GoNavigate(CKPT_REGDIAL);
  2657. }
  2658. break;
  2659. case CKPT_ACTCONN:
  2660. if (g.rb_conn_lan.checked)
  2661. {
  2662. g_ActConnRadioSticky = 1;
  2663. GoNavigate(CKPT_ACTLAN);
  2664. }
  2665. else
  2666. {
  2667. g_ActConnRadioSticky = 2;
  2668. PushCKPT(CKPT_REGDIAL);
  2669. Navigate(URLFromCKPT(CKPT_REGDIAL));
  2670. }
  2671. break;
  2672. case CKPT_ACTLAN:
  2673. ProxySettingsObj.UseAuto = g.cb_auto_detect.checked;
  2674. ProxySettingsObj.UseProxy = g.cb_use_proxy.checked;
  2675. ProxySettingsObj.Server = g.txt_proxy_url.value;
  2676. ProxySettingsObj.Port = g.txt_proxy_port.value;
  2677. window.external.set_ProxySettings(
  2678. ProxySettingsObj.UseAuto,
  2679. ProxySettingsObj.UseScript,
  2680. ProxySettingsObj.ScriptUrl,
  2681. ProxySettingsObj.UseProxy,
  2682. ProxySettingsObj.Server + ((ProxySettingsObj.Port == "") ? "" : (":" + ProxySettingsObj.Port))
  2683. );
  2684. ActLan();
  2685. break;
  2686. case CKPT_REGDIAL:
  2687. GoNavigate(CKPT_DONE);
  2688. break;
  2689. case CKPT_ACT_MSG:
  2690. if ( g_ActivationStatus != ERR_ACT_SUCCESS )
  2691. {
  2692. GoNavigate(CKPT_ACTIVSVC);
  2693. break;
  2694. }
  2695. // Fall through
  2696. case CKPT_DONE:
  2697. window.external.Finish();
  2698. break;
  2699. default:
  2700. // BUGBUG should we remove the default altogether?
  2701. break;
  2702. }
  2703. }
  2704. // BUGBUG temporary until MSN changes code
  2705. function GoOffline()
  2706. {
  2707. GoNext();
  2708. }
  2709. // Button Event Handlers and Initialization
  2710. function SetLastButtonText()
  2711. {
  2712. if (g.btnNext != null)
  2713. g_LastButtonText = g.btnNextText;
  2714. else if (g.btnBack != null)
  2715. g_LastButtonText = g.btnBackText;
  2716. else if (g.btnRestore != null)
  2717. g_LastButtonText = g.btnRestoreText;
  2718. else if (g.btnCancel != null)
  2719. g_LastButtonText = g.btnCancelText;
  2720. }
  2721. // Function: InitFrameRef
  2722. // Description: Sets up globals to point to buttons
  2723. // Since the buttons exist on the child frame,
  2724. // we want to have quick access to them without
  2725. // going through the collections.
  2726. // WARNING: Call this function at the top of XXX_LoadMe()
  2727. //
  2728. function InitFrameRef()
  2729. {
  2730. g_LastButtonText = null;
  2731. g_FirstFocusElement = null;
  2732. g_LastKeyDown = null;
  2733. g = document.frames("msoobeMain");
  2734. g.document.body.style.backgroundColor = "transparent";
  2735. try
  2736. {
  2737. g.document.body.onkeydown = OnKeyDown;
  2738. SetLastButtonText();
  2739. }
  2740. catch(e){}
  2741. }
  2742. function HideButtons(buttons)
  2743. {
  2744. if (null != g.btnBack && (buttons & HIDE_BACK))
  2745. {
  2746. g.btnBack.Hide = true;
  2747. }
  2748. if (null != g.btnNext && (buttons & HIDE_NEXT))
  2749. {
  2750. g.btnNext.Hide = true;
  2751. }
  2752. if (null != g.spanCancel && (buttons & HIDE_CANCEL))
  2753. {
  2754. g.btnSkip.Hide = true;
  2755. }
  2756. if (null != g.spanRestore && (buttons & HIDE_RESTORE))
  2757. {
  2758. g.btnRestore.Hide = true;
  2759. }
  2760. }
  2761. function HandleButtonMouseOver()
  2762. {
  2763. // if((!this.disabled)&&(this.tagName=="BUTTON"))
  2764. // this.className="buttons-hover";
  2765. }
  2766. function HandleButtonMouseOut()
  2767. {
  2768. // if((!this.disabled)&&(this.tagName=="BUTTON"))
  2769. // this.className="buttons";
  2770. }
  2771. function InitButtons(SimpleBack, SimpleNext)
  2772. {
  2773. if(g.btnSkip!=null) {
  2774. g.btnSkip.onmouseover = HandleButtonMouseOver;
  2775. g.btnSkip.onmouseout = HandleButtonMouseOut;
  2776. if(!g.btnSkip.disabled) {
  2777. g.btnSkip.onclick = GoCancel;
  2778. // dont enable onfocus,onblur handlers until issues in 88615 are resolved
  2779. // g.btnSkip.onfocus = HandleButtonMouseOver;
  2780. // g.btnSkip.onblur = HandleButtonMouseOut;
  2781. g.btnSkip.className="buttons";
  2782. } else {
  2783. g.btnSkip.className="buttons-disabled";
  2784. }
  2785. }
  2786. if (g.btnNext != null)
  2787. {
  2788. g.btnNext.onmouseover = HandleButtonMouseOver;
  2789. g.btnNext.onmouseout = HandleButtonMouseOut;
  2790. if (!g.btnNext.disabled)
  2791. {
  2792. if (SimpleNext == null)
  2793. {
  2794. g.btnNext.onclick = GoNext;
  2795. }
  2796. else
  2797. {
  2798. g.btnNext.onclick = SimpleNavNext;
  2799. }
  2800. g.btnNext.className="buttons";
  2801. }
  2802. else
  2803. {
  2804. g.btnNext.className="buttons-disabled";
  2805. }
  2806. }
  2807. if (g.btnBack != null)
  2808. {
  2809. g.btnBack.onmouseover = HandleButtonMouseOver;
  2810. g.btnBack.onmouseout = HandleButtonMouseOut;
  2811. if (!g.btnBack.disabled)
  2812. {
  2813. if (SimpleBack == null)
  2814. {
  2815. g.btnBack.onclick = GoBack;
  2816. }
  2817. else
  2818. {
  2819. g.btnBack.onclick = SimpleNavBack;
  2820. }
  2821. g.btnBack.className="buttons";
  2822. }
  2823. else
  2824. {
  2825. g.btnBack.className="buttons-disabled";
  2826. }
  2827. }
  2828. try
  2829. {
  2830. if(g.btnQuit != null) {
  2831. g.btnQuit.onmouseover = HandleButtonMouseOver;
  2832. g.btnQuit.onmouseout = HandleButtonMouseOut;
  2833. if(g.btnQuit.disabled == false) {
  2834. g.btnQuit.onclick = GoQuit;
  2835. g.btnQuit.className="buttons";
  2836. } else {
  2837. g.btnQuit.className="buttons-disabled";
  2838. }
  2839. }
  2840. } catch(e) {}
  2841. window.setTimeout("EnableDefaultCursor();",500);
  2842. }
  2843. function EnableDefaultCursor()
  2844. {
  2845. g.document.body.style.cursor="default";
  2846. }
  2847. var g_LastKeyDown = null;
  2848. function OnKeyDown()
  2849. {
  2850. try
  2851. {
  2852. if (IsLocalFile() && g.event == null)
  2853. return;
  2854. }
  2855. catch(e)
  2856. {
  2857. return;
  2858. }
  2859. if (g.event.altKey)
  2860. {
  2861. g_LastKeyDown = String.fromCharCode(g.event.keyCode);
  2862. if (g_LastKeyDown != null)
  2863. g_LastKeyDown = g_LastKeyDown.toUpperCase();
  2864. }
  2865. else
  2866. g_LastKeyDown = null;
  2867. }
  2868. // VALIDATION ROUTINES
  2869. function KeyPressIsNumeric()
  2870. {
  2871. try
  2872. {
  2873. if (IsLocalFile() && g.event == null)
  2874. return;
  2875. }
  2876. catch(e)
  2877. {
  2878. return;
  2879. }
  2880. if (!IsNumeric(g.event.keyCode))
  2881. {
  2882. g.event.keyCode = 0;
  2883. g.event.returnValue = false;
  2884. }
  2885. }
  2886. function IsNumeric(keyCode)
  2887. {
  2888. if ((keyCode >= 48/*0*/) && (keyCode <= 57/*9*/))
  2889. return true;
  2890. else
  2891. return false;
  2892. }
  2893. function IsSpecial(keyCode)
  2894. {
  2895. // BUGBUG DISABLED FOR BETA
  2896. /*
  2897. var bFound = false;
  2898. var iPosition = 0;
  2899. for (;iPosition < g_SpecialChars.length; iPosition++)
  2900. {
  2901. if (g_SpecialChars.charCodeAt(iPosition) == keyCode)
  2902. {
  2903. bFound = true;
  2904. break;
  2905. }
  2906. }
  2907. return bFound;
  2908. */
  2909. return false;
  2910. }
  2911. function KeyPressIsValid()
  2912. {
  2913. try
  2914. {
  2915. if (IsLocalFile() && g.event == null)
  2916. return;
  2917. }
  2918. catch(e)
  2919. {
  2920. return;
  2921. }
  2922. if (!IsAlpha(g.event.keyCode) &&
  2923. !IsSpecial(g.event.keyCode) &&
  2924. !IsNumeric(g.event.keyCode))
  2925. {
  2926. g.event.keyCode = 0;
  2927. g.event.returnValue = false;
  2928. }
  2929. }
  2930. function KeyPressIsAlpha()
  2931. {
  2932. try
  2933. {
  2934. if (IsLocalFile() && g.event == null)
  2935. return;
  2936. }
  2937. catch(e)
  2938. {
  2939. return;
  2940. }
  2941. if (!IsAlpha(g.event.keyCode))
  2942. {
  2943. g.event.keyCode = 0;
  2944. g.event.returnValue = false;
  2945. }
  2946. }
  2947. function IsAlpha(keyCode)
  2948. {
  2949. // BUGBUG DISABLED FOR BETA
  2950. /*
  2951. var strKeyCode = String.fromCharCode(keyCode);
  2952. var re1 = new RegExp("\w");
  2953. var re2 = new RegExp("\D");
  2954. strKeyCode.match(re1);
  2955. strKeyCode.match(re2);
  2956. //return ((strKeyCode.match(re1) != null) && (strKeyCode.match(re2) != null));
  2957. */
  2958. // if ((keyCode >= 97/*a*/ && keyCode <= 122/*z*/) ||
  2959. // (keyCode >= 65/*A*/ && keyCode <= 90 /*Z*/))
  2960. return true;
  2961. // else
  2962. // return false;
  2963. }
  2964. function NumberOfSpaces(strValue)
  2965. {
  2966. /*
  2967. var NASexp = RegExp("\s");
  2968. var result = strValue.match(NASexp);
  2969. return ((result == null) || (result.length != strValue.length));
  2970. */
  2971. var iSpaceCount = 0;
  2972. for (iPosition = 0; iPosition < strValue.length; iPosition ++)
  2973. {
  2974. if (strValue.charAt(iPosition) == ' ')
  2975. {
  2976. iSpaceCount++;
  2977. }
  2978. }
  2979. return iSpaceCount;
  2980. }
  2981. function KeyCodeToUpper()
  2982. {
  2983. var strKeyCode = String.fromCharCode(g.event.keyCode);
  2984. strKeyCode = strKeyCode.toUpperCase();
  2985. g.event.keyCode = strKeyCode.charCodeAt(0);
  2986. }
  2987. // END VALIDATION ROUTINES
  2988. var vCurItem = 0;
  2989. function SetupPageLayout()
  2990. {
  2991. var WPAWindowHeight = document.body.clientHeight;
  2992. var WPAWindowWidth = document.body.clientWidth;
  2993. if (window.external.IsServerSku())
  2994. {
  2995. document.body.bgColor = "#7A838A";
  2996. }
  2997. if(0 != window.external.Directions.get_AppMode())
  2998. {
  2999. document.all.ifrmMainFrame.style.height = WPAWindowHeight - 93;
  3000. document.all.ifrmMainFrame.style.width = WPAWindowWidth;
  3001. }
  3002. if (window.external.IsServerSku())
  3003. {
  3004. WPABackground.src = 'images/swpaback.jpg';
  3005. WPAKey.src = 'images/swpakey.jpg';
  3006. WPATop.src = 'images/swpatop.jpg';
  3007. WPABottom.src = 'images/swpabtm.jpg';
  3008. WPAFlag.src = 'images/swpaflag.jpg';
  3009. }
  3010. else
  3011. {
  3012. WPABackground.src = 'images/wpaback.jpg';
  3013. WPAKey.src = 'images/wpakey.jpg';
  3014. WPATop.src = 'images/wpatop.jpg';
  3015. WPABottom.src = 'images/wpabtm.jpg';
  3016. WPAFlag.src = 'images/wpaflag.jpg';
  3017. }
  3018. if (window.screen.colordepth < 16) {
  3019. document.body.bgColor = "#808080";
  3020. WPABackground.style.visibility = "hidden";
  3021. WPAKey.style.visibility = "hidden";
  3022. WPATop.style.visibility = "hidden";
  3023. WPABottom.style.visibility = "hidden";
  3024. WPAFlag.style.visibility = "hidden";
  3025. }
  3026. WPABottom.style.top = WPAWindowHeight - 45;
  3027. WPAKey.style.left = WPAWindowWidth - 237;
  3028. WPAKey.style.top = WPAWindowHeight - 315;
  3029. }
  3030. function CheckForAnyConnection()
  3031. {
  3032. var Capabilities = GetConnectionCapabilities();
  3033. return (Capabilities != CONNECTIONTYPE_INVALID &&
  3034. Capabilities != CONNECTIONTYPE_NONE);
  3035. }
  3036. var g_fSIFTimer = false;
  3037. var g_iSIFTimerID;
  3038. function SetTimerShowIFrame(iMilliSeconds)
  3039. {
  3040. // This function is intended to wrap SetTimer calls to ShowIFrame
  3041. // so that we don't get multiple overlapping calls to Show the IFrame
  3042. if (g_fSIFTimer)
  3043. {
  3044. try
  3045. {
  3046. window.clearTimeout(g_iSIFTimerID);
  3047. }
  3048. catch(e) {}
  3049. g_fSIFTimer = false;
  3050. }
  3051. g_iSIFTimerID = window.setTimeout("ShowIFrame();", iMilliSeconds);
  3052. g_fSIFTimer = true;
  3053. }
  3054. var g_ShowTransition = false;
  3055. function ShowIFrame(ShowIt, loadingstatus)
  3056. {
  3057. // Kill an existing timers
  3058. if (g_fSIFTimer)
  3059. {
  3060. try
  3061. {
  3062. window.clearTimeout(g_iSIFTimerID);
  3063. }
  3064. catch(e) {}
  3065. g_fSIFTimer = false;
  3066. }
  3067. if (g_ShowTransition)
  3068. {
  3069. WPATransContainer.filters[0].Apply();
  3070. }
  3071. if (ShowIt == null)
  3072. {
  3073. // Show Iframe
  3074. WPA_DIV2.style.visibility="visible";
  3075. WPA_DIV1.style.visibility="hidden";
  3076. PageStatus.style.visibility="hidden";
  3077. WPAProgressbar.style.visibility = "hidden";
  3078. if (g_ShowTransition)
  3079. {
  3080. WPATransContainer.filters[0].Play();
  3081. }
  3082. }
  3083. else
  3084. {
  3085. // Hide Iframe
  3086. WPA_DIV2.style.visibility="hidden";
  3087. WPA_DIV1.style.visibility="visible";
  3088. if (g_ShowTransition)
  3089. {
  3090. WPATransContainer.filters[0].Play();
  3091. }
  3092. // Show progress text...
  3093. if (loadingstatus!=null)
  3094. {
  3095. PageStatus.style.visibility="visible";
  3096. PageStatus.innerHTML=loadingstatus;
  3097. WPAProgressbar.style.visibility = "hidden"; // lets hide this for now...
  3098. }
  3099. else
  3100. {
  3101. PageStatus.style.visibility="hidden";
  3102. WPAProgressbar.style.visibility = "hidden";
  3103. }
  3104. }
  3105. }
  3106. window.onresize = SetupPageLayout;
  3107. var g_Already_Activated;
  3108. function InitApplication()
  3109. {
  3110. // Make sure all the services have started up
  3111. window.external.ComputerNameChangeComplete(false);
  3112. WPATransContainer.style.display="inline";
  3113. try
  3114. {
  3115. g_Already_Activated = window.external.NeedActivation();
  3116. }
  3117. catch(e)
  3118. {
  3119. g_Already_Activated = 999;
  3120. }
  3121. // 0 means activation is not needed or has already occurred.
  3122. if (g_Already_Activated == 0)
  3123. {
  3124. // If we're here, Windows is already activated and all we need is to show CKPT_ACTDONE.
  3125. SetupPageLayout();
  3126. InitFrameRef();
  3127. g_status = STATUS_OFF;
  3128. g_DoActivation = false;
  3129. InitCKPT();
  3130. if (0 != DirObj.get_AppMode)
  3131. {
  3132. do
  3133. {
  3134. PopCKPT();
  3135. }
  3136. while (null != g_CurrentCKPT);
  3137. }
  3138. GoNavigate(CKPT_ACTDONE);
  3139. SetTimerShowIFrame(900);
  3140. }
  3141. else if (g_Already_Activated == 999)
  3142. {
  3143. window.external.Finish();
  3144. }
  3145. else
  3146. {
  3147. SetupPageLayout();
  3148. g_bStartup = true;
  3149. InitFrameRef();
  3150. GetConnectionCapabilities();
  3151. g_status = STATUS_OFF;
  3152. g_DoActivation = true;
  3153. CheckForAnyConnection();
  3154. InitCKPT();
  3155. // if we are in appmode, we must nuke the stack and restart each time
  3156. if (0 != DirObj.get_AppMode)
  3157. {
  3158. do
  3159. {
  3160. PopCKPT();
  3161. }
  3162. while (null != g_CurrentCKPT);
  3163. }
  3164. GoNavigate(CKPT_ACTIV);
  3165. SetTimerShowIFrame(900);
  3166. }
  3167. }
  3168. function loadTransitionFilter()
  3169. {
  3170. document.all.WPATransContainer.style.display = "none";
  3171. document.all.WPATransContainer.style.position = "absolute";
  3172. document.all.WPATransContainer.style.top = 0;
  3173. document.all.WPATransContainer.style.left = 0;
  3174. document.all.WPATransContainer.style.width = "100%";
  3175. document.all.WPATransContainer.style.height = "100%";
  3176. if ((window.screen.colordepth >= 16) && window.external.UseFadeEffect())
  3177. {
  3178. document.all.WPATransContainer.style.filter = "progid:DXImageTransform.Microsoft.Fade(duration=0.2,overlap=0.8)";
  3179. try
  3180. {
  3181. if (WPATransContainer.filters[0])
  3182. {
  3183. g_ShowTransition = true;
  3184. }
  3185. }
  3186. catch(e)
  3187. {
  3188. }
  3189. }
  3190. }
  3191. </script>
  3192. </HEAD>
  3193. <BODY topMargin=0 bgcolor="#4E6FD6" leftMargin=0 onload="loadTransitionFilter();InitApplication();" scroll=no tabIndex=-1 rightMargin=0>
  3194. <!-- WPA images, dynamic layout positioning will be done in SetupPageLayout() function -->
  3195. <IMG ID=WPABackground style="LEFT: 0px; TOP: 0px; POSITION: absolute; z-index:-99;" alt="">
  3196. <IMG ID=WPAKey style="LEFT: 0px; TOP: 0px; POSITION: absolute; z-index:-98;" alt="">
  3197. <IMG ID=WPATop style="LEFT: 0px; TOP: 0px; POSITION: absolute; z-index:-97;" alt="">
  3198. <IMG ID=WPABottom style="LEFT: 0px; TOP: 0px; POSITION: absolute; z-index:-96;" alt="">
  3199. <!-- Don't alter this table structure. It's designed to support BiDi and Non-BiDi. -->
  3200. <TABLE WIDTH="95%" BORDER=0 style="POSITION: absolute; LEFT: 20px; TOP: 0px;" CELLPADDING=0 CELLSPACING=0>
  3201. <TR>
  3202. <TD nowrap VALIGN=MIDDLE>
  3203. <SPAN id=Span_WPA_MainTitle class="title" style="height: 28px;" tabIndex=-1>
  3204. </SPAN>
  3205. </TD>
  3206. <TD WIDTH="99%">&nbsp;
  3207. </TD>
  3208. <TD VALIGN=TOP>
  3209. <IMG ID=WPAFlag alt="">
  3210. </TD>
  3211. </TR>
  3212. </TABLE>
  3213. <span ID="WPATransContainer">
  3214. <!-- First Content (by design, don't remove) -->
  3215. <span ID="WPA_DIV1" STYLE="POSITION: absolute; left:0; top:0; width=100%; height=100%; background-Color: transparent;">
  3216. <table border=0 width="100%" height="100%" class="text-primary">
  3217. <tr>
  3218. <td valign=middle align=center>
  3219. <span id=PageStatus></span>
  3220. <br>
  3221. <span id=WPAProgressbar style="visibility:hidden;"><img src="images/progress.gif"></span>
  3222. </td>
  3223. </tr>
  3224. </table>
  3225. </span>
  3226. <!-- Actual Content -->
  3227. <span id="WPA_DIV2" style="visibility: hidden; POSITION: absolute; LEFT: 0px; TOP: 48px; width=100%; height=100%;" tabIndex=-1>
  3228. <IFRAME ALLOWTRANSPARENCY="true" frameBorder=no width="100%" height="100%" id=ifrmMainFrame name=msoobeMain src="about:blank" tabIndex=0></IFRAME>
  3229. </span>
  3230. </span>
  3231. </BODY>
  3232. </HTML>