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.

1980 lines
54 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="regsetup\regstyl.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_REGRMIND = 1;
  52. var CKPT_REGISTER3 = 2;
  53. var CKPT_REGCONN = 3;
  54. var CKPT_REGLAN = 4;
  55. var CKPT_REGDIAL = 5;
  56. var CKPT_ACT_MSG = 6;
  57. var CKPT_DONE = 7;
  58. var CKPT_MAX = 8; // ALWAYS set this to be the biggest value!
  59. var CKPT_ISPDIAL = CKPT_MAX;
  60. var CKPT_REFDIAL = CKPT_MAX;
  61. var CKPT_MIGDIAL = CKPT_MAX;
  62. var CKPT_REGISTER1 = CKPT_MAX;
  63. var CKPT_ISPSIGNUP = CKPT_DONE;
  64. var dnCKPT = new Array(CKPT_MAX);
  65. // Checkpoint breadcrumbs
  66. var g_CurrentCKPT = null;
  67. var g_DialCKPT = null;
  68. var HKEY_LOCAL_MACHINE = 0x80000002;
  69. var OOBE_MAIN_REG_KEY = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\OOBE";
  70. var CKPT_REG_KEY = "\\CKPT";
  71. var TOS_REG_VALUE = "TOS";
  72. // CheckDialReady errors
  73. var ERR_COMM_NO_ERROR = 0;
  74. var ERR_COMM_OOBE_COMP_MISSING = 1;
  75. var ERR_COMM_UNKNOWN = 2; // Unknow error, check input parameters
  76. var ERR_COMM_NOMODEM = 3; // There is no modem installed
  77. var ERR_COMM_RAS_TCP_NOTINSTALL = 4;
  78. // Dialing errors. Look at raserror.h for details
  79. var DERR_DIALTONE = 680;
  80. var DERR_BUSY = 676;
  81. var DERR_VOICEANSWER = 677;
  82. var DERR_NOANSWER = 678;
  83. var DERR_NO_CARRIER = 679;
  84. var DERR_HARDWARE_FAILURE = 630; // modem turned off
  85. var DERR_PORT_ALREADY_OPEN = 602; // procomm/hypertrm/RAS has COM port
  86. var DERR_PORT_OR_DEVICE = 692; // got this when hypertrm had the device open -- jmazner
  87. var DERR_PPP_TIMEOUT = 718;
  88. var DERR_REMOTE_DISCONNECT = 629; // Connection interrupted
  89. // Finish errors
  90. var FINISH_OK = 0x00000000;
  91. var FINISH_REBOOT = 0x00000001;
  92. var FINISH_BAD_PID = 0x00000002;
  93. var FINISH_BAD_EULA = 0x00000004;
  94. var FINISH_BAD_STAMP = 0x00000008;
  95. // Language reboot return codes
  96. var LANGUAGE_REBOOT_NEVER = 0;
  97. var LANGUAGE_REBOOT_NOW = 1;
  98. var LANGUAGE_REBOOT_END = 2;
  99. // on-the-fly button hiding
  100. var HIDE_BACK = 0x0001;
  101. var HIDE_NEXT = 0x0002;
  102. var HIDE_CANCEL = 0x0004;
  103. var HIDE_RESTORE = 0x0008;
  104. // BUGBUG temp GUIDs
  105. var NOLAUNCHISPSIGNUP = "{C37D92A5-CA34-11d2-B71C-00C04F794977}";
  106. var MSNCOMPLETED = "{1C0A22F2-CB6B-11d2-B544-00A0C949DA70}";
  107. // window.external object caches
  108. var TapiObj = null;
  109. var InfoObj = null;
  110. var EulaObj = null;
  111. var LangObj = null;
  112. var PidObj = null;
  113. var StatusObj = null;
  114. var DirObj = null;
  115. var ApiObj = null;
  116. var RegisterObj = null;
  117. // general globals and status
  118. var g_strISPFile = "";
  119. var g_bStartup;
  120. var g_LastButtonText = null;
  121. var g_FirstFocusElement = null;
  122. var g = null;
  123. var g_SpecialChars = ".'-` ";
  124. var g_OOBEDir = "file://" + window.external.API.get_SystemDirectory() + "\\oobe\\";
  125. var g_bRedial = false;
  126. var g_LineProblem = 0;
  127. var g_bFirstServerError = true;
  128. var g_status = STATUS_OFF;
  129. var g_ServerErrorCount = 0;
  130. var g_IMEExists = false;
  131. var g_OEMAddBackURL = "";
  132. var g_DialingAvailableInCountry = true;
  133. var g_ModalDialogUp = false;
  134. var g_RemoveRemind = false;
  135. var MS_REGISTRATION = "{1C956940-8617-11D3-8B99-00A0C91E7F3C}";
  136. var OEM_REGISTRATION = "{ECD24360-B210-11D3-8B99-00A0C91E7F3C}";
  137. var g_bTapiDone = false;
  138. var g_OEMNameStr=window.external.Signup.get_OEMName();
  139. var L_MS_Text="Microsoft";
  140. var g_InitAutodial = false;
  141. var L_CheckConnectivity_Text = "Checking for connectivity...";
  142. var L_BlankTitle_Text = "";
  143. var g_IsMSRegistrationSuccessful = false;
  144. var g_IsOEMRegistrationSuccessful = false;
  145. // Mandatory Initialization Code
  146. if (null == ApiObj)
  147. {
  148. ApiObj = new Object;
  149. ApiObj = window.external.API;
  150. }
  151. if (null == StatusObj)
  152. {
  153. StatusObj = new Object;
  154. StatusObj = window.external.Status;
  155. }
  156. if (null == DirObj)
  157. {
  158. DirObj = new Object;
  159. DirObj = window.external.Directions;
  160. }
  161. if (null == InfoObj)
  162. {
  163. InfoObj = new Object;
  164. InfoObj = window.external.UserInfo;
  165. }
  166. if (null == RegisterObj)
  167. {
  168. RegisterObj = new Object;
  169. RegisterObj = window.external.Register;
  170. }
  171. if (null == TapiObj)
  172. {
  173. TapiObj = new Object;
  174. TapiObj = window.external.Tapi;
  175. }
  176. // END Initialization Code
  177. // AGENT: SelectClick is used by Agent
  178. function OnSelectClick() {}
  179. // AGENT: OnClick is used by Agent
  180. function OnClick() {}
  181. // AGENT: Focus functions are used by Agent
  182. function OnFocus() {}
  183. // these handle next/back navigation for non-checkpoint pages
  184. function SimpleNavBack()
  185. {
  186. g.window.history.back();
  187. }
  188. function HandleTextAreaFocus() {
  189. g.event.srcElement.style.borderStyle="ridge";
  190. }
  191. function HandleTextAreaBlur() {
  192. g.event.srcElement.style.borderStyle="";
  193. }
  194. //////////////////////////////////////////////////////////////////////////////////////
  195. // start.htm
  196. //////////////////////////////////////////////////////////////////////////////////////
  197. function Start_OnKeyPress()
  198. {
  199. try
  200. {
  201. if (g.event == null)
  202. return;
  203. }
  204. catch(e)
  205. {
  206. return;
  207. }
  208. // Treat the enter key like the next button
  209. // since the user hasn't gone through the mouse tutorial yet.
  210. if ((g.event.keyCode == 13) &&
  211. (g.btnNext.disabled == false))
  212. {
  213. GoNext();
  214. }
  215. else
  216. {
  217. KeyPressIsValid();
  218. }
  219. }
  220. function CheckUserLocale()
  221. {
  222. // if local is Korean, Simplified Chinese,
  223. // Traditional Chinese then we return
  224. // false else true
  225. var language = ApiObj.get_UserDefaultLCID;
  226. if (language == MAKELCID(MAKELANGID(LANG_KOREAN, SUBLANG_KOREAN), SORT_DEFAULT) ||
  227. language == MAKELCID(MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL), SORT_DEFAULT) ||
  228. language == MAKELCID(MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED), SORT_DEFAULT))
  229. return false;
  230. else
  231. return true;
  232. }
  233. // Function: Start_LoadMe
  234. // Description: This function is called after start.htm is
  235. // loaded. we then initialize Items on the page.
  236. // we also populate the edits with any values already
  237. // found in the registry.
  238. //
  239. function RemindChkBoxClick()
  240. {
  241. g_RemoveRemind = g.RemoveReminder.checked;
  242. if (g.btnNext.disabled)
  243. {
  244. g.btnNext.disabled = false;
  245. g.btnNext.onclick = GoNext;
  246. g.btnNext.focus();
  247. g.rb_reg_ms_no.checked = true;
  248. g.rb_reg_oem_no.checked = true;
  249. }
  250. }
  251. function Start_LoadMe()
  252. {
  253. InitFrameRef();
  254. var L_Title1_Text = "Ready to register with %1 and %2?";
  255. g.Title_Text.innerText = ApiObj.FormatMessage(L_Title1_Text, g_OEMNameStr, L_MS_Text);
  256. GetPageTitle();
  257. if (g_OEMNameStr.length != 0)
  258. {
  259. var L_OEM_Text = "Thank you for purchasing this computer from %1 featuring Microsoft Windows XP. We recommend you register with %2 and Microsoft. By registering your copy of Windows, Microsoft can notify you of future product updates, events, promotions, special offers and new products that you may be interested in.";
  260. g.welcome_namestr.innerText = ApiObj.FormatMessage(L_OEM_Text, g_OEMNameStr, g_OEMNameStr);
  261. var L_Question_Text = "Are you ready to register online with %1?";
  262. g.reg1_oem_TxtQuestion.innerText = ApiObj.FormatMessage(L_Question_Text, g_OEMNameStr);
  263. var L_Answer_Text = "Y<u>e</u>s, I'd like to register with %1 now";
  264. g.reg1_spn3.innerHTML = ApiObj.FormatMessage(L_Answer_Text, g_OEMNameStr);
  265. }
  266. g.WelcomePageText.style.visibility="visible";
  267. g.OEMName3.innerText=g_OEMNameStr;
  268. if ((g.rb_reg_ms_yes.checked || g.rb_reg_ms_no.checked) && (g.rb_reg_oem_yes.checked || g.rb_reg_oem_no.checked))
  269. {
  270. g.btnNext.disabled = false;
  271. g_FirstFocusElement = g.btnNext;
  272. }
  273. else
  274. {
  275. g.btnNext.disabled = true;
  276. g_FirstFocusElement = g.btnQuit;
  277. }
  278. InitButtons();
  279. g_FirstFocusElement.focus();
  280. }
  281. function Reg1RadioClicked()
  282. {
  283. if (g.btnNext.disabled)
  284. {
  285. if ((g.rb_reg_ms_yes.checked || g.rb_reg_ms_no.checked) && (g.rb_reg_oem_yes.checked || g.rb_reg_oem_no.checked))
  286. {
  287. g.btnNext.disabled = false;
  288. g.btnNext.onclick = GoNext;
  289. g.btnNext.focus();
  290. }
  291. }
  292. }
  293. //// reg3.htm ///////////////////////
  294. 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");
  295. 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");
  296. var ProvinceNames = new Array("","Alberta","British Columbia","Manitoba","New Brunswick","Newfoundland","Northwest Territories","Nova Scotia","Nunavut","Ontario","Prince Edward Island","Quebec","Saskatchewan","Yukon");
  297. // need ability to map state name string to index into StateAbbrevs
  298. var g_StateName2IndexMap= new ActiveXObject("Scripting.Dictionary");
  299. var g_ProvinceName2IndexMap= new ActiveXObject("Scripting.Dictionary");
  300. g_ProvinceName2IndexMap.CompareMode = 1; // text compare
  301. g_StateName2IndexMap.CompareMode = 1; // text compare
  302. // init hash table
  303. var ii;
  304. for(ii=1;ii<=FullStateNames.length;ii++) {
  305. // add both full name and abbrev to hash table
  306. g_StateName2IndexMap.Add(FullStateNames[ii-1].toUpperCase(),ii);
  307. g_StateName2IndexMap.Add(StateAbbrevs[ii].toUpperCase(),ii);
  308. if(ii < ProvinceNames.length) {
  309. g_ProvinceName2IndexMap.Add(ProvinceNames[ii].toUpperCase(),ii);
  310. }
  311. }
  312. var L_Postal_Text = "Postal or <u>Z</u>IP code:";
  313. var L_AsteriskPostal_Text = "*Postal or <u>Z</u>IP code:";
  314. var L_Province_Text= "State/<u>P</u>rovince:";
  315. var L_AsteriskProvince_Text= "*State/<u>P</u>rovince:";
  316. var L_Canada_Text="Canada";
  317. var L_UnitedStates_Text="United States";
  318. function Reg3UserCountryChanged() {
  319. // AGENT: notify Agent of the change
  320. g_Country=g.selCountry.options(g.selCountry.selectedIndex).text;
  321. if(g_Country == L_UnitedStates_Text) {
  322. if(g.selUSState.style.display!="inline") {
  323. g.selUSState.style.display="inline";
  324. }
  325. g.selCAProvince.style.display="none";
  326. g.UserStateTextBox.style.display="none";
  327. // when changing to US, try to translate any textbox string to state index
  328. if(g.UserStateTextBox.value!="") {
  329. var res=g_StateName2IndexMap.Item(g.UserStateTextBox.value.toUpperCase());
  330. if(res!=null) {
  331. g.selUSState.selectedIndex=res;
  332. }
  333. }
  334. g.LabelZIP.innerHTML = L_AsteriskPostal_Text;
  335. g.StateLabel.innerHTML = L_AsteriskProvince_Text;
  336. } else if(g_Country == L_Canada_Text) {
  337. g.selUSState.style.display="none";
  338. g.selCAProvince.style.display="inline";
  339. g.UserStateTextBox.style.display="none";
  340. // when changing to Canada, try to translate any textbox string to province index
  341. if(g.UserStateTextBox.value!="") {
  342. var res=g_ProvinceName2IndexMap.Item(g.UserStateTextBox.value.toUpperCase());
  343. if(res!=null) {
  344. g.selCAProvince.selectedIndex=res;
  345. }
  346. }
  347. g.LabelZIP.innerHTML = L_AsteriskPostal_Text;
  348. g.StateLabel.innerHTML = L_AsteriskProvince_Text;
  349. } else {
  350. g.selUSState.style.display="none";
  351. g.selCAProvince.style.display="none";
  352. g.UserStateTextBox.style.display="inline";
  353. g.LabelZIP.innerHTML = L_Postal_Text;
  354. g.StateLabel.innerHTML = L_Province_Text;
  355. }
  356. g_CountryIdx=g.selCountry.selectedIndex;
  357. Reg3UserStateChanged();
  358. }
  359. var L_FullName_Text="*<u>F</u>ull Name:";
  360. function Reg3UserStateChanged() {
  361. // AGENT: notify Agent of the change
  362. // BUGBUG: ok for no notify on change to textbox?
  363. if(g.selUSState.style.display!="none")
  364. {
  365. g_StateIdx=g.selUSState.selectedIndex;
  366. g_State=g.selUSState.options(g.selUSState.selectedIndex).text;
  367. g.StateLabel.htmlFor="selUSState";
  368. }
  369. else if (g.selCAProvince.style.display!="none")
  370. {
  371. g_StateIdx=g.selCAProvince.selectedIndex;
  372. g_State=g.selCAProvince.options(g.selCAProvince.selectedIndex).text;
  373. g.StateLabel.htmlFor="selCAProvince";
  374. }
  375. else
  376. {
  377. g_State = g.UserStateTextBox.value;
  378. g.StateLabel.htmlFor="UserStateTextBox";
  379. }
  380. }
  381. // store field info here:
  382. var g_FirstName=InfoObj.get_FirstName();
  383. // var g_MiddleName=InfoObj.get_MiddleInitial(); // InfoObj.get_MiddleName(); BUGBUG need to add this fn
  384. var g_LastName=InfoObj.get_LastName();
  385. var g_Address1=InfoObj.get_Address1();
  386. var g_Address2=InfoObj.get_Address2();
  387. var g_City=InfoObj.get_City();
  388. var g_ZipCode=InfoObj.get_Zip();
  389. var g_EmailAddr= InfoObj.get_PrimaryEmail();
  390. var g_PhoneNumber = InfoObj.get_PhoneNumber();
  391. var g_Country=InfoObj.get_Country();
  392. var g_CountryIdx=-1;
  393. var g_State=InfoObj.get_State();
  394. var g_StateIdx=0;
  395. function Reg3SaveSettings() {
  396. g_FirstName=g.UserFirstName.value;
  397. // g_MiddleName=g.UserMiddleName.value;
  398. g_LastName=g.UserLastName.value;
  399. g_Address1=g.UserAddress.value;
  400. g_Address2=g.UserAddress2.value;
  401. g_ZipCode=g.UserZipCode.value;
  402. g_EmailAddr=g.UserEmailAddress.value;
  403. g_PhoneNumber=g.UserPhoneNumber.value;
  404. g_City=g.UserCity.value;
  405. g_Country=g.selCountry.options(g.selCountry.selectedIndex).text;
  406. if(g.UserStateTextBox.style.display!="none")
  407. {
  408. g_State=g.UserStateTextBox.value;
  409. }
  410. else if (g.selUSState.style.display!="none")
  411. {
  412. g_State=g.selUSState.options(g.selUSState.selectedIndex).text;
  413. }
  414. else
  415. {
  416. g_State=g.selCAProvince.options(g.selCAProvince.selectedIndex).text;
  417. }
  418. InfoObj.set_FirstName(g_FirstName);
  419. InfoObj.set_LastName(g_LastName);
  420. // InfoObj.set_MiddleInitial(g_MiddleName);
  421. InfoObj.set_Country(g_Country);
  422. InfoObj.set_State(g_State);
  423. InfoObj.set_Address1(g_Address1);
  424. InfoObj.set_Address2(g_Address2);
  425. InfoObj.set_PrimaryEmail(g_EmailAddr);
  426. InfoObj.set_PhoneNumber(g_PhoneNumber);
  427. InfoObj.set_Zip(g_ZipCode);
  428. InfoObj.set_City(g_City);
  429. TapiObj.set_CountryIndex(g.selCountry.selectedIndex);
  430. }
  431. function Reg3_LoadMe()
  432. {
  433. InitFrameRef();
  434. GetPageTitle();
  435. g_FirstFocusElement = g.UserFirstName;
  436. if (IsFarEastLocale())
  437. {
  438. /*For JPN, CHT, CHS,
  439. Last Name
  440. First Name
  441. Country/Region
  442. Province
  443. City
  444. Address
  445. Zip
  446. E-Mail
  447. For KOR only,
  448. Full Name
  449. Country/Region
  450. Province
  451. City
  452. Address
  453. Zip
  454. E-Mail
  455. */
  456. g.MainPageCell.style.display="none"; // hide while we change order
  457. // no middle name for far east langs
  458. // g.MiddleNameRow.style.display="none";
  459. g.FieldTable.moveRow(2,0); // move lastname in front of first
  460. g.FieldTable.moveRow(7,3); // move country to after firstname
  461. g.FieldTable.moveRow(7,4); // move province to after country
  462. g.FieldTable.moveRow(7,5); // move city to after province
  463. g.FE_ZIPLabel.innerHTML=g.LabelRight.innerHTML;
  464. g.FE_ZIPInput.innerHTML=g.MenuRight.innerHTML;
  465. g.FE_ZIPRow.style.display="inline";
  466. g.LabelRight.innerHTML="";
  467. g.MenuRight.innerHTML="";
  468. // no reason to limit these lengths for FE, so just make them match others
  469. g.UserZipCode.size=30;
  470. g.UserZipCode.maxlength=120;
  471. g.UserStateTextBox.size=30;
  472. g.UserStateTextBox.maxlength=120;
  473. g_FirstFocusElement = g.UserLastName;
  474. if (IsKoreanLocale()) {
  475. g.LastNameRow.style.display="none";
  476. g.LabelFirstName.innerHTML=L_FullName_Text;
  477. g_FirstFocusElement = g.UserFirstName;
  478. }
  479. g.MainPageCell.style.display="inline";
  480. }
  481. // limit width of country menu since some text options are very long
  482. g.selCountry.style.width=g.UserEmailAddress.offsetWidth;
  483. g.UserFirstName.value=g_FirstName;
  484. // g.UserMiddleName.value=g_MiddleName;
  485. g.UserLastName.value=g_LastName;
  486. g.UserAddress.value=g_Address1;
  487. g.UserAddress2.value=g_Address2;
  488. g.UserZipCode.value=g_ZipCode;
  489. g.UserEmailAddress.value=g_EmailAddr;
  490. g.UserPhoneNumber.value=g_PhoneNumber;
  491. g.UserCity.value=g_City;
  492. // placeholder idx 0 option is needed to fix 101447
  493. // Due to a possible mshtml bug, the cursor is shifted right when the menu
  494. // expands to its full width.
  495. g.selUSState.remove(0);
  496. for (var i = 0; i < StateAbbrevs.length; i++) {
  497. var oOption = g.document.createElement("OPTION");
  498. oOption.text = StateAbbrevs[i];
  499. if (StateAbbrevs[i] == g_State)
  500. {
  501. g_StateIdx = i;
  502. }
  503. g.selUSState.add(oOption);
  504. }
  505. for (i = 0; i < ProvinceNames.length; i++) {
  506. oOption = g.document.createElement("OPTION");
  507. oOption.text = ProvinceNames[i];
  508. if (ProvinceNames[i] == g_State)
  509. {
  510. g_StateIdx = i;
  511. }
  512. g.selCAProvince.add(oOption);
  513. }
  514. var fTapi = TapiObj.IsTAPIConfigured(); // init TAPI
  515. /*
  516. var ilen = TapiObj.get_NumOfCountry(); // get num of countries, also inits COM obj storage
  517. for (var i = 0; i < ilen; i++)
  518. {
  519. var oOption = g.document.createElement("OPTION");
  520. oOption.text = TapiObj.get_CountryNameForIndex(i);
  521. g.selCountry.add(oOption);
  522. }
  523. */
  524. g_CountryIdx = TapiObj.get_CountryIndex();
  525. if(g_CountryIdx>=0)
  526. {
  527. g.selCountry.selectedIndex=g_CountryIdx;
  528. if(g_Country == L_UnitedStates_Text)
  529. {
  530. g.selUSState.selectedIndex=g_StateIdx;
  531. }
  532. else if(g_Country == L_Canada_Text)
  533. {
  534. g.selCAProvince.selectedIndex=g_StateIdx;
  535. }
  536. else
  537. g.UserStateTextBox.value=g_State;
  538. }
  539. else
  540. {
  541. // get default value
  542. g.selCountry.selectedIndex = TapiObj.get_CountryIndex();
  543. }
  544. Reg3UserCountryChanged();
  545. Reg3UserStateChanged();
  546. InitButtons();
  547. g.error_mesg.innerHTML = L_RequiredField_Text;
  548. g.error_mesg.style.display="inline";
  549. g_FirstFocusElement.focus();
  550. }
  551. function GetCurrentProvince() {
  552. if(g.selCountry.options(g.selCountry.selectedIndex).text == L_UnitedStates_Text) {
  553. return g.selUSState.options(g.selUSState.selectedIndex).text;
  554. } else if(g.selCountry.options(g.selCountry.selectedIndex).text == L_Canada_Text) {
  555. return g.selCAProvince.options(g.selCAProvince.selectedIndex).text;
  556. } else return g.UserStateTextBox.value;
  557. }
  558. function GetCurrentCountry() {
  559. return g.selCountry.options(g.selCountry.selectedIndex).text;
  560. }
  561. var L_Email_Text="Please enter a valid E-mail address or leave the E-mail text box empty.";
  562. var L_EnterValid_Text="* Please fill in the required fields.";
  563. var L_RequiredField_Text="* indicates required information";
  564. var g_PostToMS = true;
  565. var g_PostToOEM = true;
  566. var POST_TO_OEM = 1;
  567. var POST_TO_MS = 2;
  568. // Update status pane and navigate
  569. function navigatetoPrivacy(PrivPage)
  570. {
  571. if(g_CurrentCKPT == CKPT_REGISTER3) {
  572. Reg3SaveSettings();
  573. }
  574. if(PrivPage == "MS")
  575. g.navigate("rprvcyMS.htm");
  576. else
  577. g.navigate("rOEMpriv.htm");
  578. }
  579. function VerifyReg3Fields() {
  580. g.error_mesg.style.display="none";
  581. var LastErrorField = null;
  582. var CurReg3ErrStringArray = new Array();
  583. // user needs to complete input of address/name
  584. // this dynamically builds the list of erroneous fields to give to the user
  585. if(g.UserEmailAddress.value != "") {
  586. // do some validation on email address
  587. // Note special regexpr char like '\S' must be double-\'d because they are inside a string
  588. var re = new RegExp("^\\s*\\S+@\\S+\\.\\S\\S+","");
  589. if(re.exec(g.UserEmailAddress.value) == null) {
  590. LastErrorField = g.UserEmailAddress;
  591. g.LabelEmail.style.color = "red";
  592. } else {
  593. g.LabelEmail.style.color = "black";
  594. }
  595. }
  596. var CurCountry=GetCurrentCountry();
  597. // dont require state or zip except for US/Canada
  598. if ((CurCountry == L_UnitedStates_Text)||(CurCountry == L_Canada_Text)) {
  599. if(g.UserZipCode.value == "") {
  600. LastErrorField = g.UserZipCode;
  601. g.LabelZIP.className="text-error";
  602. } else {
  603. g.LabelZIP.className="text-primary";
  604. }
  605. if(GetCurrentProvince() == "") {
  606. if(g.selUSState.style.display!="none") {
  607. LastErrorField = g.selUSState;
  608. } else {
  609. LastErrorField = g.selCAProvince;
  610. }
  611. g.StateLabel.className="text-error";
  612. } else {
  613. g.StateLabel.className="text-primary";
  614. }
  615. }
  616. if(g.UserCity.value == "") {
  617. LastErrorField = g.UserCity;
  618. g.LabelCity.className="text-error";
  619. } else {
  620. g.LabelCity.className="text-primary";
  621. }
  622. if(g.UserAddress.value == "") {
  623. LastErrorField = g.UserAddress;
  624. g.LabelAddress.className="text-error";
  625. } else {
  626. g.LabelAddress.className="text-primary";
  627. }
  628. if((g.UserLastName.value == "") && (g.LastNameRow.style.display!="none")) {
  629. LastErrorField = g.UserLastName;
  630. g.LabelLastName.className="text-error";
  631. } else {
  632. g.LabelLastName.className="text-primary";
  633. }
  634. if(g.UserFirstName.value == "") {
  635. g.LabelFirstName.className="text-error";
  636. LastErrorField = g.UserFirstName;
  637. } else {
  638. g.LabelFirstName.className="text-primary";
  639. }
  640. if(LastErrorField==null) {
  641. return true;
  642. }
  643. // handle error
  644. if(LastErrorField==g.UserEmailAddress) {
  645. g.error_mesg.innerText = L_Email_Text;
  646. } else {
  647. g.error_mesg.innerText = L_EnterValid_Text;
  648. }
  649. g.error_mesg.style.display="inline";
  650. try
  651. {
  652. g.btnNext.disabled=false;
  653. }
  654. catch(e) {}
  655. try
  656. {
  657. g.btnBack.disabled=false;
  658. }
  659. catch(e) {}
  660. try
  661. {
  662. g.btnSkip.disabled=false;
  663. }
  664. catch(e) {}
  665. InitButtons();
  666. LastErrorField.focus();
  667. return false;
  668. }
  669. // Function: Start_CheckEnableNextButton
  670. // Description: This function is called everytime a keyup
  671. // event fires on a edit box for first, middle, or last
  672. // name. We then see if we should enable or disable the
  673. // next button based on if every field has a value.
  674. // First || Last
  675. //
  676. function Start_CheckEnableNextButton()
  677. {
  678. try
  679. {
  680. if (g.event == null)
  681. return;
  682. }
  683. catch(e)
  684. {
  685. return;
  686. }
  687. if (Start_CheckLengthRequirement() &&
  688. Start_CheckLengthNotEqualSpaces())
  689. {
  690. g.btnNext.disabled = false;
  691. }
  692. else
  693. {
  694. g.btnNext.disabled = true;
  695. }
  696. InitButtons();
  697. }
  698. function Start_CheckLengthRequirement()
  699. {
  700. if ((g.edt_FirstName.value.length != 0) ||
  701. (g.edt_LastName.value.length != 0))
  702. return true;
  703. else
  704. return false;
  705. }
  706. function Start_CheckLengthNotEqualSpaces()
  707. {
  708. if ((g.edt_FirstName.value.length != NumberOfSpaces(g.edt_FirstName.value)) ||
  709. (g.edt_LastName.value.length != NumberOfSpaces(g.edt_LastName.value)))
  710. return true;
  711. else
  712. return false;
  713. }
  714. // END start.htm
  715. function DoFocus()
  716. {
  717. try
  718. {g_FirstFocusElement.focus();}
  719. catch(e){}
  720. }
  721. //////////////////////////////////////////////////////////////////////////////////////
  722. // regconn.htm
  723. //////////////////////////////////////////////////////////////////////////////////////
  724. var g_RegConnRadioSticky = 1;
  725. function RegConn_LoadMe()
  726. {
  727. InitFrameRef();
  728. GetPageTitle();
  729. if (g_RegConnRadioSticky == 1)
  730. {
  731. g_FirstFocusElement = g.rb_conn_lan;
  732. g.rb_conn_lan.checked = true;
  733. }
  734. else
  735. {
  736. g_FirstFocusElement = g.rb_conn_modem;
  737. g.rb_conn_modem.checked = true;
  738. }
  739. InitButtons();
  740. DoFocus();
  741. }
  742. //////////////////////////////////////////////////////////////////////////////////////
  743. // reglan.htm
  744. //////////////////////////////////////////////////////////////////////////////////////
  745. var ProxySettingsObj = null;
  746. function ProxySettings(ConfigString)
  747. {
  748. this.UseAuto = false;
  749. this.UseScript = false;
  750. this.ScriptUrl = "";
  751. this.UseProxy = false;
  752. this.Server = "";
  753. this.Port = "";
  754. if (ConfigString != null)
  755. {
  756. var i, j;
  757. var Args = ConfigString.split(/ /);
  758. for (i = 0; i < Args.length; i++)
  759. {
  760. switch (Args[i])
  761. {
  762. case 'u':
  763. var ProxyList = Args[++i];
  764. var HttpProxy = null;
  765. // only care about proxy server for HTTP
  766. if (ProxyList.indexOf("=") == -1)
  767. {
  768. HttpProxy = ProxyList;
  769. }
  770. else
  771. {
  772. var Proxys = ProxyList.split(/;/);
  773. if (Proxys != null)
  774. {
  775. for (j = 0; j < Proxys.length; j++)
  776. {
  777. if (Proxys[j].indexOf("http=") == 0)
  778. {
  779. HttpProxy = Proxys[j].substring(5, Proxys[j].length);
  780. break;
  781. }
  782. }
  783. }
  784. }
  785. if (HttpProxy)
  786. {
  787. j = HttpProxy.lastIndexOf(':');
  788. if (j == -1)
  789. {
  790. this.Server = HttpProxy;
  791. }
  792. else
  793. {
  794. this.Server = HttpProxy.substring(0, j);
  795. this.Port = HttpProxy.substring(j+1, HttpProxy.length);
  796. }
  797. }
  798. break;
  799. case 'a':
  800. this.UseAuto = true;
  801. break;
  802. case 'm':
  803. this.UseProxy = true;
  804. break;
  805. }
  806. }
  807. }
  808. }
  809. function RegLan_LoadMe()
  810. {
  811. InitFrameRef();
  812. GetPageTitle();
  813. InitButtons();
  814. if (ProxySettingsObj == null)
  815. {
  816. var ConfigString = window.external.get_ProxySettings();
  817. ProxySettingsObj = new ProxySettings(ConfigString);
  818. }
  819. g.cb_auto_detect.checked = ProxySettingsObj.UseAuto;
  820. g.cb_use_proxy.checked = ProxySettingsObj.UseProxy;
  821. g.txt_proxy_url.value = ProxySettingsObj.Server;
  822. g.txt_proxy_port.value = ProxySettingsObj.Port;
  823. RegLan_upClickHandler();
  824. g_FirstFocusElement = g.btnNext;
  825. DoFocus();
  826. }
  827. function RegLan_upClickHandler()
  828. {
  829. if (g.cb_use_proxy.checked)
  830. {
  831. g.txt_proxy_url.style.backgroundColor = "#ffffff";
  832. g.txt_proxy_url.disabled = false;
  833. g.txt_proxy_port.style.backgroundColor = "#ffffff";
  834. g.txt_proxy_port.disabled = false;
  835. }
  836. else
  837. {
  838. g.txt_proxy_url.style.backgroundColor = "#dddddd";
  839. g.txt_proxy_url.disabled = true;
  840. g.txt_proxy_port.style.backgroundColor = "#dddddd";
  841. g.txt_proxy_port.disabled = true;
  842. }
  843. }
  844. function RegLan(Stage)
  845. {
  846. if (Stage == null)
  847. {
  848. //
  849. // Do the internet connectivity checking ...
  850. //
  851. var L_CheckingConnectivity_Text = "Checking connectivity...";
  852. Span_WPA_MainTitle.innerText = L_CheckingConnectivity_Text;
  853. ResetConnectedToInternetEx();
  854. ConnectedToInternetEx(true, "RegLan(1);");
  855. }
  856. else
  857. {
  858. //
  859. // Use the existing connectivity value
  860. //
  861. if (ConnectedToInternetEx(false))
  862. {
  863. IcsConnect(ICS_CONN_TYPE_REG);
  864. }
  865. else
  866. {
  867. GoNavigate(CKPT_ACT_MSG);
  868. }
  869. }
  870. }
  871. ///////////////////////////////////////////////////////////////////////////////////////
  872. // rdeskerr.htm
  873. ///////////////////////////////////////////////////////////////////////////////////////
  874. function Activation_ResetNetworking()
  875. {
  876. if (window.external.CheckOnlineStatus)
  877. {
  878. ResetDialing();
  879. }
  880. if (g_InitAutodial)
  881. {
  882. window.external.InternetAutodialHangup();
  883. g_InitAutodial = false;
  884. }
  885. }
  886. function reg_desktop_error_LoadMe()
  887. {
  888. InitFrameRef();
  889. GetPageTitle();
  890. Activation_ResetNetworking();
  891. if (g_IsMSRegistrationSuccessful || g_IsOEMRegistrationSuccessful)
  892. {
  893. var L_RegThankYou_Text = "Thank You!";
  894. Span_WPA_MainTitle.innerText = L_RegThankYou_Text;
  895. g.acterror_description_SUCCESS1.style.display="inline";
  896. g.btnQuit.style.visibility = "hidden";
  897. var L_FinishButton_Text = "OK";
  898. g.btnNext.innerHTML = L_FinishButton_Text;
  899. var Accesskey_O = "O";
  900. g.btnNext.accessKey = Accesskey_O;
  901. }
  902. else
  903. {
  904. var L_RegUnable_Text = "Unable to register online";
  905. Span_WPA_MainTitle.innerText = L_RegUnable_Text;
  906. g.acterror_description1.style.display="inline";
  907. }
  908. InitButtons();
  909. g_FirstFocusElement = g.btnNext;
  910. DoFocus();
  911. }
  912. //////////////////////////////////////////////////////////////////////////////////////
  913. // General Default LoadMe function
  914. //////////////////////////////////////////////////////////////////////////////////////
  915. function _Default_LoadMe(SimpleBack, SimpleNext)
  916. {
  917. InitFrameRef();
  918. if (g.btnNext != null)
  919. g_FirstFocusElement = g.btnNext;
  920. else if (g.btnSkip != null)
  921. g_FirstFocusElement = g.btnSkip;
  922. else if (g.btnBack != null)
  923. g_FirstFocusElement = g.btnBack;
  924. InitButtons(SimpleBack, SimpleNext);
  925. if (g_FirstFocusElement != null)
  926. g_FirstFocusElement.focus();
  927. else
  928. g.document.body.focus();
  929. }
  930. function New_Default_LoadMe(SimpleBack, SimpleNext)
  931. {
  932. InitFrameRef();
  933. GetPageTitle();
  934. if (g.btnNext != null)
  935. g_FirstFocusElement = g.btnNext;
  936. else if (g.btnSkip != null)
  937. g_FirstFocusElement = g.btnSkip;
  938. else if (g.btnBack != null)
  939. g_FirstFocusElement = g.btnBack;
  940. InitButtons(SimpleBack, SimpleNext);
  941. if (g_FirstFocusElement != null)
  942. g_FirstFocusElement.focus();
  943. else
  944. g.document.body.focus();
  945. }
  946. function OEMPrivacy_LoadMe(NewSimpleBack, NewSimpleNext)
  947. {
  948. New_Default_LoadMe(NewSimpleBack, NewSimpleNext);
  949. if (g_OEMNameStr.length != 0)
  950. {
  951. var L_Title1_Text = "%1 Privacy Statement";
  952. g.Title_Text.innerText = ApiObj.FormatMessage(L_Title1_Text, g_OEMNameStr);
  953. GetPageTitle();
  954. }
  955. }
  956. //////////////////////////////////////////////////////////////////////////////////////
  957. // MISC Functions
  958. //////////////////////////////////////////////////////////////////////////////////////
  959. // Page Navigation
  960. // InitCKPT, PushCKPT, PopCKPT, CKPTFromVal are meant to handle the behavior for GoBack.
  961. // We only go back to certain pages (i.e., Mouse Tutorial, Sound Check).
  962. // And on some of the pages, we only go back if they haven't been
  963. // completed (i.e., EULA, PID).
  964. //
  965. // So, we push checkpoints if we intend to all coming back to that page.
  966. // We pop checkpoints if we no longer want to come back (e.g., we've
  967. // completed that page.
  968. function InitCKPT()
  969. {
  970. dnCKPT[CKPT_REGRMIND] = new CheckPoint("regsetup\\regrmnd.htm", 0, 0, 0, 0);
  971. dnCKPT[CKPT_REGISTER3] = new CheckPoint("regsetup\\rusrinfo.htm", 0, 0, 0, 0);
  972. dnCKPT[CKPT_REGCONN] = new CheckPoint("regsetup\\regconn.htm", 0, 0, 0, 0);
  973. dnCKPT[CKPT_REGLAN] = new CheckPoint("regsetup\\reglan.htm", 0, 0, 0, 0);
  974. dnCKPT[CKPT_REGDIAL] = new CheckPoint("regsetup\\rdrdyreg.htm", 0, 0, 0, 0);
  975. dnCKPT[CKPT_ACT_MSG] = new CheckPoint("regsetup\\rdeskerr.htm", 0, 0, 0, 0);
  976. dnCKPT[CKPT_DONE] = new CheckPoint("regsetup\\regdone.htm", 0, 0, 0, 0);
  977. PopCKPT();
  978. }
  979. function PushCKPT(ckpt)
  980. {
  981. if (ckpt > 0 && ckpt < CKPT_MAX)
  982. {
  983. var tos = 0;
  984. try
  985. {
  986. tos = ApiObj.get_RegValue(HKEY_LOCAL_MACHINE, OOBE_MAIN_REG_KEY + CKPT_REG_KEY, TOS_REG_VALUE);
  987. }
  988. catch (e) {}
  989. ApiObj.set_RegValue(HKEY_LOCAL_MACHINE, OOBE_MAIN_REG_KEY + CKPT_REG_KEY, tos.toString(), ckpt);
  990. ApiObj.set_RegValue(HKEY_LOCAL_MACHINE, OOBE_MAIN_REG_KEY + CKPT_REG_KEY, TOS_REG_VALUE, ++tos);
  991. g_CurrentCKPT = ckpt;
  992. }
  993. }
  994. function PopCKPT(ckptCheck)
  995. {
  996. var ckpt = 0;
  997. try
  998. {
  999. var tos = ApiObj.get_RegValue(HKEY_LOCAL_MACHINE, OOBE_MAIN_REG_KEY + CKPT_REG_KEY, TOS_REG_VALUE);
  1000. if (tos > 0)
  1001. {
  1002. ckpt = ApiObj.get_RegValue(HKEY_LOCAL_MACHINE, OOBE_MAIN_REG_KEY + CKPT_REG_KEY, (tos - 1).toString());
  1003. if (null == ckptCheck || ckpt == ckptCheck)
  1004. {
  1005. ApiObj.set_RegValue(HKEY_LOCAL_MACHINE, OOBE_MAIN_REG_KEY + CKPT_REG_KEY, TOS_REG_VALUE, --tos);
  1006. ApiObj.DeleteRegValue(HKEY_LOCAL_MACHINE, OOBE_MAIN_REG_KEY + CKPT_REG_KEY, tos.toString());
  1007. }
  1008. }
  1009. }
  1010. catch (e) {}
  1011. if (ckpt > 0 && ckpt < CKPT_MAX)
  1012. {
  1013. g_CurrentCKPT = ckpt;
  1014. }
  1015. else
  1016. g_CurrentCKPT = null;
  1017. }
  1018. function URLFromCKPT(ckpt)
  1019. {
  1020. var str = "";
  1021. if (ckpt > 0 && ckpt < CKPT_MAX)
  1022. {
  1023. str = dnCKPT[ckpt].strURL;
  1024. }
  1025. return str;
  1026. }
  1027. function IndexFromCKPT(ckpt, status)
  1028. {
  1029. var index = 0;
  1030. if (ckpt > 0 && ckpt < CKPT_MAX)
  1031. {
  1032. var checkpoint = dnCKPT[ckpt];
  1033. index = checkpoint.rgindex[status];
  1034. }
  1035. return index;
  1036. }
  1037. function IsLocalFile()
  1038. {
  1039. try
  1040. {
  1041. return (-1 != g.location.protocol.indexOf("file"));
  1042. }
  1043. catch (e)
  1044. {
  1045. return false;
  1046. }
  1047. }
  1048. //////////////////////////////////////////////////////////////////////////////////////
  1049. // public navigation APIs
  1050. //////////////////////////////////////////////////////////////////////////////////////
  1051. function SetBack(strURL)
  1052. {
  1053. g_OEMAddBackURL = strURL;
  1054. }
  1055. function GoCancel(ckpt)
  1056. {
  1057. try
  1058. {
  1059. if (IsLocalFile() && g.event == null)
  1060. return;
  1061. }
  1062. catch(e)
  1063. {
  1064. return;
  1065. }
  1066. switch (g_CurrentCKPT)
  1067. {
  1068. case CKPT_REGDIAL:
  1069. GoNavigate(CKPT_DONE);
  1070. break;
  1071. case CKPT_REGISTER3:
  1072. GoNavigate(CKPT_DONE);
  1073. break;
  1074. case CKPT_REGLAN:
  1075. RegLan();
  1076. break;
  1077. }
  1078. }
  1079. function GoBack(ckpt)
  1080. {
  1081. try
  1082. {
  1083. if (IsLocalFile() && g.event == null)
  1084. return;
  1085. }
  1086. catch(e)
  1087. {
  1088. return;
  1089. }
  1090. if (g_CurrentCKPT == g_DialCKPT)
  1091. ResetDialing();
  1092. if(g_CurrentCKPT == CKPT_REGISTER3)
  1093. {
  1094. Reg3SaveSettings(); // save field settings in case we return to page
  1095. }
  1096. var ckptPrevious = g_CurrentCKPT;
  1097. PopCKPT();
  1098. if (ckptPrevious == g_CurrentCKPT)
  1099. {
  1100. // This handles the case where the current page pushed itself on the stack.
  1101. PopCKPT();
  1102. }
  1103. if (g_CurrentCKPT > 0 && g_CurrentCKPT < CKPT_MAX)
  1104. {
  1105. GoNavigate(g_CurrentCKPT);
  1106. }
  1107. }
  1108. function StatusNavigate()
  1109. {
  1110. var iMove = IndexFromCKPT(g_CurrentCKPT, g_status) - window.external.get_StatusIndex;
  1111. while (iMove > 0)
  1112. {
  1113. window.external.MoveNext();
  1114. --iMove;
  1115. }
  1116. while (iMove < 0)
  1117. {
  1118. window.external.MovePrevious();
  1119. ++iMove;
  1120. }
  1121. }
  1122. ////////////////////////////////////////////////////////////////////
  1123. // DON'T MUCK WITH THE POSITIONING OF THE CASES IN THE SWITCHS BELOW
  1124. ////////////////////////////////////////////////////////////////////
  1125. function GoNavigate(ckptGoHere)
  1126. {
  1127. try
  1128. {
  1129. if (g_bStartup == false)
  1130. {
  1131. if (IsLocalFile())
  1132. {
  1133. if (g.event != null)
  1134. {
  1135. g.event.returnValue = false;
  1136. g.event.cancelBubble = true;
  1137. }
  1138. }
  1139. }
  1140. else
  1141. g_bStartup = false;
  1142. }
  1143. catch(e)
  1144. {
  1145. return;
  1146. }
  1147. switch (ckptGoHere)
  1148. {
  1149. default:
  1150. PushCKPT(ckptGoHere); // sets g_CurrentCKPT = ckptGoHere;
  1151. g.navigate(g_OOBEDir + URLFromCKPT(ckptGoHere));
  1152. break;
  1153. }
  1154. }
  1155. // Description: Disable all the buttons
  1156. // Used to prevent script error caused by
  1157. // double clicking or rapid clicking
  1158. // of two different buttons. E.g. when someone click
  1159. // next and back quickly.
  1160. //
  1161. function DisableAllButtons()
  1162. {
  1163. try
  1164. {
  1165. g.btnNext.disabled=true;
  1166. }
  1167. catch(e) {}
  1168. try
  1169. {
  1170. g.btnBack.disabled=true;
  1171. }
  1172. catch(e) {}
  1173. try
  1174. {
  1175. g.btnSkip.disabled=true;
  1176. }
  1177. catch(e) {}
  1178. try
  1179. {
  1180. InitButtons();
  1181. }
  1182. catch(e) {}
  1183. }
  1184. function GoQuit()
  1185. {
  1186. // var L_strCloseWindow_Text ="Click OK to exit registration reminder.";
  1187. // if (confirm(L_strCloseWindow_Text))
  1188. if (g_RemoveRemind)
  1189. window.external.DeleteRemind(0);
  1190. window.external.Finish();
  1191. }
  1192. function GoNext()
  1193. {
  1194. try
  1195. {
  1196. if (IsLocalFile() && g.event == null)
  1197. return;
  1198. }
  1199. catch(e)
  1200. {
  1201. return;
  1202. }
  1203. DisableAllButtons();
  1204. switch (g_CurrentCKPT)
  1205. {
  1206. case CKPT_REGRMIND:
  1207. if (g_RemoveRemind)
  1208. window.external.DeleteRemind(0);
  1209. if (g.rb_reg_ms_yes.checked || g.rb_reg_oem_yes.checked)
  1210. {
  1211. g_PostToMS = g.rb_reg_ms_yes.checked;
  1212. g_PostToOEM = g.rb_reg_oem_yes.checked;
  1213. GoNavigate(CKPT_REGISTER3);
  1214. }
  1215. else
  1216. {
  1217. window.external.Finish();
  1218. return;
  1219. }
  1220. break;
  1221. case CKPT_REGISTER3:
  1222. if(VerifyReg3Fields())
  1223. {
  1224. Span_WPA_MainTitle.innerText = "Checking connectivity...";
  1225. Reg3SaveSettings();
  1226. if (!ConnectedToInternetEx(true))
  1227. {
  1228. // If not, try AutoDial
  1229. window.external.InternetAutodial();
  1230. ResetConnectedToInternetEx();
  1231. // Check again. InternetAutodial returns success if the user cancels
  1232. if (!ConnectedToInternetEx(true))
  1233. {
  1234. // We can't assume user has modem here because
  1235. // CheckForAnyConnection don't mean having Internet Connection
  1236. if (HasNetwork() && HasModem())
  1237. {
  1238. GoNavigate(CKPT_REGCONN);
  1239. }
  1240. else if (HasNetwork())
  1241. {
  1242. GoNavigate(CKPT_REGLAN);
  1243. }
  1244. else if (HasModem())
  1245. {
  1246. GoNavigate(CKPT_REGDIAL);
  1247. }
  1248. else
  1249. {
  1250. GoNavigate(CKPT_ACTIVERR);
  1251. }
  1252. }
  1253. else
  1254. {
  1255. // if we are connected, advance the checkpoint and send the data
  1256. PushCKPT(CKPT_REGDIAL);
  1257. g_InitAutodial = true;
  1258. // This will set the URL to send the data to and will execute
  1259. // OnConnected in dialmgr.js, which will send the data
  1260. // and navigate to the next (finish) page.
  1261. //
  1262. window.external.Connect(CONNECTED_REGISTRATION, "reg.isp");
  1263. }
  1264. }
  1265. else
  1266. {
  1267. // if we are connected, advance the checkpoint and send the data
  1268. PushCKPT(CKPT_REGDIAL);
  1269. // This will set the URL to send the data to and will execute
  1270. // OnConnected in dialmgr.js, which will send the data
  1271. // and navigate to the next (finish) page.
  1272. //
  1273. window.external.Connect(CONNECTED_REGISTRATION, "reg.isp");
  1274. }
  1275. }
  1276. break;
  1277. case CKPT_REGCONN:
  1278. if (g.rb_conn_lan.checked)
  1279. {
  1280. g_RegConnRadioSticky = 1;
  1281. GoNavigate(CKPT_REGLAN);
  1282. }
  1283. else
  1284. {
  1285. g_RegConnRadioSticky = 2;
  1286. PushCKPT(CKPT_REGDIAL);
  1287. Navigate(URLFromCKPT(CKPT_REGDIAL));
  1288. }
  1289. break;
  1290. case CKPT_REGLAN:
  1291. ProxySettingsObj.UseAuto = g.cb_auto_detect.checked;
  1292. ProxySettingsObj.UseProxy = g.cb_use_proxy.checked;
  1293. ProxySettingsObj.Server = g.txt_proxy_url.value;
  1294. ProxySettingsObj.Port = g.txt_proxy_port.value;
  1295. window.external.set_ProxySettings(
  1296. ProxySettingsObj.UseAuto,
  1297. ProxySettingsObj.UseScript,
  1298. ProxySettingsObj.ScriptUrl,
  1299. ProxySettingsObj.UseProxy,
  1300. ProxySettingsObj.Server + ((ProxySettingsObj.Port == "") ? "" : (":" + ProxySettingsObj.Port))
  1301. );
  1302. RegLan();
  1303. break;
  1304. case CKPT_REGDIAL:
  1305. GoNavigate(CKPT_DONE);
  1306. break;
  1307. case CKPT_ACT_MSG:
  1308. if (!g_IsMSRegistrationSuccessful && !g_IsOEMRegistrationSuccessful)
  1309. {
  1310. GoNavigate(CKPT_REGCONN);
  1311. break;
  1312. }
  1313. // Fall through
  1314. case CKPT_DONE:
  1315. if (g_RemoveRemind)
  1316. window.external.DeleteRemind(0);
  1317. window.external.Finish();
  1318. break;
  1319. default:
  1320. // BUGBUG should we remove the default altogether?
  1321. break;
  1322. }
  1323. }
  1324. // BUGBUG temporary until MSN changes code
  1325. function GoOffline()
  1326. {
  1327. GoNext();
  1328. }
  1329. // Button Event Handlers and Initialization
  1330. function SetLastButtonText()
  1331. {
  1332. if (g.btnNext != null)
  1333. g_LastButtonText = g.btnNextText;
  1334. else if (g.btnBack != null)
  1335. g_LastButtonText = g.btnBackText;
  1336. else if (g.btnRestore != null)
  1337. g_LastButtonText = g.btnRestoreText;
  1338. else if (g.btnCancel != null)
  1339. g_LastButtonText = g.btnCancelText;
  1340. }
  1341. // Function: InitFrameRef
  1342. // Description: Sets up globals to point to buttons
  1343. // Since the buttons exist on the child frame,
  1344. // we want to have quick access to them without
  1345. // going through the collections.
  1346. // WARNING: Call this function at the top of XXX_LoadMe()
  1347. //
  1348. function InitFrameRef()
  1349. {
  1350. g_LastButtonText = null;
  1351. g_FirstFocusElement = null;
  1352. g_LastKeyDown = null;
  1353. g = document.frames("msoobeMain");
  1354. try
  1355. {
  1356. g.document.body.onkeydown = OnKeyDown;
  1357. SetLastButtonText();
  1358. }
  1359. catch(e){}
  1360. }
  1361. function HideButtons(buttons)
  1362. {
  1363. if (null != g.btnBack && (buttons & HIDE_BACK))
  1364. {
  1365. g.btnBack.Hide = true;
  1366. }
  1367. if (null != g.btnNext && (buttons & HIDE_NEXT))
  1368. {
  1369. g.btnNext.Hide = true;
  1370. }
  1371. if (null != g.spanCancel && (buttons & HIDE_CANCEL))
  1372. {
  1373. g.btnSkip.Hide = true;
  1374. }
  1375. if (null != g.spanRestore && (buttons & HIDE_RESTORE))
  1376. {
  1377. g.btnRestore.Hide = true;
  1378. }
  1379. }
  1380. function HandleButtonMouseOver()
  1381. {
  1382. // if((!this.disabled)&&(this.tagName=="BUTTON"))
  1383. // this.className="buttons-hover";
  1384. }
  1385. function HandleButtonMouseOut()
  1386. {
  1387. // if((!this.disabled)&&(this.tagName=="BUTTON"))
  1388. // this.className="buttons";
  1389. }
  1390. function InitButtons(SimpleBack, SimpleNext)
  1391. {
  1392. if(g.btnSkip!=null) {
  1393. g.btnSkip.onmouseover = HandleButtonMouseOver;
  1394. g.btnSkip.onmouseout = HandleButtonMouseOut;
  1395. if(!g.btnSkip.disabled) {
  1396. g.btnSkip.onclick = GoCancel;
  1397. // dont enable onfocus,onblur handlers until issues in 88615 are resolved
  1398. // g.btnSkip.onfocus = HandleButtonMouseOver;
  1399. // g.btnSkip.onblur = HandleButtonMouseOut;
  1400. g.btnSkip.className="buttons";
  1401. } else {
  1402. g.btnSkip.className="buttons-disabled";
  1403. }
  1404. }
  1405. if (g.btnNext != null)
  1406. {
  1407. g.btnNext.onmouseover = HandleButtonMouseOver;
  1408. g.btnNext.onmouseout = HandleButtonMouseOut;
  1409. if (!g.btnNext.disabled)
  1410. {
  1411. if (SimpleNext == null)
  1412. {
  1413. g.btnNext.onclick = GoNext;
  1414. }
  1415. else
  1416. {
  1417. g.btnNext.onclick = SimpleNavNext;
  1418. }
  1419. g.btnNext.className="buttons";
  1420. }
  1421. else
  1422. {
  1423. g.btnNext.className="buttons-disabled";
  1424. }
  1425. }
  1426. if (g.btnBack != null)
  1427. {
  1428. g.btnBack.onmouseover = HandleButtonMouseOver;
  1429. g.btnBack.onmouseout = HandleButtonMouseOut;
  1430. if (!g.btnBack.disabled)
  1431. {
  1432. if (SimpleBack == null)
  1433. {
  1434. g.btnBack.onclick = GoBack;
  1435. }
  1436. else
  1437. {
  1438. g.btnBack.onclick = SimpleNavBack;
  1439. }
  1440. g.btnBack.className="buttons";
  1441. }
  1442. else
  1443. {
  1444. g.btnBack.className="buttons-disabled";
  1445. }
  1446. }
  1447. try
  1448. {
  1449. if(g.btnQuit != null) {
  1450. g.btnQuit.onmouseover = HandleButtonMouseOver;
  1451. g.btnQuit.onmouseout = HandleButtonMouseOut;
  1452. if(g.btnQuit.disabled == false) {
  1453. g.btnQuit.onclick = GoQuit;
  1454. g.btnQuit.className="buttons";
  1455. } else {
  1456. g.btnQuit.className="buttons-disabled";
  1457. }
  1458. }
  1459. } catch(e) {}
  1460. }
  1461. var g_LastKeyDown = null;
  1462. function OnKeyDown()
  1463. {
  1464. try
  1465. {
  1466. if (IsLocalFile() && g.event == null)
  1467. return;
  1468. }
  1469. catch(e)
  1470. {
  1471. return;
  1472. }
  1473. if (g.event.altKey)
  1474. {
  1475. g_LastKeyDown = String.fromCharCode(g.event.keyCode);
  1476. if (g_LastKeyDown != null)
  1477. g_LastKeyDown = g_LastKeyDown.toUpperCase();
  1478. }
  1479. else
  1480. g_LastKeyDown = null;
  1481. }
  1482. // VALIDATION ROUTINES
  1483. function KeyPressIsNumeric()
  1484. {
  1485. try
  1486. {
  1487. if (IsLocalFile() && g.event == null)
  1488. return;
  1489. }
  1490. catch(e)
  1491. {
  1492. return;
  1493. }
  1494. if (!IsNumeric(g.event.keyCode))
  1495. {
  1496. g.event.keyCode = 0;
  1497. g.event.returnValue = false;
  1498. }
  1499. }
  1500. function IsNumeric(keyCode)
  1501. {
  1502. if ((keyCode >= 48/*0*/) && (keyCode <= 57/*9*/))
  1503. return true;
  1504. else
  1505. return false;
  1506. }
  1507. function IsSpecial(keyCode)
  1508. {
  1509. // BUGBUG DISABLED FOR BETA
  1510. /*
  1511. var bFound = false;
  1512. var iPosition = 0;
  1513. for (;iPosition < g_SpecialChars.length; iPosition++)
  1514. {
  1515. if (g_SpecialChars.charCodeAt(iPosition) == keyCode)
  1516. {
  1517. bFound = true;
  1518. break;
  1519. }
  1520. }
  1521. return bFound;
  1522. */
  1523. return false;
  1524. }
  1525. function KeyPressIsValid()
  1526. {
  1527. try
  1528. {
  1529. if (IsLocalFile() && g.event == null)
  1530. return;
  1531. }
  1532. catch(e)
  1533. {
  1534. return;
  1535. }
  1536. if (!IsAlpha(g.event.keyCode) &&
  1537. !IsSpecial(g.event.keyCode) &&
  1538. !IsNumeric(g.event.keyCode))
  1539. {
  1540. g.event.keyCode = 0;
  1541. g.event.returnValue = false;
  1542. }
  1543. }
  1544. function KeyPressIsAlpha()
  1545. {
  1546. try
  1547. {
  1548. if (IsLocalFile() && g.event == null)
  1549. return;
  1550. }
  1551. catch(e)
  1552. {
  1553. return;
  1554. }
  1555. if (!IsAlpha(g.event.keyCode))
  1556. {
  1557. g.event.keyCode = 0;
  1558. g.event.returnValue = false;
  1559. }
  1560. }
  1561. function IsAlpha(keyCode)
  1562. {
  1563. // BUGBUG DISABLED FOR BETA
  1564. /*
  1565. var strKeyCode = String.fromCharCode(keyCode);
  1566. var re1 = new RegExp("\w");
  1567. var re2 = new RegExp("\D");
  1568. strKeyCode.match(re1);
  1569. strKeyCode.match(re2);
  1570. //return ((strKeyCode.match(re1) != null) && (strKeyCode.match(re2) != null));
  1571. */
  1572. // if ((keyCode >= 97/*a*/ && keyCode <= 122/*z*/) ||
  1573. // (keyCode >= 65/*A*/ && keyCode <= 90 /*Z*/))
  1574. return true;
  1575. // else
  1576. // return false;
  1577. }
  1578. function NumberOfSpaces(strValue)
  1579. {
  1580. /*
  1581. var NASexp = RegExp("\s");
  1582. var result = strValue.match(NASexp);
  1583. return ((result == null) || (result.length != strValue.length));
  1584. */
  1585. var iSpaceCount = 0;
  1586. for (iPosition = 0; iPosition < strValue.length; iPosition ++)
  1587. {
  1588. if (strValue.charAt(iPosition) == ' ')
  1589. {
  1590. iSpaceCount++;
  1591. }
  1592. }
  1593. return iSpaceCount;
  1594. }
  1595. function KeyCodeToUpper()
  1596. {
  1597. var strKeyCode = String.fromCharCode(g.event.keyCode);
  1598. strKeyCode = strKeyCode.toUpperCase();
  1599. g.event.keyCode = strKeyCode.charCodeAt(0);
  1600. }
  1601. // END VALIDATION ROUTINES
  1602. var vCurItem = 0;
  1603. function SetupPageLayout()
  1604. {
  1605. var WPAWindowHeight = document.body.clientHeight;
  1606. var WPAWindowWidth = document.body.clientWidth;
  1607. if(0 != window.external.Directions.get_AppMode())
  1608. {
  1609. document.all.ifrmMainFrame.style.height = WPAWindowHeight - 93;
  1610. document.all.ifrmMainFrame.style.width = WPAWindowWidth;
  1611. }
  1612. WPABackground.src = 'images/wpaback.jpg';
  1613. WPATop.src = 'images/wpatop.jpg';
  1614. WPABottom.src = 'images/wpabtm.jpg';
  1615. WPAFlag.src = 'images/wpaflag.jpg';
  1616. WPABottom.style.top = WPAWindowHeight - 45;
  1617. }
  1618. window.onresize = SetupPageLayout;
  1619. function InitApplication()
  1620. {
  1621. var bNoModem = false;
  1622. SetupPageLayout();
  1623. g_bStartup = true;
  1624. InitFrameRef();
  1625. if ( 1 == DirObj.get_Offline() || window.external.CheckDialReady() != ERR_COMM_NO_ERROR)
  1626. {
  1627. bNoModem = true;
  1628. g_status = STATUS_OFF;
  1629. }
  1630. InitCKPT();
  1631. // if we are in appmode, we must nuke the stack and restart each time
  1632. if (0 != DirObj.get_AppMode)
  1633. {
  1634. do
  1635. {
  1636. PopCKPT();
  1637. }
  1638. while (null != g_CurrentCKPT);
  1639. }
  1640. GoNavigate(CKPT_REGRMIND);
  1641. spnPage.style.visibility = "visible";
  1642. }
  1643. function GetPageTitle()
  1644. {
  1645. Span_WPA_MainTitle.innerText = g.Title_Text.innerText;
  1646. }
  1647. </script>
  1648. </HEAD>
  1649. <BODY DIR=LTR bgcolor="#4E6FD6" topMargin=0 leftMargin=0 onload="InitApplication();" scroll=no tabIndex=-1 rightMargin=0>
  1650. <!-- WPA images, dynamic layout positioning will be done in SetupPageLayout() function -->
  1651. <IMG ID=WPABackground style="LEFT: 0px; TOP: 0px; POSITION: absolute; z-index:-99;" alt="">
  1652. <IMG ID=WPATop style="LEFT: 0px; TOP: 0px; POSITION: absolute; z-index:-97;" alt="">
  1653. <IMG ID=WPABottom style="LEFT: 0px; TOP: 0px; POSITION: absolute; z-index:-96;" alt="">
  1654. <!-- Don't alter this table structure. It's designed to support BiDi and Non-BiDi. -->
  1655. <TABLE WIDTH="95%" BORDER=0 style="POSITION: absolute; LEFT: 20px; TOP: 0px;" CELLPADDING=0 CELLSPACING=0>
  1656. <TR>
  1657. <TD nowrap VALIGN=MIDDLE>
  1658. <SPAN id=Span_WPA_MainTitle class="title" style="height: 28px;" tabIndex=-1>
  1659. </SPAN>
  1660. </TD>
  1661. <TD WIDTH="99%">&nbsp;
  1662. </TD>
  1663. <TD VALIGN=TOP>
  1664. <IMG ID=WPAFlag alt="">
  1665. </TD>
  1666. </TR>
  1667. </TABLE>
  1668. <SPAN id=spnPage style="VISIBILITY: hidden" tabIndex=-1>
  1669. <span id=spnMainFrame style="POSITION: absolute; LEFT: 0px; TOP: 48px; width=100%; height=100%;" tabIndex=-1>
  1670. <IFRAME ALLOWTRANSPARENCY="true" frameBorder=no width="100%" height="100%" id=ifrmMainFrame name=msoobeMain src="about:blank" tabIndex=0></IFRAME>
  1671. </SPAN>
  1672. </SPAN>
  1673. </BODY>
  1674. </HTML>