jQuery(function($) {

        // install flowplayer into flowplayer container
        var mjv_player = $f("player", "http://releases.flowplayer.org/swf/flowplayer-3.2.2.swf", {

                clip: {			

			urlResolvers: 'bwcheck',
			provider: 'rtmp',
			autoPlay: true,
			scaling: 'fit',
       
			// available bitrates and the corresponding files. We specify also the video width
			// here, so that the player does not use a too large file. It switches to a 
			// file/stream with larger dimensions when going fullscreen if the available bandwidth permits.
			bitrates: [
			  { 
				url: "mp4:vod/mjvideotribute.psi/Enoch_MJFC_WEB14.m4v", width: 480, height: 270, bitrate: 350,
				// this is the default bitrate, the playback kicks off with this and after that
				// Quality Of Service monitoring adjusts to the most appropriate bitrate
				isDefault: true 
			  },
			  { url: "mp4:vod/mjvideotribute.psi/Enoch_MJFC_WEB15.m4v", width: 480, bitrate: 580 },
         		  { url: "mp4:vod/mjvideotribute.psi/Enoch_MJFC_WEB16.m4v", width: 480, bitrate: 700 }
			]
		},

		plugins:  {
        
			// bandwidth check plugin
			bwcheck: {  
				url: 'flowplayer.bwcheck-3.2.1.swf', 
      	    
				// HDDN uses Wowza servers
				serverType: 'wowza',
      	    
				// we use dynamic switching, the appropriate bitrate is switched on the fly
				dynamic: true,
      	    
				netConnectionUrl: 'rtmp://vod01.netdna.com/play'
			},
        	
        		// RTMP streaming plugin
        		rtmp: {
				url: 'flowplayer.rtmp-3.2.1.swf',
				netConnectionUrl: 'rtmp://vod01.netdna.com/play'
			},
                }
        });

        // setup button action. it will fire our overlay
        $("a[rel='#mjvt']").overlay({

                // use the Apple effect for overlay
                effect: 'apple',

                expose: '#789',

                // when overlay is opened, load our player
                onLoad: function() {
                        mjv_player.load();
                },

                // when overlay is closed, unload our player
                onClose: function() {
                        mjv_player.unload();
                }
        });
});

