text: $(function() {
  		
  	$('body').on('click', 'a#edit_btn', function(e){
  		e.preventDefault();
  		
  		$.blockUI();
  		// $(document).ajaxStart($.blockUI).ajaxStop($.unblockUI);
  		$('div#edit_commission').html('<h5>Loading...</h5>');
  		
  		//var upc = $(this).data('upc');
  		var product_commission_id = $(this).data('product_commission_id');
  		
  		$('div#edit_commission').load(BASE_URL + 'product/other_commission_edit', {
  			//upc: upc,
  			product_commission_id: product_commission_id 
  		});
  		//$.unblockUI();
  	});
  	
  	$('body').on('click', 'a#delete_btn', function(e){
  		e.preventDefault();
  		var product_commission_id = $(this).data('product_commission_id');
  		
  		    $.confirm({
  				    title: 'Delete ',
  				    content: 'คุณต้องการลบรายการนี้ใช่หรือไม่',
  				    type: 'red',
  				    closeIcon: true,
  				    backgroundDismiss: true,
  				    escapeKey: true,
  				    buttons: {
  				    	confirm:  {
  				        	text: 'ต้องการลบ',
  				    		btnClass:  'btn-red',
  				    		keys: ['enter'],
  				    		action: function(){
  				    			$('div#edit_commission').html('');
  								$('tr[data-product_commission_id="' +product_commission_id+ '"]').addClass('danger');
  								
  								$.blockUI();
  								$.ajax({
  									type: 'POST',
  									url: BASE_URL+'product/delete_commission',
  									data: {
  										id: product_commission_id,
  									},
  									dataType: 'json',
  									success: function(data){
  										toastr.success('ลบรายการเรียบร้อยแล้ว');
  										$('tr[data-product_commission_id="' +data.commission_id+ '"]').remove();
  									}
  									
  								});
  				    		}
  				      },
  				        cancel: function () {
  				            //$.alert('Canceled!');
  				        }
  				    }
  				});
      
  	});
  	
  	
  	//add new
  	$('a#new_commission').on('click', function(e){
  		
  		e.preventDefault();
  		
  		$.blockUI();
  		$('div#edit_commission').html('<h4>Loading...</h4>');
  		
  		var upc = $('#product_upc').val();
  		var commission_month = $("#commission_month").val();
  		var commission_year = $("#commission_year").val();
  		//var product_commission_id = $(this).data('product_commission_id');
  		
  		$('div#edit_commission').load(BASE_URL + 'product/other_commission_add', {
  			product_upc: upc,
  			commission_month: commission_month,
  			commission_year: commission_year
  			//product_commission_id: product_commission_id 
  		});
  	});
  	
  	/*
  	$('#btn_confirm').on('confirmed.bs.confirmation', function(){
  		alert('confirm');
  	});
  	*/
  	
  	//test button
  	$('a#test_btn').click(function(e){
  		e.preventDefault();
  		var table = $('table#table_commission tbody tr');
  		alert(table.size());
  	});
  	
  	$('#btn_alert').on('click',function(e){
  		
  		toastr.info('Are you the 6 fingered man?');
  		toastr.success("Gnome & Growl type non-blocking notifications", "ทดสอบ Notifications");
  
  		
  		
  	});
  	
  	
  }); //document.ready
  
  