| 9. Fair Value Measurements - Schedule of Fair Value of Level 3 Inputs to Warrants (Details) - Level 3 [Member] - Warrants [Member] $ in Thousands | 6 Months Ended | 
|---|---|
| Jun. 30, 2017  USD ($) | |
| Fair Value, Liabilities Measured on Recurring Basis, Unobservable Input Reconciliation [Line Items] | |
| Beginning Balance | $ 651 | 
| Exercised warrants | (178) | 
| Adjustments to fair value for the period | (473) | 
| Ending Balance | $ 0 | 
| X | ||||||||||
| 
- Definition Exercised Warrants. No definition available. 
 | 
| X | ||||||||||
| 
- Definition Line items represent financial concepts included in a table. These concepts are used to disclose reportable information associated with domain members defined in one or many axes to the table. No definition available. 
 | 
| X | ||||||||||
| 
- Definition Amount of settlements of financial instrument classified as a liability measured using unobservable inputs that reflect the entity's own assumption about the assumptions market participants would use in pricing. Reference 1: http://www.xbrl.org/2003/role/presentationRef 
 | 
| X | ||||||||||
| 
- Definition Fair value of financial instrument classified as a liability measured using unobservable inputs that reflect the entity's own assumption about the assumptions market participants would use in pricing. Reference 1: http://www.xbrl.org/2003/role/presentationRef 
 | 
| X | ||||||||||
| 
- Details 
 | 
| X | ||||||||||
| 
- Details 
 |