Fixes for restoreSession logic. (#4378)
[openemr.git] / library / js / common.js
bloba09639faf7e5e56b83b52f88c439817a100fdba9
1 function tabbify()
4     $('ul.tabNav a').click(function () {
5         var curChildIndex = $(this).parent().prevAll().length + 1;
6         $(this).parent().parent().children('.current').removeClass('current');
7         $(this).parent().addClass('current');
8         $(this).parent().parent().next('.tabContainer').children('.current').each(function () {
9             $(this).removeClass('current');
10             $(this).parent().children('div:nth-child(' + curChildIndex + ')').each(function () {
11                 $(this).addClass('current');
12             });
13         });
14         return false;
15     });
19 //----------------------------------------
20 function PreventIt(evt)//Specially for the browser chrome.
22 //When focus is on the text box and enter key is pressed the form gets submitted.TO prevent it this function is used.
23     evt = (evt) ? evt : window.event;
24     var charCode = (evt.which) ? evt.which : evt.keyCode;
25     if (charCode == 13) {//tab key,enter key
26         if (evt.preventDefault) {
27             evt.preventDefault();
28         }
29         if (evt.stopPropagation) {
30             evt.stopPropagation();
31         }
32     }
36 // Onkeyup handler for policy number.  Allows only A-Z and 0-9.
37 function policykeyup(e)
39     var v = e.value.toUpperCase();
40     var filteredString = "";
41     for (var i = 0; i < v.length; ++i) {
42         var c = v.charAt(i);
43         if (
44           (c >= '0' && c <= '9') ||
45           (c >= 'A' && c <= 'Z') ||
46           (c == '*') ||
47           (c == '-') ||
48           (c == '_') ||
49           (c == '(') ||
50           (c == ')') ||
51           (c == '#') ||
52           // add for modifiers in fee sheet, Claim::x12clean() will remove from outgoing claims
53           (c == ' ') ||
54           (c == ':')
55         ) {
56             filteredString += c;
57         }
58     }
59     e.value = filteredString;
60     return;