﻿function RenderVideoPlayer(container, video, path)
{
    if(container != null & video != null)
    {
        var serverPath = 'rtmpt://abbott.fcod.llnwd.net/a1915/o18/eas/';
        
        if(path != null)
        {
            serverPath = path;
        }

        $f(container,
           {
                src: "/flash/flowplayer.commercial-3.1.5.swf",
                wmode: 'opaque',
                onFail: function() 
                {
                    ShowVideoError(container);
                }
           },
           {
                key: "#@9da823d06f138f66863",
                clip: {
                    url: video,
                    scaling: 'orig',
                    autoPlay: true,
                    provider: 'rtmp'
                },                
                plugins: {
                      rtmp: {
                             url: '/flash/flowplayer.rtmp-3.1.3.swf',
                             netConnectionUrl: serverPath
                      }
                }
            });
    } 
}

function ShowVideoError(container)
{
    var errorMessage = "<h4>Flash is required to view this video.</h4>" +
                       "<p>You have no flash plug-in installed.</p>" +
                       "<p>Download latest version from <a onclick=\"if(!warn_on_leave('http://www.adobe.com/go/getflashplayer')){return false;}\" href=\"http://www.adobe.com/go/getflashplayer\" target=\"_adobe\">here</a></p>";
                       
    $("#" + container).html(errorMessage);
}
