var entityMap = { "<": "<", ">": ">" }; var messages = new Array(); function escapeHtml(string) { return String(string).replace(/[<>]/g, function (s) { return entityMap[s]; }); } function relationshipChangeEvent(){ var relationship = document.getElementById("relationship"); relationshipChange(relationship); } function relationshipDecChangeEvent(){ var relationship = document.getElementById("relationshipDecendentDeath"); relationshipChange(relationship); } function relationshipChange(relationship){ var relationshipSelIndex = relationship.selectedIndex; var relationshipValue = relationship.options[relationshipSelIndex].value; var uploaddoczone = document.getElementById("uploaddoczone"); var dropzone = document.getElementById("dropzone"); var ufile = document.getElementById("upload-table"); var ufilestatus = document.getElementById("uploaded-files-status"); var mdropzone = document.getElementById("mdropzone"); var mufile = document.getElementById("mupload-table"); var progress = document.getElementById("progress"); var mprogress = document.getElementById("mprogress"); var divUploadSupportDoc = document.getElementById("divUploadSupportDoc"); var addDocTitle = document.getElementById("addDocTitle"); var addDocBody = document.getElementById("addDocBody"); var addDocTitle1 = document.getElementById("addDocTitle1"); var addDocBody1 = document.getElementById("addDocBody1"); var addIDTitle = document.getElementById("addIDTitle"); var addIDBody = document.getElementById("addIDBody"); var addIDTitle1 = document.getElementById("addIDTitle1"); var addIDBody1 = document.getElementById("addIDBody1"); var addIDTitle2 = document.getElementById("addIDTitle2"); var addIDBody2 = document.getElementById("addIDBody2"); var addIDTitle3 = document.getElementById("addIDTitle3"); var addIDBody3 = document.getElementById("addIDBody3"); var addMoreID = document.getElementById("addMoreID"); var imgFilePath = document.getElementById("imgFilePath").value; var imgFilePath1 = document.getElementById("imgFilePath1").value; var imgFilePath2 = document.getElementById("imgFilePath2").value; var imgFilePath3 = document.getElementById("imgFilePath3").value; var docFilePath1 = document.getElementById("docFilePath1").value; addIDTitle1.style.display = "none"; addIDBody1.style.display = "none"; addIDTitle2.style.display = "none"; addIDBody2.style.display = "none"; addIDTitle3.style.display = "none"; addIDBody3.style.display = "none"; if (imgFilePath != null && imgFilePath != "") { addMoreID.style.display = ""; }else { addMoreID.style.display = "none"; } if (imgFilePath1 != null && imgFilePath1 != "") { addIDTitle1.style.display = ""; } if (imgFilePath2 != null && imgFilePath2 != "") { addIDTitle1.style.display = ""; addIDTitle2.style.display = ""; } if (imgFilePath3 != null && imgFilePath3 != "") { addIDTitle1.style.display = ""; addIDTitle2.style.display = ""; addIDTitle3.style.display = ""; } if (docFilePath1 != null && docFilePath1 != "") { addDocTitle1.style.display = ""; } if (relationshipValue == "Legal Guardian" || relationshipValue == "Legal Representative"){ divUploadSupportDoc.style.display=""; divUploadSupportDoc.style.display=""; uploaddoczone.style.display = ""; } else { divUploadSupportDoc.style.display="none"; } } function expeditedShipInfo(){ displayFAQ(); //var divFAQ = document.getElementById("divFAQ"); //divFAQ.style.display = ''; //var iframeFAQ = document.getElementByID("iframeFAQ"); //set the location of iframeFAQ to the # anchor within the FAQ here. //iframeFAQ.document.location.href = "FAQURL.jsp#expeditedship"; } function penInHandInfo(){ displayFAQ(); //var divFAQ = document.getElementById("divFAQ"); //divFAQ.style.display = ''; //var iframeFAQ = document.getElementByID("iframeFAQ"); //set the location of iframeFAQ to the # anchor within the FAQ here. //iframeFAQ.document.location.href = "FAQURL.jsp#peninhand"; } function displayFAQ(){ //var divFAQ = document.getElementById("divFAQ"); //divFAQ.style.display = ''; opener = window.open('https://gta.georgia.gov/rover-faqs-0', 'roverFAQ'); } function closeFAQ(){ var divFAQ = document.getElementById("divFAQ"); divFAQ.style.display = 'none'; } function selectAPO(){ //hide state and country fields for military addresses. var divStateLabel = document.getElementById("divStateLabel"); var divCountryLabel = document.getElementById("divCountryLabel"); var divCountry = document.getElementById("divCountry"); var divDefaultCountry = document.getElementById("divDefaultCountry"); var chkAPO = document.getElementById("chkAPO"); var country = document.getElementById("country"); var countrySelectedIndex; var countryV; if (country != null) { countrySelectedIndex = country.selectedIndex; countryV = country.options[countrySelectedIndex].value; } if (chkAPO.checked == true){ divStateLabel.style.display = "none"; removeMessage("country"); } else { divStateLabel.style.display = ""; if (countryV == "UNITED STATES OF AMERICA") { divStateLabel.innerHTML = "State: *"; } else { divStateLabel.innerHTML = "State:"; } divCountryLabel.innerHTML = "Country: *"; divCountryLabel.style.display = ""; divCountry.style.display = ""; divDefaultCountry.style.display = "none"; } } function checkAddrAPO(){ // addressCheck(); // selectAPOShip(); } function addressCheck(){ //check the address for a po box var address1Ship = document.getElementById("address1Ship"); var addrVal = address1Ship.value.toUpperCase().replace(/\s/g, ""); var address2Ship = document.getElementById("address2Ship"); var addr2Val = address2Ship.value.toUpperCase().replace(/\s/g, ""); var isPOBox = false; var expeditedShip = document.getElementById("expeditedShip"); var divExpeditedShipMessage = document.getElementById("divExpeditedShipMessage"); if (addrVal.indexOf("POBOX") != -1){ isPOBox = true; } if (addrVal.indexOf("P.O.BOX") != -1){ isPOBox = true; } if (addrVal.indexOf("PO.BOX") != -1){ isPOBox = true; } if (addrVal.indexOf("P.OBOX") != -1){ isPOBox = true; } if (addrVal.indexOf("POSTOFFICEBOX") != -1){ isPOBox = true; } if (addr2Val.indexOf("POBOX") != -1){ isPOBox = true; } if (addr2Val.indexOf("P.O.BOX") != -1){ isPOBox = true; } if (addr2Val.indexOf("PO.BOX") != -1){ isPOBox = true; } if (addr2Val.indexOf("P.OBOX") != -1){ isPOBox = true; } if (addr2Val.indexOf("POSTOFFICEBOX") != -1){ isPOBox = true; } if (isPOBox == true){ if (expeditedShip != null) { expeditedShip.checked = false; expeditedShip.disabled = true; } divExpeditedShipMessage.display = ""; divExpeditedShipMessage.innerHTML = "Expedited Shipping is not available if you are using a P. O. Box."; updateCopies(); } else { expeditedShip.disabled = false; divExpeditedShipMessage.display = "none"; divExpeditedShipMessage.innerHTML = ""; } return isPOBox; } function validateEmail(emailId) { var valid = false; var email = document.getElementById(emailId); var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; var isEmailValid = re.test(email.value); if (isEmailValid == true){ //alert("1 valid testing 2"); if (validEmail2(emailId) == true){ //alert("2 valid"); valid = true; } else { valid = false; } } else { valid = false; } return valid; } function validEmail2(emailId){ var valid = false; var email = document.getElementById(emailId); //requirements list only .com .edu .gov and .org as valid domains. var re = /([\w\-\.]*)@(([\d]{1,3}\.[\d]{1,3}\.[\d]{1,3}\.[\d]{1,3})|([\w\-]+\.)+((([a-zA-Z\-0-9]))))/; var isEmailValid = re.test(email.value); if (isEmailValid == true){ valid = true; } else { valid = false; } return valid; } function doEmailsMatch(email, emailConfirm){ var valid = false; var email = document.getElementById(email); var emailConfirm = document.getElementById(emailConfirm); if (email.value.trim() == emailConfirm.value.trim()){ valid = true; } else { valid = false; } return valid; } function doEmailsCaseMatch(email, emailConfirm){ var valid = false; var email = document.getElementById(email); var emailConfirm = document.getElementById(emailConfirm); if (email.value.trim().toLowerCase() == emailConfirm.value.trim().toLowerCase()){ valid = true; } else { valid = false; } return valid; } function back(){ changes = false; sessionTimeout = sessionResetValue; } function back0(){ changes = false; sessionTimeout = sessionResetValue; } function checkZipCode(zipCode){ //Zip code validation removed to allow european addresses. //validate integer and dash only, and length is 5 or 9 without the dash var zipTemp = zipCode; var valid = true; zipTemp = zipTemp.replace("-", ""); if (isInteger(zipTemp) == false){ valid = false; } if ((zipTemp.length == 5) || (zipTemp.length == 9)){ //valid - 5 base is OK or 9 without dash is ok } else { //other lengths not valid valid = false; } return valid; } function checkPhone(phone){ //Phone validation removed to allow european addresses. //validate integer and dash only, and length is 10 or 9 without the dash and parenthese var phoneTemp = phone; var valid = true; phoneTemp = phoneTemp.replace("-", ""); phoneTemp = phoneTemp.replace("(", ""); phoneTemp = phoneTemp.replace(")", ""); phoneTemp = phoneTemp.replace(" ", ""); if (isInteger(phoneTemp) == false){ valid = false; } if ((phoneTemp.length == 10)){ //valid - 10 base is OK } else { //other lengths not valid valid = false; } return valid; } function limitZipCode(limitField, limitNum, limitMessage) { //zip code limited to 9 characters except dashes allow it to go to 10 var removeDash = limitField.value.replace(/\-/g, ""); var dashCount = limitField.value.length - removeDash.length; //alert(removeDash + " " + dashCount); //remove dashes and count to max 9 characters not counting dashes. if (removeDash.length > limitNum) { //alert("limiting") limitField.value = limitField.value.substring(0, limitNum + dashCount); limitMessage.style.display='block'; } else { //alert("not limiting"); //limitCount.innerHTML = limitNum - limitField.value.length; } } function checkAmendedYear(amendedYear){ var valid = true; if (isInteger(amendedYear) == false){ valid = false; } if (amendedYear.length<4){ valid = false; } return valid; } function setTotals(sSearchFee, sAddCopiesFee, sProcessingFee, sExpeditedShipFee){ var vSearchFee = parseFloat(sSearchFee); var vAddCopiesFee = parseFloat(sAddCopiesFee); var vProcessingFee = parseFloat(sProcessingFee); var vExpeditedShipFee = parseFloat(sExpeditedShipFee); var divSearchFee = document.getElementById("divSearchFee"); var searchTotal = document.getElementById("searchTotal"); divSearchFee.innerHTML = vSearchFee.formatMoney(2, '.', ','); searchTotal.value = vSearchFee.formatMoney(2, '.', ','); var divAdditionalCopies = document.getElementById("divAdditionalCopies"); var addCopyTotal = document.getElementById("addCopyTotal"); divAdditionalCopies.innerHTML = vAddCopiesFee.formatMoney(2, '.', ','); addCopyTotal.value = vAddCopiesFee.formatMoney(2, '.', ','); var divProcessingFee = document.getElementById("divProcessingFee"); var processingTotal = document.getElementById("processingTotal"); divProcessingFee.innerHTML = vProcessingFee.formatMoney(2, '.', ','); processingTotal.value = vProcessingFee.formatMoney(2, '.', ','); var divExpeditedShippingFee = document.getElementById("divExpeditedShippingFee"); var expeditedShippingTotal = document.getElementById("expeditedShippingTotal"); divExpeditedShippingFee.innerHTML = vExpeditedShipFee.formatMoney(2, '.', ','); expeditedShippingTotal.value = vExpeditedShipFee.formatMoney(2, '.', ','); var sumFees = vSearchFee + vAddCopiesFee + vProcessingFee + vExpeditedShipFee; var divFinalTotal = document.getElementById("divFinalTotal"); var finalTotal = document.getElementById("finalTotal"); divFinalTotal.innerHTML = sumFees.formatMoney(2, '.', ','); finalTotal.value = sumFees.formatMoney(2, '.', ','); } function addExpeditedShipFee(vExpeditedShipFee){ } function checkRequiredFieldTextbox(fieldName){ var field = document.getElementById(fieldName); var fieldValue = ""; if (field != null) fieldValue = field.value; //alert(fieldValue); if (fieldValue == ""){ return fieldName; } else { return "valuefound"; } } function checkUploadmodlues() { var invalidCount = 0; //check upload module additonalDoc1 var idType1 = document.getElementById("idType1").value; var idNumber1 = document.getElementById("idNumber1").value; var idDescriptionObj1 = document.getElementById("idDescription1"); var idDescription1; if (idDescriptionObj1 != null) idDescription1 = idDescriptionObj1.value; var imgFilePath1 = document.getElementById("imgFilePath1").value; var addIDstatus1 = document.getElementById("addIDstatus1"); var uploadedfilesstatus1 = document.getElementById("uploaded-files-status1"); var uploadadoc1 = document.getElementById("upload-adoc1"); if(imgFilePath1 == null || imgFilePath1 =="") { if ((idType1 != null && idType1 != "") || (idNumber1 != null && idNumber1.trim() != "") || (idDescription1 != null && idDescription1.trim() != "")){ addIDstatus1.innerHTML = ''; uploadedfilesstatus1.innerHTML = 'Upload incomplete: Please either complete upload or clear all upload fields.'; uploadadoc1.innerHTML = ''; invalidCount += 1; }else { addIDstatus1.innerHTML = ''; uploadedfilesstatus1.innerHTML = ''; } } else { if ((idType1 == null || idType1 == "") || (idNumber1 == null || idNumber1.trim() == "") || ((idType1 == "6") && (idDescription1 == null || idDescription1.trim() == ""))){ addIDstatus1.innerHTML = ''; uploadedfilesstatus1.innerHTML = 'Upload incomplete: Please either complete upload or clear all upload fields.'; if ((idType1 == "6") && (idDescription1 == null || idDescription1.trim() == "")) { uploadedfilesstatus1.innerHTML = 'The ID Description of your aditional document is required.'; } uploadadoc1.innerHTML = ''; invalidCount += 1; }else { addIDstatus1.innerHTML = ''; uploadedfilesstatus1.innerHTML = ''; uploadadoc1.innerHTML = '
Support document was uploaded successfully!
'; } } //check upload module additonalDoc2 var idType2 = document.getElementById("idType2").value; var idNumber2 = document.getElementById("idNumber2").value; var idDescriptionObj2 = document.getElementById("idDescription2"); var idDescription2; if (idDescriptionObj2 != null) idDescription2 = idDescriptionObj2.value; var imgFilePath2 = document.getElementById("imgFilePath2").value; var addIDstatus2 = document.getElementById("addIDstatus2"); var uploadedfilesstatus2 = document.getElementById("uploaded-files-status2"); var uploadadoc2 = document.getElementById("upload-adoc2"); if(imgFilePath2 == null || imgFilePath2 =="") { if ((idType2 != null && idType2 != "") || (idNumber2 != null && idNumber2.trim() != "") || (idDescription2 != null && idDescription2.trim() != "")){ addIDstatus2.innerHTML = ''; uploadedfilesstatus2.innerHTML = 'Upload incomplete: Please either complete upload or clear all upload fields.'; uploadadoc2.innerHTML = ''; invalidCount += 1; }else { addIDstatus2.innerHTML = ''; uploadedfilesstatus2.innerHTML = ''; } }else { if ((idType2 == null || idType2 == "") || (idNumber2 == null || idNumber2.trim() == "") || ((idType2 == "6") && (idDescription2 == null || idDescription2.trim() == ""))){ addIDstatus2.innerHTML = ''; uploadedfilesstatus2.innerHTML = 'Upload incomplete: Please either complete upload or clear all upload fields.'; if ((idType2 == "6") && (idDescription2 == null || idDescription2.trim() == "")) { uploadedfilesstatus2.innerHTML = 'The ID Description of your aditional document is required.'; } uploadadoc2.innerHTML = ''; invalidCount += 1; }else { addIDstatus2.innerHTML = ''; uploadedfilesstatus2.innerHTML = ''; uploadadoc2.innerHTML = '
Support document was uploaded successfully!
'; } } //check upload module additonalDoc3 var idType3 = document.getElementById("idType3").value; var idNumber3 = document.getElementById("idNumber3").value; var idDescriptionObj3 = document.getElementById("idDescription3"); var idDescription3; if (idDescriptionObj3 != null) idDescription3 = idDescriptionObj3.value; var imgFilePath3 = document.getElementById("imgFilePath3").value; var addIDstatus3 = document.getElementById("addIDstatus3"); var uploadedfilesstatus3 = document.getElementById("uploaded-files-status3"); var uploadadoc3 = document.getElementById("upload-adoc3"); if(imgFilePath3 == null || imgFilePath3 =="") { if ((idType3 != null && idType3 != "") || (idNumber3 != null && idNumber3.trim() != "") || (idDescription3 != null && idDescription3.trim() != "")){ addIDstatus3.innerHTML = ''; uploadedfilesstatus3.innerHTML = 'Upload incomplete: Please either complete upload or clear all upload fields.'; uploadadoc3.innerHTML = ''; invalidCount += 1; }else { addIDstatus3.innerHTML = ''; uploadedfilesstatus3.innerHTML = ''; } }else { if ((idType3 == null || idType3 == "") || (idNumber3 == null || idNumber3.trim() == "") || ((idType3 == "6") && (idDescription3 == null || idDescription3.trim() == ""))){ addIDstatus3.innerHTML = ''; uploadedfilesstatus3.innerHTML = 'Upload incomplete: Please either complete upload or clear all upload fields.'; if ((idType3 == "6") && (idDescription3 == null || idDescription3.trim() == "")) { uploadedfilesstatus3.innerHTML = 'The ID Description of your aditional document is required.'; } uploadadoc3.innerHTML = ''; invalidCount += 1; }else { addIDstatus3.innerHTML = ''; uploadedfilesstatus3.innerHTML = ''; uploadadoc3.innerHTML = '
Support document was uploaded successfully!
'; } } //check upload module supportDoc1 var idTypedoc1 = document.getElementById("idTypedoc1").value; var idNumberdoc1 = document.getElementById("idNumberdoc1").value; var idDescriptiondocObj1 = document.getElementById("idDescriptiondoc1"); var idDescriptiondoc1; if (idDescriptiondocObj1 != null) idDescriptiondoc1 = idDescriptiondocObj1.value; var docFilePath1 = document.getElementById("docFilePath1").value; var addDocstatus1 = document.getElementById("addDocstatus1"); var muploadedfilesstatus1 = document.getElementById("muploaded-files-status1"); var uploadsdoc1 = document.getElementById("upload-sdoc1"); if(docFilePath1 == null || docFilePath1 =="") { if ((idTypedoc1 != null && idTypedoc1 != "") || (idNumberdoc1 != null && idNumberdoc1.trim() != "") || (idDescriptiondoc1 != null && idDescriptiondoc1.trim() != "")){ addDocstatus1.innerHTML = ''; muploadedfilesstatus1.innerHTML = 'Upload incomplete: Please either complete upload or clear all upload fields.'; uploadsdoc1.innerHTML = ''; invalidCount += 1; }else { addDocstatus1.innerHTML = ''; muploadedfilesstatus1.innerHTML = ''; } }else { if ((idTypedoc1 == null || idTypedoc1 == "") || (idNumberdoc1 == null || idNumberdoc1.trim() == "") || ((idTypedoc1 == "6") && (idDescriptiondoc1 == null || idDescriptiondoc1.trim() == ""))){ addDocstatus1.innerHTML = ''; muploadedfilesstatus1.innerHTML = 'Upload incomplete: Please either complete upload or clear all upload fields.'; if ((idTypedoc1 == "6") && (idDescriptiondoc1 == null || idDescriptiondoc1.trim() == "")) { muploadedfilesstatus1.innerHTML = 'The ID Description of your aditional document is required.'; } uploadsdoc1.innerHTML = ''; invalidCount += 1; }else { addDocstatus1.innerHTML = ''; muploadedfilesstatus1.innerHTML = ''; uploadsdoc1.innerHTML = '
Support document was uploaded successfully!
'; } } return invalidCount; } //navigate back from birth certificate instructions to basic info form function back1(){ changes = false; sessionTimeout = sessionResetValue; } //navigate back from birth certificate form to birth certificate instructions function back2(){ changes = false; sessionTimeout = sessionResetValue; } //navigate back from death certificate form to death certificate instructions function back2d(){ changes = false; } //navigate back from shipping form to birth certificate form function back3(){ changes = false; sessionTimeout = sessionResetValue; } //back from summary now takes you back one page in browser history because it is now a cancel button function back4(){ //this has been changed to Cancel button instead of a Back button. //history.go(-1); location.href="/gta/odi-innovations/"; //sessionTimeout = sessionResetValue; } function editPhotoID(){ navFromSummaryPhotoID = true; hideOrderSummaryPage(); next0(); } function editRequestor(){ navFromSummaryRequestor = true; hideOrderSummaryPage(); next(); } function editBirth(){ navFromSummaryBirth = true; hideOrderSummaryPage(); next2(); } function editDeath(){ navFromSummaryDeath = true; hideOrderSummaryPage(); next2(); } function editShip(){ navFromSummaryShip = true; hideOrderSummaryPage(); if (selectedType == "BIRTH"){ next3(); } else { next3d(); } } function amendedYesNo(){ var amendedYearRegistrantY = document.getElementById("amendedRegistrant:0"); var amendedYearRegistrantN = document.getElementById("amendedRegistrant:1"); var labelYearAmended = document.getElementById("labelYearAmended"); var amendedYearRegistrant = document.getElementById("amendedYearRegistrant"); if (amendedYearRegistrantY.checked == true){ amendedYearRegistrant.style.display = ""; labelYearAmended.style.display = ""; } if (amendedYearRegistrantN.checked == true) { amendedYearRegistrant.style.display = "none"; amendedYearRegistrant.value = ""; labelYearAmended.style.display = "none"; removeMessage("amendedYearRegistrant"); removeMessage("amendedYearValid"); } } function amendedYes(){ var amendedYearRegistrant = document.getElementById("amendedYearRegistrant"); amendedYearRegistrant.style.display = ""; var labelYearAmended = document.getElementById("labelYearAmended"); labelYearAmended.style.display = ""; } function amendedNo(){ var amendedYearRegistrant = document.getElementById("amendedYearRegistrant"); amendedYearRegistrant.style.display = "none"; amendedYearRegistrant.value = ""; var labelYearAmended = document.getElementById("labelYearAmended"); labelYearAmended.style.display = "none"; removeMessage("amendedYearRegistrant"); removeMessage("amendedYearValid"); } function updateCopies(){ // var additionalCopies = document.getElementById("additionalCopies"); // var additionalCopiesDeath = document.getElementById("additionalCopiesDeath"); // var expeditedShip = document.getElementById("expeditedShip"); // var addCopiesTotal; // if (selectedType == "BIRTH"){ // addCopiesTotal = additionalCopies.value * addCopiesFee; // } else { // addCopiesTotal = additionalCopiesDeath.value * addCopiesFee; // } // if (expeditedShip.checked == true){ // expeditedShippingSelected = true; // setTotals(searchFee, addCopiesTotal, processingFee, expeditedShippingFee); // } else { // //expeditedShippingSelected = false; // setTotals(searchFee, addCopiesTotal, processingFee, 0); // } } function navigationEvents(){ // updateCopies(); sessionTimeout = sessionResetValue; } function isInteger(s){ var i; for (i = 0; i < s.length; i++){ // Check that current character is number. var c = s.charAt(i); if (((c < "0") || (c > "9"))) return false; } // All characters are numbers. return true; } function stripCharsInBag(s, bag){ var i; var returnString = ""; // Search through string's characters one by one. // If character is not in bag, append to returnString. for (i = 0; i < s.length; i++){ var c = s.charAt(i); if (bag.indexOf(c) == -1) returnString += c; } return returnString; } function daysInFebruary (year){ // February has 29 days in any year evenly divisible by four, // EXCEPT for centurial years which are not also divisible by 400. return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 ); } function DaysArray(n) { for (var i = 1; i <= n; i++) { this[i] = 31; if (i==4 || i==6 || i==9 || i==11) { this[i] = 30; } if (i==2) { this[i] = 29; } } return this; } function isDate(dtStr, fieldName, minYear, maxYear){ var daysInMonth = DaysArray(12); var pos1=dtStr.indexOf(dtCh); var pos2=dtStr.indexOf(dtCh,pos1+1); var strMonth=dtStr.substring(0,pos1); var strDay=dtStr.substring(pos1+1,pos2); var strYear=dtStr.substring(pos2+1); strYr=strYear; //return true if the values are not filled in. This will be handled be a required field validator when Next is clicked. if (strDay == "-1"){ return "TRUE"; } if (strMonth == "-1"){ return "TRUE"; } if (strYear == ""){ return "TRUE"; } if (strDay.charAt(0)=="0" && strDay.length>1){ strDay=strDay.substring(1); } if (strMonth.charAt(0)=="0" && strMonth.length>1){ strMonth=strMonth.substring(1); } for (var i = 1; i <= 3; i++) { if (strYr.charAt(0)=="0" && strYr.length>1){ strYr=strYr.substring(1); } } month=parseInt(strMonth); day=parseInt(strDay); year=parseInt(strYr); var invalidMatch = false; var message = ""; if (pos1==-1 || pos2==-1){ invalidMatch = true; message = "The date format should be : mm/dd/yyyy in " + fieldName +".
"; } if (strMonth.length<1 || month<1 || month>12){ invalidMatch = true; message += "Please enter a valid month in " + fieldName +".
"; } if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){ invalidMatch = true; message += "Please enter a valid day in " + fieldName +".
"; } if (strYear.length != 4 || year==0 || yearmaxYear){ invalidMatch = true; message += "Please enter a valid 4 digit year between "+minYear+" and "+maxYear +" in " + fieldName +".
"; } if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){ invalidMatch = true; message += "Please enter a valid date in " + fieldName +".
"; } if (invalidMatch == true){ return message; } return "TRUE"; } function checkDate(){ var monthRegistrant = document.getElementById("monthRegistrant"); var dayRegistrant = document.getElementById("dayRegistrant"); var yearRegistrant = document.getElementById("yearRegistrant"); var monthSelIndex = monthRegistrant.selectedIndex; var monthValue = monthRegistrant.options[monthSelIndex].value; var daySelIndex = dayRegistrant.selectedIndex; var dayValue = dayRegistrant.options[daySelIndex].value; var yearValue = yearRegistrant.value; if (parseInt(yearValue) 0 && dayValue.length > 0 && yearValue.length > 0){ isDateResult = isDate(dateStringRegistrant, "Birth date", 1800, maxYear); } else if (monthValue.length > 0 && dayValue.length > 0 && yearValue.length == 0){ //no year value isDateResult = isMonthDayValid(monthValue, dayValue); } else if (yearValue.length > 0){ if (yearValue.length == 4){ if (isNumber(yearValue) == true){ if (yearValue > 1800 && yearValue <= maxDeathYear){ isDateResult = "TRUE"; } else { isDateResult = "FALSE"; } } else { isDateResult = "FALSE"; } } else { isDateResult = "FALSE"; } } else { //other date combos can not be validated. return a true isDateResult = "TRUE"; } if (isDateResult == "TRUE"){ //removeMessage("dateValidBirthDeath"); //monthRegistrant.style.background = "white"; //dayRegistrant.style.background = "white"; //yearRegistrant.style.background = "white"; return true; } else { //addOrReplaceMessage("dateValidBirthDeath",isDateResult); //monthRegistrant.style.background = "red"; //dayRegistrant.style.background = "red"; //yearRegistrant.style.background = "red"; return false; } } function isNumber(n) { return !isNaN(parseFloat(n)) && isFinite(n); } function checkDateBirthDeathCompare(){ //birth date var monthRegistrant = document.getElementById("birthMonthDeath"); var dayRegistrant = document.getElementById("birthDayDeath"); var yearRegistrant = document.getElementById("birthYearDeath"); var monthSelIndex = monthRegistrant.selectedIndex; var monthValue = parseInt(removeLeadingZero(monthRegistrant.options[monthSelIndex].value)); var daySelIndex = dayRegistrant.selectedIndex; var dayValue = parseInt(removeLeadingZero(dayRegistrant.options[daySelIndex].value)); var yearValue = parseInt(yearRegistrant.value); //var dateStringRegistrant = monthValue + "/" + dayValue + "/" + yearValue; //death date var monthRegistrant2 = document.getElementById("monthDeath"); var dayRegistrant2 = document.getElementById("dayDeath"); var yearRegistrant2 = document.getElementById("yearDeath"); var monthSelIndex2 = monthRegistrant2.selectedIndex; var monthValue2 = parseInt(removeLeadingZero(monthRegistrant2.options[monthSelIndex2].value)); var daySelIndex2 = dayRegistrant2.selectedIndex; var dayValue2 = parseInt(removeLeadingZero(dayRegistrant.options[daySelIndex2].value)); var yearValue2 = parseInt(yearRegistrant2.value); //var dateStringRegistrant2 = monthValue2 + "/" + dayValue2 + "/" + yearValue2; var d1 = new Date(yearValue, monthValue, dayValue); var d2 = new Date(yearValue2, monthValue2, dayValue2); //alert(yearValue + "/" + monthValue +"/" + dayValue); //alert(yearValue2 + "/" + monthValue2 +"/" + dayValue2); //alert(d1 > d2); if (d1 > d2){ return false; } else { return true; } } function removeLeadingZero(s){ while (s.charAt(0) == '0') { if (s.length == 1) { break; } if (s.charAt(1) == '.') { break; } s = s.substr(1,s.length-1); } return s; } function getCheckedValue(radioObj) { if(!radioObj){ return ""; } var radioLength = radioObj.length; if(radioLength == undefined) if(radioObj.checked) return radioObj.value; else return ""; for(var i = 0; i < radioLength; i++) { if(radioObj[i].checked) { return radioObj[i].value; } } return ""; } function addOrReplaceMessage(messageKey, messageToAdd){ var divSpecial = document.getElementById("divSpecial"); var i = 0; var strMessages = ""; var currMessageKey = ""; var currMessage = ""; var bMatchFound = false; var message = new Message(); message.messageKey = messageKey; message.message = messageToAdd; for (i = 0; i < messages.length; i++){ currMessageKey = messages[i].messageKey; if (currMessageKey == messageKey){ //match found. Replace. messages[i].message = messageToAdd; bMatchFound = true; break; } else { //nothing } } if (bMatchFound == false){ messages.push(message); } //loop through all messages and display. for (i = 0; i < messages.length; i++){ strMessages += messages[i].message + "
"; } divSpecial.innerHTML = strMessages; divSpecial.style.display=""; } function confirmBD(){ var checkedBirth = document.getElementById("checkboxBD"); if (checkedBirth.checked == true){ enableTable("bdTable"); } else { disableTable("bdTable"); removeAllMessages(); } } function removeMessage(messageKey){ var divSpecial = document.getElementById("divSpecial"); var currMessageKey = ""; var currMessage = ""; var strMessages = ""; for (i = 0; i < messages.length; i++){ currMessageKey = messages[i].messageKey; if (currMessageKey == messageKey){ messages.splice(i,1); } } //loop through all messages and display. if (messages.length > 0){ for (i = 0; i < messages.length; i++){ strMessages += messages[i].message + "
"; } divSpecial.innerHTML = strMessages; divSpecial.style.display=""; } else { //hide messages box if empty divSpecial.style.display = "none"; } } function removeAllMessages(){ var divSpecial = document.getElementById("divSpecial"); messages = new Array(); divSpecial.innerHTML = ""; divSpecial.style.display = "none"; } function Message(){ this.messageKey = ""; this.message = ""; } function limitTextArea(limitField, limitCount, limitNum, limitWarning) { limitField.value = limitField.value.replace(/\s\s+/g, ' '); if (limitField.value.length > limitNum) { limitField.value = limitField.value.substring(0, limitNum); limitWarning.style.visibility = "visible"; } else { //limitCount.value = limitNum - limitField.value.length; limitCount.innerHTML = limitNum - limitField.value.length + " Characters remaining"; limitWarning.style.visibility = "hidden"; } } function pageLoad(){ //ie does not select first item in drop down list by default. //additionalCopies //var additionalCopies = document.getElementById("additionalCopies"); //additionalCopies.selectedIndex = 0; //additionalCopiesDeath //var additionalCopiesDeath = document.getElementById("additionalCopiesDeath"); //additionalCopiesDeath.selectedIndex = 0; } function changeIdNumber() { var val = $.trim($('#idNumber').val()); if (val == "") { $('#upload-adoc').html(''); $('#addIDstatus').html(''); $("#uploaded-files-status").html('The ID Number of your primary proof of identification is required. If your ID does not have number, simply input N/A.'); }else { $("#uploaded-files-status").html(''); removeMessage("idNumber"); if (($('#imgFilePath').val() !="") && ( $('#idType').val() != "") && ($('#idNumber').val() != "") && (($('#idDescription').val() != "" && $('#idType').val() == "6") || ($('#idType').val() != "6"))) { $('#addIDstatus').html(''); $('#upload-adoc').html('
Support document was uploaded successfully!
'); } } } function changeIdNumber1() { var val = $.trim($('#idNumber1').val()); if (val == "") { $('#upload-adoc1').html(''); $('#addIDstatus1').html(''); $("#uploaded-files-status1").html('The ID Number is required. If this document does not have number, simply input N/A'); }else { $("#uploaded-files-status1").html(''); if (($('#imgFilePath1').val() !="") && ( $('#idType1').val() != "") && ($('#idNumber1').val() != "") && (($('#idDescription1').val() != "" && $('#idType1').val() == "6") || ($('#idType1').val() != "6"))) { $('#addIDstatus1').html(''); $('#upload-adoc1').html('
Support document was uploaded successfully!
'); } } } function changeIdNumber2() { var val = $.trim($('#idNumber2').val()); if (val == "") { $('#upload-adoc2').html(''); $('#addIDstatus2').html(''); $("#uploaded-files-status2").html('The ID Number is required. If this document does not have number, simply input N/A.'); }else { $("#uploaded-files-status2").html(''); if (($('#imgFilePath2').val() !="") && ( $('#idType2').val() != "") && ($('#idNumber2').val() != "") && (($('#idDescription2').val() != "" && $('#idType2').val() == "6") || ($('#idType2').val() != "6"))) { $('#addIDstatus2').html(''); $('#upload-adoc2').html('
Support document was uploaded successfully!
'); } } } function changeIdNumber3() { var val = $.trim($('#idNumber3').val()); if (val == "") { $('#upload-adoc3').html(''); $('#addIDstatus3').html(''); $("#uploaded-files-status3").html('The ID Number is required. If this document does not have number, simply input N/A.'); }else { $("#uploaded-files-status3").html(''); if (($('#imgFilePath3').val() !="") && ( $('#idType3').val() != "") && ($('#idNumber3').val() != "") && (($('#idDescription3').val() != "" && $('#idType3').val() == "6") || ($('#idType3').val() != "6"))) { $('#addIDstatus3').html(''); $('#upload-adoc3').html('
Support document was uploaded successfully!
'); } } } function changeIdNumberdoc1() { var val = $.trim($('#idNumberdoc1').val()); if (val == "") { $('#upload-sdoc1').html(''); $('#addDocstatus1').html(''); $("#muploaded-files-status1").html('The ID Number is required. If this document does not have number, simply input N/A.'); }else { $("#muploaded-files-status1").html(''); removeMessage("idNumberdoc1"); if (($('#docFilePath1').val() !="") && ( $('#idTypedoc1').val() != "") && ($('#idNumberdoc1').val() != "") && (($('#idDescriptiondoc1').val() != "" && $('#idTypedoc1').val() == "6") || ($('#idTypedoc1').val() != "6"))) { $('#addDocstatus1').html(''); $('#upload-sdoc1').html('
Support document was uploaded successfully!
'); } } } function changeIdType() { if ($('#imgFilePath').val() !="") { if ($('#idType').val() == "") { $('#addIDstatus').html(''); $('#uploaded-files-status').html('The ID Type of your Primary Photo ID is required.'); $('#upload-adoc').html(''); } else { if ($('#idNumber').val() == "") {; $('#addIDstatus').html(''); $('#uploaded-files-status').html('The ID Number of your Primary Photo ID is required.'); $('#upload-adoc').html(''); } var desc = $('#idDescription').val(); if (typeof desc == "undefined") { $('#upload-adoc').html(''); $('#addIDstatus').html(''); if($('#idType').val() == "6") $('#uploaded-files-status').html('The ID Description of your Primary Photo ID is required.'); else { if ($('#idNumber').val() == "") $('#uploaded-files-status').html('The ID Number of your Primary Photo ID is required.'); else { $('#addIDstatus').html(''); $('#uploaded-files-status').html(''); $('#upload-adoc').html('
Support document was uploaded successfully!
'); } } } else if ($('#idDescription').val() == "" && $('#idType').val() == "6") { $('#upload-adoc').html(''); $('#addIDstatus').html(''); $('#uploaded-files-status').html('The ID Description of your Primary Photo ID is required.'); } } if (typeof desc !== "undefined") { if (( $('#idType').val() != "") && ($('#idNumber').val() != "") && (($('#idDescription').val() != "" && $('#idType').val() == "6") || ($('#idType').val() != "6"))) { $('#addIDstatus').html(''); $('#uploaded-files-status').html(''); $('#upload-adoc').html('
Support document was uploaded successfully!
'); } } } } function changeIdDescription() { if ($('#imgFilePath').val() !="") { if ($('#idType').val() == "") { $('#addIDstatus').html(''); $('#uploaded-files-status').html('The ID Type of your Primary Photo ID is required.'); $('#upload-adoc').html(''); } else { if ($('#idNumber').val() == "") { $('#addIDstatus').html(''); $('#uploaded-files-status').html('The ID Number of your Primary Photo ID is required.'); $('#upload-adoc').html(''); } if ($.trim($('#idDescription').val()) == "") { $('#addIDstatus').html(''); $('#uploaded-files-status').html('The ID Description of your Primary Photo ID is required.'); $('#upload-adoc').html(''); } } if (( $('#idType').val() != "") && ($('#idNumber').val() != "") && (($('#idDescription').val() != "" && $('#idType').val() == "6") || ($('#idType').val() != "6"))) { $('#addIDstatus').html(''); $('#uploaded-files-status').html(''); $('#upload-adoc').html('
Support document was uploaded successfully!
'); } } } function changeIdType1() { if ($('#imgFilePath1').val() !="") { if ($('#idType1').val() == "") { $('#addIDstatus1').html(''); $('#uploaded-files-status1').html('The ID Type is required.'); $('#upload-adoc1').html(''); } else { if ($('#idNumber1').val() == "") { $('#addIDstatus1').html(''); $('#uploaded-files-status1').html('The ID Number is required.'); $('#upload-adoc1').html(''); } var desc1 = $('#idDescription1').val(); if (typeof desc1 == "undefined") { $('#upload-adoc1').html(''); $('#addIDstatus1').html(''); if($('#idType1').val() == "6") $('#uploaded-files-status1').html('The ID Description is required.'); else { if ($('#idNumber1').val() == "") $('#uploaded-files-status1').html('The ID Number is required.'); else { $('#addIDstatus1').html(''); $('#uploaded-files-status1').html(''); $('#upload-adoc1').html('
Support document was uploaded successfully!
'); } } } else if ($('#idDescription1').val() == "" && $('#idType1').val() == "6") { $('#upload-adoc1').html(''); $('#addIDstatus1').html(''); $('#uploaded-files-status1').html('The ID Description is required.'); } } if (typeof desc1 !== "undefined") { if (( $('#idType1').val() != "") && ($('#idNumber1').val() != "") && (($('#idDescription1').val() != "" && $('#idType1').val() == "6") || ($('#idType1').val() != "6"))) { $('#addIDstatus1').html(''); $('#uploaded-files-status1').html(''); $('#upload-adoc1').html('
Support document was uploaded successfully!
'); } } } } function changeIdDescription1() { if ($('#imgFilePath1').val() !="") { if ($('#idType1').val() == "") { $('#addIDstatus1').html(''); $('#uploaded-files-status1').html('The ID Type is required.'); $('#upload-adoc1').html(''); } else { if ($('#idNumber1').val() == "") { $('#addIDstatus1').html(''); $('#uploaded-files-status1').html('The ID Number is required.'); $('#upload-adoc1').html(''); } if ($.trim($('#idDescription1').val()) == "") { $('#addIDstatus1').html(''); $('#uploaded-files-status1').html('The ID Description is required.'); $('#upload-adoc1').html(''); } } if (( $('#idType1').val() != "") && ($('#idNumber1').val() != "") && (($('#idDescription1').val() != "" && $('#idType1').val() == "6") || ($('#idType1').val() != "6"))) { $('#addIDstatus1').html(''); $('#uploaded-files-status1').html(''); $('#upload-adoc1').html('
Support document was uploaded successfully!
'); } } } function changeIdType2() { if ($('#imgFilePath2').val() !="") { if ($('#idType2').val() == "") { $('#addIDstatus2').html(''); $('#uploaded-files-status2').html('The ID Type is required.'); $('#upload-adoc2').html(''); } else { if ($('#idNumber2').val() == "") { $('#addIDstatus2').html(''); $('#uploaded-files-status2').html('The ID Number is required.'); $('#upload-adoc2').html(''); } var desc2 = $('#idDescription2').val(); if (typeof desc2 == "undefined") { $('#upload-adoc2').html(''); $('#addIDstatus2').html(''); if($('#idType2').val() == "6") $('#uploaded-files-status2').html('The ID Description is required.'); else { if ($('#idNumber2').val() == "") $('#uploaded-files-status2').html('The ID Number is required.'); else { $('#addIDstatus2').html(''); $('#uploaded-files-status2').html(''); $('#upload-adoc2').html('
Support document was uploaded successfully!
'); } } } else if ($('#idDescription2').val() == "" && $('#idType2').val() == "6") { $('#upload-adoc2').html(''); $('#addIDstatus2').html(''); $('#uploaded-files-status2').html('The ID Description is required.'); } } if (typeof desc2 !== "undefined") { if (( $('#idType2').val() != "") && ($('#idNumber2').val() != "") && (($('#idDescription2').val() != "" && $('#idType2').val() == "6") || ($('#idType2').val() != "6"))) { $('#addIDstatus2').html(''); $('#uploaded-files-status2').html(''); $('#upload-adoc2').html('
Support document was uploaded successfully!
'); } } } } function changeIdDescription2() { if ($('#imgFilePath2').val() !="") { if ($('#idType2').val() == "") { $('#addIDstatus2').html(''); $('#uploaded-files-status2').html('The ID Type is required.'); $('#upload-adoc2').html(''); } else { if ($('#idNumber2').val() == "") { $('#addIDstatus2').html(''); $('#uploaded-files-status2').html('The ID Number is required.'); $('#upload-adoc2').html(''); } if ($.trim($('#idDescription2').val()) == "") { $('#addIDstatus2').html(''); $('#uploaded-files-status2').html('The ID Description is required.'); $('#upload-adoc2').html(''); } } if (( $('#idType2').val() != "") && ($('#idNumber2').val() != "") && (($('#idDescription2').val() != "" && $('#idType2').val() == "6") || ($('#idType2').val() != "6"))) { $('#addIDstatus2').html(''); $('#uploaded-files-status2').html(''); $('#upload-adoc2').html('
Support document was uploaded successfully!
'); } } } function changeIdType3() { if ($('#imgFilePath3').val() !="") { if ($('#idType3').val() == "") { $('#addIDstatus3').html(''); $('#uploaded-files-status3').html('The ID Type is required.'); $('#upload-adoc3').html(''); } else { if ($('#idNumber3').val() == "") { $('#addIDstatus3').html(''); $('#uploaded-files-status3').html('The ID Number is required.'); $('#upload-adoc3').html(''); } var desc3 = $('#idDescription3').val(); if (typeof desc3 == "undefined") { $('#upload-adoc3').html(''); $('#addIDstatus3').html(''); if($('#idType3').val() == "6") $('#uploaded-files-status3').html('The ID Description is required.'); else { if ($('#idNumber3').val() == "") $('#uploaded-files-status3').html('The ID Number is required.'); else { $('#addIDstatus3').html(''); $('#uploaded-files-status3').html(''); $('#upload-adoc3').html('
Support document was uploaded successfully!
'); } } } else if ($('#idDescription3').val() == "" && $('#idType3').val() == "6") { $('#upload-adoc3').html(''); $('#addIDstatus3').html(''); $('#uploaded-files-status3').html('The ID Description is required.'); } } if (typeof desc3 !== "undefined") { if (( $('#idType3').val() != "") && ($('#idNumber3').val() != "") && (($('#idDescription3').val() != "" && $('#idType3').val() == "6") || ($('#idType3').val() != "6"))) { $('#addIDstatus3').html(''); $('#uploaded-files-status3').html(''); $('#upload-adoc3').html('
Support document was uploaded successfully!
'); } } } } function changeIdDescription3() { if ($('#imgFilePath3').val() !="") { if ($('#idType3').val() == "") { $('#addIDstatus3').html(''); $('#uploaded-files-status3').html('The ID Type is required.'); $('#upload-adoc3').html(''); } else { if ($('#idNumber3').val() == "") { $('#addIDstatus3').html(''); $('#uploaded-files-status3').html('The ID Number is required.'); $('#upload-adoc3').html(''); } if ($.trim($('#idDescription3').val()) == "") { $('#addIDstatus3').html(''); $('#uploaded-files-status3').html('The ID Description is required.'); $('#upload-adoc3').html(''); } } if (( $('#idType3').val() != "") && ($('#idNumber3').val() != "") && (($('#idDescription3').val() != "" && $('#idType3').val() == "6") || ($('#idType3').val() != "6"))) { $('#addIDstatus3').html(''); $('#uploaded-files-status3').html(''); $('#upload-adoc3').html('
Support document was uploaded successfully!
'); } } } function changeIdTypedoc1() { if ($('#docFilePath1').val() !="") { if ($('#idTypedoc1').val() == "") { $('#addDocstatus1').html(''); $('#muploaded-files-status1').html('The ID Type is required.'); $('#upload-sdoc1').html(''); } else { if ($('#idNumberdoc1').val() == "") { $('#addDocstatus1').html(''); $('#muploaded-files-status1').html('The ID Number is required.'); $('#upload-sdoc1').html(''); } var descdoc1 = $('#idDescriptiondoc1').val(); if (typeof descdoc1 == "undefined") { $('#upload-sdoc1').html(''); $('#addDocstatus1').html(''); if($('#idTypedoc1').val() == "6") $('#muploaded-files-status1').html('The ID Description is required.'); else { if ($('#idNumberdoc1').val() == "") $('#muploaded-files-status1').html('The ID Number is required.'); else { $('#addDocstatus1').html(''); $('#muploaded-files-status1').html(''); $('#upload-sdoc1').html('
Support document was uploaded successfully!
'); } } } else if ($('#idDescriptiondoc1').val() == "" && $('#idTypedoc1').val() == "6") { $('#upload-sdoc1').html(''); $('#addDocstatus1').html(''); $('#muploaded-files-status1').html('The ID Description is required.'); } } if (typeof descdoc1 !== "undefined") { if (( $('#idTypedoc1').val() != "") && ($('#idNumberdoc1').val() != "") && (($('#idDescriptiondoc1').val() != "" && $('#idTypedoc1').val() == "6") || ($('#idTypedoc1').val() != "6"))) { $('#addDocstatus1').html(''); $('#muploaded-files-status1').html(''); $('#upload-sdoc1').html('
Support document was uploaded successfully!
'); } } } } function changeIdDescriptiondoc1() { if ($('#docFilePath1').val() !="") { if ($('#idTypedoc1').val() == "") { $('#addDocstatus1').html(''); $('#muploaded-files-status1').html('The ID Type is required.'); $('#upload-sdoc1').html(''); } else { if ($('#idNumberdoc1').val() == "") { $('#addDocstatus1').html(''); $('#muploaded-files-status1').html('The ID Number is required.'); $('#upload-sdoc1').html(''); } if ($.trim($('#idDescriptiondoc1').val()) == "") { $('#addDocstatus1').html(''); $('#muploaded-files-status1').html('The ID Description is required.'); $('#upload-sdoc1').html(''); } } if (( $('#idTypedoc1').val() != "") && ($('#idNumberdoc1').val() != "") && (($('#idDescriptiondoc1').val() != "" && $('#idTypedoc1').val() == "6") || ($('#idTypedoc1').val() != "6"))) { $('#addDocstatus1').html(''); $('#muploaded-files-status1').html(''); $('#upload-sdoc1').html('
Support document was uploaded successfully!
'); } } } //decimals, decimal_sep, thousands_sep Number.prototype.formatMoney = function(c, d, t){ var n = this, c = isNaN(c = Math.abs(c)) ? 2 : c, d = d == undefined ? "," : d, t = t == undefined ? "." : t, s = n < 0 ? "-" : "", i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0; return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : ""); };