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

1751 lines
45 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. <script language=jscript src="oobeutil.js"></script>
  6. <script language=jscript>
  7. // This is intended to hold all the script needed
  8. // in the default & offline OOBE HTML pages.
  9. //
  10. // We want to separate the layout (HTML) from the script.
  11. // At the same time, it's helpful to have all the code
  12. // in one place to make it easier to understand the flow
  13. // from page to page.
  14. // Status location constants
  15. var STATUS_MSN = 0;
  16. var STATUS_OEM = 1;
  17. var STATUS_NONE = 2;
  18. var STATUS_OFF = 3;
  19. var STATUS_MAX = 4;
  20. var SNDX_WELCOME = 0;
  21. var SNDX_MSN_ISP = 1;
  22. var SNDX_MSN_REG = 2;
  23. var SNDX_MSN_FINISH = 3;
  24. var SNDX_OEM_REG = 1;
  25. var SNDX_OEM_ISP = 2;
  26. var SNDX_OEM_FINISH = 3;
  27. var SNDX_NONE_REG = 1;
  28. var SNDX_NONE_FINISH = 2;
  29. function CheckPoint(strURL, i1, i2, i3, i4)
  30. {
  31. this.strURL = strURL;
  32. this.rgindex = new Array(STATUS_MAX);
  33. this.rgindex[STATUS_MSN] = i1;
  34. this.rgindex[STATUS_OEM] = i2;
  35. this.rgindex[STATUS_NONE] = i3;
  36. this.rgindex[STATUS_OFF] = i4;
  37. }
  38. // Checkpoint constants
  39. var CKPT_START = 1;
  40. var CKPT_TAPI = 2;
  41. var CKPT_CONNECT = 3;
  42. var CKPT_MODEMCANCEL = 4;
  43. var CKPT_DIALTONE = 5;
  44. var CKPT_NOTAVAIL = 6;
  45. var CKPT_SRVERROR = 7;
  46. var CKPT_TOOBUSY = 8;
  47. var CKPT_CONNECTERROR = 9;
  48. var CKPT_NOANSWER = 10;
  49. var CKPT_HANDSHAKE = 11;
  50. var CKPT_INSERROR = 12;
  51. var CKPT_ISPTOOBUSY = 13;
  52. var CKPT_ISPNOCONNECT = 14;
  53. var CKPT_ISPRESET = 15;
  54. var CKPT_MAX = 16; // ALWAYS set this to be the biggest value!
  55. var dnCKPT = new Array(CKPT_MAX);
  56. // Checkpoint breadcrumbs
  57. var g_CurrentCKPT = null;
  58. var g_DialCKPT = null;
  59. var HKEY_LOCAL_MACHINE = 0x80000002;
  60. var OOBE_MAIN_REG_KEY = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\OOBE";
  61. var CKPT_REG_KEY = "\\CKPT";
  62. var TOS_REG_VALUE = "TOS";
  63. // CheckDialReady errors
  64. var ERR_COMM_NO_ERROR = 0;
  65. var ERR_COMM_OOBE_COMP_MISSING = 1;
  66. var ERR_COMM_UNKNOWN = 2; // Unknow error, check input parameters
  67. var ERR_COMM_NOMODEM = 3; // There is no modem installed
  68. var ERR_COMM_RAS_TCP_NOTINSTALL = 4;
  69. // Dialing errors. Look at raserror.h for details
  70. var DERR_DIALTONE = 680;
  71. var DERR_BUSY = 676;
  72. var DERR_VOICEANSWER = 677;
  73. var DERR_NOANSWER = 678;
  74. var DERR_NO_CARRIER = 679;
  75. var DERR_HARDWARE_FAILURE = 630; // modem turned off
  76. var DERR_PORT_ALREADY_OPEN = 602; // procomm/hypertrm/RAS has COM port
  77. var DERR_PORT_OR_DEVICE = 692; // got this when hypertrm had the device open -- jmazner
  78. var DERR_PPP_TIMEOUT = 718;
  79. // Finish errors
  80. var FINISH_OK = 0x00000000;
  81. var FINISH_REBOOT = 0x00000001;
  82. // Language reboot return codes
  83. var LANGUAGE_REBOOT_NEVER = 0;
  84. var LANGUAGE_REBOOT_NOW = 1;
  85. var LANGUAGE_REBOOT_END = 2;
  86. // on-the-fly button hiding
  87. var HIDE_BACK = 0x0001;
  88. var HIDE_NEXT = 0x0002;
  89. var HIDE_CANCEL = 0x0004;
  90. var HIDE_RESTORE = 0x0008;
  91. // BUGBUG temp GUIDs
  92. var NOLAUNCHISPSIGNUP = "{C37D92A5-CA34-11d2-B71C-00C04F794977}";
  93. var MSNCOMPLETED = "{1C0A22F2-CB6B-11d2-B544-00A0C949DA70}";
  94. // window.external object caches
  95. var TapiObj = null;
  96. var InfoObj = null;
  97. var StatusObj = null;
  98. var DirObj = null;
  99. var ApiObj = null;
  100. // general globals and status
  101. var g_strISPFile = "";
  102. var g_bStartup;
  103. var g_LastButtonText = null;
  104. var g_FirstFocusElement = null;
  105. var g = null;
  106. var g_SpecialChars = ".'-` ";
  107. var g_OOBEDir = "file://" + window.external.API.get_SystemDirectory() + "\\oobe\\";
  108. var g_bRedial = false;
  109. var g_LineProblem = 0;
  110. var g_bFirstServerError = true;
  111. var g_status = STATUS_OFF;
  112. var g_ServerErrorCount = 0;
  113. var g_DialingAvailableInCountry = true;
  114. var g_ModalDialogUp = false;
  115. // preload image caches
  116. var g_ImgClick = new Image();
  117. var g_ImgDisabled = new Image();
  118. var g_ImgHover = new Image();
  119. var g_ImgDefault = new Image();
  120. var g_ImgLeftClickSingle = new Image();
  121. var g_ImgLeftDefaultSingle = new Image();
  122. var g_ImgLeftDisabledSingle = new Image();
  123. var g_ImgLeftHoverSingle = new Image();
  124. var g_ImgRightClickSingle = new Image();
  125. var g_ImgRightDefaultSingle = new Image();
  126. var g_ImgRightDisabledSingle = new Image();
  127. var g_ImgRightHoverSingle = new Image();
  128. var g_ImgLeftClick = new Image();
  129. var g_ImgLeftDefault = new Image();
  130. var g_ImgLeftDisabled = new Image();
  131. var g_ImgLeftHover = new Image();
  132. var g_ImgRightClick = new Image();
  133. var g_ImgRightDefault = new Image();
  134. var g_ImgRightDisabled = new Image();
  135. var g_ImgRightHover = new Image();
  136. var g_ImgLeftClickWide = new Image();
  137. var g_ImgLeftDefaultWide = new Image();
  138. var g_ImgLeftDisabledWide = new Image();
  139. var g_ImgLeftHoverWide = new Image();
  140. var g_ImgRightClickWide = new Image();
  141. var g_ImgRightDefaultWide = new Image();
  142. var g_ImgRightDisabledWide = new Image();
  143. var g_ImgRightHoverWide = new Image();
  144. var ImgDialingAni = new Image();
  145. var ImgNegotiatingAni = new Image();
  146. var ImgConnectedAni = new Image();
  147. var ImgLastConnectImage = new Image();
  148. ImgDialingAni.src = g_OOBEDir + "images/dial_ani.gif";
  149. ImgNegotiatingAni.src = g_OOBEDir + "images/neg_ani.gif";
  150. ImgConnectedAni.src = g_OOBEDir + "images/con_ani.gif";
  151. var g_ImagesAtStage = new Array(4);
  152. var g_ImgConfetti = new Image();
  153. var g_ImgFlagAni = new Image();
  154. g_ImgFlagAni.src = g_OOBEDir + "images/flagani.gif"
  155. g_ImgClick.src = g_OOBEDir + "images/click.gif";
  156. g_ImgDisabled.src = g_OOBEDir + "images/disabled.gif";
  157. g_ImgHover.src = g_OOBEDir + "images/hover.gif";
  158. g_ImgDefault.src = g_OOBEDir + "images/default.gif";
  159. g_ImgLeftClickSingle.src = g_OOBEDir + "images/clickl.gif";
  160. g_ImgLeftDefaultSingle.src = g_OOBEDir + "images/defaultl.gif";
  161. g_ImgLeftDisabledSingle.src = g_OOBEDir + "images/disabldl.gif";
  162. g_ImgLeftHoverSingle.src = g_OOBEDir + "images/hoverl.gif";
  163. g_ImgRightClickSingle.src = g_OOBEDir + "images/clickr.gif";
  164. g_ImgRightDefaultSingle.src = g_OOBEDir + "images/defaultr.gif";
  165. g_ImgRightDisabledSingle.src = g_OOBEDir + "images/disabldr.gif";
  166. g_ImgRightHoverSingle.src = g_OOBEDir + "images/hoverr.gif";
  167. g_ImgLeftClick.src = g_OOBEDir + "images/lftclk.gif";
  168. g_ImgLeftDefault.src = g_OOBEDir + "images/lftdef.gif";
  169. g_ImgLeftDisabled.src = g_OOBEDir + "images/lftdsld.gif";
  170. g_ImgLeftHover.src = g_OOBEDir + "images/lfthvr.gif";
  171. g_ImgRightClick.src = g_OOBEDir + "images/rhtclk.gif";
  172. g_ImgRightDefault.src = g_OOBEDir + "images/rhtdef.gif";
  173. g_ImgRightDisabled.src = g_OOBEDir + "images/rhtdsld.gif";
  174. g_ImgRightHover.src = g_OOBEDir + "images/rhthvr.gif";
  175. g_ImgLeftClickWide.src = g_OOBEDir + "images/lftclkw.gif";
  176. g_ImgLeftDefaultWide.src = g_OOBEDir + "images/lftdefw.gif";
  177. g_ImgLeftDisabledWide.src = g_OOBEDir + "images/lftdsldw.gif";
  178. g_ImgLeftHoverWide.src = g_OOBEDir + "images/lfthvrw.gif";
  179. g_ImgRightClickWide.src = g_OOBEDir + "images/rhtclkw.gif";
  180. g_ImgRightDefaultWide.src = g_OOBEDir + "images/rhtdefw.gif";
  181. g_ImgRightDisabledWide.src = g_OOBEDir + "images/rhtdsldw.gif";
  182. g_ImgRightHoverWide.src = g_OOBEDir + "images/rhthvrw.gif";
  183. // Mandatory Initialization Code
  184. if (null == ApiObj)
  185. {
  186. ApiObj = new Object;
  187. ApiObj = window.external.API;
  188. }
  189. if (null == StatusObj)
  190. {
  191. StatusObj = new Object;
  192. StatusObj = window.external.Status;
  193. }
  194. if (null == DirObj)
  195. {
  196. DirObj = new Object;
  197. DirObj = window.external.Directions;
  198. }
  199. if (null == InfoObj)
  200. {
  201. InfoObj = new Object;
  202. InfoObj = window.external.UserInfo;
  203. }
  204. // END Initialization Code
  205. //////////////////////////////////////////////////////////////////////////////////////
  206. // tapi.htm
  207. //////////////////////////////////////////////////////////////////////////////////////
  208. function TapiLoadMe()
  209. {
  210. InitFrameRef();
  211. ResetDialing();
  212. g_FirstFocusElement = g.selCountry;
  213. if (null == TapiObj)
  214. {
  215. TapiObj = new Object;
  216. TapiObj = window.external.Tapi;
  217. }
  218. RetrieveTapi();
  219. Tapi_CountryChange();
  220. g_FirstFocusElement.focus();
  221. }
  222. function Tapi_AreaCodeChange()
  223. {
  224. try
  225. {
  226. if (g.event == null)
  227. return;
  228. }
  229. catch(e)
  230. {
  231. return;
  232. }
  233. if (window.external.Tapi.IsAreaCodeRequired(g.selCountry.selectedIndex) &&
  234. window.external.CheckPhoneBook("msobe.isp") &&
  235. g.edtAreaCode.value.length == 0)
  236. g.btnNext.disabled = true;
  237. else
  238. g.btnNext.disabled = false;
  239. InitButtons();
  240. }
  241. function Tapi_CountryChange()
  242. {
  243. try
  244. {
  245. if (g.event == null)
  246. return;
  247. }
  248. catch(e)
  249. {
  250. return;
  251. }
  252. TapiObj.set_CountryIndex = g.selCountry.selectedIndex;
  253. if (window.external.CheckPhoneBook("msobe.isp"))
  254. {
  255. g.div_MSNNotAvailable.style.visibility = "hidden";
  256. g.spn_AdditionalSettings.style.visibility = "visible";
  257. g_DialingAvailableInCountry = true;
  258. }
  259. else
  260. {
  261. g.div_MSNNotAvailable.style.visibility = "visible";
  262. g.spn_AdditionalSettings.style.visibility = "hidden";
  263. g_DialingAvailableInCountry = false;
  264. }
  265. tapi_OutsideLineClicked();
  266. Tapi_AreaCodeChange();
  267. }
  268. function StoreTapi()
  269. {
  270. TapiObj.set_CountryIndex = g.selCountry.selectedIndex;
  271. TapiObj.set_AreaCode = g.edtAreaCode.value;
  272. if(g.radioTouchToneYes.checked)
  273. TapiObj.set_PhoneSystem = 1; //touch tone
  274. else
  275. TapiObj.set_PhoneSystem = 0; //rotary
  276. TapiObj.set_DialOut = g.edtOutsideLine.value;
  277. }
  278. function RetrieveTapi()
  279. {
  280. var fTapi = TapiObj.IsTAPIConfigured;
  281. g.selCountry.selectedIndex = TapiObj.get_CountryIndex;
  282. g.edtAreaCode.value = TapiObj.get_AreaCode;
  283. if(1 == TapiObj.get_PhoneSystem)
  284. g.radioTouchToneYes.checked = true; //touch tone
  285. else
  286. g.radioTouchToneNo.checked = true; //rotary
  287. g.edtOutsideLine.value = TapiObj.get_DialOut;
  288. if(g.edtOutsideLine.value != "")
  289. g.radioOutSideLineYes.checked = true; //use a number to dial out
  290. else
  291. g.radioOutSideLineNo.checked = true; //don't use a number to dial out
  292. }
  293. function tapi_OutsideLineClicked()
  294. {
  295. var L_OutSideLine_Text = "9"; //global variable number used to dial outside line
  296. try
  297. {
  298. if (g.event == null)
  299. return;
  300. }
  301. catch(e)
  302. {
  303. return;
  304. }
  305. if (g.radioOutSideLineYes.checked == true &&
  306. g.spn_AdditionalSettings.style.visibility == "visible")
  307. {
  308. g.spanOutsideLine.style.visibility = "visible";
  309. g.edtOutsideLine.style.visibility = "visible";
  310. g.edtOutsideLine.value = TapiObj.get_DialOut;
  311. if (g.edtOutsideLine.value.length == 0)
  312. g.edtOutsideLine.value = L_OutSideLine_Text;
  313. }
  314. else
  315. {
  316. g.spanOutsideLine.style.visibility = "hidden";
  317. g.edtOutsideLine.style.visibility = "hidden";
  318. g.spanOutsideLine.style.visibility = "hidden";
  319. g.edtOutsideLine.value = ""; //nuke out any outside line value
  320. }
  321. }
  322. // END tapi.htm
  323. //////////////////////////////////////////////////////////////////////////////////////
  324. // connect.htm
  325. //////////////////////////////////////////////////////////////////////////////////////
  326. function connect_LoadMe()
  327. {
  328. InitFrameRef();
  329. g_FirstFocusElement = g.btnCancelText;
  330. if (g != null)
  331. {
  332. if (g.btnBack != null)
  333. {
  334. g.btnBack.disabled = true;
  335. }
  336. }
  337. InitButtons();
  338. setTimeout("DoDialExternal()" , 40); //BUGBUG #define this at the top, and why do we have to wait 40 milliseconds anyway?
  339. g_FirstFocusElement.focus();
  340. }
  341. function ResetDialing()
  342. {
  343. g_bRedial = false;
  344. g_LineProblem = 0;
  345. g_bFirstServerError = true;
  346. g_strISPFile = "";
  347. window.external.Hangup();
  348. }
  349. function SetDialing(strISPFile)
  350. {
  351. g_strISPFile = strISPFile;
  352. g_DialCKPT = g_CurrentCKPT;
  353. g_ModalDialogUp = false;
  354. }
  355. function DoDialExternal()
  356. {
  357. SetDialing("msobe.isp");
  358. DoDial();
  359. }
  360. function DoDial()
  361. {
  362. if (g != null)
  363. {
  364. if (g.spnDialing != null)
  365. g.spnDialing.style.color = 0x990000;
  366. if (g.imgDialing != null)
  367. {
  368. ImgLastConnectImage.src = g.imgDialing.src;
  369. g.imgDialing.src = ImgDialingAni.src;
  370. }
  371. }
  372. if (g_bRedial)
  373. {
  374. window.external.ReDial(g_strISPFile);
  375. }
  376. else
  377. {
  378. window.external.Dial(g_strISPFile);
  379. }
  380. }
  381. function Redial()
  382. {
  383. if (g != null && g.Connect_REDIALINFO != null)
  384. {
  385. g.Connect_REDIALINFO.style.visibility = "visible";
  386. }
  387. if (g != null && g.btnBack != null)
  388. {
  389. g.btnBack.disabled = true;
  390. }
  391. DoDial();
  392. }
  393. <!--REQUIRED FUNCTION NAME:: DO NOT OVERLOAD OR ALTER-->
  394. function OnDialingEx()
  395. {
  396. g_bRedial = true;
  397. if (g != null && g.spnDialing != null)
  398. g.spnDialing.innerText = window.external.get_DialNumber;
  399. if (g != null)
  400. {
  401. if (g.btnBack != null)
  402. {
  403. g.btnBack.disabled = false;
  404. }
  405. InitPairedButton(g.spanBack, g.btnBack, g.btnBackText, g_ImgLeftDefault, g_ImgLeftDisabled,
  406. g_ImgLeftDefaultSingle, g_ImgLeftDisabledSingle,
  407. g.spanNext, "backButton", "backButtonText");
  408. }
  409. }
  410. <!--REQUIRED FUNCTION NAME:: DO NOT OVERLOAD OR ALTER-->
  411. function OnConnectingEx()
  412. {
  413. //alert("Connecting");
  414. if (g != null)
  415. {
  416. if (g.spnDialing != null)
  417. g.spnDialing.style.color = 0x999999;
  418. if (g.imgDialing != null)
  419. g.imgDialing.src = "../images/dial_off.gif";
  420. if (g.imgNegotiating != null)
  421. {
  422. ImgLastConnectImage.src = g.imgNegotiating.src;
  423. g.imgNegotiating.src = ImgNegotiatingAni.src;
  424. }
  425. }
  426. }
  427. <!--REQUIRED FUNCTION NAME:: DO NOT OVERLOAD OR ALTER-->
  428. function OnDownloadingEx()
  429. {
  430. //alert("Downloading");
  431. if (g != null)
  432. {
  433. if (g.spnDialing != null)
  434. g.spnDialing.style.color = 0x999999;
  435. if (g.imgNegotiating != null)
  436. g.imgNegotiating.src = "../images/neg_off.gif";
  437. if (g.imgConnected != null)
  438. g.imgConnected.src = ImgConnectedAni.src;
  439. }
  440. }
  441. <!--REQUIRED FUNCTION NAME:: DO NOT OVERLOAD OR ALTER-->
  442. function OnDisconnectEx()
  443. {
  444. //alert("Disconnected");
  445. }
  446. <!--REQUIRED FUNCTION NAME:: DO NOT OVERLOAD OR ALTER-->
  447. function OnDialingErrorEx(derr)
  448. {
  449. if (g_ModalDialogUp)
  450. {
  451. g_ModalDialogUp = false;
  452. return;
  453. }
  454. window.external.Hangup();
  455. g_LineProblem++;
  456. if (g_CurrentCKPT == g_DialCKPT)
  457. {
  458. switch (derr)
  459. {
  460. case DERR_PORT_OR_DEVICE:
  461. case DERR_PORT_ALREADY_OPEN:
  462. case DERR_HARDWARE_FAILURE:
  463. case DERR_DIALTONE:
  464. GoNavigate(CKPT_DIALTONE);
  465. break;
  466. case DERR_BUSY:
  467. if (g_LineProblem < 3)
  468. {
  469. window.setTimeout("Redial()", 1000);
  470. }
  471. else
  472. GoNavigate(CKPT_TOOBUSY);
  473. break;
  474. case DERR_VOICEANSWER:
  475. case DERR_PPP_TIMEOUT:
  476. GoNavigate(CKPT_HANDSHAKE);
  477. break;
  478. case DERR_NO_CARRIER:
  479. GoNavigate(CKPT_CONNECTERROR);
  480. break;
  481. case DERR_NOANSWER:
  482. if (g_LineProblem < 3)
  483. {
  484. window.setTimeout("Redial()", 1000);
  485. }
  486. else
  487. {
  488. GoNavigate(CKPT_HANDSHAKE);
  489. }
  490. break;
  491. default:
  492. GoNavigate(CKPT_SRVERROR);
  493. break;
  494. }
  495. }
  496. }
  497. <!--REQUIRED FUNCTION NAME:: DO NOT OVERLOAD OR ALTER-->
  498. function OnServerErrorEx(derr)
  499. {
  500. if (g_CurrentCKPT == g_DialCKPT)
  501. {
  502. if (g_bFirstServerError)
  503. {
  504. var url = window.external.GetReconnectURL
  505. if (url != null && url.length !=0)
  506. ifrmMainFrame.window.navigate(url);
  507. g_bFirstServerError = false;
  508. }
  509. else
  510. {
  511. GoNavigate(CKPT_SRVERROR);
  512. }
  513. }
  514. }
  515. // END connect.htm
  516. //////////////////////////////////////////////////////////////////////////////////////
  517. // General Default LoadMe function
  518. //////////////////////////////////////////////////////////////////////////////////////
  519. function _Default_LoadMe()
  520. {
  521. InitFrameRef();
  522. if (g.btnCancelText != null)
  523. g_FirstFocusElement = g.btnCancelText;
  524. else if (g.btnRestoreText != null)
  525. g_FirstFocusElement = g.btnRestoreText;
  526. else if (g.btnBackText != null)
  527. g_FirstFocusElement = g.btnBackText;
  528. else if (g.btnNextText != null)
  529. g_FirstFocusElement = g.btnNextText;
  530. InitButtons();
  531. if (g_FirstFocusElement != null)
  532. g_FirstFocusElement.focus();
  533. else
  534. g.document.body.focus();
  535. }
  536. //////////////////////////////////////////////////////////////////////////////////////
  537. // usemodem.htm
  538. //////////////////////////////////////////////////////////////////////////////////////
  539. function usemodem_LoadMe()
  540. {
  541. InitFrameRef();
  542. ResetDialing();
  543. g_FirstFocusElement = g.UseModem_Yes;
  544. InitButtons();
  545. g_FirstFocusElement.focus();
  546. }
  547. //////////////////////////////////////////////////////////////////////////////////////
  548. // hndshake.htm
  549. //////////////////////////////////////////////////////////////////////////////////////
  550. function hndshake_OnKeyPress()
  551. {
  552. try
  553. {
  554. if (g.event == null)
  555. return;
  556. }
  557. catch(e)
  558. {
  559. return;
  560. }
  561. // Treat the enter key like the next button
  562. // since the user hasn't gone through the mouse tutorial yet.
  563. if ((g.event.keyCode == 13) &&
  564. (g.btnNext.disabled == false))
  565. {
  566. GoNext();
  567. }
  568. else
  569. {
  570. KeyPressIsValid();
  571. }
  572. }
  573. function hndshake_CheckEdits()
  574. {
  575. try
  576. {
  577. if (g.event == null)
  578. return;
  579. }
  580. catch(e)
  581. {
  582. return;
  583. }
  584. if (g.event.srcElement != g.edtMSNPhoneNumber)
  585. {
  586. hndshake_CheckEnableNextButton();
  587. }
  588. }
  589. function hndshake_CheckEnableNextButton()
  590. {
  591. try
  592. {
  593. if (g.event == null)
  594. return;
  595. }
  596. catch(e)
  597. {
  598. return;
  599. }
  600. if (g.edtMSNPhoneNumber.value.length)
  601. {
  602. g.btnNext.disabled = false;
  603. }
  604. else
  605. {
  606. g.btnNext.disabled = true;
  607. }
  608. InitButtons();
  609. }
  610. function hndshake_LoadMe()
  611. {
  612. InitFrameRef();
  613. g_FirstFocusElement = g.edtMSNPhoneNumber;
  614. hndshake_CheckEnableNextButton();
  615. g_FirstFocusElement.focus();
  616. }
  617. //////////////////////////////////////////////////////////////////////////////////////
  618. // MISC Functions
  619. //////////////////////////////////////////////////////////////////////////////////////
  620. // Page Navigation
  621. // InitCKPT, PushCKPT, PopCKPT, CKPTFromVal are meant to handle the behavior for GoBack.
  622. // We only go back to certain pages (i.e., Mouse Tutorial, Sound Check).
  623. // And on some of the pages, we only go back if they haven't been
  624. // completed (i.e., EULA, PID).
  625. //
  626. // So, we push checkpoints if we intend to all coming back to that page.
  627. // We pop checkpoints if we no longer want to come back (e.g., we've
  628. // completed that page.
  629. function InitCKPT()
  630. {
  631. dnCKPT[CKPT_START] = new CheckPoint("msnsetup\\mstart.htm", SNDX_WELCOME, SNDX_WELCOME, SNDX_WELCOME, SNDX_WELCOME);
  632. dnCKPT[CKPT_TAPI] = new CheckPoint("msnsetup\\mtapi.htm", SNDX_MSN_ISP, SNDX_OEM_REG, SNDX_NONE_REG, 0);
  633. dnCKPT[CKPT_CONNECT ] = new CheckPoint("msnsetup\\mconnect.htm", SNDX_MSN_ISP, SNDX_OEM_REG, SNDX_NONE_REG, 0);
  634. dnCKPT[CKPT_MODEMCANCEL] = new CheckPoint("msnsetup\\musemode.htm", SNDX_MSN_ISP, SNDX_OEM_REG, SNDX_NONE_REG, 0);
  635. dnCKPT[CKPT_DIALTONE] = new CheckPoint("msnerror\\mdialton.htm", SNDX_MSN_ISP, SNDX_OEM_REG, SNDX_NONE_REG, 0);
  636. dnCKPT[CKPT_NOTAVAIL] = new CheckPoint("msnerror\\mnotavai.htm", SNDX_MSN_ISP, SNDX_OEM_REG, SNDX_NONE_REG, 0);
  637. dnCKPT[CKPT_SRVERROR] = new CheckPoint("msnerror\\msrverro.htm", SNDX_MSN_ISP, SNDX_OEM_REG, SNDX_NONE_REG, 0);
  638. dnCKPT[CKPT_TOOBUSY] = new CheckPoint("msnerror\\mtoobusy.htm", SNDX_MSN_ISP, SNDX_OEM_REG, SNDX_NONE_REG, 0);
  639. dnCKPT[CKPT_CONNECTERROR] = new CheckPoint("msnerror\\mcnncter.htm", SNDX_MSN_ISP, SNDX_OEM_REG, SNDX_NONE_REG, 0);
  640. dnCKPT[CKPT_NOANSWER] = new CheckPoint("msnerror\\mnoanswe.htm", SNDX_MSN_ISP, SNDX_OEM_REG, SNDX_NONE_REG, 0);
  641. dnCKPT[CKPT_HANDSHAKE] = new CheckPoint("msnerror\\mhndshak.htm", SNDX_MSN_ISP, SNDX_OEM_REG, SNDX_NONE_REG, 0);
  642. dnCKPT[CKPT_INSERROR] = new CheckPoint("msnerror\\minserro.htm", SNDX_MSN_ISP, SNDX_OEM_REG, SNDX_NONE_REG, 0);
  643. dnCKPT[CKPT_ISPTOOBUSY] = new CheckPoint("msnerror\\misp2bus.htm", 0, SNDX_OEM_ISP, 0, 0);
  644. dnCKPT[CKPT_ISPNOCONNECT] = new CheckPoint("msnerror\\mispcnnc.htm", 0, SNDX_OEM_ISP, 0, 0);
  645. dnCKPT[CKPT_ISPRESET] = new CheckPoint("msnerror\\misprese.htm", 0, SNDX_OEM_ISP, 0, 0);
  646. PopCKPT();
  647. }
  648. function PushCKPT(ckpt)
  649. {
  650. if (ckpt > 0 && ckpt < CKPT_MAX)
  651. {
  652. var tos = 0;
  653. try
  654. {
  655. tos = ApiObj.get_RegValue(HKEY_LOCAL_MACHINE, OOBE_MAIN_REG_KEY + CKPT_REG_KEY, TOS_REG_VALUE);
  656. }
  657. catch (e) {}
  658. ApiObj.set_RegValue(HKEY_LOCAL_MACHINE, OOBE_MAIN_REG_KEY + CKPT_REG_KEY, tos.toString(), ckpt);
  659. ApiObj.set_RegValue(HKEY_LOCAL_MACHINE, OOBE_MAIN_REG_KEY + CKPT_REG_KEY, TOS_REG_VALUE, ++tos);
  660. g_CurrentCKPT = ckpt;
  661. }
  662. }
  663. function PopCKPT(ckptCheck)
  664. {
  665. var ckpt = 0;
  666. try
  667. {
  668. var tos = ApiObj.get_RegValue(HKEY_LOCAL_MACHINE, OOBE_MAIN_REG_KEY + CKPT_REG_KEY, TOS_REG_VALUE);
  669. if (tos > 0)
  670. {
  671. ckpt = ApiObj.get_RegValue(HKEY_LOCAL_MACHINE, OOBE_MAIN_REG_KEY + CKPT_REG_KEY, (tos - 1).toString());
  672. if (null == ckptCheck || ckpt == ckptCheck)
  673. {
  674. ApiObj.set_RegValue(HKEY_LOCAL_MACHINE, OOBE_MAIN_REG_KEY + CKPT_REG_KEY, TOS_REG_VALUE, --tos);
  675. ApiObj.DeleteRegValue(HKEY_LOCAL_MACHINE, OOBE_MAIN_REG_KEY + CKPT_REG_KEY, tos.toString());
  676. }
  677. }
  678. }
  679. catch (e) {}
  680. if (ckpt > 0 && ckpt < CKPT_MAX)
  681. {
  682. g_CurrentCKPT = ckpt;
  683. }
  684. else
  685. g_CurrentCKPT = null;
  686. }
  687. function URLFromCKPT(ckpt)
  688. {
  689. var str = "";
  690. if (ckpt > 0 && ckpt < CKPT_MAX)
  691. {
  692. str = dnCKPT[ckpt].strURL;
  693. }
  694. return str;
  695. }
  696. function IndexFromCKPT(ckpt, status)
  697. {
  698. var index = 0;
  699. if (ckpt > 0 && ckpt < CKPT_MAX)
  700. {
  701. var checkpoint = dnCKPT[ckpt];
  702. index = checkpoint.rgindex[status];
  703. }
  704. return index;
  705. }
  706. function SetButtonImageToClick()
  707. {
  708. try
  709. {
  710. if (g.event != null)
  711. {
  712. switch(g.event.srcElement.parentElement.id)
  713. {
  714. case "spanCancel":
  715. if (g.spanRestore != null && true != g.spanRestore.Hide)
  716. {
  717. g.btnCancel.src = g_ImgLeftClickWide.src;
  718. }
  719. else
  720. {
  721. g.btnCancel.src = g_ImgClick.src;
  722. }
  723. break;
  724. case "spanRestore":
  725. if (g.spanCancel != null && true != g.spanCancel.Hide)
  726. {
  727. g.btnRestore.src = g_ImgRightClickWide.src;
  728. }
  729. else
  730. {
  731. g.btnRestore.src = g_ImgClick.src;
  732. }
  733. break;
  734. case "spanBack":
  735. if (g.spanNext != null && true != g.spanNext.Hide)
  736. {
  737. g.btnBack.src = g_ImgLeftClick.src;
  738. }
  739. else
  740. {
  741. g.btnBack.src = g_ImgLeftClickSingle.src;
  742. }
  743. break;
  744. case "spanNext":
  745. if (g.spanBack != null && true != g.spanBack.Hide)
  746. {
  747. g.btnNext.src = g_ImgRightClick.src;
  748. }
  749. else
  750. {
  751. g.btnNext.src = g_ImgRightClickSingle.src;
  752. }
  753. break;
  754. }
  755. }
  756. }
  757. catch(e)
  758. {
  759. return;
  760. }
  761. }
  762. function IsLocalFile()
  763. {
  764. try
  765. {
  766. return (-1 != g.location.protocol.indexOf("file"));
  767. }
  768. catch (e)
  769. {
  770. return false;
  771. }
  772. }
  773. //////////////////////////////////////////////////////////////////////////////////////
  774. // public navigation APIs
  775. //////////////////////////////////////////////////////////////////////////////////////
  776. //Some server page is calling this function that used to set g_OEMAddBackURL.
  777. function SetBack(strURL)
  778. {
  779. }
  780. function GoCancel(ckpt)
  781. {
  782. try
  783. {
  784. if (IsLocalFile() && g.event == null)
  785. return;
  786. }
  787. catch(e)
  788. {
  789. return;
  790. }
  791. SetButtonImageToClick();
  792. switch (g_CurrentCKPT)
  793. {
  794. case CKPT_CONNECT:
  795. ResetDialing();
  796. // fall through...
  797. case CKPT_TAPI:
  798. GoNavigate(CKPT_MODEMCANCEL);
  799. break;
  800. }
  801. }
  802. function GoBack(ckpt)
  803. {
  804. var ckptPrevious = g_CurrentCKPT;
  805. try
  806. {
  807. if (IsLocalFile() && g.event == null)
  808. return;
  809. }
  810. catch(e)
  811. {
  812. return;
  813. }
  814. SetButtonImageToClick();
  815. if (g_CurrentCKPT == g_DialCKPT)
  816. ResetDialing();
  817. PopCKPT();
  818. if (ckptPrevious == g_CurrentCKPT)
  819. {
  820. // This handles the case where the current page pushed itself on the stack.
  821. PopCKPT();
  822. }
  823. if (g_CurrentCKPT > 0 && g_CurrentCKPT < CKPT_MAX)
  824. {
  825. GoNavigate(g_CurrentCKPT);
  826. }
  827. }
  828. function StatusNavigate()
  829. {
  830. var iMove = IndexFromCKPT(g_CurrentCKPT, g_status) - window.external.get_StatusIndex;
  831. while (iMove > 0)
  832. {
  833. window.external.MoveNext();
  834. --iMove;
  835. }
  836. while (iMove < 0)
  837. {
  838. window.external.MovePrevious();
  839. ++iMove;
  840. }
  841. }
  842. ////////////////////////////////////////////////////////////////////
  843. // DON'T MUCK WITH THE POSITIONING OF THE CASES IN THE SWITCHS BELOW
  844. ////////////////////////////////////////////////////////////////////
  845. function GoNavigate(ckptGoHere)
  846. {
  847. try
  848. {
  849. if (g_bStartup == false)
  850. {
  851. if (IsLocalFile())
  852. {
  853. if (g.event != null)
  854. {
  855. g.event.returnValue = false;
  856. g.event.cancelBubble = true;
  857. }
  858. }
  859. }
  860. else
  861. g_bStartup = false;
  862. }
  863. catch(e)
  864. {
  865. return;
  866. }
  867. SetButtonImageToClick();
  868. switch (ckptGoHere)
  869. {
  870. case CKPT_START:
  871. PushCKPT(CKPT_START); //BUGBUG do we want to do this?
  872. g.navigate(g_OOBEDir + URLFromCKPT(g_CurrentCKPT));
  873. break;
  874. case CKPT_TAPI:
  875. PushCKPT(CKPT_TAPI);
  876. g.navigate(g_OOBEDir + URLFromCKPT(g_CurrentCKPT));
  877. break;
  878. case CKPT_CONNECT:
  879. g_CurrentCKPT = CKPT_CONNECT;
  880. g.navigate(g_OOBEDir + URLFromCKPT(CKPT_CONNECT));
  881. break;
  882. case CKPT_NOTAVAIL:
  883. g_CurrentCKPT = CKPT_NOTAVAIL;
  884. g.navigate(g_OOBEDir + URLFromCKPT(CKPT_NOTAVAIL));
  885. break;
  886. case CKPT_DIALTONE:
  887. g_CurrentCKPT = CKPT_DIALTONE;
  888. g.navigate(g_OOBEDir + URLFromCKPT(CKPT_DIALTONE));
  889. break;
  890. case CKPT_TOOBUSY:
  891. g_CurrentCKPT = CKPT_TOOBUSY;
  892. g.navigate(g_OOBEDir + URLFromCKPT(CKPT_TOOBUSY));
  893. break;
  894. case CKPT_SRVERROR:
  895. g_CurrentCKPT = CKPT_SRVERROR;
  896. g.navigate(g_OOBEDir + URLFromCKPT(CKPT_SRVERROR));
  897. break;
  898. case CKPT_MODEMCANCEL:
  899. g_CurrentCKPT = CKPT_MODEMCANCEL;
  900. g.navigate(g_OOBEDir + URLFromCKPT(CKPT_MODEMCANCEL));
  901. break;
  902. case CKPT_INSERROR:
  903. g_CurrentCKPT = CKPT_INSERROR;
  904. g.navigate(g_OOBEDir + URLFromCKPT(CKPT_INSERROR));
  905. break;
  906. case CKPT_HANDSHAKE:
  907. g_CurrentCKPT = CKPT_HANDSHAKE;
  908. g.navigate(g_OOBEDir + URLFromCKPT(CKPT_HANDSHAKE));
  909. break;
  910. case CKPT_CONNECTERROR:
  911. g_CurrentCKPT = CKPT_CONNECTERROR;
  912. g.navigate(g_OOBEDir + URLFromCKPT(g_CurrentCKPT));
  913. break;
  914. case CKPT_ISPTOOBUSY:
  915. g_CurrentCKPT = CKPT_ISPTOOBUSY;
  916. g.navigate(g_OOBEDir + URLFromCKPT(g_CurrentCKPT));
  917. break;
  918. case CKPT_ISPRESET:
  919. g_CurrentCKPT = CKPT_ISPRESET;
  920. g.navigate(g_OOBEDir + URLFromCKPT(g_CurrentCKPT));
  921. break;
  922. }
  923. StatusNavigate();
  924. }
  925. function GoNext()
  926. {
  927. try
  928. {
  929. if (IsLocalFile() && g.event == null)
  930. return;
  931. }
  932. catch(e)
  933. {
  934. return;
  935. }
  936. SetButtonImageToClick();
  937. switch (g_CurrentCKPT)
  938. {
  939. case CKPT_HANDSHAKE:
  940. window.external.set_DialNumber(g.edtMSNPhoneNumber.value);
  941. case CKPT_SRVERROR:
  942. case CKPT_ISPRESET:
  943. case CKPT_CONNECTERROR:
  944. case CKPT_DIALTONE:
  945. case CKPT_TOOBUSY:
  946. GoNavigate(g_DialCKPT);
  947. break;
  948. case CKPT_START:
  949. GoNavigate(CKPT_TAPI);
  950. break;
  951. case CKPT_TAPI:
  952. StoreTapi();
  953. if ( dnCKPT[CKPT_CONNECT].strURL.toUpperCase() == "MSNSETUP\\MLAN.HTM" || window.external.CheckPhoneBook("msobe.isp") )
  954. {
  955. GoNavigate(CKPT_CONNECT);
  956. }
  957. break;
  958. default:
  959. // BUGBUG should we remove the default altogether?
  960. break;
  961. }
  962. }
  963. // BUGBUG temporary until MSN changes code
  964. function GoOffline()
  965. {
  966. GoNext();
  967. }
  968. // Button Event Handlers and Initialization
  969. function SetLastButtonText()
  970. {
  971. if (g.btnNext != null)
  972. g_LastButtonText = g.btnNextText;
  973. else if (g.btnBack != null)
  974. g_LastButtonText = g.btnBackText;
  975. else if (g.btnRestore != null)
  976. g_LastButtonText = g.btnRestoreText;
  977. else if (g.btnCancel != null)
  978. g_LastButtonText = g.btnCancelText;
  979. }
  980. // Function: InitFrameRef
  981. // Description: Sets up globals to point to buttons
  982. // Since the buttons exist on the child frame,
  983. // we want to have quick access to them without
  984. // going through the collections.
  985. // WARNING: Call this function at the top of XXX_LoadMe()
  986. //
  987. function InitFrameRef()
  988. {
  989. g_LastButtonText = null;
  990. g_FirstFocusElement = null;
  991. g_LastKeyDown = null;
  992. g = document.frames("msoobeMain");
  993. try
  994. {
  995. if (g.StageImage != null && g.StageImage.readyState == "complete")
  996. {
  997. g.StageImage.style.display = "none";
  998. }
  999. g.document.body.onkeydown = OnKeyDown;
  1000. SetLastButtonText();
  1001. }
  1002. catch(e){}
  1003. }
  1004. function HideButtons(buttons)
  1005. {
  1006. if (null != g.spanBack && (buttons & HIDE_BACK))
  1007. {
  1008. g.spanBack.Hide = true;
  1009. g.btnBack.Hide = true;
  1010. }
  1011. if (null != g.spanNext && (buttons & HIDE_NEXT))
  1012. {
  1013. g.spanNext.Hide = true;
  1014. g.btnNext.Hide = true;
  1015. }
  1016. if (null != g.spanCancel && (buttons & HIDE_CANCEL))
  1017. {
  1018. g.spanCancel.Hide = true;
  1019. g.btnCancel.Hide = true;
  1020. }
  1021. if (null != g.spanRestore && (buttons & HIDE_RESTORE))
  1022. {
  1023. g.spanRestore.Hide = true;
  1024. g.btnRestore.Hide = true;
  1025. }
  1026. }
  1027. function InitButtons()
  1028. {
  1029. if (g.btnNextText && (g.btnBackText && (g.btnBack.Hide == null || g.btnBack.Hide == false)))
  1030. g.btnNextText.style.textAlign="left";
  1031. else if (g.btnNextText)
  1032. g.btnNextText.style.textAlign="center";
  1033. if (g.btnBackText && (g.btnNextText && (g.btnNext.Hide == null || g.btnNext.Hide == false)))
  1034. g.btnBackText.style.textAlign="right";
  1035. else if (g.btnBackText)
  1036. g.btnBackText.style.textAlign="center";
  1037. if (g.btnRestoreText && (g.btnCancelText && (g.btnCancel.Hide == null || g.btnCancel.Hide == false)))
  1038. g.btnRestoreText.style.textAlign="left";
  1039. else if (g.btnRestoreText)
  1040. g.btnRestoreText.style.textAlign="center";
  1041. if (g.btnCancelText && (g.btnRestoreText && (g.btnRestore.Hide == null || g.btnRestore.Hide == false)))
  1042. g.btnCancelText.style.textAlign="right";
  1043. else if(g.btnCancelText)
  1044. g.btnCancelText.style.textAlign="center";
  1045. InitPairedButton(g.spanNext, g.btnNext, g.btnNextText, g_ImgRightDefault, g_ImgRightDisabled,
  1046. g_ImgRightDefaultSingle, g_ImgRightDisabledSingle,
  1047. g.spanBack, "backButton", "backButtonText");
  1048. InitPairedButton(g.spanBack, g.btnBack, g.btnBackText, g_ImgLeftDefault, g_ImgLeftDisabled,
  1049. g_ImgLeftDefaultSingle, g_ImgLeftDisabledSingle,
  1050. g.spanNext, "backButton", "backButtonText");
  1051. InitPairedButton(g.spanRestore, g.btnRestore, g.btnRestoreText, g_ImgRightDefaultWide, g_ImgRightDisabledWide,
  1052. g_ImgDefault, g_ImgDisabled,
  1053. g.spanCancel, "cancelButton", "cancelButtonText");
  1054. InitPairedButton(g.spanCancel, g.btnCancel, g.btnCancelText, g_ImgLeftDefaultWide, g_ImgLeftDisabledWide,
  1055. g_ImgDefault, g_ImgDisabled,
  1056. g.spanRestore, "cancelButton", "cancelButtonText");
  1057. }
  1058. function InitPairedButton(span, btn, btnText, img, imgDisabled,
  1059. imgSingle, imgSingleDisabled,
  1060. span2, btnClass, btnTextClass)
  1061. {
  1062. if (span != null)
  1063. {
  1064. if (span2 == null || true == span2.Hide)
  1065. {
  1066. btn.className = btnClass;
  1067. btnText.className = btnTextClass;
  1068. btnText.style.textAlign="center";
  1069. }
  1070. if (btn.disabled == null || !btn.disabled)
  1071. {
  1072. if (span2 == null || true == span2.Hide)
  1073. {
  1074. btn.src = imgSingle.src;
  1075. }
  1076. else
  1077. {
  1078. btn.src = img.src;
  1079. }
  1080. btnText.style.color= "black";
  1081. }
  1082. else
  1083. {
  1084. if (span2 == null || true == span2.Hide)
  1085. {
  1086. btn.src = imgSingleDisabled.src;
  1087. }
  1088. else
  1089. {
  1090. btn.src = imgDisabled.src;
  1091. }
  1092. btnText.style.color= "gray";
  1093. }
  1094. span.onmouseover = HoverOnButton;
  1095. span.onmouseout = HoverOffButton;
  1096. btnText.onblur = BlurBtnText;
  1097. btnText.onkeydown = KeyDownBtnText;
  1098. btnText.onfocus = FocusBtnText;
  1099. // set sibling associations.
  1100. btn.sibling = btnText;
  1101. btnText.sibling = btn;
  1102. if (null == btn.Hide || false == btn.Hide)
  1103. {
  1104. btn.style.visibility = "visible";
  1105. btnText.style.visibility = "visible";
  1106. switch (btnText.style.textAlign.toUpperCase())
  1107. {
  1108. case "CENTER":
  1109. btnText.style.posLeft = btn.offsetLeft + (btn.width / 2 - btnText.offsetWidth / 2);
  1110. break;
  1111. case "RIGHT":
  1112. btnText.style.posLeft = btn.offsetLeft + btn.width - ( btnText.offsetWidth + 10);
  1113. break;
  1114. }
  1115. }
  1116. }
  1117. }
  1118. ///////////////////////////////////////////////////////////
  1119. // Function: HoverOnButton
  1120. // Description: This function is attached to a onmouseover
  1121. // event for a button span. We use the event source to
  1122. // determine which button it occured on and change that
  1123. // button to it's higlighted or hover state.
  1124. //
  1125. function HoverOnButton()
  1126. {
  1127. try
  1128. {
  1129. if (IsLocalFile() && g.event == null)
  1130. return;
  1131. }
  1132. catch(e)
  1133. {
  1134. return;
  1135. }
  1136. switch (g.event.srcElement.parentElement)
  1137. {
  1138. case g.spanCancel:
  1139. case g.btnCancelText:
  1140. HoverOnPairedButton(g.btnCancel, g.btnCancelText, g_ImgLeftHoverWide, g_ImgHover, g.btnRestore);
  1141. break;
  1142. case g.spanRestore:
  1143. case g.btnRestoreText:
  1144. HoverOnPairedButton(g.btnRestore, g.btnRestoreText, g_ImgRightHoverWide, g_ImgHover, g.btnCancel);
  1145. break;
  1146. case g.spanBack:
  1147. case g.btnBackText:
  1148. HoverOnPairedButton(g.btnBack, g.btnBackText, g_ImgLeftHover, g_ImgLeftHoverSingle, g.btnNext);
  1149. break;
  1150. case g.spanNext:
  1151. case g.btnNextText:
  1152. HoverOnPairedButton(g.btnNext, g.btnNextText, g_ImgRightHover, g_ImgRightHoverSingle, g.btnBack);
  1153. break;
  1154. }
  1155. }
  1156. function HoverOnPairedButton(btn, btnText, img, imgSingle, btn2)
  1157. {
  1158. if (btn.disabled == null || !btn.disabled)
  1159. {
  1160. if (!btn.parentElement.contains(g.event.fromElement))
  1161. {
  1162. if (btn2 == null || true == btn2.Hide)
  1163. {
  1164. btn.src = imgSingle.src;
  1165. }
  1166. else
  1167. {
  1168. btn.src = img.src;
  1169. }
  1170. btnText.style.fontWeight = "bold";
  1171. switch (btnText.style.textAlign.toUpperCase())
  1172. {
  1173. case "CENTER":
  1174. btnText.style.posLeft = btn.offsetLeft + (btn.offsetWidth / 2 - btnText.offsetWidth / 2);
  1175. break;
  1176. case "RIGHT":
  1177. btnText.style.posLeft = btn.offsetLeft + btn.offsetWidth - ( btnText.offsetWidth + 10);
  1178. break;
  1179. }
  1180. }
  1181. }
  1182. }
  1183. var g_LastKeyDown = null;
  1184. function OnKeyDown()
  1185. {
  1186. try
  1187. {
  1188. if (IsLocalFile() && g.event == null)
  1189. return;
  1190. }
  1191. catch(e)
  1192. {
  1193. return;
  1194. }
  1195. if (g.event.altKey)
  1196. {
  1197. g_LastKeyDown = String.fromCharCode(g.event.keyCode);
  1198. if (g_LastKeyDown != null)
  1199. g_LastKeyDown = g_LastKeyDown.toUpperCase();
  1200. }
  1201. else
  1202. g_LastKeyDown = null;
  1203. }
  1204. function FocusBtnText()
  1205. {
  1206. try
  1207. {
  1208. if (IsLocalFile() && g.event == null)
  1209. return;
  1210. }
  1211. catch(e)
  1212. {
  1213. return;
  1214. }
  1215. if (g.event.srcElement.sibling == null ||
  1216. g.event.srcElement.sibling.disabled == null ||
  1217. g.event.srcElement.sibling.disabled == false)
  1218. {
  1219. var accessKey = g.event.srcElement.accessKey;
  1220. if(g.event.altKey &&
  1221. !g.event.button &&
  1222. accessKey != null &&
  1223. g_LastKeyDown == accessKey.toUpperCase())
  1224. g.event.srcElement.parentElement.click();
  1225. }
  1226. else
  1227. g.event.srcElement.blur();
  1228. g.event.returnValue = false;
  1229. g.event.cancelBubble = true;
  1230. }
  1231. function KeyDownBtnText()
  1232. {
  1233. try
  1234. {
  1235. if (IsLocalFile() && g.event == null)
  1236. return;
  1237. }
  1238. catch(e)
  1239. {
  1240. return;
  1241. }
  1242. var keyPressed = String.fromCharCode(g.event.keyCode);
  1243. if (g.event.keyCode == 13 || (g.event.altKey && keyPressed.toUpperCase() == g.event.srcElement.accessKey.toUpperCase()))
  1244. {
  1245. g.event.keyCode = 0;
  1246. g.event.returnValue = false;
  1247. g.event.cancelBubble = true;
  1248. g.event.srcElement.parentElement.click();
  1249. }
  1250. if (g_LastButtonText != null && g.event.srcElement == g_LastButtonText &&
  1251. g.event.keyCode == 9 && null != g_FirstFocusElement && g_FirstFocusElement.isTextEdit &&
  1252. !g.event.altKey)
  1253. {
  1254. g_FirstFocusElement.focus();
  1255. g_FirstFocusElement.select();
  1256. g.event.returnValue = false; // BUGBUG should we keyCode 0 here?
  1257. g.event.keyCode = 0;
  1258. }
  1259. }
  1260. function BlurBtnText()
  1261. {
  1262. // need this stinking thing here for the
  1263. // case when we have an onblur happen and the page is not valid
  1264. // so we are in a transition. this way we don't get a mesagebox
  1265. // about an error
  1266. try
  1267. {
  1268. if (g.event.type == "blur")
  1269. {
  1270. if (!g.event.altKey &&
  1271. g_LastButtonText != null &&
  1272. g_FirstFocusElement != null &&
  1273. g.event.srcElement == g_LastButtonText)
  1274. {
  1275. g_FirstFocusElement.focus();
  1276. }
  1277. }
  1278. }
  1279. catch(e)
  1280. {
  1281. return;
  1282. }
  1283. }
  1284. ///////////////////////////////////////////////////////////
  1285. // Function: HoverOffButton
  1286. // Description: This function is attached to a onmouseout
  1287. // event for a button span. We use the event source to
  1288. // determine which button it occured on and change that
  1289. // button back to it's normal state.
  1290. //
  1291. function HoverOffButton()
  1292. {
  1293. // need this stinking thing here for the
  1294. // case when we have an onblur happen and the page is not valid
  1295. // so we are in a transition. this way we don't get a mesagebox
  1296. // about an error
  1297. try
  1298. {
  1299. if (IsLocalFile() && g.event == null)
  1300. return;
  1301. }
  1302. catch(e)
  1303. {
  1304. return;
  1305. }
  1306. switch (g.event.srcElement.parentElement)
  1307. {
  1308. case g.spanCancel:
  1309. case g.btnCancelText:
  1310. HoverOffPairedButton(g.btnCancel, g.btnCancelText, g_ImgLeftDefaultWide, g_ImgDefault, g.btnRestore);
  1311. break;
  1312. case g.spanRestore:
  1313. case g.btnRestoreText:
  1314. HoverOffPairedButton(g.btnRestore, g.btnRestoreText, g_ImgRightDefaultWide, g_ImgDefault, g.btnCancel);
  1315. break;
  1316. case g.spanBack:
  1317. case g.btnBackText:
  1318. HoverOffPairedButton(g.btnBack, g.btnBackText, g_ImgLeftDefault, g_ImgLeftDefaultSingle, g.btnNext);
  1319. break;
  1320. case g.spanNext:
  1321. case g.btnNextText:
  1322. HoverOffPairedButton(g.btnNext, g.btnNextText, g_ImgRightDefault, g_ImgRightDefaultSingle, g.btnBack);
  1323. break;
  1324. }
  1325. // BlurText();
  1326. }
  1327. function HoverOffPairedButton(btn, btnText, img, imgSingle, btn2)
  1328. {
  1329. if (btn.disabled == null || !btn.disabled)
  1330. {
  1331. if (!btn.parentElement.contains(g.event.toElement))
  1332. {
  1333. if (btn2 == null || true == btn2.Hide)
  1334. {
  1335. btn.src = imgSingle.src;
  1336. }
  1337. else
  1338. {
  1339. btn.src = img.src;
  1340. }
  1341. btnText.style.fontWeight = "normal";
  1342. btnText.style.color = "black";
  1343. switch (btnText.style.textAlign.toUpperCase())
  1344. {
  1345. case "CENTER":
  1346. btnText.style.posLeft = btn.offsetLeft + (btn.offsetWidth / 2 - btnText.offsetWidth / 2);
  1347. break;
  1348. case "RIGHT":
  1349. btnText.style.posLeft = btn.offsetLeft + btn.offsetWidth - ( btnText.offsetWidth + 10);
  1350. break;
  1351. }
  1352. }
  1353. }
  1354. }
  1355. // END Button Event Handlers and Initialization
  1356. // VALIDATION ROUTINES
  1357. function KeyPressIsNumeric()
  1358. {
  1359. try
  1360. {
  1361. if (IsLocalFile() && g.event == null)
  1362. return;
  1363. }
  1364. catch(e)
  1365. {
  1366. return;
  1367. }
  1368. if (!IsNumeric(g.event.keyCode))
  1369. {
  1370. g.event.keyCode = 0;
  1371. g.event.returnValue = false;
  1372. }
  1373. }
  1374. function IsNumeric(keyCode)
  1375. {
  1376. if ((keyCode >= 48/*0*/) && (keyCode <= 57/*9*/))
  1377. return true;
  1378. else
  1379. return false;
  1380. }
  1381. function IsSpecial(keyCode)
  1382. {
  1383. // BUGBUG DISABLED FOR BETA
  1384. /*
  1385. var bFound = false;
  1386. var iPosition = 0;
  1387. for (;iPosition < g_SpecialChars.length; iPosition++)
  1388. {
  1389. if (g_SpecialChars.charCodeAt(iPosition) == keyCode)
  1390. {
  1391. bFound = true;
  1392. break;
  1393. }
  1394. }
  1395. return bFound;
  1396. */
  1397. return false;
  1398. }
  1399. function KeyPressIsValid()
  1400. {
  1401. try
  1402. {
  1403. if (IsLocalFile() && g.event == null)
  1404. return;
  1405. }
  1406. catch(e)
  1407. {
  1408. return;
  1409. }
  1410. if (!IsAlpha(g.event.keyCode) &&
  1411. !IsSpecial(g.event.keyCode) &&
  1412. !IsNumeric(g.event.keyCode))
  1413. {
  1414. g.event.keyCode = 0;
  1415. g.event.returnValue = false;
  1416. }
  1417. }
  1418. function KeyPressIsAlpha()
  1419. {
  1420. try
  1421. {
  1422. if (IsLocalFile() && g.event == null)
  1423. return;
  1424. }
  1425. catch(e)
  1426. {
  1427. return;
  1428. }
  1429. if (!IsAlpha(g.event.keyCode))
  1430. {
  1431. g.event.keyCode = 0;
  1432. g.event.returnValue = false;
  1433. }
  1434. }
  1435. function IsAlpha(keyCode)
  1436. {
  1437. // BUGBUG DISABLED FOR BETA
  1438. /*
  1439. var strKeyCode = String.fromCharCode(keyCode);
  1440. var re1 = new RegExp("\w");
  1441. var re2 = new RegExp("\D");
  1442. strKeyCode.match(re1);
  1443. strKeyCode.match(re2);
  1444. //return ((strKeyCode.match(re1) != null) && (strKeyCode.match(re2) != null));
  1445. */
  1446. // if ((keyCode >= 97/*a*/ && keyCode <= 122/*z*/) ||
  1447. // (keyCode >= 65/*A*/ && keyCode <= 90 /*Z*/))
  1448. return true;
  1449. // else
  1450. // return false;
  1451. }
  1452. function NumberOfSpaces(strValue)
  1453. {
  1454. /*
  1455. var NASexp = RegExp("\s");
  1456. var result = strValue.match(NASexp);
  1457. return ((result == null) || (result.length != strValue.length));
  1458. */
  1459. var iSpaceCount = 0;
  1460. for (iPosition = 0; iPosition < strValue.length; iPosition ++)
  1461. {
  1462. if (strValue.charAt(iPosition) == ' ')
  1463. {
  1464. iSpaceCount++;
  1465. }
  1466. }
  1467. return iSpaceCount;
  1468. }
  1469. function KeyCodeToUpper()
  1470. {
  1471. var strKeyCode = String.fromCharCode(g.event.keyCode);
  1472. strKeyCode = strKeyCode.toUpperCase();
  1473. g.event.keyCode = strKeyCode.charCodeAt(0);
  1474. }
  1475. // END VALIDATION ROUTINES
  1476. function SetupPageLayout()
  1477. {
  1478. document.all.ifrmMainFrame.style.height = document.body.clientHeight;
  1479. }
  1480. window.onresize = SetupPageLayout;
  1481. function ReCheckModem()
  1482. {
  1483. if ( 1 == DirObj.get_Offline() || window.external.CheckDialReady() != ERR_COMM_NO_ERROR)
  1484. {
  1485. g_status = STATUS_OFF;
  1486. StatusObj.set_Status(NOLAUNCHISPSIGNUP, true);
  1487. }
  1488. else
  1489. {
  1490. g_status = STATUS_MSN;
  1491. }
  1492. }
  1493. function InitApplication()
  1494. {
  1495. SetupPageLayout();
  1496. g_bStartup = true;
  1497. InitFrameRef();
  1498. if ( 1 == DirObj.get_Offline() || window.external.CheckDialReady() != ERR_COMM_NO_ERROR)
  1499. {
  1500. g_status = STATUS_OFF;
  1501. StatusObj.set_Status(NOLAUNCHISPSIGNUP, true);
  1502. }
  1503. else
  1504. {
  1505. g_status = STATUS_MSN;
  1506. }
  1507. InitCKPT();
  1508. do
  1509. {
  1510. PopCKPT();
  1511. }
  1512. while (null != g_CurrentCKPT);
  1513. GoNavigate(CKPT_START);
  1514. spnPage.style.visibility = "visible";
  1515. }
  1516. </script>
  1517. </HEAD>
  1518. <BODY bgColor=#ffffff leftMargin=0 onload=InitApplication(); scroll=no tabIndex=-1 topMargin=0>
  1519. <SPAN id=spnPage style="VISIBILITY: hidden" tabIndex=-1>
  1520. <SPAN id=spnMainFrame style="LEFT: 0px; POSITION: absolute; TOP: 0px" tabIndex=-1>
  1521. <IFRAME frameBorder=no height="100%" id=ifrmMainFrame name=msoobeMain src="about:blank" tabIndex=-1 width="100%"></IFRAME>
  1522. </SPAN>
  1523. </SPAN>
  1524. </BODY>
  1525. </HTML>