Loans and allowance for loan losses (Details 4) - USD ($)
$ in Thousands
3 Months Ended 9 Months Ended
Sep. 30, 2017
Sep. 30, 2016
Sep. 30, 2017
Sep. 30, 2016
Impaired Loans With No Related Allowance Recorded [Abstract]        
Average Recorded Investment $ 11,334 $ 10,168 $ 10,279 $ 10,638
Interest Income Recognized 140 79 354 342
Impaired Loans With Related Allowance Recorded [Abstract]        
Average Recorded Investment 3,923 8,442 5,016 9,084
Interest Income Recognized 31 54 114 198
Total [Abstract]        
Average Recorded Investment 15,257 18,610 15,295 19,722
Interest Income Recognized 171 133 468 540
Construction and Land Development Commercial [Member]        
Impaired Loans With No Related Allowance Recorded [Abstract]        
Average Recorded Investment 99 92 100 211
Interest Income Recognized 1 0 3 40
Total [Abstract]        
Average Recorded Investment 566 1,515 572 1,742
Interest Income Recognized 6 7 20 59
Commercial [Member]        
Impaired Loans With No Related Allowance Recorded [Abstract]        
Average Recorded Investment 99 92 100 211
Interest Income Recognized 1 0 3 40
Impaired Loans With Related Allowance Recorded [Abstract]        
Average Recorded Investment 467 1,423 472 1,531
Interest Income Recognized 5 7 17 19
Total [Abstract]        
Average Recorded Investment 566 1,515 572 1,742
Interest Income Recognized 6 7 20 59
Commercial Real Estate [Member]        
Impaired Loans With No Related Allowance Recorded [Abstract]        
Average Recorded Investment 5,718 3,481 4,745 3,470
Interest Income Recognized 55 28 172 121
Impaired Loans With Related Allowance Recorded [Abstract]        
Average Recorded Investment 1,929 5,069 2,978 5,446
Interest Income Recognized 17 47 58 166
Total [Abstract]        
Average Recorded Investment 7,647 8,550 7,723 8,916
Interest Income Recognized 72 75 230 287
Owner Occupied [Member]        
Impaired Loans With No Related Allowance Recorded [Abstract]        
Average Recorded Investment 3,531 935 2,539 933
Interest Income Recognized 32 0 90 29
Impaired Loans With Related Allowance Recorded [Abstract]        
Average Recorded Investment 1,929 4,911 2,978 5,272
Interest Income Recognized 17 47 58 157
Total [Abstract]        
Average Recorded Investment 5,460 5,846 5,517 6,205
Interest Income Recognized 49 47 148 186
Non-Owner Occupied [Member]        
Impaired Loans With No Related Allowance Recorded [Abstract]        
Average Recorded Investment 2,187 2,546 2,206 2,537
Interest Income Recognized 23 28 82 92
Impaired Loans With Related Allowance Recorded [Abstract]        
Average Recorded Investment 2,187 158 2,206 174
Interest Income Recognized 23 0 82 9
Total [Abstract]        
Average Recorded Investment   2,704   2,711
Interest Income Recognized   28   101
Home equity lines [Member]        
Impaired Loans With No Related Allowance Recorded [Abstract]        
Average Recorded Investment 751 1,164 761 1,246
Interest Income Recognized 16 0 17 1
Impaired Loans With Related Allowance Recorded [Abstract]        
Average Recorded Investment 890   830  
Interest Income Recognized 16   23  
Total [Abstract]        
Average Recorded Investment 139 1,164 69 1,246
Interest Income Recognized 0 0 6 1
First Deed of Trust [Member]        
Impaired Loans With No Related Allowance Recorded [Abstract]        
Average Recorded Investment 3,737 4,137 3,615 4,188
Interest Income Recognized 24 42 86 134
Impaired Loans With Related Allowance Recorded [Abstract]        
Average Recorded Investment 815 1,680 1,120 1,800
Interest Income Recognized 8 0 26 9
Total [Abstract]        
Average Recorded Investment 4,552 5,817 4,735 5,987
Interest Income Recognized 32 42 112 143
Second Deed of Trust [Member]        
Impaired Loans With No Related Allowance Recorded [Abstract]        
Average Recorded Investment 555 839 563 950
Interest Income Recognized 9 9 27 32
Impaired Loans With Related Allowance Recorded [Abstract]        
Average Recorded Investment 129 171 131 185
Interest Income Recognized 1 0 3 4
Total [Abstract]        
Average Recorded Investment 684 1,010 694 1,135
Interest Income Recognized 10 9 30 36
Consumer Real Estate [Member]        
Impaired Loans With No Related Allowance Recorded [Abstract]        
Average Recorded Investment 5,043 6,140 4,939 6,384
Interest Income Recognized 49 51 130 167
Impaired Loans With Related Allowance Recorded [Abstract]        
Average Recorded Investment 1,083 1,851 1,320 1,985
Interest Income Recognized 9 0 35 13
Total [Abstract]        
Average Recorded Investment 6,126 7,991 6,259 8,368
Interest Income Recognized 58 51 165 180
Commercial and industrial loans (except those secured by real estate) [Member]        
Impaired Loans With No Related Allowance Recorded [Abstract]        
Average Recorded Investment 470 455 493 568
Interest Income Recognized 35 0 49 14
Impaired Loans With Related Allowance Recorded [Abstract]        
Average Recorded Investment 444 99 245 122
Interest Income Recognized 0 0 4 0
Total [Abstract]        
Average Recorded Investment 915 554 738 690
Interest Income Recognized 35 0 53 14
Consumer And Other [Member]        
Impaired Loans With No Related Allowance Recorded [Abstract]        
Average Recorded Investment 4 0 2 5
Interest Income Recognized 0 0 0 0
Impaired Loans With Related Allowance Recorded [Abstract]        
Average Recorded Investment 0   1  
Interest Income Recognized 0   0  
Total [Abstract]        
Average Recorded Investment 4 0 3 5
Interest Income Recognized $ 0 $ 0 $ 0 $ 0