// JavaScript Document function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; 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 57){ isError = 1; break; } } if (isError == 1) { textObject.select(); alert(errorMsg); return false; } else { return true; } } function isValidSSN(value) { var re = /^([0-6]\d{2}|7[0-6]\d|77[0-2])([ \-]?)(\d{2})\2(\d{4})$/; if (!re.test(value)) { return false; } var temp = value; if (value.indexOf("-") != -1) { temp = (value.split("-")).join(""); } if (value.indexOf(" ") != -1) { temp = (value.split(" ")).join(""); } if (temp.substring(0, 3) == "000") { return false; } if (temp.substring(3, 5) == "00") { return false; } if (temp.substring(5, 9) == "0000") { return false; } return true; } function calculate_total() { var total = 0.00; var fieldname; for (i=0; i' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + ''; return menuCode; } function getPropTypeMenu(name) { var menuCode =''; menuCode =''; return menuCode; } /* Start functions for aid inm step 1/borrower info */ var maxNumPropertyAssets = 20; var prevNumPropertyAssets = 0; function getPropAssetFieldset(propNum) { var htmlCode = ''; //var i = eval(propNum); var i = parseInt(propNum); if (isNaN(propNum)) { return false; } htmlCode = '' + '' + '' + ' ' + ' ' + ' ' + ' ' + '' + ' ' + ' ' + ' ' + ' ' + '' + ' ' + ' ' + ' ' + '' + ' ' + '' + '
Property Asset #'+i+'
Property Address:Lender Name:
Address 2:Lender Phone:
City, State, Zip:
' + ' ' + '' + getStateMenu('propAsset'+i+'_state')+ '
Property Type:'+getPropTypeMenu('propAsset'+i+'_propType')+'
' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + '
Mortgage
Balance
Market
Value
Rental
Income
Mortgage
Payment
Net Rental
Income
'; return htmlCode; } function resetPropAssetLayers(resetTo) { currentNumProps = parseInt(document.forms["profile"].numberOfProps.value); for (i=1; i<=maxNumPropertyAssets; i++) { if (resetTo < 1) { document.getElementById('propAsset' + i + '_layer').style.visibility = "hidden"; document.getElementById('propAsset' + i + '_layer').style.lineHeight = "1px"; document.getElementById('propAsset' + i + '_layer').innerHTML = ""; } else if (maxNumPropertyAssets > resetTo && i > resetTo) { document.getElementById('propAsset' + i + '_layer').style.visibility = "hidden"; document.getElementById('propAsset' + i + '_layer').style.lineHeight = "1px"; document.getElementById('propAsset' + i + '_layer').innerHTML = ""; } } } function setPropAssetLayers(NumOfAssetObj) { var numofAssets = parseInt(NumOfAssetObj.value); resetPropAssetLayers(numofAssets); // reset all layers that need to be invisible if (numofAssets < 1 || numofAssets > maxNumPropertyAssets) { prevNumPropertyAssets = 0; resetPropAssetLayers(0); return false; } for (i=1; i<=numofAssets; i++) { if (prevNumPropertyAssets < numofAssets && i > prevNumPropertyAssets || isNaN(prevNumPropertyAssets)) { document.getElementById('propAsset' + eval(i) + '_layer').innerHTML = getPropAssetFieldset(i); document.getElementById('propAsset' + eval(i) + '_layer').style.visibility = "visible"; document.getElementById('propAsset' + i + '_layer').style.lineHeight = "normal"; } } prevNumPropertyAssets = numofAssets; return true; } function setReferredByOther(formName) { var referredBy = document.forms[formName].referred_by; var referredByOther = document.forms[formName].referred_by_other; if (referredBy.value == 'Other') { document.getElementById('referredByOtherDiv').style.visibility = "visible"; referredByOther.focus(); } else { document.getElementById('referredByOtherDiv').style.visibility = "hidden"; } } function clearDrawRequestErrors() { document.images.contractor_id.src="template_images/spacer.gif"; document.images.contact_name.src="template_images/spacer.gif"; document.images.contact_phone1.src="template_images/spacer.gif"; if (document.images.inspector_id) { document.images.inspector_id.src="template_images/spacer.gif"; } if (document.images.sent_for_inspection_date) { document.images.sent_for_inspection_date.src="template_images/spacer.gif"; } if (document.images.close_date){ document.images.close_date.src="template_images/spacer.gif"; } return true; } function ckDrawRequest(ckTopFields) { var cid = document.escrowDrawForm.contractor_id.value; clearDrawRequestErrors(); // clear out all previous errors and re-evaluate // get the referred_by select object and evaluate contractorIdObj = eval("document.escrowDrawForm.contractor_id"); if (contractorIdObj.value == "" || contractorIdObj.value == null || contractorIdObj.value == '--Select One--') { document.images.contractor_id.src="template_images/field_warning.gif"; alert("You must select a contractor for this draw request.\nCorrect and resubmit your request."); document.escrowDrawForm.contractor_id.focus(); return false; } if (calcDrawReqTotal() < 1 && ckTopFields != 1) { alert("You must request some funds before submitting your draw request.\nCorrect and resubmit your request."); return false; } if (cid === false || cid === "" || cid === null || cid < 1 || cid === "--Select One--") { document.images.contractor_id.src="template_images/field_warning.gif"; alert("You must select a contractor for this draw request.\nCorrect and resubmit your request."); return false; } if (document.escrowDrawForm.contact_name.value.length < 1) { document.images.contact_name.src="template_images/field_warning.gif"; alert("You must enter a contact name.\nCorrect and resubmit your request."); document.escrowDrawForm.contact_name.focus(); return false; } if (document.escrowDrawForm.contact_phone1.value.length < 1) { document.images.contact_phone1.src="template_images/field_warning.gif"; alert("You must enter a contact phone.\nCorrect and resubmit your request."); document.escrowDrawForm.contact_phone1.focus(); return false; } if (document.escrowDrawForm.req_ins_date.value.length < 1) { document.images.req_ins_date.src="template_images/field_warning.gif"; alert("You must enter a requsted inspection date.\nCorrect and resubmit your request."); document.escrowDrawForm.req_ins_date.focus(); return false; } // check the top fields if indicated if (ckTopFields == 1) { // inspector inspectorIdObj = eval("document.escrowDrawForm.inspector_id"); if ((document.escrowDrawForm.status.value == "Sent For Inspection" || document.escrowDrawForm.status.value == "Closed") && (inspectorIdObj.value == "" || inspectorIdObj.value == null || inspectorIdObj.value == '--Select One--')) { document.images.inspector_id.src="template_images/field_warning.gif"; alert("You must select an inspector for this draw request.\nCorrect and resubmit your request."); document.escrowDrawForm.inspector_id.focus(); return false; } // sent_for_inspection_date if (document.escrowDrawForm.status.value == "Sent For Inspection") { if (document.escrowDrawForm.sent_for_inspection_date && document.escrowDrawForm.sent_for_inspection_date.value.length < 10) { // only if present, if not we're moving to this status for the first time document.images.sent_for_inspection_date.src="template_images/field_warning.gif"; alert("You must enter a Sent For Inspection Date.\nCorrect and resubmit your request."); document.escrowDrawForm.sent_for_inspection_date.focus(); return false; } } // close_date if (document.escrowDrawForm.status.value == "Closed") { if (document.escrowDrawForm.sent_for_inspection_date && document.escrowDrawForm.sent_for_inspection_date.value.length < 10) { // only if present, if not we're moving to this status for the first time document.images.sent_for_inspection_date.src="template_images/field_warning.gif"; alert("You must enter a Sent For Inspection Date.\nCorrect and resubmit your request."); document.escrowDrawForm.sent_for_inspection_date.focus(); return false; } if (document.escrowDrawForm.close_date && document.escrowDrawForm.close_date.value.length < 10) { // only if present, if not we're moving to this status for the first time document.images.close_date.src="template_images/field_warning.gif"; alert("You must enter a Close Date.\nCorrect and resubmit your request."); document.escrowDrawForm.close_date.focus(); return false; } } } // if no erros encountered, submit the form document.escrowDrawForm.submit(); return true; } function ckDrawRequestAmount(requestAmount, budgetAmount, resetAmount) { if (requestAmount.value > budgetAmount) { //if (isNaN(resetAmount) || resetAmount == "") { // resetAmount = budgetAmount - requestAmount; //} requestAmount.value = resetAmount; requestAmount.select(); alert("This payment can not exceed remaining balance."); return false; } else { return true; } } function setAmtReleasedTotal() { var total = 0.00; var fieldname; var fieldValue; //document.forms["escrowDrawReportForm"].elements["total_amountReleased"].value = 0; for (i=0; i= 48 && characterCode <= 57){ return true; } if(characterCode == 46 || characterCode == 8 || characterCode == 127){ return true; } else { return false; } } // function that only allows input of 0-9,.,backspace function numbersDashesOnly(e) { var characterCode; if (e && e.which){ e = e; characterCode = e.which; } else { e = event; characterCode = e.keyCode; } if(characterCode >= 48 && characterCode <= 57){ return true; } if(characterCode == 46 || characterCode == 8 || characterCode == 127 || characterCode == 45){ return true; } else { return false; } } function clearProfileErrors() { document.images.referred_by.src="template_images/spacer.gif"; document.images.borrower_type.src="template_images/spacer.gif"; document.images.firstname.src="template_images/spacer.gif"; document.images.lastname.src="template_images/spacer.gif"; document.images.address1.src="template_images/spacer.gif"; document.images.city.src="template_images/spacer.gif"; document.images.zip.src="template_images/spacer.gif"; document.images.birth_date.src="template_images/spacer.gif"; document.images.phone1.src="template_images/spacer.gif"; document.images.phone3.src="template_images/spacer.gif"; document.images.fax.src="template_images/spacer.gif"; document.images.email.src="template_images/spacer.gif"; document.images.password.src="template_images/spacer.gif"; document.images.confirmPassword.src="template_images/spacer.gif"; document.images.employer_name.src="template_images/spacer.gif"; document.images.employer_address.src="template_images/spacer.gif"; document.images.employer_titleHeld.src="template_images/spacer.gif"; document.images.employer_annualSalary.src="template_images/spacer.gif"; document.images.employer_timeEmployed.src="template_images/spacer.gif"; document.images.employer_phone.src="template_images/spacer.gif"; document.images.agreesToTerms.src="template_images/spacer.gif"; var i = 1; while (i <= 5) { if (document.images['propAsset'+i+'_address1']) { // if we have an address 1 document.images['propAsset'+i+'_propType'].src = "template_images/spacer.gif"; document.images['propAsset'+i+'_address1'].src = "template_images/spacer.gif"; document.images['propAsset'+i+'_lenderName'].src = "template_images/spacer.gif"; document.images['propAsset'+i+'_city'].src = "template_images/spacer.gif"; document.images['propAsset'+i+'_state'].src = "template_images/spacer.gif"; document.images['propAsset'+i+'_zip'].src = "template_images/spacer.gif"; document.images['propAsset'+i+'_mortgageBalance'].src = "template_images/spacer.gif"; document.images['propAsset'+i+'_mortgagePayment'].src = "template_images/spacer.gif"; } i++; } return true; } function validateProfile(ckPass) { var referred_byObj; var borrower_typeObj; var numberOfPropsObj; var numberOfPropsVal = 0; var is_error = 0; var error_msg = "The following fields have errors that need to be corrected before continuing:\n\n"; clearProfileErrors(); // clear out all previous errors and re-evaluate // recalculate the financial summary setAssetTotals(); // get the referred_by select object and evaluate referred_byObj = eval("document.profile.referred_by"); if (referred_byObj.value.length < 3 || referred_byObj.value == null || referred_byObj.value == '--Select One--') { document.images.referred_by.src="template_images/field_warning.gif"; error_msg = error_msg + "- How did you hear about us?\n"; is_error = 1; } // get the borrower_type select object and evaluate borrower_typeObj = eval("document.profile.borrower_type"); if (borrower_typeObj.value == "" || borrower_typeObj.value == null || borrower_typeObj.value == '--Select One--') { document.images.borrower_type.src="template_images/field_warning.gif"; error_msg = error_msg + "- I am applying as a(n)\n"; is_error = 1; } // test the firstname if (document.profile.firstname.value == "" || document.profile.firstname.value == null) { document.images.firstname.src="template_images/field_warning.gif"; error_msg = error_msg + "- First Name\n"; is_error = 1; } // test the lastname if (document.profile.lastname.value == "" || document.profile.lastname.value == null) { document.images.lastname.src="template_images/field_warning.gif"; error_msg = error_msg + "- Last Name\n"; is_error = 1; } // test the address1 if (document.profile.address1.value == "" || document.profile.address1.value == null) { document.images.address1.src="template_images/field_warning.gif"; error_msg = error_msg + "- Address\n"; is_error = 1; } // test city if (document.profile.city.value == "" || document.profile.city.value == null) { document.images.city.src="template_images/field_warning.gif"; error_msg = error_msg + "- City\n"; is_error = 1; } // test zip if (document.profile.zip.value == "" || document.profile.zip.value == null) { document.images.zip.src="template_images/field_warning.gif"; error_msg = error_msg + "- Zip\n"; is_error = 1; } // test ssn if (document.profile.ssn.value == "" || document.profile.ssn.value == null || !isValidSSN(document.profile.ssn.value)) { document.images.ssn.src="template_images/field_warning.gif"; error_msg = error_msg + "- Social Security\n"; is_error = 1; } // test birth_date if (document.profile.birth_date.value == "" || document.profile.birth_date.value == null) { document.images.birth_date.src="template_images/field_warning.gif"; error_msg = error_msg + "- Date of Birth\n"; is_error = 1; } // test phone1 - AKA Home Phone if (document.profile.phone1.value.length < 7) { document.images.phone1.src="template_images/field_warning.gif"; error_msg = error_msg + "- Home Phone must be at least 7 digits\n"; is_error = 1; } // test phone3 - AKA Business Phone if (document.profile.phone3.value.length < 7) { document.images.phone3.src="template_images/field_warning.gif"; error_msg = error_msg + "- Business Phone must be at least 7 digits\n"; is_error = 1; } // test fax if (document.profile.fax.value.length < 7) { document.images.fax.src="template_images/field_warning.gif"; error_msg = error_msg + "- Fax must be at least 7 digits\n"; is_error = 1; } // get the numberOfProps select object and evaluate numberOfPropsVal = parseInt(document.profile.numberOfProps.value); if (!isNaN(numberOfPropsVal) && numberOfPropsVal >= 1) { // if 1 or more is selected, some stuff is required var i = 1; while (i <= numberOfPropsVal) { // check each property assest // test the property address1 if (document.forms["profile"].elements['propAsset'+i+'_address1'].value.length < 1) { document.images['propAsset'+i+'_address1'].src="template_images/field_warning.gif"; error_msg = error_msg + "- Property Asset #"+i+": Address\n"; is_error = 1; } // test the property lender name if (document.forms['profile'].elements['propAsset'+i+'_lenderName'].value.length < 1) { document.images['propAsset'+i+'_lenderName'].src="template_images/field_warning.gif"; error_msg = error_msg + "- Property Asset #"+i+": Lender Name\n"; is_error = 1; } // test the property city if (document.forms['profile'].elements['propAsset'+i+'_city'].value.length < 1) { document.images['propAsset'+i+'_city'].src="template_images/field_warning.gif"; error_msg = error_msg + "- Property Asset #"+i+": City\n"; is_error = 1; } // test the property state if (document.forms['profile'].elements['propAsset'+i+'_state'].value.length < 1) { document.images['propAsset'+i+'_state'].src="template_images/field_warning.gif"; error_msg = error_msg + "- Property Asset #"+i+": State\n"; is_error = 1; } // test the property zip if (document.forms['profile'].elements['propAsset'+i+'_zip'].value.length < 1) { document.images['propAsset'+i+'_zip'].src="template_images/field_warning.gif"; error_msg = error_msg + "- Property Asset #"+i+": Zip\n"; is_error = 1; } // test the property type, check the property type pulldown menu propTypeObj = document.forms['profile'].elements['propAsset'+i+'_propType']; if (propTypeObj.value == "" || propTypeObj.value == null || propTypeObj.value == '--Select One--') { document.images['propAsset'+i+'_propType'].src="template_images/field_warning.gif"; error_msg = error_msg + "- Property Asset #"+i+": Property Type\n"; is_error = 1; } // test the property Mortgage Balance if (document.forms['profile'].elements['propAsset'+i+'_mortgageBalance'].value.length < 1) { document.images['propAsset'+i+'_mortgageBalance'].src="template_images/field_warning.gif"; error_msg = error_msg + "- Property Asset #"+i+": Mortgage Balance\n"; is_error = 1; } // test the property Mortgage Payment if (document.forms['profile'].elements['propAsset'+i+'_mortgagePayment'].value.length < 1) { document.images['propAsset'+i+'_mortgagePayment'].src="template_images/field_warning.gif"; error_msg = error_msg + "- Property Asset #"+i+": Mortgage Payment\n"; is_error = 1; } i++; } //document.forms["profile"].assets_cashOnHand.value = assetsCashOnHand.toFixed(2); } // test How many residential real estate properties have you rehabbed in the past? if (document.profile.num_residential_rehabs.value == "" || document.profile.num_residential_rehabs.value == null) { document.images.num_residential_rehabs.src="template_images/field_warning.gif"; error_msg = error_msg + "- How many residential real estate properties have you rehabbed in the past?\n"; is_error = 1; } // test the employment information section if (document.profile.employer_name.value.length < 1) { document.images.employer_name.src="template_images/field_warning.gif"; error_msg = error_msg + "- Employer Name\n"; is_error = 1; } if (document.profile.employer_address.value.length < 1) { document.images.employer_address.src="template_images/field_warning.gif"; error_msg = error_msg + "- Employer Address\n"; is_error = 1; } if (document.profile.employer_titleHeld.value.length < 1) { document.images.employer_titleHeld.src="template_images/field_warning.gif"; error_msg = error_msg + "- Title Held\n"; is_error = 1; } if (document.profile.employer_annualSalary.value.length < 1) { document.images.employer_annualSalary.src="template_images/field_warning.gif"; error_msg = error_msg + "- Annual Salary\n"; is_error = 1; } if (document.profile.employer_timeEmployed_years.value.length < 1 && document.profile.employer_timeEmployed_months.value.length < 1) { document.images.employer_timeEmployed.src="template_images/field_warning.gif"; error_msg = error_msg + "- Length Of Time Employed\n"; is_error = 1; } if (document.profile.employer_phone.value.length < 1) { document.images.employer_phone.src="template_images/field_warning.gif"; error_msg = error_msg + "- Employer Phone\n"; is_error = 1; } // get the agreesToTerms checkbox object and evaluate agreesToTermsObj = eval("document.profile.agreesToTerms"); if (agreesToTermsObj.checked == false) { document.images.agreesToTerms.src="template_images/field_warning.gif"; error_msg = error_msg + "- Indicate that you have understand and agree to the terms.\n"; is_error = 1; } // test email if (document.profile.email.value == "" || document.profile.email.value == null) { document.images.email.src="template_images/field_warning.gif"; error_msg = error_msg + "- Email\n"; is_error = 1; } if (ckPass === 1) { // test password if (document.profile.password.value == "" || document.profile.password.value == null || document.profile.password.value.length < 8) { document.images.password.src="template_images/field_warning.gif"; error_msg = error_msg + "- Password must be at least 8 characters long.\n"; is_error = 1; } } // test passwordConfirm if (document.profile.confirmPassword.value != document.profile.password.value) { document.images.confirmPassword.src="template_images/field_warning.gif"; error_msg = error_msg + "- Confirm password does not match.\n"; is_error = 1; } // evaluate test results and act accordingly if (is_error >= 1) { // spit up the error and return false alert(error_msg); return false; } else { // no erros, submit and return true document.profile.submit(); return true; } } function clearPartnerProfileErrors() { document.images.referred_by.src="template_images/spacer.gif"; document.images.partner_type.src="template_images/spacer.gif"; document.images.firstname.src="template_images/spacer.gif"; document.images.lastname.src="template_images/spacer.gif"; document.images.address1.src="template_images/spacer.gif"; document.images.city.src="template_images/spacer.gif"; document.images.zip.src="template_images/spacer.gif"; document.images.phone1.src="template_images/spacer.gif"; document.images.fax.src="template_images/spacer.gif"; document.images.ssn.src="template_images/spacer.gif"; document.images.tax_id.src="template_images/spacer.gif"; document.images.email.src="template_images/spacer.gif"; document.images.password.src="template_images/spacer.gif"; document.images.confirmPassword.src="template_images/spacer.gif"; return true; } function validatePartnerProfile(ckPass) { var referred_byObj; var partner_typeObj; var is_error = 0; var error_msg = "The following fields have errors that need to be corrected before continuing:\n\n"; clearPartnerProfileErrors(); // clear out all previous errors and re-evaluate // get the referred_by select object and evaluate referred_byObj = eval("document.profile.referred_by"); if (referred_byObj.value == "" || referred_byObj.value == null || referred_byObj.value == '--Select One--') { document.images.referred_by.src="template_images/field_warning.gif"; error_msg = error_msg + "- How did you hear about us?\n"; is_error = 1; } // get the borrower_type select object and evaluate partner_typeObj = eval("document.profile.partner_type"); if (partner_typeObj.value == "" || partner_typeObj.value == null || partner_typeObj.value == '--Select One--') { document.images.partner_type.src="template_images/field_warning.gif"; error_msg = error_msg + "- I am applying as a(n)\n"; is_error = 1; } // test the firstname if (document.profile.firstname.value == "" || document.profile.firstname.value == null) { document.images.firstname.src="template_images/field_warning.gif"; error_msg = error_msg + "- First Name\n"; is_error = 1; } // test the lastname if (document.profile.lastname.value == "" || document.profile.lastname.value == null) { document.images.lastname.src="template_images/field_warning.gif"; error_msg = error_msg + "- Last Name\n"; is_error = 1; } // test the address1 if (document.profile.address1.value == "" || document.profile.address1.value == null) { document.images.address1.src="template_images/field_warning.gif"; error_msg = error_msg + "- Address\n"; is_error = 1; } // test city if (document.profile.city.value == "" || document.profile.city.value == null) { document.images.city.src="template_images/field_warning.gif"; error_msg = error_msg + "- City\n"; is_error = 1; } // test zip if (document.profile.zip.value == "" || document.profile.zip.value == null) { document.images.zip.src="template_images/field_warning.gif"; error_msg = error_msg + "- Zip\n"; is_error = 1; } // now check dependancies of ssn with partner_typeObj if (partner_typeObj.value == "Individual" && document.profile.ssn.value == "") { document.images.ssn.src="template_images/field_warning.gif"; error_msg = error_msg + "- If applying as an Individual SSN is required.\n"; is_error = 1; } // now check dependancies of taxid with partner_typeObj if (partner_typeObj.value == "Business" && document.profile.tax_id.value == "") { document.images.tax_id.src="template_images/field_warning.gif"; error_msg = error_msg + "- If applying as a Business Tax ID is required.\n"; is_error = 1; } // test ssn & tax_id - make sure at least one has something if (document.profile.ssn.value == "" && document.profile.tax_id.value == "" && partner_typeObj.value == '--Select One--') { document.images.ssn.src="template_images/field_warning.gif"; document.images.tax_id.src="template_images/field_warning.gif"; error_msg = error_msg + "- Social Security or Tax ID\n"; is_error = 1; } // test phone1 if (document.profile.phone1.value == "" || document.profile.phone1.value == null) { document.images.phone1.src="template_images/field_warning.gif"; error_msg = error_msg + "- Phone\n"; is_error = 1; } // test fax if (document.profile.fax.value == "" || document.profile.fax.value == null) { document.images.fax.src="template_images/field_warning.gif"; error_msg = error_msg + "- Fax\n"; is_error = 1; } // test email if (document.profile.email.value == "" || document.profile.email.value == null) { document.images.email.src="template_images/field_warning.gif"; error_msg = error_msg + "- Email\n"; is_error = 1; } if (ckPass === 1) { // test password if (document.profile.password.value == "" || document.profile.password.value == null || document.profile.password.value.length < 8) { document.images.password.src="template_images/field_warning.gif"; error_msg = error_msg + "- Password must be at least 8 characters long.\n"; is_error = 1; } } // test passwordConfirm if (document.profile.confirmPassword.value != document.profile.password.value) { document.images.confirmPassword.src="template_images/field_warning.gif"; error_msg = error_msg + "- Confirm password does not match.\n"; is_error = 1; } // evaluate test results and act accordingly if (is_error >= 1) { // spit up the error and return false alert(error_msg); return false; } else { // no erros, submit and return true document.profile.submit(); return true; } } function clearPartnerProfileErrors() { document.images.firstname.src="template_images/spacer.gif"; document.images.lastname.src="template_images/spacer.gif"; document.images.address1.src="template_images/spacer.gif"; document.images.city.src="template_images/spacer.gif"; document.images.zip.src="template_images/spacer.gif"; document.images.phone1.src="template_images/spacer.gif"; document.images.fax.src="template_images/spacer.gif"; document.images.email.src="template_images/spacer.gif"; document.images.password.src="template_images/spacer.gif"; document.images.confirmPassword.src="template_images/spacer.gif"; return true; } function validateInspectorProfile(ckPass) { var is_error = 0; var error_msg = "The following fields have errors that need to be corrected before continuing:\n\n"; clearInspectorProfileErrors(); // clear out all previous errors and re-evaluate // test the firstname if (document.profile.firstname.value == "" || document.profile.firstname.value == null) { document.images.firstname.src="template_images/field_warning.gif"; error_msg = error_msg + "- First Name\n"; is_error = 1; } // test the lastname if (document.profile.lastname.value == "" || document.profile.lastname.value == null) { document.images.lastname.src="template_images/field_warning.gif"; error_msg = error_msg + "- Last Name\n"; is_error = 1; } // test the address1 if (document.profile.address1.value == "" || document.profile.address1.value == null) { document.images.address1.src="template_images/field_warning.gif"; error_msg = error_msg + "- Address\n"; is_error = 1; } // test city if (document.profile.city.value == "" || document.profile.city.value == null) { document.images.city.src="template_images/field_warning.gif"; error_msg = error_msg + "- City\n"; is_error = 1; } // test zip if (document.profile.zip.value == "" || document.profile.zip.value == null) { document.images.zip.src="template_images/field_warning.gif"; error_msg = error_msg + "- Zip\n"; is_error = 1; } // test phone1 if (document.profile.phone1.value == "" || document.profile.phone1.value == null) { document.images.phone1.src="template_images/field_warning.gif"; error_msg = error_msg + "- Phone\n"; is_error = 1; } // test fax if (document.profile.fax.value == "" || document.profile.fax.value == null) { document.images.fax.src="template_images/field_warning.gif"; error_msg = error_msg + "- Fax\n"; is_error = 1; } // test email if (document.profile.email.value == "" || document.profile.email.value == null) { document.images.email.src="template_images/field_warning.gif"; error_msg = error_msg + "- Email\n"; is_error = 1; } if (ckPass === 1) { // test password if (document.profile.password.value == "" || document.profile.password.value == null || document.profile.password.value.length < 8) { document.images.password.src="template_images/field_warning.gif"; error_msg = error_msg + "- Password must be at least 8 characters long.\n"; is_error = 1; } } // test passwordConfirm if (document.profile.confirmPassword.value != document.profile.password.value) { document.images.confirmPassword.src="template_images/field_warning.gif"; error_msg = error_msg + "- Confirm password does not match.\n"; is_error = 1; } // evaluate test results and act accordingly if (is_error >= 1) { // spit up the error and return false alert(error_msg); return false; } else { // no erros, submit and return true document.profile.submit(); return true; } } function clearFinalLoanAppErrors() { if (document.forms["finalLoanApp"].business_name) { document.images.business_name.src="template_images/spacer.gif"; document.images.firstname.src="template_images/spacer.gif"; document.images.lastname.src="template_images/spacer.gif"; document.images.phone1.src="template_images/spacer.gif"; } else { document.images.contractor_id.src="template_images/spacer.gif"; } return true; } function validateFinalLoanApp() { var businessNameObj; var firstNameObj; var lastNameObj; var phone1Obj; var contractorIdObj; clearFinalLoanAppErrors(); // clear out all previous errors and re-evaluate var is_error = 0; var error_msg = "The following fields have errors that need to be corrected before continuing:\n\n"; if (document.forms["finalLoanApp"].business_name) { if (document.forms["finalLoanApp"].business_name.value.length < 1) { document.images.business_name.src="template_images/field_warning.gif"; error_msg = error_msg + "- Constuction Company.\n"; is_error = 1; } if (document.forms["finalLoanApp"].firstname.value.length < 1) { document.images.firstname.src="template_images/field_warning.gif"; error_msg = error_msg + "- Contact First Name.\n"; is_error = 1; } if (document.forms["finalLoanApp"].lastname.value.length < 1) { document.images.lastname.src="template_images/field_warning.gif"; error_msg = error_msg + "- Contact Last Name.\n"; is_error = 1; } if (document.forms["finalLoanApp"].phone1.value.length < 1) { document.images.phone1.src="template_images/field_warning.gif"; error_msg = error_msg + "- Phone Number.\n"; is_error = 1; } } else { // get the contractor_id select object and evaluate contractorIdObj = eval("document.forms['finalLoanApp'].contractor_id"); if (contractorIdObj.value == "" || contractorIdObj.value == null || contractorIdObj.value == '--Select One--') { document.images.contractor_id.src="template_images/field_warning.gif"; error_msg = error_msg + "- Choose a Contractor.\n"; is_error = 1; } } // evaluate test results and act accordingly if (is_error >= 1) { // spit up the error and return false alert(error_msg); return false; } else { // no erros, submit and return true document.forms["finalLoanApp"].submit(); return true; } } function clearLoanApp2Errors() { document.images.loan_program.src="template_images/spacer.gif"; document.images.closing_date.src="template_images/spacer.gif"; document.images.purchase_price.src="template_images/spacer.gif"; document.images.total_repair_costs.src="template_images/spacer.gif"; document.images.est_payoff_date.src="template_images/spacer.gif"; document.images.loan_amount.src="template_images/spacer.gif"; document.images.ARV_based_on.src="template_images/spacer.gif"; document.images.estimated_ARV.src="template_images/spacer.gif"; document.images.seller_name.src="template_images/spacer.gif"; document.images.seller_phone.src="template_images/spacer.gif"; document.images.agent_name.src="template_images/spacer.gif"; document.images.agent_phone.src="template_images/spacer.gif"; document.images.property_type.src="template_images/spacer.gif"; document.images.property_address.src="template_images/spacer.gif"; document.images.property_city.src="template_images/spacer.gif"; document.images.property_state.src="template_images/spacer.gif"; document.images.property_zip.src="template_images/spacer.gif"; document.images.property_county.src="template_images/spacer.gif"; document.images.how_to_access.src="template_images/spacer.gif"; document.images.is_occupied.src="template_images/spacer.gif"; document.images.bedrooms.src="template_images/spacer.gif"; document.images.bathrooms.src="template_images/spacer.gif"; document.images.garage_spaces.src="template_images/spacer.gif"; document.images.sq_ft_living.src="template_images/spacer.gif"; document.images.exterior_walls.src="template_images/spacer.gif"; return true; } function validateLoanApp2() { var loanProgramObj; var payoffDateObj; var arvBasedOnObj; var stateObj; var isOccupiedObj; var propertyTypeObj; var bedroomsObj; var bathroomsObj; var howToAccessObj; var garageSpacesObj; var extWallsObj; var is_error = 0; var error_msg = "The following fields have errors that need to be corrected before continuing:\n\n"; clearLoanApp2Errors(); // clear out all previous errors and re-evaluate // get the loan_program select object and evaluate loanProgramObj = eval("document.loanAppStep2.loan_program"); if (loanProgramObj.value == "" || loanProgramObj.value == null || loanProgramObj.value == '--Select One--') { document.images.loan_program.src="template_images/field_warning.gif"; error_msg = error_msg + "- Choose a Loan Program.\n"; is_error = 1; } // test the closing_date if (document.loanAppStep2.closing_date.value == "" || document.loanAppStep2.closing_date.value == null) { document.images.closing_date.src="template_images/field_warning.gif"; error_msg = error_msg + "- Requested Date of Closing.\n"; is_error = 1; } // test the purchase_price if (document.loanAppStep2.purchase_price.value == "" || document.loanAppStep2.purchase_price.value == null) { document.images.purchase_price.src="template_images/field_warning.gif"; error_msg = error_msg + "- Purchase Price.\n"; is_error = 1; } // test the total_repair_costs if (document.loanAppStep2.total_repair_costs.value == "" || document.loanAppStep2.total_repair_costs.value == null) { document.images.total_repair_costs.src="template_images/field_warning.gif"; error_msg = error_msg + "- Total Repair Costs.\n"; is_error = 1; } // get the est_payoff_date select object and evaluate payoffDateObj = eval("document.loanAppStep2.est_payoff_date"); if (payoffDateObj.value == "" || payoffDateObj.value == null || payoffDateObj.value == '--Select One--') { document.images.est_payoff_date.src="template_images/field_warning.gif"; error_msg = error_msg + "- Estimated Loan Payoff Date.\n"; is_error = 1; } // test the loan_amount if (document.loanAppStep2.loan_amount.value == "" || document.loanAppStep2.loan_amount.value == null) { document.images.loan_amount.src="template_images/field_warning.gif"; error_msg = error_msg + "- Loan Amount Requested.\n"; is_error = 1; } // get the ARV_based_on select object and evaluate arvBasedOnObj = eval("document.loanAppStep2.ARV_based_on"); if (arvBasedOnObj.value == "" || arvBasedOnObj.value == null || arvBasedOnObj.value == '--Select One--') { document.images.ARV_based_on.src="template_images/field_warning.gif"; error_msg = error_msg + "- Estimated ARV Based on.\n"; is_error = 1; } // test the estimated_ARV if (document.loanAppStep2.estimated_ARV.value == "" || document.loanAppStep2.estimated_ARV.value == null) { document.images.estimated_ARV.src="template_images/field_warning.gif"; error_msg = error_msg + "- Estimated After Repaired Value (ARV).\n"; is_error = 1; } // test the seller/agent fields // if both names are blank if (document.loanAppStep2.seller_name.value.length < 1 && document.loanAppStep2.agent_name.value.length < 1) { document.images.seller_name.src="template_images/field_warning.gif"; document.images.agent_name.src="template_images/field_warning.gif"; error_msg = error_msg + "- Seller or Agent Name.\n"; is_error = 1; } if (document.loanAppStep2.seller_name.value.length > 1 && document.loanAppStep2.seller_phone.value.length < 1) { document.images.seller_phone.src="template_images/field_warning.gif"; error_msg = error_msg + "- Seller Phone.\n"; is_error = 1; } if (document.loanAppStep2.agent_name.value.length > 1 && document.loanAppStep2.agent_phone.value.length < 1) { document.images.agent_phone.src="template_images/field_warning.gif"; error_msg = error_msg + "- Agent Phone.\n"; is_error = 1; } // test the property_address if (document.loanAppStep2.property_address.value == "" || document.loanAppStep2.property_address.value == null) { document.images.property_address.src="template_images/field_warning.gif"; error_msg = error_msg + "- Address.\n"; is_error = 1; } // test the property_city if (document.loanAppStep2.property_city.value == "" || document.loanAppStep2.property_city.value == null) { document.images.property_city.src="template_images/field_warning.gif"; error_msg = error_msg + "- City.\n"; is_error = 1; } // get the property_state select object and evaluate stateObj = eval("document.loanAppStep2.property_state"); if (stateObj.value == "" || stateObj.value == null || stateObj.value == '--Select One--') { document.images.property_state.src="template_images/field_warning.gif"; error_msg = error_msg + "- State.\n"; is_error = 1; } // test the property_zip if (document.loanAppStep2.property_zip.value == "" || document.loanAppStep2.property_zip.value == null) { document.images.property_zip.src="template_images/field_warning.gif"; error_msg = error_msg + "- Zip.\n"; is_error = 1; } // test the property_county if (document.loanAppStep2.property_county.value == "" || document.loanAppStep2.property_county.value == null) { document.images.property_county.src="template_images/field_warning.gif"; error_msg = error_msg + "- County.\n"; is_error = 1; } // test the how_to_access howToAccessObj = eval("document.loanAppStep2.how_to_access"); if (howToAccessObj.value == "" || howToAccessObj.value == null || howToAccessObj.value == '--Select One--') { document.images.how_to_access.src="template_images/field_warning.gif"; error_msg = error_msg + "- How do we access the property?\n"; is_error = 1; } // get the is_occupied select object and evaluate isOccupiedObj = eval("document.loanAppStep2.is_occupied"); if (isOccupiedObj.value == "" || isOccupiedObj.value == null || isOccupiedObj.value == '--Select One--') { document.images.is_occupied.src="template_images/field_warning.gif"; error_msg = error_msg + "- Is the property occupied?\n"; is_error = 1; } // get the property_type select object and evaluate propertyTypeObj = eval("document.loanAppStep2.property_type"); if (propertyTypeObj.value == "" || propertyTypeObj.value == null || propertyTypeObj.value == '--Select One--') { document.images.property_type.src="template_images/field_warning.gif"; error_msg = error_msg + "- Dwelling Type\n"; is_error = 1; } // get the bedrooms select object and evaluate bedroomsObj = eval("document.loanAppStep2.bedrooms"); if (bedroomsObj.value == "" || bedroomsObj.value == null || bedroomsObj.value == '--Select One--') { document.images.bedrooms.src="template_images/field_warning.gif"; error_msg = error_msg + "- Number of bedrooms.\n"; is_error = 1; } // get the bathrooms select object and evaluate bathroomsObj = eval("document.loanAppStep2.bathrooms"); if (bathroomsObj.value == "" || bathroomsObj.value == null || bathroomsObj.value == '--Select One--') { document.images.bathrooms.src="template_images/field_warning.gif"; error_msg = error_msg + "- Number of bathrooms.\n"; is_error = 1; } // get the garage_spaces select object and evaluate garageSpacesObj = eval("document.loanAppStep2.garage_spaces"); if (garageSpacesObj.value == "" || garageSpacesObj.value == null || garageSpacesObj.value == '--Select One--') { document.images.garage_spaces.src="template_images/field_warning.gif"; error_msg = error_msg + "- Garage spaces.\n"; is_error = 1; } // test the sq_ft_living if (document.loanAppStep2.sq_ft_living.value == "" || document.loanAppStep2.sq_ft_living.value == null) { document.images.sq_ft_living.src="template_images/field_warning.gif"; error_msg = error_msg + "- Sq. Ft. Living Area.\n"; is_error = 1; } // get the exterior_walls select object and evaluate extWallsObj = eval("document.loanAppStep2.exterior_walls"); if (extWallsObj.value == "" || extWallsObj.value == null || extWallsObj.value == '--Select One--') { document.images.exterior_walls.src="template_images/field_warning.gif"; error_msg = error_msg + "- Choose exterior walls.\n"; is_error = 1; } // evaluate test results and act accordingly if (is_error >= 1) { // spit up the error and return false alert(error_msg); return false; } else { // no erros, submit and return true document.loanAppStep2.submit(); return true; } } function clearReqPayoffFormErrors() { document.images.clientName.src="template_images/spacer.gif"; document.images.propertyAddress.src="template_images/spacer.gif"; document.images.expectedClosingDate.src="template_images/spacer.gif"; document.images.payoffDate.src="template_images/spacer.gif"; document.images.payoffType.src="template_images/spacer.gif"; document.images.RequesterCompanyName.src="template_images/spacer.gif"; document.images.RequesterContact.src="template_images/spacer.gif"; document.images.RequesterNumber.src="template_images/spacer.gif"; document.images.RequesterFax.src="template_images/spacer.gif"; document.images.email.src="template_images/spacer.gif"; return true; } function ckReqPayoffForm() { var is_error = 0; var error_msg = "The following fields have errors that need to be corrected before continuing:\n\n"; clearReqPayoffFormErrors(); // clear out all previous errors and re-evaluate // test the clientName if (document.requestPayoffForm.clientName.value.length < 1) { document.images.clientName.src="template_images/field_warning.gif"; error_msg = error_msg + "- Seller Name.\n"; is_error = 1; } // test the propertyAddress if (document.requestPayoffForm.propertyAddress.value.length < 1) { document.images.propertyAddress.src="template_images/field_warning.gif"; error_msg = error_msg + "- Address of Property.\n"; is_error = 1; } // test the expectedClosingDate if (document.requestPayoffForm.expectedClosingDate.value.length < 1) { document.images.expectedClosingDate.src="template_images/field_warning.gif"; error_msg = error_msg + "- Expected Closing Date.\n"; is_error = 1; } // test the payoffDate if (document.requestPayoffForm.payoffDate.value.length < 1) { document.images.payoffDate.src="template_images/field_warning.gif"; error_msg = error_msg + "- Date Payoff Should be Made Good Through.\n"; is_error = 1; } // test the payoffType if (document.requestPayoffForm.payoffType.value.length < 1 || document.requestPayoffForm.payoffType.value == "--Select One--") { document.images.payoffType.src="template_images/field_warning.gif"; error_msg = error_msg + "- Payoff Type.\n"; is_error = 1; } // test the titleCompanyName if (document.requestPayoffForm.RequesterCompanyName.value.length < 1) { document.images.RequesterCompanyName.src="template_images/field_warning.gif"; error_msg = error_msg + "- Requester Company Name.\n"; is_error = 1; } // test the titleCompanyContact if (document.requestPayoffForm.RequesterContact.value.length < 1) { document.images.RequesterContact.src="template_images/field_warning.gif"; error_msg = error_msg + "- Requester Contact Person.\n"; is_error = 1; } // test the titleCompanyNumber if (document.requestPayoffForm.RequesterNumber.value.length < 1) { document.images.RequesterNumber.src="template_images/field_warning.gif"; error_msg = error_msg + "- Requester Phone Number.\n"; is_error = 1; } // test the titleCompanyFax if (document.requestPayoffForm.RequesterFax.value.length < 1) { document.images.RequesterFax.src="template_images/field_warning.gif"; error_msg = error_msg + "- Requester Fax Number.\n"; is_error = 1; } // test the email if (document.requestPayoffForm.email.value.length < 1) { document.images.email.src="template_images/field_warning.gif"; error_msg = error_msg + "- Requester Email Address.\n"; is_error = 1; } // evaluate test results and act accordingly if (is_error >= 1) { // spit up the error and return false alert(error_msg); return false; } else { // no erros, submit and return true //document.requestPayoffForm.submit(); return true; } } function clearForgotPassErrors() { document.images.FirstName.src="template_images/spacer.gif"; document.images.LastName.src="template_images/spacer.gif"; document.images.email.src="template_images/spacer.gif"; document.images.Phone.src="template_images/spacer.gif"; return true; } function ckForgotPassForm() { var is_error = 0; var error_msg = "The following fields have errors that need to be corrected before continuing:\n\n"; clearForgotPassErrors(); // clear out all previous errors and re-evaluate // test the firstname if (document.getForgotPass.FirstName.value == "" || document.getForgotPass.FirstName.value == null) { document.images.FirstName.src="template_images/field_warning.gif"; error_msg = error_msg + "- First Name.\n"; is_error = 1; } // test the lastname if (document.getForgotPass.LastName.value == "" || document.getForgotPass.LastName.value == null) { document.images.LastName.src="template_images/field_warning.gif"; error_msg = error_msg + "- Last Name.\n"; is_error = 1; } // test the email if (document.getForgotPass.email.value == "" || document.getForgotPass.email.value == null) { document.images.email.src="template_images/field_warning.gif"; error_msg = error_msg + "- Email.\n"; is_error = 1; } // test the Phone if (document.getForgotPass.Phone.value == "" || document.getForgotPass.Phone.value == null) { document.images.Phone.src="template_images/field_warning.gif"; error_msg = error_msg + "- Phone.\n"; is_error = 1; } // evaluate test results and act accordingly if (is_error >= 1) { // spit up the error and return false alert(error_msg); return false; } else { // no erros, submit and return true document.getForgotPass.submit(); return true; } } function clearSubscribeErrors() { document.images.FirstName.src="template_images/spacer.gif"; document.images.LastName.src="template_images/spacer.gif"; document.images.Phone.src="template_images/spacer.gif"; document.images.email.src="template_images/spacer.gif"; document.images.referred_by.src="template_images/spacer.gif"; return true; } function validateEmail(emailStr) { /* OLD, very basic validater var at="@"; var dot="."; var lat=str.indexOf(at); var lstr=str.length; var ldot=str.indexOf(dot); if (str.indexOf(at)==-1) { return false; } if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr) { return false; } if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr) { return false; } if (str.indexOf(at,(lat+1))!=-1) { return false; } if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot) { return false; } if (str.indexOf(dot,(lat+2))==-1) { return false; } if (str.indexOf(" ")!=-1) { return false; } return true; */ /* more thorough validator */ /* The following variable tells the rest of the function whether or not to verify that the address ends in a two-letter country or well-known TLD. 1 means check it, 0 means don't. */ var checkTLD=1; /* The following is the list of known TLDs that an e-mail address must end with. */ var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/; /* The following pattern is used to check if the entered e-mail address fits the user@domain format. It also is used to separate the username from the domain. */ var emailPat=/^(.+)@(.+)$/; /* The following string represents the pattern for matching all special characters. We don't want to allow special characters in the address. These characters include ( ) < > @ , ; : \ " . [ ] */ var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]"; /* The following string represents the range of characters allowed in a username or domainname. It really states which chars aren't allowed.*/ var validChars="\[^\\s" + specialChars + "\]"; /* The following pattern applies if the "user" is a quoted string (in which case, there are no rules about which characters are allowed and which aren't; anything goes). E.g. "jiminy cricket"@disney.com is a legal e-mail address. */ var quotedUser="(\"[^\"]*\")"; /* The following pattern applies for domains that are IP addresses, rather than symbolic names. E.g. joe@[123.124.233.4] is a legal e-mail address. NOTE: The square brackets are required. */ var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/; /* The following string represents an atom (basically a series of non-special characters.) */ var atom=validChars + '+'; /* The following string represents one word in the typical username. For example, in john.doe@somewhere.com, john and doe are words. Basically, a word is either an atom or quoted string. */ var word="(" + atom + "|" + quotedUser + ")"; // The following pattern describes the structure of the user var userPat=new RegExp("^" + word + "(\\." + word + ")*$"); /* The following pattern describes the structure of a normal symbolic domain, as opposed to ipDomainPat, shown above. */ var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$"); /* Finally, let's start trying to figure out if the supplied address is valid. */ /* Begin with the coarse pattern to simply break up user@domain into different pieces that are easy to analyze. */ var matchArray=emailStr.match(emailPat); if (matchArray==null) { /* Too many/few @'s or something; basically, this address doesn't even fit the general mould of a valid e-mail address. */ alert("Email address seems incorrect (check @ and .'s)"); return false; } var user=matchArray[1]; var domain=matchArray[2]; // Start by checking that only basic ASCII characters are in the strings (0-127). for (i=0; i127) { alert("Ths username contains invalid characters."); return false; } } for (i=0; i127) { alert("Ths domain name contains invalid characters."); return false; } } // See if "user" is valid if (user.match(userPat)==null) { // user is not valid alert("The username doesn't seem to be valid."); return false; } /* if the e-mail address is at an IP address (as opposed to a symbolic host name) make sure the IP address is valid. */ var IPArray=domain.match(ipDomainPat); if (IPArray!=null) { // this is an IP address for (var i=1;i<=4;i++) { if (IPArray[i]>255) { alert("Destination IP address is invalid!"); return false; } } return true; } // Domain is symbolic name. Check if it's valid. var atomPat=new RegExp("^" + atom + "$"); var domArr=domain.split("."); var len=domArr.length; for (i=0;i= 1) { // spit up the error and return false alert(error_msg); return false; } else { // no erros, submit and return true document.subscribe.submit(); return true; } } function clearCommissionErrors() { document.images.partner_id.src="template_images/spacer.gif"; document.images.loan_id.src="template_images/spacer.gif"; document.images.amount.src="template_images/spacer.gif"; //document.images.date.src="template_images/spacer.gif"; return true; } function ckCommissionForm() { var is_error = 0; var error_msg = "The following fields have errors that need to be corrected before continuing:\n\n"; clearCommissionErrors(); // clear out all previous errors and re-evaluate // test the partner_id if (document.commissionForm.partner_id.value == "" || document.commissionForm.partner_id.value == null) { document.images.partner_id.src="template_images/field_warning.gif"; error_msg = error_msg + "- Partner ID.\n"; is_error = 1; } // test the loan_id if (document.commissionForm.loan_id.value == "" || document.commissionForm.loan_id.value == null) { document.images.loan_id.src="template_images/field_warning.gif"; error_msg = error_msg + "- Loan ID.\n"; is_error = 1; } // test the amount if (document.commissionForm.amount.value == "" || document.commissionForm.amount.value == null) { document.images.amount.src="template_images/field_warning.gif"; error_msg = error_msg + "- Amount.\n"; is_error = 1; } // test the date //if (document.commissionForm.date.value == "" || document.commissionForm.date.value == null) { // document.images.date.src="template_images/field_warning.gif"; // error_msg = error_msg + "- Date.\n"; // is_error = 1; //} // evaluate test results and act accordingly if (is_error >= 1) { // spit up the error and return false alert(error_msg); return false; } else { // no erros, submit and return true document.commissionForm.submit(); return true; } } function clearContactErrors() { document.images.email.src="template_images/spacer.gif"; return true; } function ckContactForm() { var is_error = 0; var error_msg = "The following fields have errors that need to be corrected before continuing:\n\n"; clearContactErrors(); // clear out all previous errors and re-evaluate // test the email if (document.contact.email.value == "" || document.contact.email.value == null) { document.images.email.src="template_images/field_warning.gif"; error_msg = error_msg + "- Email.\n"; is_error = 1; } // evaluate test results and act accordingly if (is_error >= 1) { // spit up the error and return false alert(error_msg); return false; } else { // no erros, submit and return true //document.write(document.forms["contact"].sfga.value); document.contact.submit(); return true; } } function clearPartnerEnrollErrors() { document.images.first_name.src="template_images/spacer.gif"; document.images.last_name.src="template_images/spacer.gif"; document.images.company.src="template_images/spacer.gif"; document.images.address.src="template_images/spacer.gif"; document.images.city.src="template_images/spacer.gif"; document.images.state.src="template_images/spacer.gif"; document.images.zip.src="template_images/spacer.gif"; document.images.phone.src="template_images/spacer.gif"; document.images.fax.src="template_images/spacer.gif"; document.images.email.src="template_images/spacer.gif"; document.images.workingWithRep.src="template_images/spacer.gif"; document.images.referred_by.src="template_images/spacer.gif"; return true; } function ckPartnerEnrollForm() { var is_error = 0; var error_msg = "The following fields have errors that need to be corrected before continuing:\n\n"; var applicant_typeObj; clearPartnerEnrollErrors(); // clear out all previous errors and re-evaluate // test the first_name if (document.partnerEnroll.first_name.value == "" || document.partnerEnroll.first_name.value == null) { document.images.first_name.src="template_images/field_warning.gif"; error_msg = error_msg + "- First Name.\n"; is_error = 1; } // test the last_name if (document.partnerEnroll.last_name.value == "" || document.partnerEnroll.last_name.value == null) { document.images.last_name.src="template_images/field_warning.gif"; error_msg = error_msg + "- Last Name.\n"; is_error = 1; } // test the company if (document.partnerEnroll.company.value == "" || document.partnerEnroll.company.value == null) { document.images.company.src="template_images/field_warning.gif"; error_msg = error_msg + "- Company.\n"; is_error = 1; } // test the address if (document.partnerEnroll.address.value == "" || document.partnerEnroll.address.value == null) { document.images.address.src="template_images/field_warning.gif"; error_msg = error_msg + "- Address.\n"; is_error = 1; } // test the city if (document.partnerEnroll.city.value == "" || document.partnerEnroll.city.value == null) { document.images.city.src="template_images/field_warning.gif"; error_msg = error_msg + "- City.\n"; is_error = 1; } // test the state if (document.partnerEnroll.state.value == "" || document.partnerEnroll.state.value == null) { document.images.state.src="template_images/field_warning.gif"; error_msg = error_msg + "- State.\n"; is_error = 1; } // test the zip if (document.partnerEnroll.zip.value == "" || document.partnerEnroll.zip.value == null) { document.images.zip.src="template_images/field_warning.gif"; error_msg = error_msg + "- Zip.\n"; is_error = 1; } // test the phone if (document.partnerEnroll.phone.value == "" || document.partnerEnroll.phone.value == null) { document.images.phone.src="template_images/field_warning.gif"; error_msg = error_msg + "- Phone.\n"; is_error = 1; } // test the fax if (document.partnerEnroll.fax.value == "" || document.partnerEnroll.fax.value == null) { document.images.fax.src="template_images/field_warning.gif"; error_msg = error_msg + "- Fax.\n"; is_error = 1; } // test the email if (document.partnerEnroll.email.value == "" || document.partnerEnroll.email.value == null) { document.images.email.src="template_images/field_warning.gif"; error_msg = error_msg + "- Email.\n"; is_error = 1; } //workingWithRep // test the referred_by if (document.partnerEnroll.referred_by.value.length < 3 || document.partnerEnroll.referred_by.value == '--Select One--') { document.images.referred_by.src="template_images/field_warning.gif"; error_msg = error_msg + "- How did you hear about us?.\n"; is_error = 1; } // evaluate test results and act accordingly if (is_error >= 1) { // spit up the error and return false alert(error_msg); return false; } else { // no erros, submit and return true document.partnerEnroll.submit(); return true; } } function clearContractorErrors() { document.images.firstname.src="template_images/spacer.gif"; document.images.lastname.src="template_images/spacer.gif"; document.images.address1.src="template_images/spacer.gif"; document.images.city.src="template_images/spacer.gif"; document.images.state.src="template_images/spacer.gif"; document.images.zip.src="template_images/spacer.gif"; document.images.phone1.src="template_images/spacer.gif"; document.images.email.src="template_images/spacer.gif"; document.images.business_name.src="template_images/spacer.gif"; return true; } function validateContractor() { var stateObj; var is_error = 0; var error_msg = "The following fields have errors that need to be corrected before continuing:\n\n"; clearContractorErrors(); // clear out all previous errors and re-evaluate // test the firstname if (document.contractorForm.firstname.value == "" || document.contractorForm.firstname.value == null) { document.images.firstname.src="template_images/field_warning.gif"; error_msg = error_msg + "- First Name\n"; is_error = 1; } // test the lastname if (document.contractorForm.lastname.value == "" || document.contractorForm.lastname.value == null) { document.images.lastname.src="template_images/field_warning.gif"; error_msg = error_msg + "- Last Name\n"; is_error = 1; } /* // test the address1 if (document.contractorForm.address1.value == "" || document.contractorForm.address1.value == null) { document.images.address1.src="template_images/field_warning.gif"; error_msg = error_msg + "- Address 1\n"; is_error = 1; } // test city if (document.contractorForm.city.value == "" || document.contractorForm.city.value == null) { document.images.city.src="template_images/field_warning.gif"; error_msg = error_msg + "- City\n"; is_error = 1; } // get the state select object and evaluate stateObj = eval("document.contractorForm.state"); if (stateObj.value == "" || stateObj.value == null || stateObj.value == '--Select One--') { document.images.state.src="template_images/field_warning.gif"; error_msg = error_msg + "- State\n"; is_error = 1; } // test zip if (document.contractorForm.zip.value == "" || document.contractorForm.zip.value == null) { document.images.zip.src="template_images/field_warning.gif"; error_msg = error_msg + "- Zip\n"; is_error = 1; } */ // test phone1 if (document.contractorForm.phone1.value == "" || document.contractorForm.phone1.value == null) { document.images.phone1.src="template_images/field_warning.gif"; error_msg = error_msg + "- Phone 1\n"; is_error = 1; } // test business_name if (document.contractorForm.business_name.value == "" || document.contractorForm.business_name.value == null) { document.images.business_name.src="template_images/field_warning.gif"; error_msg = error_msg + "- Business Name\n"; is_error = 1; } /* // test email if (document.contractorForm.email.value == "" || document.contractorForm.email.value == null) { document.images.email.src="template_images/field_warning.gif"; error_msg = error_msg + "- Email\n"; is_error = 1; } */ // evaluate test results and act accordingly if (is_error >= 1) { // spit up the error and return false alert(error_msg); return false; } else { // no erros, submit and return true document.contractorForm.submit(); return true; } } function clearInspectorErrors() { document.images.firstname.src="template_images/spacer.gif"; document.images.lastname.src="template_images/spacer.gif"; document.images.address1.src="template_images/spacer.gif"; document.images.city.src="template_images/spacer.gif"; document.images.state.src="template_images/spacer.gif"; document.images.zip.src="template_images/spacer.gif"; document.images.phone1.src="template_images/spacer.gif"; document.images.email.src="template_images/spacer.gif"; document.images.password.src="template_images/spacer.gif"; document.images.password2.src="template_images/spacer.gif"; document.images.business_name.src="template_images/spacer.gif"; return true; } function validateInspector(confirmPass) { var stateObj; var is_error = 0; var error_msg = "The following fields have errors that need to be corrected before continuing:\n\n"; clearInspectorErrors(); // clear out all previous errors and re-evaluate // test the firstname if (document.inspectorForm.firstname.value == "" || document.inspectorForm.firstname.value == null) { document.images.firstname.src="template_images/field_warning.gif"; error_msg = error_msg + "- First Name\n"; is_error = 1; } // test the lastname if (document.inspectorForm.lastname.value == "" || document.inspectorForm.lastname.value == null) { document.images.lastname.src="template_images/field_warning.gif"; error_msg = error_msg + "- Last Name\n"; is_error = 1; } // test the address1 if (document.inspectorForm.address1.value == "" || document.inspectorForm.address1.value == null) { document.images.address1.src="template_images/field_warning.gif"; error_msg = error_msg + "- Address 1\n"; is_error = 1; } // test city if (document.inspectorForm.city.value == "" || document.inspectorForm.city.value == null) { document.images.city.src="template_images/field_warning.gif"; error_msg = error_msg + "- City\n"; is_error = 1; } // get the state select object and evaluate stateObj = eval("document.inspectorForm.state"); if (stateObj.value == "" || stateObj.value == null || stateObj.value == '--Select One--') { document.images.state.src="template_images/field_warning.gif"; error_msg = error_msg + "- State\n"; is_error = 1; } // test zip if (document.inspectorForm.zip.value == "" || document.inspectorForm.zip.value == null) { document.images.zip.src="template_images/field_warning.gif"; error_msg = error_msg + "- Zip\n"; is_error = 1; } // test phone1 if (document.inspectorForm.phone1.value == "" || document.inspectorForm.phone1.value == null) { document.images.phone1.src="template_images/field_warning.gif"; error_msg = error_msg + "- Phone 1\n"; is_error = 1; } // test business_name if (document.inspectorForm.business_name.value == "" || document.inspectorForm.business_name.value == null) { document.images.business_name.src="template_images/field_warning.gif"; error_msg = error_msg + "- Business Name\n"; is_error = 1; } // test email if (document.inspectorForm.email.value == "" || document.inspectorForm.email.value == null) { document.images.email.src="template_images/field_warning.gif"; error_msg = error_msg + "- Email\n"; is_error = 1; } // test password if (confirmPass >= 1 && document.inspectorForm.password.value.length < 8) { document.images.password.src="template_images/field_warning.gif"; error_msg = error_msg + "- Password must be at least 8 characters long\n"; is_error = 1; } if (document.inspectorForm.password.value.length >= 1 && document.inspectorForm.password.value != document.inspectorForm.password2.value) { document.images.password.src="template_images/field_warning.gif"; document.images.password2.src="template_images/field_warning.gif"; error_msg = error_msg + "- Password mismatch\n"; is_error = 1; } // evaluate test results and act accordingly if (is_error >= 1) { // spit up the error and return false alert(error_msg); return false; } else { // no erros, submit and return true document.inspectorForm.submit(); return true; } } function clearAppraiserErrors() { document.images.firstname.src="template_images/spacer.gif"; document.images.lastname.src="template_images/spacer.gif"; document.images.address1.src="template_images/spacer.gif"; document.images.city.src="template_images/spacer.gif"; document.images.state.src="template_images/spacer.gif"; document.images.zip.src="template_images/spacer.gif"; document.images.phone1.src="template_images/spacer.gif"; document.images.email.src="template_images/spacer.gif"; document.images.business_name.src="template_images/spacer.gif"; return true; } function validateAppraiser() { var stateObj; var is_error = 0; var error_msg = "The following fields have errors that need to be corrected before continuing:\n\n"; clearAppraiserErrors(); // clear out all previous errors and re-evaluate // test the firstname if (document.appraiserForm.firstname.value == "" || document.appraiserForm.firstname.value == null) { document.images.firstname.src="template_images/field_warning.gif"; error_msg = error_msg + "- First Name\n"; is_error = 1; } // test the lastname if (document.appraiserForm.lastname.value == "" || document.appraiserForm.lastname.value == null) { document.images.lastname.src="template_images/field_warning.gif"; error_msg = error_msg + "- Last Name\n"; is_error = 1; } // test the address1 if (document.appraiserForm.address1.value == "" || document.appraiserForm.address1.value == null) { document.images.address1.src="template_images/field_warning.gif"; error_msg = error_msg + "- Address 1\n"; is_error = 1; } // test city if (document.appraiserForm.city.value == "" || document.appraiserForm.city.value == null) { document.images.city.src="template_images/field_warning.gif"; error_msg = error_msg + "- City\n"; is_error = 1; } // get the state select object and evaluate stateObj = eval("document.appraiserForm.state"); if (stateObj.value == "" || stateObj.value == null || stateObj.value == '--Select One--') { document.images.state.src="template_images/field_warning.gif"; error_msg = error_msg + "- State\n"; is_error = 1; } // test zip if (document.appraiserForm.zip.value == "" || document.appraiserForm.zip.value == null) { document.images.zip.src="template_images/field_warning.gif"; error_msg = error_msg + "- Zip\n"; is_error = 1; } // test phone1 if (document.appraiserForm.phone1.value == "" || document.appraiserForm.phone1.value == null) { document.images.phone1.src="template_images/field_warning.gif"; error_msg = error_msg + "- Phone 1\n"; is_error = 1; } // test business_name if (document.appraiserForm.business_name.value == "" || document.appraiserForm.business_name.value == null) { document.images.business_name.src="template_images/field_warning.gif"; error_msg = error_msg + "- Business Name\n"; is_error = 1; } // test email if (document.appraiserForm.email.value == "" || document.appraiserForm.email.value == null) { document.images.email.src="template_images/field_warning.gif"; error_msg = error_msg + "- Email\n"; is_error = 1; } // evaluate test results and act accordingly if (is_error >= 1) { // spit up the error and return false alert(error_msg); return false; } else { // no erros, submit and return true document.appraiserForm.submit(); return true; } } function clearEmailDrawReqErrors() { document.images.inspector_id.src="template_images/spacer.gif"; document.images.additional_emails.src="template_images/spacer.gif"; document.images.cc.src="template_images/spacer.gif"; document.images.from.src="template_images/spacer.gif"; document.images.replyto.src="template_images/spacer.gif"; document.images.subject.src="template_images/spacer.gif"; return true; } function ckEmailDrawReqForm() { var includeInspector = eval("document.emailDrawRequest.include_inspector"); var includeAdditionalTo = eval("document.emailDrawRequest.include_additional_to"); var includeCC = eval("document.emailDrawRequest.include_cc"); var inspectorObj = eval("document.emailDrawRequest.inspector_id"); var is_error = 0; var error_msg = "The following fields have errors that need to be corrected before continuing:\n\n"; clearEmailDrawReqErrors(); // clear out all previous errors and re-evaluate // evaluate inspector menu if (includeInspector.checked == true) { if (inspectorObj.value == "" || inspectorObj.value == null || inspectorObj.value == '--Select One--') { document.images.inspector_id.src="template_images/field_warning.gif"; error_msg = error_msg + "- Inspector\n"; is_error = 1; } } else { } // evaluate additional_to addresses if (includeAdditionalTo.checked == true) { if (document.emailDrawRequest.additional_emails.value.length < 1) { document.images.additional_emails.src="template_images/field_warning.gif"; error_msg = error_msg + "- Also send to\n"; is_error = 1; } } // evaluate cc addresses if (includeCC.checked == true) { if (document.emailDrawRequest.cc.value.length < 1) { document.images.cc.src="template_images/field_warning.gif"; error_msg = error_msg + "- CC\n"; is_error = 1; } } // evaluate the From field if (document.emailDrawRequest.from.value.length < 1) { document.images.from.src="template_images/field_warning.gif"; error_msg = error_msg + "- From\n"; is_error = 1; } // evaluate the Reply-To field if (document.emailDrawRequest.replyto.value.length < 1) { document.images.replyto.src="template_images/field_warning.gif"; error_msg = error_msg + "- Reply-To\n"; is_error = 1; } // evaluate the Subject field if (document.emailDrawRequest.subject.value.length < 1) { document.images.subject.src="template_images/field_warning.gif"; error_msg = error_msg + "- Subject\n"; is_error = 1; } // inspector_id if (document.emailDrawRequest.subject.value.length < 1) { document.images.subject.src="template_images/field_warning.gif"; error_msg = error_msg + "- Subject\n"; is_error = 1; } // evaluate test results and act accordingly if (is_error >= 1) { // spit up the error and return false alert(error_msg); return false; } else { // no erros, submit and return true document.emailDrawRequest.submit(); return true; } } function clearEmailInspectionReportErrors() { document.images.inspector_id.src="template_images/spacer.gif"; document.images.additional_emails.src="template_images/spacer.gif"; document.images.cc.src="template_images/spacer.gif"; document.images.from.src="template_images/spacer.gif"; document.images.replyto.src="template_images/spacer.gif"; document.images.subject.src="template_images/spacer.gif"; return true; } function ckEmailInspectionReportForm() { var includeInspector = eval("document.emailInspectionReportForm.include_inspector"); var includeAdditionalTo = eval("document.emailInspectionReportForm.include_additional_to"); var includeCC = eval("document.emailInspectionReportForm.include_cc"); var inspectorObj = eval("document.emailInspectionReportForm.inspector_id"); var is_error = 0; var error_msg = "The following fields have errors that need to be corrected before continuing:\n\n"; clearEmailInspectionReportErrors(); // clear out all previous errors and re-evaluate // evaluate inspector menu if (includeInspector.checked == true) { if (inspectorObj.value == "" || inspectorObj.value == null || inspectorObj.value == '--Select One--') { document.images.inspector_id.src="template_images/field_warning.gif"; error_msg = error_msg + "- Inspector\n"; is_error = 1; } } // evaluate additional_to addresses if (includeAdditionalTo.checked == true) { if (document.emailInspectionReportForm.additional_emails.value.length < 1) { document.images.additional_emails.src="template_images/field_warning.gif"; error_msg = error_msg + "- Also send to\n"; is_error = 1; } } // evaluate cc addresses if (includeCC.checked == true) { if (document.emailInspectionReportForm.cc.value.length < 1) { document.images.cc.src="template_images/field_warning.gif"; error_msg = error_msg + "- CC\n"; is_error = 1; } } // evaluate the From field if (document.emailInspectionReportForm.from.value.length < 1) { document.images.from.src="template_images/field_warning.gif"; error_msg = error_msg + "- From\n"; is_error = 1; } // evaluate the Reply-To field if (document.emailInspectionReportForm.replyto.value.length < 1) { document.images.replyto.src="template_images/field_warning.gif"; error_msg = error_msg + "- Reply-To\n"; is_error = 1; } // evaluate the Subject field if (document.emailInspectionReportForm.subject.value.length < 1) { document.images.subject.src="template_images/field_warning.gif"; error_msg = error_msg + "- Subject\n"; is_error = 1; } // inspector_id if (document.emailInspectionReportForm.subject.value.length < 1) { document.images.subject.src="template_images/field_warning.gif"; error_msg = error_msg + "- Subject\n"; is_error = 1; } // evaluate test results and act accordingly if (is_error >= 1) { // spit up the error and return false alert(error_msg); return false; } else { // no erros, submit and return true document.emailInspectionReportForm.submit(); return true; } }