Try this. It's a mel toggle that will alow you to toggle x-ray on and off. I believe you can also make a shelf button with it....I haven't used this though so you're on your own with it. This is from highend3d so if this one doesn't do what you want, maybe there are other scripts there that will. Not sure about the second question.
"Terminat Bora Diem, Terminal Auctor opus."