<script type="text/javascript">
    /*
    var video = {
        video_link_pattern: /:\/\/www\.youtube\.com.*v=([a-zA-Z0-9\-_]+)/,
        video_link_pattern__vk: /vk.com\/video_ext\.php\?(.*)" width/,
        overlay: null,
        video_by_link_val: null,
        video_by_link: function(el){
            var v = $.trim(el.val());
            if(v != '' && v != video.video_by_link_val && (video.video_link_pattern.test(v) || video.video_link_pattern__vk.test(v))){
                var id = video.video_link_pattern.test(v) ? video.video_link_pattern.exec(v) : video.video_link_pattern__vk.exec(v);
                video.overlay = sOverlay($('form'));
                $.ajax({
                    url: '/a/video/gdata?id=' + id[1].replace(/=/gi, ':').replace(/&/gi, ';') + '&type=' + (video.video_link_pattern.test(v) ? 'youtube' : 'vk'),
                    dataType: 'json',
                    success: function(json){
                        var parent = $('#video_cover_widget_form_photo_upload');
                        var hidden = parent.find('input[type="hidden"]');
                        parent.removeClass('no_image');
                        parent.css('background-image', 'url(' + json.image.filelink + ')');
                        parent.find('.uploader_messages').html('');
                        hidden.val(json.image.filename);
                        $('#video_vid').val(id[1]);
                        $('#video_ru_title').val(json.title);
                        $('#video_en_title').val(json.title);
                        el.attr('disabled', false);
                        video.overlay.remove();
                    }
                });
                video.video_by_link_val = v;
            }
        },
        init_link: function(){
            $('#video_vid').on({
                change: function(){video.video_by_link($(this));},
                keyup: function(){video.video_by_link($(this));},
                keydown: function(){video.video_by_link($(this));}
            });
            video.video_by_link_val = $.trim($('#video_yt_vid').val());
        },
        play: function(){
            $('#select_modal').html('<iframe width="760" height="463" src="http://www.youtube.com/embed/' + $('#video_url_id').val() + '" frameborder="0" allowfullscreen></iframe>');
            $('#select_modal').modal();
        }
    };
    $(document).ready(function(){
        video.init_link();
    });
    */
</script>

