// 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) { if(!CheckTxtField(document.order.namecart.value, "Наименование заказа")) return false; if(!CheckTxtField(document.order.fio.value, (type == 'f') ? 'ФИО': 'Контактное лицо')) return false; if(!CheckTxtField(document.order.tel.value, "Телефон")) return false; if(!CheckTxtField(document.order.mail.value, "E-mail")) return false; if(!CheckTxtField(document.order.address_dost.value, "Адрес доставки")) return false; if(!CheckTxtField(document.order.time_dost.value, "Время доставки")) return false; if(type == "u") { if(!CheckTxtField(document.order.nameKontr.value, "Название организации")) return false; if(!CheckTxtField(document.order.address_ur.value, "Юридический адрес")) return false; if(!CheckTxtFieldN(document.order.inn.value, "ИНН", 12)) return false; if(!CheckTxtFieldN(document.order.kpp.value, "kpp", 9)) 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; } 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, position) { // alert(document.cookie); old_count = parseInt(old_count); new_count = parseInt(new_count); var d = document; var objGoodPrice = d.getElementById('Supermarket_Good_PriceRub' + good_id); var good_price = 0; if (objGoodPrice) { good_price = parseFloat(objGoodPrice.innerHTML); if (isNaN(good_price)) { good_price = 0; } } var objGoodCount = d.getElementById('Supermarket_Good_Count' + good_id); if (!objGoodCount) { alert('No GoodCount!'); return; } if (isNaN(new_count) || new_count < 0) { objGoodCount.value = old_count; return; } var objTotalGoodsCount = d.getElementById('Supermarket_TotalGoodsCount'); var objTotalAmount = d.getElementById('Supermarket_TotalAmount'); 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 (!noMoney) { var old_total_amount = parseFloat(objTotalAmount.innerHTML); if (isNaN(old_total_amount)) { old_total_amount = 0; } var new_total_amount = old_total_amount + (new_count - old_count) * good_price; if (isNaN(new_total_amount)) { new_total_amount = 0; } objTotalAmount.innerHTML = zeros4Money(Money_Round(new_total_amount, 2)); 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 = 'smRowSelected'; var tds = document.getElementsByTagName("td"); for(var i = 0; i < tds.length; i++) { var td = tds[i]; if (td.id.match(re)) { td.className = 'smCellSelected'; } } } 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 = 'smRow' + ms[1]; } } if (tr) { if (position % 2 == 1) { tr.className = 'smRow1'; } else { tr.className = 'smRow0'; } } } } } // function Supermarket_Good_IncToBasket(good_id, type, 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, position) } // function Supermarket_Good_DecToBasket(good_id, type, 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; if (new_count < 0) { new_count = 0; } Supermarket_Good_AddToBasket(good_id, old_count, new_count, type, position) } // function Supermarket_Good_ZeroToBasket(good_id, type, 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; Supermarket_Good_AddToBasket(good_id, old_count, new_count, type, 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 N_SC(id) { var Me = self.document.getElementById('Me' + id); var Childs = self.document.getElementById('Childs' + id); // alert(arg_SwitchId); if(Me && Childs && Me.getAttribute("N_Opened") == "1") { Me.setAttribute("N_Opened", "0"); Me.className = Me.getAttribute("class2"); Childs.className = "N_H"; } else if (Me && Childs) { Me.setAttribute("N_Opened", "1"); Me.className = Me.getAttribute("class1"); Childs.className = "N_In"; } else { // alert(id); } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // 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; } //// function Page_Load() { var Node = self.document.getElementById("MaxId"); if(Node == null) return; if(Node.value == "" || Node.value == null) return; var ParentNode = self.parent.document.getElementById("MaxId"); if(ParentNode == null) return; ParentNode.value = Node.value; Node.value = ""; Node = self.document.getElementById("LoadingId"); if(Node == null) return; var FromNode = self.document.getElementById("root"); if(FromNode == null) return; var ToNode = self.parent.document.getElementById(Node.value); if(ToNode == null) return; for(i = 0; i < ToNode.childNodes.length; i++) ToNode.removeChild(ToNode.childNodes[i]); ImportNode(FromNode, ToNode); } function ImportNode(arg_FromNode, arg_ToNode) { if(arg_FromNode.hasChildNodes == false) return; for(var i = 0; i < arg_FromNode.childNodes.length; i++) { var FromNode = arg_FromNode.childNodes[i]; var ToNode = null; if(FromNode.nodeValue == null) { ToNode = arg_ToNode.ownerDocument.createElement(FromNode.tagName); for(var j = 0; j < FromNode.attributes.length; j++) { var Attribute = FromNode.attributes[j]; if(Attribute.nodeValue == null || Attribute.nodeValue == "" || Attribute.nodeValue == "undefined") continue; switch(Attribute.nodeName.toLowerCase()) { case "class": ToNode.className = Attribute.nodeValue; break; case "colspan": ToNode.colSpan = Attribute.nodeValue; break; default: ToNode.setAttribute(Attribute.nodeName, Attribute.nodeValue); } } } else ToNode = arg_ToNode.ownerDocument.createTextNode(FromNode.nodeValue); arg_ToNode.appendChild(ToNode); ImportNode(FromNode, ToNode); } } // USETEXTLINKS = 1 TFRAME="_self" DWIN=0 //for our script UCB=0 // 1 - use checkboxes 0 - dont use function Folder(folderDescription, hreference) { this.desc = folderDescription this.hreference = hreference this.id = -1 this.navObj = 0 this.iconImg = 0 this.nodeImg = 0 this.isLastNode = 0 /* dynamic data */ this.isOpen = true this.iconSrc = "images/m-diop.gif" this.children = new Array this.nChildren = 0 /* methods */ this.initialize = initializeFolder this.setState = setStateFolder this.addChild = addChild this.createIndex = createEntryIndex this.hide = hideFolder this.display = display this.renderOb = drawFolder this.totalHeight = totalHeight this.subEntries = folderSubEntries this.outputLink = outputFolderLink } function setStateFolder(isOpen) { var subEntries var totalHeight var fIt = 0 var i=0 if (isOpen == this.isOpen) return if (browserVersion == 2) { totalHeight = 0 for (i=0; i < this.nChildren; i++) totalHeight = totalHeight + this.children[i].navObj.clip.height subEntries = this.subEntries() if (this.isOpen) totalHeight = 0 - totalHeight for (fIt = this.id + subEntries + 1; fIt < nEntries; fIt++) indexOfEntries[fIt].navObj.moveBy(0, totalHeight) } this.isOpen = isOpen propagateChangesInState(this) } function propagateChangesInState(folder) { var i=0 if (folder.isOpen) { if (folder.nodeImg) if (folder.isLastNode) folder.nodeImg.src = "images/m-minus.gif" else folder.nodeImg.src = "images/m-minus.gif" folder.iconImg.src = "images/m-diop.gif" 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("
") doc.write(leftSide) this.outputLink() doc.write("") doc.write(" ") if (USETEXTLINKS) { this.outputLink() doc.write(this.desc + "") } else doc.write(this.desc) 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=""; }