Advertisement
Guest User

Untitled

a guest
Aug 24th, 2011
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.27 KB | None | 0 0
  1. function status_clock() {
  2. theTime = window.setTimeout("runClock()", 1000);
  3. var today = new Date();
  4. var display= today.toLocaleString();
  5. status = display;
  6. }
  7.  
  8. function go_page(main, sub) {
  9. switch (main) {
  10. case "system":
  11. switch (sub) {
  12. case "info":
  13. document.location.href = "./system_info.cgi";
  14. break;
  15. case "user":
  16. document.location.href = "./system_user.cgi";
  17. break;
  18. case "default":
  19. document.location.href = "./system_default.cgi";
  20. break;
  21. case "reboot":
  22. document.location.href = "./system_reboot.cgi";
  23. break;
  24. }
  25. break;
  26.  
  27. case "device":
  28. switch (sub) {
  29. case "camera":
  30. document.location.href = "./device_camera.cgi";
  31. break;
  32. case "audio":
  33. document.location.href = "./device_audio.cgi";
  34. break;
  35. case "sensor":
  36. document.location.href = "./device_sensor.cgi";
  37. break;
  38. case "moalarm":
  39. document.location.href = "./device_moalarm.cgi";
  40. break;
  41. case "exalarm":
  42. document.location.href = "./device_exalarm.cgi";
  43. break;
  44. }
  45. break;
  46.  
  47. case "record":
  48. switch (sub) {
  49. case "camera":
  50. document.location.href = "./record_camera.cgi";
  51. break;
  52. case "schedule":
  53. document.location.href = "./record_schedule.cgi";
  54. break;
  55. }
  56. break;
  57.  
  58. case "network":
  59. switch (sub) {
  60. case "network":
  61. document.location.href = "./network_network.cgi";
  62. break;
  63. case "ddns":
  64. document.location.href = "./network_ddns.cgi";
  65. break;
  66. case "notification":
  67. document.location.href = "./network_notification.cgi";
  68. break;
  69. }
  70. break;
  71.  
  72. case "quick":
  73. switch (sub) {
  74. case "setup":
  75. document.location.href = "./quick_setup.cgi";
  76. break;
  77. }
  78. break;
  79.  
  80. case "wconf":
  81. document.location.href = "./system_info.cgi";
  82. break;
  83.  
  84. case "live":
  85. document.location.href = "./web_monitoring.cgi";
  86. break;
  87.  
  88. case "vod":
  89. document.location.href = "./web_playback.cgi";
  90. break;
  91.  
  92. case "logout":
  93. document.location.href = "./logout_proc.cgi";
  94. break;
  95. }
  96. }
  97.  
  98. function trim(value) {
  99. return value.replace(/(^\s*)|(\s*$)/g, "");
  100. }
  101.  
  102. function isvalid_ip(ipvalue) {
  103. var ippattern = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;
  104. var iparray = ipvalue.match(ippattern);
  105.  
  106. var result = "";
  107. if (ipvalue == "0.0.0.0")
  108. return false;
  109. else if (ipvalue == "255.255.255.255")
  110. return false;
  111.  
  112. if (iparray == null) {
  113. return false;
  114. } else {
  115. for (i = 0; i < 4; i++) {
  116. thissegment = iparray[i];
  117. if (thissegment > 255)
  118. return false;
  119. else if ((i == 0) && (thissegment > 255))
  120. return false;
  121. }
  122. }
  123. return true;
  124. }
  125.  
  126. function isvalid_date(y, m, d) {
  127. var er = 0;
  128. var daa = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
  129.  
  130. if ((y%1000 != 0) && (y%4 == 0)) daa[1] = 29;
  131. if ((d>daa[m-1]) || (d<1)) er = 1;
  132. if ((m<1) || (m>12)) er = 1;
  133. if ((m%1 != 0) || (y%1 != 0) || (d%1 != 0)) er = 1;
  134.  
  135. if (er == 1)
  136. return false;
  137.  
  138. return true;
  139. }
  140.  
  141. function isvalid_data(input) {
  142. if (input == null || input.replace(/ /gi,"") == "") {
  143. return false;
  144. }
  145. return true;
  146. }
  147.  
  148. function isvalid_num(input) {
  149. return (/^[0-9]+$/).test(input.remove(arguments[0])) ? true : false;
  150. }
  151.  
  152.  
  153. function isvalid_email(input) {
  154. return (/\w+([-+.]\w+)*@\w+([-.]\w+)*\.[a-zA-Z]{2,4}$/).test(input);
  155. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement