GenericScripts = {FaxFunnelErrorMessageResponse: function(data) { if (data.Errors[0].Field != null && data.Errors[0].Field.indexOf('customer.payment_method') == 0) { //billing problem //what type of billing error? try { $.each(data.Errors, function (index, result) { if (result.Field.indexOf('customer.payment_method.account_number') == 0) { $('.container-creditcard-number').addClass('has-error'); } else if (result.Field.indexOf('customer.payment_method.card_verification_code') == 0) { $('.container-creditcard-cvv').addClass('has-error'); } else if (result.Field.indexOf('customer.payment_method.card_expiration_month') == 0) { $('.container-creditcard-exp').addClass('has-error'); } }); } catch (e) { //TODO:log error } global.showErrorMessage(Messages.Get(MessagesType.BillingErrorMessage, language)); } else if (data.Errors[0].ErrorCode != null && data.Errors[0].ErrorCode.indexOf('DUPLICATED_EMAIL') == 0) { global.showErrorMessage(Messages.Get(MessagesType.DuplicateEmailBilling, language)); $(window).scrollTop($(".has-error").offset()); } else if (data.Errors[0].ErrorCode != null && (data.Errors[0].Field != null && data.Errors[0].Field.indexOf('customer.address.postal_code') == 0)) { global.showErrorMessage(Messages.Get(MessagesType.PostalCode, language)); $(window).scrollTop($(".has-error").offset()); } else if (data.Errors[0].ErrorCode != null && data.Errors[0].ErrorCode.indexOf('reCaptchaValidationError') == 0) { if (grecaptcha != undefined) { grecaptcha.reset(); } global.showErrorMessage(data.Errors[0].DeveloperMessage); $(window).scrollTop($(".has-error").offset()); } else if (data.Errors[0].ErrorCode != null && data.Errors[0].ErrorCode.indexOf('BotAttack') == 0) { global.disableButton(); global.redirect('/'); } else if (data.Errors[0].ErrorCode != null && data.Errors[0].ErrorCode.indexOf('DID_NOT_AVAILABLE') == 0) { eFaxEU.showSessionModal(); } else { global.showErrorMessage(Messages.Get(MessagesType.GeneralErrorMessage, language)); } }};var postalValidation = {Mask : function(country){switch(country){case 'AR' : { return 'a{1}9{4}a{4}'; }case 'FR' : { return '9{5}'; }case 'US' : { return '9{5}'; }case 'AU' : { return '9{4}'; }case 'IN' : { return '9{6}'; }case 'MY' : { return '9{4}'; }case 'MX' : { return '9{5}'; }case 'IE' : { return '*{0,2}'; }case 'CA' : { return 'a9a 9a9'; }case 'AT' : { return '9{4}'; }case 'JP' : { return '9{3}-9{4}'; }case 'DE' : { return '9{5}'; }case 'ES' : { return '9{5}'; }}return '';},RegEx : function(country){switch(country){case 'CA' : { return '[A-Za-z][0-9][A-Za-z] [0-9][A-Za-z][0-9]'; }case 'MY' : { return '[0-9]{4}'; }case 'MX' : { return '[0-9]{5}'; }case 'AR' : { return '[A-Za-z]{1}[0-9]{4}[A-Za-z]{4}'; }case 'AT' : { return '[0-9]{4}'; }case 'DE' : { return '[0-9]{5}'; }case 'IE' : { return '/[0-9A-Z]{0,2}/g'; }case 'ES' : { return '[0-9]{5}'; }case 'JP' : { return '^([0-9]){3}-([0-9]){4}$'; }case 'FR' : { return '[0-9]{5}'; }case 'IN' : { return '[0-9]{6}'; }case 'US' : { return '[0-9]{5}'; }case 'AU' : { return '[0-9]{4}'; }}return ''; }}