It's the 12th century, you've had a rough camel ride, the Mongols are invading, your silk-wear business is way off and your turban's wound too tight. Uuff, what a headache.

The doctor's prescription might be: Rub lemon peel on your neck, sniff some quince, put a magic charm under your pillow and get the servants to play something nice on a mandolin. Sure beats taking two aspirin and calling back in the morning.

Use of medicinal plants, belief in the supernatural and the improvement of what might today be called your quality of life were all part of ancient medicine in this crossroads country on the shores of the Caspian Sea. It was a time and place in which science blended with beauty and formed the basis of elaborate philosophies on how to enjoy life. Medieval cures and advice were painstakingly reproduced by hand in books decorated with gold leaf and miniature paintings.

Much of this learning -- and the beauty -- has been destroyed in the recurrent wars that have shaken Eurasia over the past thousand years. What remains are precious relics that few scholars have the time, skill or inclination to decipher.

Here in Baku, the capital of Azerbaijan, Farid Alakbarov is laboring mightily to retrieve the old knowledge. He is a biomedical historian who pores over old manuscripts in the collection of the musty, dusty Documents Institute at the Academy of Sciences.

Alakbarov's work requires knowledge of Turkic, Persian and Arabic languages, a linguistic salad that indicates the varied cultures that have influenced this arid land. His task is also in some ways a thankless one. Academia in Azerbaijan, as in many of the states of the former Soviet Union, is under-funded. Arcane studies cannot compete with the need to repair roads, hospitals and schools. Baku, which is coming into its own as a regional oil hub, is no exception. Alakbarov's salary is $25 a month. "It is difficult to call it a salary," he said.

Alakbarov has completed work on an unpublished 400-page treatise on the theory and practice of ancient medicine. No publisher is available. "I am doing it for myself, mainly. I am used to this work. I do it for the creative challenge. Not the $25 of course," he said stoically.

It is easy to see the seduction of the ancient texts. They are pleasingly, even sensually, adorned with swirling arabesques and graceful human figures. A depiction of a male doctor feeling the pulse of a female patient could easily be mistaken for a seduction scene.

The calligraphy is graceful. It was not enough for Alakbarov to master three regional languages, he also had to decipher a myriad of calligraphic styles within each. He wrote a treatise on 47 of them.

The collection in the Documents Institute is evidence of the sophistication of medieval Muslim culture. The flowering of medicine in the Muslim world occurred between the 10th and 12th centuries, Alakbarov said. For centuries afterward, scholars added new discoveries, but made few new theoretical breakthroughs.

Manuscripts were commissioned by nobility and from generation to generation. Old texts were meticulously copied. Prescriptions range from the simple, composed of one herb, to a complex blend of hundreds. Some are recognizable -- chamomile, for instance. Some are esoteric -- cypress cones formed the basis of one cure for kidney problems. Yusif ibn Ismayil Khoyi, a 14th-century physician in the court of Baghdad, compiled a list of thousands of medicinal herbs. He called it immodestly, "Things a Doctor Needs So as Not to Increase His Ignorance."

Anatomical study was limited because Islam forbids desecration of cadavers -- although some investigators tried to extrapolate human anatomy from their studies of monkeys and dogs. The results were not satisfactory. "There were some dissections practiced secretly. They gathered experience, though slowly," Alakbarov said.

Prevention in an age when penicillin was unknown played an important part in a physician's advice. Diet, of course, was important (Avoid fatty foods, wrote Mohammed Momin in the 17th century. Vegetable oils should be substituted. If you must eat meat, use lemon, pomegranate, saffron or cinnamon as condiments.)

Music cured insanity, according to Mahmoud ibn Iyas, a 12th-century physician. An 18th-century tome advised that decor played a role in promoting good health: Pale blue is the best color for bedrooms; try to decorate with flowers. Workaholism is to be avoided, many physicians counseled. They told patients to stop and literally smell the roses, lemons and apples.

"Physicians even gave advice on the construction and location of houses. They wanted people to avoid damp places and have lots of open windows," Alakbarov said.

Alakbarov came to his vocation through a fascination with languages. When he was only 10 years old, he discovered a book of Arabic poems that belonged to his great- grandfather. He found a translation and relied on his grandmother to match up the Arabic and Azeri words and supply the pronunciation. His parents, who were both biologists, drew him to science.

He is reluctant to recommend ancient cures -- they need to be tested for side effects -- although ibn Iyas's prescription to fight nervousness seems hard to resist: "A patient should be made to lie in a comfortable place, preferably near a flower garden or next to a fountain. If someone sits next to him and plays tender melodies on a stringed instrument, the effect is even stronger. Eventually, the patient will relax and fall asleep." CAPTION: An anatomical diagram, from a collection published in "Islamic Science, an Illustrated Study," by Seyyed Hossein Nasr, is attributed to Mansur ibn Muhammad Ahmad, in 17th century Persia. ec