'); $(el).append(g); $(g).show(); }
_uPostForm('',{type:'POST',url:'/shop/basket',data:{'mode':'clear'}});
ga_event('basket_clear');
return false;
}
function removeBasket(id){
if(lock_buttons) return false; else lock_buttons = 1;
$('#basket-item-'+id+' .sb-func').removeClass('remove').addClass('myWinLoadS').attr('title','');
_uPostForm('',{type:'POST',url:'/shop/basket',data:{'mode':'del', 'id':id}});
return false;
}
function add2Basket(id,pref){
if(lock_buttons) return false; else lock_buttons = 1;
var opt = new Array();
var err_msg = '';
$('#b'+pref+'-'+id+'-basket').attr('disabled','disabled');
$('#'+pref+'-'+id+'-basket').removeClass('done').removeClass('err').removeClass('add').addClass('wait').attr('title','');
$('#'+pref+'-'+id+'-options-selectors').find('input:checked, select').each(function(){
opt.push(this.id.split('-')[3]+(this.value !== '' ? '-'+this.value :''));
if(this.value !== ''){
opt.push(this.id.split('-')[3]+(this.value !== '' ? '-'+this.value :''));
}else{
err_msg += '
'+$(this).parent().parent().find('span.opt').html().replace(':', '')+'';
}
});
if(err_msg == ''){
_uPostForm('',{type:'POST',url:'/shop/basket',data:{'mode':'add', 'id':id, 'pref':pref, 'opt':opt.join(':'), 'cnt':$('#q'+pref+'-'+id+'-basket').attr('value')}});
ga_event('basket_add');
}else{
lock_buttons = 0;
shop_alert('
Опции
обязательны для выбора
','Замечания','warning',350,100,{tm:8000,align:'left',icon:'https://s107.ucoz.net/img/icon/warning.png', 'onclose': function(){ $('#b'+pref+'-'+id+'-basket').removeAttr('disabled'); $('#'+pref+'-'+id+'-basket').removeClass('wait').addClass('add'); }});
}
return false;
}
function buyNow(id,pref){
if(lock_buttons) return false; else lock_buttons = 1;
var opt = new Array();
var err_msg = '';
$('#b'+pref+'-'+id+'-buynow').attr('disabled','disabled');
$('#'+pref+'-'+id+'-buynow').removeClass('done').removeClass('err').removeClass('now').addClass('wait').attr('title','');
$('#'+pref+'-'+id+'-options-selectors').find('input:checked, select').each(function(){
if(this.value !== ''){
opt.push(this.id.split('-')[3]+'-'+this.value);
}else{
err_msg += '
'+$(this).parent().parent().find('span.opt').html().replace(':', '')+'';
}
});
if(err_msg == ''){
_uPostForm('',{type:'POST',url:'/shop/basket',data:{'mode':'add', 'id':id, 'pref':pref, 'opt':opt.join(':'), 'cnt':$('#q'+pref+'-'+id+'-basket').attr('value'), 'now':1}});
ga_event('basket_buynow');
}else{
lock_buttons = 0;
shop_alert('
Опции
обязательны для выбора
','Замечания','warning',350,100,{tm:8000,align:'left',icon:'https://s107.ucoz.net/img/icon/warning.png', 'onclose': function(){ $('#b'+pref+'-'+id+'-buynow').removeAttr('disabled'); $('#'+pref+'-'+id+'-buynow').removeClass('wait').addClass('add'); }});
}
return false;
}
//-->