$(document).ready(function() {

	 /* DIV loading*/
	 $("#loading").ajaxStart(function(){
	   $(this).show();
	 });
	
	 $("#loading").ajaxStop(function(){
	   $(this).hide();
	 });
	 
	
		

	$("#input_order_radio1").click(function () {
	      $("#order_fiz").show();
	      $("#order_ur").hide();
	      
	    });
	    
	$("#input_order_radio2").click(function () {
	     $("#order_fiz").hide();
	     $("#order_ur").show();
	      
	    });    
	
	  	
		  		
	$('form[name="addtobasket"]').submit(function() { 
		
		  
	 	$.post("/system/request/basket.php",  $(this).serialize(), function(data){
			
	   		$("#basket_count").html(data.count);
	   		$("#basket_price").html(data.summ);
	   		$("#stats").html(data.stats);
	   		$('#jGrowl').jGrowl(data.mess , { life: 5000 });
	   		
		},"json");		
		
		$(this).find("input[name*='count']").val("1")
	
	 
		return false; 
	}); 			 

});

	
function basket_del_item (id){
	$.post("/system/request/basket_del_item.php",  {id: id}, function(data){
		
   	
   		$("#stats").html(data.stats);
   		$("#tr_"+id).hide();
   		
		$('#jGrowl').jGrowl(data.mess , { life: 5000 });
   		$("#basket_count").html(data.count);
   		$("#basket_price").html(data.summ);
   		$("#total_price").html(data.summ);
   		
   		
	},"json");		
	
}
  /*
  $.get("/system/request/basket.php", { id : $(this).find("input[name*='id']").val(), count: $(this).find("input[name*='count']").val() }, function(data){
		$.jGrowl("Товары добавлены в корзину.", { life: 2000 });
   		$("#basket_count").html(data);
   		
	});	
	*/       
	

