// reg form
if (location.hostname.indexOf("vetezorder") == -1) {
jQuery(document).ready(function() {
// added jbackus 20230418a
if (jQuery(".nextLogin").length) {
location = "https://www.mynutramax.com/login/";
ga('create', 'UA-741540-11', 'auto', {'name': 'dashboard'}); // Dashboard
ga('dashboard.send', 'event', "User Events", "Vet-EZ-Order store login redirect", jQuery('[name="EMAIL"]').val());
} else if (jQuery(".nextRegister").length) {
location = "https://www.mynutramax.com/register/";
ga('create', 'UA-741540-11', 'auto', {'name': 'dashboard'}); // Dashboard
ga('dashboard.send', 'event', "User Events", "Vet-EZ-Order store reg redirect", jQuery('[name="EMAIL"]').val());
} else if (!jQuery(".nextLoggedIn").length) {
ga('create', 'UA-741540-11', 'auto', {'name': 'dashboard'}); // Dashboard
ga('dashboard.send', 'event', "User Events", "Vet-EZ-Order public pageview", location.href);
} else {
ga('create', 'UA-741540-11', 'auto', {'name': 'dashboard'}); // Dashboard
ga('dashboard.send', 'event', "User Events", "Vet-EZ-Order store pageview", location.href);
}
// commented jbackus 20230418a
// if (jQuery(".nextLoggedIn.nextPending").length || jQuery("#ctl00_cphFooter_mcfFooter_maiAccountInfo_lbFullLogOut, #lbFullLogOut").length){
// LogoutPending();
// } else {
// initNewLoginRegForm();
// }
});
}
ga('create', 'UA-741540-11', 'auto', {
'name': 'dashboard'
}); // Dashboard
function initNewLoginRegForm() {
if (jQuery(".account.nextLoggedIn.nextRegister").length) {
return;
}
//console.log("initNewLoginRegForm");
if (jQuery(".loginFormContainer-form .ui-btn-hidden").length) {
location.reload();
}
if (jQuery(".nextLoggedIn.nextPending, .xnextNotLoggedIn.nextPending").length) {
ShowConfirmation();
}
jQuery("#ctl00_ctl00_cphMain_cphMain_lafAddress_txtCompanyName").closest("tr").addClass("hidden").insertAfter("tr#ctl00_ctl00_cphMain_cphMain_lafAddress_trZip");
jQuery("#ctl00_ctl00_cphMain_cphMain_lafAddress_lblCompanyName").text("Practice Name");
jQuery("#ctl00_ctl00_cphMain_cphMain_ccfRegister_lvCustomFields_ctrl1_ctl00_cfCustomField").closest("tr").insertAfter("tr#ctl00_ctl00_cphMain_cphMain_lafAddress_trZip");
jQuery("#ctl00_ctl00_cphMain_cphMain_uafAddress_phnAddress_trPhone").closest("tr").insertAfter("tr#ctl00_ctl00_cphMain_cphMain_lafAddress_trZip");
jQuery("#ctl00_ctl00_cphMain_cphMain_lafAddress_cbPreferredShipTo, #ctl00_ctl00_cphMain_cphMain_lafAddress_cbPreferredBillTo").prop("checked", true);
jQuery("#ctl00_ctl00_cphMain_cphMain_pwrPassword_psdMain_rtbPassword_txtRestricted, #ctl00_ctl00_cphMain_cphMain_pwrPassword_psdRetype_rtbPassword_txtRestricted").val(TmpPassword());
jQuery("#ctl00_cphMain_pwrPassword_psdMain_txtPassword, #ctl00_cphMain_pwrPassword_psdRetype_txtPassword").val(TmpPassword());
jQuery("#ctl00_ctl00_cphMain_cphMain_ccfRegister_lvCustomFields_ctrl1_ctl00_cfCustomField_ddlTextPick, #ctl00_cphMain_ccfRegister_rptCustomFields_ctl02_cfCustomField_ddlTextPick").on("change", function() {
if (jQuery("#ctl00_ctl00_cphMain_cphMain_ccfRegister_lvCustomFields_ctrl1_ctl00_cfCustomField_ddlTextPick").val() == "Practice" || jQuery("#ctl00_cphMain_ccfRegister_rptCustomFields_ctl02_cfCustomField_ddlTextPick").val() == "Practice") {
jQuery("#ctl00_ctl00_cphMain_cphMain_lafAddress_txtCompanyName").closest("tr").removeClass("hidden");
jQuery(".nextRegister.ui-mobile-viewport .nextCompanyNameLabel, .nextRegister.ui-mobile-viewport .nextCompanyNameLabel+div").removeClass("hidden");
jQuery("#ctl00_ctl00_cphMain_cphMain_lafAddress_txtCompanyName").focus();
} else {
jQuery("#ctl00_ctl00_cphMain_cphMain_lafAddress_txtCompanyName").closest("tr").addClass("hidden");
jQuery(".nextRegister.ui-mobile-viewport .nextCompanyNameLabel, .nextRegister.ui-mobile-viewport .nextCompanyNameLabel+div").addClass("hidden");
jQuery("#ctl00_ctl00_cphMain_cphMain_lafAddress_txtCompanyName").val("");
}
});
window.setTimeout(function() {
jQuery("#ctl00_ctl00_cphMain_cphMain_ewrRegister_emlMain_txtEmail, #ctl00_cphMain_ewrRegister_emlMain_mrtEmail__input").on("blur", function() {
jQuery("#ctl00_ctl00_cphMain_cphMain_ewrRegister_emlRetype_txtEmail").val(jQuery("#ctl00_ctl00_cphMain_cphMain_ewrRegister_emlMain_txtEmail").val());
jQuery("#ctl00_cphMain_ewrRegister_emlRetype_mrtEmail__input").val(jQuery("#ctl00_cphMain_ewrRegister_emlMain_mrtEmail__input").val());
});
if (jQuery(".loginFormContainer-form .ui-btn-hidden").length) {
location.reload();
}
if (jQuery(".nextLoggedIn.nextPending, .xnextNotLoggedIn.nextPending").length || getCookie("requested-vet-acct") != "") {
ShowConfirmation();
window.setTimeout(function() {
setCookie("requested-vet-acct", "", -1);
}, 5000);
}
}, 1000);
jQuery("#ctl00_ctl00_cphMain_cphMain_ccfRegister_lvCustomFields_ctrl1_ctl00_cfCustomField_ddlTextPick option:first, #ctl00_ctl00_cphMain_cphMain_lafAddress_ddlState option:first").text("");
jQuery("#ctl00_cphMain_lafAddress_ddlState option:first, #ctl00_cphMain_ccfRegister_rptCustomFields_ctl02_cfCustomField_ddlTextPick option:first").text("");
jQuery('.ui-select .ui-btn-text').text("");
jQuery('.nextRegister:not(.ui-mobile-viewport) [value="Personal"]').text("Address above is personal.");
jQuery('.nextRegister:not(.ui-mobile-viewport) [value="Practice"]').text("Address above is a practice.");
jQuery(".nextRegister label, .nextCustomerCustomFieldLabelCell").each(function() {
jQuery(this).html(jQuery(this).text().replace(":", "").replace("(optional)", "").trim() + '* ');
});
jQuery(".nextRegister:not(.ui-mobile-viewport) #aspnetForm").append('
If you wish to receive promotions, special offers, and new product information from Nutramax Laboratories Veterinary Sciences, Inc. Please
click here .
');
jQuery(".nextRegister #ctl00_ctl00_cphMain_cphMain_btnSubmit").val("Submit Registration");
jQuery(".nextRegister #ctl00_ctl00_cphMain_cphMain_lafAddress_ddlState option, #ctl00_cphMain_lafAddress_ddlState option").not("[value*='United States']").remove();
jQuery(".nextRegister #ctl00_ctl00_cphMain_cphMain_lafAddress_ddlState option:contains('Armed'), #ctl00_cphMain_lafAddress_ddlState option:contains('Armed')").remove();
jQuery(".nextRegister #ctl00_ctl00_cphMain_cphMain_lafAddress_ddlState, #ctl00_cphMain_lafAddress_ddlState").prepend(' ');
jQuery(".nextRegister #ctl00_cphMain_ccfRegister_rptCustomFields_ctl02_cfCustomField_ddlTextPick option").not("[value*='P']").remove();
jQuery(".nextRegister #ctl00_cphMain_ccfRegister_rptCustomFields_ctl02_cfCustomField_ddlTextPick").prepend(' ');
jQuery(".nextRegister").append('
');
jQuery(".nextRegister.ui-mobile-viewport .nextCompanyNameLabel, .nextRegister.ui-mobile-viewport .nextCompanyNameLabel+div").addClass("hidden").insertAfter(".nextZipTextBox");
jQuery(".nextRegister.ui-mobile-viewport #ctl00_cphMain_lafAddress_lblCompanyName").html("Practice Name* ");
jQuery(".nextRegister.ui-mobile-viewport").append('');
jQuery(".nextRegister.ui-mobile-viewport #ctl00_cphMain_ccfRegister_rptCustomFields_ctl02_lblCustomField").closest(".nextCustomerCustomFieldLabel").insertAfter(".nextZipTextBox");
jQuery(".nextRegister.ui-mobile-viewport #ctl00_cphMain_ccfRegister_rptCustomFields_ctl02_cfCustomField").closest(".nextCustomerCustomFieldValue").insertAfter(".nextZipTextBox");
jQuery(".nextRegister.ui-mobile-viewport #ctl00_cphMain_lafAddress_cbPreferredShipTo, .nextRegister.ui-mobile-viewport #ctl00_cphMain_lafAddress_cbPreferredBillTo").prop("checked", true);
jQuery(".nextRegister.ui-mobile-viewport #header").after('Welcome to the NEW Vet-EZ-Order store by Nutramax Laboratories Veterinary Sciences, Inc.
');
jQuery(".nextRegister.ui-mobile-viewport .vet-welcome").after('');
jQuery(".nextRegister.ui-mobile-viewport #ctl00_pnlContent").after('Tap here if you wish to receive promotions, special offers, and new product information from Nutramax Laboratories Veterinary Sciences, Inc.
');
jQuery(".nextRegister.ui-mobile-viewport #aspnetForm").after(' ');
jQuery(".nextRegister.ui-mobile-viewport #ctl00_cphMain_ccfRegister_rptCustomFields_ctl02_cfCustomField").closest("[class*='next']").insertAfter(jQuery(".nextRegister.ui-mobile-viewport #ctl00_cphMain_ccfRegister_rptCustomFields_ctl02_lblCustomField").closest("[class*='next']"));
jQuery(".nextRegister.ui-mobile-viewport #ctl00_cphMain_uafAddress_mpnAddress_lblPhone").html("Phone #* ");
jQuery(".nextRegister.ui-mobile-viewport .nextPhoneLabel, .nextRegister.ui-mobile-viewport .nextPhoneLabel+div").insertAfter(".nextZipTextBox");
jQuery(".nextRegister.ui-mobile-viewport .nextMobileInput div[class*='Label']").addClass("label");
jQuery(".nextRegister.ui-mobile-viewport #ctl00_cphMain_btnSubmit, #ctl00_ctl00_cphMain_cphMain_btnSubmit").attr("onclick", "SubmitMobile();");
if (location.search.indexOf("jbackus") > -1) {
//UseTestMode();
window.setTimeout(function() {
//SubmitMobile();
}, 1000);
}
AddLoginBox();
window.setTimeout(function() {
CatchRegFormSubmit();
}, 1000);
}
function OpenStoreOverview() {
jQuery("#storeOverviewPopup").addClass("open");
if (jQuery("#storeOverviewPopup .closer").length == 1) {
jQuery("#storeOverviewPopup .closer").clone().prependTo(jQuery("#storeOverviewPopup"));
}
jQuery("#storeOverviewPopup .closer").unbind().on("click", function() {
jQuery("#storeOverviewPopup").removeClass("open");
});
}
function UseTestMode() {
jQuery("#ctl00_ctl00_cphMain_cphMain_uafAddress_nfAddress_txtFirstName").val("Tester");
jQuery("#ctl00_ctl00_cphMain_cphMain_uafAddress_nfAddress_txtLastName").val("Testing");
jQuery("#ctl00_ctl00_cphMain_cphMain_ewrRegister_emlMain_txtEmail").val("testing.jbackus@nutramaxlabs.info");
jQuery("#ctl00_ctl00_cphMain_cphMain_ccfRegister_lvCustomFields_ctrl0_ctl00_cfCustomField_txtText").val("11223344");
jQuery("#ctl00_ctl00_cphMain_cphMain_ccfRegister_lvCustomFields_ctrl0_ctl01_cfCustomField_txtText").val("SC");
//jQuery("#ctl00_ctl00_cphMain_cphMain_ccfRegister_lvCustomFields_ctrl1_ctl00_cfCustomField_ddlTextPick").val();
jQuery("#ctl00_ctl00_cphMain_cphMain_lafAddress_txtAddress1").val("123 Some Street");
jQuery("#ctl00_ctl00_cphMain_cphMain_lafAddress_txtCity").val("Sometown");
jQuery("#ctl00_ctl00_cphMain_cphMain_lafAddress_txtZip").val("21345");
jQuery("#ctl00_ctl00_cphMain_cphMain_uafAddress_phnAddress_txtPhone").val("123-123-1234");
jQuery("#ctl00_cphMain_uafAddress_mnfAddress_txtFirstName").val("Tester");
jQuery("#ctl00_cphMain_uafAddress_mnfAddress_txtLastName").val("Testing");
jQuery("#ctl00_cphMain_ewrRegister_emlMain_mrtEmail__input").val("testing.jbackus@nutramaxlabs.info");
jQuery("#ctl00_cphMain_ccfRegister_rptCustomFields_ctl00_cfCustomField_txtText").val("11223344");
jQuery("#ctl00_cphMain_ccfRegister_rptCustomFields_ctl01_cfCustomField_txtText").val("SC");
jQuery("#ctl00_cphMain_lafAddress_txtAddress1").val("123 Some Street");
jQuery("#ctl00_cphMain_lafAddress_txtCity").val("Sometown");
jQuery("#ctl00_cphMain_lafAddress_txtZip").val("21345");
jQuery("#ctl00_cphMain_uafAddress_mpnAddress_txtPhone").val("123-123-1234");
}
function SubmitMobile() {
jQuery("#aspnetForm").submit();
}
function LogoutPending() {
eval(jQuery(".ui-mobile-viewport #ctl00_cphFooter_mcfFooter_maiAccountInfo_lbFullLogOut, #lbFullLogOut").attr("href"));
}
function ShowConfirmation() {
jQuery(".loginFormContainer, #aspnetForm").hide();
if (jQuery(".nextLoggedIn.nextPending").length || jQuery(".ui-mobile-viewport #ctl00_cphFooter_mcfFooter_maiAccountInfo_lbFullLogOut, #lbFullLogOut").length) {
LogoutPending();
return;
}
jQuery("#vetWelcome,.vet-welcome").addClass("thankyou");
//
jQuery("#vetWelcome h1,.vet-welcome").html('Just One More Step:You will be assigned a login and a password, which will be emailed to you, along with instructions within 1-2 business days.
');
jQuery(".notify-container").remove();
window.setTimeout(function() {
window.scrollTo(0, 0);
}, 100);
window.setTimeout(function() {
setCookie("requested-vet-acct", "", -1);
}, 5000);
}
function NotifyCustomerService() {
jQuery(".nextRegister:not(.ui-mobile-viewport) .notify-container").load("https://www.nutramax.biz/mods/notify/?send=new-pending-vet-customer&fname=" + jQuery("#ctl00_ctl00_cphMain_cphMain_uafAddress_nfAddress_txtFirstName").val() + "&lname=" + jQuery("#ctl00_ctl00_cphMain_cphMain_uafAddress_nfAddress_txtLastName").val() + "&email=" + jQuery("#ctl00_ctl00_cphMain_cphMain_ewrRegister_emlMain_txtEmail").val() + "&lnum=" + jQuery("#ctl00_ctl00_cphMain_cphMain_ccfRegister_lvCustomFields_ctrl0_ctl00_cfCustomField_txtText").val().replace(/\s/g, "+").replace("#", "") + "&lstate=" + jQuery("#ctl00_ctl00_cphMain_cphMain_ccfRegister_lvCustomFields_ctrl0_ctl01_cfCustomField_txtText").val() + "&type=" + jQuery("#ctl00_ctl00_cphMain_cphMain_ccfRegister_lvCustomFields_ctrl1_ctl00_cfCustomField_ddlTextPick").val() + "", function() {
ShowConfirmation();
});
jQuery(".nextRegister.ui-mobile-viewport .notify-container").load("https://www.nutramax.biz/mods/notify/?send=new-pending-vet-customer&fname=" + jQuery("#ctl00_cphMain_uafAddress_mnfAddress_txtFirstName").val() + "&lname=" + jQuery("#ctl00_cphMain_uafAddress_mnfAddress_txtLastName").val() + "&email=" + jQuery("#ctl00_cphMain_ewrRegister_emlMain_mrtEmail__input").val() + "&lnum=" + jQuery("#ctl00_cphMain_ccfRegister_rptCustomFields_ctl00_cfCustomField_txtText").val().replace(/\s/g, "+").replace("#", "") + "&lstate=" + jQuery("#ctl00_cphMain_ccfRegister_rptCustomFields_ctl01_cfCustomField_txtText").val() + "&type=" + jQuery("#ctl00_cphMain_ccfRegister_rptCustomFields_ctl02_cfCustomField_ddlTextPick").val() + "", function() {
ShowConfirmation();
RegisterHandler.postformRegisterUser();
});
}
function CatchRegFormSubmit() {
jQuery('.nextRegister #aspnetForm').ajaxForm({
beforeSubmit: function() {
if (jQuery(".nextRegister.ui-mobile-viewport").length) {
return ValidateMobileRegFormSubmit();
} else {
return ValidateRegFormSubmit();
}
},
success: function() {
NotifyCustomerService();
}
});
}
function ValidateMobileRegFormSubmit() {
jQuery(".missing, .invalid").removeClass("missing").removeClass("invalid");
jQuery('.nextRegister #aspnetForm:not(.validated-once) input, .nextRegister #aspnetForm:not(.validated-once) select').change(function() {
window.setTimeout(function() {
ValidateMobileRegFormSubmit();
}, 100);
});
jQuery('.nextRegister #aspnetForm').addClass("validated-once");
jQuery(".nextMobileInput input:visible, .nextMobileInput select:visible").each(function() {
if (jQuery(this).val().trim() == "") {
jQuery(this).closest("[class*='next']").addClass("missing").prev().addClass("missing");
} else if (jQuery(this).attr("id") == "ctl00_cphMain_ewrRegister_emlMain_mrtEmail__input") {
if (!ValidateEmail(jQuery(this).val())) {
jQuery(this).closest("[class*='next']").addClass("invalid").prev().addClass("invalid");
}
} else if (jQuery(this).attr("id") == "ctl00_cphMain_uafAddress_mpnAddress_txtPhone") {
if (!ValidatePhone(jQuery(this).val())) {
jQuery(this).closest("[class*='next']").addClass("invalid").prev().addClass("invalid");
}
}
});
jQuery("#aspnetForm .nextMobileInput .invalid input:first, #aspnetForm .nextMobileInput .missing input:first").focus();
if (jQuery(".nextMobileInput .missing, .nextMobileInput .invalid").length) {
console.log("ValidateMobileRegFormSubmit: false;");
return false;
}
setCookie("requested-vet-acct", jQuery("#ctl00_cphMain_ewrRegister_emlMain_mrtEmail__input").val(), 365);
console.log("ValidateMobileRegFormSubmit: true;");
return true;
}
function ValidateRegFormSubmit() {
jQuery(".missing, .invalid").removeClass("missing").removeClass("invalid");
jQuery('.nextRegister #aspnetForm:not(.validated-once) input, .nextRegister #aspnetForm:not(.validated-once) select').change(function() {
window.setTimeout(function() {
ValidateRegFormSubmit();
}, 100);
});
jQuery('.nextRegister #aspnetForm').addClass("validated-once");
jQuery("#aspnetForm input:visible, #aspnetForm select:visible").each(function() {
if (jQuery(this).val().trim() == "") {
jQuery(this).closest("td").addClass("missing").prev().addClass("missing");
} else if (jQuery(this).attr("id") == "ctl00_ctl00_cphMain_cphMain_ewrRegister_emlMain_txtEmail") {
if (!ValidateEmail(jQuery(this).val())) {
jQuery(this).closest("td").addClass("invalid").prev().addClass("invalid");
}
} else if (jQuery(this).attr("id") == "ctl00_ctl00_cphMain_cphMain_uafAddress_phnAddress_txtPhone") {
if (!ValidatePhone(jQuery(this).val())) {
jQuery(this).closest("td").addClass("invalid").prev().addClass("invalid");
}
}
});
jQuery("#aspnetForm .invalid input:first, #aspnetForm .missing input:first").focus();
if (jQuery("#aspnetForm .invalid input, #aspnetForm .missing input").length) {
console.log("ValidateRegFormSubmit: false;");
return false;
}
console.log("ValidateRegFormSubmit: true;");
// if (jQuery(".ajax__validatorcallout_error_message_cell:visible").length){
// tmp_validation_msg = jQuery(".ajax__validatorcallout_error_message_cell:visible:last").text();
// jQuery(".ajax__validatorcallout_error_message_cell:visible").closest("table").remove();
// window.setTimeout(function(){ alert(tmp_validation_msg); },100);
// return false;
// }
setCookie("requested-vet-acct", jQuery("#ctl00_ctl00_cphMain_cphMain_ewrRegister_emlMain_txtEmail").val(), 365);
return true;
}
// login box
function AddLoginBox() {
jQuery(".nextRegister #aspnetForm, #-ctl00_cphMain_hdrContactInfo_pnlMobileHeader").before('');
jQuery('[name="EMAIL"]').val(getCookie("reg-pg-login-attempt"));
if (location.search.indexOf("loginfailed") > -1) {
jQuery(".store-login-form .loginFormContainer-title").after('Your E-Mail Address/Password combination was not recognized. Please note that Passwords are case sensitive.
');
jQuery("#ctl00_ctl00_cphMain_cphMain_ewrRegister_emlMain_vcePreventDuplicate_popupTable").remove();
ga('dashboard.send', 'event', "User Events", "Vet-EZ-Order store login failed", jQuery('[name="EMAIL"]').val());
}
if (jQuery('[name="EMAIL"]').val() != "") {
jQuery('[name="PASSWORD"]').focus();
}
window.setTimeout(function() {
jQuery('[name="EMAIL"], [name="PASSWORD"]').unbind().on('keypress', function(e) {
if (e.which == 13) {
ValidateCustomLogin();
}
});
}, 400);
}
function ValidateCustomLogin() {
setCookie("reg-pg-login-attempt", jQuery('[name="EMAIL"]').val(), 1);
window.setTimeout(function() {
jQuery(".store-login-form").submit();
}, 400);
}
function NmxResetPasswordLink() {
if (jQuery('[name="EMAIL"]').val() == "") {
setCookie("forgot-pass-email", "@", 1);
} else {
setCookie("forgot-pass-email", jQuery('[name="EMAIL"]').val(), 1);
}
window.setTimeout(function() {
document.location = "/bus/login.aspx#recover";
}, 400);
}
if (location.hash == "#recover") {
ga('dashboard.send', 'event', "User Events", "Vet-EZ-Order store forgot password", getCookie("reg-pg-login-attempt"));
window.setTimeout(function() {
jQuery('[name="ctl00$ctl00$cphMain$cphMain$lfBtoB$prPasswordReminder$btnGeneratePassword"]').on("click", function() {
ga('dashboard.send', 'event', "User Events", "Vet-EZ-Order store reset password", jQuery('[name="ctl00$ctl00$cphMain$cphMain$lfBtoB$prPasswordReminder$emlPasswordReminder$txtEmail"]').val());
});
}, 400);
}
function setCookie(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
var expires = "expires=" + d.toUTCString();
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}
function getCookie(cname) {
var name = cname + "=";
var decodedCookie = decodeURIComponent(document.cookie);
var ca = decodedCookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
// input and validation functions
function TmpPassword() {
var length = 8,
charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
retVal = "";
for (var i = 0, n = charset.length; i < length; ++i) {
retVal += charset.charAt(Math.floor(Math.random() * n));
}
return retVal;
}
function ValidateEmail(str) {
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,8})+$/.test(str)) {
return true;
}
return false;
}
function ValidatePhone(str) {
//console.log(str);
str = str.replace(/-/g, "").replace(/\(/g, "").replace(/\)/g, "").replace(/\s/g, "").replace(/\./g, "");
var phoneno = /^\d{10}$/;
if (str.match(phoneno)) {
return true;
} else {
return false;
}
}
function FormatPhone(str) {
var cleaned = ('' + str).replace(/\D/g, '')
var match = cleaned.match(/^(\d{3})(\d{3})(\d{4})$/)
if (match) {
return '(' + match[1] + ') ' + match[2] + '-' + match[3]
}
return str;
}