Hepatic encephalopathy

Hepatic encephalopathy is a condition caused by the build-up of toxins in the body that are usually processed by the liver, primarily ammonia. It is usually caused by an underlying condition of the liver, but can be caused by several other conditions, such as those that increase the load of nitrogen in the body's tissues, a disturbance in electrolyte levels, the use of certain medications or certain types of infection. 
Depending on the level of severity of the lever of toxins, the symptoms of the condition vary from minor absent mindedness to coma. 
Unfortunately, hepatic encephalopathy mimics several other conditions and doing a differential diagnosis usually requires invasive tests. Blood ammonia tests can be helpful, but the level of ammonia does not always correlate with the severity of the symptoms. It is usually necessary to confirm a pathology of the liver, often with a biopsy, before a definitive diagnosis can be reached. 
Immediate treatment requires taking steps to prevent the absorption of ammonia from the intestines. Lactulose binds to ammonia in the intestines and converts it to less harmful nitrogen compounds. Antibiotics kill the bacteria in the intestines that create most of the ammonia. From there, treatment of the underlying pathology is required, up to and including a transplant. However, unlike later types of liver failure, hepatic encephalopathy can usually be treated successfully. 
Hepatic encephalopathy at NIH
Hepatic encephalopathy at Wikipedia