var SiteCallout = new Class({
    initialize: function(obj){
        if(!$(obj.eid)) return;
        this.obj = obj;
        this.FX = null;
        this.setStyles();
        this.attachBehaviors();
    },
    
    attachBehaviors: function(){
        $(this.obj.eid).addEvent('click', this.click.bindWithEvent(this));
        $(this.obj.eid).addEvent('mouseenter', this.over.bindWithEvent(this));
        $(this.obj.eid).addEvent('mouseleave', this.out.bindWithEvent(this));
    },
    
    setStyles: function(){
        $(this.obj.eid).style.background = 'url('+this.obj.disabledImg+') no-repeat bottom center;';
        this.FX = new Fx.Morph($(this.obj.eid).getElement('img')).set({
            'opacity': 0
        });
        $(this.obj.eid).getElement('img').src = this.obj.enabledImg;
        
    },
    
    over: function(){
        if(this.FX) this.FX.cancel();
        
        this.FX = new Fx.Morph($(this.obj.eid).getElement('img'), {duration: 300, transition: Fx.Transitions.Circ.easeIn}).start({
            'opacity': 1
        });
    },
    
    out: function(){
        this.FX.cancel();
        this.FX = new Fx.Morph($(this.obj.eid).getElement('img')).set({
            'opacity': 0
        });
    },
    
    click: function(){
        this.obj.click.call(this);
    }
    
 });


