//customs
document.onclick = function(event) {
var el = event.target;
//alert(el.nodeName);
if (el.nodeName == "A" && el.classList.contains("call-now")) {
var num = el.getAttribute('href');
var referer = window.location.href;
var cta_id = el.getAttribute('data-cta-id');
//alert(num + " " + referer);
var request = new XMLHttpRequest();
request.open('GET', '//naranresidence.mn/api.php/cta/call?&url=' + num + '&cta_id=' + cta_id, true);
request.onload = function() {
if (request.status >= 200 && request.status < 400) {
// Success!
var resp = request.responseText;
} else {
// We reached our target server, but it returned an error
}
};
request.onerror = function() {
// There was a connection error of some sort
};
request.send();
}
};
if ($("section#p").length > 0){
location.href='/home/cc';
}
function add_cart(product_id, quantity){
var xhr = new XMLHttpRequest();
xhr.open('POST', '/cart/add');
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.onload = function() {
if (xhr.status === 200 && xhr.responseText !== 'ok') {
//alert('added to cart');
}
else if (xhr.status !== 200) {
alert('Error');
}
};
xhr.send(encodeURI('product=' + product_id + '&quantity=' + quantity));
}
var div = document.createElement("div");
div.innerHTML = '