* editpage add-media-wizard binding fix
authorMichael Dale <dale@users.mediawiki.org>
Wed, 11 Nov 2009 14:45:55 +0000 (14:45 +0000)
committerMichael Dale <dale@users.mediawiki.org>
Wed, 11 Nov 2009 14:45:55 +0000 (14:45 +0000)
* fixed remoteMw embed calls
* stubs for k-player fallback
* fixed native seek for videos that have not started playing yet
* some timedText fixes

14 files changed:
js2/editPage.js
js2/mwEmbed/example_usage/Player_Themable.html
js2/mwEmbed/libEmbedVideo/embedVideo.js
js2/mwEmbed/libEmbedVideo/flashEmbed.js [deleted file]
js2/mwEmbed/libEmbedVideo/flowplayerEmbed.js [new file with mode: 0644]
js2/mwEmbed/libEmbedVideo/kplayerEmbed.js [new file with mode: 0644]
js2/mwEmbed/libEmbedVideo/nativeEmbed.js
js2/mwEmbed/libSequencer/mvTimedEffectsEdit.js
js2/mwEmbed/libTimedText/mvTextInterface.js
js2/mwEmbed/libTimedText/mvTimeTextEdit.js
js2/mwEmbed/mv_embed.js
js2/mwEmbed/php/languages/mwEmbed.i18n.php
js2/mwEmbed/skins/ctrlBuilder.js
js2/remoteMwEmbed.js

index c03bf06..0e93231 100644 (file)
@@ -21,6 +21,7 @@ var defaultAddMediaConfig = {
 };
 
 js2AddOnloadHook( function() {
+       js_log("edit page js2AddOnloadHook::");
        var amwConf = $j.extend( true, defaultAddMediaConfig, mwAddMediaConfig );
        // kind of tricky, it would be nice to use run on ready "loader" call here
        var didWikiEditorBind = false;  
@@ -49,17 +50,19 @@ js2AddOnloadHook( function() {
        //Add to old toolbar if wikiEditor did not remove '#toolbar' from the page:    
        setTimeout(function(){
                if( $j('#btn-add-media-wiz').length == 0 && $j( '#toolbar' ).length != 0 ){
-                       js_log(' old toolbar bind:');
+                       js_log( 'Do old toolbar bind:' );
+                       didWikiEditorBind = true;
                        $j( '#toolbar' ).append( '<img style="cursor:pointer" id="btn-add-media-wiz" src="' +
                                mv_skin_img_path + 'Button_add_media.png">' );
                        $j( '#btn-add-media-wiz' ).addMediaWiz(
                                amwConf
                        );
-               }else{
-                       js_log('failed to bind via build section bind via target:');
+               }else{                  
                        //Make sure the wikieditor got binded: 
-                       if( !didWikiEditorBind )
+                       if( !didWikiEditorBind ){
+                               js_log( 'Failed to bind via build section bind via target:' );
                                $j(".tool[rel='file']").unbind().addMediaWiz( amwConf );
+                       }
                }
        }, 120)
 
index a32e539..a17f857 100644 (file)
@@ -26,7 +26,7 @@ src="http://upload.wikimedia.org/wikipedia/commons/2/29/Charles_Lindbergh_flight
                poster="http://upload.wikimedia.org/wikipedia/commons/thumb/2/29/Charles_Lindbergh_flight_to_Brussels.ogg/mid-Charles_Lindbergh_flight_to_Brussels.ogg.jpg" durationHint="15"></video>
 <video class="kskin" style="width:208px;height:160px;float:left;" src="http://upload.wikimedia.org/wikipedia/commons/2/29/Charles_Lindbergh_flight_to_Brussels.ogg" 
                poster="http://upload.wikimedia.org/wikipedia/commons/thumb/2/29/Charles_Lindbergh_flight_to_Brussels.ogg/mid-Charles_Lindbergh_flight_to_Brussels.ogg.jpg" durationHint="15"></video>
-<b>(ksin) Source Code used:</b><br>
+<b>(kskin) Source Code used:</b><br>
 <textarea cols="50" rows="7"><video class="kskin" style="width:400px;height:288px" poster="http://upload.wikimedia.org/wikipedia/commons/thumb/2/29/Charles_Lindbergh_flight_to_Brussels.ogg/mid-Charles_Lindbergh_flight_to_Brussels.ogg.jpg" 
 src="http://upload.wikimedia.org/wikipedia/commons/2/29/Charles_Lindbergh_flight_to_Brussels.ogg"></video></textarea>
 </div>
index 8bdefe3..00cef43 100644 (file)
@@ -34,9 +34,8 @@ loadGM({
        "mwe-video_credits" : "Video credits",
        "mwe-menu_btn" : "Menu",
        "mwe-close_btn" : "Close",
-       "mwe-ogg-player-vlc-mozilla" : "VLC plugin",
+       "mwe-ogg-player-vlc-player" : "VLC player",
        "mwe-ogg-player-videoElement" : "Native Ogg video",
-       "mwe-ogg-player-vlc-activex" : "VLC ActiveX",
        "mwe-ogg-player-oggPlugin" : "Generic Ogg plugin",
        "mwe-ogg-player-quicktime-mozilla" : "QuickTime plugin",
        "mwe-ogg-player-quicktime-activex" : "QuickTime ActiveX",
@@ -59,45 +58,45 @@ loadGM({
 var commons_api_url =  'http://commons.wikimedia.org/w/api.php';
 
 var default_video_attributes = {
-       "id":null,
-       "class":null,
-       "style":null,
-       "name":null,
-       "innerHTML":null,
-       "width":"320",
-       "height":"240",
+       "id" : null,
+       "class" : null,
+       "style" : null,
+       "name" : null,
+       "innerHTML" : null,
+       "width" : "320",
+       "height" : "240",
 
        //video attributes:
-       "src":null,
-       "autoplay":false,
-       "start":0,
-       "end":null,
-       "controls":true,
-       "muted":false,
-       "wikiTitleKey":null,
+       "src" : null,
+       "autoplay" : false,
+       "start" : 0,
+       "end" : null,
+       "controls" : true,
+       "muted" : false,
+       "wikiTitleKey" : null,
        
        //roe url (for xml based metadata)
-       "roe":null,
+       "roe" : null,
        //if roe includes metadata tracks we can expose a link to metadata
-       "show_meta_link":true,
+       "show_meta_link" : true,
 
        //default state attributes per html5 spec:
        //http://www.whatwg.org/specs/web-apps/current-work/#video)
-       "paused":true,
-       "readyState":0,  //http://www.whatwg.org/specs/web-apps/current-work/#readystate
-       "currentTime":0, //current playback position (should be updated by plugin)
-       "duration":null,   //media duration (read from file or the temporal url)
-       "networkState":0,
+       "paused" : true,
+       "readyState" : 0,  //http://www.whatwg.org/specs/web-apps/current-work/#readystate
+       "currentTime"  :0, //current playback position (should be updated by plugin)
+       "duration"  :null,   //media duration (read from file or the temporal url)
+       "networkState" : 0,
 
-       "startOffset":null, //if serving an ogg_chop segment use this to offset the presentation time 
+       "startOffset" : null, //if serving an ogg_chop segment use this to offset the presentation time 
 
        //custom attributes for mv_embed:
-       "play_button":true,     
-       "thumbnail":null,
-       "linkback":null,
-       "embed_link":true,
-       "download_link":true,
-       "type":null,     //the content type of the media 
+       "play_button" : true,   
+       "thumbnail" : null,
+       "linkback" : null,
+       "embed_link" : true,
+       "download_link" : true,
+       "type" :null,    //the content type of the media 
 };
 /*
  * the base source attribute checks
@@ -109,10 +108,12 @@ var mv_default_source_attr= new Array(
        'titleKey',
        'title',
        'URLTimeEncoding', //boolean if we support temporal url requests on the source media
-       'startOffset',
+       'startOffset',  
+       
        'durationHint',
        'start',
-       'end',  
+       'end',
+       
        'default',
        'lang'
 );
@@ -335,10 +336,7 @@ mediaSource.prototype =
                        if( $j(element).attr( attr ) ) {
                                this[ attr ] =  $j(element).attr( attr );
                        }
-               }                               
-               //update duration from hit if present: 
-               if( this.durationHint )
-                       this.duration = this.durationHint;              
+               }       
                                        
                        
                if ( $j(element).attr('type'))
@@ -430,7 +428,8 @@ mediaSource.prototype =
                return this.index;
        },
        /*
-        * function getDuration in milliseconds
+        * function parseURLDuration 
+        * getDuration in milliseconds
         * special case derive duration from request url
         * supports media_url?t=ntp_start/ntp_end url request format
         */
@@ -460,9 +459,9 @@ mediaSource.prototype =
                //js_log('f:parseURLDuration() for:' + this.src  + ' d:' + this.duration);
        },
        /** Attempts to detect the type of a media file based on the URI.
-               @param {String} uri URI of the media file.
-               @returns The guessed MIME type of the file.
-               @type String
+       *       @param {String} uri URI of the media file.
+       *       @returns The guessed MIME type of the file.
+       *       @type String
        */
        detectType:function(uri)
        {
@@ -473,10 +472,22 @@ mediaSource.prototype =
                var end_inx =  (uri.indexOf('?')!=-1)? uri.indexOf('?') : uri.length;
                var no_param_uri = uri.substr(0, end_inx);
                switch( no_param_uri.substr(no_param_uri.lastIndexOf('.'),4).toLowerCase() ){
-                       case '.flv':return 'video/x-flv';break;
-                       case '.ogg': case '.ogv': return 'video/ogg';break;
-                       case '.oga': return 'audio/ogg'; break;
-                       case '.anx':return 'video/ogg';break;
+                       case '.mp4': 
+                               return 'video/h264'; 
+                       break;
+                       case '.flv': 
+                               return 'video/x-flv'; 
+                       break;
+                       case '.ogg': 
+                       case '.ogv': 
+                               return 'video/ogg';
+                       break;
+                       case '.oga': 
+                               return 'audio/ogg'; 
+                       break;
+                       case '.anx':
+                               return 'video/ogg';
+                       break;
                }
        }
 };
@@ -488,7 +499,7 @@ mediaSource.prototype =
        @param {element} video_element <video> element used for initialization.
        @constructor
 */
-function mediaElement(video_element)
+function mediaElement( video_element )
 {
        this.init(video_element);
 };
@@ -509,10 +520,7 @@ mediaElement.prototype =
                var _this = this;
                js_log('Initializing mediaElement...' );
                this.sources = new Array();
-               this.thumbnail = mv_default_thumb_url;
-               // Process the source element:
-               if($j(video_element).attr("src"))
-                       this.tryAddSource(video_element);                         
+               this.thumbnail = mv_default_thumb_url;                            
                
                if($j(video_element).attr('thumbnail'))
                        this.thumbnail = $j(video_element).attr('thumbnail');
@@ -522,11 +530,24 @@ mediaElement.prototype =
                
                if($j(video_element).attr('wikiTitleKey'))
                        this.wikiTitleKey = $j(video_element).attr('wikiTitleKey');
-                       
-               // Process all inner <source> elements  
-               //js_log("inner source count: " + video_element.getElementsByTagName('source').length );
+       
+               if($j(video_element).attr('durationHint')){
+                       this.durationHint = $j(video_element).attr('durationHint');                     
+                       //convert duration hint if needed:
+                       var sc = this.durationHint.split(':');
+                       if( sc.length >=1 ){
+                               this.duration = npt2seconds( this.durationHint );
+                       }else{
+                               this.duration = parseFloat( this.durationHint );
+                       }
+               }
+               
+               // Process the video_element as a source element:
+               if($j(video_element).attr("src"))
+                       this.tryAddSource(video_element);       
                
-               $j(video_element).find('source,text').each(function(inx, inner_source){                 
+               // Process all inner <source> elements  
+               $j(video_element).find('source,text,itext').each(function(inx, inner_source){                   
                        _this.tryAddSource( inner_source );
                });                                               
        },
@@ -578,14 +599,15 @@ mediaElement.prototype =
                for(var i=0; i < playable_sources.length; i++){
                        if( i==index ){
                                this.selected_source = playable_sources[i];
-                               //update the user selected format: 
+                               // Update the user selected format: 
                                embedTypes.players.userSelectFormat( playable_sources[i].mime_type );
                                break;
                        }
                }               
        },
-       /** selects the default source via cookie preference, default marked, or by id order
-        * */
+       /** 
+       * selects the default source via cookie preference, default marked, or by id order
+       */
        autoSelectSource:function(){ 
                js_log('f:autoSelectSource:');  
                //@@todo read user preference for source                
@@ -600,14 +622,14 @@ mediaElement.prototype =
                                this.selected_source = playable_sources[source];                                
                                return true;
                        }
-                       //set via user-preference
+                       // Set via user-preference
                        if(embedTypes.players.preference['format_prefrence'] == mime_type){
                                 js_log('set via preference: '+playable_sources[source].mime_type);
                                 this.selected_source = playable_sources[source];
                                 return true; 
                        }                                                                                                                       
                }          
-               //set Ogg via player support            
+               // Set Ogg via player support           
                for(var source=0; source < playable_sources.length; source++){
                        js_log('f:autoSelectSource:' + playable_sources[source].mime_type);
                        var mime_type =playable_sources[source].mime_type;                                      
@@ -623,7 +645,7 @@ mediaElement.prototype =
                                }
                        }
                }
-               //set basic flash
+               // Set basic flash
                for(var source=0; source < playable_sources.length; source++){  
                        var mime_type =playable_sources[source].mime_type;                                                                              
                        if( mime_type=='video/x-flv' ){
@@ -632,7 +654,7 @@ mediaElement.prototype =
                                return true;
                        }                                               
                }
-               //set h264 flash 
+               // Set h264 flash 
                for(var source=0; source < playable_sources.length; source++){  
                        var mime_type =playable_sources[source].mime_type;                                                                              
                        if( mime_type=='video/h264' ){
@@ -641,7 +663,7 @@ mediaElement.prototype =
                                return true;
                        }                          
                }               
-               //select first source           
+               // Select first source          
                if (!this.selected_source)
                {
                        js_log('set via first source:' + playable_sources[0]);
@@ -683,7 +705,7 @@ mediaElement.prototype =
                the element has a 'src' attribute.              
                @param element {element} <video>, <source> or <mediaSource> <text> element.
        */
-       tryAddSource:function(element)
+       tryAddSource:function( element )
        {
                js_log('f:tryAddSource:'+ $j(element).attr("src"));                             
                if ( $j(element).attr("src") ){
@@ -696,8 +718,16 @@ mediaElement.prototype =
                                        this.sources[i].updateSource(element);
                                }
                        }
-               }                               
-               var source = new mediaSource( element );                
+               }                                       
+               var source = new mediaSource( element );
+               // Inherit some properties from the parent <video> element if unset: 
+               if( !source.duration && this.duration)
+                       source.duration = this.duration;
+                       
+               if( !source.startOffset && this.startOffset)
+                       source.startOffset =this.startOffset;
+               
+                               
                this.sources.push(source);              
                js_log('pushed source to stack'+ source + 'sl:'+this.sources.length);
        },
@@ -820,6 +850,8 @@ embedVideo.prototype = {
                        }
                }
                
