Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.15 KB | None | 0 0
  1. function clockTick()
  2. {
  3.  
  4.  
  5. var currentTime = new Date();
  6. var hours = currentTime.getHours();
  7. var minutes = currentTime.getMinutes();
  8. var seconds = currentTime.getSeconds();
  9. var day = currentTime.getDate();
  10. var month = currentTime.getMonth();
  11. var strMonth;
  12. var year = currentTime.getFullYear();
  13. var ampm = "am";
  14.  
  15.  
  16. strMonth = GetMonth(month);
  17.  
  18. if (hours > 12){
  19. hours = hours - 12;
  20. ampm = "pm";
  21. };
  22. if (minutes < 10){
  23. minutes = "0" + minutes;
  24. };
  25. if (seconds < 10){
  26. seconds = "0" + seconds;
  27. };
  28.  
  29. if ((navigator.platform.indexOf("MacPPC") > -1) && (navigator.userAgent.indexOf("MSIE") > -1)){
  30. //document.clock_form.clock.size = "1";
  31. document.write(" "+ strMonth + " " + day + ", " + year+ " " + hours + ":" + minutes + " " + ampm);// + ":" + seconds + " " + ampm);
  32. }
  33. else {
  34. document.write(" "+ strMonth + " " + day + ", " + year+ " " + hours + ":" + minutes + " " + ampm);// + ":" + seconds + " " + ampm);
  35. //document.clock_form.clock.value = " "+ strMonth + " " + day + ", " + year+ " " + hours + ":" + minutes + " " + ampm;// + ":" + seconds + " " + ampm;
  36. //document.clock_form.clock.blur();
  37. //setTimeout("clockTick()", 1000);
  38. };
  39.  
  40.  
  41.  
  42. }
  43.  
  44. function Set_nav_DateTime(){
  45. var month;
  46. var day;
  47. var hourcount;
  48. var long_month_name;
  49. var current_time;
  50. var ampm = "am";
  51. var current_date = "";
  52.  
  53. current_time = "Thu Mar 14 21:55:20 2019";
  54. fields = current_time.split(/ /);
  55.  
  56. year = fields[fields.length - 1];
  57.  
  58. short_month_name = fields[1];
  59. if (short_month_name == "Jan")
  60. long_month_name = "January";
  61. else if (short_month_name == "Feb")
  62. long_month_name = "February";
  63. else if (short_month_name == "Mar")
  64. long_month_name = "March";
  65. else if (short_month_name == "Apr")
  66. long_month_name = "April";
  67. else if (short_month_name == "May")
  68. long_month_name= "May";
  69. else if (short_month_name == "Jun")
  70. long_month_name = "June";
  71. else if (short_month_name == "Jul")
  72. long_month_name = "July";
  73. else if (short_month_name == "Aug")
  74. long_month_name = "August";
  75. else if (short_month_name == "Sep")
  76. long_month_name = "September";
  77. else if (short_month_name == "Oct")
  78. long_month_name = "October";
  79. else if (short_month_name == "Nov")
  80. long_month_name = "November";
  81. else
  82. long_month_name = "December";
  83.  
  84. day = fields[2];
  85. if (day.length == 0)
  86. day = "1";
  87.  
  88.  
  89. time_fields = fields[3].split(/:/);
  90. if (time_fields.length != 3)
  91. {
  92. time_fields = fields[4].split(/:/);
  93. year = fields[3];
  94. }
  95. hour = time_fields[0];
  96. minute = time_fields[1];
  97. second = time_fields[2];
  98.  
  99. if (hour > 12 )
  100. {
  101. hour = hour- 12;
  102. ampm = "pm";
  103. }
  104. /* adds an extra 0, minute already has a leading 0
  105. if (minute < 10)
  106. {minute = "0" + minute;};
  107. */
  108.  
  109. current_date = long_month_name + " " + day + ", " + year + " " + hour + ":" + minute + " " + ampm;
  110. document.write(current_date);
  111. return true;
  112. }
  113.  
  114. function GetDate(datestr)
  115. {
  116.  
  117.  
  118. var currentTime = new Date();
  119. var hours = currentTime.getHours();
  120. var minutes = currentTime.getMinutes();
  121. var seconds = currentTime.getSeconds();
  122. var day = currentTime.getDate();
  123. var month = currentTime.getMonth();
  124. var strMonth;
  125. var year = currentTime.getFullYear();
  126. var ampm = "am";
  127. var strDate = "";
  128. var spacer = "";
  129.  
  130. strMonth = GetMonth(month);
  131.  
  132. if (hours > 12){
  133. hours = hours - 12;
  134. ampm = "pm";
  135. };
  136. if (minutes < 10){
  137. minutes = "0" + minutes;
  138. };
  139.  
  140. if (datestr.toUpperCase() == 'HOUR'){
  141. return hours;
  142. };
  143.  
  144. if (datestr.toUpperCase() == 'MINUTE'){
  145. return minutes;
  146. };
  147. if (datestr.toUpperCase() == 'SECOND'){
  148. return seconds;
  149. };
  150. if (datestr.toUpperCase() == 'AMPM'){
  151. return ampm;
  152. };
  153.  
  154. if (datestr.toUpperCase() == 'DAY'){
  155. return day;
  156. };
  157. if (datestr.toUpperCase() == 'MONTH'){
  158. return strMonth;
  159. };
  160. if (datestr.toUpperCase() == 'YEAR'){
  161. return year;
  162. };
  163.  
  164. }
  165.  
  166. function GetMonth(month){
  167. var strMonth;
  168. switch(month)
  169. {
  170. case 0:
  171. strMonth = "January";
  172. break;
  173. case 1:
  174. strMonth = "February";
  175. break;
  176. case 2:
  177. strMonth = "March";
  178. break;
  179. case 3:
  180. strMonth = "April";
  181. break;
  182. case 4:
  183. strMonth = "May";
  184. break;
  185. case 5:
  186. strMonth = "June";
  187. break;
  188. case 6:
  189. strMonth = "July";
  190. break;
  191. case 7:
  192. strMonth = "August";
  193. break;
  194. case 8:
  195. strMonth = "September";
  196. break;
  197. case 9:
  198. strMonth = "October";
  199. break;
  200. case 10:
  201. strMonth = "November";
  202. break;
  203. case 11:
  204. strMonth = "December";
  205. break;
  206. }
  207. return strMonth;
  208. }
  209.  
  210. function SetTime(theStr){
  211. var month;
  212. var day;
  213. var hourcount;
  214. var selectstate = "";
  215.  
  216.  
  217. if (theStr.toUpperCase() == "YEAR"){
  218. var dayear = GetDate("year") ;
  219. document.write('<input name="Year" type="text" id="Year" value="' + dayear + '" size="4" maxlength="4" onChange="time_change();">');
  220. }
  221.  
  222.  
  223. if (theStr.toUpperCase() == "MONTH"){
  224. for (var i = 1; i <= 12; i++){
  225. month = GetMonth(i - 1)
  226. if (month == GetDate('month')) {
  227. selectstate = "selected";
  228. }
  229. document.write('<option value="' + month + '" ' + selectstate + '>' + month + '</option>')
  230. selectstate = "";
  231. }
  232. return true;
  233. }
  234.  
  235. if (theStr.toUpperCase() == "DAY"){
  236. var dayValue = "";
  237. for (var i = 1; i <= 31; i++){
  238. if (i == GetDate('day'))
  239. {selectstate = "selected";};
  240.  
  241. if (i < 10)
  242. { dayValue = "0"; };
  243.  
  244. dayValue = dayValue + i;
  245. document.write('<option value="' + dayValue+ '" ' + selectstate + '>' + dayValue + '</option>')
  246. selectstate = "";
  247. dayValue = "";
  248. }
  249. return true;
  250. }
  251.  
  252. if (theStr.toUpperCase() == "HOUR"){
  253. var hourValue = "";
  254. for (var i = 1; i <= 12; i++){
  255. hourcount = i;
  256. if (hourcount == GetDate('hour')) {
  257. selectstate = "selected";
  258. }
  259. if (i < 10) {
  260. hourValue = "0";
  261. }
  262. hourValue = hourValue + i;
  263. document.write('<option value="' + hourValue + '" ' + selectstate + '>' + hourValue + '</option>')
  264. selectstate = "";
  265. hourValue = "";
  266. }
  267. return true;
  268. }
  269.  
  270. if (theStr.toUpperCase() == "MINUTE"){
  271. var minuteValue = "";
  272. for (var i = 0; i <= 59; i++)
  273. {
  274. if (i == GetDate('minute'))
  275. {selectstate = "selected";};
  276. if (i < 10)
  277. {minuteValue = "0";};
  278. minuteValue = minuteValue + i;
  279. document.write('<option value="' + minuteValue + '" ' + selectstate + '>' + minuteValue + '</option>');
  280. selectstate = "";
  281. minuteValue = "";
  282. }
  283. return true;
  284. }
  285.  
  286. if (theStr.toUpperCase() == "SECOND"){
  287. var current = GetDate('second');
  288. var secondValue = "";
  289. for (var i = 0; i <= 59; i++){
  290. if (i == current)
  291. {selectstate = "selected";};
  292.  
  293. if (i < 10)
  294. {secondValue = "0";};
  295. secondValue = secondValue + i;
  296. document.write('<option value="' + secondValue + '" ' + selectstate + '>' + secondValue + '</option>')
  297. selectstate = "";
  298. secondValue = "";
  299. }
  300. return true;
  301. }
  302.  
  303. if (theStr.toUpperCase() == "AMPM"){
  304. var amselectstate = "";
  305. var pmselectstate = "";
  306.  
  307. if (GetDate('ampm') == 'am') {
  308. amselectstate = "selected";
  309. }
  310.  
  311. if (GetDate('ampm') == 'pm') {
  312. pmselectstate = "selected";
  313. }
  314. document.write('<option value="AM" ' + amselectstate + '>AM</option>');
  315. document.write('<option value="PM" ' + pmselectstate + '>PM</option>');
  316.  
  317. }
  318. return true;
  319. }
  320.  
  321. function WriteMenu(section){
  322.  
  323. document.write('<table width="100%"border="0" cellspacing="0" cellpadding="4">');
  324. document.write('<tr>');
  325. document.write('<td><a href="../systemsummary/index.asp"><img src="../images/icons35_syssummary.gif" width="185" height="35" border="0"></a></td>');
  326. document.write('</tr>');
  327. document.write('<tr>');
  328. document.write('<td><a href="../generalsetup/index.asp"><img src="../images/icons35_generalsetup.gif" width="185" height="35" border="0"></a>');
  329. // General Setup submenu
  330. if (section == "General"){
  331. document.write('<br><table width="190" border="0" cellspacing="2" cellpadding="2">');
  332. document.write('<tr>');
  333. document.write('<td width="2" valign="top"><img src="images/spacer.gif" width="2" height="1"></td>');
  334. document.write('<td valign="top"><img src="../images/dot.gif" width="10" height="14"></td>');
  335. document.write('<td valign="top"><a href="login.asp">Update Username and Password </a></td>');
  336. document.write('</tr>');
  337. document.write('<tr>');
  338. document.write('<td valign="top">&nbsp;</td>');
  339. document.write('<td valign="top"><img src="../images/dot.gif" width="10" height="14"></td>');
  340. document.write('<td valign="top"><a href="datetime.asp">Update Date/Time Settings </a></td>');
  341. document.write('</tr>');
  342. document.write('<tr>');
  343. document.write('<td valign="top">&nbsp;</td>');
  344. document.write('<td valign="top"><img src="../images/dot.gif" width="10" height="14"></td>');
  345. document.write('<td valign="top"><a href="networkname.asp">Update Device / Workgroup Names </a></td>');
  346. document.write('</tr>');
  347. document.write('<tr>');
  348. document.write('<td valign="top">&nbsp;</td>');
  349. document.write('<td valign="top"><img src="../images/dot.gif" width="10" height="14"></td>');
  350. document.write('<td valign="top"><a href="networkaddress.asp">Obtain a Network Address </a></td>');
  351. document.write('</tr>');
  352. document.write('<tr>');
  353. document.write('<td valign="top">&nbsp;</td>');
  354. document.write('<td valign="top"><img src="../images/dot.gif" width="10" height="14"></td>');
  355. document.write('<td valign="top"><a href="firmware.asp">Upgrade Firmware </a></td>');
  356. document.write('</tr></table>');
  357. };
  358. //End of general setup submenu
  359. document.write('</td>');
  360. document.write('</tr>');
  361. document.write('<tr>');
  362. document.write('<td><a href="../filesharing/index.asp"><img src="../images/icons35_filesharing.gif" width="185" height="35" border="0"></a>');
  363. //File Sharing submenu
  364. if (section == "File"){
  365. document.write('<br><table width="190" border="0" cellspacing="2" cellpadding="2">');
  366. document.write('<tr>');
  367. document.write('<td width="2" valign="top"><img src="images/spacer.gif" width="2" height="1"></td>');
  368. document.write('<td valign="top"><img src="../images/dot.gif" width="10" height="14"></td>');
  369. document.write('<td valign="top"><a href="addshare.asp">Add a Shared Folder</a></td>');
  370. document.write('</tr>');
  371. document.write('<tr>');
  372. document.write('<td valign="top">&nbsp;</td>');
  373. document.write('<td valign="top"><img src="../images/dot.gif" width="10" height="14"></td>');
  374. document.write('<td valign="top"><a href="renameshare.asp">Rename a Shared Folder</a></td>');
  375. document.write('</tr>');
  376. document.write('<tr>');
  377. document.write('<td valign="top">&nbsp;</td>');
  378. document.write('<td valign="top"><img src="../images/dot.gif" width="10" height="14"></td>');
  379. document.write('<td valign="top"><a href="removeshare.asp">Remove a Shared Folder</a></td>');
  380. document.write('</tr>');
  381. document.write('<tr>');
  382. document.write('<td valign="top">&nbsp;</td>');
  383. document.write('<td valign="top"><img src="../images/dot.gif" width="10" height="14"></td>');
  384. document.write('<td valign="top"><a href="updatesecurity.asp">Update Security Settings</a> </td>');
  385. document.write('</tr></table>');
  386. //document.write('<tr>');
  387. //document.write('<td valign="top">&nbsp;</td>');
  388. //document.write('<td valign="top"><img src="../images/dot.gif" width="10" height="14"></td>');
  389. //document.write('<td valign="top"><a href="prioritywizard.asp">File Transfer Priorities </a></td>');
  390. //document.write('</tr>');
  391. };
  392. //End of File Sharing submenu
  393. document.write('</td>');
  394. document.write('</tr>');
  395. document.write('<tr>');
  396. document.write('<td><a href="../printersharing/index.asp"><img src="../images/icons35_printersharing.gif" width="185" height="35" border="0"></a></td>');
  397. document.write('</tr>');
  398. document.write('<tr>');
  399. document.write('<td><a href="../drivemgt/index.asp"><img src="../images/icons35_drivemanagement.gif" width="185" height="35" border="0"></a>');
  400. //Drive Management submenu
  401. if (section == "Drive"){
  402. document.write('<br><table width="190" border="0" cellspacing="2" cellpadding="2">');
  403. document.write('<tr>');
  404. document.write('<td width="2" valign="top"><img src="images/spacer.gif" width="2" height="1"></td>');
  405. document.write('<td valign="top"><img src="../images/dot.gif" width="10" height="14"></td>');
  406. document.write('<td valign="top"><a href="diskhealth.asp">View Disk Health </a></td>');
  407. document.write('</tr>');
  408. /*
  409. document.write('<tr>');
  410. document.write('<td valign="top">&nbsp;</td>');
  411. document.write('<td valign="top"><img src="../images/dot.gif" width="10" height="14"></td>');
  412. document.write('<td valign="top"><a href="usb.asp">Change USB Drive Auto-Behavior </a></td>');
  413. document.write('</tr>');
  414. */
  415. document.write('<tr>');
  416. document.write('<td valign="top">&nbsp;</td>');
  417. document.write('<td valign="top"><img src="../images/dot.gif" width="10" height="14"></td>');
  418. document.write('<td valign="top"><a href="addpool.asp">Create a New Volume </a></td>');
  419. document.write('</tr>');
  420. document.write('<tr>');
  421. document.write('<td valign="top">&nbsp;</td>');
  422. document.write('<td valign="top"><img src="../images/dot.gif" width="10" height="14"></td>');
  423. document.write('<td valign="top"><a href="resizepool.asp">Resize a Volume </a></td>');
  424. document.write('</tr>');
  425. document.write('<tr>');
  426. document.write('<td valign="top">&nbsp;</td>');
  427. document.write('<td valign="top"><img src="../images/dot.gif" width="10" height="14"></td>');
  428. document.write('<td valign="top"><a href="renamepool.asp">Rename a Volume </a></td>');
  429. document.write('</tr>');
  430. document.write('<tr>');
  431. document.write('<td valign="top">&nbsp;</td>');
  432. document.write('<td valign="top"><img src="../images/dot.gif" width="10" height="14"></td>');
  433. document.write('<td valign="top"><a href="removepool.asp">Remove a Volume</a> </td>');
  434. document.write('</tr>');
  435. /*
  436. document.write('<tr>');
  437. document.write('<td valign="top">&nbsp;</td>');
  438. document.write('<td valign="top"><img src="../images/dot.gif" width="10" height="14"></td>');
  439. document.write('<td valign="top"><a href="addmirrorspare.asp">Add a Mirror or Spare </a></td>');
  440. document.write('</tr>');
  441. document.write('<tr>');
  442. document.write('<td valign="top">&nbsp;</td>');
  443. document.write('<td valign="top"><img src="../images/dot.gif" width="10" height="14"></td>');
  444. document.write('<td valign="top"><a href="removemirrorspare.asp">Remove a Mirror or Spare </a></td>');
  445. document.write('</tr>');
  446. */
  447. document.write('<tr>');
  448. document.write('<td valign="top">&nbsp;</td>');
  449. document.write('<td valign="top"><img src="../images/dot.gif" width="10" height="14"></td>');
  450. document.write('<td valign="top"><a href="claimdisk.asp">Claim a Drive</a></td>');
  451. document.write('</tr>');
  452. document.write('<tr>');
  453. document.write('<td valign="top">&nbsp;</td>');
  454. document.write('<td valign="top"><img src="../images/dot.gif" width="10" height="14"></td>');
  455. document.write('<td valign="top"><a href="renamedisk.asp">Rename a Drive</a></td>');
  456. document.write('</tr>');
  457. document.write('<tr>');
  458. document.write('<td valign="top">&nbsp;</td>');
  459. document.write('<td valign="top"><img src="../images/dot.gif" width="10" height="14"></td>');
  460. document.write('<td valign="top"><a href="unclaimdisk.asp">Unclaim a Drive</a></td>');
  461. document.write('</tr>');
  462. document.write('</table>');
  463. };
  464. //End of Drive Management submenu
  465. document.write('</td>');
  466. document.write('</tr>');
  467. document.write('<tr>');
  468. document.write('<td><a href="../help/index.asp"><img src="../images/icons35_help.gif" width="185" height="35" border="0"></a>');
  469. //Help submenu
  470. if (section == "help"){
  471. document.write('<br><table width="190" border="0" cellspacing="2" cellpadding="2">');
  472. document.write('<tr>');
  473. document.write('<tr>');
  474. document.write('<td valign="top">&nbsp;</td>');
  475. /* document.write('<td width="2" valign="top"><img src="images/spacer.gif" width="2" height="1"></td>'); */
  476. document.write('<td valign="top"><img src="../images/dot.gif" width="10" height="14"></td>');
  477. document.write('<td valign="top"><a href="solutioncenter.asp">Troubleshooting/FAQs</a></td>');
  478. document.write('</tr>');
  479. //document.write('<tr>');
  480. //document.write('<td valign="top">&nbsp;</td>');
  481. //document.write('<td valign="top"><img src="../images/dot.gif" width="10" height="14"></td>');
  482. //document.write('<td valign="top"><a href="userguide.asp">Online User Guide </a></td>');
  483. //document.write('</tr>');
  484. document.write('<td valign="top">&nbsp;</td>');
  485. document.write('<td valign="top"><img src="../images/dot.gif" width="10" height="14"></td>');
  486. document.write('<td valign="top"><a href="glossary.asp">Glossary </a></td>');
  487. document.write('</tr></table>');
  488. };
  489. //End of HELP Submenu
  490. document.write('</td>');
  491. document.write('</tr>');
  492. document.write('</table>');
  493. }
  494.  
  495. function WriteHeader(section){
  496. document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0">');
  497. document.write('<tr>');
  498. document.write('<td><img src="../images/header2.jpg" width="750" height="79"></td>');
  499. document.write('</tr>');
  500. document.write('<tr>');
  501. //document.write('<td align="right" class="clockframe" valign="top">');
  502. //document.write('<table width="200" border="0" cellpadding="2">');
  503. document.write('<td align="center" class="clockframe" valign="top">');
  504. document.write('<table width="715" border="0" cellpadding="2">');
  505. document.write('<tr>');
  506. document.write('<td align="right" class="clockframe">');
  507. document.write('<script language="javascript" type="text/javascript">Set_nav_DateTime();</script>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;');
  508. document.write('</td>');
  509. document.write('</tr>');
  510. document.write('<tr>');
  511. if (section == "nazwizard" || section == "drivemgtwizard" || section == "wizard" || section == "addshare" ){
  512. document.write('<td valign="top" align="right"><a href="../home.asp" target="_top"><img src="../images/icons35_home.gif" width="96" height="35" border="0"></a>&nbsp;&nbsp;&nbsp;</td>');
  513. }
  514. else if (section == "setup" || section == "main")
  515. {
  516. document.write('<td valign="top" align="right">&nbsp;&nbsp;&nbsp;&nbsp;</td>');
  517. }
  518. else if (section == "setup_end")
  519. {
  520. document.write('<td valign="top" align="right"><a href="/home.asp" target="_top"><img src="../images/icons35_advancedsetup.gif" width="159" height="35" border="0"></a>&nbsp;&nbsp;&nbsp;&nbsp;</td>');
  521. }
  522. else
  523. {
  524. document.write('<td valign="top" align="right"><a href="/home.asp"><img src="../images/icons35_home.gif" width="96" height="35" border="0"></a>&nbsp;&nbsp;&nbsp;</td>');
  525. };
  526. document.write('</tr>');
  527. document.write('</table></td>');
  528. document.write('</tr>');
  529. document.write('</table>');
  530.  
  531. }
  532.  
  533. function WriteFooter(section){
  534. document.write('<br>');
  535. document.write('<p style="font-size: 0.8em; color: navy;">Copyright &#169 2005 Western Digital Technologies, Inc. All rights reserved.</p>');
  536. document.write('<br>');
  537. }
  538.  
  539.  
  540. function CreateBuildInfoString( rawString )
  541. {
  542. var lines = rawString.split( "\n" );
  543. return lines[ 0 ].split( "." ).slice( 0, 3 ).join( "." );
  544. }
  545. function CreateBuildInfoStringExt( rawString )
  546. {
  547. var lines = rawString.split( "\n" );
  548. return lines[ 0 ];
  549. }
  550.  
  551. function trim(val)
  552. {
  553. val = val+'';
  554. for (var startIndex=0;startIndex<val.length && val.substring(startIndex,startIndex+1) == ' ';startIndex++);
  555. for (var endIndex=val.length-1; endIndex>startIndex && val.substring(endIndex,endIndex+1) == ' ';endIndex--);
  556. return val.substring(startIndex,endIndex+1);
  557. }
  558.  
  559. function round_decimals(num, decimalNum)
  560. {
  561. var tmpNum;
  562. if(num)
  563. {
  564. tmpNum =num;
  565.  
  566.  
  567. tmpNum *= Math.pow(10,decimalNum);
  568. tmpNum = Math.floor(tmpNum);
  569. tmpNum /= Math.pow(10,decimalNum);
  570.  
  571.  
  572. if (tmpNum - Math.floor(tmpNum) == 0)
  573. {
  574. tmpNum = tmpNum + ".00";
  575. }
  576. else
  577. {
  578. string = tmpNum.toString();
  579. parts = string.split(".");
  580. cents = parts[1];
  581. if (cents.length == 1)
  582. {
  583. tmpNum = tmpNum + "0";
  584. }
  585. }
  586. return tmpNum;
  587.  
  588. }
  589. else
  590. {
  591. return '0.00';
  592. }
  593.  
  594. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement