Can someone show me how to use a javascript variable to make a button in a dialog component show or hide depending on the value of a variable?

I want the button to dynamically show if the value is one variable and hide if the variable does not equal that value. I see that there is the ability to define a user-defined javascript function, and I would be glad to use that if someone would show me how. This should work to the extent that if I change the value in Firebug, the button should show or hide based on the value of the variable.

Thanks,
Jay