//declare global variables here var today = new Date() var Year = today.getYear() //Check to see if this textbox is empty or not function ChkText(Object) { if (Object.value == "") { Msg = GetMsg(Object.name) alert ("Please enter " + Msg + ".") Object.focus() return false } return true } //Check to see if a value in the drop-down box is selected function ChkSelect(Object) { if (Object.options[Object.selectedIndex].value == "None") { var aMsg = Object.name.split("_") var Count = aMsg.length //alert (Count) var Msg = "" for (var i=1;i "9") { // alert("Please make sure you entered whole numbers here. No decimals are allowed.") alert("Please enter a valid number: No dollar signs, no commas, just numbers.") return false } } return true } function ChkNumber(Str, Len) { for (var i=0; i< Str.length; i++) { var oneChar = Str.charAt(i) if (oneChar < "0" || oneChar > "9") { // alert("Please make sure you entered whole numbers here. No decimals are allowed.") alert("Please enter a valid number: No dollar signs, no commas, just numbers.") return false } } if (Str.length < Len) { alert("Please make sure you entered a " + Len + "-digit number here.") return false } return true } function ChkFloatNumber(Str) { var WholePart, DecimalPart, Pos Pos = Str.indexOf(".") WholePart = Str.substring(0, Pos) DecimalPart = Str.substring(Pos + 1, Str.length) for (var i=0; i< WholePart.length; i++) { var oneChar = WholePart.charAt(i) if (oneChar < "0" || oneChar > "9") { alert("Please make sure you entered all numbers for the whole part.") return false } } for (var i=0; i< DecimalPart.length; i++) { var oneChar = DecimalPart.charAt(i) if (oneChar < "0" || oneChar > "9") { alert("Please make sure you entered all numbers for the Decimal part.") return false } } return true } //Look for a particular text at an exact location in a string //Searched: string that needs to be searched for //Str: string to search within //Start: start position function ExactLoc(Searched, Str, Start, Len, Msg) { if (Str.substr(Start, Len) != Searched) { alert (Msg + " not correct! Please re-enter.") return false } return true } //Extract only numeric characters (ex. "123") out of the string sent //Str: string to be examined //Len: the expected length of string //Msg: message when something goes wrong function ExtractNum(Str, Len, Msg) { var Newstr = "" for (var i=0; i 12) { alert("Invalid month!") return false } if (theMonth == 01 || theMonth == 03 || theMonth == 05 || theMonth == 07 || theMonth == 08 || theMonth == 10 || theMonth == 12) { if (theDay < 1 || theDay > 31) { alert("Invalid day!") return false } } if (theMonth == 04 || theMonth == 06 || theMonth == 09 || theMonth == 11) { if (theDay < 1 || theDay > 30) { alert("This month has only 30 days.") return false } } if (theMonth == 02) { if (theYear % 4 != 0) { if (theDay < 1 || theDay > 28) { alert("February of this year has only 28 days.") return false } } else { if (theDay < 1 || theDay > 29) { alert("February of this year has only 29 days.") return false } } } return true } //for validating Policy's Effective Date function OlderThanTodayDate(DateObj, strDate)//if the date is in the future, return false { var today = new Date() var theDate = new Date(strDate) if (theDate > today) { alert("Date entered has to be older than today's date !") DateObj.select() return false } return true } //for validating DOB function LaterThanTodayDate(DateObj, strDate)////if the date is in the past, return false { var today = new Date() var theDate = new Date(strDate) if (theDate < today) { alert("Date entered has to be later than today's date !") DateObj.select() return false } return true } //for validating DOB with only one Object parameter function ChkForm() { var aElementR = new Array(100) var aElementNameR = new Array(100) var aElementC = new Array(100) var aElementNameC = new Array(100) var NumR = 0 var NumC = 0 for (var i=0; i4) { Len = aElementNameR[a].substring(4, aElementNameR[a].indexOf("_")) if (Len == "F") //number of Float type { if (isNaN(aElementR[a].value)) { alert ("Please enter numbers only here. Decimals are allowed.") aElementR[a].select() return false } } else if (Len == "D") //Date type { if (!ChkDate(aElementR[a].value)) { return false } } else if (Len == "DO") //Date must be Older than today's date { if (!ChkDate(aElementR[a].value)) { return false } if (!OlderThanTodayDate(aElementR[a], aElementR[a].value)) { return false } } else if (Len == "DL") //Date must be Later than today's date { if (!ChkDate(aElementR[a].value)) { return false } if (!LaterThanTodayDate(aElementR[a], aElementR[a].value)) { return false } } else if (Len == "0") //integer number of any length { if (!IsNumber(aElementR[a].value)) { aElementR[a].select() return false } } else // integer number of specific length { if (!ChkNumber(aElementR[a].value, Len)) { aElementR[a].select() return false } } } } if (aElementNameR[a].substr(1,3) == "cbo") { if (!ChkSelect(aElementR[a])) { return false } } } for (var a=0;a4) { Len = aElementNameC[a].substring(4, aElementNameC[a].indexOf("_")) if (Len == "F") //number of Float type { if (isNaN(aElementC[a].value)) { alert ("Please enter numbers only here. Decimals are allowed.") aElementC[a].select() return false } } else if (Len == "D") //Date type { if (!ChkDate(aElementC[a].value)) { return false } } else if (Len == "DO") //Date must be Older than today's date { if (!ChkDate(aElementC[a].value)) { return false } if (!OlderThanTodayDate(aElementC[a], aElementC[a].value)) { return false } } else if (Len == "DL") //Date must be Later than today's date { if (!ChkDate(aElementC[a].value)) { return false } if (!LaterThanTodayDate(aElementC[a], aElementC[a].value)) { return false } } else if (Len == "0") //integer number of any length { if (!IsNumber(aElementC[a].value)) { aElementC[a].select() return false } } else // integer number of specific length { if (!ChkNumber(aElementC[a].value, Len)) { aElementC[a].select() return false } } } } } } return true } function ChkEligibility(form) { for (var i=0; i < form.elements.length; i++) { var Object = form.elements[i] //get name into variable var objname = form.elements[i].name; if (Object.type == "radio") { for (var u=0;u "0") && Char < "9") { break } } if (Object.defaultChecked) //if a radio button is pre-checked { if (!(Object.checked)) { alert("Based on the answer to question " + objname.substr(u+1, objname.length-1)+ ", this application is not eligible.") Object.focus() return false } } //check to see if this radio group is checked //if both sides are unchecked if (eval("form."+objname+"[0].checked==0&&form."+objname+"[1].checked==0")) { // if so, do this alert("Please answer question "+objname.substr(u+1, objname.length-1)); eval("form."+objname+"[0].focus()"); return false break; } else { //check further to see if applicant picks the eligible answer if (eval("form.EligAns"+objname.substr(u+1, objname.length-1)+".value") == "Yes") { if (eval("form."+objname+"[1].checked==1")) { alert ("Based on the answer to question " +objname.substr(u+1, objname.length-1)+", this application is not eligible.") return false } } else { if (eval("form.EligAns"+objname.substr(u+1, objname.length-1)+".value") == "No") { if (eval("form."+objname+"[0].checked==1")) { alert ("Based on the answer to question " +objname.substr(u+1, objname.length-1)+", this application is not eligible.") return false } } } } } } return true } function ChkEligibility1(form) { for (var i=0; i < form.elements.length; i++) { var Object = form.elements[i] //get name into variable var objname = form.elements[i].name; if (Object.type == "radio") { for (var u=0;u "0") && Char < "9") { break } } //check further to see if applicant picks the eligible answer if (eval("form.EligAns"+objname.substr(u+1, objname.length-1)+".value") == "Yes") { if (eval("form."+objname+"[1].checked==1")) { alert ("Based on the answer to question " +objname.substr(u+1, objname.length-1)+", this application is not eligible.") return false } } else { if (eval("form.EligAns"+objname.substr(u+1, objname.length-1)+".value") == "No") { if (eval("form."+objname+"[0].checked==1")) { alert ("Based on the answer to question " +objname.substr(u+1, objname.length-1)+", this application is not eligible.") eval("form."+objname+"[0].focus()") return false } } } } } return true } function ValidateEligibility() { var Num = document.theForm.NoOfQues.value for (var i=1; i<=Num; i++) { var QT = eval("document.theForm.QT" +i) var QTVal = eval("document.theForm.QT" + i + ".value") if (QTVal == "1") { if (eval("document.theForm.EligAns" + i + ".value") == "Yes") { if (eval("document.theForm.Rrdo_"+i+"[1].checked==1")) { alert ("Based on the answer to question " + i + ", this application is not eligible.") //eval("document.theForm.Rrdo_"+i+"[1].focus()") return false } } else { if (eval("document.theForm.EligAns"+ i + ".value") == "No") { if (eval("document.theForm.Rrdo_" + i + "[0].checked==1")) { alert ("Based on the answer to question " + i +", this application is not eligible.") eval("document.theForm.Rrdo_"+i+"[0].focus()") return false } } } } if (QTVal == "2") //Compare textbox against Max & Min values { var Max = eval("document.theForm.Max1" + i + ".value") var Min = eval("document.theForm.Min1" + i + ".value") if (Max != "" || Min !="") { var Entered = eval("document.theForm.Rtxt0_a_value_for_question_" + i + ".value") if (1*Entered > 1*Max || 1*Entered < 1*Min) { alert("Based on the answer to question " + i + ", this application is not eligible.") //eval("document.theForm.Rtxt0_a_value_for_question_" + i + ".focus()") return false } } } if (QTVal == "4") { var ValHoldChk = eval("document.theForm.ValHoldChk" + i + ".value") var Box = eval("document.theForm.memBox" + i) if (ValHoldChk == "Yes" && eval("document.theForm.Rrdo_" + i + "[0].checked") && Box.value == "") { alert ("Since you answered 'Yes'" + " to question " + i + ", you must fill in the box provided for this question.") Box.focus() return false } else if (ValHoldChk == "Yes" && eval("document.theForm.Rrdo_" + i + "[1].checked") && Box.value != "") { //just empty this box Box.value = "" } else if (ValHoldChk == "No" && eval("document.theForm.Rrdo_" + i + "[1].checked") && Box.value == "") { alert ("Since you answered 'No'" + " to question " + i + ", you must fill in the box provided for this question.") Box.focus() return false } else if (ValHoldChk == "No" && eval("document.theForm.Rrdo_" + i + "[0].checked") && Box.value != "") { //just empty this box Box.value = "" } } } return true } function ChkUnderwrite1(form) { if (!ChkForm()) { return false } else { //var aNum=form.BusDesc.value.split(" ") // if (aNum.length < 10 ) // { // alert ("Please enter a business description.") // form.BusDesc.focus() //return false //} } return true } //dn 07/17/02 function Start(page, Wd, Ht) { //alert (page + ", " + Wd + ", " + Ht); var aw = (screen.width - 1*Wd) /2; var ah = (screen.height - 1*Ht)/2; //alert ("width=" + aw + " height = " + ah); OpenWin = window.open(page, "CtrlWindow", "width=" + 1*Wd + ",height=" + 1*Ht + ",toolbar=No,menubar=No,location=No,scrollbars=1,resizable=0,,top=" + ah +",left=" + aw +""); //OpenWin.moveTo(aw,ah); if (!OpenWin.opener) OpenWin.opener = self; } /* =====================header functions=========================*/ function changePage() { if (self.parent.frames.length != 0) self.parent.location=document.location; } /* Function that swaps images. */ function di20(id, newSrc) { var theImage = FWFindImage(document, id, 0); if (theImage) { theImage.src = newSrc; } } /* Functions that track and set toggle group button states. */ function FWFindImage(doc, name, j) { var theImage = false; if (doc.images) { theImage = doc.images[name]; } if (theImage) { return theImage; } if (doc.layers) { for (j = 0; j < doc.layers.length; j++) { theImage = FWFindImage(doc.layers[j].document, name, 0); if (theImage) { return (theImage); } } } return (false); } /* New Small Window Top Left function */ function new_win(url) { link = window.open(url,"Link","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=217,height=190,left=1,top=1"); } /* Special Window Top Left for Calander function */ function calander_win(url) { theWindow = window.open(url,"newWin","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=295,height=300,left=1,top=1"); } //dn 05/30/02 - used for Help window function new_helpwin(url, width, height) { link = window.open(url,"Link","toolbar=0,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=1,width=" + width + ",height=" + height + ",left=1,top=1"); } function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i