function tcart_fadeOut(el, duration, complete) { var opacity = 1; var durationAsInt = parseInt(duration); var speed = durationAsInt > 0 ? durationAsInt / 10 : 40; // default duration = 400 var timer = setInterval(function () { el.style.opacity = opacity; opacity -= 0.1; if (opacity <= 0.1) { clearInterval(timer); el.style.display = 'none'; if (typeof complete === 'function') { complete(); } } }, speed);}function tcart_fadeIn(el, duration, complete) { if ( (getComputedStyle(el).opacity === '1' || getComputedStyle(el).opacity === '') && getComputedStyle(el).display !== 'none' ) { return; } var opacity = 0; var durationAsInt = parseInt(duration); var speed = durationAsInt > 0 ? durationAsInt / 10 : 40; el.style.opacity = opacity; el.style.display = ''; var timer = setInterval(function () { el.style.opacity = opacity; opacity += 0.1; if (opacity >= 1.0) { clearInterval(timer); if (typeof complete === 'function') { complete(); } } }, speed);}/** * Method isEmptyObject for ie8+ * * @param {object} obj - object for checked * @returns {boolean} - return true/false **/function tcart__isEmptyObject(obj) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { return false; } } return true;}/** * Polyfill: Element.matches **/if (!Element.prototype.matches) { Element.prototype.matches = Element.prototype.matchesSelector || Element.prototype.msMatchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.webkitMatchesSelector || Element.prototype.oMatchesSelector;}/** * Polyfill: Element.closest **/if (!Element.prototype.closest) { Element.prototype.closest = function (s) { var el = this; while (el && el.nodeType === 1) { if (Element.prototype.matches.call(el, s)) { return el; } el = el.parentElement || el.parentNode; } return null; };}function tcart_changeEndpoint(error, callback) { if ( error &&