function Js_String_Trim(value) { value = String(value); return value.replace(/^\s+/ig, "").replace(/\s+$/ig, ""); } function Js_Type_IsEmpty(value) { if (value == undefined || value == null || typeof(value) == "undefined") { return true; } else { return false; } } /*смена цвета фона*/ function LightTd(id, method) { var obj = document.getElementById("i" + id); if (obj != null) { obj.style.background = '#'+method+''; } } /*смена фоновой картинки*/ function LightTdImg(id, method) { var obj = document.getElementById("im" + id); if (obj != null) { obj.style.background = 'url('+method+') repeat-x left top #A52B2F'; } } /*смена фоновой картинки*/ function LightTdImgExp(id, method, color) { var obj = document.getElementById("im" + id); if (obj != null) { obj.style.background = 'url('+method+') repeat-x left top #'+color+''; } } // function Supermarket_Complect_AddToBasket(complect_id, old_count, new_count) { d = document; objComplectCount = d.getElementById('Supermarket_Complect_Count' + complect_id); if (!objComplectCount) { alert('Error!'); return; } objComplectPrice = d.getElementById('Supermarket_Complect_PriceRub' + complect_id); var complect_price = 0; if (objComplectPrice) { complect_price = parseFloat(objComplectPrice.innerHTML); if (isNaN(complect_price)) { complect_price = 0; } } old_count = parseInt(old_count); new_count = parseInt(new_count); if (isNaN(old_count) || (old_count < 0)) { objComplectCount.value = 0; return; } if (isNaN(new_count) || (new_count < 0)) { objComplectCount.value = old_count; return; } objComplectCount.value = new_count; objTotalComplectsCount = d.getElementById('Supermarket_TotalComplectsCount'); objTotalAmount = d.getElementById('Supermarket_TotalAmount'); if (!objTotalComplectsCount) { alert('No objTotalComplectsCount!'); return; } var old_total_count = parseInt(objTotalComplectsCount.innerHTML); if (isNaN(old_total_count)) { old_total_count = 0; } var new_total_count = old_total_count + new_count - old_count; objTotalComplectsCount.innerHTML = new_total_count; var noMoney = false; if (!objTotalAmount) { noMoney = true; } if (!noMoney) { var old_total_amount = parseFloat(objTotalAmount.innerHTML); if (isNaN(old_total_amount) || (old_total_amount < 0)) { old_total_amount = 0; } var new_total_amount = old_total_amount + (new_count - old_count) * complect_price; //alert(new_total_amount); objTotalAmount.innerHTML = Money_Round(new_total_amount, 2); Supermarket_Budget_SetRest(new_total_amount); } Cookie(complect_id + ':' + new_total_count, 'Supermarket_Cart_Complects', (new_total_count > 0 ? true : false), 'add'); GetFull('Supermarket_Cart_Complects','Supermarket_Cart_Img','/images/supermarket/icons/cart.gif','/images/supermarket/icons/cart_full.gif'); //alert(1); } // function Supermarket_Complect_IncToBasket(complect_id) { var d = document; var objComplectCount = d.getElementById('Supermarket_Complect_Count' + complect_id); if (!objComplectCount) { return; } var old_count = parseInt(objComplectCount.value); if (isNaN(old_count)) { old_count = 0; } var new_count = old_count + 1; Supermarket_Complect_AddToBasket(complect_id, old_count, new_count) } // function Supermarket_Complect_DecToBasket(complect_id) { var d = document; var objComplectCount = d.getElementById('Supermarket_Complect_Count' + complect_id); if (!objComplectCount) { return; } var old_count = parseInt(objComplectCount.value); if (isNaN(old_count)) { old_count = 0; } var new_count = old_count - 1; if (new_count < 0) { new_count = 0; } Supermarket_Complect_AddToBasket(complect_id, old_count, new_count) } // function Supermarket_Complect_ZeroToBasket(complect_id) { var d = document; var objComplectCount = d.getElementById('Supermarket_Complect_Count' + complect_id); if (!objComplectCount) { return; } var old_count = parseInt(objComplectCount.value); if (isNaN(old_count)) { old_count = 0; } var new_count = 0; Supermarket_Complect_AddToBasket(complect_id, old_count, new_count) } // function CheckTxtField(txt, txtAlarm) { txt = txt.replace(/\s+/g, ""); if(txt.length == 0) { if(txtAlarm != "") alert('Заполните поле "' + txtAlarm + '"!'); return false; } return true; } // function CheckTxtFieldN(txt, txtAlarm, n) { txt=txt.replace(/\s+/g, ""); if(txt.length < n) { if(txtAlarm!="") alert('Заполните поле "' + txtAlarm + '"!'); return false; } return true; } // function Supermarket_Order_CheckDetails(type) { //alert(CheckTxtField(document.order.fio.value, (type == 'f') ? 'ФИО': 'Контактное лицо')); //if(!CheckTxtField(document.order.namecart.value, "Наименование заказа")) // return false; if(type == "u") { if(!CheckTxtField(document.order.fio.value, "Контактное лицо")) return false; if(!CheckTxtField(document.order.nameKontr.value, "Название организации")) return false; if(!CheckTxtField(document.order.mail.value, "E-mail")) return false; s = document.order.mail.value; var re = new RegExp("^[0-9a-z-_\\.]+@[0-9a-z-_\\.]+\.[a-z]{2,5}$", "i"); var r = s.search(re); if(r == -1) { alert("Неправильно введен email!"); return false; } if(!CheckTxtFieldN(document.order.inn.value, "ИНН")) return false; if(!CheckTxtFieldN(document.order.kpp.value, "kpp")) return false; if(!CheckTxtField(document.order.tel.value, "Телефон")) return false; if(!CheckTxtField(document.order.address_ur.value, "Юридический адрес")) return false; if(!CheckTxtField(document.order.info.value, "Фактический адрес")) return false; } if(!CheckTxtField(document.order.fio.value, (type == 'f') ? 'ФИО': 'Контактное лицо')) return false; if(!CheckTxtField(document.order.mail.value, "E-mail")) return false; s = document.order.mail.value; var re = new RegExp("^[0-9a-z-_\\.]+@[0-9a-z-_\\.]+\.[a-z]{2,5}$", "i"); var r = s.search(re); if(r == -1) { alert("Неправильно введен email!"); return false; } if(!CheckTxtField(document.order.tel.value, "Телефон")) return false; if(!CheckTxtField(document.order.address_dost.value, "Адрес доставки")) return false; //if(!CheckTxtField(document.order.time_dost.value, "Время доставки")) // return false; return true; } // function Supermarket_Cart_CheckArticulsForm() { var d = document; var f = d.articulsForm; var found = 0; for(var i = 0; i < f.elements.length; i++) { var e = f.elements[i]; var e_ = f.elements[i + 1]; if (e.name == 'articul') { if (e.value != '' && parseInt(e_.value) > 0) { found = 1; } else if (e.value != '' || (e_.value != '' && e_.value != '0')) { alert('Неверные данные!'); found = 0; break; // e.value = ''; // e_.value = ''; } } } if (found == 1) { return true; } else { return false; } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// var caution = false; function Cookie(goodId, nameCookie, checked, action) // action (add, remove,replace) { var alert_add = getCookie('alert_add'); //значения кука, которое указывает что сообщение о добавлении товара в карзину выскакивало или нет var alert_remove = getCookie('alert_remove'); //значения кука, которое указывает что сообщение о удалении товара из карзину выскакивало или нет goodId=goodId + ''; var now = new Date(); var str = getCookie(nameCookie); if(str == null || str == '') str = '·'; var arr = new Array(); ch = '·'; if(goodId.indexOf(':') != -1) { ch = ':'; arr = goodId.split(':'); } else arr[0] = goodId; if((checked && action == 'add') || (!checked && action == 'remove'))//if количество товара не 0 или ставим галочку на добавление или убираем галочку на удаление { if(alert_add == null) { if(nameCookie == 'complect') alert('Комплект добавлен в корзину.\n Данное сообщение больше появляться не будет.'); if(nameCookie == 'cart') alert('Товар добавлен в корзину.\n Данное сообщение больше показываться не будет.'); if(nameCookie == 'compare') alert('Товар добавлен в сравнение.\n Данное сообщение больше показываться не будет.'); setCookie('alert_add', 1); } if (str == '·') { str = '·' + goodId + '·'; } else { if(str.indexOf('·' + arr[0] + ch) == -1) //если чекбокс, { str = str + goodId + '·'; } else //если количество товара изменено { str=str.replace(new RegExp(arr[0]+':[0-9]+·'), goodId+'·') } } } else if (checked && action == 'add+') { if(alert_add == null) { if(nameCookie == 'complect') alert('Комплект добавлен в корзину.\n Данное сообщение больше появляться не будет.'); if(nameCookie == 'cart') alert('Товар добавлен в корзину.\n Данное сообщение больше показываться не будет.'); if(nameCookie == 'compare') alert('Товар добавлен в сравнение.\n Данное сообщение больше показываться не будет.'); setCookie('alert_add', 1); } if (str == '·') { str = '·' + goodId+'·'; } else { if(str.indexOf('·' + arr[0] + ch) == -1) { str = str + goodId + '·'; } else { var re = new RegExp('·' + arr[0] + ':([0-9]+)·'); var ms = new Array(); ms = str.match(re); if (ms[1] > 0) { count = parseInt(ms[1]) + parseInt(arr[1]); str = str.replace(re, '·' + arr[0] + ':' + count + '·'); } } } } else { //ставим галочку на удаление или снимаем галочку на добавление или ставим 0 в поле с количеством товара if(alert_remove==null) { if(nameCookie=='complect') alert('Комплект удален из корзины.\n Данное сообщение больше появляться не будет.'); if(nameCookie=='cart') alert('Товар удален из корзины.\n Данное сообщение больше появляться не будет.'); if(nameCookie=='compare') alert('Товар удален из сравнения.\n Данное сообщение больше появляться не будет.'); setCookie('alert_remove', 1); } if(arr[1]==0) str = str.replace(new RegExp(arr[0]+':[0-9]+·'),''); //если ставим 0 в поле с количеством else str = str.replace(goodId + '·', '') } if (str == '·') str = ''; setCookie(nameCookie, str); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function setCookie(name, value, expires, path, domain, secure) { path = "/"; // alert('Name: ' + name); // alert('EsName: ' + escape(name)); name = name.replace(/_/g, '%5F'); var curCookie = name + '=' + escape(value) + ((expires) ? '; expires=' + expires.toGMTString() : '') + ((path) ? '; path=' + path : '') + ((domain) ? '; domain=' + domain : '') + ((secure) ? '; secure' : '') if (!caution || (name + '=' + escape(value)).length <= 4000) document.cookie = curCookie else if (confirm('Cookie exceeds 4KB and will be cut!')) document.cookie = curCookie } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function getCookie(name) { name = name.replace(/_/g, '%5F'); var prefix = name + '=' var cookieStartIndex = document.cookie.indexOf(prefix) if (cookieStartIndex == -1) return null var cookieEndIndex = document.cookie.indexOf(';', cookieStartIndex + prefix.length) if (cookieEndIndex == -1) cookieEndIndex = document.cookie.length return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex)) } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function deleteCookie(name, path, domain) { if (getCookie(name)) { name = name.replace(/_/g, '%5F'); document.cookie = name + '=' + ((path) ? '; path=' + path : '') + ((domain) ? '; domain=' + domain : '') + '; expires=Thu, 01-Jan-70 00:00:01 GMT' } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function GetFull(nameCookie,nameObject,emptyImg,fullImg) { // определяет полная корзина или нет, в зависимости от этого меняет пиктограмму заполнености корзины.. var cookieValue=getCookie(nameCookie); obj = document.getElementById(nameObject); if (obj) { var imgSrc = obj.src; //eval(nameObject+'.src'); if((cookieValue == null || cookieValue == '') && imgSrc.indexOf(fullImg)!=-1) obj.src = emptyImg; //eval(nameObject).src=emptyImg; if((cookieValue != null || cookieValue == '') && imgSrc.indexOf(emptyImg)!=-1) obj.src = fullImg; //eval(nameObject).src=fullImg; } else { alert('No such object: ' + nameObject); } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Добавление товара в корзине function Supermarket_Good_AddToBasket(good_id, old_count, new_count, type, volume, position) { ///alert(good_id); ///alert(document.cookie); volume = parseFloat(volume); /// alert("volume = " + volume); old_count = parseInt(old_count); new_count = parseInt(new_count); var old_total_goods_volume = 0; //Старое значение if (new_count<0 || new_count>999) { alert("Количество товара должно быть в диапозоне от 1 до 999!"); } else { var d = document; //Старые элементы var objGoodPrice = d.getElementById('Supermarket_Good_PriceRub' + good_id); var objGoodCount = d.getElementById('Supermarket_Good_Count' + good_id); //var objGoodVolume = d.getElementById('Supermarket_Good_Volume' + good_id); //Нужен вот такой объект //Новые элементы var objTotalGoodsCount = d.getElementById('Supermarket_TotalGoodsCount'); var objTotalAmount = d.getElementById('Supermarket_TotalAmount'); var objTotalVolume = d.getElementById('Supermarket_TotalV'); var good_price = 0; old_total_goods_volume = parseFloat(objTotalVolume.innerHTML); /// alert("old_total_goods_volume = " + old_total_goods_volume); if (objGoodPrice) { //good_price = parseFloat(objGoodPrice.innerHTML); var RegEx=/\s/g; good_price=parseInt(objGoodPrice.innerHTML.replace(RegEx,"")); if (isNaN(good_price)) { good_price = 0; } } if (!objGoodCount) { alert('No GoodCount!'); return; } if (isNaN(new_count) || new_count < 0) { objGoodCount.value = old_count; return; } if (!objTotalGoodsCount) { alert('No objTotalGoodsCount!'); return; } var noMoney = false; if (!objTotalAmount) { noMoney = true; } var old_total_goods_count = parseInt(objTotalGoodsCount.innerHTML); if (isNaN(old_total_goods_count)) { old_total_goods_count = 0; } objTotalGoodsCount.innerHTML = old_total_goods_count + (new_count - old_count); if (volume!="0") { volume = old_total_goods_volume + volume; } else { volume = old_total_goods_volume; } var sum_kolvo = old_total_goods_count + (new_count - old_count); if (sum_kolvo==0) { volume = 0; } /// alert("volume (2) = " + volume); volume = ftos(volume, 4); /// alert("volume (3) = " + volume); objTotalVolume.innerHTML = volume; if (!noMoney) { //var old_total_amount = parseFloat(objTotalAmount.innerHTML); //var old_total_amount = parseInt(objTotalAmount.innerHTML); var RegEx=/\s/g; var old_total_amount = parseInt(objTotalAmount.innerHTML.replace(RegEx,"")); //document.write("old_old_amount =" + old_total_amount + "
"); if (isNaN(old_total_amount)) { old_total_amount = 0; } var new_total_amount = old_total_amount + (new_count - old_count) * good_price; //document.write(new_total_amount); if (isNaN(new_total_amount)) { new_total_amount = 0; } //objTotalAmount.innerHTML = zeros4Money(Money_Round(new_total_amount, 2)); //objTotalAmount.innerHTML = Money_Round(new_total_amount, 2); objTotalAmount.innerHTML = numFormat(new_total_amount); Supermarket_Budget_SetRest(new_total_amount); } Cookie(good_id + ':' + new_count, 'Supermarket_Cart_Goods', (new_count > 0 ? true : false), 'add'); //GetFull('Supermarket_Cart_Goods', 'Supermarket_Cart_Img', '/images/supermarket/icons/cart.gif', '/images/supermarket/icons/cart_full.gif'); objGoodCount.value = new_count; if (type == 4) { var span = d.getElementById("Supermarket_SpanForGood" + good_id); var table = d.getElementById("Supermarket_TableForGood" + good_id); var tr = d.getElementById("Supermarket_TrForGood" + good_id); var re = new RegExp('cell4Good' + good_id + '_(\.)', 'i'); if (new_count > 0) { /* if (span) { span.style.display = 'none'; } if (table) { table.style.display = ''; } */ if (tr) tr.className = 'Supermarket_RowSelected'; var tds = document.getElementsByTagName("td"); for(var i = 0; i < tds.length; i++) { var td = tds[i]; if (td.id.match(re)) { td.className = 'Supermarket_CellSelected'; } } } else { /* if (span) { span.style.display = ''; } if (table) { table.style.display = 'none'; } */ var tds = document.getElementsByTagName("td"); for (var i = 0; i < tds.length; i++) { var td = tds[i]; if (td.id.match(re)) { ms = td.id.match(re); td.className = 'Supermarket_Row' + ms[1]; } } if (tr) { if (position % 2 == 1) { tr.className = 'Supermarket_Row1'; } else { tr.className = 'Supermarket_Row0'; } } } } } } //Добавление товара в корзину function Supermarket_Good_IncToBasket(good_id, type, volume, position) { var d = document; var objGoodCount = d.getElementById('Supermarket_Good_Count' + good_id); if (!objGoodCount) { return; } var old_count = parseInt(objGoodCount.value); if (isNaN(old_count)) { old_count = 0; } var new_count = old_count + 1; Supermarket_Good_AddToBasket(good_id, old_count, new_count, type, volume, position) } //Уменьшение товара в корзине function Supermarket_Good_DecToBasket(good_id, type, volume, position) { //alert(volume); var d = document; var objGoodCount = d.getElementById('Supermarket_Good_Count' + good_id); if (!objGoodCount) { return; } var old_count = parseInt(objGoodCount.value); if (isNaN(old_count)) { old_count = 0; } var new_count = old_count - 1; if (new_count < 0) { new_count = 0; } //alert("volume = " + volume + ", old_count=" + old_count + ", new_count=" + new_count + ", type=" + type); Supermarket_Good_AddToBasket(good_id, old_count, new_count, type, -volume, position) } //Удаление товара в корзине function Supermarket_Good_ZeroToBasket(good_id, type, volume, position) { var d = document; var objGoodCount = d.getElementById('Supermarket_Good_Count' + good_id); if (!objGoodCount) { return; } var old_count = parseInt(objGoodCount.value); if (isNaN(old_count)) { old_count = 0; } var new_count = 0; volume = volume * old_count; ///alert("volume = " + volume + ", old_count = " + old_count); Supermarket_Good_AddToBasket(good_id, old_count, new_count, type, -volume, position) } // function Supermarket_Budget_SetRest(sum) { var objLeftBudgetSum = document.getElementById('Supermarket_Budget_LeftSum'); var objMaxBudgetSum = document.getElementById('Supermarket_Budget_MaxSum'); if (objMaxBudgetSum) { var budgetSum = parseFloat(objMaxBudgetSum.innerHTML); if (objLeftBudgetSum && (budgetSum > 0)) { if (budgetSum >= sum) { objLeftBudgetSum.innerHTML = 'остаток бюджета: ' + zeros4Money(Money_Round(parseFloat(budgetSum) - sum, 2)); } else { objLeftBudgetSum.innerHTML = 'перерасход бюджета: ' + zeros4Money(Money_Round( - parseFloat(budgetSum) + sum, 2)); } } } } // function Supermarket_Budget_ShowInput() { var d = document; var str = prompt('ВтхфшЄх тр° сюфцхЄ:', 10000); if (parseFloat(str) > 0) { sum = parseFloat(str); objAmount = d.getElementById('Supermarket_TotalAmount'); objMaxBudgetSum = d.getElementById('Supermarket_Budget_MaxSum'); objLeftBudgetSum= d.getElementById('Supermarket_Budget_LeftSum'); objMaxBudgetSum.innerHTML = zeros4Money(sum); Supermarket_Budget_SetRest(parseFloat(objAmount.innerHTML)); setCookie('Supermarket_Budget_Sum', sum); } else { alert('НхтхЁэыщ ттюф!'); } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// var isIE = document.all ? true : false; var preCount = 0; // // ----------------------------- SEARCH ----------------------------------------- // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function Supermarket_Search_HideDiv() { document.getElementById('searchDiv').style.display = 'none'; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function Supermarket_Search_ShowDiv() { document.getElementById('searchDiv').style.display = ''; } function Supermarket_Filters_HideDiv() { document.getElementById('filtersDiv').style.display = 'none'; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function Supermarket_Filters_ShowDiv() { document.getElementById('filtersDiv').style.display = ''; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function Supermarket_Search_ManageAdditionalCharacts(str, id, label, currentRid) { if (str == 'none') { document.getElementById('whereToSearch').value = 1135; } else { document.getElementById('whereToSearch').value = currentRid; } document.searchForm.submitButton.value = label; for(var i = 0; i <= id; i++) { if (document.getElementById('additionalCharacts' + i)) { document.getElementById('additionalCharacts' + i).style.display = str; } if(document.getElementById('filter_' + i)) { document.getElementById('filter_' + i).disabled = (str == 'none'); } if(document.getElementById('filter_min_' + i)) { document.getElementById('filter_min_' + i).disabled = (str == 'none'); } if(document.getElementById('filter_max_' + i)) { document.getElementById('filter_max_' + i).disabled = (str == 'none'); } } } // ЏҐаҐбзҐв Є®а§Ё­л ЇаЁ Ё§¬Ґ­Ґ­ЁЁ зЁб«  в®ў а®ў ў Ё­Їг⥠//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function checkArticulsForm() { var d = document; var f = d.articulsForm; var found = 0; for(var i = 0; i < f.elements.length; i++) { var e = f.elements[i]; var e_ = f.elements[i + 1]; if (e.name == 'articul') { if (e.value != '' && parseInt(e_.value) > 0) { found = 1; } else if (e.value != '' || (e_.value != '' && e_.value != '0')) { alert('Неверные данные!'); found = 0; break; // e.value = ''; // e_.value = ''; } } } if (found == 1) { return true; } else { return false; } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function processParam(id) { a = document.getElementById("param" + id); if (a.className != "buttonPressed") { Cookie(id + ":1", 'params', true, 'add'); a.className = "buttonPressed"; } else { Cookie(id + ":0", 'params', true, 'replace'); a.className = "buttonNotPressed"; } } function turnOnOffSearchDiv() { var div = document.getElementById('searchFormDiv'); var btn = document.getElementById('searchFormTurnOnOffButton'); if (div && btn) { if (div.getAttribute('status') == 'on') { div.setAttribute('status', 'off'); div.style.display = 'none'; btn.value = btn.getAttribute('showLabel'); } else { div.setAttribute('status', 'on'); div.style.display = ''; btn.value = btn.getAttribute('hideLabel'); } } } // function Supermarket_Search_SetAvailability(obj) { if (obj.checked) { setCookie('availability', 1); } else { setCookie('availability', 0); } var l = document.location + ''; if (l.match(/set_cookie/)) { l = document.location; } else if (l.match(/\?/)) { l += '&set_cookie=1'; } else { l += '/?set_cookie=1'; } if (document.location == l) { location.reload(); } else { document.location = l; } } // var Supermarket_Search_MousePressed = false; var Supermarket_Search_MousePressedX = 0; var Supermarket_Search_MousePressedY = 0; var Supermarket_Search_MousePressedRelativeX = 0; var Supermarket_Search_MousePressedRelativeY = 0; // function Supermarket_Search_MouseUp(e) { Supermarket_Search_MousePressed = false; } // function Supermarket_Search_MouseDown(e) { if (typeof e == 'undefined') e = event; var d = document; var div = document.getElementById('searchDiv'); Supermarket_Search_MousePressed = true; Supermarket_Search_MousePressedX = e.clientX; Supermarket_Search_MousePressedY = e.clientY; Supermarket_Search_MousePressedRelativeX = e.clientX - div.offsetLeft; Supermarket_Search_MousePressedRelativeY = e.clientY - div.offsetTop; } function Supermarket_Search_MouseMove(e) { if (typeof e == 'undefined') e = event; var d = document; var div = document.getElementById('searchDiv'); if (div) { // if ((div.style.posLeft > e.clientX) || ((div.style.posLeft + div.style.width) > e.clientX) ) { // Supermarket_Search_MousePressed = false; } if (Supermarket_Search_MousePressed) { div.style.left = (e.clientX - Supermarket_Search_MousePressedRelativeX); div.style.top = (e.clientY - Supermarket_Search_MousePressedRelativeY); } } } function Supermarket_Filters_HideDiv() { document.getElementById('filtersDiv').style.display = 'none'; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function Supermarket_Filters_ShowDiv() { document.getElementById('filtersDiv').style.display = ''; } // function Supermarket_Compare_HideDiv() { obj = document.getElementById('Supermarket_Compare_Div'); if (obj) { obj.style.display = 'none'; } } // function Supermarket_Compare_ShowDiv() { obj = document.getElementById('Supermarket_Compare_Div'); if (obj) { obj.style.display = ''; } } function Supermarket_SetShowingPics(obj) { if (obj.checked) { setCookie('Supermarket_IsShowPics', 1); } else { setCookie('Supermarket_IsShowPics', 0); } var l = document.location + ''; if (l.match(/set_cookie/i)) { l = document.location; } else if (l.match(/\?/)) { l += '&set_cookie=1'; } else { l += '/?set_cookie=1'; } if (document.location == l) { location.reload(); } else { document.location = l; } } function User_Counter_PageLoad() { try { var node = self.document.getElementById("counter_page_load_time"); var today = new Date(); node.src = node.getAttribute("counter_src") + "&time_value=" + today.valueOf(); } catch (e) { return; } }function Js_User_Modules_Guestbook_ConfirmDelete(message, url, mode) { if (typeof(mode) == "number" && mode == 0) { alert(message); } else if(confirm(message)) { self.location = url; } } function Js_User_Modules_DocumentViewer_Switch(id) { var prefix = "Id_User_Modules_DocumentViewer_"; try { var node = self.document.getElementById(prefix + id); if (node.style.display == "none") { node.style.display = ""; } else { node.style.display = "none"; } var switchOn = self.document.getElementById(prefix + "On_" + id); var switchOff = self.document.getElementById(prefix + "Off_" + id); if (switchOn.style.display == "none") { switchOn.style.display = ""; switchOff.style.display = "none"; } else { switchOn.style.display = "none"; switchOff.style.display = ""; } } catch (e) { } } function isUndef(name) { return ("" + name == "undefined"); } // возвращает float как строку с десятичным разделителем "." // value - значение // scale - кол-во знаков после десятичного разделителя // flag - если true, то вместо 0 возвращает пустую строку function ftos(str, scale, flag) { if (isUndef(scale)) scale = -1; else { scale = parseInt(scale); if (isNaN(scale)) scale = -1; if (scale > 5) scale = 5; } var s = String(str); //.replace(",","."); s = s.replace(",","."); var i = s.indexOf("."); if (i == 0) { s = "0" + s; i = 1; } if (scale < 0) { if (i > 0) { var j = s.length-1; while (j > 0) { if (s.charAt(j)=="0") j--; else { if (s.charAt(j)==".") j--; break; } } s = s.substr(0,j+1); } } else if (scale == 0) { if (i > 0) s = s.substr(0,i); } else { if (i > 0) { var j = i+scale+1; s = s.substr(0, j); while (s.length < j) s += "0"; } else if (s.length > 0) { s += "."; for (i=0; i < scale; i++) s += "0"; } } if (isUndef(flag)) flag= false; if (flag) { var f = parseFloat(s); if (isNaN(f) || f == 0) return ""; } return s; } // function Money_Round(xx, acc) { if (isNaN(xx) || xx == 00) return 0; acc = Math.ceil(acc); if(isNaN(acc) || acc <= 0) acc = 0; return (Math.floor(xx * Math.pow(10, acc) + 0.5) / Math.pow(10, acc)); } // function zeros4Money(sum) { if (sum == parseInt(sum)) { sum = sum + '.00'; } else if (sum == parseInt(sum * 10) / 10) { sum = sum + '0'; } else { } return sum; } // //*** Decoding (for Visit) function D(z, n){ var k="", ar=new Array(); ar=z.split(","); for(i=0;i 0) auxEv = "" else auxEv = "" if (level>0) if (lastNode) /* the last 'brother' in the children array */ { this.renderOb(leftSide + auxEv + "") leftSide = leftSide + "" + "" + "" this.isLastNode = 1 } else { this.renderOb(leftSide + auxEv + "") leftSide = leftSide + "" + "" + "" this.isLastNode = 0 } else this.renderOb("") if (nc > 0) { level = level + 1 for (i=0 ; i < this.nChildren; i++) { if (i == this.nChildren-1) this.children[i].initialize(level, 1, leftSide) else this.children[i].initialize(level, 0, leftSide) } } } function drawFolder(leftSide) { if (browserVersion == 2) { if (!doc.yPos) doc.yPos=8 doc.write("") } doc.write("") doc.write("") doc.write(leftSide) this.outputLink() doc.write("") doc.write("") if (USETEXTLINKS) { this.outputLink() doc.write(this.desc + "") } else doc.write(this.desc) doc.write("") doc.write("") if (browserVersion == 2) { doc.write("") } if (browserVersion == 1) { this.navObj = doc.all["folder"+this.id] this.iconImg = doc.all["folderIcon"+this.id] this.nodeImg = doc.all["nodeIcon"+this.id] } else if (browserVersion == 2) { this.navObj = doc.layers["folder"+this.id] this.iconImg = this.navObj.document.images["folderIcon"+this.id] this.nodeImg = this.navObj.document.images["nodeIcon"+this.id] doc.yPos=doc.yPos+this.navObj.clip.height } } function outputFolderLink(linkurl) { if (this.hreference) { doc.write(" 0) doc.write("onMouseDown='clickOnFolder("+this.id+")'>") }else{ if (this.id!=0) // link ! doc.write("") /* 100600 */ } } function addChild(childNode) { this.children[this.nChildren] = childNode this.nChildren++ return childNode } function folderSubEntries() { var i = 0 var se = this.nChildren for (i=0; i < this.nChildren; i++){ if (this.children[i].children) //is a folder se = se + this.children[i].subEntries() } return se } /* Definition of class Item (a document or link inside a Folder) */ function Item(itemDescription, itemLink) { /* constant data */ this.desc = itemDescription this.link = itemLink this.id = -1 //initialized in initalize() this.navObj = 0 //initialized in render() this.iconImg = 0 //initialized in render() this.iconSrc = "images/m-diop.gif" /* methods */ this.initialize = initializeItem this.createIndex = createEntryIndex this.hide = hideItem this.display = display this.renderOb = drawItem this.totalHeight = totalHeight } function hideItem() { if (browserVersion == 1) { if (this.navObj.style.display == "none") return this.navObj.style.display = "none" } else { if (this.navObj.visibility == "hiden") return this.navObj.visibility = "hiden" } } function initializeItem(level, lastNode, leftSide) { this.createIndex() // if (level>1) if (lastNode) //the last 'brother' in the children array { this.renderOb(leftSide + "" + "" + "") leftSide = leftSide + "" } else { this.renderOb(leftSide + "" + "" + "") leftSide = leftSide + "" } // if (level==0) this.renderOb("") // if (level==1) // { // this.renderOb(leftSide + "" + "" + "") // leftSide = leftSide + "" // } } function drawItem(leftSide) { if (browserVersion == 2) doc.write("") doc.write("") doc.write("") doc.write(leftSide) if (this.link) doc.write("") doc.write("") doc.write("") doc.write("") if (USETEXTLINKS && this.link && this.id != a) doc.write("" + this.desc + "" + "") else doc.write("" + this.desc + "") doc.write("") if (browserVersion == 2) doc.write("\n") if (browserVersion == 1) { this.navObj = doc.all["item"+this.id] this.iconImg = doc.all["itemIcon"+this.id] } else if (browserVersion == 2) { this.navObj = doc.layers["item"+this.id] this.iconImg = this.navObj.document.images["itemIcon"+this.id] doc.yPos=doc.yPos+this.navObj.clip.height } } /* Methods common to both objects (pseudo-inheritance) */ function display() { if (browserVersion == 1) this.navObj.style.display = "block" else this.navObj.visibility = "show" } function createEntryIndex() { this.id = nEntries indexOfEntries[nEntries] = this nEntries++ } /* total height of subEntries open */ function totalHeight() //used with browserVersion == 2 { var h = this.navObj.clip.height var i = 0 if (this.isOpen) //is a folder and _is_ open for (i=0 ; i < this.nChildren; i++) h = h + this.children[i].totalHeight() return h } function clickOnFolder(folderId) { var clicked = indexOfEntries[folderId] if (!clicked.isOpen) clickOnNode(folderId) return if (clicked.isSelected) return } function clickOnNode(folderId) { var clickedFolder = 0 var state = 0 clickedFolder = indexOfEntries[folderId] state = clickedFolder.isOpen clickedFolder.setState(!state) return false; } /* Auxiliary Functions for Folder-Tree backward compatibility */ function gFld(description, ref, ch) { var t=''; if(ch>0)t=' CHECKED ' if (UCB==1) (description=''+description) if (DWIN) ref = "javascript:go(\""+ref+"\")" folder = new Folder(description, ref) return folder } function gLnk(target, description,ref,ch) { var t=''; if(ch>0)t=' CHECKED ' fullLink = "" d="" if (UCB==1) (description=''+description) if (DWIN && ref) ref = "javascript:go(\""+ref+"\")" if (ref) if (target==0) fullLink = "'"+ref+"' target=\"" + TFRAME + "\"" else fullLink = "'"+ref+"' target=_blank" linkItem = new Item(description, fullLink) return linkItem } function insFld(parentFolder, childFolder) { return parentFolder.addChild(childFolder) } function insDoc(parentFolder, document) { parentFolder.addChild(document) } function initializeDocument() { if (doc.all) browserVersion = 1 /* IE */ else if (doc.layers) { browserVersion = 2 /* NS */ self.onresize = self.doResize } else browserVersion = 0 /* other */ foldersTree.initialize(0, 1, "") foldersTree.display() if (browserVersion > 0) { doc.write(" ") /* close the whole tree */ clickOnNode(0) /* open the root folder */ clickOnNode(0) } this.folder0.style.display = "none" } function openToActive(ActiveIndex, ActiveLevel) { var ai = ActiveIndex; var al = ActiveLevel; do { if(this.indexOfEntries[ai].children){ clickOnNode(ai); al--; } ai--; } while (al>1); } function go(s) { onerror=goNewW; /* IE */ sErrREF = s; /* IE */ if (!opener.closed) opener.document.location=s; else window.open(s,"newW"); /* NS */ } function goNewW() /* IE */ { window.open(sErrREF,"newW"); } function doResize() /* NS */ { document.location.reload(); } function hideLayer(layerName){ eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"'); } indexOfEntries = new Array nEntries = 0 doc = document browserVersion = 0 selectedFolder=0 sErrREF = ""; /* IE */ layerRef="document.all"; styleSwitch=".style"; if (navigator.appName == "Netscape") { layerRef="document.layers"; styleSwitch=""; }