Video Detail Page

@BRT.Detail(tableId:"Content", viewId:"Video", 
fields: new[] {"Title", "Friendly", "PubDate", "Body", "Link", "Summary", "EmbedCode", "VideoFile"},
template:
@<div>
    @if(!@item.IsDBNull("PubDate")){
        <p>@item.GetDateTime("PubDate").ToString("d")</p>
    }  
    @if(!@item.IsDBNull("Summary")){
        @BRT.Raw(item.GetString("Summary"))
    }
    else if(!@item.IsDBNull("Link")){
       if (Request.UserAgent.ToLower().IndexOf("ipad", 0) > 0 | Request.UserAgent.ToLower().IndexOf("iphone", 0) > 0){
            if(@item.GetString("Link").IndexOf(".flv", 0) > 0){
                <div>Sorry, Flash video is not supported by your browser</div>
            }
            else {
                var s1 = "<video controls='controls' width='470' height='320' autoplay='autoplay'>";
                var s2 = "<source src='" + @item.GetString("Link") + "' type='video/mp4' />";
                var s3 = "</video>";
                @BRT.Raw( @s1 +  @s2 + @s3);
            }
       }
       else {
            var s1 = "<script type='text/javascript' src='/files/content/www/jwplayer.js'></script><div id='brtplayer'></div><script type='text/javascript'>";
            var s3 = "</script>";
            @BRT.Raw(@s1);
            <text>               
                jwplayer('brtplayer').setup({
                    height: 320, 
                    modes: [{type: 'flash', 
                    src:  'http://brtmedia.s3.amazonaws.com/player.swf'} ], 
                    file:'@item.GetString("Link")', 
                    width: 470 
                }); 
            </text>
            @BRT.Raw(@s3);
        }
    }  
   @if(@item.GetFiles("VideoFile").Count > 0){
        foreach(FileFieldItem r in item.GetFiles("VideoFile")){
            <div>
                <h4>@r.Title</h4>
                <div>@r.Description</div>
                <br/>
                <video width="665" height="372" controls="true">
                    <source src="@r.Url" type="@r.ContentType" />
                </video>
            </div>
        }
    }  
    @if(!@item.IsDBNull("EmbedCode")){
        <div>
            @BRT.Raw(item.GetString("EmbedCode"))
        </div>
    }
    <p>@BRT.Raw(item.GetString("Body"))</p>
</div>)