+               
+               
                //set the skin name from the class  
                var     sn = element.getAttribute('class');
                if( sn && sn != ''){
@@ -939,7 +971,7 @@ embedVideo.prototype = {
                }               
        },
        inheritEmbedObj:function(){             
-               js_log("inheritEmbedObj:duration is: " +  this.duration);  
+               js_log("inheritEmbedObj:duration is: " +  this.getDuration() );  
                //@@note: tricky cuz direct overwrite is not so ideal.. since the extended object is already tied to the dom
                //clear out any non-base embedObj stuff:
                if(this.instanceOf){
@@ -1061,7 +1093,7 @@ embedVideo.prototype = {
                //return this.wrapEmebedContainer( this.getEmbedObj() );
                return 'function getEmbedHTML should be overitten by embedLib ';
        },
-       //do seek function (should be overwritten by implementing embedLibs)
+       // Do seek function (should be overwritten by implementing embedLibs)
        // to check if seek can be done on locally downloaded content. 
        doSeek : function( perc ){              
                if( this.supportsURLTimeEncoding() ){                   
@@ -1078,7 +1110,7 @@ embedVideo.prototype = {
        },
        /*
         * seeks to the requested time and issues a callback when ready 
-        * (should be overwitten by client that supports frame serving)
+        * (should be overwritten by client that supports frame serving)
         */     
        setCurrentTime:function( time, callback){
                js_log('error: base embed setCurrentTime can not frame serve (override via plugin)');
@@ -1099,14 +1131,15 @@ embedVideo.prototype = {
                this.closeDisplayedHTML();
 
 //             if(!this.selected_player){
-//                     return this.getPluginMissingHTML();             
+//                     return this.getPluginMissingHTML();
+               
                //Set "loading" here
                $j('#mv_embedded_player_'+_this.id).html(''+
                        '<div style="color:black;width:'+this.width+'px;height:'+this.height+'px;">' + 
                                gM('mwe-loading_plugin') + 
                        '</div>'                                        
                );
-               // schedule embedding
+               // Schedule embedding
                this.selected_player.load(function()
                {
                        js_log('performing embed for ' + _this.id);                     
@@ -1231,6 +1264,7 @@ embedVideo.prototype = {
                }                                       
        },
        onClipDoneDisp:function(){
+               var _this = this;
                //add the liks_info_div black back 
                $j('#dc_'+this.id).append('<div id="liks_info_'+this.id+'" ' +
                                'style="width:' +parseInt(parseInt(this.width)/2)+'px;'+                
@@ -1242,8 +1276,8 @@ embedVideo.prototype = {
           );
           //start animation (make thumb small in upper left add in div for "loading"                   
                $j('#img_thumb_'+this.id).animate({                             
-                               width:parseInt(parseInt(_this.width)/2),
-                               height:parseInt(parseInt(_this.height)/2),
+                               width : parseInt( parseInt(_this.width)/2 ),
+                               height : parseInt( parseInt(_this.height)/2 ),
                                top:20,
                                left:10
                        },
@@ -1925,7 +1959,7 @@ embedVideo.prototype = {
        *  base embed controls
        *       the play button calls
        */
-       play:function(){
+       play : function(){
                var eid = (this.pc!=null)?this.pc.pp.id:this.id;
                                
                //js_log( "mv_embed play:" + this.id);          
@@ -2084,7 +2118,7 @@ embedVideo.prototype = {
                        }
                        //check if we are "done"
                        if( this.currentTime > ( parseInt(this.duration) + 1 ) ){
-                               js_log("should run clip done");
+                               js_log("should run clip done ct:: " + this.currentTime + ' > ' +  parseInt( this.duration + 1 ) );
                                this.onClipDone();
                        }                               
                }else{
@@ -2289,16 +2323,16 @@ mediaPlayer.prototype =
 /* players and supported mime types 
 @@todo ideally we query the plugin to get what mime types it supports in practice not always reliable/avaliable
 */
-var flowPlayer = new mediaPlayer('flowplayer',['video/x-flv', 'video/h264'],'flash');
+var flowPlayer = new mediaPlayer('flowplayer', ['video/x-flv', 'video/h264'], 'flowplayer');
+//var kplayer = new mediaPlayer('kplayer', ['video/x-flv', 'video/h264'], 'kplayer');
 
 var omtkPlayer = new mediaPlayer('omtkplayer',['audio/ogg'], 'omtk' );
 
 var cortadoPlayer = new mediaPlayer('cortado',['video/ogg', 'audio/ogg'],'java');
 var videoElementPlayer = new mediaPlayer('videoElement',['video/ogg', 'audio/ogg'],'native');
 
-var vlcMineList = ['video/ogg','audio/ogg', 'video/x-flv', 'video/mp4',  'video/h264'];
-var vlcMozillaPlayer = new mediaPlayer('vlc-mozilla',vlcMineList,'vlc');
-var vlcActiveXPlayer = new mediaPlayer('vlc-activex',vlcMineList,'vlc');
+var vlcMineList = ['video/ogg', 'audio/ogg', 'video/x-flv', 'video/mp4',  'video/h264'];
+var vlcPlayer = new mediaPlayer('vlc-player', vlcMineList, 'vlc');
 
 //add generic
 var oggPluginPlayer = new mediaPlayer('oggPlugin',['video/ogg'],'generic');
@@ -2330,8 +2364,8 @@ mediaPlayers.prototype =
                this.loadPreferences();
                
                //set up default players order for each library type            
-               this.default_players['video/x-flv'] = ['flash','vlc'];
-               this.default_players['video/h264'] = ['flash', 'vlc'];
+               this.default_players['video/x-flv'] = ['flowplayer', 'vlc'];
+               this.default_players['video/h264'] = ['flowplayer', 'vlc'];
                
                this.default_players['video/ogg'] = ['native','vlc','java', 'generic'];         
                this.default_players['application/ogg'] = ['native','vlc','java', 'generic'];           
@@ -2521,6 +2555,8 @@ var embedTypes = {
                                }                               
                                //flowplayer has pretty good compatiablity 
                                // (but if we wanted to be fancy we would check for version of flash and update the mp4/h.264 support
+                               
+                               //this.players.addPlayer( kplayer );
                                this.players.addPlayer( flowPlayer );                              
                        }
                         // VLC
@@ -2575,7 +2611,7 @@ var embedTypes = {
                                        pluginName = '';
                                }                               
                                if ( pluginName.toLowerCase() == 'vlc multimedia plugin' || pluginName.toLowerCase() == 'vlc multimedia plug-in' ) {
-                                       this.players.addPlayer(vlcMozillaPlayer, type);
+                                       this.players.addPlayer( vlcPlayer, type);
                                        continue;
                                }
                
@@ -2607,8 +2643,10 @@ var embedTypes = {
                                        this.players.addPlayer(vlcMozillaPlayer, type);
                                        continue;
                                }*/
-                               if(type=='application/x-shockwave-flash'){
-                                       this.players.addPlayer( flowPlayer );
+                               if( type == 'application/x-shockwave-flash' ){
+                               
+                                       //this.players.addPlayer( kplayer );
+                                       this.players.addPlayer( flowPlayer );   
                                        
                                        //check version to add omtk:
                                        var flashDescription = navigator.plugins["Shockwave Flash"].description;
diff --git a/js2/mwEmbed/libEmbedVideo/flashEmbed.js b/js2/mwEmbed/libEmbedVideo/flashEmbed.js
deleted file mode 100644 (file)
index ef83a2d..0000000
+++ /dev/null
@@ -1,1838 +0,0 @@
-/**
- * metavid: mv_flashEmbed builds off of flowplayer api (included first in this file) 
- */
- /**
- * flowplayer.js 3.0.0-rc5. The Flowplayer API.
- * 
- * This file is part of Flowplayer, http://flowplayer.org
- *
- * Author: Tero Piirainen, <support@flowplayer.org>
- * Copyright (c) 2008 Flowplayer Ltd
- *
- * Released under the MIT License:
- * http://www.opensource.org/licenses/mit-license.php
- * 
- * Version: 3.0.0-rc5 - Thu Nov 20 2008 22:09:49 GMT-0000 (GMT+00:00)
- */
-(function() {
-/* 
-       FEATURES 
-       --------
-       - handling multiple instances 
-       - Flowplayer programming API 
-       - Flowplayer event model        
-       - player loading / unloading
-       - $f() function
-       - jQuery support
-*/ 
-
-/*jslint glovar: true, browser: true */
-/*global flowplayer, $f */
-
-// {{{ private utility methods
-       
-       function log(args) {
-               
-               // write into opera console
-               if (typeof opera == 'object') {
-                       opera.postError("$f.fireEvent: " + args.join(" | "));   
-
-                       
-               } else if (typeof console == 'object') {
-                       console.log("$f.fireEvent", [].slice.call(args));       
-               }
-       }
-
-               
-       // thanks: http://keithdevens.com/weblog/archive/2007/Jun/07/javascript.clone
-       function clone(obj) {   
-               if (!obj || typeof obj != 'object') { return obj; }             
-               var temp = new obj.constructor();       
-               for (var key in obj) {  
-                       if (obj.hasOwnProperty(key)) {
-                               temp[key] = clone(obj[key]);
-                       }
-               }               
-               return temp;
-       }
-
-       // stripped from jQuery, thanks John Resig 
-       function each(obj, fn) {
-               if (!obj) { return; }
-               
-               var name, i = 0, length = obj.length;
-       
-               // object
-               if (length === undefined) {
-                       for (name in obj) {
-                               if (fn.call(obj[name], name, obj[name]) === false) { break; }
-                       }
-                       
-               // array
-               } else {
-                       for (var value = obj[0];
-                               i < length && fn.call( value, i, value ) !== false; value = obj[++i]) {                         
-                       }
-               }
-       
-               return obj;
-       }
-
-       
-       // convenience
-       function el(id) {
-               return document.getElementById(id);      
-       }       
-
-       
-       // used extensively. a very simple implementation. 
-       function extend(to, from, skipFuncs) {
-               if (to && from) {                       
-                       each(from, function(name, value) {
-                               if (!skipFuncs || typeof value != 'function') {
-                                       to[name] = value;               
-                               }
-                       });
-               }
-       }
-       
-       // var arr = select("elem.className"); 
-       function select(query) {
-               var index = query.indexOf("."); 
-               if (index != -1) {
-                       var tag = query.substring(0, index) || "*";
-                       var klass = query.substring(index + 1, query.length);
-                       var els = [];
-                       each(document.getElementsByTagName(tag), function() {
-                               if (this.className && this.className.indexOf(klass) != -1) {
-                                       els.push(this);         
-                               }
-                       });
-                       return els;
-               }
-       }
-       
-       // fix event inconsistencies across browsers
-       function stopEvent(e) {
-               e = e || window.event;
-               
-               if (e.preventDefault) {
-                       e.stopPropagation();
-                       e.preventDefault();
-                       
-               } else {
-                       e.returnValue = false;  
-                       e.cancelBubble = true;
-               } 
-               return false;
-       }
-
-       // push an event listener into existing array of listeners
-       function bind(to, evt, fn) {
-               to[evt] = to[evt] || [];
-               to[evt].push(fn);               
-       }
-       
-       
-       // generates an unique id
-   function makeId() {
-         return "_" + ("" + Math.random()).substring(2, 10);   
-   }
-       
-//}}}  
-       
-
-// {{{ Clip
-
-       var Clip = function(json, index, player) {
-               
-               // private variables
-               var self = this;
-               var cuepoints = {};
-               var listeners = {}; 
-               this.index = index;
-               
-               // instance variables
-               if (typeof json == 'string') {
-                       json = {url:json};      
-               }
-       
-               extend(this, json, true);       
-               
-               // event handling 
-               each(("Begin*,Start,Pause*,Resume*,Seek*,Stop*,Finish*,LastSecond,Update,BufferFull,BufferEmpty,BufferStop").split(","),
-                       function() {
-                       
-                       var evt = "on" + this;
-                               
-                       // before event
-                       if (evt.indexOf("*") != -1) {
-                               evt = evt.substring(0, evt.length -1); 
-                               var before = "onBefore" + evt.substring(2); 
-                               
-                               self[before] = function(fn) {
-                                       bind(listeners, before, fn);
-                                       return self;
-                               };                              
-                       }  
-                       
-                       self[evt] = function(fn) {
-                               bind(listeners, evt, fn);
-                               return self;
-                       };
-                       
-                       
-                       // set common clip event listeners to player level
-                       if (index == -1) {
-                               if (self[before]) {
-                                       player[before] = self[before];          
-                               }                               
-                               if (self[evt])  {
-                                       player[evt] = self[evt];                
-                               }
-                       }
-                       
-               });                       
-               
-               extend(this, {
-                       
-                        
-                       onCuepoint: function(points, fn) {
-                               
-                               // embedded cuepoints
-                               if (arguments.length == 1) {
-                                       cuepoints.embedded = [null, points];
-                                       return self;
-                               }
-                               
-                               if (typeof points == 'number') {
-                                       points = [points];      
-                               }
-                               
-                               var fnId = makeId();  
-                               cuepoints[fnId] = [points, fn]; 
-                               
-                               if (player.isLoaded()) {
-                                       player._api().fp_addCuepoints(points, index, fnId);     
-                               }  
-                               
-                               return self;
-                       },
-                       
-                       update: function(json) {
-                               extend(self, json);
-
-                               if (player.isLoaded()) {
-                                       player._api().fp_updateClip(json, index);       
-                               }
-                               var conf = player.getConfig(); 
-                               var clip = (index == -1) ? conf.clip : conf.playlist[index];
-                               extend(clip, json, true);
-                       },
-                       
-                       
-                       // internal event for performing clip tasks. should be made private someday
-                       _fireEvent: function(evt, arg1, arg2, target) {                          
-                               
-                               if (evt == 'onLoad') { 
-                                       each(cuepoints, function(key, val) {
-                                               player._api().fp_addCuepoints(val[0], index, key);               
-                                       }); 
-                                       return false;
-                               }                                       
-                               
-                               // target clip we are working against
-                               if (index != -1) {
-                                       target = self;  
-                               }
-                               
-                               if (evt == 'onCuepoint') {
-                                       var fn = cuepoints[arg1];
-                                       if (fn) {
-                                               return fn[1].call(player, target, arg2);
-                                       }
-                               }  
-       
-                               if (evt == 'onStart' || evt == 'onUpdate') {
-                                       
-                                       extend(target, arg1);                                   
-                                       
-                                       if (!target.duration) {
-                                               target.duration = arg1.metaData.duration;        
-                                       } else {
-                                               target.fullDuration = arg1.metaData.duration;   
-                                       }                                         
-                               }  
-                               
-                               var ret = true;
-                               each(listeners[evt], function() {
-                                       ret = this.call(player, target, arg1);          
-                               }); 
-                               return ret;                             
-                       }                       
-                       
-               });
-               
-               
-               // get cuepoints from config
-               if (json.onCuepoint) {
-                       self.onCuepoint.apply(self, json.onCuepoint);
-                       delete json.onCuepoint;
-               } 
-               
-               // get other events
-               each(json, function(key, val) {
-                       if (typeof val == 'function') {
-                               bind(listeners, key, val);
-                               delete json[key];       
-                       }
-               });
-
-               
-               // setup common clip event callbacks for Player object too (shortcuts)
-               if (index == -1) {
-                       player.onCuepoint = this.onCuepoint;    
-               }
-       
-       };
-
-//}}}
-
-
-// {{{ Plugin
-               
-       var Plugin = function(name, json, player, fn) {
-       
-               var listeners = {};
-               var self = this;   
-               var hasMethods = false;
-       
-               if (fn) {
-                       extend(listeners, fn);  
-               }   
-               
-               // custom callback functions in configuration
-               each(json, function(key, val) {
-                       if (typeof val == 'function') {
-                               listeners[key] = val;
-                               delete json[key];       
-                       }
-               });  
-               
-               // core plugin methods          
-               extend(this, {
-  
-                       animate: function(props, speed, fn) { 
-                               if (!props) {
-                                       return self;    
-                               }
-                               
-                               if (typeof speed == 'function') { 
-                                       fn = speed; 
-                                       speed = 500;
-                               }
-                               
-                               if (typeof props == 'string') {
-                                       var key = props;
-                                       props = {};
-                                       props[key] = speed;
-                                       speed = 500; 
-                               }
-                               
-                               if (fn) {
-                                       var fnId = makeId();
-                                       listeners[fnId] = fn;
-                               }
-               
-                               if (speed === undefined) { speed = 500; }
-                               json = player._api().fp_animate(name, props, speed, fnId);      
-                               return self;
-                       },
-                       
-                       css: function(props, val) {
-                               if (val !== undefined) {
-                                       var css = {};
-                                       css[props] = val;
-                                       props = css;                                    
-                               }
-                               try{
-                                       json = player._api().fp_css(name, props);
-                                       extend(self, json);
-                                       return self;
-                               }catch(e){
-                                       js_log('flow player could not set css: ' + json);
-                               }
-                       },
-                       
-                       show: function() {
-                               this.display = 'block';
-                               player._api().fp_showPlugin(name);
-                               return self;
-                       },
-                       
-                       hide: function() {
-                               this.display = 'none';
-                               player._api().fp_hidePlugin(name);
-                               return self;
-                       },
-                       
-                       toggle: function() {
-                               this.display = player._api().fp_togglePlugin(name);
-                               return self;
-                       },                      
-                       
-                       fadeTo: function(o, speed, fn) {
-                               
-                               if (typeof speed == 'function') { 
-                                       fn = speed; 
-                                       speed = 500;
-                               }
-                               
-                               if (fn) {
-                                       var fnId = makeId();
-                                       listeners[fnId] = fn;
-                               }                               
-                               this.display = player._api().fp_fadeTo(name, o, speed, fnId);
-                               this.opacity = o;
-                               return self;
-                       },
-                       
-                       fadeIn: function(speed, fn) { 
-                               return self.fadeTo(1, speed, fn);                               
-                       },
-       
-                       fadeOut: function(speed, fn) {
-                               return self.fadeTo(0, speed, fn);       
-                       },
-                       
-                       getName: function() {
-                               return name;    
-                       },
-                       
-                       
-                       // internal method not meant to be used by clients
-                _fireEvent: function(evt, arg) {
-
-                               
-                       // update plugins properties & methods
-                       if (evt == 'onUpdate') {
-                          var json = arg || player._api().fp_getPlugin(name); 
-                                       if (!json) { return;    }                                       
-                                       
-                          extend(self, json);
-                          delete self.methods;
-                                       
-                          if (!hasMethods) {
-                                 each(json.methods, function() {
-                                        var method = "" + this;           
-                                                       
-                                        self[method] = function() {
-                                               var a = [].slice.call(arguments);
-                                               var ret = player._api().fp_invoke(name, method, a); 
-                                               return ret == 'undefined' ? self : ret;
-                                        };
-                                 });
-                                 hasMethods = true;             
-                          }
-                       }
-                       
-                       // plugin callbacks
-                       var fn = listeners[evt];
-
-                               if (fn) {
-                                       
-                                       fn.call(self, arg);
-                                       
-                                       // "one-shot" callback
-                                       if (evt.substring(0, 1) == "_") {
-                                               delete listeners[evt];  
-                                       } 
-                       }                
-                }                                       
-                       
-               });
-
-       };
-
-
-//}}}
-
-
-function Player(wrapper, params, conf) {   
-               
-       // private variables (+ arguments)
-       var 
-               self = this, 
-               api = null, 
-               html, 
-               commonClip, 
-               playlist = [], 
-               plugins = {},
-               listeners = {},
-               playerId,
-               apiId,
-               activeIndex,
-               swfHeight,
-               wrapperHeight;  
-
-  
-// {{{ public methods 
-       
-       extend(self, {
-                       
-               id: function() {
-                       return playerId;        
-               }, 
-               
-               isLoaded: function() {
-                       return (api !== null);  
-               },
-               
-               getParent: function() {
-                       return wrapper; 
-               },
-               
-               hide: function(all) {
-                       if (all) { wrapper.style.height = "0px"; }
-                       if (api) { api.style.height = "0px"; } 
-                       return self;
-               },
-
-               show: function() {
-                       wrapper.style.height = wrapperHeight + "px";
-                       if (api) { api.style.height = swfHeight + "px"; }
-                       return self;
-               }, 
-                                       
-               isHidden: function() {
-                       return api && parseInt(api.style.height, 10) === 0;
-               },
-               
-               
-               load: function(fn) { 
-                       
-                       if (!api && self._fireEvent("onBeforeLoad") !== false) {
-                               
-                               // unload all instances
-                               each(players, function()  {
-                                       this.unload();          
-                               });
-                               
-                               html = wrapper.innerHTML; 
-                               flashembed(wrapper, params, {config: conf});
-                               
-                               // function argument
-                               if (fn) {
-                                       fn.cached = true;
-                                       bind(listeners, "onLoad", fn);  
-                               }
-                       }
-                       
-                       return self;    
-               },
-               
-               unload: function() {  
-                       
-                if (api && html.replace(/\s/g, '') !== '' && !api.fp_isFullscreen() && 
-                       self._fireEvent("onBeforeUnload") !== false) { 
-                               api.fp_close();
-                               wrapper.innerHTML = html; 
-                               self._fireEvent("onUnload");
-                               api = null;
-                       }
-                       
-                       return self;
-               },
-
-               getClip: function(index) {
-                       if (index === undefined) {
-                               index = activeIndex;    
-                       }
-                       return playlist[index];
-               },
-               
-               
-               getCommonClip: function() {
-                       return commonClip;      
-               },              
-               
-               getPlaylist: function() {
-                       return playlist; 
-               },
-               
-         getPlugin: function(name) {  
-                var plugin = plugins[name];
-                
-                       // create plugin if nessessary
-                if (!plugin && self.isLoaded()) {
-                               var json = self._api().fp_getPlugin(name);
-                               if (json) {
-                                       plugin = new Plugin(name, json, self);
-                                       plugins[name] = plugin;                                           
-                               } 
-                }              
-                return plugin; 
-         },
-               
-               getScreen: function() { 
-                       return self.getPlugin("screen");
-               }, 
-               
-               getControls: function() { 
-                       return self.getPlugin("controls");
-               }, 
-
-               getConfig: function() { 
-                       return clone(conf);
-               },
-               
-               getFlashParams: function() { 
-                       return params;
-               },              
-               
-               loadPlugin: function(name, url, props, fn) { 
-
-                       // properties not supplied                      
-                       if (typeof props == 'function') { 
-                               fn = props; 
-                               props = {};
-                       } 
-                       
-                       // if fn not given, make a fake id so that plugin's onUpdate get's fired
-                       var fnId = fn ? makeId() : "_"; 
-                       self._api().fp_loadPlugin(name, url, props, fnId); 
-                       
-                       // create new plugin
-                       var arg = {};
-                       arg[fnId] = fn;
-                       var p = new Plugin(name, null, self, arg);
-                       plugins[name] = p;
-                       return p;                       
-               },
-               
-               
-               getState: function() {
-                       return api ? api.fp_getState() : -1;
-               },
-               
-               // "lazy" play
-               play: function(clip) {
-                       
-                       function play() {
-                               if (clip !== undefined) {
-                                       self._api().fp_play(clip);
-                               } else {
-                                       if(typeof self._api().fp_play == 'function')
-                                               self._api().fp_play();  
-                               }
-                       }
-                       
-                       if (api) {
-                               play();
-                               
-                       } else {
-                               self.load(function() { 
-                                       play();
-                               });
-                       }
-                       
-                       return self;
-               },
-               
-               getVersion: function() {
-                       var js = "flowplayer.js 3.0.0-rc5";
-                       if (api) {
-                               var ver = api.fp_getVersion();
-                               ver.push(js);
-                               return ver;
-                       }
-                       return js; 
-               },
-               
-               _api: function() {
-                       if (!api) {
-                               throw "Flowplayer " +self.id()+ " not loaded. Try moving your call to player's onLoad event";
-                       }
-                       return api;                             
-               },
-               
-               _dump: function() {
-                       console.log(listeners);
-               }
-               
-       }); 
-       
-       
-       // event handlers
-       each(("Click*,Load*,Unload*,Keypress*,Volume*,Mute*,Unmute*,PlaylistReplace,Fullscreen*,FullscreenExit,Error").split(","),
-               function() {             
-                       var name = "on" + this;
-                       
-                       // before event
-                       if (name.indexOf("*") != -1) {
-                               name = name.substring(0, name.length -1); 
-                               var name2 = "onBefore" + name.substring(2);
-                               self[name2] = function(fn) {
-                                       bind(listeners, name2, fn);     
-                                       return self;
-                               };                                              
-                       }
-                       
-                       // normal event
-                       self[name] = function(fn) {
-                               bind(listeners, name, fn);      
-                               return self;
-                       };                       
-               }
-       ); 
-       
-       
-       // core API methods
-       each(("pause,resume,mute,unmute,stop,toggle,seek,getStatus,getVolume,setVolume,getTime,isPaused,isPlaying,startBuffering,stopBuffering,isFullscreen,reset").split(","),         
-               function() {             
-                       var name = this;
-                       
-                       self[name] = function(arg) {
-                               if (!api) { return self; }
-                               try{
-                                       var ret = (arg === undefined) ? api["fp_" + name]() : api["fp_" + name](arg);
-                                       return ret == 'undefined' ? self : ret;
-                               }catch (e){
-                                       js_log('flowplayer could not access fp_ '+ name);
-                               }
-                       };                       
-               }
-       );               
-       
-//}}}
-
-
-// {{{ public method: _fireEvent
-               
-       self._fireEvent = function(evt, arg0, arg1, arg2) {             
-                               
-               if (conf.debug) {
-                       log(arguments);         
-               }                               
-               
-               // internal onLoad
-               if (evt == 'onLoad' && !api) {  
-                       
-                       api = api || el(apiId); 
-                       swfHeight = api.clientHeight;
-                       
-                       each(playlist, function() {
-                               this._fireEvent("onLoad");              
-                       });
-                       
-                       each(plugins, function(name, p) {
-                               p._fireEvent("onUpdate");               
-                       });
-                       
-                       
-                       commonClip._fireEvent("onLoad");  
-               }
-               
-         if (evt == 'onContextMenu') {
-                each(conf.contextMenu[arg0], function(key, fn)  {
-                       fn.call(self);
-                });
-                return;
-         }
-
-               if (evt == 'onPluginEvent') {
-                       var name = arg0.name || arg0;
-                       var p = plugins[name];
-                       if (p) {
-                               if (arg0.name) {
-                                       p._fireEvent("onUpdate", arg0);         
-                               }
-                               p._fireEvent(arg1);             
-                       }
-                       return;
-               }               
-
-               // onPlaylistReplace
-               if (evt == 'onPlaylistReplace') {
-                       playlist = [];
-                       var index = 0;
-                       each(arg0, function() {
-                               playlist.push(new Clip(this, index++));
-                       });             
-               }
-               
-               var ret = true;
-               
-               // clip event
-               if (arg0 === 0 || (arg0 && arg0 >= 0)) {
-                       
-                       activeIndex = arg0;
-                       var clip = playlist[arg0];                      
-                       
-                       if (clip) {
-                               ret = clip._fireEvent(evt, arg1, arg2); 
-                       } 
-                       
-                       if (!clip || ret !== false) {
-                               
-                               // clip argument is given for common clip, because it behaves as the target
-                               ret = commonClip._fireEvent(evt, arg1, arg2, clip);     
-                       }  
-               } 
-               
-               // player event 
-               var i = 0;
-               each(listeners[evt], function() {
-                       ret = this.call(self, arg0);            
-                       
-                       // remove cached entry
-                       if (this.cached) {
-                               listeners[evt].splice(i, 1);    
-                       }
-                       
-                       // break loop
-                       if (ret === false) { return false;       }
-                       i++;
-                       
-               }); 
-
-               return ret;
-       };
-
-//}}}
-
-// {{{ init
-       
-   function init() {
-               
-               if ($f(wrapper)) {
-                       return null;    
-               }               
-               
-               wrapperHeight = parseInt(wrapper.style.height) || wrapper.clientHeight;
-               
-               // register this player into global array of instances
-               players.push(self);  
-               
-               
-               // flashembed parameters
-               if (typeof params == 'string') {
-                       params = {src: params}; 
-               }       
-               
-               // playerId     
-               playerId = wrapper.id || "fp" + makeId();
-               apiId = params.id || playerId + "_api";          
-               params.id = apiId;
-               conf.playerId = playerId;
-               
-               
-               // plain url is given as config
-               if (typeof conf == 'string') {
-                       conf = {clip:{url:conf}};       
-               } 
-               
-               // common clip is always there
-               conf.clip = conf.clip || {};
-               commonClip = new Clip(conf.clip, -1, self);  
-               
-               
-               // wrapper href as playlist
-               if (wrapper.getAttribute("href")) { 
-                       conf.playlist = [{url:wrapper.getAttribute("href", 2)}];                        
-               } 
-               
-               // playlist
-               conf.playlist = conf.playlist || [conf.clip]; 
-               
-               var index = 0;
-               each(conf.playlist, function() {
-
-                       var clip = this;
-                       
-                       // clip is an array, we don't allow that
-                       if (typeof clip == 'object' && clip.length)  {
-                               clip = "" + clip;       
-                       }
-                       
-                       if (!clip.url && typeof clip == 'string') {                             
-                               clip = {url: clip};                             
-                       } 
-                       
-                       // populate common clip properties to each clip
-                       extend(clip, conf.clip, true);          
-                       
-                       // modify configuration playlist
-                       conf.playlist[index] = clip;                    
-                       
-                       // populate playlist array
-                       clip = new Clip(clip, index, self);
-                       playlist.push(clip);                                            
-                       index++;                        
-               });
-                       
-               
-               // event listeners
-               each(conf, function(key, val) {
-                       if (typeof val == 'function') {
-                               bind(listeners, key, val);
-                               delete conf[key];       
-                       }
-               });              
-               
-               
-               // plugins
-               each(conf.plugins, function(name, val) {
-                       if (val) {
-                               plugins[name] = new Plugin(name, val, self);
-                       }
-               });
-               
-               
-               // setup controlbar plugin if not explicitly defined
-               if (!conf.plugins || conf.plugins.controls === undefined) {
-                       plugins.controls = new Plugin("controls", null, self);  
-               } 
-               
-               // Flowplayer uses black background by default
-               params.bgcolor = params.bgcolor || "#000000";
-               
-               
-               // setup default settings for express install
-               params.version = params.version || [9,0];               
-               params.expressInstall = 'http://www.flowplayer.org/swf/expressinstall.swf';
-               
-               
-               // click function
-               function doClick(e) {
-                       if (self._fireEvent("onBeforeClick") !== false) {
-                               self.load();            
-                       } 
-                       return stopEvent(e);                                    
-               }
-               
-               // defer loading upon click
-               html = wrapper.innerHTML;
-               if (html.replace(/\s/g, '') !== '') {    
-                       
-                       if (wrapper.addEventListener) {
-                               wrapper.addEventListener("click", doClick, false);      
-                               
-                       } else if (wrapper.attachEvent) {
-                               wrapper.attachEvent("onclick", doClick);        
-                       }
-                       
-               // player is loaded upon page load 
-               } else {
-                       
-                       // prevent default action from wrapper (safari problem) loaded
-                       if (wrapper.addEventListener) {
-                               wrapper.addEventListener("click", stopEvent, false);    
-                       }
-                       
-                       // load player
-                       self.load();
-               }
-               
-       }
-
-       // possibly defer initialization until DOM get's loaded
-       if (typeof wrapper == 'string') { 
-               flashembed.domReady(function() {
-                       var node = el(wrapper); 
-                       
-                       if (!node) {
-                               throw "Flowplayer cannot access element: " + wrapper;   
-                       } else {
-                               wrapper = node; 
-                               init();                                 
-                       } 
-               });
-               
-       // we have a DOM element so page is already loaded
-       } else {                
-               init();
-       }
-       
-       
-//}}}
-
-
-}
-
-
-// {{{ flowplayer() & statics 
-
-// container for player instances
-var players = [];
-
-
-// this object is returned when multiple player's are requested 
-function Iterator(arr) {
-       
-       this.length = arr.length;
-       
-       this.each = function(fn)  {
-               each(arr, fn);  
-       };
-       
-       this.size = function() {
-               return arr.length;      
-       };      
-}
-
-// these two variables are the only global variables
-window.flowplayer = window.$f = function() {
-       
-       var instance = null;
-       var arg = arguments[0]; 
-       
-       
-       // $f()
-       if (!arguments.length) {
-               each(players, function() {
-                       if (this.isLoaded())  {
-                               instance = this;        
-                               return false;
-                       }
-               });
-               
-               return instance || players[0];
-       } 
-       
-       if (arguments.length == 1) {
-               
-               // $f(index);
-               if (typeof arg == 'number') { 
-                       return players[arg];    
-       
-                       
-               // $f(wrapper || 'containerId' || '*');
-               } else {
-                       
-                       // $f("*");
-                       if (arg == '*') {
-                               return new Iterator(players);   
-                       }
-                       
-                       // $f(wrapper || 'containerId');
-                       each(players, function() {
-                               if (this.id() == arg.id || this.id() == arg || this.getParent() == arg)  {
-                                       instance = this;        
-                                       return false;
-                               }
-                       });
-                       
-                       return instance;                                        
-               }
-       }                        
-
-       // instance builder 
-       if (arguments.length > 1) {             
-
-               var swf = arguments[1];
-               var conf = (arguments.length == 3) ? arguments[2] : {};
-                                               
-               if (typeof arg == 'string') {
-                       
-                       // select arg by classname
-                       if (arg.indexOf(".") != -1) {
-                               var instances = [];
-                               
-                               each(select(arg), function() { 
-                                       instances.push(new Player(this, clone(swf), clone(conf)));               
-                               });     
-                               
-                               return new Iterator(instances);
-                               
-                       // select node by id
-                       } else {                
-                               var node = el(arg);
-                               return new Player(node !== null ? node : arg, swf, conf);         
-                       } 
-                       
-                       
-               // arg is a DOM element
-               } else if (arg) {
-                       return new Player(arg, swf, conf);                                              
-               }
-               
-       } 
-       
-       return null; 
-};
-       
-extend(window.$f, {
-
-       // called by Flash External Interface            
-       fireEvent: function(id, evt, a0, a1, a2) {              
-               var p = $f(id);         
-               return p ? p._fireEvent(evt, a0, a1, a2) : null;
-       },
-       
-       
-       // create plugins by modifying Player's prototype
-       addPlugin: function(name, fn) {
-               Player.prototype[name] = fn;
-               return $f;
-       },
-       
-       // utility methods for plugin developers
-       each: each,
-       
-       extend: extend
-       
-});
-       
-//}}}
-
-
-//{{{ jQuery support
-
-if (typeof jQuery == 'function') {
-       
-       jQuery.prototype.flowplayer = function(params, conf) {  
-               
-               // select instances
-               if (!arguments.length || typeof arguments[0] == 'number') {
-                       var arr = [];
-                       this.each(function()  {
-                               var p = $f(this);
-                               if (p) {
-                                       arr.push(p);    
-                               }
-                       });
-                       return arguments.length ? arr[arguments[0]] : new Iterator(arr);
-               }
-               
-               // create flowplayer instances
-               return this.each(function() { 
-                       $f(this, clone(params), conf ? clone(conf) : {});       
-               }); 
-               
-       };
-       
-}
-
-//}}}
-
-
-})();
-/** 
- * flashembed 0.34. Adobe Flash embedding script
- * 
- * http://flowplayer.org/tools/flash-embed.html
- *
- * Copyright (c) 2008 Tero Piirainen (support@flowplayer.org)
- *
- * Released under the MIT License:
- * http://www.opensource.org/licenses/mit-license.php
- * 
- * >> Basically you can do anything you want but leave this header as is <<
- *
- * first version 0.01 - 03/11/2008 
- * version 0.34 - Tue Nov 11 2008 09:09:52 GMT-0000 (GMT+00:00)
- */
-(function() { 
-//{{{ utility functions 
-               
-var jQ = typeof jQuery == 'function';
-
-
-// from "Pro JavaScript techniques" by John Resig
-function isDomReady() {
-       
-       if (domReady.done)  { return false; }
-       
-       var d = document;
-       if (d && d.getElementsByTagName && d.getElementById && d.body) {
-               clearInterval(domReady.timer);
-               domReady.timer = null;
-               
-               for (var i = 0; i < domReady.ready.length; i++) {
-                       domReady.ready[i].call();       
-               }
-               
-               domReady.ready = null;
-               domReady.done = true;
-       } 
-}
-
-// if jQuery is present, use it's more effective domReady method
-var domReady = jQ ? jQuery : function(f) {
-       
-       if (domReady.done) {
-               return f();     
-       }
-       
-       if (domReady.timer) {
-               domReady.ready.push(f); 
-               
-       } else {
-               domReady.ready = [f];
-               domReady.timer = setInterval(isDomReady, 13);
-       } 
-};     
-
-
-// override extend params function 
-function extend(to, from) {
-       if (from) {
-               for (key in from) {
-                       if (from.hasOwnProperty(key)) {
-                               to[key] = from[key];
-                       }
-               }
-       }
-       
-       return to;
-}      
-
-
-function concatVars(vars) {            
-       var out = "";
-       
-       for (var key in vars) { 
-               if (vars[key]) {
-                       out += [key] + '=' + asString(vars[key]) + '&';
-               }
-       }                       
-       return out.substring(0, out.length -1);                         
-}  
-
-
-
-// JSON.asString() function
-function asString(obj) {
-
-       switch (typeOf(obj)){
-               case 'string':
-                       obj = obj.replace(new RegExp('(["\\\\])', 'g'), '\\$1');
-                       
-                       // flash does not handle %- characters well. transforms "50%" to "50pct" (a dirty hack, I admit)
-                       obj = obj.replace(/^\s?(\d+)%/, "$1pct");
-                       return '"' +obj+ '"';
-                       
-               case 'array':
-                       return '['+ map(obj, function(el) {
-                               return asString(el);
-                       }).join(',') +']'; 
-                       
-               case 'function':
-                       return '"function()"';
-                       
-               case 'object':
-                       var str = [];
-                       for (var prop in obj) {
-                               if (obj.hasOwnProperty(prop)) {
-                                       str.push('"'+prop+'":'+ asString(obj[prop]));
-                               }
-                       }
-                       return '{'+str.join(',')+'}';
-       }
-       
-       // replace ' --> "  and remove spaces
-       return String(obj).replace(/\s/g, " ").replace(/\'/g, "\"");
-}
-
-
-// private functions
-function typeOf(obj) {
-       if (obj === null || obj === undefined) { return false; }
-       var type = typeof obj;
-       return (type == 'object' && obj.push) ? 'array' : type;
-}
-
-
-// version 9 bugfix: (http://blog.deconcept.com/2006/07/28/swfobject-143-released/)
-if (window.attachEvent) {
-       window.attachEvent("onbeforeunload", function() {
-               __flash_unloadHandler = function() {};
-               __flash_savedUnloadHandler = function() {};
-       });
-}
-
-function map(arr, func) {
-       var newArr = []; 
-       for (var i in arr) {
-               if (arr.hasOwnProperty(i)) {
-                       newArr[i] = func(arr[i]);
-               }
-       }
-       return newArr;
-}
-       
-function getEmbedCode(p, c) {
-       var html = '<embed type="application/x-shockwave-flash" ';
-
-       if (p.id) { extend(p, {name:p.id}); }
-       
-       for (var key in p) { 
-               if (p[key] !== null) { 
-                       html += key + '="' +p[key]+ '"\n\t';
-               }
-       }
-
-       if (c) {
-                html += 'flashvars=\'' + concatVars(c) + '\'';
-       }
-       
-       // thanks Tom Price (07/17/2008)
-       html += '/>';
-       
-       return html;
-}
-
-function getObjectCode(p, c, embeddable) {
-       
-       var html = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
-       html += 'width="' + p.width + '" height="' + p.height + '"'; 
-       
-       // force id for IE. otherwise embedded Flash object cannot be returned
-       if (!p.id && document.all) {
-               p.id = "_" + ("" + Math.random()).substring(5);
-       } 
-       
-       if (p.id) {
-               html += ' id="' + p.id + '"';
-       }
-       
-       html += '>';  
-       
-       // sometimes ie fails to load flash if it's on cache
-       if (document.all) {
-               p.src += ((p.src.indexOf("?") != -1 ? "&" : "?") + Math.random());              
-       } 
-       
-       html += '\n\t<param name="movie" value="'+ p.src +'" />';
-
-       var e = extend({}, p);
-       e.id = e.width = e.height = e.src = null;
-       
-       for (var k in e) {
-               if (e[k] !== null) {
-                       html += '\n\t<param name="'+ k +'" value="'+ e[k] +'" />';
-               }
-       }
-       
-       if (c) {
-               html += '\n\t<param name="flashvars" value=\'' + concatVars(c) + '\' />';
-       }
-       
-       if (embeddable) {
-               html += getEmbedCode(p, c);     
-       }
-        
-       html += "</object>";
-       
-       return html;
-}
-
-function getFullHTML(p, c) {
-       return getObjectCode(p, c, true);       
-}
-
-function getHTML(p, c) { 
-       var isNav = navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length; 
-       return (isNav) ? getEmbedCode(p, c) : getObjectCode(p, c);
-}
-
-//}}}
-
-       
-window.flashembed = function(root, userParams, flashvars) {    
-       
-       
-//{{{ construction
-               
-       // setup params
-       var params = {
-               
-               // very common params
-               src: '#',
-               width: '100%',
-               height: '100%',         
-               
-               // flashembed specific options
-               version:null,
-               onFail:null,
-               expressInstall:null,  
-               debug: false,
-               
-               // flashembed defaults
-               // bgcolor: 'transparent',
-               allowfullscreen: true,
-               allowscriptaccess: 'always',
-               quality: 'high',
-               type: 'application/x-shockwave-flash',
-               pluginspage: 'http://www.adobe.com/go/getflashplayer'
-       };
-       
-       
-       if (typeof userParams == 'string') {
-               userParams = {src: userParams}; 
-       }
-       
-       extend(params, userParams);                      
-               
-       var version = flashembed.getVersion(); 
-       var required = params.version; 
-       var express = params.expressInstall;             
-       var debug = params.debug;
-
-       
-       if (typeof root == 'string') {
-               var el = document.getElementById(root);
-               if (el) {
-                       root = el;      
-               } else {
-                       domReady(function() {
-                               flashembed(root, userParams, flashvars);
-                       });
-                       return;          
-               } 
-       }
-       
-       if (!root) { return; }
-
-       
-       // is supported 
-       if (!required || flashembed.isSupported(required)) {
-               params.onFail = params.version = params.expressInstall = params.debug = null;
-               
-               // root.innerHTML may cause broplems: http://domscripting.com/blog/display/99
-               // thanks to: Ryan Rud
-               // var tmp = document.createElement("extradiv");
-               // tmp.innerHTML = getHTML();
-               // root.appendChild(tmp);
-               
-               root.innerHTML = getHTML(params, flashvars);
-               
-               // return our API                       
-               return root.firstChild;
-               
-       // custom fail event
-       } else if (params.onFail) {
-               var ret = params.onFail.call(params, flashembed.getVersion(), flashvars);
-               if (ret === true) { root.innerHTML = ret; }             
-               
-
-       // express install
-       } else if (required && express && flashembed.isSupported([6,65])) {
-               
-               extend(params, {src: express});
-               
-               flashvars = {
-                       MMredirectURL: location.href,
-                       MMplayerType: 'PlugIn',
-                       MMdoctitle: document.title
-               };
-               
-               root.innerHTML = getHTML(params, flashvars);    
-               
-       // not supported
-       } else {
-
-               // minor bug fixed here 08.04.2008 (thanks JRodman)
-               
-               if (root.innerHTML.replace(/\s/g, '') !== '') {
-                       // custom content was supplied
-               
-               } else {
-                       root.innerHTML = 
-                               "<h2>Flash version " + required + " or greater is required</h2>" + 
-                               "<h3>" + 
-                                       (version[0] > 0 ? "Your version is " + version : "You have no flash plugin installed") +
-                               "</h3>" + 
-                               "<p>Download latest version from <a href='" + params.pluginspage + "'>here</a></p>";
-               }
-       }
-
-       return root;
-       
-//}}}
-       
-       
-};
-
-
-//{{{ static methods
-
-extend(window.flashembed, {
-
-       // returns arr[major, fix]
-       getVersion: function() {
-       
-               var version = [0, 0];
-               
-               if (navigator.plugins && typeof navigator.plugins["Shockwave Flash"] == "object") {
-                       var _d = navigator.plugins["Shockwave Flash"].description;
-                       if (typeof _d != "undefined") {
-                               _d = _d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
-                               var _m = parseInt(_d.replace(/^(.*)\..*$/, "$1"), 10);
-                               var _r = /r/.test(_d) ? parseInt(_d.replace(/^.*r(.*)$/, "$1"), 10) : 0;
-                               version = [_m, _r];
-                       }
-                       
-               } else if (window.ActiveXObject) {
-                       
-                       try { // avoid fp 6 crashes
-                               var _a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
-                               
-                       } catch(e) {
-                               try { 
-                                       _a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
-                                       version = [6, 0];
-                                       _a.AllowScriptAccess = "always"; // throws if fp < 6.47 
-                                       
-                               } catch(ee) {
-                                       if (version[0] == 6) { return; }
-                               }
-                               try {
-                                       _a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
-                               } catch(eee) {
-                               
-                               }
-                               
-                       }
-                       
-                       if (typeof _a == "object") {
-                               _d = _a.GetVariable("$version"); // bugs in fp 6.21 / 6.23
-                               if (typeof _d != "undefined") {
-                                       _d = _d.replace(/^\S+\s+(.*)$/, "$1").split(",");
-                                       version = [parseInt(_d[0], 10), parseInt(_d[2], 10)];
-                               }
-                       }
-               } 
-               
-               return version;
-       },
-       
-       isSupported: function(version) {
-               var now = flashembed.getVersion();
-               var ret = (now[0] > version[0]) || (now[0] == version[0] && now[1] >= version[1]);                      
-               return ret;
-       },
-       
-       domReady: domReady,
-       
-       // returns a String representation from JSON object 
-       asString: asString,
-       
-       getHTML: getHTML,
-       
-       getFullHTML: getFullHTML
-       
-});
-
-//}}}
-
-
-// setup jquery support
-if (jQ) {
-       
-       jQuery.prototype.flashembed = function(params, flashvars) { 
-               return this.each(function() { 
-                       flashembed(this, params, flashvars);
-               });
-       };
-
-}
-
-})();
-
-/************************************************
-********* mv_embed extension to flowplayer.js ***
-************************************************/       
-var flashEmbed = {
-       instanceOf:'flashEmbed',
-       monitorTimerId : 0,
-       old_pid:0,
-       didSeekJump:false,
-       startedTimedPlayback:false,             
-       didDateStartTimeRestore:false,
-       supports: {
-               'play_head':true, 
-               'pause':true,
-               'stop':true, 
-               //'fullscreen':true, 
-               'time_display':true, 
-               'volume_control':true,
-               'overlay':false,
-               'fullscreen':false
-       },
-       getEmbedHTML: function (){
-               setTimeout('document.getElementById(\''+this.id+'\').postEmbedJS()', 150);
-               return this.wrapEmebedContainer( this.getEmbedObj() );
-       },
-       getEmbedObj:function(){ 
-               //give the embed element a unique pid (work around for flowplayer persistence)
-               if( this.old_pid!=0 ){
-                       this.pid = this.pid +'_'+ this.old_pid;
-               }                               
-               return '<a  '+
-                                       'href="'+ this.getSrc() + '" '+  
-                                       'style="display:block;width:' + parseInt(this.width) + 'px;height:' + parseInt(this.height) + 'px" '+  
-                                       'id="'+this.pid+'">'+ 
-                               '</a>';
-       },
-       postEmbedJS: function()
-       {   
-               var _this = this;
-               js_log('embedFlow: uri:'+ this.getSrc() + "\n"+ mv_embed_path + 'binPlayers/flowplayer/flowplayer-3.0.1.swf' ) ;
-               var flowConfig = { 
-                       clip: { 
-                               url: this.getSrc(),                               
-                               // when this is false playback does not start until play button is pressed 
-                               autoPlay: true
-                       },
-                       plugins: { 
-                               controls: { 
-                                  all: false, 
-                                  fullscreen: true,
-                                  backgroundColor: 'transparent',
-                                  backgroundGradient: 'none',
-                                  autoHide:'always',
-                                  top:'95%',
-                                  right:'0px'
-                               }                                
-                       },
-                       screen: {
-                               opacity : '1.0'
-                       }                       
-               };
-               
-               //if in preview mode set grey and lower volume until "ready"
-               if( this.preview_mode ){
-                       flowConfig.screen.opacity = 0.2;                                 
-               }                                       
-               
-               $f(this.pid,  mv_embed_path + 'binPlayers/flowplayer/flowplayer-3.0.1.swf', flowConfig);                                  
-               //get the this.fla value:                
-               this.getFLA();          
-               //set up bindings (for when interacting with the swf causes action:  
-               this.fla.onPause(function(){                                                                                                                            
-                       _this.parent_pause();   //update the interface                   
-               })
-               this.fla.onResume( function(){
-                       _this.parent_play();    //update the interface  
-               });                             
-                  
-               //start monitor: 
-               this.monitor();  
-               this.old_pid++;
-       },   
-       /* js hooks/controls */
-       play: function(){                               
-               this.getFLA();          
-               //update play/pause button etc
-               this.parent_play();                             
-               if( this.fla ){                 
-                       this.fla.play();                        
-                       
-                       //on a resume make sure volume and opacity are correct 
-                       this.restorePlayer();                                            
-                       setTimeout('$j(\'#'+this.id+'\').get(0).monitor()', 250);
-               }
-       },
-       //@@todo support mute
-       toggleMute: function(){
-               this.parent_toggleMute();
-               this.getFLA();
-               if(this.fla){
-                       if(this.muted){
-                               
-                       }else{
-                               
-                       }
-               }
-       },
-       //@@ Suport UpDateVolumen 
-       updateVolumen:function(perc){
-               this.getFLA();          
-               if(this.fla)this.fla.setVolume(perc*100);
-                           
-    }, 
-    //@@ Get Volumen
-       getVolumen:function(){
-               this.getFLA();          
-               if(this.fla)
-                       return this.fla.getVolume() / 100;                         
-    }, 
-       fullscreen:function(){
-               if(this.fla){
-                       this.fla.fullscreen();
-               }else{
-                       js_log('must be playing before you can go fullscreen');
-               }
-       },
-       pause : function()
-       {
-               this.getFLA();
-               if(!this.thumbnail_disp){
-                       this.parent_pause();
-                       if(this.fla){           
-                               js_log("Flash:Pause: " + this.fla.isPaused() );
-                               if( this.fla['pause'] ){
-                                       if( ! this.fla.isPaused() ){
-                                               js_log('calling plugin pause');                         
-                                               this.fla.pause();  
-                                               
-                                               //restore volume and opacity 
-                                               this.restorePlayer();              
-                                       }
-                               }
-                       }
-               }
-       },
-       monitor : function()
-       {                       
-               var _this = this;
-               //date time
-               if( !this.dateStartTime ){
-                       var d = new Date();
-                       this.dateStartTime = d.getTime();
-                       
-               }else{
-                       var d = new Date();                                              
-                       if( !this.didDateStartTimeRestore  && this.preview_mode)
-                               this.fla.setVolume(0);
-                               
-                       if( (d.getTime() - this.dateStartTime) > 6000  && !this.didDateStartTimeRestore){                                                        
-                               this.restorePlayer(); 
-                       }
-               }                                         
-                                         
-               var flash_state = this.fla.getStatus();
-               //update the duration from the clip if its zero or not set: 
-               if( !this.duration || this.duration==0 ){
-                       if( this.fla.getClip() ){
-                               this.duration = this.fla.getClip().fullDuration;                                
-                               js_log('set duration via clip value: ' + this.getDuration() );
-                       }
-               }
-               //update the duration ntp values: 
-               this.getDuration();             
-
-               if( typeof flash_state == 'undefined' ){
-                        var flash_state = {
-                                "time" : this.fla.getTime()
-                        };                              
-                       //we are not getting buffered data restore volume and opacity
-                       this.restorePlayer();                                              
-               }else{
-                       //simplification of buffer state ... should move to support returning time rages like:
-                       //http://www.whatwg.org/specs/web-apps/current-work/#normalized-timeranges-object                       
-                       this.bufferedPercent = flash_state.bufferEnd / this.getDuration();                                                                      
-               }                          
-               //set the current Time (based on timeFormat)            
-               if( this.supportsURLTimeEncoding() ){
-                       this.currentTime = flash_state.time;                      
-                       //js_log('set buffer: ' + flash_state.bufferEnd + ' at time: ' + flash_state.time +' of total dur: ' + this.getDuration()); 
-               }else{
-                       this.currentTime = flash_state.time + this.start_offset;                                                
-                       //stop buffering if greater than the duration: 
-                       if( flash_state.bufferEnd > this.getDuration() + 5 ){
-                               //js_log('should stop buffering (does not seem to work)' + flash_state.bufferEnd + ' > dur: ' + this.getDuration() );
-                               this.fla.stopBuffering();
-                       } 
-               }                                 
-               
-               if(this.currentTime > npt2seconds(this.start_ntp) && !this.startedTimedPlayback){
-                       var fail = false;
-                       try
-                       {
-                               this.restorePlayer();                           
-                       }
-                       catch(err)
-                       {
-                               js_log('failed to set values');
-                               fail = true;
-                       }
-                       if(!fail)
-                               this.startedTimedPlayback=true;                                                                          
-               }
-               
-               /* to support local seeks */
-               if(this.currentTime > 1 && this.seek_time_sec != 0 && !this.supportsURLTimeEncoding() )
-               {
-                       js_log('flashEmbed: _local_ Seeking to ' + this.seek_time_sec);
-                       this.fla.seek( this.seek_time_sec );
-                       this.seek_time_sec = 0;
-               }                                               
-               
-               //checks to see if we reached the end of playback:                              
-               if(this.duration && this.startedTimedPlayback && 
-                       (        this.currentTime > (npt2seconds(this.end_ntp)+2) 
-                               || 
-                               ( this.currentTime > (npt2seconds(this.end_ntp)-1) 
-                                       && this.prevTime == this.currentTime) )
-                       ){                                                      
-                       js_log('prbally reached end of stream: '+ seconds2npt( this.currentTime) );
-                       this.onClipDone();                                
-               }               
-               
-               //update the status and check timmer via universal parent monitor
-               this.parent_monitor();
-               
-               
-               this.prevTime = this.currentTime;       
-               //js_log('cur perc loaded: ' + this.fla.getPercentLoaded() +' cur time : ' + (this.currentTime - npt2seconds(this.start_ntp)) +' / ' +(npt2seconds(this.end_ntp)-npt2seconds(this.start_ntp)));
-       },
-       restorePlayer:function(){               
-               if(!this.fla)
-                       this.getFLA();
-               if(this.fla){
-                       js_log('f:do restorePlayer');
-                       this.fla.setVolume(90); 
-                       $f().getPlugin('screen').css({'opacity':'1.0'} );
-                       //set the fallback date restore flag to true:
-                       this.didDateStartTimeRestore=true;                                
-               }               
-       },
-       // get the embed fla object 
-       getFLA : function (){
-               this.fla = $f(this.pid);                   
-       },
-       stop : function(){      
-               js_log('f:flashEmbed:stop');            
-               this.startedTimedPlayback=false;        
-               if (this.monitorTimerId != 0 )
-               {
-                       clearInterval(this.monitorTimerId);
-                       this.monitorTimerId = 0;
-               }
-               if(this.fla)
-                       this.fla.unload();
-               this.parent_stop();
-       },
-       onStop: function(){
-               js_log('f:onStop');
-               //stop updates: 
-               if( this.monitorTimerId != 0 )
-               {
-                       clearInterval(this.monitorTimerId);
-                       this.monitorTimerId = 0;
-               }
-       },
-       onClipDone: function(){                 
-               js_log('f:flash:onClipDone');           
-               if( ! this.startedTimedPlayback){
-                       js_log('clip done before timed playback started .. not good. (ignoring) ');                     
-                       //keep monitoring: 
-                       this.monitor();
-               }else{
-                       js_log('clip done and '+ this.startedTimedPlayback);
-                       //stop the clip if its not stopped already:
-                       this.stop();
-                       this.setStatus("Clip Done...");
-                       //run the onClip done action: 
-                       this.parent_onClipDone();
-               }
-       }
-};
diff --git a/js2/mwEmbed/libEmbedVideo/flowplayerEmbed.js b/js2/mwEmbed/libEmbedVideo/flowplayerEmbed.js
new file mode 100644 (file)
index 0000000..7964254
--- /dev/null
@@ -0,0 +1,1835 @@
+/**
+ * metavid: mv_flashEmbed builds off of flowplayer api (included first in this file) 
+ */
+ /**
+ * flowplayer.js 3.0.0-rc5. The Flowplayer API.
+ * 
+ * This file is part of Flowplayer, http://flowplayer.org
+ *
+ * Author: Tero Piirainen, <support@flowplayer.org>
+ * Copyright (c) 2008 Flowplayer Ltd
+ *
+ * Released under the MIT License:
+ * http://www.opensource.org/licenses/mit-license.php
+ * 
+ * Version: 3.0.0-rc5 - Thu Nov 20 2008 22:09:49 GMT-0000 (GMT+00:00)
+ */
+(function() {
+/* 
+       FEATURES 
+       --------
+       - handling multiple instances 
+       - Flowplayer programming API 
+       - Flowplayer event model        
+       - player loading / unloading
+       - $f() function
+       - jQuery support
+*/ 
+
+/*jslint glovar: true, browser: true */
+/*global flowplayer, $f */
+
+// {{{ private utility methods
+       
+       function log(args) {
+               
+               // write into opera console
+               if (typeof opera == 'object') {
+                       opera.postError("$f.fireEvent: " + args.join(" | "));   
+
+                       
+               } else if (typeof console == 'object') {
+                       console.log("$f.fireEvent", [].slice.call(args));       
+               }
+       }
+
+               
+       // thanks: http://keithdevens.com/weblog/archive/2007/Jun/07/javascript.clone
+       function clone(obj) {   
+               if (!obj || typeof obj != 'object') { return obj; }             
+               var temp = new obj.constructor();       
+               for (var key in obj) {  
+                       if (obj.hasOwnProperty(key)) {
+                               temp[key] = clone(obj[key]);
+                       }
+               }               
+               return temp;
+       }
+
+       // stripped from jQuery, thanks John Resig 
+       function each(obj, fn) {
+               if (!obj) { return; }
+               
+               var name, i = 0, length = obj.length;
+       
+               // object
+               if (length === undefined) {
+                       for (name in obj) {
+                               if (fn.call(obj[name], name, obj[name]) === false) { break; }
+                       }
+                       
+               // array
+               } else {
+                       for (var value = obj[0];
+                               i < length && fn.call( value, i, value ) !== false; value = obj[++i]) {                         
+                       }
+               }
+       
+               return obj;
+       }
+
+       
+       // convenience
+       function el(id) {
+               return document.getElementById(id);      
+       }       
+
+       
+       // used extensively. a very simple implementation. 
+       function extend(to, from, skipFuncs) {
+               if (to && from) {                       
+                       each(from, function(name, value) {
+                               if (!skipFuncs || typeof value != 'function') {
+                                       to[name] = value;               
+                               }
+                       });
+               }
+       }
+       
+       // var arr = select("elem.className"); 
+       function select(query) {
+               var index = query.indexOf("."); 
+               if (index != -1) {
+                       var tag = query.substring(0, index) || "*";
+                       var klass = query.substring(index + 1, query.length);
+                       var els = [];
+                       each(document.getElementsByTagName(tag), function() {
+                               if (this.className && this.className.indexOf(klass) != -1) {
+                                       els.push(this);         
+                               }
+                       });
+                       return els;
+               }
+       }
+       
+       // fix event inconsistencies across browsers
+       function stopEvent(e) {
+               e = e || window.event;
+               
+               if (e.preventDefault) {
+                       e.stopPropagation();
+                       e.preventDefault();
+                       
+               } else {
+                       e.returnValue = false;  
+                       e.cancelBubble = true;
+               } 
+               return false;
+       }
+
+       // push an event listener into existing array of listeners
+       function bind(to, evt, fn) {
+               to[evt] = to[evt] || [];
+               to[evt].push(fn);               
+       }
+       
+       
+       // generates an unique id
+   function makeId() {
+         return "_" + ("" + Math.random()).substring(2, 10);   
+   }
+       
+//}}}  
+       
+
+// {{{ Clip
+
+       var Clip = function(json, index, player) {
+               
+               // private variables
+               var self = this;
+               var cuepoints = {};
+               var listeners = {}; 
+               this.index = index;
+               
+               // instance variables
+               if (typeof json == 'string') {
+                       json = {url:json};      
+               }
+       
+               extend(this, json, true);       
+               
+               // event handling 
+               each(("Begin*,Start,Pause*,Resume*,Seek*,Stop*,Finish*,LastSecond,Update,BufferFull,BufferEmpty,BufferStop").split(","),
+                       function() {
+                       
+                       var evt = "on" + this;
+                               
+                       // before event
+                       if (evt.indexOf("*") != -1) {
+                               evt = evt.substring(0, evt.length -1); 
+                               var before = "onBefore" + evt.substring(2); 
+                               
+                               self[before] = function(fn) {
+                                       bind(listeners, before, fn);
+                                       return self;
+                               };                              
+                       }  
+                       
+                       self[evt] = function(fn) {
+                               bind(listeners, evt, fn);
+                               return self;
+                       };
+                       
+                       
+                       // set common clip event listeners to player level
+                       if (index == -1) {
+                               if (self[before]) {
+                                       player[before] = self[before];          
+                               }                               
+                               if (self[evt])  {
+                                       player[evt] = self[evt];                
+                               }
+                       }
+                       
+               });                       
+               
+               extend(this, {
+                       
+                        
+                       onCuepoint: function(points, fn) {
+                               
+                               // embedded cuepoints
+                               if (arguments.length == 1) {
+                                       cuepoints.embedded = [null, points];
+                                       return self;
+                               }
+                               
+                               if (typeof points == 'number') {
+                                       points = [points];      
+                               }
+                               
+                               var fnId = makeId();  
+                               cuepoints[fnId] = [points, fn]; 
+                               
+                               if (player.isLoaded()) {
+                                       player._api().fp_addCuepoints(points, index, fnId);     
+                               }  
+                               
+                               return self;
+                       },
+                       
+                       update: function(json) {
+                               extend(self, json);
+
+                               if (player.isLoaded()) {
+                                       player._api().fp_updateClip(json, index);       
+                               }
+                               var conf = player.getConfig(); 
+                               var clip = (index == -1) ? conf.clip : conf.playlist[index];
+                               extend(clip, json, true);
+                       },
+                       
+                       
+                       // internal event for performing clip tasks. should be made private someday
+                       _fireEvent: function(evt, arg1, arg2, target) {                          
+                               
+                               if (evt == 'onLoad') { 
+                                       each(cuepoints, function(key, val) {
+                                               player._api().fp_addCuepoints(val[0], index, key);               
+                                       }); 
+                                       return false;
+                               }                                       
+                               
+                               // target clip we are working against
+                               if (index != -1) {
+                                       target = self;  
+                               }
+                               
+                               if (evt == 'onCuepoint') {
+                                       var fn = cuepoints[arg1];
+                                       if (fn) {
+                                               return fn[1].call(player, target, arg2);
+                                       }
+                               }  
+       
+                               if (evt == 'onStart' || evt == 'onUpdate') {
+                                       
+                                       extend(target, arg1);                                   
+                                       
+                                       if (!target.duration) {
+                                               target.duration = arg1.metaData.duration;        
+                                       } else {
+                                               target.fullDuration = arg1.metaData.duration;   
+                                       }                                         
+                               }  
+                               
+                               var ret = true;
+                               each(listeners[evt], function() {
+                                       ret = this.call(player, target, arg1);          
+                               }); 
+                               return ret;                             
+                       }                       
+                       
+               });
+               
+               
+               // get cuepoints from config
+               if (json.onCuepoint) {
+                       self.onCuepoint.apply(self, json.onCuepoint);
+                       delete json.onCuepoint;
+               } 
+               
+               // get other events
+               each(json, function(key, val) {
+                       if (typeof val == 'function') {
+                               bind(listeners, key, val);
+                               delete json[key];       
+                       }
+               });
+
+               
+               // setup common clip event callbacks for Player object too (shortcuts)
+               if (index == -1) {
+                       player.onCuepoint = this.onCuepoint;    
+               }
+       
+       };
+
+//}}}
+
+
+// {{{ Plugin
+               
+       var Plugin = function(name, json, player, fn) {
+       
+               var listeners = {};
+               var self = this;   
+               var hasMethods = false;
+       
+               if (fn) {
+                       extend(listeners, fn);  
+               }   
+               
+               // custom callback functions in configuration
+               each(json, function(key, val) {
+                       if (typeof val == 'function') {
+                               listeners[key] = val;
+                               delete json[key];       
+                       }
+               });  
+               
+               // core plugin methods          
+               extend(this, {
+  
+                       animate: function(props, speed, fn) { 
+                               if (!props) {
+                                       return self;    
+                               }
+                               
+                               if (typeof speed == 'function') { 
+                                       fn = speed; 
+                                       speed = 500;
+                               }
+                               
+                               if (typeof props == 'string') {
+                                       var key = props;
+                                       props = {};
+                                       props[key] = speed;
+                                       speed = 500; 
+                               }
+                               
+                               if (fn) {
+                                       var fnId = makeId();
+                                       listeners[fnId] = fn;
+                               }
+               
+                               if (speed === undefined) { speed = 500; }
+                               json = player._api().fp_animate(name, props, speed, fnId);      
+                               return self;
+                       },
+                       
+                       css: function(props, val) {
+                               if (val !== undefined) {
+                                       var css = {};
+                                       css[props] = val;
+                                       props = css;                                    
+                               }
+                               try{
+                                       json = player._api().fp_css(name, props);
+                                       extend(self, json);
+                                       return self;
+                               }catch(e){
+                                       js_log('flow player could not set css: ' + json);
+                               }
+                       },
+                       
+                       show: function() {
+                               this.display = 'block';
+                               player._api().fp_showPlugin(name);
+                               return self;
+                       },
+                       
+                       hide: function() {
+                               this.display = 'none';
+                               player._api().fp_hidePlugin(name);
+                               return self;
+                       },
+                       
+                       toggle: function() {
+                               this.display = player._api().fp_togglePlugin(name);
+                               return self;
+                       },                      
+                       
+                       fadeTo: function(o, speed, fn) {
+                               
+                               if (typeof speed == 'function') { 
+                                       fn = speed; 
+                                       speed = 500;
+                               }
+                               
+                               if (fn) {
+                                       var fnId = makeId();
+                                       listeners[fnId] = fn;
+                               }                               
+                               this.display = player._api().fp_fadeTo(name, o, speed, fnId);
+                               this.opacity = o;
+                               return self;
+                       },
+                       
+                       fadeIn: function(speed, fn) { 
+                               return self.fadeTo(1, speed, fn);                               
+                       },
+       
+                       fadeOut: function(speed, fn) {
+                               return self.fadeTo(0, speed, fn);       
+                       },
+                       
+                       getName: function() {
+                               return name;    
+                       },
+                       
+                       
+                       // internal method not meant to be used by clients
+                _fireEvent: function(evt, arg) {
+
+                               
+                       // update plugins properties & methods
+                       if (evt == 'onUpdate') {
+                          var json = arg || player._api().fp_getPlugin(name); 
+                                       if (!json) { return;    }                                       
+                                       
+                          extend(self, json);
+                          delete self.methods;
+                                       
+                          if (!hasMethods) {
+                                 each(json.methods, function() {
+                                        var method = "" + this;           
+                                                       
+                                        self[method] = function() {
+                                               var a = [].slice.call(arguments);
+                                               var ret = player._api().fp_invoke(name, method, a); 
+                                               return ret == 'undefined' ? self : ret;
+                                        };
+                                 });
+                                 hasMethods = true;             
+                          }
+                       }
+                       
+                       // plugin callbacks
+                       var fn = listeners[evt];
+
+                               if (fn) {
+                                       
+                                       fn.call(self, arg);
+                                       
+                                       // "one-shot" callback
+                                       if (evt.substring(0, 1) == "_") {
+                                               delete listeners[evt];  
+                                       } 
+                       }                
+                }                                       
+                       
+               });
+
+       };
+
+
+//}}}
+
+
+function Player(wrapper, params, conf) {   
+               
+       // private variables (+ arguments)
+       var 
+               self = this, 
+               api = null, 
+               html, 
+               commonClip, 
+               playlist = [], 
+               plugins = {},
+               listeners = {},
+               playerId,
+               apiId,
+               activeIndex,
+               swfHeight,
+               wrapperHeight;  
+
+  
+// {{{ public methods 
+       
+       extend(self, {
+                       
+               id: function() {
+                       return playerId;        
+               }, 
+               
+               isLoaded: function() {
+                       return (api !== null);  
+               },
+               
+               getParent: function() {
+                       return wrapper; 
+               },
+               
+               hide: function(all) {
+                       if (all) { wrapper.style.height = "0px"; }
+                       if (api) { api.style.height = "0px"; } 
+                       return self;
+               },
+
+               show: function() {
+                       wrapper.style.height = wrapperHeight + "px";
+                       if (api) { api.style.height = swfHeight + "px"; }
+                       return self;
+               }, 
+                                       
+               isHidden: function() {
+                       return api && parseInt(api.style.height, 10) === 0;
+               },
+               
+               
+               load: function(fn) { 
+                       
+                       if (!api && self._fireEvent("onBeforeLoad") !== false) {
+                               
+                               // unload all instances
+                               each(players, function()  {
+                                       this.unload();          
+                               });
+                               
+                               html = wrapper.innerHTML; 
+                               flashembed(wrapper, params, {config: conf});
+                               
+                               // function argument
+                               if (fn) {
+                                       fn.cached = true;
+                                       bind(listeners, "onLoad", fn);  
+                               }
+                       }
+                       
+                       return self;    
+               },
+               
+               unload: function() {  
+                       
+                if (api && html.replace(/\s/g, '') !== '' && !api.fp_isFullscreen() && 
+                       self._fireEvent("onBeforeUnload") !== false) { 
+                               api.fp_close();
+                               wrapper.innerHTML = html; 
+                               self._fireEvent("onUnload");
+                               api = null;
+                       }
+                       
+                       return self;
+               },
+
+               getClip: function(index) {
+                       if (index === undefined) {
+                               index = activeIndex;    
+                       }
+                       return playlist[index];
+               },
+               
+               
+               getCommonClip: function() {
+                       return commonClip;      
+               },              
+               
+               getPlaylist: function() {
+                       return playlist; 
+               },
+               
+         getPlugin: function(name) {  
+                var plugin = plugins[name];
+                
+                       // create plugin if nessessary
+                if (!plugin && self.isLoaded()) {
+                               var json = self._api().fp_getPlugin(name);
+                               if (json) {
+                                       plugin = new Plugin(name, json, self);
+                                       plugins[name] = plugin;                                           
+                               } 
+                }              
+                return plugin; 
+         },
+               
+               getScreen: function() { 
+                       return self.getPlugin("screen");
+               }, 
+               
+               getControls: function() { 
+                       return self.getPlugin("controls");
+               }, 
+
+               getConfig: function() { 
+                       return clone(conf);
+               },
+               
+               getFlashParams: function() { 
+                       return params;
+               },              
+               
+               loadPlugin: function(name, url, props, fn) { 
+
+                       // properties not supplied                      
+                       if (typeof props == 'function') { 
+                               fn = props; 
+                               props = {};
+                       } 
+                       
+                       // if fn not given, make a fake id so that plugin's onUpdate get's fired
+                       var fnId = fn ? makeId() : "_"; 
+                       self._api().fp_loadPlugin(name, url, props, fnId); 
+                       
+                       // create new plugin
+                       var arg = {};
+                       arg[fnId] = fn;
+                       var p = new Plugin(name, null, self, arg);
+                       plugins[name] = p;
+                       return p;                       
+               },
+               
+               
+               getState: function() {
+                       return api ? api.fp_getState() : -1;
+               },
+               
+               // "lazy" play
+               play: function(clip) {
+                       
+                       function play() {
+                               if (clip !== undefined) {
+                                       self._api().fp_play(clip);
+                               } else {
+                                       if(typeof self._api().fp_play == 'function')
+                                               self._api().fp_play();  
+                               }
+                       }
+                       
+                       if (api) {
+                               play();
+                               
+                       } else {
+                               self.load(function() { 
+                                       play();
+                               });
+                       }
+                       
+                       return self;
+               },
+               
+               getVersion: function() {
+                       var js = "flowplayer.js 3.0.0-rc5";
+                       if (api) {
+                               var ver = api.fp_getVersion();
+                               ver.push(js);
+                               return ver;
+                       }
+                       return js; 
+               },
+               
+               _api: function() {
+                       if (!api) {
+                               throw "Flowplayer " +self.id()+ " not loaded. Try moving your call to player's onLoad event";
+                       }
+                       return api;                             
+               },
+               
+               _dump: function() {
+                       console.log(listeners);
+               }
+               
+       }); 
+       
+       
+       // event handlers
+       each(("Click*,Load*,Unload*,Keypress*,Volume*,Mute*,Unmute*,PlaylistReplace,Fullscreen*,FullscreenExit,Error").split(","),
+               function() {             
+                       var name = "on" + this;
+                       
+                       // before event
+                       if (name.indexOf("*") != -1) {
+                               name = name.substring(0, name.length -1); 
+                               var name2 = "onBefore" + name.substring(2);
+                               self[name2] = function(fn) {
+                                       bind(listeners, name2, fn);     
+                                       return self;
+                               };                                              
+                       }
+                       
+                       // normal event
+                       self[name] = function(fn) {
+                               bind(listeners, name, fn);      
+                               return self;
+                       };                       
+               }
+       ); 
+       
+       
+       // core API methods
+       each(("pause,resume,mute,unmute,stop,toggle,seek,getStatus,getVolume,setVolume,getTime,isPaused,isPlaying,startBuffering,stopBuffering,isFullscreen,reset").split(","),         
+               function() {             
+                       var name = this;
+                       
+                       self[name] = function(arg) {
+                               if (!api) { return self; }
+                               try{
+                                       var ret = (arg === undefined) ? api["fp_" + name]() : api["fp_" + name](arg);
+                                       return ret == 'undefined' ? self : ret;
+                               }catch (e){
+                                       js_log('flowplayer could not access fp_ '+ name);
+                               }
+                       };                       
+               }
+       );               
+       
+//}}}
+
+
+// {{{ public method: _fireEvent
+               
+       self._fireEvent = function(evt, arg0, arg1, arg2) {             
+                               
+               if (conf.debug) {
+                       log(arguments);         
+               }                               
+               
+               // internal onLoad
+               if (evt == 'onLoad' && !api) {  
+                       
+                       api = api || el(apiId); 
+                       swfHeight = api.clientHeight;
+                       
+                       each(playlist, function() {
+                               this._fireEvent("onLoad");              
+                       });
+                       
+                       each(plugins, function(name, p) {
+                               p._fireEvent("onUpdate");               
+                       });
+                       
+                       
+                       commonClip._fireEvent("onLoad");  
+               }
+               
+         if (evt == 'onContextMenu') {
+                each(conf.contextMenu[arg0], function(key, fn)  {
+                       fn.call(self);
+                });
+                return;
+         }
+
+               if (evt == 'onPluginEvent') {
+                       var name = arg0.name || arg0;
+                       var p = plugins[name];
+                       if (p) {
+                               if (arg0.name) {
+                                       p._fireEvent("onUpdate", arg0);         
+                               }
+                               p._fireEvent(arg1);             
+                       }
+                       return;
+               }               
+
+               // onPlaylistReplace
+               if (evt == 'onPlaylistReplace') {
+                       playlist = [];
+                       var index = 0;
+                       each(arg0, function() {
+                               playlist.push(new Clip(this, index++));
+                       });             
+               }
+               
+               var ret = true;
+               
+               // clip event
+               if (arg0 === 0 || (arg0 && arg0 >= 0)) {
+                       
+                       activeIndex = arg0;
+                       var clip = playlist[arg0];                      
+                       
+                       if (clip) {
+                               ret = clip._fireEvent(evt, arg1, arg2); 
+                       } 
+                       
+                       if (!clip || ret !== false) {
+                               
+                               // clip argument is given for common clip, because it behaves as the target
+                               ret = commonClip._fireEvent(evt, arg1, arg2, clip);     
+                       }  
+               } 
+               
+               // player event 
+               var i = 0;
+               each(listeners[evt], function() {
+                       ret = this.call(self, arg0);            
+                       
+                       // remove cached entry
+                       if (this.cached) {
+                               listeners[evt].splice(i, 1);    
+                       }
+                       
+                       // break loop
+                       if (ret === false) { return false;       }
+                       i++;
+                       
+               }); 
+
+               return ret;
+       };
+
+//}}}
+
+// {{{ init
+       
+   function init() {
+               
+               if ($f(wrapper)) {
+                       return null;    
+               }               
+               
+               wrapperHeight = parseInt(wrapper.style.height) || wrapper.clientHeight;
+               
+               // register this player into global array of instances
+               players.push(self);  
+               
+               
+               // flashembed parameters
+               if (typeof params == 'string') {
+                       params = {src: params}; 
+               }       
+               
+               // playerId     
+               playerId = wrapper.id || "fp" + makeId();
+               apiId = params.id || playerId + "_api";          
+               params.id = apiId;
+               conf.playerId = playerId;
+               
+               
+               // plain url is given as config
+               if (typeof conf == 'string') {
+                       conf = {clip:{url:conf}};       
+               } 
+               
+               // common clip is always there
+               conf.clip = conf.clip || {};
+               commonClip = new Clip(conf.clip, -1, self);  
+               
+               
+               // wrapper href as playlist
+               if (wrapper.getAttribute("href")) { 
+                       conf.playlist = [{url:wrapper.getAttribute("href", 2)}];                        
+               } 
+               
+               // playlist
+               conf.playlist = conf.playlist || [conf.clip]; 
+               
+               var index = 0;
+               each(conf.playlist, function() {
+
+                       var clip = this;
+                       
+                       // clip is an array, we don't allow that
+                       if (typeof clip == 'object' && clip.length)  {
+                               clip = "" + clip;       
+                       }
+                       
+                       if (!clip.url && typeof clip == 'string') {                             
+                               clip = {url: clip};                             
+                       } 
+                       
+                       // populate common clip properties to each clip
+                       extend(clip, conf.clip, true);          
+                       
+                       // modify configuration playlist
+                       conf.playlist[index] = clip;                    
+                       
+                       // populate playlist array
+                       clip = new Clip(clip, index, self);
+                       playlist.push(clip);                                            
+                       index++;                        
+               });
+                       
+               
+               // event listeners
+               each(conf, function(key, val) {
+                       if (typeof val == 'function') {
+                               bind(listeners, key, val);
+                               delete conf[key];       
+                       }
+               });              
+               
+               
+               // plugins
+               each(conf.plugins, function(name, val) {
+                       if (val) {
+                               plugins[name] = new Plugin(name, val, self);
+                       }
+               });
+               
+               
+               // setup controlbar plugin if not explicitly defined
+               if (!conf.plugins || conf.plugins.controls === undefined) {
+                       plugins.controls = new Plugin("controls", null, self);  
+               } 
+               
+               // Flowplayer uses black background by default
+               params.bgcolor = params.bgcolor || "#000000";
+               
+               
+               // setup default settings for express install
+               params.version = params.version || [9,0];               
+               params.expressInstall = 'http://www.flowplayer.org/swf/expressinstall.swf';
+               
+               
+               // click function
+               function doClick(e) {
+                       if (self._fireEvent("onBeforeClick") !== false) {
+                               self.load();            
+                       } 
+                       return stopEvent(e);                                    
+               }
+               
+               // defer loading upon click
+               html = wrapper.innerHTML;
+               if (html.replace(/\s/g, '') !== '') {    
+                       
+                       if (wrapper.addEventListener) {
+                               wrapper.addEventListener("click", doClick, false);      
+                               
+                       } else if (wrapper.attachEvent) {
+                               wrapper.attachEvent("onclick", doClick);        
+                       }
+                       
+               // player is loaded upon page load 
+               } else {
+                       
+                       // prevent default action from wrapper (safari problem) loaded
+                       if (wrapper.addEventListener) {
+                               wrapper.addEventListener("click", stopEvent, false);    
+                       }
+                       
+                       // load player
+                       self.load();
+               }
+               
+       }
+
+       // possibly defer initialization until DOM get's loaded
+       if (typeof wrapper == 'string') { 
+               flashembed.domReady(function() {
+                       var node = el(wrapper); 
+                       
+                       if (!node) {
+                               throw "Flowplayer cannot access element: " + wrapper;   
+                       } else {
+                               wrapper = node; 
+                               init();                                 
+                       } 
+               });
+               
+       // we have a DOM element so page is already loaded
+       } else {                
+               init();
+       }
+       
+       
+//}}}
+
+
+}
+
+
+// {{{ flowplayer() & statics 
+
+// container for player instances
+var players = [];
+
+
+// this object is returned when multiple player's are requested 
+function Iterator(arr) {
+       
+       this.length = arr.length;
+       
+       this.each = function(fn)  {
+               each(arr, fn);  
+       };
+       
+       this.size = function() {
+               return arr.length;      
+       };      
+}
+
+// these two variables are the only global variables
+window.flowplayer = window.$f = function() {
+       
+       var instance = null;
+       var arg = arguments[0]; 
+       
+       
+       // $f()
+       if (!arguments.length) {
+               each(players, function() {
+                       if (this.isLoaded())  {
+                               instance = this;        
+                               return false;
+                       }
+               });
+               
+               return instance || players[0];
+       } 
+       
+       if (arguments.length == 1) {
+               
+               // $f(index);
+               if (typeof arg == 'number') { 
+                       return players[arg];    
+       
+                       
+               // $f(wrapper || 'containerId' || '*');
+               } else {
+                       
+                       // $f("*");
+                       if (arg == '*') {
+                               return new Iterator(players);   
+                       }
+                       
+                       // $f(wrapper || 'containerId');
+                       each(players, function() {
+                               if (this.id() == arg.id || this.id() == arg || this.getParent() == arg)  {
+                                       instance = this;        
+                                       return false;
+                               }
+                       });
+                       
+                       return instance;                                        
+               }
+       }                        
+
+       // instance builder 
+       if (arguments.length > 1) {             
+
+               var swf = arguments[1];
+               var conf = (arguments.length == 3) ? arguments[2] : {};
+                                               
+               if (typeof arg == 'string') {
+                       
+                       // select arg by classname
+                       if (arg.indexOf(".") != -1) {
+                               var instances = [];
+                               
+                               each(select(arg), function() { 
+                                       instances.push(new Player(this, clone(swf), clone(conf)));               
+                               });     
+                               
+                               return new Iterator(instances);
+                               
+                       // select node by id
+                       } else {                
+                               var node = el(arg);
+                               return new Player(node !== null ? node : arg, swf, conf);         
+                       } 
+                       
+                       
+               // arg is a DOM element
+               } else if (arg) {
+                       return new Player(arg, swf, conf);                                              
+               }
+               
+       } 
+       
+       return null; 
+};
+       
+extend(window.$f, {
+
+       // called by Flash External Interface            
+       fireEvent: function(id, evt, a0, a1, a2) {              
+               var p = $f(id);         
+               return p ? p._fireEvent(evt, a0, a1, a2) : null;
+       },
+       
+       
+       // create plugins by modifying Player's prototype
+       addPlugin: function(name, fn) {
+               Player.prototype[name] = fn;
+               return $f;
+       },
+       
+       // utility methods for plugin developers
+       each: each,
+       
+       extend: extend
+       
+});
+       
+//}}}
+
+
+//{{{ jQuery support
+
+if (typeof jQuery == 'function') {
+       
+       jQuery.prototype.flowplayer = function(params, conf) {  
+               
+               // select instances
+               if (!arguments.length || typeof arguments[0] == 'number') {
+                       var arr = [];
+                       this.each(function()  {
+                               var p = $f(this);
+                               if (p) {
+                                       arr.push(p);    
+                               }
+                       });
+                       return arguments.length ? arr[arguments[0]] : new Iterator(arr);
+               }
+               
+               // create flowplayer instances
+               return this.each(function() { 
+                       $f(this, clone(params), conf ? clone(conf) : {});       
+               }); 
+               
+       };
+       
+}
+
+//}}}
+
+
+})();
+/** 
+ * flashembed 0.34. Adobe Flash embedding script
+ * 
+ * http://flowplayer.org/tools/flash-embed.html
+ *
+ * Copyright (c) 2008 Tero Piirainen (support@flowplayer.org)
+ *
+ * Released under the MIT License:
+ * http://www.opensource.org/licenses/mit-license.php
+ * 
+ * >> Basically you can do anything you want but leave this header as is <<
+ *
+ * first version 0.01 - 03/11/2008 
+ * version 0.34 - Tue Nov 11 2008 09:09:52 GMT-0000 (GMT+00:00)
+ */
+(function() { 
+//{{{ utility functions 
+               
+var jQ = typeof jQuery == 'function';
+
+
+// from "Pro JavaScript techniques" by John Resig
+function isDomReady() {
+       
+       if (domReady.done)  { return false; }
+       
+       var d = document;
+       if (d && d.getElementsByTagName && d.getElementById && d.body) {
+               clearInterval(domReady.timer);
+               domReady.timer = null;
+               
+               for (var i = 0; i < domReady.ready.length; i++) {
+                       domReady.ready[i].call();       
+               }
+               
+               domReady.ready = null;
+               domReady.done = true;
+       } 
+}
+
+// if jQuery is present, use it's more effective domReady method
+var domReady = jQ ? jQuery : function(f) {
+       
+       if (domReady.done) {
+               return f();     
+       }
+       
+       if (domReady.timer) {
+               domReady.ready.push(f); 
+               
+       } else {
+               domReady.ready = [f];
+               domReady.timer = setInterval(isDomReady, 13);
+       } 
+};     
+
+
+// override extend params function 
+function extend(to, from) {
+       if (from) {
+               for (key in from) {
+                       if (from.hasOwnProperty(key)) {
+                               to[key] = from[key];
+                       }
+               }
+       }
+       
+       return to;
+}      
+
+
+function concatVars(vars) {            
+       var out = "";
+       
+       for (var key in vars) { 
+               if (vars[key]) {
+                       out += [key] + '=' + asString(vars[key]) + '&';
+               }
+       }                       
+       return out.substring(0, out.length -1);                         
+}  
+
+
+
+// JSON.asString() function
+function asString(obj) {
+
+       switch (typeOf(obj)){
+               case 'string':
+                       obj = obj.replace(new RegExp('(["\\\\])', 'g'), '\\$1');
+                       
+                       // flash does not handle %- characters well. transforms "50%" to "50pct" (a dirty hack, I admit)
+                       obj = obj.replace(/^\s?(\d+)%/, "$1pct");
+                       return '"' +obj+ '"';
+                       
+               case 'array':
+                       return '['+ map(obj, function(el) {
+                               return asString(el);
+                       }).join(',') +']'; 
+                       
+               case 'function':
+                       return '"function()"';
+                       
+               case 'object':
+                       var str = [];
+                       for (var prop in obj) {
+                               if (obj.hasOwnProperty(prop)) {
+                                       str.push('"'+prop+'":'+ asString(obj[prop]));
+                               }
+                       }
+                       return '{'+str.join(',')+'}';
+       }
+       
+       // replace ' --> "  and remove spaces
+       return String(obj).replace(/\s/g, " ").replace(/\'/g, "\"");
+}
+
+
+// private functions
+function typeOf(obj) {
+       if (obj === null || obj === undefined) { return false; }
+       var type = typeof obj;
+       return (type == 'object' && obj.push) ? 'array' : type;
+}
+
+
+// version 9 bugfix: (http://blog.deconcept.com/2006/07/28/swfobject-143-released/)
+if (window.attachEvent) {
+       window.attachEvent("onbeforeunload", function() {
+               __flash_unloadHandler = function() {};
+               __flash_savedUnloadHandler = function() {};
+       });
+}
+
+function map(arr, func) {
+       var newArr = []; 
+       for (var i in arr) {
+               if (arr.hasOwnProperty(i)) {
+                       newArr[i] = func(arr[i]);
+               }
+       }
+       return newArr;
+}
+       
+function getEmbedCode(p, c) {
+       var html = '<embed type="application/x-shockwave-flash" ';
+
+       if (p.id) { extend(p, {name:p.id}); }
+       
+       for (var key in p) { 
+               if (p[key] !== null) { 
+                       html += key + '="' +p[key]+ '"\n\t';
+               }
+       }
+
+       if (c) {
+                html += 'flashvars=\'' + concatVars(c) + '\'';
+       }
+       
+       // thanks Tom Price (07/17/2008)
+       html += '/>';
+       
+       return html;
+}
+
+function getObjectCode(p, c, embeddable) {
+       
+       var html = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
+       html += 'width="' + p.width + '" height="' + p.height + '"'; 
+       
+       // force id for IE. otherwise embedded Flash object cannot be returned
+       if (!p.id && document.all) {
+               p.id = "_" + ("" + Math.random()).substring(5);
+       } 
+       
+       if (p.id) {
+               html += ' id="' + p.id + '"';
+       }
+       
+       html += '>';  
+       
+       // sometimes ie fails to load flash if it's on cache
+       if (document.all) {
+               p.src += ((p.src.indexOf("?") != -1 ? "&" : "?") + Math.random());              
+       } 
+       
+       html += '\n\t<param name="movie" value="'+ p.src +'" />';
+
+       var e = extend({}, p);
+       e.id = e.width = e.height = e.src = null;
+       
+       for (var k in e) {
+               if (e[k] !== null) {
+                       html += '\n\t<param name="'+ k +'" value="'+ e[k] +'" />';
+               }
+       }
+       
+       if (c) {
+               html += '\n\t<param name="flashvars" value=\'' + concatVars(c) + '\' />';
+       }
+       
+       if (embeddable) {
+               html += getEmbedCode(p, c);     
+       }
+        
+       html += "</object>";
+       
+       return html;
+}
+
+function getFullHTML(p, c) {
+       return getObjectCode(p, c, true);       
+}
+
+function getHTML(p, c) { 
+       var isNav = navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length; 
+       return (isNav) ? getEmbedCode(p, c) : getObjectCode(p, c);
+}
+
+//}}}
+
+       
+window.flashembed = function(root, userParams, flashvars) {    
+       
+       
+//{{{ construction
+               
+       // setup params
+       var params = {
+               
+               // very common params
+               src: '#',
+               width: '100%',
+               height: '100%',         
+               
+               // flashembed specific options
+               version:null,
+               onFail:null,
+               expressInstall:null,  
+               debug: false,
+               
+               // flashembed defaults
+               // bgcolor: 'transparent',
+               allowfullscreen: true,
+               allowscriptaccess: 'always',
+               quality: 'high',
+               type: 'application/x-shockwave-flash',
+               pluginspage: 'http://www.adobe.com/go/getflashplayer'
+       };
+       
+       
+       if (typeof userParams == 'string') {
+               userParams = {src: userParams}; 
+       }
+       
+       extend(params, userParams);                      
+               
+       var version = flashembed.getVersion(); 
+       var required = params.version; 
+       var express = params.expressInstall;             
+       var debug = params.debug;
+
+       
+       if (typeof root == 'string') {
+               var el = document.getElementById(root);
+               if (el) {
+                       root = el;      
+               } else {
+                       domReady(function() {
+                               flashembed(root, userParams, flashvars);
+                       });
+                       return;          
+               } 
+       }
+       
+       if (!root) { return; }
+
+       
+       // is supported 
+       if (!required || flashembed.isSupported(required)) {
+               params.onFail = params.version = params.expressInstall = params.debug = null;
+               
+               // root.innerHTML may cause broplems: http://domscripting.com/blog/display/99
+               // thanks to: Ryan Rud
+               // var tmp = document.createElement("extradiv");
+               // tmp.innerHTML = getHTML();
+               // root.appendChild(tmp);
+               
+               root.innerHTML = getHTML(params, flashvars);
+               
+               // return our API                       
+               return root.firstChild;
+               
+       // custom fail event
+       } else if (params.onFail) {
+               var ret = params.onFail.call(params, flashembed.getVersion(), flashvars);
+               if (ret === true) { root.innerHTML = ret; }             
+               
+
+       // express install
+       } else if (required && express && flashembed.isSupported([6,65])) {
+               
+               extend(params, {src: express});
+               
+               flashvars = {
+                       MMredirectURL: location.href,
+                       MMplayerType: 'PlugIn',
+                       MMdoctitle: document.title
+               };
+               
+               root.innerHTML = getHTML(params, flashvars);    
+               
+       // not supported
+       } else {
+
+               // minor bug fixed here 08.04.2008 (thanks JRodman)
+               
+               if (root.innerHTML.replace(/\s/g, '') !== '') {
+                       // custom content was supplied
+               
+               } else {
+                       root.innerHTML = 
+                               "<h2>Flash version " + required + " or greater is required</h2>" + 
+                               "<h3>" + 
+                                       (version[0] > 0 ? "Your version is " + version : "You have no flash plugin installed") +
+                               "</h3>" + 
+                               "<p>Download latest version from <a href='" + params.pluginspage + "'>here</a></p>";
+               }
+       }
+
+       return root;
+       
+//}}}
+       
+       
+};
+
+
+//{{{ static methods
+
+extend(window.flashembed, {
+
+       // returns arr[major, fix]
+       getVersion: function() {
+       
+               var version = [0, 0];
+               
+               if (navigator.plugins && typeof navigator.plugins["Shockwave Flash"] == "object") {
+                       var _d = navigator.plugins["Shockwave Flash"].description;
+                       if (typeof _d != "undefined") {
+                               _d = _d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
+                               var _m = parseInt(_d.replace(/^(.*)\..*$/, "$1"), 10);
+                               var _r = /r/.test(_d) ? parseInt(_d.replace(/^.*r(.*)$/, "$1"), 10) : 0;
+                               version = [_m, _r];
+                       }
+                       
+               } else if (window.ActiveXObject) {
+                       
+                       try { // avoid fp 6 crashes
+                               var _a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
+                               
+                       } catch(e) {
+                               try { 
+                                       _a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
+                                       version = [6, 0];
+                                       _a.AllowScriptAccess = "always"; // throws if fp < 6.47 
+                                       
+                               } catch(ee) {
+                                       if (version[0] == 6) { return; }
+                               }
+                               try {
+                                       _a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
+                               } catch(eee) {
+                               
+                               }
+                               
+                       }
+                       
+                       if (typeof _a == "object") {
+                               _d = _a.GetVariable("$version"); // bugs in fp 6.21 / 6.23
+                               if (typeof _d != "undefined") {
+                                       _d = _d.replace(/^\S+\s+(.*)$/, "$1").split(",");
+                                       version = [parseInt(_d[0], 10), parseInt(_d[2], 10)];
+                               }
+                       }
+               } 
+               
+               return version;
+       },
+       
+       isSupported: function(version) {
+               var now = flashembed.getVersion();
+               var ret = (now[0] > version[0]) || (now[0] == version[0] && now[1] >= version[1]);                      
+               return ret;
+       },
+       
+       domReady: domReady,
+       
+       // returns a String representation from JSON object 
+       asString: asString,
+       
+       getHTML: getHTML,
+       
+       getFullHTML: getFullHTML
+       
+});
+
+//}}}
+
+
+// setup jquery support
+if (jQ) {
+       
+       jQuery.prototype.flashembed = function(params, flashvars) { 
+               return this.each(function() { 
+                       flashembed(this, params, flashvars);
+               });
+       };
+
+}
+
+})();
+
+/************************************************
+********* mv_embed extension to flowplayer.js ***
+************************************************/       
+var flowplayerEmbed = {
+       instanceOf:'flowplayerEmbed',
+       monitorTimerId : 0,
+       old_pid:0,
+       didSeekJump:false,
+       startedTimedPlayback:false,             
+       didDateStartTimeRestore:false,
+       supports: {
+               'play_head' : true, 
+               'pause' : true,
+               'stop' : true, 
+               'time_display' : true, 
+               'volume_control' : true
+       },
+       getEmbedHTML: function (){
+               setTimeout('document.getElementById(\''+this.id+'\').postEmbedJS()', 150);
+               return this.wrapEmebedContainer( this.getEmbedObj() );
+       },
+       getEmbedObj:function(){ 
+               //give the embed element a unique pid (work around for flowplayer persistence)
+               if( this.old_pid!=0 ){
+                       this.pid = this.pid +'_'+ this.old_pid;
+               }                               
+               return '<a  '+
+                                       'href="'+ this.getSrc() + '" '+  
+                                       'style="display:block;width:' + parseInt(this.width) + 'px;height:' + parseInt(this.height) + 'px" '+  
+                                       'id="'+this.pid+'">'+ 
+                               '</a>';
+       },
+       postEmbedJS: function()
+       {   
+               var _this = this;
+               js_log('embedFlow: uri:'+ this.getSrc() + "\n"+ mv_embed_path + 'binPlayers/flowplayer/flowplayer-3.0.1.swf' ) ;
+               var flowConfig = { 
+                       clip: { 
+                               url: this.getSrc(),                               
+                               // when this is false playback does not start until play button is pressed 
+                               autoPlay: true
+                       },
+                       plugins: { 
+                               controls: { 
+                                  all: false, 
+                                  fullscreen: true,
+                                  backgroundColor: 'transparent',
+                                  backgroundGradient: 'none',
+                                  autoHide:'always',
+                                  top:'95%',
+                                  right:'0px'
+                               }                                
+                       },
+                       screen: {
+                               opacity : '1.0'
+                       }                       
+               };
+               
+               //if in preview mode set grey and lower volume until "ready"
+               if( this.preview_mode ){
+                       flowConfig.screen.opacity = 0.2;                                 
+               }                                       
+               
+               $f(this.pid,  mv_embed_path + 'binPlayers/flowplayer/flowplayer-3.0.1.swf', flowConfig);                                  
+               //get the this.fla value:                
+               this.getFLA();          
+               //set up bindings (for when interacting with the swf causes action:  
+               this.fla.onPause(function(){                                                                                                                            
+                       _this.parent_pause();   //update the interface                   
+               })
+               this.fla.onResume( function(){
+                       _this.parent_play();    //update the interface  
+               });                             
+                  
+               //start monitor: 
+               this.monitor();  
+               this.old_pid++;
+       },   
+       /* js hooks/controls */
+       play: function(){                               
+               this.getFLA();          
+               //update play/pause button etc
+               this.parent_play();                             
+               if( this.fla ){                 
+                       this.fla.play();                        
+                       
+                       //on a resume make sure volume and opacity are correct 
+                       this.restorePlayer();                                            
+                       setTimeout('$j(\'#'+this.id+'\').get(0).monitor()', 250);
+               }
+       },
+       //@@todo support mute
+       toggleMute: function(){
+               this.parent_toggleMute();
+               this.getFLA();
+               if(this.fla){
+                       if(this.muted){
+                               
+                       }else{
+                               
+                       }
+               }
+       },
+       //@@ Suport UpDateVolumen 
+       updateVolumen:function(perc){
+               this.getFLA();          
+               if(this.fla)this.fla.setVolume(perc*100);
+                           
+    }, 
+    //@@ Get Volumen
+       getVolumen:function(){
+               this.getFLA();          
+               if(this.fla)
+                       return this.fla.getVolume() / 100;                         
+    }, 
+       fullscreen:function(){
+               if(this.fla){
+                       this.fla.fullscreen();
+               }else{
+                       js_log('must be playing before you can go fullscreen');
+               }
+       },
+       pause : function()
+       {
+               this.getFLA();
+               if(!this.thumbnail_disp){
+                       this.parent_pause();
+                       if(this.fla){           
+                               js_log("Flash:Pause: " + this.fla.isPaused() );
+                               if( this.fla['pause'] ){
+                                       if( ! this.fla.isPaused() ){
+                                               js_log('calling plugin pause');                         
+                                               this.fla.pause();  
+                                               
+                                               //restore volume and opacity 
+                                               this.restorePlayer();              
+                                       }
+                               }
+                       }
+               }
+       },
+       monitor : function()
+       {                       
+               var _this = this;
+               //date time
+               if( !this.dateStartTime ){
+                       var d = new Date();
+                       this.dateStartTime = d.getTime();
+                       
+               }else{
+                       var d = new Date();                                              
+                       if( !this.didDateStartTimeRestore  && this.preview_mode)
+                               this.fla.setVolume(0);
+                               
+                       if( (d.getTime() - this.dateStartTime) > 6000  && !this.didDateStartTimeRestore){                                                        
+                               this.restorePlayer(); 
+                       }
+               }                                         
+                                         
+               var flash_state = this.fla.getStatus();
+               //update the duration from the clip if its zero or not set: 
+               if( !this.duration || this.duration==0 ){
+                       if( this.fla.getClip() ){
+                               this.duration = this.fla.getClip().fullDuration;                                
+                               js_log('set duration via clip value: ' + this.getDuration() );
+                       }
+               }
+               //update the duration ntp values: 
+               this.getDuration();             
+
+               if( typeof flash_state == 'undefined' ){
+                        var flash_state = {
+                                "time" : this.fla.getTime()
+                        };                              
+                       //we are not getting buffered data restore volume and opacity
+                       this.restorePlayer();                                              
+               }else{
+                       //simplification of buffer state ... should move to support returning time rages like:
+                       //http://www.whatwg.org/specs/web-apps/current-work/#normalized-timeranges-object                       
+                       this.bufferedPercent = flash_state.bufferEnd / this.getDuration();                                                                      
+               }                          
+               //set the current Time (based on timeFormat)            
+               if( this.supportsURLTimeEncoding() ){
+                       this.currentTime = flash_state.time;                      
+                       //js_log('set buffer: ' + flash_state.bufferEnd + ' at time: ' + flash_state.time +' of total dur: ' + this.getDuration()); 
+               }else{
+                       this.currentTime = flash_state.time + this.start_offset;                                                
+                       //stop buffering if greater than the duration: 
+                       if( flash_state.bufferEnd > this.getDuration() + 5 ){
+                               //js_log('should stop buffering (does not seem to work)' + flash_state.bufferEnd + ' > dur: ' + this.getDuration() );
+                               this.fla.stopBuffering();
+                       } 
+               }                                 
+               
+               if(this.currentTime > npt2seconds(this.start_ntp) && !this.startedTimedPlayback){
+                       var fail = false;
+                       try
+                       {
+                               this.restorePlayer();                           
+                       }
+                       catch(err)
+                       {
+                               js_log('failed to set values');
+                               fail = true;
+                       }
+                       if(!fail)
+                               this.startedTimedPlayback=true;                                                                          
+               }
+               
+               /* to support local seeks */
+               if(this.currentTime > 1 && this.seek_time_sec != 0 && !this.supportsURLTimeEncoding() )
+               {
+                       js_log('flashEmbed: _local_ Seeking to ' + this.seek_time_sec);
+                       this.fla.seek( this.seek_time_sec );
+                       this.seek_time_sec = 0;
+               }                                               
+               
+               //checks to see if we reached the end of playback:                              
+               if(this.duration && this.startedTimedPlayback && 
+                       (        this.currentTime > (npt2seconds(this.end_ntp)+2) 
+                               || 
+                               ( this.currentTime > (npt2seconds(this.end_ntp)-1) 
+                                       && this.prevTime == this.currentTime) )
+                       ){                                                      
+                       js_log('prbally reached end of stream: '+ seconds2npt( this.currentTime) );
+                       this.onClipDone();                                
+               }               
+               
+               //update the status and check timmer via universal parent monitor
+               this.parent_monitor();
+               
+               
+               this.prevTime = this.currentTime;       
+               //js_log('cur perc loaded: ' + this.fla.getPercentLoaded() +' cur time : ' + (this.currentTime - npt2seconds(this.start_ntp)) +' / ' +(npt2seconds(this.end_ntp)-npt2seconds(this.start_ntp)));
+       },
+       restorePlayer:function(){               
+               if(!this.fla)
+                       this.getFLA();
+               if(this.fla){
+                       js_log('f:do restorePlayer');
+                       this.fla.setVolume(90); 
+                       $f().getPlugin('screen').css({'opacity':'1.0'} );
+                       //set the fallback date restore flag to true:
+                       this.didDateStartTimeRestore=true;                                
+               }               
+       },
+       // get the embed fla object 
+       getFLA : function (){
+               this.fla = $f(this.pid);                   
+       },
+       stop : function(){      
+               js_log('f:flashEmbed:stop');            
+               this.startedTimedPlayback=false;        
+               if (this.monitorTimerId != 0 )
+               {
+                       clearInterval(this.monitorTimerId);
+                       this.monitorTimerId = 0;
+               }
+               if(this.fla)
+                       this.fla.unload();
+               this.parent_stop();
+       },
+       onStop: function(){
+               js_log('f:onStop');
+               //stop updates: 
+               if( this.monitorTimerId != 0 )
+               {
+                       clearInterval(this.monitorTimerId);
+                       this.monitorTimerId = 0;
+               }
+       },
+       onClipDone: function(){                 
+               js_log('f:flash:onClipDone');           
+               if( ! this.startedTimedPlayback){
+                       js_log('clip done before timed playback started .. not good. (ignoring) ');                     
+                       //keep monitoring: 
+                       this.monitor();
+               }else{
+                       js_log('clip done and '+ this.startedTimedPlayback);
+                       //stop the clip if its not stopped already:
+                       this.stop();
+                       this.setStatus("Clip Done...");
+                       //run the onClip done action: 
+                       this.parent_onClipDone();
+               }
+       }
+};
diff --git a/js2/mwEmbed/libEmbedVideo/kplayerEmbed.js b/js2/mwEmbed/libEmbedVideo/kplayerEmbed.js
new file mode 100644 (file)
index 0000000..6a8dfda
--- /dev/null
@@ -0,0 +1,74 @@
+var kplayerEmbed={
+       instanceOf:'kflashEmbed',
+       supports: {
+               'play_head':true, 
+               'pause':true,
+               'stop':true, 
+               'time_display':true, 
+               'volume_control':true,
+               'overlay':false,
+               'fullscreen':false
+       },
+       getEmbedHTML : function (){             
+               var embed_code =  this.getEmbedObj();           
+               //setTimeout('$j(\'#' + this.id + '\').get(0).postEmbedJS()', 2000);
+               js_log("return embed html");
+               return this.wrapEmebedContainer( embed_code);                   
+       },      
+       getEmbedObj:function(){
+               var player_path = mv_embed_path + 'binPlayers/kaltura-player/player.swf';       
+               return '<object id="'+this.pid+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '+ 
+                               'width="' +this.width+'" height="' + this.height + '">'+
+                                       '<param name="movie" value="'+ player_path +'" />' +
+                                       '<param name="allowfullscreen" value="true" />' +
+                                       '<param name="allowscriptaccess" value="always" />' +
+                                       '<param name="flashvars" value="file=video.flv&image=preview.jpg" />' +
+                               '<embed '+
+                                       'type="application/x-shockwave-flash" '+
+                                       'id="'+this.pid+'" '+                                   
+                                       'src="' + player_path +'" '+ 
+                                       'width="' + this.width + '" '+ 
+                                       'height="' + this.height + '" '+
+                                       'allowscriptaccess="always" '+ 
+                                       'allowfullscreen="true" '+
+                                       'flashvars="autostart=true&file=' + escape(  this.getSrc() ) + '" '+ 
+                               '/>'+
+                       '</object>';            
+               /*return  '<object id="'+this.pid+'" type="application/x-shockwave-flash"'+ 
+                               'allowScriptAccess="always" allowNetworking="all" allowFullScreen="true" '+
+                               'height="'+  parseInt(this.height) + '" ' +
+                               'width="' + parseInt(this.width) + '" ' +
+                               'data="http://www.kaltura.com/index.php/kwidget/wid/_309/uiconf_id/1000106">'+
+                                       '<param name="allowScriptAccess" value="always"/>'+
+                                       '<param name="allowNetworking" value="all"/>'+
+                                       '<param name="allowFullScreen" value="true"/>'+
+                                       '<param name="bgcolor" value="#000000"/>'+
+                                       '<param name="movie" value="http://www.kaltura.com/index.php/kwidget/wid/_0/uiconf_id/1000106"/>'+
+                                       '<param name="flashVars" value="emptyF=onKdpEmpty&readyF=onKdpReady&'+
+                                               //set the url: 
+                                               'entryId=' + escape(  this.getSrc() ) + '"/>'+
+                                       '<param name="wmode" value="opaque"/>'+
+                               '</object>';    */              
+       },
+       postEmbedJS:function(){         
+               this.monitor();
+       },
+       pause:function(){
+               this.stop();
+       },
+       monitor:function(){             
+               //this.parent_monitor();        
+       }
+}
+
+function onKdpReady(playerId) {
+        js_log("IN THEORY PLAYER IS READY");
+        /*
+        window.myKdp=get(playerId);
+        get("Player_State").innerHTML="<br>&nbsp; READY (Id=" + playerId + ")";
+        get("nowPlaying").innerHTML=(myKdp.evaluate('{entryId}'));
+        getDuration();
+        attachKdpEvents();
+        addKdpListners();
+        */
+ }
\ No newline at end of file
index 2b66df0..69b830c 100644 (file)
@@ -80,26 +80,29 @@ var nativeEmbed = {
                this.seeking = false;
        },
        doSeek:function(perc){                                  
-               //js_log('native:seek:p: ' + perc+ ' : '  + this.supportsURLTimeEncoding() + ' dur: ' + this.getDuration() + ' sts:' + this.seek_time_sec );            
+               js_log('native:seek:p: ' + perc+ ' : '  + this.supportsURLTimeEncoding() + ' dur: ' + this.getDuration() + ' sts:' + this.seek_time_sec );              
                //@@todo check if the clip is loaded here (if so we can do a local seek)
-               if( this.supportsURLTimeEncoding() || !this.vid){                       
-                       //make sure we could not do a local seek instead:
+               if( this.supportsURLTimeEncoding() ){                   
+                       // Make sure we could not do a local seek instead:
                        if( perc < this.bufferedPercent && this.vid.duration && !this.didSeekJump ){
                                js_log("do local seek " + perc + ' is already buffered < ' + this.bufferedPercent);
                                this.doNativeSeek(perc);
-                       }else{
+                       }else{                  
+                               // We support URLTimeEncoding call parent seek: 
                                this.parent_doSeek(perc);
                        }                       
                }else if(this.vid && this.vid.duration ){          
                        //(could also check bufferedPercent > perc seek (and issue oggz_chop request or not) 
                        this.doNativeSeek( perc );      
                }else{
+                       //try to do a play then seek: 
                        this.doPlayThenSeek( perc )
                }                                 
        },      
        doNativeSeek:function(perc){    
+               js_log('native::doNativeSeek::' + perc);
                this.seek_time_sec=0;                    
-               this.vid.currentTime = perc * this.vid.duration;                
+               this.vid.currentTime = perc * this.duration;            
                this.monitor(); 
        },
        doPlayThenSeek:function(perc){
@@ -107,14 +110,17 @@ var nativeEmbed = {
                var _this = this;
                this.play();
                var rfsCount = 0;
-               var readyForSeek = function(){
-                       _this.getVID();         
+               var readyForSeek = function(){          
+                       _this.getVID();
+                       if(_this.vid)           
+                               js_log('readyForSeek looking::' + _this.vid.duration);
                        //if we have duration then we are ready to do the seek
-                       if(this.vid && this.vid.duration){
-                               _this.doSeek( perc );
+                       if( _this.vid && _this.vid.duration ){
+                               _this.doNativeSeek( perc );
                        }else{                  
-                               //try to get player for 10 seconds: 
-                               if( rfsCount < 200 ){
+                               //Try to get player for 40 seconds: 
+                               //(it would be nice if the onmetadata type callbacks where fired consistently)
+                               if( rfsCount < 800 ){
                                        setTimeout(readyForSeek, 50);
                                        rfsCount++;
                                }else{
index e42f4cb..73888ec 100644 (file)
@@ -12,7 +12,8 @@ loadGM({
        "mwe-effects" : "Effects stack",
        "mwe-remove_transition" : "Remove transition",
        "mwe-edit_transin" : "Edit transition into clip",
-       "mwe-edit_transout" : "Edit transition out of clip"
+       "mwe-edit_transout" : "Edit transition out of clip",
+       "mwe-add-transition" : "Add a Transition"
 });
 
 var default_timed_effect_values = {
@@ -246,12 +247,12 @@ mvTimedEffectsEdit.prototype = {
                                break;
                        }
                }
-               //and finally add effect timeline scrubber (for timed effects this also stores keyframes)
+               //and finally add effect timeline scruber (for timed effects this also stores keyframes)
 
        },
        getTransitionListControl : function(target_out){
                js_log("getTransitionListControl");
-               var o= '<h3>Add a Transition:</h3>';
+               var o= '<h3>' + gM('mwe-add-transition') +'</h3>';
                for(var type in mvTransLib['type']){
                        js_log('on tran type: ' + i);
                        var base_trans_name = i;
index 8a2a2d8..917ca37 100644 (file)
@@ -39,21 +39,26 @@ mvTextInterface.prototype = {
                //if roe not yet loaded do load it:
                if(this.pe.roe || _this.pe.wikiTitleKey ){
                        if(!this.pe.media_element.addedROEData){
-                               js_log("load roe data!");
                                $j('#mv_txt_load_'+_this.pe.id).show(); //show the loading icon
-                               if(_this.pe.roe){
+                               if( _this.pe.roe ){
                                        do_request( _this.pe.roe, function(data)
                                        {
                                                _this.pe.media_element.addROE(data);
                                                _this.getParseTimedText_rowReady();
                                        });
                                }else if( _this.pe.wikiTitleKey ){
+                                       //check for a clear namespace key:
+                                       var timedtext_ns = 102;                                 
+                                       if( wgNamespaceIds && wgNamespaceIds['timedtext']){
+                                               timedtext_ns = wgNamespaceIds['timedtext'];
+                                       }
                                        do_api_req({
                                                        'url' : apiUrl,
                                                        'data': {
                                                                'list' : 'allpages',
                                                                'apprefix' : _this.pe.wikiTitleKey,
-                                                               'apnamespace' : 102
+                                                               'apnamespace' : timedtext_ns,
+                                                               'prop':'revisions'
                                                        }
                                        }, function( subData ) {
                                                if(     subData.error && subData.error.code == 'apunknown_apnamespace'){
@@ -87,6 +92,8 @@ mvTextInterface.prototype = {
                var _this = this;
                //look for text tracks:
                var foundTextTracks = false;
+               
+               //get all the known languages:
                do_api_req({
                        'url':  hostPath + '/api.php',
                        'data': {
@@ -117,17 +124,13 @@ mvTextInterface.prototype = {
                                                        'category' : 'SUB',
                                                        'lang'  : langKey,
                                                        'type'  : _this.suportedMime[ extension ],
-                                                       'title' : langData[ langKey],                                                   
+                                                       'title' : langData[ langKey]                                                                    
+                                               });
+                                               // We use the api since ?action raw on the real title has cache issues 
+                                               $j( textElm ).attr({
+                                                       'apisrc'        : hostPath + '/api.php',
+                                                       'titleKey'      : subPage.title
                                                });
-                                               //set src to remote friendly 
-                                               if( wgServer &&  hostPath.indexOf(wgServer)!==-1){
-                                                       $j(textElm).attr('src', hostPath + '/index.php?title=' + subPage.title + '&action=raw');
-                                               }else{
-                                                       $j(textElm).attr({
-                                                               'apisrc'        : hostPath + '/api.php',
-                                                               'titleKey'      : subPage.title
-                                                       });
-                                               }                                                                                               
                                                _this.pe.media_element.tryAddSource( textElm );
                                                foundTextTracks = true;                                                                                 
                                        }
@@ -192,12 +195,12 @@ mvTextInterface.prototype = {
                        if( typeof source.id == 'undefined' || source.id == null ){
                                source.id = 'text_' + inx;
                        }
-                       var tObj = new timedTextObj( source ); 
+                       var tObj = new timedTextObj( source );
                        //make sure its a valid timed text format (we have not loaded or parsed yet) : (
                        if( tObj.lib != null ){ 
                                _this.availableTracks.push( tObj );                             
-                               //display if requested:
-                               if( ( wgUserLanguage && source['lang'] == wgUserLanguage ) || source['default'] == "true" ){
+                               //display requested language if we can know that: 
+                               if( ( typeof wgUserLanguage != 'undefined' && source['lang'] == wgUserLanguage ) || source['default'] == "true" ){
                                        //we did set at least one track by default tag
                                        found_tracks = true;                                    
                                        _this.loadAndDisplay( _this.availableTracks.length -1 );
@@ -206,15 +209,17 @@ mvTextInterface.prototype = {
                                }
                        }
                });
+               
                //no default clip found take the userLanguage key if set:
-               if(!found_tracks){                      
+               if( !found_tracks ){                    
                        $j.each( _this.availableTracks, function(inx, source){                          
                                _this.loadAndDisplay( inx );
                                found_tracks=true;
                                //return after loading first available
                                return false;
                        });
-               }               
+               }
+               
            //if nothing found anywhere give the not found msg: 
                if(!found_tracks){
                        $j( '#metaBox_' + _this.pe.id).html( ''+
@@ -226,11 +231,11 @@ mvTextInterface.prototype = {
        loadAndDisplay: function ( track_id){
                var _this = this;
                $j('#mv_txt_load_'+_this.pe.id).show();//show the loading icon
-               _this.availableTracks[ track_id ].load(_this.default_time_range, function(){
+               _this.availableTracks[ track_id ].load( _this.default_time_range, function(){
                        $j('#mv_txt_load_'+_this.pe.id).hide();
                        _this.addTrack( track_id );
                });
-       },
+       },      
        addTrack: function( track_id ){
                js_log('f:displayTrack:'+ track_id);
                var _this = this;
@@ -238,7 +243,7 @@ mvTextInterface.prototype = {
                _this.availableTracks[ track_id ].display=true;
                //setup the layout:
                this.setup_layout();
-               js_log("SHOULD ADD: track:"+ track_id + ' count:' +  _this.availableTracks[ track_id ].textNodes.length);
+               js_log( "SHOULD ADD: track:" + track_id + ' count:' +  _this.availableTracks[ track_id ].textNodes.length);
 
                //a flag to avoid checking all clips if we know we are adding to the end:
                _this.add_to_end_on_this_pass = false;
@@ -248,10 +253,12 @@ mvTextInterface.prototype = {
                var track_id = track_id;
                var addNextClip = function(){
                        var text_clip = _this.availableTracks[ track_id ].textNodes[i];
-                       _this.add_merge_text_clip(text_clip, track_id);
-                       i++;
-                       if(i < _this.availableTracks[ track_id ].textNodes.length){
-                               setTimeout(addNextClip, 1);
+                       if(     text_clip ){    
+                               _this.add_merge_text_clip(text_clip, track_id);
+                               i++;
+                               if(i < _this.availableTracks[ track_id ].textNodes.length){
+                                       setTimeout(addNextClip, 1);
+                               }
                        }
                }
                addNextClip();
@@ -259,7 +266,7 @@ mvTextInterface.prototype = {
        add_merge_text_clip: function( text_clip, track_id ){
                var _this = this;
                //make sure the clip does not already exist:
-               if($j('#tc_'+text_clip.id).length==0){
+               if( $j('#tc_'+text_clip.id).length==0 ){
                        var inserted = false;
                        var text_clip_start_time = npt2seconds( text_clip.start );
 
index f1aabad..965d277 100644 (file)
@@ -9,11 +9,12 @@ if( !mwAddMediaConfig )
 var mvTimedTextEdit = {};
 
 loadGM({
-  "mwe-add-subs-file"      : "Add/replace subtitle",
-  "mwe-add-subs-file-title": "Select subtitle to upload",
-  "mwe-error-only-srt"     : "You can only upload srt files.",
-  "mwe-watch-video"        : "Watch video",
-  "mwe-select-other-language": "Select other language"
+  "mwe-upload-subs-file" : "Upload subtitle",
+  "mwe-add-subs-file-title" : "Select subtitle to upload",
+  "mwe-error-only-srt" : "You can only upload srt files.",
+  "mwe-watch-video" : "Watch video",
+  "mwe-select-other-language" : "Select other language",
+  "mwe-saving" : "saving.."
 })
 
 
@@ -25,7 +26,7 @@ js2AddOnloadHook( function() {
       return srtData;
   }
   function getVideoTitle() {
-    var videoTitle = wgTitle.split('.');
+    var videoTitle = wgPageName.split('.');
     videoTitle.pop();
     videoTitle.pop();
     videoTitle = videoTitle.join('.').replace('TimedText:', 'File:');
@@ -80,13 +81,13 @@ js2AddOnloadHook( function() {
           cBtn[ gM('mwe-ok') ] = function(){
                //get language from form
             langKey = $j('#timed_text_language').val();
-            var title = wgTitle.split('.');
+            var title = wgPageName.split('.');
             title.pop();
             title.pop();
             title = title.join('.') + '.' + langKey + '.srt';
             
             var file = $j('#timed_text_file_upload');
-            if( file[0].files[0]){
+            if(!file[0].files[0]){
                //no file to upload just jump to the lang key: 
                document.location.href = wgArticlePath.replace('/$1', '?title=' + title + '&action=edit');
                return ;
@@ -105,7 +106,7 @@ js2AddOnloadHook( function() {
 
             if(extension == "srt") {
               var srt = getSubtitle(file[0]);
-              $j(this).html("saving...");
+              $j(this).text( gM('mwe-saving' ) );
               $j('.ui-dialog-buttonpane').remove();
 
               var editToken = $j('input[name=wpEditToken]').val();
@@ -147,14 +148,14 @@ js2AddOnloadHook( function() {
   $j(tselect).after(ttoolbar);
 
   var button = $j('<button>');
-  button.click(uploadSubtitles)
-  button.text(gM("mwe-add-subs-file"));
-  ttoolbar.append(button);
+         button.click(uploadSubtitles)
+         button.text(gM("mwe-upload-subs-file"));
+         ttoolbar.append(button);
   ttoolbar.append(' ');
 
   var button = $j('<button>');
-  button.click(function() { document.location.href = wgArticlePath.replace('$1', getVideoTitle()); })
-  button.text(gM("mwe-watch-video"));
+         button.click(function() { document.location.href = wgArticlePath.replace('$1', getVideoTitle()); })
+         button.text(gM("mwe-watch-video"));
   ttoolbar.append(button);
 
 });
index ad0998c..4303fee 100644 (file)
@@ -132,7 +132,8 @@ lcPaths({
        "mvClipEdit"                    : "libClipEdit/mvClipEdit.js",
 
        "embedVideo"            : "libEmbedVideo/embedVideo.js",
-       "flashEmbed"            : "libEmbedVideo/flashEmbed.js",
+       "flowplayerEmbed"       : "libEmbedVideo/flowplayerEmbed.js",
+       "kplayerEmbed"          : "libEmbedVideo/kplayerEmbed.js",
        "genericEmbed"          : "libEmbedVideo/genericEmbed.js",
        "htmlEmbed"                     : "libEmbedVideo/htmlEmbed.js",
        "javaEmbed"                     : "libEmbedVideo/javaEmbed.js",
@@ -1010,8 +1011,10 @@ var mvJsLoader = {
                //js_log( 'jQueryCheck::' );
                var _this = this;
                // Skip stuff if $j is already loaded:
-               if( _global['$j'] && callback ){
-                       callback();
+               if( _global['$j'] ){
+                       callback(); //call the callback now
+                       callback=null;
+                       // Check if we have jquery-ui css loaded and assigned skin globals
                        if( _this.jQuerySetupFlag )
                                return ;
                }               
@@ -1046,11 +1049,12 @@ var mvJsLoader = {
                                // Set up mvEmbed jQuery bindings and config based dependencies
                                mv_jqueryBindings();
                                _this.jQuerySetupFlag = true;
-                       }
-                       // Run the callback
-                       if( callback ) {
-                               callback();
-                       }
+                               
+                               // Run the callback if not already run above
+                               if( callback ) {
+                                       callback();
+                               }
+                       }                       
                });
        },
        embedVideoCheck:function( callback ) {
@@ -1093,6 +1097,7 @@ var mvJsLoader = {
                });
        },
        addLoadEvent: function( fn ) {
+               //js_log('add ready event: ' + fn );
                this.onReadyEvents.push( fn );
        },
        // Check the jQuery flag. This way, when remote embedding, we don't load jQuery
@@ -1106,7 +1111,7 @@ var mvJsLoader = {
                });
        },
        runReadyEvents: function() {
-               js_log( "runReadyEvents" );
+               js_log( "runReadyEvents" +  this.onReadyEvents.length );
                while( this.onReadyEvents.length ) {    
                        var func = this.onReadyEvents.shift();
                        //js_log('run onReady:: ' + func );
@@ -1663,15 +1668,25 @@ function npt2seconds( npt_str ) {
        // Strip "npt:" time definition if present
        npt_str = npt_str.replace( 'npt:', '' );
 
+       var hour = 0;
+       var min = 0;
+       var sec = 0;
+
        times = npt_str.split( ':' );
-       if( times.length != 3 ){
-               js_log( 'error: npt2seconds on ' + npt_str );
-               return false;
+       if( times.length == 3 ){
+               sec = times[2];
+               min = times[1];
+               hour = times[0];
+       }else if(times.length == 2){
+               sec = times[1];
+               min = times[0];
+       }else{
+               sec = times[0];
        }
        // Sometimes a comma is used instead of period for ms
-       times[2] = times[2].replace( /,\s?/, '.' );
+       sec = sec.replace( /,\s?/, '.' );
        // Return seconds float
-       return parseInt( times[0] * 3600) + parseInt( times[1] * 60 ) + parseFloat( times[2] );
+       return parseInt( hour * 3600) + parseInt( min * 60 ) + parseFloat( sec );
 }
 /*
  * Simple helper to grab an edit token
@@ -1769,7 +1784,7 @@ function do_api_req( options, callback ) {
        }
 }
 function mwGetLocalApiUrl( url ) {
-       if ( wgServer && wgScriptPath ) {
+       if ( typeof wgServer != 'undefined' && typeof wgScriptPath  != 'undefined') {
                return wgServer + wgScriptPath + '/api.php';
        }
        return false;
index 5d7eb56..e9fd645 100644 (file)
@@ -55,10 +55,12 @@ $messages['en'] = array(
        /*
         * js file: /libTimedText/mvTimeTextEdit.js
         */
-        'mwe-add-subs-file'      => 'Add/replace subtitle',
-        'mwe-add-subs-file-title'=> 'Select subtitle to upload',
-        'mwe-error-only-srt'     => 'You can only upload srt files.',
-        'mwe-watch-video'        => 'Watch video',
+        'mwe-upload-subs-file' => "Upload/replace subtitle",
+        'mwe-add-subs-file-title' => 'Select subtitle to upload',
+        'mwe-error-only-srt' => 'You can only upload srt files.',
+        'mwe-watch-video' => 'Watch video',
+        'mwe-select-other-language' => 'Select other language',
+        'mwe-saving' => 'saving..',
 
        /*
         * js file: /libSequencer/mvTimedEffectsEdit.js
@@ -278,6 +280,20 @@ $messages['en'] = array(
        'mwe-ftype-ogg' => 'Ogg video file',
        'mwe-ftype-unk' => 'Unknown file format',
 
+       'rsd-wiki_commons-title'=> 'Wikimedia Commons',
+       'rsd-wiki_commons'=> 'Wikimedia Commons, an archive of freely-licensed educational media content (images, sound and video clips)',
+
+       'rsd-this_wiki-title' => 'This Wiki',
+       'rsd-this_wiki-desc' => 'The local wiki install',
+
+       'rsd-archive_org-title'=> 'Archive.org',
+       'rsd-archive_org-desc' => 'The Internet Archive, a digital library of cultural artifacts',
+
+       'rsd-flickr-title' => 'Flickr.com',
+       'rsd-flickr-desc' => 'Flickr.com, a online photo sharing site',
+       'rsd-metavid-title' => 'Meavid.org',
+       'rsd-metavid-desc' => 'Metavid a community archive of US House and Senate floor proceedings',
+
        /*
         * js file: /libAddMedia/simpleUploadForm.js
         */
index 3f7908d..2e42750 100644 (file)
@@ -213,7 +213,7 @@ ctrlBuilder.prototype = {
                                        embedObj.seek_time_sec = npt2seconds( embedObj.jump_time, true );
                                        js_log('do jump to: '+embedObj.jump_time + ' perc:' +perc + ' sts:' + embedObj.seek_time_sec);
                                        embedObj.setStatus( gM('mwe-seeking') );
-                                       embedObj.doSeek(perc);
+                                       embedObj.doSeek( perc );
                                }
                        }
                });
index 5d5e8a6..a53416a 100644 (file)
@@ -5,18 +5,16 @@
  
 var urlparts = getRemoteEmbedPath();
 var mwEmbedHostPath = urlparts[0];
-var mwRemoteVersion = '1.05';
+var mwRemoteVersion = '1.06';
 var mwUseScriptLoader = true;
 
-reqArguments = urlparts[1];
-
 //setup up request Params: 
 var reqParts = urlparts[1].substring(1).split('&');
-var reqParam={};
+var mwReqParam={};
 for(var i=0;i< reqParts.length; i++){
        var p = reqParts[i].split('=');
        if( p.length == 2 )
-               reqParam[ p[0] ]=  p[1];
+               mwReqParam[ p[0] ] = p[1];
 }
 
 addOnloadHook( function(){
@@ -30,13 +28,14 @@ function doPageSpecificRewrite() {
        // Add media wizard
        if( wgAction == 'edit' || wgAction == 'submit' ) {
                load_mv_embed( function() {     
-                       loadExternalJs( mwEmbedHostPath + '/editPage.js' + reqArguments );
-               } );
+                       loadExternalJs( mwEmbedHostPath + '/editPage.js?' + mwGetReqArgs() );
+               });
        }
        
        // Timed text display:
        if(wgPageName.indexOf("TimedText") === 0){              
                load_mv_embed(function(){
+                       // Load with mw loader to get localized interface:
                        $mw.load( ['mvTimeTextEdit'],function(){
                                //could run init here (but mvTimeTextEdit included onLoad actions)
                        });
@@ -46,7 +45,7 @@ function doPageSpecificRewrite() {
        // Firefogg integration
        if( wgPageName == "Special:Upload" ){           
                load_mv_embed( function() {
-                       loadExternalJs( mwEmbedHostPath + '/uploadPage.js' + reqArguments );
+                       loadExternalJs( mwEmbedHostPath + '/uploadPage.js?' + mwGetReqArgs() );
                } );
        }
        
@@ -55,7 +54,7 @@ function doPageSpecificRewrite() {
                var wgEnableIframeApiProxy = true;
                load_mv_embed( function() {
                        js_log("Wiki:ApiProxy::");
-                       loadExternalJs( mwEmbedHostPath + '/apiProxyPage.js' + reqArguments );
+                       loadExternalJs( mwEmbedHostPath + '/apiProxyPage.js?' + mwGetReqArgs() );
                });
        }
        
@@ -166,30 +165,37 @@ function getRemoteEmbedPath() {
                }
        }
 }
+function mwGetReqArgs(){
+       var rurl = '';
+       if(mwReqParam['debug'])
+               rurl += 'debug=true&';
 
-function load_mv_embed( callback ) {   
+       if(mwReqParam['uselang'] )
+               rurl += 'uselang=' + mwReqParam['uselang'] + '&';
+
+       if( mwReqParam['urid'] ){
+               rurl += 'urid=' + mwReqParam['urid'];
+       }else{
+               // Make sure to use an urid 
+               // This way remoteMwEmbed can control version of code being requested
+               rurl += 'urid=' + mwRemoteVersion;
+       }
+       return rurl;
+}
+function load_mv_embed( callback ) {
        // Inject mv_embed if needed
        if( typeof $mw == 'undefined' ) {       
-               if( ( reqParam['uselang'] || reqParam['useloader'] ) && mwUseScriptLoader){
+               if( ( mwReqParam['uselang'] || mwReqParam['useloader'] ) && mwUseScriptLoader){
                        var rurl = mwEmbedHostPath + '/mwEmbed/jsScriptLoader.php?class=mv_embed';
                        // Add jQuery too if we need it: 
                        if(typeof window.jQuery == 'undefined'){
-                               rurl+= ',window.jQuery';
-                       }
-                       if(reqParam['urid']){
-                               rurl+='&urid=' + reqParam['urid'];
-                       }else{
-                               rurl+='&urid=' + mwRemoteVersion;
-                       }
-                       if(reqParam['debug'])
-                               rurl+='&debug=true';
-
-                       if(reqParam['uselang'] )
-                               rurl+='&uselang=' + reqParam['uselang'];
+                               rurl += ',window.jQuery';
+                       }       
+                       rurl += '&' + mwGetReqArgs();                                                           
                                                        
-                       importScriptURI(rurl); 
+                       importScriptURI( rurl ); 
                }else{
-                       importScriptURI( mwEmbedHostPath + '/mwEmbed/mv_embed.js' + reqArguments );
+                       importScriptURI( mwEmbedHostPath + '/mwEmbed/mv_embed.js?' + mwGetReqArgs() );
                }
        }
        check_for_mv_embed( callback );