From the Supreme Court Decison Everson v. Board of Education:
""The 'establishment of religion' clause of the First Amendment means at least this: Neither a state nor the Federal Government can set up a church. Neither can pass laws which aid one religion, aid all religions or prefer one religion over another. Neither can force nor influence a person to go to or to remain away from church against his will or force him to profess a belief or disbelief in any religion. No person can be punished for entertaining or professing religious beliefs or disbeliefs, for church attendance or non-attendance. No tax in any amount, large or small, can be levied to support any religious activities or institutions, whatever they may be called, or whatever form they may adopt to teach or practice religion. Neither a state nor the Federal Government can, openly or secretly, participate in the affairs of any religious organizations or groups and vice versa. In the words of Jefferson, the clause against establishment of religion by law was intended to erect 'a wall of separation between Church and State.'" 330 U.S. 1, 15-16."
Voting based on religious conviction is not illegal, creating a law based on religious beliefs is. You cannot have a law that is founded on one's religious beliefs. If I sponsored a referrendum that said everyone had to go church and it passed with 100% of the vote it would still be unconstitutional and therefore uninforcable. If you want to ban gay marriage, the law banning it cannot have anything to do with anyone's religious beliefs so good luck to anyone who wants to try and find a valid secular argument for banning gay marriage. I for one don't think that exists.