var MediaViewItem = new Class({
    element: null,

    mediaView: null,
    currentWidth: 0,
    currentHeight: 0,

    initialize: function(mediaView){
        this.element = new Element("div");
        this.element.addClass("MediaViewItem");
        this.element.setStyle("top",-2000);
        this.element.fx = new Fx.Tween(this.element,{
            link: "cancel",
            onStart: this.onFxStart.bind(this),
            onComplete: this.onFxComplete.bind(this)
        });
        this.element.fx.set("opacity",0);
        this.mediaView = mediaView;
        this.currentWidth = null;
        this.currentHeight = null;
    },
    onFxStart: function(){
        if( this.element.getStyle("opacity") == 0 )
        {
            this.element.setStyle("top",0);
        }
    },
    onFxComplete: function(){
        if( this.element.getStyle("opacity") == 0 )
        {
            this.element.setStyle("top",-2000);
        }
    },
    getElement: function(){
        return this.element;
    },
    hide: function(disableAnimation){
        if( disableAnimation == true )
        {
            this.element.fx.set("opacity",0);
        }
        else
        {
            this.element.fx.start("opacity",0);
        }
    },
    show: function(disableAnimation){
        if( disableAnimation == true )
        {
            this.element.fx.set("opacity",1);
        }
        else
        {
            this.element.fx.start("opacity",1);
        }
    },
    onResize: function(){
        if(
            ( this.mediaView.element.getWidth() == this.currentWidth ) &&
            ( this.mediaView.element.getHeight()-this.mediaView.decreaseHeightBy == this.currentHeight )
        )
        {
            return false;
        }
        this.currentWidth = this.mediaView.element.getWidth();
        this.currentHeight = this.mediaView.element.getHeight()-this.mediaView.decreaseHeightBy;

        return true;
    }
});
