var umsapp = umsapp || {};
umsapp.Tdirectors = function ($, objname, options) {
    'use srict';
    var self = this;

    this.create = function () {
        self.target = $('.bg-vimeo-hover');
        self.videosIds = [];
        self.defaultOptions =
        {
            controls: false,
            quality: '1080p',
            loop: false,
            muted: true,
            autoplay: false,
            title: false
        };

        self._slider = [];
        self.events.onCreate();
    };

    this.onReady = function () {
        self.events.onReady();
    };

    this.start = function () {
        self.events.onStarted();
    };

    this.processTriggers = function () {

    };

    this.onElementsEvents = function () {

    };

    this.execute = function () {

        if(self.target.length > 0)
        {
            self.settingVideo();
        }
    };

    this.apllyEvents = function (p_play)
    {
        $($(p_play.element).closest('a')).hover(function()
        {
            p_play.play()
        },
        function()
        {
            p_play.pause()
        });
    };

    this.settingVideo = function () {
        self.player = [];
        self.target.each(function(idx, elem){
            self.player[idx] = new Vimeo.Player($(elem).attr('id'), {...self.defaultOptions, 'id': $(elem).attr('data-videoid')});
            self.apllyEvents(self.player[idx]);
        });
    };

    CjsBaseClass.call(this, $, objname, options);
};

umsapp.directors = new umsapp.Tdirectors(
    window.cjsbaseclass_jquery,
    'directors',
    {
        'debug': CJS_DEBUG_MODE_1,
        'highlighted': 'auto'
    }
);