File: //home/sarlight.ru/public_html/wp-content/themes/addison/script.js
function findButtons() {
	if (jQuery('input.footer_form')) {
		jQuery('input.footer_form').attr('onclick', 'submit_data_to_crm_footer();');
	} 
	if (jQuery('input.kontakty_form')) {
		jQuery('input.kontakty_form').attr('onclick', 'submit_data_to_crm_kontakty();');
	}
}
document.addEventListener("DOMContentLoaded", findButtons);
// Ставим куки
var curUrl = window.location.href;
var findme = curUrl.indexOf("?");
if (findme === -1) {
} else {
	function setCookie(name, value, options = {}) {
	  options = {
	    path: '/',
	    // при необходимости добавьте другие значения по умолчанию
		...options
	  };
	  let updatedCookie = encodeURIComponent(name) + "=" + encodeURIComponent(value);
	  for (let optionKey in options) {
	    updatedCookie += "; " + optionKey;
	    let optionValue = options[optionKey];
	    if (optionValue !== true) {
	      updatedCookie += "=" + optionValue;
	    }
	  }
	  document.cookie = updatedCookie;
	}
	setCookie('Group2', window.location.href.split('?')[1], {secure: true, 'max-age': 2592000});
}
// Ставим куки
// Отправка на CRM
function submit_data_to_crm_footer(event) {
	var name = jQuery('input[name=text-826]').val();
	var phone = jQuery('input[name=tel-415]').val();
	if (phone) {
		function getCookie(name) {
		  var value = "; " + document.cookie;
		  var parts = value.split("; " + name + "=");
		  if (parts.length == 2) return parts.pop().split(";").shift();
		}
		var group2 = getCookie('Group2');
		// console.log(group2);
		jQuery.ajax({
			url: "https://spaceapp.ru/ClientRequests/API",
			type: "POST",
			data:{domainId: 37, Phone: phone, FIO: name, GroupBy1: window.location.href.split('?')[0], GroupBy2: group2},
			scriptCharset: "utf-8",
			contentType: "application/x-www-form-urlencoded; charset=UTF-8",
		});
	}
}
// Отправка на CRM
function submit_data_to_crm_kontakty(event) {
	var name = jQuery('input[name=text-406]').val();
	var email = jQuery('input[name=email-711]').val();
	var text = jQuery('textarea[name=textarea-410]').val();
	if (email) {
		function getCookie(name) {
		  var value = "; " + document.cookie;
		  var parts = value.split("; " + name + "=");
		  if (parts.length == 2) return parts.pop().split(";").shift();
		}
		var group2 = getCookie('Group2');
		// console.log(group2);
		jQuery.ajax({
			url: "https://spaceapp.ru/ClientRequests/API",
			type: "POST",
			data:{domainId: 37, Email: email, FIO: name, Text: text, GroupBy1: window.location.href.split('?')[0], GroupBy2: group2},
			scriptCharset: "utf-8",
			contentType: "application/x-www-form-urlencoded; charset=UTF-8",
		});
	}
}