///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // JAVAINCLUDE.TXT // Last Updated: 2/11/2004 // This file includes the javascript functions that are used regularly in our applications. A reference to this include file is included in each template page making each of these functions available by default. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function ValidateTextboxLength(limitField, limitNum, message) { if (limitField.value.length > limitNum) { limitField.value = limitField.value.substring(0, limitNum); alert(message); } else { return false; } } function validateNumKey () { var inputKey = event.keyCode; var returnCode = true; if ( inputKey > 47 && inputKey < 58 ) // numbers { return; } else { returnCode = false; event.keyCode = 0; } event.returnValue = returnCode; } function decOnly(i) { var t = i.value; if(t.length>0) { t = t.replace(/[^\d\.]+/g, ''); } var s = t.split('.'); if(s.length>1) { s[1] = s[0] + '.' + s[1]; s.shift(s); } i.value = s.join(''); } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // MULTILINE TEXTBOX MAXLENGTH LIMITER - Usage: ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function MultiMaxLength(text,long) { var maxlength = new Number(long); // Change number to your max length. if (text.value.length > maxlength){ text.value = text.value.substring(0,maxlength); alert(" Only " + long + " chars"); } } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // STATIONARY HEADERS ON SCROLLING DATAGRID ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function DockHeaders(DataGrid, Table) { var str; str = document.all(DataGrid.id).outerHTML; str = (str.substring((str.indexOf(""))+4) + "
").replace(DataGrid.id , Table.id); document.all(Table.id).outerHTML = str; if (document.all(DataGrid.id).rows[1].cells[0].offsetWidth > 0) { for (var i = 0; i < (document.all(DataGrid.id).rows[1].cells.length); i++) { if (i==0) { document.all(Table.id).rows[0].cells[i].width = document.all(DataGrid.id).rows[1].cells[i].offsetWidth+2; document.all(DataGrid.id).rows[1].cells[i].width = document.all(DataGrid.id).rows[1].cells[i].offsetWidth; } else { document.all(Table.id).rows[0].cells[i].width = document.all(DataGrid.id).rows[1].cells[i].offsetWidth; document.all(DataGrid.id).rows[1].cells[i].width = document.all(DataGrid.id).rows[1].cells[i].offsetWidth; } } document.all(DataGrid.id).rows[0].style.display="none"; } else { document.all(Table.id).rows[0].style.display="none"; } } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // GENERIC EDIT MASK - Usage: ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function mask(str,textbox,mask) { var delim = [0] var loc = "" // TAB, END, HOME, DELETE, BACKSPACE, CR, LF, SHIFT if (event.keyCode!=8 && event.keyCode!=9 && event.keyCode!=2 && event.keyCode!=3 && event.keyCode!=10 && event.keyCode!=13 && event.keyCode!=14 && event.keyCode!=15) { // 01,2,3,4,5,6,7,8,9 if (event.keyCode!=48 && event.keyCode!=49 && event.keyCode!=50 && event.keyCode!=51 && event.keyCode!=52 && event.keyCode!=53 && event.keyCode!=54 && event.keyCode!=55 && event.keyCode!=56 && event.keyCode!=57) { return false; } for (var j = 0; j <= mask.length-1; j++) { if (mask.substring(j, j+1) != "#") { delim[j] = mask.substring(j, j+1) str = str.replace(delim[j], "") loc = loc + j + "," } } loc = loc.substring(0, loc.length - 1); var locs = loc.split(','); for (var i = 0; i <= locs.length; i++) { for (var k = 0; k <= str.length; k++) { if (k == locs[i]) { if (str.substring(k, k+1) != delim[locs[i]]) { str = str.substring(0,k) + delim[locs[i]] + str.substring(k,str.length) } } } } textbox.value = str } else { return false; } } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // CONTROL HIGHLIGHTING ON FOCUS - Used in conjunction with COMPASSUtils SetFocusHighlighting function (Must have 'accessible' style in style sheet) ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function fnSetStyle() { event.srcElement.className="accessible"; } function fnUnSetStyle() { event.srcElement.className="textbox"; } // End