function ById(id) { return document.getElementById(id); }; function GetBrowserInfo() { let browserInfo = navigator.appName + ";" + navigator.platform + ";" + navigator.appVersion; return browserInfo; } function AjaxJSONSync(httpMethod, url, sendObject) { var xhr = new XMLHttpRequest(); xhr.open(httpMethod, url, false); xhr.setRequestHeader("Content-type", "application/json"); if (sendObject != undefined) { xhr.send(JSON.stringify(sendObject)); } else { xhr.send(); } if (xhr.status != 200) { return null; } if ((xhr.response != undefined) && (xhr.response != "")) return JSON.parse(xhr.response); return xhr.response; } function AjaxJSONAsync(httpMethod, url, sendObject, onready) { var xhr = new XMLHttpRequest(); xhr.onload = function (e) { if (xhr.readyState === 4) { if (xhr.status != 200) { onready(null); } else { if ((xhr.response != undefined) && (xhr.response != "")) { onready(JSON.parse(xhr.response)); } else { onready(xhr.response); } } } }; xhr.open(httpMethod, url, true); xhr.setRequestHeader("Content-type", "application/json"); if ((sendObject != undefined)&&(sendObject!=null)) { xhr.send(JSON.stringify(sendObject)); } else { xhr.send(); } } function navigateToUrl(url) { let element = document.getElementById("submitForm"); if (element) { element.action = url; element.submit(); } } function AjaxHTMLSync(httpMethod, url, sendObject) { var xhr = new XMLHttpRequest(); xhr.open(httpMethod, url, false); xhr.setRequestHeader("Content-type", "application/json"); if (sendObject != undefined) { xhr.send(JSON.stringify(sendObject)); } else { xhr.send(); } if (xhr.status != 200) { return null; } return xhr.response; } function AjaxHTMLAsync(httpMethod, url, sendObject, onready) { var xhr = new XMLHttpRequest(); xhr.onload = function (e) { if (xhr.readyState === 4) { if (xhr.status != 200) { if (onready!=null) onready(null); } else { if (onready == null) return; if ((xhr.response != undefined) && (xhr.response != "")) { onready(xhr.response); } else { onready(null); } } } }; xhr.open(httpMethod, url, true); xhr.setRequestHeader("Content-type", "application/json"); if ((sendObject != undefined) && (sendObject != null)) { xhr.send(JSON.stringify(sendObject)); } else { xhr.send(); } } function formatPrice(priceInCent) { return " " + (priceInCent / 100).toFixed(2); } function showTab(tabIdPrefix, bodyIdPrefix, minIndex,maxIndex, tabIndex) { for (i = minIndex; i <= maxIndex; i++) { if ((bodyIdPrefix!=undefined)&&(bodyIdPrefix!=null)) document.getElementById(bodyIdPrefix + i).style.display = "none"; $("#" + tabIdPrefix + i).removeClass("active"); } if ((bodyIdPrefix != undefined) && (bodyIdPrefix != null)) document.getElementById(bodyIdPrefix + tabIndex).style.display = "block"; $("#" + tabIdPrefix + tabIndex).addClass("active"); } function setCloseMenuHandler() { $('.navbar-nav>li>a').on('click', function () { $('.navbar-collapse').collapse('hide'); }); $(document).on('click', function () { $('.navbar-collapse').collapse('hide'); }); }