function isNull( field , fieldName) { selected = 0; fieldIsNull = 0; if ( field.type == "text" || field.type == "password" || field.type == "textarea" ) { if ( field.value == "" ) fieldIsNull = 1; } else if ( field.type == "select-one" ) { if ( field.options[field.selectedIndex].value == "%null%") fieldIsNull = 1; } else if ( field.type == "select-multiple" ) { fieldIsNull = 1; for ( i = 0; i < field.length; i++ ) if ( field.options[i].selected ) fieldIsNull = 0; } else if ( field.type == "undefined" || field.type == "checkbox" || field.type == "radio" ) { fieldIsNull = 1; for ( i = 0; i < field.length; i++ ) if ( field[i].checked ) fieldIsNull = 0; } if ( fieldIsNull ) { if ( isNull.arguments.length == 1 ) alert( " Value cannot be null." ); else alert( fieldName + " Cannot be Blank." ); if ( field.type == "text" || field.type == "textarea" || field.type == "password" || field.type == "select-one" || field.type == "select-multiple" ) field.focus(); return true; } return false; } function isNumber(theElement) { s = theElement.value; if (isNaN(Math.abs(theElement.value)) && (s.charAt(0) != '#')) { if ( isNumber.arguments.length < 1 ) alert( " Value must be a number." ); else { for (var i=0; (i <= s.length && s.charAt(i) != '.'); ) { if (((s.charAt(i) >= 0) && (s.charAt(i) <= 9)) || (s.charAt(i) == ',' && i != 0 && i != s.length-1) || (s.charAt(i) == '.') ) i++; else { alert( theElement.name + " Value must be a number / must be of proper format" ); theElement.focus(); return false; } } if (s.charAt(i) == '.') { for (i++;i <= s.length; ) { if (((s.charAt(i) >= 0) && (s.charAt(i) <= 9))) i++; else { alert( theElement.name + " Value must be a number / must be of proper format" ); theElement.focus(); return false; } } } } } return true; } function isAlphaNumeric(theElement, theElementName) { var s = theElement.value; var filter=/^[a-zA-Z0-9$-_+=<>() ]{1,}$/; if (s.length == 0 ) return true; if (filter.test(s)) return true; else alert(theElementName + " Requires an AlphaNumeric Value!" ); theElement.focus(); return false; } function isAN(theElement, theElementName) { var s = theElement.value; var filter=/^[a-zA-Z0-9]{1,}$/; if (s.length == 0 ) return true; if (filter.test(s)) return true; else alert(theElementName + " May Only Contain Letters or Numbers!" ); theElement.focus(); return false; } // Date Field Validation function DATEValidation(date_field) { if (date_field.value == ""){ return true } date_field.value = date_field.value.toUpperCase() var inputStr = date_field.value inputStr = inputStr.replace(/-/g, "/"); date_field.value = inputStr; var delim1 = inputStr.indexOf("/") var delim2 = inputStr.lastIndexOf("/") var err_msg = "The date entry is not in an acceptable format.\n\nYou " + "must enter dates in the following format: MM/DD/YYYY." if (delim1 != -1 && delim1 == delim2) { // there is only one delimiter IN the string alert(err_msg) setTimeout(function(){date_field.focus();}, 1); return false } if (delim1 != -1) { // there are delimiters; extract component values var mm = parseInt(inputStr.substring(0,delim1),10) var dd = parseInt(inputStr.substring(delim1+1,delim2),10) var yyyy = parseInt(inputStr.substring(delim2 + 1, inputStr.length),10) } else { // there are no delimiters; extract component VALUES if (isNaN(parseInt(inputStr.substring(1,2),10))) { //If the USER entered a single digit, add a 0 in front inputStr = "0" + inputStr } var mm = parseInt(inputStr.substring(0,2),10) var dd = parseInt(inputStr.substring(2,4),10) var yyyy = parseInt(inputStr.substring(4,inputStr.length),10) } if (isNaN(dd) || isNaN(mm) || isNaN(yyyy)) { // there is a non-numeric character in one OF the component values alert(err_msg) setTimeout(function(){date_field.focus();}, 1); return false } if (mm < 1 || mm > 12) { // date value is not 1 thru 12 alert("Months must be entered between the range of 01 and 12.") setTimeout(function(){date_field.focus();}, 1); return false } if (dd < 1 || dd > 31) { // date value is not 1 thru 31 alert("Days must be entered between the range of 01 and 31 (depending on the month and year).") setTimeout(function(){date_field.focus();}, 1); return false } if (yyyy < 1000 || yyyy > 9999) { // Year must have 4 digits alert("The Year must be 4 digits long.") setTimeout(function(){date_field.focus();}, 1); return false } // check the entered month for too high a value var long_months = new Array ("","January","February","March","April","May","June", "July","August","September","October","November","December") if ((mm == 4 || mm == 6 || mm == 9 || mm == 11) && dd > 30) { alert(long_months[mm] + " has only 30 days.") setTimeout(function(){date_field.focus();}, 1); return false } else if (mm == 2 ) { if (yyyy % 4 > 0 && dd > 28) { alert("February of " + yyyy + " has only 28 days.") date_field.focus(); return false } else if (dd > 29) { alert("February of " + yyyy + " has only 29 days.") setTimeout(function(){date_field.focus();}, 1); return false } } var ddStr = dd.toString() var mmStr = mm.toString() if (mm > 0 && mm < 10) { //If the user entered a single digit, add a 0 in front mmStr = "0" + mmStr } if (dd > 0 && dd < 10) { //If the user entered a single digit, add a 0 in front ddStr = "0" + ddStr } date_field.value = mmStr + "/" + ddStr + "/" + yyyy.toString() return true } function PHONENUMValidation(phnumField) { var ph = phnumField.value; var matchArrparen = ph.match(/^\(?\d{3}\)? ?\d{3}-?\d{4}$/); var matchArrnoparen = ph.match(/^(\d{3})-?(\d{3})-?(\d{4})$/); var matchArrdots = ph.match(/^(\d{3}).?(\d{3}).?(\d{4})$/); var numParens = ph.split('(').length - 1; if (ph == "") {return true;} if (matchArrparen == null && matchArrnoparen == null && matchArrdots == null) { alert("Invalid Phone Number. Must be 10 digits or\n" + "in the form NNN-NNN-NNNN or (NNN) NNN-NNNN."); setTimeout(function(){phnumField.focus();}, 1); } else { if (numParens == 0 && matchArrnoparen != null) { phnumField.value = "(" + matchArrnoparen[1] + ") " + matchArrnoparen[2] + "-" + matchArrnoparen[3]} if (numParens == 0 && matchArrdots != null) { phnumField.value = "(" + matchArrdots[1] + ") " + matchArrdots[2] + "-" + matchArrdots[3]} return true; } } // End --> function EMAILValidation(emailField) { var emailPat=/^(.+)@(.+)$/ if (emailField.value == "") {return true;} var matchArray=emailField.value.match(emailPat) if (matchArray==null) { alert("Email address incorrect format (123@abc.xyz)") setTimeout(function(){emailField.focus();}, 1); } return true; } // End --> function SSNValidation(ssnField) { // Let me explain the following command // '^' used for a match at the beginning of a line // '()' using the parens causeds it to be matched and // Rememeber in the resulting array. // '\d' matches any digit character (0-9) // '{n}' matches 'n' occurrences of the preceding // character. Ex. \d{3} means match three digits // '-?' The question mark is used to match the preceding // character 0 or 1 times. So '-?' means look for 1 or // no dash. // '$' is used for a match at the end of the line. Ex. // \d{4}$ means make sure there are four digits at the end //of the line. var ssn = ssnField.value; var matchArr = ssn.match(/^(\d{3})-?(\d{2})-?(\d{4})$/); var numDashes = ssn.split('-').length - 1; if (ssn == "") {return true;} if (matchArr == null || numDashes == 1) { alert("Invalid SSN. Must be 9 digits or in the form " + "NNN-NN-NNNN."); ssnField.focus(); } else { if (parseInt(matchArr[1],10)==0) { alert("Invalid SSN: SSN's can't start with 000."); ssnField.focus(); } else { if (numDashes == 0) { ssnField.value = matchArr[1] + "-" + matchArr[2] + "-" + matchArr[3]}; return true; } } } // End --> function MouseHover(theObject,theHighlight) { var saved_color= theObject.style.color; var saved_size= theObject.style.fontSize; theObject.onmouseout=function() {this.style.fontSize=saved_size; this.style.color = saved_color;}; theObject.style.cursor='pointer'; theObject.style.color=theHighlight; } function MouseHoverRow(theObject,theHighlight) { var saved_color= theObject.style.backgroundColor; var saved_size= theObject.style.fontSize; theObject.onmouseout=function() {this.style.fontSize=saved_size; this.style.backgroundColor = saved_color;}; theObject.style.backgroundColor=theHighlight; } function doBlink() { // Blink, Blink, Blink... var blink = document.all.tags("BLINK") for (var i=0; i < blink.length; i++) blink[i].style.visibility = blink[i].style.visibility == "" ? "hidden" : "" } function startBlink() { // Make sure it is IE4 if (document.all) setInterval("doBlink()",1000) } window.onload = startBlink; function info(thePage) { var iMyWidth; var iMyHeight; iMyWidth = (window.screen.width/2) - (400 + 10); //half the screen width minus half the new window width (plus 5 pixel borders). iMyHeight = (window.screen.height/2) - (300 + 50); //half the screen height minus half the new window height (plus title and status bars). var theWindow = window.open("", "on_help","status=no,height=300,width=400,resizable=yes,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",scrollbars=yes,toolbar=no,location=no,menubar=no"); theWindow.opener=self; theWindow.focus(); theWindow.document.write(thePage); window.event.returnValue = false; } function lov(kCode_List,kForm,kReturn, kDefault, kLabel, kAdd, kGoto) { sPage.style.display='none'; rPage.style.display='none'; PopUp.style.display='block'; var output = ''; if(document.layers) { document.layers['PopUp'].document.open(); document.layers['PopUp'].document.writeln(output); document.layers['PopUp'].document.close(); } else if (document.all) { document.all.PopUp.innerHTML = output; } else if(document.getElementById && ! document.all) { document.getElementById('PopUp').innerHTML = output; } } function please_wait() { rPage.style.display='block'; sPage.style.display='none'; } function whichKey(e){ var keynum; keynum = e.keyCode; return keynum; } function box_off(k) { k.value='N'; var ck = document.getElementById("c" + k.id); ck.checked=''; } function hide_popup() { parent.PopUp.style.display='none'; parent.sPage.style.display='block'; } function getRealTop(Elem) { yPos = eval(Elem).offsetTop; tempEl = eval(Elem).offsetParent; while (tempEl != null) { yPos += tempEl.offsetTop; tempEl = tempEl.offsetParent; } return yPos; } function getYfromTop(ID) { if (navigator.appName.indexOf("Netscape")>=0 && parseFloat(navigator.appVersion)>=4 && parseFloat(navigator.appVersion)<5) return eval(ID).y; else return getRealTop(ID); } function hide_popup2(target) { parent.PopUp.style.display='none'; parent.sPage.style.display='block'; target.style.background = "yellow"; parent.window.scrollTo(0,getRealTop(target) -30); top.window.scrollTo(0,getRealTop(target) -10); }