spectro_screen = 1250; Spectro_JS = 1; function Spectro_GoOnURL(url) { location.href = url; } function Spectro_Confirm(message, url) { html = '
');
for (i = 1; i < 6; i++) {
if (document.getElementById(name + "refresh" + i)) {
console.log('apprefresh/?url=https://molekula-smart.ru/' + document.getElementById(name + "refresh" + i).value);
}
}
form.submit();
}
function Spectro_CryptoSubmit(block, name)
{
Spectro_CryptForm(block);
var form = document.getElementById(name);
form.submit();
}
function Spectro_Value(id, value)
{
if (document.getElementById(id)) document.getElementById(id).value = value;
}
function Spectro_Html(id, value)
{
if (document.getElementById(id)) document.getElementById(id).innerHTML = value;
}
function Spectro_Style(id, param, value)
{
if (document.getElementById(id))
switch (param) {
case "background": document.getElementById(id).style.background = value; break;
case "bgposition": document.getElementById(id).style.backgroundPosition = value; break;
case "bgurl": document.getElementById(id).style.backgroundImage = "url('" + value + "')"; break;
case "width": document.getElementById(id).style.width = value + "px"; break;
case "height": document.getElementById(id).style.height = value + "px"; break;
case "top": document.getElementById(id).style.top = value + "px"; break;
case "left": document.getElementById(id).style.left = value + "px"; break;
case "margin-left": document.getElementById(id).style.marginLeft = value + "px"; break;
case "margin-top": document.getElementById(id).style.marginTop = value + "px"; break;
case "display": document.getElementById(id).style.display = value; break;
case "position": document.getElementById(id).style.position = value; break;
case "opacity": document.getElementById(id).style.opacity = value; break;
case "border": document.getElementById(id).style.border = value; break;
}
}
function Spectro_Exit(message, url)
{ if (confirm(message)) location.href = url;
}
function Spectro_FrameButton(buttonid, currclass)
{
if (document.getElementById(buttonid)) {
div = document.getElementById(buttonid);
div.setAttribute('class', currclass);
}
}
function Spectro_Frame(position, url, buttonid)
{
var addstr = '';
ajax_var.open("get", "https://molekula-smart.ru/" + url, false);
if (document.getElementById(buttonid)) {
div = document.getElementById(buttonid);
currclass = div.getAttribute("class");
div.setAttribute('class', currclass + ' spectro_animate');
} else currclass = "";
ajax_var.onreadystatechange = function() {
if (ajax_var.readyState == 4) {
var response = ajax_var.responseText;
if (response != "") {
Spectro_Html(position, '
');
params = "umessage=" + newmess + "&dialogid=" + dialogid + "&from=" + from + "&to=" + to +
"&type=ajax&cryptcheck=" + cryptcheck;
Spectro_Action("spectro_data", "dialog/", "addtodialog", 0, params);
Spectro_Frame("spectro_data", "private/dialog/id" + dialogid + "/frame/");
Spectro_DialogScroll();
setTimeout(Spectro_DialogScroll, 1000);
setTimeout(Spectro_DialogScroll, 2000);
setTimeout(Spectro_DialogScroll, 3000);
if (cryptype != "") {
Spectro_Value("spectro_" + cryptype + "_temp1", "");
setTimeout(Spectro_Start, 300);
} else Spectro_Value("spectro_message" + ui, "");
} else {
div = document.getElementById('spectro_message' + ui);
currclass = div.getAttribute("class");
div.setAttribute('class', currclass + ' spectro_animate');
}
}
function Spectro_DialogScroll()
{
if (document.getElementById("spectro_dialoglist")) {
var dialog = document.getElementById("spectro_dialoglist");
dialog.scrollTop = dialog.scrollHeight + dialog.scrollHeight;
}
}
function Spectro_UnCryptData()
{
text = document.getElementById("spectro_crypt").value;
text = Spectro_UnCrypt(text);
document.getElementById("spectro_crypt0").innerHTML = text + '
';
}
function Spectro_CryptForm(form)
{
fields = parseInt(document.getElementById('spectro_' + form + '_fields').value) + 1;
for (ii = 1; ii < fields; ii++) if (document.getElementById('spectro_' + form + '_temp' + ii)) {
value = Spectro_Crypt(document.getElementById('spectro_' + form + '_temp' + ii).value);
Spectro_Value('spectro_' + form + '_field' + ii, value);
if (iscryptshow == 1 && document.getElementById('spectro_' + form + '_crypt' + ii) && value != "")
document.getElementById('spectro_' + form + '_crypt' + ii).innerHTML = 'Перед отправкой, данные шифруются" + ", не зависимо от того, видите вы зашифрованные значения или нет
"; } isformrules = 0; function Spectro_FormRules() { isformrules = 1 - isformrules; if (isformrules == 1) { document.getElementById('spectro_formrules').innerHTML = "Ваши контактные данные будут использоваться исключительно для вашего информирования по вашему запросу. " + "Никаких спам-рассылок, никакой навязчивой рекламы туда отправляться не будет. Ваши контактные данные никогда не " + "будут видны на сайте и не будут никому передаваться без вашего согласия. У вас всегда будет возможность удалить " + "свои контактные данные и отказаться от любых уведомлений. Отправляя данную форму, вы соглашаетесь с этими условиями.
"; } else document.getElementById('spectro_formrules').innerHTML = ""; } iscryptshow = 0; function Spectro_CryptPhone(phone) { phone = phone.split("oo").join("1"); phone = phone.split("tt").join("2"); phone = phone.split("hh").join("3"); phone = phone.split("ff").join("4"); phone = phone.split("ii").join("5"); phone = phone.split("ss").join("6"); phone = phone.split("ee").join("7"); phone = phone.split("gg").join("8"); phone = phone.split("nn").join("9"); phone = phone.split("zz").join("0"); return(phone); } Enemy = 0; function Spectro_EnemyOff() { done = 0; var item = document.getElementsByTagName('div'); for (var i = 0; i < item.length; i++) { if (done == 1) { item[i].innerHTML = ""; Enemy = 1; } if (item[i].className == 'spectro_end') done = 1; } if (document.getElementById('spectro_end') && Enemy == 0) setTimeout(Spectro_EnemyOff, 1000); } function Spectro_Statistic() { ref = document.referrer; ajax_var.open('get', 'https://molekula-smart.ru/spectro_statistic/' + ref + '/', true); ajax_var.onreadystatechange = function() { if (ajax_var.readyState == 4) { var response = ajax_var.responseText; document.getElementById("spectro_panel").innerHTML = response; } }; ajax_var.send(); } function Spectro_JS_Results() { ajax_var.open('get', 'https://molekula-smart.ru/cms-dynamic/', false); ajax_var.onreadystatechange = function() { if (ajax_var.readyState == 4) { var response = ajax_var.responseText; var db = response.split("-|-"); if (db[1] && db[1] != "") { document.getElementById('spectro_results').innerHTML = db[1]; setTimeout(Spectro_CleanResults, 2500); } } }; ajax_var.send(); } function Spectro_Start() { Spectro_DynamicImg(); Spectro_DynamicDraw(); if (document.getElementById("spectro_dynamicdata")) { Spectro_Frame("spectro_data", document.getElementById("spectro_dynamicdata").value); } for (i = 1; i < 6; i++) { if (document.getElementById("spectro_dynamicblock" + i)) { Spectro_Frame("spectro_block" + i, document.getElementById("spectro_dynamicblock" + i).value); } } onlinemode = 0; ajax_var.open('get', 'https://molekula-smart.ru/cms-dynamic/spectro-open-type/', false); ajax_var.onreadystatechange = function() { if (ajax_var.readyState == 4) { var response = ajax_var.responseText; var db = response.split("-|-"); if (db[1] && db[1] != "") { document.getElementById('spectro_results').innerHTML = db[1]; setTimeout(Spectro_CleanResults, 2500); } if (db[2] && document.getElementById("spectro_basket")) document.getElementById("spectro_basket").innerHTML = db[2]; if (db[3]) { good = db[3].split("+|+"); for (var i = 0; i < good.length; i++) { blow = good[i].split("::"); if (document.getElementById("spectro_ing_" + blow[0])) { Spectro_Style("spectro_ing_" + blow[0], "display", "block"); document.getElementById("spectro_ingc_" + blow[0]).innerHTML = blow[1]; } if (document.getElementById("spectro_inl0_" + blow[0])) { Spectro_Style("spectro_inl0_" + blow[0], "display", "block"); document.getElementById("spectro_inl0c_" + blow[0]).innerHTML = blow[1]; } if (document.getElementById("spectro_inl3_" + blow[0])) Spectro_Style("spectro_inl3_" + blow[0], "display", "block"); if (document.getElementById("spectro_inl4_" + blow[0])) Spectro_Style("spectro_inl4_" + blow[0], "display", "block"); if (document.getElementById("spectro_inl5_" + blow[0])) Spectro_Style("spectro_inl5_" + blow[0], "display", "block"); } } if (db[4]) { for (i = 1; i < 6; i++) { if (document.getElementById("spectro_protect" + i)) { document.getElementById("spectro_protect" + i).src = "/spectro-protect-" + db[4] + ".png"; Spectro_Value("spectro_protect" + i + "num", db[4]); } } } if (db[5] && db[5] != "") document.getElementById('spectro_add').innerHTML = db[5]; if (db[6]) onlinemode = db[6]; if (db[7] && document.getElementById("spectro_onlinedialog")) { document.getElementById("spectro_onlinedialog").innerHTML = db[7]; } /* if (db[7] && document.getElementById("spectro_dialog")) { dialog = db[7].split("") setTimeout(Spectro_OnlineFirst, 5000); document.getElementById("spectro_dialog").innerHTML = dialog[0]; }*/ if (db[8] && db[8] != "" && document.getElementById("spectro_phone_top")) document.getElementById('spectro_phone_top').innerHTML = Spectro_CryptPhone(db[8]); if (db[9] && db[9] != "" && document.getElementById("spectro_phone_bottom")) document.getElementById('spectro_phone_bottom').innerHTML = Spectro_CryptPhone(db[9]); if (db[10] && db[10] != "") { db[10] = db[10].split("[A]").join("@"); db[10] = db[10].split("[S]").join("mailto:"); db[10] = db[10].split("[D]").join("."); if (document.getElementById("spectro_sitemail_top")) document.getElementById('spectro_sitemail_top').innerHTML = db[10]; if (document.getElementById("spectro_sitemail_bottom")) document.getElementById('spectro_sitemail_bottom').innerHTML = db[10]; if (document.getElementById("spectro_sitemail_page")) document.getElementById('spectro_sitemail_page').innerHTML = db[10]; } if (db[11] && db[11] != "") { db[11] = Spectro_CryptPhone(db[11]); if (document.getElementById("spectro_phone_region_top")) document.getElementById('spectro_phone_region_top').innerHTML = db[11]; if (document.getElementById("spectro_phone_region_bottom")) document.getElementById('spectro_phone_region_bottom').innerHTML = db[11]; if (document.getElementById("spectro_phone_region_page")) document.getElementById('spectro_phone_region_page').innerHTML = db[11]; } } }; ajax_var.send(); if (document.getElementById("spectro_noregion")) setTimeout(Spectro_RegionConfirm, 3000); if (document.getElementById("spectro_end")) setTimeout(Spectro_EnemyOff, 100); isslider = 0; for (i = 1; i < 6; i++) { if (document.getElementById("spectro_slider" + i)) { isslider = 1; setTimeout(Spectro_SliderAuto, 3000); } } if (isslider == 1) Spectro_SliderResize(); ismodebg = 0; for (i = 1; i < 6; i++) { if (document.getElementById("spectro_movebg" + i)) ismodebg = 1; } if (ismodebg == 1) Spectro_MoveBG1(); if (document.getElementById("spectro_scanpage")) setTimeout(Spectro_ScanPage, 3000); for (i = 1; i < 6; i++) { if (document.getElementById("spectro_dyprices" + i)) { Spectro_DynamicPrices(document.getElementById("spectro_dyprices" + i).value); } } if (document.getElementById("spectro_dialoglist")) { Spectro_DialogScroll(); setTimeout(Spectro_DialogScroll, 1000); setTimeout(Spectro_DialogScroll, 2000); setTimeout(Spectro_DialogScroll, 3000); } if (document.getElementById("spectro_crypt")) Spectro_UnCryptData(); if (document.getElementById("spectro_calc")) Spectro_initCalc(); if (document.getElementById("dataview")) { htmlEditor = new Application.Editor({ ID: 'dataview' }); htmlEditor.EditMode = 1; htmlEditor.SetHeight(); var fontc = new MooRainbow('fontc', { id: 'chfontcol', wheel: true, 'startColor': [58, 142, 246], onChange: function(color) { htmlEditor.SetColor(color.hex); }, onComplete: function(color) { htmlEditor.SetColor(color.hex); } }); } if (document.getElementById("deliverymap")) ymaps.ready(initYMaps); if (document.getElementById("outjsonload")) OutJSonload(); if (document.getElementById("spectrosnow1")) Spectro_RunSnow(); } function Spectro_Field2check(id) { if (document.getElementById(id).checked == false) document.getElementById(id).checked = true; else document.getElementById(id).checked = false; } function Spectro_Field2(block, name, field, catid, filter, pos) { if (document.getElementById(block + "open")) document.getElementById(block).innerHTML = ""; else { ajax_var.open('get', 'https://molekula-smart.ru/cms-field2/' + block + '/' + name + '/' + field + '/' + catid + '/' + filter + '/id' + pos + '/', true); ajax_var.onreadystatechange = function() { if (ajax_var.readyState == 4) { var response = ajax_var.responseText; document.getElementById(block).innerHTML = response; } }; ajax_var.send(null); } } function Spectro_GoodImg(img, goodid, ui) { document.getElementById('goodimg' + goodid + "_" + ui).src = img; } function Spectro_ImgOne(img, goodid) { Spectro_Style("spectro_movebg2", "bgurl", img); document.getElementById('good' + goodid).src = img; } runsnow = 0; function Spectro_RunSnow() { if (runsnow == 0) { Spectro_Snow(); runsnow = 1; } } var snowtop = [0, 222, 13, 30, 28, 344, 170, 299, 124, 150]; var snowleft = [0, 100, 300, 700, 900, 400, 560, 800, 200, 555]; function Spectro_Snow() { if (window.innerWidth) spectro_screen = window.innerWidth; else if (document.documentElement && document.documentElement.clientWidth) spectro_screen = document.documentElement.clientWidth; else if (document.body && document.body.clientWidth) spectro_screen = document.body.clientWidth; if (spectro_screen > 1000) { for (i = 1; i < 11; i++) { cid = 'spectrosnow' + i; Spectro_Style(cid, 'top', snowtop[i]); snowtop[i] = snowtop[i] + Math.floor(Math.random()*(4 - 1) + 1); Spectro_Style(cid, 'margin-left', snowleft[i]); snowleft[i] = snowleft[i] + Math.floor(Math.random()*2); if (snowtop[i] > 600) { snowtop[i] = Math.floor(Math.random()*(190 - 1) + 1); snowleft[i] = Math.floor(Math.random()*(990 - 1) + 1); } if (snowleft[i] > 1000) snowleft[i] = Math.floor(Math.random()*(990 - 1) + 1); } setTimeout(Spectro_Snow, 50); } else { for (i = 1; i < 11; i++) { cid = 'spectrosnow' + i; Spectro_Style(cid, 'display', 'none'); } } } function Spectro_SetMask(pos, elem) { elem.focus(); if (elem.setSelectionRange) elem.setSelectionRange(pos, pos); else if (elem.createTextRange) { var range = elem.createTextRange(); range.collapse(true); range.moveEnd("character", pos); range.moveStart("character", pos); range.select() } } function Spectro_PhoneMask(event, type = "phone") { var matrix = "+7 (___) ___-__-__", element = event.target, i = 0; switch(type) { case "time": matrix = "__:__"; break; case "date": matrix = "__.__.____"; break; } var def = matrix.replace(/\D/g, ""), val = element.value.replace(/\D/g, ""); if (def.length >= val.length) val = def; element.value = matrix.replace(/./g, function(a) { return /[_\d]/.test(a) && i < val.length ? val.charAt(i++) : i >= val.length ? "" : a }); if (event.type == "blur") { if (element.value.length == 2) element.value = "" } else Spectro_SetMask(element.value.length, element) } window.onload=function(){ajax_var=new XMLHttpRequest();Spectro_Start();};window.onscroll=function(){Spectro_DynamicScroll();};window.onfocus=function(){Spectro_JS=1;};window.onblur=function(){Spectro_JS=0;};