﻿var ChangeImageFade = Class.create({    
    initialize: function(elmImage, newSrc) {
        this.image = elmImage;        
        this.src = newSrc;
        new Effect.Fade(this.image, { duration: 0.4 });   
        this.tempImage = new Image();
        this.tempImage.onload = this.load.bind(this);     
        this.tempImage.src = this.src;           
    },
    
    load: function() {
        setTimeout(this.show.bind(this), 400);            
    },
    
    show: function() {
        this.image.src = this.src;
        new Effect.Appear(this.image, { duration: 0.4 });
    }
});
