﻿
// Video class
Type.registerNamespace('CorvusCMS.UI');

CorvusCMS.UI.Video = function(element) {

    CorvusCMS.UI.Video.initializeBase(this, [element]);
   

}

CorvusCMS.UI.Video.prototype = {

    initialize: function() {
        CorvusCMS.UI.Video.callBaseMethod(this, 'initialize');

    },

    dispose: function() {

        try {
            var player = $get("corvusPlayer_" + this.get_element().id);
            player.sendEvent("STOP");
            swfobject.removeSWF("corvusPlayer_" + this.get_element().id);
        }
        catch (ex) { }
        CorvusCMS.UI.Video.callBaseMethod(this, 'dispose');


    },

    render: function() {

        var params = {
            allowfullscreen: "true",
            allowscriptaccess: "always",
            title: this.get_item().Title,
            flashvars: "file=" + this.get_item().VideoURL + "&bufferlength=1&autostart=true"
        }
        var attributes = {
            id: "corvusPlayer_" + this.get_id(),
            name: "corvusPlayer_" + this.get_id(),
            data: this.get_item().PlayerURL,
            width: this.get_width(),
            height: this.get_height()
        }
        
         var container = document.createElement("div");
         container.id = "videoItemPlaceHolder_" + this.get_id();
         this.get_element().appendChild(container);
        
        swfobject.createSWF(attributes, params, container.id);




    }

}

CorvusCMS.UI.Video.registerClass("CorvusCMS.UI.Video", CorvusCMS.UI.GalleryItem, Sys.IDisposable);



if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();