function cl(obj) {
   console.log(obj);
}


jQuery(document).ready(function() {
	
   var total = parseInt(total) || 0;
   	$('#checkout_wrap').hide();
	
   $('.checkbox').click(function(evt) {
		//cl($(this).attr('class'));
		
      if($(this).hasClass('free') == false) {
			$('.checkbox.free').addClass('checked');
		}
      
      if ($(this).hasClass('checked')) {
         total = total - parseInt($(this).attr('id'));
      } else {
         total = total + parseInt($(this).attr('id'));
      }
      
      $('.w_total').html(parseInt(total));
	  
	  if(parseInt(total) == 0)
		$('#checkout_wrap').hide();
	  else
		$('#checkout_wrap').show();
   });
   
   
   
   $('.checkbox').click(function(evt) {
		evt.preventDefault();
		
		if ($(this).hasClass('checked')) {
			$(this).removeClass('checked');
         $(this).find('input').attr('value', '');
			$(this).find('input').attr('checked', false);
			$(this).next().attr('checked', false);
		} else {
			$(this).addClass('checked');
         $(this).find('input').attr('value', $(this).find('input').attr('value'));
			$(this).find('input').attr('checked', 'checked');
			$(this).next().attr('checked', 'checked');
		}
	});
});