Killing the city of Jericho, Sodom and Gomorra because they don't agree with you is a good thing, while having a wank is a mortal sin. Burning oxes before the sabbath because the odor pleases the lord is good, but putting a dick up one's bottom is a mortal sin. If two people have sex outside of a narrowly defined set of circumstances, it is OK to stone them to death in the village square, but it is a horrible sin to show someone a breast.
Not all religions agree with one another, and some (i.e. Unitarians) are actually fervent supporters of gay rights.
These examples just serve to illustrate the complete moral bankruptcy of many religious writings. These books were not exactly written during the renaissance.
I don't recall saying anything about books but, um, okay.
[...] but it has been proven that schizophrenia and epilepsia do cause religious visions, and hence religious beliefs.
No, religious beliefs are caused by someone (typically family, ministers, etc.) telling them to you, and then by you believing them. Psychotic episodes don't cause completely original viewpoints to come into ones mind.
There is a researcher called Dick Swaab in the Netherlands that has done interesting work on simulating certain attacks by use of electrodes in humans and has thus been able to conjure up end-of-life visions, out-of-body experiences and religious epiphanies with the flick of a switch.
You may be interested to know that there is a researcher in the US called Feelma Vulva who has done some even more exciting work in the study of people responding to things that weren't actually said. Check it out.