function pokreni_flowplayer()
    {
         var count = 1;
         $(".local_player").each(function(){
            
            if (video_type = 'local')  
                {
                    $("#video_preview_remote:visible").hide();
                    $("#video_preview_local:hidden").show(); 
                    var video_file = $(this).children(".fp_video").val();
                    var splash_file = $(this).children(".fp_splash").val();
                    var target = 'player' + count;
                    
                    g = new Date; 
                    $f(target , "/flow-player/flowplayer-3.1.5.swf?rand=" + g.getTime(), 
                        {
                                playlist: [
                                {
                                     
                                            onStart: function(clip) { 
                                                    var wrap = jQuery(this.getParent());
                                                    ratio = clip.height / clip.width;
                                                    var playerHeight = Math.round(ratio * 300) + 24; 
                                                    wrap.css({width: 300, height: playerHeight}); 
                                                    //wrap.css({width: clip.width, height: clip.height}); 
                                                  }, 
                                            url: '/movies/' + splash_file
                                       
                                        
                                },
                                {
                                     
                                            onStart: function(clip) { 
                                                    var wrap = jQuery(this.getParent());
                                                    ratio = clip.height / clip.width;
                                                    var playerHeight = Math.round(ratio * 300) + 24; 
                                                    wrap.css({width: 300, height: playerHeight}); 
                                                    //wrap.css({width: clip.width, height: clip.height}); 
                                                  }, 
                                            url: '/movies/' + video_file, 
                                            autoPlay: false, 
                                            autoBuffering: false 
                                      
                                }
                                ]
                         
                         });
                    count ++;
                }
                else if (video_type == 'remote')
                {
                    $("#video_preview_local:visible").hide();
                    $("#video_preview_remote:hidden").show();
                    var video_object = $(this).next("textarea").val();
                    $("#video_preview_remote").html(video_object);
                }
                
         });
                    
    }
    
$(document).ready(function()
{
      pokreni_flowplayer();
})