function plus(pos){ $(pos).value++; var userInput = $(pos).value; $('sp'+pos).innerHTML = userInput; recalc(); return false; } function minus(pos){ var userInput = $(pos).value; if(userInput>1){ $(pos).value--; var userInput = $(pos).value; $('sp'+pos).innerHTML = userInput; } recalc(); return false; } function recalc (){ multiply(); sum(); discount(); result(); sum_weight(); all(); } function multiply() { var weight_items = $$('input.weight_field'); var res_items = $$('abbr.res_field'); var n11_items = $$('strong.n11'); var items = $$('input.field'); for (i=0;i300) { $('delivery').value = 0; $('delivery_text').innerHTML = '0' } else{ $('delivery').value = $('delivery_value').value; $('delivery_text').innerHTML = $('delivery').value } } function discount(){ var discount = $$('input.discount_value_field'); var count = $$('input.field'); var price = $$('input.price_field'); var dis = 0; for (i=0;i($('total').innerHTML*1+$('dis').innerHTML*1) ? ($('total').innerHTML*1+$('dis').innerHTML*1) : b; alert(b); $('bonus_text').innerHTML = '-' + b + 'грн'; $('bonus').value = -b; } recalc(); } function all(){ var all_sum = $('total').innerHTML*1 + $('dis').innerHTML *1+$('bonus').value*1 +$('delivery').value*1; if (all_sum<0) { all_sum = 0; } $('all_sum').innerHTML = all_sum; } function cartformreset(){ var items = $$('input.field'); for (i=0;i