var numGoods = new Array(); var numGoodsB = new Array(); var charCodes = new Array(' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','!','"','#','$','%','&',"'",'(',')','*','+',',','-','.','/','0','1','2','3','4','5','6','7','8','9',':',';','<','=','>','?','@','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','[','\\',']','^','_','`','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','{','|','}','~','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','',''); function decodeBase64(string) { string = string.split('+').join(' '); var comps = string.split('%'); var out_str = '' for (var i=0;i0) goods[arr[0]] = [am,pr,nm]; } return goods; } function CheckLoadFirst(form) { goods = GetGoodsFromBasket(); if (form) { var el = form.elements; ss = el.length; for (var i=0;i 0) { el[i].value = goods[id][0]; showControlDouble(id); el[i].style.fontWeight = 'bold' el[i].style.color = 'black' OnEditChange(id,el[i]); } else { //el[i].style.color = 'gray' el[i].style.fontWeight = 'bold' el[i].style.align = 'center' el[i].value='1'; } } } } UpdateWholePrice(); } function OnEditChange(id,edit) { SomeChanges = true; edit.value = parseInt(edit.value); if (!(edit.value > 0)) {edit.value = '0'}; if (!document.all('whole_price_all')) { var el = document.getElementById('amount_div_'+id) if (edit.value == 0) { if (el) { el.style.visibility = 'hidden'; el.style.display = 'none'; } } else { if (el) { el.style.visibility = 'visible'; el.style.display = 'block'; } var el1 = document.getElementById('amount_amount_'+id) if (el1) { el1.innerHTML = ': '+edit.value; } } } UpdateWholePrice(); } function UpdateWholePrice() { var b_div = document.getElementById('basket_div'); var c_div = document.getElementById('price_caption'); var v_div = document.getElementById('price_value'); var b_div2 = document.getElementById('basket_div2'); var c_div2 = document.getElementById('price_caption2'); var v_div2 = document.getElementById('price_value2'); var bInfo = document.getElementById('bInfo'); var b_div3 = document.getElementById('basket_div3'); var c_div3 = document.getElementById('price_caption3'); var v_div3 = document.getElementById('price_value3'); if (b_div == null && c_div == null) return; var goods = GetGoodsFromBasket(); var glob_style = "color:#003580"; var glob_st = ""; var summ = 0; var cnt = 0; for (i in goods) { var amount = parseInt(goods[i][0]); // alert(goods[i][1]); var pr = parseFloat(goods[i][1]); if (isNaN(amount)){ amount=0;} if (amount==0) continue; if (isNaN(pr)) pr=0; summ+=pr*amount; cnt++; } var b_clear = document.getElementById('clear_backet'); var smallBaskerText = ''; var s=''; var sc=''; var sv=''; var text_pozic = " "; var srcPic = document.getElementById('uspic').src; var unicum = Math.random(); if (cnt > 1 || cnt == 0) {text_pozic = " "}; if (b_div.style.display.visible != 'none') { if (cnt==0) { s+='
'; bInfo.innerHTML = ''; smallBaskerText += ' '; if (b_clear.style.display == "block") { b_clear.style.display = "none"; } } else { s+='
' + cnt + text_pozic + '
' + rus_price(summ)+' .
' + '
'; bInfo.innerHTML = ''; smallBaskerText += '' + cnt + '' + text_pozic + '
' + rus_price(summ)+' .
' + '
'; if (b_clear.style.display == "none") { b_clear.style.display = "block"; } } } if (b_div != null) b_div.innerHTML=s; if (c_div != null) c_div.innerHTML=sc; if (v_div != null) v_div.innerHTML=sv; if (b_div3 != null) b_div3.innerHTML=smallBaskerText; if (c_div3 != null) c_div3.innerHTML=sc; if (v_div3 != null) v_div3.innerHTML=sv; if (v_div != null) { v_div.innerHTML=rus_price(summ)+' .'; } if (document.getElementById('price_value_b') != null ) { document.getElementById('price_value_b').innerHTML = rus_price(summ)+' .'; var chSum = parseFloat(summ); if (chSum < 10000) { document.getElementById('twoSh').style.display = 'none'; document.getElementById('othadd').style.display = 'none'; document.getElementById('other_address').style.display = 'none'; if (document.getElementById('treSh')) { document.getElementById('treSh').style.display = 'none'; document.getElementById('treShTab').style.display = 'none'; } document.getElementById('noteSum').innerHTML = " 10 . , , ." } else { document.getElementById('noteSum').innerHTML = ""; document.getElementById('twoSh').style.display = 'block'; document.getElementById('other_address').style.display = 'block'; if (document.getElementById('treSh')) { document.getElementById('treSh').style.display = 'block'; document.getElementById('treShTab').style.display = 'block'; } } } if (document.getElementById('add_value_new') != null ) { document.getElementById('add_value_new').innerHTML = cnt + text_pozic; } var smallBaskerText = ''; if (b_div2 != null) b_div2.innerHTML=smallBaskerText; } function rus_price(value) { value = ""+parseFloat(Math.round(value*100)/100); var parts = value.split('.'); if (!parts[1]) parts[1]='00'; while ((parts[1]).length<2) parts[1]+='0'; ctr = 0; for (var i = parts[0].length - 1; i>=1; i--) { ctr++; if (ctr != 3) continue; parts[0] = parts[0].substr(0,i) + ' ' + parts[0].substr(i,parts[0].length - i); ctr = 0; } value = parts.join(','); return value; } function AmountChange(form,id,delta) { basket = false; if (!form) { form = document.curform basket = true; } el = form.elements['amount_'+id]; if (el) { /* - */ var tmp = numGoods[id]; if (tmp) { var summ = parseInt(el.value) + delta; if (summ == tmp) { el.style.fontWeight = 'bold'; el.value = tmp; } else if (summ > tmp) { el.style.fontWeight = 'bold'; el.value = tmp; fadeInput(el, 0, '#808080'); el.style.border = '1px solid red'; el.style.backgroundColor = "red"; el.style.color = "#FFFFFF"; } else { el.value = summ; } } else { el.value = parseInt(el.value) + delta; } if (el.value == 'NaN' || el.value < 0 || el.value == 0) { el.value = '0'; el.style.color = 'gray'; el.style.fontWeight = 'bold'; document.getElementById('orderControl_' + id).style.display = 'none'; document.getElementById('orderBuy_' + id).style.display = 'block'; } } if (basket) { UpdateWholePrice(); BasketChanged = 1; el.onchange(); } BuyPressCatalog(form, id); } function AmountChangeConfiguration(form,id,delta) { basket = false; if (!form) { form = document.curform basket = true; } el = form.elements['amount']; if (el) { var summ = parseInt(el.value) + delta; el.value = summ; if (el.value == 'NaN' || el.value < 0 || el.value == 0) { el.value = '0'; el.style.fontWeight = 'bold'; document.getElementById('orderControl_config').style.display = 'none'; document.getElementById('orderBuy_config').style.display = 'block'; } } if (basket) { UpdateWholePrice(); BasketChanged = 1; el.onchange(); } var tbl = document.getElementById('configTable'); BuyPressConfiguration(form, id, tbl); } function BuyPressConfiguration(form, id, tbl) { if (!checkConfiguration()) return false; amount_field = form['amount']; if (amount_field) { am = parseInt(amount_field.value); if (isNaN(am) || am <= 0) { amount_field.value = 1; document.getElementById('orderControl_config').style.display = 'none'; document.getElementById('orderBuy_config').style.display = 'block'; } //if (isNaN(am)) am = 0; pr = recalcSum(); goods = GetGoodsFromBasket(); var add = true; var config_arr = new Array; rows = tbl.rows; for (var i=0;i tmp) { amount.value = tmp; BuyPress(form, id, update_whole); fadeInput(amount, 0, '#808080'); amount.style.border = '1px solid red'; amount.style.backgroundColor = "red"; amount.style.color = "#FFFFFF"; } else { amount.style.border = '1px solid #808080'; BuyPress(form, id, update_whole); createFadeItem(id, 0); } } return false; } function AmountChangeItem(form,id,delta) { basket = false; if (!form) { form = document.curform basket = true; } el = form.elements['amount_'+id]; if (el) { /* - */ var tmp = numGoods[id]; if (tmp) { var summ = parseInt(el.value) + delta; if (summ == tmp) { el.style.fontWeight = 'bold'; el.value = tmp; } else if (summ > tmp) { el.style.fontWeight = 'bold'; el.value = tmp; fadeInput(el, 0, '#808080'); el.style.border = '1px solid red'; el.style.backgroundColor = "red"; el.style.color = "#FFFFFF"; } else { el.value = summ; } } else { el.value = parseInt(el.value) + delta; } if (el.value == 'NaN' || el.value < 0 || el.value == 0) { el.value = '0'; el.style.color = 'gray'; el.style.fontWeight = 'bold'; document.getElementById('orderControl_' + id).style.display = 'none'; document.getElementById('orderBuy_' + id).style.display = 'block'; } } if (basket) { UpdateWholePrice(); BasketChanged = 1; el.onchange(); } BuyPressCatalogItem(form, id); } /* // */ function BuyPressInterface(form, id, update_whole) { amount = form['amount_'+id]; var tmp = numGoods[id]; if (amount) { am = parseInt(amount.value); if (isNaN(am) || am <= 0) { am = 1; document.getElementById('orderControl_' + id).style.display = 'none'; document.getElementById('orderBuy_' + id).style.display = 'block'; BuyPress(form, id, update_whole); } else if (am == tmp) { amount.value = tmp; BuyPress(form, id, update_whole); //createFade(id); } else if (am > tmp) { amount.value = tmp; BuyPress(form, id, update_whole); fadeInput(amount, 0, '#808080'); amount.style.border = '1px solid red'; amount.style.backgroundColor = "red"; amount.style.color = "#FFFFFF"; } else { amount.style.border = '1px solid #808080'; BuyPress(form, id, update_whole); createFade(id, 0); } } return false; } function BuyPress(form, id, update_whole) { amount = form['amount_'+id]; if (amount) { am = parseInt(amount.value); if (isNaN(am)) am = 0 pr = parseFloat(Goods[id]); PutInBasket(id,am, pr, update_whole); amount = form['amount_'+id]; if (am == 0) { amount.style.color = 'gray' amount.style.fontWeight = 'normal' } else { amount.style.color = 'black' amount.style.fontWeight = 'bold' } } return false; } function PutInBasket(id, amount, price, update_whole) { goods = GetGoodsFromBasket(); goods[id]=[amount, price]; UpdateBasketCookie(goods); if (update_whole == 1) //UpdateWholePrice(); UpdateWholePriceOnlyLite(0); } function setCookie(name, value,expires) { //alert(name + "=" + value); document.cookie = name + "=" + escape(value)+"; path=/; "+((expires)?"":"expires=Thursday, 31-Dec-2020 23:59:59 GMT;"); } function UpdateBasketCookie(basket) { var goods_arr = new Array; for (i in basket) { if (parseInt(basket[i][0]) == 0) continue; goods_arr[goods_arr.length] = i+":"+basket[i][0]+":"+basket[i][1]; } setCookie('basket',goods_arr.join("|"),'true'); } function ClearBasket() { setCookie('basket','','true'); } function DeleteFromBasket(id) { goods = GetGoodsFromBasket(); new_goods = new Array; for (i in goods) { if (i != id) { new_goods[i] = goods[i]; } } UpdateBasketCookie(new_goods); } function BuyPressBasket(form, id) { amount = form['amount_'+id]; goods = GetGoodsFromBasket(); am_changed = false; if (amount) { am = parseInt(amount.value); if (isNaN(am) || am == 0) { am = 0; hiddeBoxControl(id); } for (i in goods) { if (i == id) { if (goods[i][0] != am) { am_changed = true; break; } } } } if (am_changed) BuyPressCatalog( form, id); return true; } function open_basket() { document.getElementById('backetView').src = "/basket"; //win = window.open('/basket/','','width=700,height=450, status=0, resizable=1, menubar=0, scrollbars=yes'); //win.focus(); return false; } function open_filter(div_id, fq) { url = '/filter/' if (div_id != null) url = url + '?div=' + div_id; url += fq; win = window.open(url,'','width=700,height=450, status=0, resizable=1, menubar=0, scrollbars=yes'); win.focus(); return false; } function open_order(id) { var wdbcw = screen.width; var wdbch = screen.height; var to_w_m = parseInt(wdbcw/2 + (wdbcw/2)/2); var to_h_m = parseInt(wdbch/2 + (wdbch/2)/2); window.status = ""; win = window.open('/order?id=' + id,'',"top=0, left=0, resizable=1, toolbar=0, menubar=0, location=0, directories=0, scrollbars=1, width="+to_w_m+",height="+to_h_m); win.focus(); return false; } function open_config(id) { win = window.open('/config?id=' + id,'','width=700,height=500, status=0, resizable=1, menubar=0, scrollbars=yes'); win.focus(); return false; } function show_staff(lnk, config_id) { tbl = document.getElementById('BasketTable'); for (i=0;i max_width) win_w = max_width; if (win_h > max_height) win_h = max_height; win = window.open("", "", "status=1, resizable=1, toolbar=1, scrollbars=1, width="+win_w+", height="+win_h); win.document.write(''); win.focus(); } ////////////////////////////////////////////////////////////// function NotBlock(iframe) { if (iframe.document.readyState == null || iframe.document.readyState == 'complete') { return true; } else { alert(' . .'); return false; } } /* */ function openItem(url) { var wdbcw = screen.width; var wdbch = screen.height; var to_w_m = parseInt(wdbcw/2 + (wdbcw/2)/2); var to_h_m = parseInt(wdbch/2 + (wdbch/2)/2); window.status = ""; objNewWindow = window.open(url,'', "top=0, left=0, resizable=1, toolbar=0, menubar=0, location=0, directories=0, scrollbars=1, width="+to_w_m+",height="+to_h_m); /* window.event.cancelBubble = true; window.event.returnValue = false; */ } /* */ function openCompare(target) { var wdbcw = screen.width; var wdbch = screen.height; var to_w_m = parseInt(wdbcw/2 + (wdbcw/2)/2); var to_h_m = parseInt(wdbch/2 + (wdbch/2)/2); window.status = ""; objNewWindow = window.open('', target, "top=0, left=0, resizable=1, toolbar=0, menubar=0, location=0, directories=0, scrollbars=1, width="+to_w_m+",height="+to_h_m); document.compareform.submit(); } function openOrderPrint(target) { var wdbcw = screen.width; var wdbch = screen.height; var to_w_m = parseInt(wdbcw/2 + (wdbcw/2)/2); var to_h_m = parseInt(wdbch/2 + (wdbch/2)/2); window.status = ""; objNewWindow = window.open(target, "print", "top=0, left=0, resizable=1, toolbar=0, menubar=0, location=0, directories=0, scrollbars=1, width="+to_w_m+",height="+to_h_m); } function UpdateWholePriceOnlyLite(r) { if (!r) {var r = 0} var b_div = document.getElementById('basket_div'); var c_div = document.getElementById('price_caption'); var v_div = document.getElementById('price_value'); var b_div2 = document.getElementById('basket_div2'); var c_div2 = document.getElementById('price_caption2'); var v_div2 = document.getElementById('price_value2'); var bInfo = document.getElementById('bInfo'); var b_div3 = document.getElementById('basket_div3'); var c_div3 = document.getElementById('price_caption3'); var v_div3 = document.getElementById('price_value3'); if (b_div == null && c_div == null) return; var goods = GetGoodsFromBasket(); var glob_style = "color:#003580"; var glob_st = ""; var summ = 0; var cnt = 0; for (i in goods) { var amount = parseInt(goods[i][0]); // alert(goods[i][1]); var pr = parseFloat(goods[i][1]); if (isNaN(amount)){ amount=0;} if (amount==0) continue; if (isNaN(pr)) pr=0; summ+=pr*amount; cnt++; } var b_clear = document.getElementById('clear_backet'); var smallBaskerText = ''; var s=''; var sc=''; var sv=''; var text_pozic = " "; var srcPic = document.getElementById('uspic').src; var unicum = Math.random(); if (cnt > 1 || cnt == 0) {text_pozic = " "}; if (b_div.style.display.visible != 'none') { if (cnt==0) { s+='
'; bInfo.innerHTML = ''; smallBaskerText += ' '; if (b_clear.style.display == "block") { b_clear.style.display = "none"; } } else { s+='
' + cnt + text_pozic + '
' + rus_price(summ)+' .
' + '
'; bInfo.innerHTML = ''; if (b_clear.style.display == "none") { b_clear.style.display = "block"; } if (r == 1) { if (document.getElementById('sPv').value != cnt) { smallBaskerText += '' + cnt + '' + text_pozic + '
' + rus_price(summ)+' .
' + '
'; document.getElementById('sPv').value = cnt; } else { smallBaskerText += '' + cnt + '' + text_pozic + '
' + rus_price(summ)+' .
' + '
'; } } else if (r == 2) { smallBaskerText += '' + cnt + '' + text_pozic + '
' + rus_price(summ)+' .
' + '
'; document.getElementById('sPv').value = cnt; } else { if (document.getElementById('sPv').value != cnt) { smallBaskerText += '' + cnt + '' + text_pozic + '
' + rus_price(summ)+' .
' + '
'; document.getElementById('sPv').value = cnt; } else { smallBaskerText += '' + cnt + '' + text_pozic + '
' + rus_price(summ)+' .
' + '
'; } } } } if (b_div != null) b_div.innerHTML=s; if (c_div != null) c_div.innerHTML=sc; if (v_div != null) v_div.innerHTML=sv; if (b_div3 != null) b_div3.innerHTML=smallBaskerText; if (c_div3 != null) c_div3.innerHTML=sc; if (v_div3 != null) v_div3.innerHTML=sv; if (v_div != null) { v_div.innerHTML=rus_price(summ)+' .'; } if (document.getElementById('price_value_b') != null ) { document.getElementById('price_value_b').innerHTML = rus_price(summ)+' .'; var chSum = parseFloat(summ); if (chSum < 10000) { document.getElementById('twoSh').style.display = 'none'; document.getElementById('othadd').style.display = 'none'; document.getElementById('other_address').style.display = 'none'; if (document.getElementById('treSh')) { document.getElementById('treSh').style.display = 'none'; document.getElementById('treShTab').style.display = 'none'; } document.getElementById('noteSum').innerHTML = " 10 . , , ." } else { document.getElementById('noteSum').innerHTML = ""; document.getElementById('twoSh').style.display = 'block'; document.getElementById('other_address').style.display = 'block'; if (document.getElementById('treSh')) { document.getElementById('treSh').style.display = 'block'; document.getElementById('treShTab').style.display = 'block'; } } } if (document.getElementById('add_value_new') != null ) { document.getElementById('add_value_new').innerHTML = cnt + text_pozic; } var smallBaskerText = ''; if (b_div2 != null) b_div2.innerHTML=smallBaskerText; }