TextToggle = Class.create({
    parent: null,
    text: null,
    initialize: function(parent,text){
        this.parent = parent;
        this.text = text;
        $(parent).observe('focus', this.focus.bind(this));
        $(parent).observe('blur', this.lostFocus.bind(this));
    },
    focus: function(){
        if($(this.parent) && $F(this.parent) == this.text){
            $(this.parent).value = '';
        }
    },
    lostFocus: function(){
        if($(this.parent) && $F(this.parent) == ''){
            $(this.parent).value = this.text;
        }
    }
});

ElementToggle = Class.create({
        e1: null,
        e2: null,
        initialize: function(e1,e2,event){
            this.e1 = e1;
            this.e2 = e2;
            $(e1).observe(event, this.toggle.bind(this));
            $(e2).observe(event, this.toggle.bind(this));
        },
        toggle: function(event){
            if(Event.element(event) == $(this.e1))
                $(this.e2).selectedIndex =0;
            else
                $(this.e1).selectedIndex =0;
        }
});
