Fix typo
[lhc/web/wiklou.git] / js2 / mwEmbed / libEmbedVideo / embedVideo.js
index 842c164..8bdefe3 100644 (file)
@@ -3,53 +3,61 @@
 */
 
 loadGM({
-       "loading_plugin" : "loading plugin <blink>...<\/blink>",
-       "select_playback" : "Set playback preference",
-       "link_back" : "Link back",
-       "error_load_lib" : "Error: mv_embed was unable to load required JavaScript libraries.\nInsert script via DOM has failed. Please try reloading this page.",
-       "error_swap_vid" : "Error: mv_embed was unable to swap the video tag for the mv_embed interface",
-       "add_to_end_of_sequence" : "Add to end of sequence",
-       "missing_video_stream" : "The video file for this stream is missing",
-       "play_clip" : "Play clip",
-       "pause_clip" : "Pause clip",
-       "volume_control" : "Volume control",
-       "player_options" : "Player options",
-       "closed_captions" : "Close captions",
-       "player_fullscreen" : "Fullscreen",
-       "next_clip_msg" : "Play next clip",
-       "prev_clip_msg" : "Play previous clip",
-       "current_clip_msg" : "Continue playing this clip",
-       "seek_to" : "Seek to",
-       "download_segment" : "Download selection:",
-       "download_full" : "Download full video file:",
-       "download_right_click" : "To download, right click and select <i>Save target as...<\/i>",
-       "download_clip" : "Download video",
-       "download_text" : "Download text (<a style=\"color:white\" title=\"cmml\" href=\"http:\/\/wiki.xiph.org\/index.php\/CMML\">CMML<\/a> xml):",
-       "download" : "Download",
-       "share" : "Share",
-       "credits" : "Credits",
-       "clip_linkback" : "Clip source page",
-       "chose_player" : "Choose video player",
-       "share_this_video" : "Share this video",
-       "video_credits" : "Video credits",
-       "menu_btn" : "Menu",
-       "close_btn" : "Close",
-       "mv_ogg-player-vlc-mozilla" : "VLC plugin",
-       "mv_ogg-player-videoElement" : "Native Ogg video support",
-       "mv_ogg-player-vlc-activex" : "VLC ActiveX",
-       "mv_ogg-player-oggPlugin" : "Generic Ogg plugin",
-       "mv_ogg-player-quicktime-mozilla" : "Quicktime plugin",
-       "mv_ogg-player-quicktime-activex" : "Quicktime ActiveX",
-       "mv_ogg-player-cortado" : "Java Cortado",
-       "mv_ogg-player-flowplayer" : "Flowplayer",
-       "mv_ogg-player-selected" : " (selected)",
-       "mv_ogg-player-omtkplayer" : "OMTK Flash Vorbis",
-       "mv_generic_missing_plugin" : "You browser does not appear to support the following playback type: <b>$1<\/b><br \/>Visit the <a href=\"http:\/\/commons.wikimedia.org\/wiki\/Commons:Media_help\">Playback Methods<\/a> page to download a player.<br \/>",
-       "mv_for_best_experience" : "For a better video playback experience we recommend:<br \/><b><a href=\"http:\/\/www.mozilla.com\/en-US\/firefox\/upgrade.html?from=mwEmbed\">Firefox 3.5<\/a>.<\/b>",
-       "mv_do_not_warn_again" : "Dissmiss for now.",
-       "playerselect" : "Players"
+       "mwe-loading_plugin" : "loading plugin ...",
+       "mwe-select_playback" : "Set playback preference",
+       "mwe-link_back" : "Link back",
+       "mwe-error_swap_vid" : "Error: mv_embed was unable to swap the video tag for the mv_embed interface",
+       "mwe-add_to_end_of_sequence" : "Add to end of sequence",
+       "mwe-missing_video_stream" : "The video file for this stream is missing",
+       "mwe-play_clip" : "Play clip",
+       "mwe-pause_clip" : "Pause clip",
+       "mwe-volume_control" : "Volume control",
+       "mwe-player_options" : "Player options",
+       "mwe-closed_captions" : "Closed captions",
+       "mwe-player_fullscreen" : "Fullscreen",
+       "mwe-next_clip_msg" : "Play next clip",
+       "mwe-prev_clip_msg" : "Play previous clip",
+       "mwe-current_clip_msg" : "Continue playing this clip",
+       "mwe-seek_to" : "Seek $1",
+       "mwe-paused" : "paused",
+       "mwe-download_segment" : "Download selection:",
+       "mwe-download_full" : "Download full video file:",
+       "mwe-download_right_click" : "To download, right click and select <i>Save link as...<\/i>",
+       "mwe-download_clip" : "Download video",
+       "mwe-download_text" : "Download text (<a style=\"color:white\" title=\"cmml\" href=\"http:\/\/wiki.xiph.org\/index.php\/CMML\">CMML<\/a> xml):",
+       "mwe-download" : "Download",
+       "mwe-share" : "Share",
+       "mwe-credits" : "Credits",
+       "mwe-clip_linkback" : "Clip source page",
+       "mwe-chose_player" : "Choose video player",
+       "mwe-share_this_video" : "Share this video",
+       "mwe-video_credits" : "Video credits",
+       "mwe-menu_btn" : "Menu",
+       "mwe-close_btn" : "Close",
+       "mwe-ogg-player-vlc-mozilla" : "VLC plugin",
+       "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",
+       "mwe-ogg-player-cortado" : "Java Cortado",
+       "mwe-ogg-player-flowplayer" : "Flowplayer",
+       "mwe-ogg-player-selected" : "(selected)",
+       "mwe-ogg-player-omtkplayer" : "OMTK Flash Vorbis",
+       "mwe-generic_missing_plugin" : "You browser does not appear to support the following playback type: <b>$1<\/b><br \/>Visit the <a href=\"http:\/\/commons.wikimedia.org\/wiki\/Commons:Media_help\">Playback Methods<\/a> page to download a player.<br \/>",
+       "mwe-for_best_experience" : "For a better video playback experience we recommend:<br \/><b><a href=\"http:\/\/www.mozilla.com\/en-US\/firefox\/upgrade.html?from=mwEmbed\">Firefox 3.5<\/a>.<\/b>",
+       "mwe-do_not_warn_again" : "Dismiss for now.",
+       "mwe-playerselect" : "Players",
+       "mwe-read_before_embed" : "<a href=\"http:\/\/mediawiki.org\/wiki\/Security_Notes_on_Remote_Embedding\" target=\"_new\">Read this<\/a> before embedding.",
+       "mwe-embed_site_or_blog" : "Embed on a page",
+       "mwe-related_videos" : "Related videos",
+       "mwe-seeking" : "seeking",
+       "mwe-copy-code" : "Copy code"
 });
 
+//set the globals:
+var commons_api_url =  'http://commons.wikimedia.org/w/api.php';
+
 var default_video_attributes = {
        "id":null,
        "class":null,
@@ -66,7 +74,8 @@ var default_video_attributes = {
        "end":null,
        "controls":true,
        "muted":false,
-
+       "wikiTitleKey":null,
+       
        //roe url (for xml based metadata)
        "roe":null,
        //if roe includes metadata tracks we can expose a link to metadata
@@ -80,522 +89,116 @@ var default_video_attributes = {
        "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,
+       "play_button":true,     
        "thumbnail":null,
        "linkback":null,
        "embed_link":true,
        "download_link":true,
-       "type":null      //the content type of the media
+       "type":null,     //the content type of the media 
 };
 /*
- * the base source attibute checks
+ * the base source attribute checks
  */
 var mv_default_source_attr= new Array(
        'id',
        'src',
+       'apisrc',
+       'titleKey',
        'title',
        'URLTimeEncoding', //boolean if we support temporal url requests on the source media
        'startOffset',
        'durationHint',
        'start',
-       'end',
+       'end',  
        'default',
        'lang'
 );
-//set the dismissNativeWarn flag:
+//set the dismissNativeWarn flag: 
 _global['dismissNativeWarn'] = false;
-
-
-var ctrlBuilder = {
-       height:29,
-       supports:{
-                 'options':true,
-                 'borders':true
-       },
-       menu_items:[
-               'playerselect',
-               'download',
-               'share', 
-               'credits',
-       ],      
-       default_menu_item:'download',
-       getControls:function( embedObj ){
-               js_log('f:controlsBuilder:: opt:');
-               this.id = (embedObj.pc)?embedObj.pc.pp.id:embedObj.id;
-               this.available_width = embedObj.playerPixelWidth();
-               //make pointer to the embedObj
-               this.embedObj = embedObj;
-               var _this = this;
-               for(var i in embedObj.supports){
-                       _this.supports[i] = embedObj.supports[i];
-               };
-
-               //check for close_captions tracks:
-               if( ( embedObj.roe || embedObj.timedTextSources() )
-                       && embedObj.show_meta_link  )
-                       this.supports['closed_captions']=true;
-
-               var o='';
-               for( var i in this.components ){
-                       if( this.supports[i] ){
-                               if( this.available_width > this.components[i].w ){
-                                       //special case with playhead don't add unless we have 60px
-                                       if( i == 'play_head' && ctrlBuilder.available_width < 60 )
-                                               continue;
-                                       o+=this.components[i].o();
-                                       this.available_width -= this.components[i].w;
-                               }else{
-                                       js_log('not enough space for control component:' + i);
-                               }
-                       }
-               }               
-               return o;
-       },
-        /*
-        * addControlHooks
-        * to be run once controls are attached to the dom
-        */
-       addControlHooks:function( embedObj ){
-               //add in drag/seek hooks:
-               if(!embedObj.base_seeker_slider_offset &&  $j('#mv_seeker_slider_'+embedObj.id).get(0))
-                       embedObj.base_seeker_slider_offset = $j('#mv_seeker_slider_'+embedObj.id).get(0).offsetLeft;
-
-               //js_log('looking for: #mv_seeker_slider_'+embedObj.id + "\n " +
-               //              'start sec: '+embedObj.start_time_sec + ' base offset: '+embedObj.base_seeker_slider_offset);
-
-               var $tp=$j('#' + embedObj.id);
-
-               //@todo: which object is being play()'d (or whatever) ?
-               //We select the element to attach the event to this way:
-               //$tp.find('.ui-icon-play').parent().click(function(){alert(0)}); or we can give the button itself a class - probably better.
-
-               //add play hook for play-btn and large_play_button
-               $tp.find('.play-btn,.play-btn-large').unbind().btnBind().click(function(){
-                       $j('#' + embedObj.id).get(0).play();
-               })
-               //add recomend firefox if non-native playback:
-               if( embedObj.doNativeWarningCheck() ){
-                       $j('#dc_'+ embedObj.id).hover(
-                               function(){
-                                       if($j('#gnp_' + embedObj.id).length==0){
-                                               $j(this).append('<div id="gnp_' + embedObj.id + '" class="ui-state-highlight ui-corner-all" ' +
-                                                       'style="position:absolute;display:none;background:#FFF;top:10px;left:10px;right:10px;height:60px;">' +
-                                                       gM('mv_for_best_experience') +
-                                               '<br><input id="ffwarn_'+embedObj.id+'" type=\"checkbox\">' +
-                                                       gM('mv_do_not_warn_again') +
-                                               '</div>');
-                                               $j('#ffwarn_'+embedObj.id).click(function(){
-                                                       if( $j(this).is(':checked') ){
-                                                               //set up a cookie for 5 days:
-                                                               $j.cookie('dismissNativeWarn', true, { expires: 5 });
-                                                               //set the current instance
-                                                               _global['dismissNativeWarn'] = true;
-                                                               $j('#gnp_' + embedObj.id).fadeOut('slow');
-                                                       }else{
-                                                               _global['adismissNativeWarn'] = false;
-                                                               $j.cookie('dismissNativeWarn', false);
-                                                       }
-
-                                               });
-                                       }
-                                       if( ($j.cookie('dismissNativeWarn') !== true) &&
-                                               _global['dismissNativeWarn'] === false  ){
-                                               $j('#gnp_' + embedObj.id).fadeIn('slow');
-                                       }
-                               },
-                               function(){
-                                       $j('#gnp_' + embedObj.id).fadeOut('slow');
-                               }
-                       );
-               }
-
-               if( $j.browser.msie  &&  $j.browser.version <= 6){
-                       $j('#big_play_link_' + embedObj.id).pngFix();
-               }
-
-               //captions binding:
-               $j('#timed_text_'  + embedObj.id).unbind().btnBind().click(function(){
-                       $j('#' + embedObj.id).get(0).showTextInterface();
-               });
-
-               //options binding:
-               $j('#options_button_' + embedObj.id).unbind().btnBind().click(function(){
-                       $j('#' +embedObj.id).get(0).doOptionsHTML();
-               });
-
-               //fullscreen binding:
-               $j('#fullscreen_'+embedObj.id).unbind().btnBind().click(function(){
-                       $j('#' +embedObj.id).get(0).fullscreen();
-               });
-
-               js_log(" should add slider binding: " + $j('#mv_play_head_'+embedObj.id).length) ;
-//             $j('#mv_play_head_'+embedObj.id).slider({
-               $tp.find( '.j-scrubber' ).slider({
-                       range: "min",
-                       value: 0,
-                       min: 0,
-                       max: 1000,
-                       start: function(event, ui){
-                               var id = (embedObj.pc!=null)?embedObj.pc.pp.id:embedObj.id;
-                               embedObj.userSlide=true;
-                               $j('#big_play_link_'+id).fadeOut('fast');
-                               //if playlist always start at 0
-                               embedObj.start_time_sec = (embedObj.instanceOf == 'mvPlayList')?0:
-                                                               npt2seconds(embedObj.getTimeReq().split('/')[0]);
-                       },
-                       slide: function(event, ui) {
-                               var perc = ui.value/1000;
-                               embedObj.jump_time = seconds2npt( parseFloat( parseFloat(embedObj.getDuration()) * perc ) + embedObj.start_time_sec);
-                               //js_log('perc:' + perc + ' * ' + embedObj.getDuration() + ' jt:'+  this.jump_time);
-                               embedObj.setStatus( gM('seek_to')+' '+embedObj.jump_time );
-                               //update the thumbnail / frame
-                               if(embedObj.isPlaying==false){
-                                       embedObj.updateThumbPerc( perc );
-                               }
-                       },
-                       change:function(event, ui){
-                               //only run the onChange event if done by a user slide:
-                               if(embedObj.userSlide){
-                                       embedObj.userSlide=false;
-                                       embedObj.seeking=true;
-                                       //stop the monitor timer (if we can)
-                                       if(embedObj.stopMonitor)
-                                               embedObj.stopMonitor();
-
-                                       var perc = ui.value/1000;
-                                       //set seek time (in case we have to do a url seek)
-                                       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.doSeek(perc);
-                               }
-                       }
-               });
-               //@todo: identify problem with volume button jumping...
-               $tp.find('.k-volume-slider').slider({
-                       range: "min",
-                       value: 80,
-                       min: 0,
-                       max: 100,
-                        slide: function(event, ui) {
-                                 embedObj.updateVolumen(ui.value/100);
-                        },
-                       change: function(event, ui){
-                               var level = ui.value/100;
-                               if (level==0) {
-                                       $tp.find('.k-volume span').addClass('ui-icon-volume-off');
-                               }else{
-                                       $tp.find('.k-volume span').removeClass('ui-icon-volume-off');
-                               }
-                               //only run the onChange event if done by a user slide:
-                               if(embedObj.userSlide){
-                                       embedObj.userSlide=false;
-                                       embedObj.seeking=true;
-//                                     var perc = ui.value/100;
-                                       embedObj.updateVolumen(level);
-                               }
-                       }
-               });
-               //up the z-index of the default status indicator:
-//             $j('#mv_play_head_'+embedObj.id + ' .ui-slider-handle').css('z-index', 4);
-//             $j('#mv_play_head_'+embedObj.id + ' .ui-slider-range').addClass('ui-corner-all').css('z-index', 2);
-               //extended class list for jQuery ui themeing (we can probably refactor this with custom buffering highliter)
-               $j('#' + embedObj.id + ' .j-scrubber').prepend( ctrlBuilder.getMvBufferHtml() );
-
-
-               //adds options and bindings: (we do this onClick for faster vidoe tag startup times)  
-               var addMvOptions = function(){
-                       if($j('#' + embedObj.id + ' .k-menu').length != 0 )
-                               return false;
-                               
-                       $j('#' + embedObj.id).prepend( ctrlBuilder.components['mv_embedded_options'].o( embedObj ) );
-                       
-                       //by default its hidden:
-                       $tp.find('.k-menu').hide();
-                       
-                       //output menu-items: 
-                       for(i=0; i < ctrlBuilder.menu_items.length ; i++){                              
-                       $tp.find('.k-' +  ctrlBuilder.menu_items[i] + '-btn').click(function(){ 
-                               var mk = $j(this).attr('rel');
-                               $target = $j('#' + embedObj.id  + ' .menu-'+mk).hide();                         
-                               //gennerate the menu html not already done:
-                               if( $target.children().length == 0 ){
-                                               //call the function show{Menuitem} with target:                         
-                                               embedObj['show' + mk.charAt(0).toUpperCase() + mk.substring(1)](
-                                                       $j('#' + embedObj.id + ' .menu-'+mk)
-                                               );
-                               }                                                       
-                               //slide out the others 
-                                $j('#' + embedObj.id  + ' .menu-screen').hide();
-                                $target.fadeIn("fast");
-                                       //don't follow the # link                                                               
-                           return false;
-                               });     
-                       }                       
-               }       
-               
-               //options menu display:                 
-               $tp.find('.k-options').click(function(){      
-                       if($j('#' + embedObj.id + ' .k-menu').length == 0 )
-                               addMvOptions();
-                                                                       
-                       var $ktxt = $j(this).find('.ui-icon-k-menu');
-                       var $kmenu = $tp.find('.k-menu');
-                       if( $kmenu.is(':visible') ){
-                               $kmenu.fadeOut("fast",function(){
-                                       $ktxt.html ( gM('menu_btn') );
-                               });
-                               $tp.find('.play-btn-large').fadeIn('fast');
-                       }else{
-                               $kmenu.fadeIn("fast", function(){
-                                       $ktxt.html ( gM('close_btn') );
-                               });
-                               $tp.find('.play-btn-large').fadeOut('fast');
-                       }
-        });    
-
-               //volume binding:
-               $tp.find('.k-volume').unbind().btnBind().click(function(){
-                       $tp.toggleMute();
-               });
-
-               var hoverOverDelay=false;
-               /*$j('#volume_control_'+embedObj.id).unbind().btnBind().click(function(){
-                       $j('#' +embedObj.id).get(0).toggleMute();
-               });
-                .hover(
-                       function(){
-                               $j('#vol_container_' + embedObj.id).addClass('vol_container_top');
-                               //set to "below" if playing and embedType != native
-                               if(embedObj && embedObj.isPlaying() && !embedObj.supports['overlays']){
-                                       $j('#vol_container_' + embedObj.id).removeClass('vol_container_top').addClass('vol_container_below');
-                               }
-
-                               $j('#vol_container_' + embedObj.id).fadeIn('fast');
-                               hoverOverDelay = true;
-                       },
-                       function(){
-                               hoverOverDelay= false;
-                               setTimeout(function doHideVolume(){
-                                       if(!hoverOverDelay){
-                                               $j('#vol_container_' + embedObj.id).fadeOut('fast');
-                                       }
-                               }, 500);
-                       }
-               );
-               //Volumen Slider
-               $j('#volume_bar_'+embedObj.id).slider({
-                       orientation: "vertical",
-                       range: "min",
-                       value: 80,
-                       min: 0,
-                       max: 100,
-                       slide: function(event, ui) {
-                               var perc = ui.value/100;
-                               //js_log('update volume:' + perc);
-                               embedObj.updateVolumen(perc);
-                       },
-                       change:function(event, ui){
-                               var perc = ui.value/100;
-                               if (perc==0) {
-                                       $j('#volume_control_'+embedObj.id + ' span').removeClass('ui-icon-volume-on').addClass('ui-icon-volume-off');
-                               }else{
-                                       $j('#volume_control_'+embedObj.id + ' span').removeClass('ui-icon-volume-off').addClass('ui-icon-volume-on');
-                               }
-                               //only run the onChange event if done by a user slide:
-                               if(embedObj.userSlide){
-                                       embedObj.userSlide=false;
-                                       embedObj.seeking=true;
-                                       var perc = ui.value/100;
-                                       embedObj.updateVolumen(perc);
-                               }
-                       }
-               });*/
-
-       },
-       getMvBufferHtml:function(){
-               return '<div class="ui-slider-horizontal ui-corner-all ui-slider-buffer" />';
-       },
-       components:{
-               'borders':{
-                       'w':8,
-                       'o':function(){
-                               return  '';
-                       }
-               },
-               'mv_embedded_options':{
-                       'w':0,
-                       'o':function( embedObj ){
-                               var o= '' +
-                               '<div class="k-menu ui-widget-content" ' +
-                                       'style="width:' + embedObj.playerPixelWidth() + 'px; height:' + embedObj.playerPixelHeight() + 'px;">' +
-                                               '<ul class="k-menu-bar">';                                              
-                                                       //output menu item containers: 
-                                                       for(i=0; i < ctrlBuilder.menu_items.length; i++){               
-                                                               var mk = ctrlBuilder.menu_items[i];                             
-                                                               o+= '<li class="k-' + mk + '-btn" rel="'+mk+'">' +
-                                                                               '<a href="#" title="' + gM( mk ) +'">' + gM( mk ) +'</a></li>';
-                                                       }                                                       
-                                               o+='</ul>' +
-                                               //we have to substract the width of the k-menu-bar
-                                               '<div class="k-menu-screens" style="width:' + ( embedObj.playerPixelWidth() -75) +
-                                                       'px; height:' + (embedObj.playerPixelHeight() - ctrlBuilder.height) + 'px;">';
-                                               
-                                               //output menu item containers: 
-                                               for(i=0; i < ctrlBuilder.menu_items.length; i++){                                                       
-                                                       o+= '<div class="menu-screen menu-' + ctrlBuilder.menu_items[i] + '"></div>';
-                                               }
-                                                                                                                                       
-                                               '</div>' +
-                                       '</div>';
-                               return o;
-                       }
-               },
-               'pause':{
-                       'w':147, //28 147
-                       'o':function(){
-                               return '<button class="play-btn ui-state-default ui-corner-all" title="' +
-                                       gM('play_clip') + '" ><span class="ui-icon ui-icon-play"></span></button>'
-                       }
-               },
-               'play_head':{  // scrubber
-                       'w':0, //special case (takes up remaining space)
-                       'o':function(){
-                               return '<div class="ui-slider ui-slider-horizontal ui-corner-all j-scrubber"' +
-                                               ' style="width:' + ( ctrlBuilder.available_width - 30 ) + 'px;"></div>'
-                       }
-               },
-               'time_display':{
-                       'w':36,
-                       'o':function(){
-                               return '<div class="k-timer">' + seconds2npt ( ctrlBuilder.embedObj.getDuration() ) + '</div>';
-                       }
-               },
-               'volume_control':{
-                       'w':47,
-                       'o':function(){
-                               return '<button class="ui-state-default ui-corner-all k-volume">' +
-                                                       '<span class="ui-icon ui-icon-volume-on"></span>' +
-                                               '</button>' +
-                                               '<div class="ui-slider ui-slider-horizontal k-volume-slider"></div>';
-
-                               //vertical volume control:
-                               /* return '<div title="' + gM('volume_control') + '" id="volume_control_'+ctrlBuilder.id+'" class="ui-state-default ui-corner-all ui-icon_link rButton">' +
-                                       '<span class="ui-icon ui-icon-volume-on"></span>' +
-                                       '<div style="position:absolute;display:none;" id="vol_container_'+ctrlBuilder.id+'" class="vol_container ui-corner-all">' +
-                                               '<div class="volume_bar" id="volume_bar_' + ctrlBuilder.id + '"></div>' +
-                                               '</div>'+
-                                       '</div>';
-                               */
-                       }
-               },
-               'closed_captions':{
-                       'w':24,
-                       'o':function(){
-                               return '<div title="' + gM('closed_captions') + '" id="timed_text_' + ctrlBuilder.id +'" ' +
-                                                       'class="ui-state-default ui-corner-all ui-icon_link rButton">' +
-                                               '<span class="ui-icon ui-icon-comment"></span></div>';
-                       }
-               },
-               'fullscreen':{
-                       'w':24,
-                       'o':function(){
-                               return '<button class="ui-state-default ui-corner-all k-fullscreen" title="' + gM('player_fullscreen') + '">' +
-                                               '<span class="ui-icon ui-icon-arrow-4-diag"></span></button>'
-                       }
-               },
-               'options':{
-                       'w':50,
-                       'o':function(){
-                               return '<button class="ui-state-default ui-corner-bl k-options" title="'+ gM('player_options') + '" >' +
-                                                       '<span class="ui-icon ui-icon-k-menu">'+ gM('menu_btn') + '</span>'
-                                               '</button>'
-                       }
-               }
-       }
-}
-
 /*
 * Converts all occurrences of <video> tag into video object
 */
 function mv_video_embed(swap_done_callback, force_id){
+       //check call stack
        mvEmbed.init( swap_done_callback, force_id );
 }
-mvEmbed = {
-       //flist stores the set of functions to run after the video has been swaped in.
+mvEmbed = {    
+       //flist stores the set of functions to run after the video has been swapped in. 
        flist:new Array(),
-       init:function( swap_done_callback, force_id ){
-
+       init:function( swap_done_callback, force_id ){          
                if(swap_done_callback)
                        mvEmbed.flist.push( swap_done_callback );
-
+                       
                //get mv_embed location if it has not been set
-               js_log('mv_embed ' + MV_EMBED_VERSION);
-
-               var loadPlaylistLib=false;
-
+               js_log('mv_video_embed:: ' + $mw.version);                                              
+               
+               var loadPlaylistLib=false;                                              
+               
                var eAction = function(this_elm){
                        js_log( "Do SWAP: " + $j(this_elm).attr("id") + ' tag: '+ this_elm.tagName.toLowerCase() );
-
+                                                               
                        if( $j(this_elm).attr("id") == '' ){
-                               $j(this_elm).attr("id", 'v'+ global_player_list.length);
-                       }
-                       //stre a global reference to the id
-                  global_player_list.push( $j(this_elm).attr("id") );
-                  //if video doSwap
-                  switch( this_elm.tagName.toLowerCase()){
-                          case 'video':
-                                   var videoInterface = new embedVideo(this_elm);
+                               $j(this_elm).attr("id", 'v'+ $mw.player_list.length);
+                       }                       
+                       //store a global reference to the id    
+                       $mw.player_list.push( $j(this_elm).attr("id") );                        
+                       
+                       //if video doSwap
+                       switch( this_elm.tagName.toLowerCase()){
+                               case 'video':
+                                       var videoInterface = new embedVideo(this_elm);   
                                        mvEmbed.swapEmbedVideoElement( this_elm, videoInterface );
-                          break;
-                          case 'audio':
-                                  var videoInterface = new embedVideo(this_elm);
-                                  videoInterface.type ='audio';
-                                  mvEmbed.swapEmbedVideoElement( this_elm, videoInterface );
-                          break;
-                          case 'playlist':
-                                  loadPlaylistLib=true;
-                          break;
-                  }
-               }
-
+                               break;
+                               case 'audio':
+                                       var videoInterface = new embedVideo(this_elm);                                          
+                                       mvEmbed.swapEmbedVideoElement( this_elm, videoInterface );
+                               break;
+                               case 'playlist':
+                                       loadPlaylistLib=true;
+                               break;
+                  }            
+               }               
                if( force_id == null && force_id != '' ){
-                       var j_selector = 'video,audio,playlist';
-               }else{
+                       var j_selector = 'video,audio,playlist';                                
+               }else{          
                        var j_selector = '#' + force_id;
                }
-               //process selected elements:
-               //ie8 does not play well with the jQuery video,audio,playlist selector use native:
+               
+               js_log('j_selector:: ' + j_selector);
+               //process selected elements: 
+               //ie8 does not play well with the jQuery video,audio,playlist selector use native: 
                if($j.browser.msie && $j.browser.version >= 8){
-                       jtags = j_selector.split(',');
-                       for( var i=0; i < jtags.length; i++){
+                       jtags = j_selector.split(',');                          
+                       for( var i=0; i < jtags.length; i++){                           
                                $j( document.getElementsByTagName( jtags[i] )).each(function(){
                                        eAction(this);
                                });
-                       }
-               }else{
+                       }                               
+               }else{                  
                        $j( j_selector ).each(function(){
                                eAction(this);
-                       });
-               }
-               if(loadPlaylistLib){
-                       mvJsLoader.doLoad([
+                       });     
+               }                               
+               if(loadPlaylistLib){            
+                       mvJsLoader.doLoad([ 
                                'mvPlayList',
                                '$j.ui',        //include dialog for pop-ing up thigns
-                               '$j.ui.dialog'
+                               '$j.ui.dialog'  
                        ], function(){
-                               $j('playlist').each(function(){
+                               //deal with each playlist instance
+                               $j('playlist').each(function(){                                                                                                                                                                                                                                                                 
                                        //create new playlist interface:
                                        var plObj = new mvPlayList( this );
                                        mvEmbed.swapEmbedVideoElement(this, plObj);
                                        var added_height = plObj.pl_layout.title_bar_height + plObj.pl_layout.control_height;
-                                       //move into a blocking display container with height + controls + title height:
-                                       $j('#'+plObj.id).wrap('<div style="display:block;height:' + (plObj.height + added_height) + 'px;"></div>');
+                                       //move into a blocking display container with height + controls + title height: 
+                                       $j('#'+plObj.id).wrap('<div style="display:block;height:' + (plObj.height + added_height) + 'px;"></div>');                                                                             
                                });
                        });
-               }
+               }          
                this.checkClipsReady();
        },
        /*
@@ -607,14 +210,13 @@ mvEmbed = {
                js_log('do swap ' + videoInterface.id + ' for ' + video_element);
                embed_video = document.createElement('div');
                //make sure our div has a hight/width set:
-
-               /*$j(embed_video).css({
-                       'width':videoInterface.width,
-                       'height':videoInterface.height
-               }).html( mv_get_loading_img() );*/
-               
+                       
+               $j(embed_video).css({
+                       'width' : videoInterface.width,
+                       'height' : videoInterface.height
+               }).html( mv_get_loading_img() );                
                //inherit the video interface
-               for(var method in videoInterface){ //for in loop oky in Element context
+               for(var method in videoInterface){ //for in loop oky in Element context 
                        if(method!='readyState'){ //readyState crashes IE
                                if(method=='style'){
                                                embed_video.setAttribute('style', videoInterface[method]);
@@ -631,32 +233,32 @@ mvEmbed = {
                        //string -> boolean:
                        if(embed_video[method]=="false")embed_video[method]=false;
                        if(embed_video[method]=="true")embed_video[method]=true;
-               }
-               ///js_log('did vI style');
-               //now swap out the video element for the embed_video obj:
-               $j(video_element).after(embed_video).remove();
-               //js_log('did swap');
-               $j('#'+embed_video.id).get(0).on_dom_swap();
-
+               }       
+               ///js_log('did vI style');  
+               //now swap out the video element for the embed_video obj:         
+               $j(video_element).after(embed_video).remove();  
+               //js_log('did swap');             
+               $j('#'+embed_video.id).get(0).on_dom_swap();    
+                         
                // now that "embed_video" is stable, do more initialization (if we are ready)
-               if($j('#'+embed_video.id).get(0).loading_external_data == false &&
-                          $j('#'+embed_video.id).get(0).init_with_sources_loadedDone == false){
-                       //load and set ready state since source are available:
+               if($j('#'+embed_video.id).get(0).loading_external_data == false
+                        && $j('#'+embed_video.id).get(0).init_with_sources_loadedDone == false){
+                       //load and set ready state since source are available: 
                        $j('#'+embed_video.id).get(0).init_with_sources_loaded();
                }
-
-               js_log('done with child: ' + embed_video.id + ' len:' + global_player_list.length);
+               
+               js_log('done with child: ' + embed_video.id + ' len:' + $mw.player_list.length);
                return true;
        },
        //this should not be needed.
        checkClipsReady : function(){
                //js_log('checkClipsReady');
-               var is_ready=true;
-                 for(var i=0; i < global_player_list.length; i++){
-                         if( $j('#'+global_player_list[i]).length !=0){
-                                 var cur_vid =  $j('#'+global_player_list[i]).get(0);
+               var is_ready=true;        
+                 for(var i=0; i < $mw.player_list.length; i++){
+                         if( $j('#'+$mw.player_list[i]).length !=0){
+                                 var cur_vid =  $j('#'+$mw.player_list[i]).get(0);               
                                is_ready = ( cur_vid.ready_to_play ) ? is_ready : false;
-                               if( !is_ready && cur_vid.load_error ){
+                               if( !is_ready && cur_vid.load_error ){ 
                                        is_ready=true;
                                        $j(cur_vid).html( cur_vid.load_error );
                                }
@@ -664,15 +266,15 @@ mvEmbed = {
                }
                if( is_ready ){
                        mvEmbed.allClipsReady = true;
-                       // run queued functions
+                       // run queued functions 
                        //js_log('run queded functions:' + mvEmbed.flist[0]);
                        mvEmbed.runFlist();
-               }else{
+               }else{                           
                         setTimeout( 'mvEmbed.checkClipsReady()', 25 );
-                }
+                }                        
        },
        runFlist:function(){
-               while (this.flist.length){
+               while (this.flist.length){                              
                        this.flist.shift()();
                }
        }
@@ -715,37 +317,37 @@ mediaSource.prototype =
 
        init : function(element)
        {
-               //js_log('adding mediaSource: ' + element);
+               //js_log('adding mediaSource: ' + element);                             
                this.src = $j(element).attr('src');
                this.marked_default = false;
                if ( element.tagName.toLowerCase() == 'video')
-                       this.marked_default = true;
-
+                       this.marked_default = true;             
+               
                //set default URLTimeEncoding if we have a time  url:
-               //not ideal way to discover if content is on an oggz_chop server.
-               //should check some other way.
+               //not ideal way to discover if content is on an oggz_chop server. 
+               //should check some other way. 
                var pUrl = parseUri ( this.src );
                if(typeof pUrl['queryKey']['t'] != 'undefined'){
-                       this['URLTimeEncoding']=true;
-               }
+                       this['URLTimeEncoding']=true;                   
+               }                               
                for(var i=0; i < mv_default_source_attr.length; i++){ //array loop:
-                       var attr = mv_default_source_attr[ i ];
+                       var attr = mv_default_source_attr[ i ];                 
                        if( $j(element).attr( attr ) ) {
                                this[ attr ] =  $j(element).attr( attr );
                        }
-               }
-               //update duration from hit if present:
-               if(this.durationHint)
-                       this.duration = this.durationHint;
-
-
+               }                               
+               //update duration from hit if present: 
+               if( this.durationHint )
+                       this.duration = this.durationHint;              
+                                       
+                       
                if ( $j(element).attr('type'))
                        this.mime_type = $j(element).attr('type');
                else if ($j(element).attr('content-type'))
                        this.mime_type = $j(element).attr('content-type');
-               else
+               else                    
                        this.mime_type = this.detectType(this.src);
-
+               
                //set the title if unset:
                if( !this.title )
                        this.title = this.mime_type;
@@ -753,9 +355,9 @@ mediaSource.prototype =
                this.parseURLDuration();
        },
        updateSource:function(element){
-               //for now just update the title:
+               //for now just update the title: 
                if ($j(element).attr("title"))
-                       this.title = $j(element).attr("title");
+                       this.title = $j(element).attr("title");         
        },
        /** updates the src time and start & end
         *  @param {String} start_time in NTP format
@@ -766,18 +368,18 @@ mediaSource.prototype =
                //js_log("pre uri:" + this.src);
                //if we have time we can use:
                if( this.URLTimeEncoding ){
-                       //make sure its a valid start time / end time (else set default)
-                       if( !npt2seconds(start_ntp) )
+                       //make sure its a valid start time / end time (else set default) 
+                       if( !npt2seconds(start_ntp) ) 
                                start_ntp = this.start_ntp;
-
+                               
                        if( !npt2seconds(end_ntp) )
                                end_ntp = this.end_ntp;
-
-                       this.src = getURLParamReplace(this.src, { 't': start_ntp +'/'+ end_ntp } );
-
+                                                                                 
+                       this.src = getURLParamReplace(this.src, { 't': start_ntp +'/'+ end_ntp } );                
+                       
                        //update the duration
                        this.parseURLDuration();
-               }
+               }                
        },
        setDuration:function (duration)
        {
@@ -795,20 +397,20 @@ mediaSource.prototype =
                return this.mime_type;
        },
        /** URI accessor function.
-        *       @param int seek_time_sec (used to adjust the URI for url based seeks)
+        *       @param int seek_time_sec (used to adjust the URI for url based seeks) 
                @return the URI of the source.
                @type String
        */
        getURI : function( seek_time_sec )
-       {
-          if( !seek_time_sec || !this.URLTimeEncoding ){
-                          return this.src;
-          }
+       {                               
+          if( !seek_time_sec || !this.URLTimeEncoding ){                       
+                          return this.src;                                               
+          }                            
           if(!this.end_ntp){
                  var endvar = '';
           }else{
                  var endvar = '/'+ this.end_ntp;
-          }
+          }            
           return getURLParamReplace(this.src,  { 't': seconds2npt( seek_time_sec )+endvar } ); ;
        },
        /** Title accessor function.
@@ -832,9 +434,9 @@ mediaSource.prototype =
         * special case derive duration from request url
         * supports media_url?t=ntp_start/ntp_end url request format
         */
-       parseURLDuration : function(){
-               //check if we have a URLTimeEncoding:
-               if( this.URLTimeEncoding ){
+       parseURLDuration : function(){                    
+               //check if we have a URLTimeEncoding: 
+               if( this.URLTimeEncoding ){               
                        var annoURL = parseUri( this.src );
                        if( annoURL.queryKey['t'] ){
                                var times = annoURL.queryKey['t'].split('/');
@@ -846,15 +448,15 @@ mediaSource.prototype =
                                //look for this info as attributes
                                if(this.startOffset){
                                        this.start_offset = this.startOffset;
-                                       this.start_ntp = seconds2npt( this.startOffset);
-                               }
+                                       this.start_ntp = seconds2npt( this.startOffset);                                        
+                               } 
                                if(this.duration){
                                        this.end_ntp = seconds2npt( parseInt(this.duration) + parseInt(this.start_offset) );
-                               }
-                       }
+                               }                               
+                       }                                               
                }
                //else nothing to parse just keep whatever info we already have
-
+               
                //js_log('f:parseURLDuration() for:' + this.src  + ' d:' + this.duration);
        },
        /** Attempts to detect the type of a media file based on the URI.
@@ -894,12 +496,12 @@ function mediaElement(video_element)
 mediaElement.prototype =
 {
        /** The array of mediaSource elements. */
-       sources:null,
-       addedROEData:false,
+       sources:null,   
+       addedROEData:false,     
        /** Selected mediaSource element. */
        selected_source:null,
        thumbnail:null,
-       linkback:null,
+       linkback:null,  
 
        /** @private */
        init:function( video_element )
@@ -910,20 +512,23 @@ mediaElement.prototype =
                this.thumbnail = mv_default_thumb_url;
                // Process the source element:
                if($j(video_element).attr("src"))
-                       this.tryAddSource(video_element);
-
+                       this.tryAddSource(video_element);                         
+               
                if($j(video_element).attr('thumbnail'))
                        this.thumbnail = $j(video_element).attr('thumbnail');
-
+                       
                if($j(video_element).attr('poster'))
                        this.thumbnail = $j(video_element).attr('poster');
-
-               // Process all inner <source> elements
+               
+               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 );
-
-               $j(video_element).find('source,text').each(function(inx, inner_source){
+               
+               $j(video_element).find('source,text').each(function(inx, inner_source){                 
                        _this.tryAddSource( inner_source );
-               });
+               });                                               
        },
        /** Updates the time request for all sources that have a standard time request argument (ie &t=start_time/end_time)
         */
@@ -935,10 +540,10 @@ mediaElement.prototype =
        },
        /*timed Text check*/
        timedTextSources:function(){
-               for(var i=0; i < this.sources.length; i++){
+               for(var i=0; i < this.sources.length; i++){                     
                        if(     this.sources[i].mime_type == 'text/cmml' ||
                                this.sources[i].mime_type == 'text/x-srt')
-                                       return true;
+                                       return true;                                                            
                };
                return false;
        },
@@ -949,7 +554,7 @@ mediaElement.prototype =
        {
                if(!mime_filter)
                        return this.sources;
-               //apply mime filter:
+               //apply mime filter: 
                   var source_set = new Array();
                for(var i=0; i < this.sources.length ; i++){
                        if( this.sources[i].mime_type.indexOf( mime_filter ) != -1 )
@@ -957,7 +562,7 @@ mediaElement.prototype =
                }
                return source_set;
        },
-       getSourceById:function( source_id ){
+       getSourceById:function( source_id ){            
                for(var i=0; i < this.sources.length ; i++){
                        if( this.sources[i].id ==  source_id)
                                return this.sources[i];
@@ -973,70 +578,70 @@ 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
         * */
-       autoSelectSource:function(){
-               js_log('f:autoSelectSource:');
-               //@@todo read user preference for source
+       autoSelectSource:function(){ 
+               js_log('f:autoSelectSource:');  
+               //@@todo read user preference for source                
                // Select the default source
-               var playable_sources = this.getPlayableSources();
-               var flash_flag=ogg_flag=false;
+               var playable_sources = this.getPlayableSources();                                                       
+               var flash_flag=ogg_flag=false;            
                //debugger;
                for(var source=0; source < playable_sources.length; source++){
                        var mime_type =playable_sources[source].mime_type;
                        if( playable_sources[source].marked_default ){
                                js_log('set via marked default: ' + playable_sources[source].marked_default);
-                               this.selected_source = playable_sources[source];
+                               this.selected_source = playable_sources[source];                                
                                return true;
                        }
                        //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
+                                return true; 
+                       }                                                                                                                       
+               }          
+               //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;
-                          //set source via player
-                       if(mime_type=='video/ogg' || mime_type=='ogg/video' || mime_type=='video/annodex' || mime_type=='application/ogg'){
+                       var mime_type =playable_sources[source].mime_type;                                      
+                          //set source via player                               
+                       if(mime_type=='video/ogg' || mime_type=='ogg/video' || mime_type=='video/annodex' || mime_type=='application/ogg'){                             
                                for(var i=0; i < embedTypes.players.players.length; i++){ //for in loop on object oky
-                                       var player = embedTypes.players.players[i];
+                                       var player = embedTypes.players.players[i];                                     
                                        if(player.library=='vlc' || player.library=='native'){
-                                               js_log('set via ogg via order');
-                                               this.selected_source = playable_sources[source];
+                                               js_log('set via ogg via order');                                                
+                                               this.selected_source = playable_sources[source];        
                                                return true;
-                                       }
+                                       }                                       
                                }
                        }
                }
                //set basic flash
-               for(var source=0; source < playable_sources.length; source++){
-                       var mime_type =playable_sources[source].mime_type;
+               for(var source=0; source < playable_sources.length; source++){  
+                       var mime_type =playable_sources[source].mime_type;                                                                              
                        if( mime_type=='video/x-flv' ){
                                js_log('set via by player preference normal flash')
                                this.selected_source = playable_sources[source];
                                return true;
-                       }
+                       }                                               
                }
-               //set h264 flash
-               for(var source=0; source < playable_sources.length; source++){
-                       var mime_type =playable_sources[source].mime_type;
+               //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' ){
                                js_log('set via playable_sources preference h264 flash')
                                this.selected_source = playable_sources[source];
                                return true;
-                       }
-               }
-               //select first source
+                       }                          
+               }               
+               //select first source           
                if (!this.selected_source)
                {
                        js_log('set via first source:' + playable_sources[0]);
@@ -1075,48 +680,45 @@ mediaElement.prototype =
                //return mime_type=='video/ogg' || mime_type=='ogg/video' || mime_type=='video/annodex' || mime_type=='video/x-flv';
        },
        /** Adds a single mediaSource using the provided element if
-               the element has a 'src' attribute.
-               @param element {element} <video>, <source> or <mediaSource> element.
+               the element has a 'src' attribute.              
+               @param element {element} <video>, <source> or <mediaSource> <text> element.
        */
        tryAddSource:function(element)
        {
-               js_log('f:tryAddSource:'+ $j(element).attr("src"));
-               if (! $j(element).attr("src")){
-                       //js_log("element has no src");
-                       return false;
-               }
-               var new_src = $j(element).attr('src');
-               //make sure an existing element with the same src does not already exist:
-               for( var i=0; i < this.sources.length; i++ ){
-                       if(this.sources[i].src == new_src){
-                               //js_log('checking existing: '+this.sources[i].getURI() + ' != '+ new_src);
-                               //can't add it all but try to update any additional attr:
-                               this.sources[i].updateSource(element);
-                               return false;
+               js_log('f:tryAddSource:'+ $j(element).attr("src"));                             
+               if ( $j(element).attr("src") ){
+                       var new_src = $j(element).attr('src');
+                       //make sure an existing element with the same src does not already exist:                
+                       for( var i=0; i < this.sources.length; i++ ){                           
+                               if(this.sources[i].src == new_src){
+                                       //js_log('checking existing: '+this.sources[i].getURI() + ' != '+ new_src);      
+                                       //can't add it all but try to update any additional attr: 
+                                       this.sources[i].updateSource(element);
+                               }
                        }
-               }
-               var source = new mediaSource( element );
-               this.sources.push(source);
-               //alert('pushed source to stack'+ source + 'sl:'+this.sources.length);
+               }                               
+               var source = new mediaSource( element );                
+               this.sources.push(source);              
+               js_log('pushed source to stack'+ source + 'sl:'+this.sources.length);
        },
-       getPlayableSources: function(){
+       getPlayableSources: function(){          
                 var playable_sources= new Array();
-                for(var i=0; i < this.sources.length; i++){
-                        if( this.isPlayableType( this.sources[i].mime_type ) ){
+                for(var i=0; i < this.sources.length; i++){                                                               
+                        if( this.isPlayableType( this.sources[i].mime_type ) ){                                 
                                 playable_sources.push( this.sources[i] );
                         }else{
                                 js_log("type "+ this.sources[i].mime_type + 'is not playable');
                         }
-                };
+                };              
                 return playable_sources;
        },
        /* Imports media sources from ROE data.
         *   @param roe_data ROE data.
        */
-       addROE:function(roe_data){
+       addROE:function(roe_data){              
                js_log('f:addROE');
                this.addedROEData=true;
-               var _this = this;
+               var _this = this;               
                if( typeof roe_data == 'string' )
                {
                        var parser=new DOMParser();
@@ -1143,7 +745,7 @@ mediaElement.prototype =
                        });
                }else{
                        js_log('ROE data empty.');
-               }
+               }                               
        }
 };
 
@@ -1159,7 +761,7 @@ var embedVideo = function(element) {
 embedVideo.prototype = {
        /** The mediaElement object containing all mediaSource objects */
        media_element:null,
-       preview_mode:false,
+       preview_mode:false,                
        ready_to_play:false, //should use html5 ready state
        load_error:false, //used to set error in case of error
        loading_external_data:false,
@@ -1167,19 +769,19 @@ embedVideo.prototype = {
        thumbnail_disp:true,
        init_with_sources_loadedDone:false,
        inDOM:false,
-       //for onClip done stuff:
+       //for onClip done stuff: 
        anno_data_cache:null,
        seek_time_sec:0,
        base_seeker_slider_offset:null,
        onClipDone_disp:false,
-       supports:{},
+       supports:{},    
        //for seek thumb updates:
        cur_thumb_seek_time:0,
        thumb_seek_interval:null,
-
+       //set the default tag type to video:    
        seeking:false,
-       //set the buffered percent:
-       bufferedPercent:0,
+       //set the buffered percent:     
+       bufferedPercent:0,      
        //utility functions for property values:
        hx : function ( s ) {
                if ( typeof s != 'String' ) {
@@ -1194,7 +796,7 @@ embedVideo.prototype = {
        },
        playerPixelWidth : function()
        {
-               var player = $j('#dc_'+this.id).get(0);
+               var player = $j('#mv_embedded_player_'+this.id).get(0);
                if(typeof player!='undefined' && player['offsetWidth'])
                        return player.offsetWidth;
                else
@@ -1202,40 +804,56 @@ embedVideo.prototype = {
        },
        playerPixelHeight : function()
        {
-               var player = $j('#dc_'+this.id).get(0);
+               var player = $j('#mv_embedded_player_'+this.id).get(0);
                if(typeof player!='undefined' && player['offsetHeight'])
                        return player.offsetHeight;
                else
                        return parseInt(this.height);
        },
-       init: function(element){
-               //this.element_pointer = element;
-
-               //inherit all the default video_attributes
+       init: function(element){                                                        
+               //inherit all the default video_attributes              
                for(var attr in default_video_attributes){ //for in loop oky on user object
                        if(element.getAttribute(attr)){
-                               this[attr]=element.getAttribute(attr);
-                               //js_log('attr:' + attr + ' val: ' + element.getAttribute(attr) +'(set by elm)');
+                               this[ attr ]=element.getAttribute(attr);
                        }else{
                                this[attr]=default_video_attributes[attr];
-                               //js_log('attr:' + attr + ' val: ' + video_attributes[attr] +" "+ 'elm_val:' + element.getAttribute(attr) + "\n (set by attr)");
                        }
                }
-               //make sure startOffset is cast as an int
+               
+               //set the skin name from the class  
+               var     sn = element.getAttribute('class');
+               if( sn && sn != ''){
+                       for(var n=0;n< $mw.valid_skins.length;n++){ 
+                               if( sn.indexOf($mw.valid_skins[n]) !== -1){
+                                       this.skin_name = $mw.valid_skins[n];
+                               }
+                       }
+               }
+               //set the default if unset: 
+               if(!this.skin_name)
+                       this.skin_name = $mw.conf.skin_name;
+               
+               //make sure startOffset is cast as an int                  
                if( this.startOffset && this.startOffset.split(':').length >= 2)
                        this.startOffset = npt2seconds(this.startOffset);
-               //make sure offset is in float:
+               //make sure offset is in float: 
                this.startOffset = parseFloat(this.startOffset);
-
+                
                if( this.duration && this.duration.split(':').length >= 2)
-                       this.duration = npt2seconds( this.duration );
-                  //make sure duration is in float:
-               this.duration = parseFloat(this.duration);
+                       this.duration = npt2seconds( this.duration );    
+                  //make sure duration is in float:  
+               this.duration = parseFloat(this.duration);  
                js_log("duration is: " +  this.duration);
-               //if style is set override width and height
-               var dwh = mwConfig['video_size'].split('x');
-               this.width = element.style.width ? element.style.width : dwh[0];
-               this.height = element.style.height ? element.style.height : dwh[1];
+               
+               //get defaults          
+               var dwh = $mw.conf['video_size'].split('x');
+               this.width = element.style.width ? element.style.width : dwh[0];                
+               if( element.tagName == 'AUDIO' ){
+                       this.height = element.style.height ? element.style.height : 0;
+               }else{
+                       this.height = element.style.height ? element.style.height : dwh[1];
+               }                               
+               
                //set the plugin id
                this.pid = 'pid_' + this.id;
 
@@ -1244,114 +862,119 @@ embedVideo.prototype = {
                if(element.innerHTML!='' && element.getElementsByTagName('source').length==0){
                        js_log('innerHTML: ' + element.innerHTML);
                        this.user_missing_plugin_html=element.innerHTML;
-               }
+               }                                 
                // load all of the specified sources
-               this.media_element = new mediaElement(element);
+               this.media_element = new mediaElement(element);         
+               
+               //if we are displaying controls setup the ctrlBuilder  
+               if( this.controls ){
+                       //set-up the local ctrlBuilder instance: 
+                       this.ctrlBuilder = new ctrlBuilder( this );
+                       //load the css for the current player
+                                       
+               }                       
+               //load skin:
+               loadExternalCss(  mv_embed_path +  'skins/' + this.skin_name + '/playerSkin.css');
        },
        on_dom_swap: function(){
-               js_log('f:on_dom_swap');
+               js_log('f:on_dom_swap');                                
                // Process the provided ROE file... if we don't yet have sources
                if(this.roe && this.media_element.sources.length==0 ){
                        js_log('loading external data');
                        this.loading_external_data=true;
-                       var _this = this;
+                       var _this = this;                                       
                        do_request(this.roe, function(data)
-                       {
-                               //continue
-                               _this.media_element.addROE( data );
-                               js_log('added_roe::' + _this.media_element.sources.length);
-
-                               js_log('set loading_external_data=false');
-                               _this.loading_external_data=false;
-
-                               _this.init_with_sources_loaded();
+                       {                                                       
+                               //continue                                         
+                               _this.media_element.addROE( data );                                                                       
+                               js_log('added_roe::' + _this.media_element.sources.length);                                                        
+                                                                                                          
+                               js_log('set loading_external_data=false');       
+                               _this.loading_external_data=false;                                                         
+                               
+                               _this.init_with_sources_loaded();               
                        });
                }
        },
        init_with_sources_loaded : function()
-       {
+       {       
                js_log('f:init_with_sources_loaded');
                //set flag that we have run this function:
-               this.init_with_sources_loadedDone=true;
+               this.init_with_sources_loadedDone=true;                          
                //autoseletct the source
-               this.media_element.autoSelectSource();
-               //auto select player based on prefrence or default order
+               this.media_element.autoSelectSource();          
+               //auto select player based on default order
                if( !this.media_element.selected_source )
                {
-                       //check for parent clip:
-                       if( typeof this.pc != 'undefined' ){
-                               js_log('no sources, type:' +this.type + ' check for html');
-                               //debugger;
-                               //do load player if just displaying innerHTML:
+                       //check for parent clip: 
+                       if( typeof this.pc != 'undefined' ){                    
+                               js_log('no sources, type:' +this.type + ' check for html');     
+                               //debugger;                     
+                               //do load player if just displaying innerHTML: 
                                if( this.pc.type == 'text/html' ){
                                        this.selected_player = embedTypes.players.defaultPlayer( 'text/html' );
-                                       js_log('set selected player:'+ this.selected_player.mime_type);
+                                       js_log('set selected player:'+ this.selected_player.mime_type); 
                                }
                        }
-               }else{
+               }else{          
                        this.selected_player = embedTypes.players.defaultPlayer( this.media_element.selected_source.mime_type );
-               }
+               }                                                 
                if( this.selected_player ){
                        js_log('selected ' + this.selected_player.getName());
                        js_log("PLAYBACK TYPE: "+this.selected_player.library);
-                       this.thumbnail_disp = true;
-                       this.inheritEmbedObj();
-               }else{
+                       this.thumbnail_disp = true;             
+                       this.inheritEmbedObj();            
+               }else{                                                   
                        //no source's playable
                        var missing_type ='';
-                       var or ='';
+                       var or ='';  
                        for( var i=0; i < this.media_element.sources.length; i++){
                                missing_type+= or + this.media_element.sources[i].mime_type;
                                or=' or ';
-                       }
+                       }                       
                        if( this.pc )
-                               var missing_type = this.pc.type;
+                               var missing_type = this.pc.type;                                                                                
                           js_log('no player found for given source type ' + missing_type);
-                          this.load_error= this.getPluginMissingHTML(missing_type);
-               }
+                          this.load_error= this.getPluginMissingHTML(missing_type);                                                                               
+               }               
        },
-       inheritEmbedObj:function(){
-               js_log("inheritEmbedObj:duration is: " +  this.duration);
+       inheritEmbedObj:function(){             
+               js_log("inheritEmbedObj:duration is: " +  this.duration);  
                //@@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){
                        eval('tmpObj = '+this.instanceOf);
-                       for(var i in tmpObj){ //for in loop oky for object
+                       for(var i in tmpObj){ //for in loop oky for object  
                                if(this['parent_'+i]){
                                        this[i]=this['parent_'+i];
                                }else{
                                        this[i]=null;
                                }
                        }
-               }
+               }                                 
                //set up the new embedObj
                js_log('f: inheritEmbedObj: embedding with ' + this.selected_player.library);
-               var _this = this;
-               this.selected_player.load( function()
-               {
-                        js_log("selected_player::load:duration is: " +  _this.duration);
+               var _this = this;               
+               this.selected_player.load( function(){                    
                        //js_log('inheriting '+_this.selected_player.library +'Embed to ' + _this.id + ' ' + $j('#'+_this.id).length);
-                       //var _this = $j('#'+_this.id).get(0);
-                       //js_log( 'type of ' + _this.selected_player.library +'Embed + ' +
-                       //              eval('typeof '+_this.selected_player.library +'Embed'));
                        eval('embedObj = ' +_this.selected_player.library +'Embed;');
-                       for(var method in embedObj){ //for in loop oky for object
+                       for(var method in embedObj){ //for in loop oky for object  
                                //parent method preservation for local overwritten methods
                                if(_this[method])
                                        _this['parent_' + method] = _this[method];
                                _this[method]=embedObj[method];
                        }
                        js_log('TYPEOF_ppause: ' + typeof _this['parent_pause']);
-
+                       
                        if(_this.inheritEmbedOverride){
                                _this.inheritEmbedOverride();
                        }
                        //update controls if possible
                        if(!_this.loading_external_data)
-                               _this.refreshControlsHTML();
-
-                       //js_log("READY TO PLAY:"+_this.id);
-                       _this.ready_to_play=true;
+                               _this.refreshControlsHTML();                                                                                            
+                       
+                       //js_log("READY TO PLAY:"+_this.id);                    
+                       _this.ready_to_play=true;                               
                        _this.getDuration();
                        _this.getHTML();
                });
@@ -1362,115 +985,111 @@ embedVideo.prototype = {
                if(this.selected_player.id != player.id){
                        this.selected_player = player;
                        this.inheritEmbedObj();
-               }
+               }                       
        },
-       doNativeWarningCheck:function(){
+       doNativeWarningCheck:function(){                        
                if( $j.cookie('dismissNativeWarn') && $j.cookie('dismissNativeWarn')===true){
                        return false;
-               }else{
-                       //see if we have native support for ogg:
-                       var supporting_players = embedTypes.players.getMIMETypePlayers( 'video/ogg' );
+               }else{                  
+                       //see if we have native support for ogg: 
+                       var supporting_players = embedTypes.players.getMIMETypePlayers( 'video/ogg' );          
                        for(var i=0; i < supporting_players.length; i++){
                                if(supporting_players[i].id == 'videoElement'){
                                        return false;
-                               }
-                       }
-                       //see if we are using mv_embed without a ogg source in which case no point in promoting firefox :P
+                               }                       
+                       }       
+                       //see if we are using mv_embed without a ogg source in which case no point in promoting firefox :P                      
                        if(this.media_element && this.media_element.sources){
                                var foundOgg = false;
                                var playable_sources = this.media_element.getPlayableSources();
-                               for(var sInx=0; sInx < playable_sources.length; sInx++){
+                               for(var sInx=0; sInx < playable_sources.length; sInx++){  
                                        var mime_type = playable_sources[sInx].mime_type;
-                                       if( mime_type=='video/ogg' ){
-                                               //they  have flash / h.264 fallback no need to push firefox :(
+                                       if( mime_type=='video/ogg' ){                                           
                                                foundOgg = true;
                                        }
                                }
-                               //no ogg no point in download firefox
+                               //no ogg src... no point in download firefox link
                                if(!foundOgg)
                                        return false;
-
+                                                                               
                        }
                }
-               return true;
+               return true;    
        },
        getTimeReq:function(){
-               var default_time_req = '0:00:00/' + seconds2npt(this.getDuration());
+               var et = (this.ctrlBuilder.long_time_disp)? '/' + seconds2npt( this.getDuration() ) : '';
+               var default_time_req = '0:00:00' + et;
                if(!this.media_element)
                        return default_time_req;
                if(!this.media_element.selected_source)
-                       return default_time_req;
+                       return default_time_req;                
                if(!this.media_element.selected_source.end_ntp)
-                       return default_time_req;
-               return this.media_element.selected_source.start_ntp+'/'+this.media_element.selected_source.end_ntp;
-       },
-       getDuration:function(){
-               //update some local pointers for the selected source:
-               if(this.media_element && this.media_element.selected_source && this.media_element.selected_source.duration){
-                       this.duration = this.media_element.selected_source.duration;
+                       return default_time_req;                
+               var et = (this.ctrlBuilder.long_time_disp) ?'/'+this.media_element.selected_source.end_ntp : '';
+               return this.media_element.selected_source.start_ntp + et;
+       },      
+       getDuration:function(){                                                 
+               //update some local pointers for the selected source:   
+               if(this.media_element && this.media_element.selected_source && this.media_element.selected_source.duration){                                                                     
+                       this.duration = this.media_element.selected_source.duration;                                            
                        this.start_offset = this.media_element.selected_source.start_offset;
                        this.start_ntp = this.media_element.selected_source.start_ntp;
-                       this.end_ntp = this.media_element.selected_source.end_ntp;
+                       this.end_ntp = this.media_element.selected_source.end_ntp;                                      
                }
-               //update start end_ntp if duration !=0 (set from plugin)
+               //update start end_ntp if duration !=0 (set from plugin) 
                if(!this.start_ntp)
                        this.start_ntp = '0:0:0';
                if(!this.end_ntp && this.duration)
-                       this.end_ntp = seconds2npt( this.duration );
+                       this.end_ntp = seconds2npt( this.duration );            
                //return the duration
                return this.duration;
        },
-       timedTextSources:function(){
-               if(!this.media_element.timedTextSources)
-                       return false;
-               return this.media_element.timedTextSources()
-       },
        /*
         * wrapEmebedContainer
         * wraps the embed code into a container to better support playlist function
         *  (where embed element is swapped for next clip
-        *  (where plugin method does not support playlsits)
+        *  (where plugin method does not support playlist) 
         */
        wrapEmebedContainer:function(embed_code){
                //check if parent clip is set( ie we are in a playlist so name the embed container by playlistID)
                var id = (this.pc!=null)?this.pc.pp.id:this.id;
-               return '<div id="mv_ebct_'+id+'" style="width:'+this.width+'px;height:'+this.height+'px;">' +
-                                       embed_code +
+               return '<div id="mv_ebct_'+id+'" style="width:'+this.width+'px;height:'+this.height+'px;">' + 
+                                       embed_code + 
                                '</div>';
-       },
+       },      
        getEmbedHTML : function(){
                //return this.wrapEmebedContainer( this.getEmbedObj() );
                return 'function getEmbedHTML should be overitten by embedLib ';
        },
        //do seek function (should be overwritten by implementing embedLibs)
-       // first check if seek can be done on locally downloaded content.
-       doSeek : function( perc ){
-               if( this.supportsURLTimeEncoding() ){
+       // to check if seek can be done on locally downloaded content. 
+       doSeek : function( perc ){              
+               if( this.supportsURLTimeEncoding() ){                   
                        //make sure this.seek_time_sec is up-to-date:
                        this.seek_time_sec = npt2seconds( this.start_ntp ) + parseFloat( perc * this.getDuration() );
                        js_log('updated seek_time_sec: ' + seconds2npt ( this.seek_time_sec) );
-                       this.stop();
+                       this.stop();                                    
                        this.didSeekJump=true;
                        //update the slider
-                       this.setSliderValue( perc );
-               }
-               //do play in 100ms (give things time to clear)
+                       this.setSliderValue( perc ); 
+               }               
+               //do play in 100ms (give things time to clear) 
                setTimeout('$j(\'#' + this.id + '\').get(0).play()',100);
        },
        /*
-        * seeks to the requested time and issues a callback when ready
+        * seeks to the requested time and issues a callback when ready 
         * (should be overwitten by client that supports frame serving)
-        */
+        */     
        setCurrentTime:function( time, callback){
-               js_log('error: base embed setCurrentTime can not frame serve (overide via plugin)');
+               js_log('error: base embed setCurrentTime can not frame serve (override via plugin)');
        },
        addPresTimeOffset:function(){
-          //add in the offset:
+          //add in the offset:         
           if(this.seek_time_sec && this.seek_time_sec!=0){
                        this.currentTime+=this.seek_time_sec;
-          }else if(this.start_offset && this.start_offset!=0){
-                  this.currentTime = parseFloat(this.currentTime) + parseFloat(this.start_offset);
-          }
+          }else if(this.start_offset && this.start_offset!=0){    
+                  this.currentTime = parseFloat(this.currentTime) + parseFloat(this.start_offset);                      
+          }               
        },
        doEmbedHTML:function()
        {
@@ -1480,90 +1099,180 @@ embedVideo.prototype = {
                this.closeDisplayedHTML();
 
 //             if(!this.selected_player){
-//                     return this.getPluginMissingHTML();
+//                     return this.getPluginMissingHTML();             
                //Set "loading" here
-               $j('#dc_'+_this.id).html(''+
-                       '<div style="color:black;width:'+this.width+'px;height:'+this.height+'px;">' +
-                               gM('loading_plugin') +
-                       '</div>'
+               $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
                this.selected_player.load(function()
                {
-                       js_log('performing embed for ' + _this.id);
-                       var embed_code = _this.getEmbedHTML();
+                       js_log('performing embed for ' + _this.id);                     
+                       var embed_code = _this.getEmbedHTML();                  
                        //js_log('shopuld embed:' + embed_code);
-                       $j('#dc_'+_this.id).html(embed_code);
+                       $j('#mv_embedded_player_'+_this.id).html(embed_code);   
                });
        },
+       mvVideoAudioSearch:function(){
+               var _this = this;                   
+               js_log('switch video Relational'  );            
+               var reqObj = {
+                       'action'        :       'query',                         
+                       'titles'        :       this.wikiTitleKey,
+                   'generator' :       'categories'
+               };                              
+               var req_categories= new Array();                                                
+           do_api_req({
+                       'data'  : reqObj, 
+                       'url'   : commons_api_url
+           },  function(data){ 
+                       req_categories = Array();
+                       if(data.query && data.query.pages){
+                               for(var pageid in  data.query.pages){
+                                       if(data.query.pages[pageid].title)
+                                               req_categories.push(data.query.pages[pageid].title);
+                               }
+                               _this.getRelatedFromCat( req_categories );                                              
+                       }else{
+                               _this.doThumbnailHTML();                        
+                       }
+               });             
+       },
+       getRelatedFromCat:function(catAry){
+               js_log('getRelatedFromCat');
+               var _this = this;
+               for ( var i= 0 ; i <= catAry.length ;i++ ){
+                       if(!catAry[i])
+                               continue;                                               
+                       var reqObj = {
+                               'action'        : 'query',                       
+                               'generator'     : 'categorymembers'  ,
+                               'gcmtitle'      : catAry[i],
+                               'prop'          : 'imageinfo',
+                               'iiprop'        : 'url',
+                               'iiurlwidth': '80'      
+                       };
+                       do_api_req({
+                               'data':reqObj, 
+                               'url': commons_api_url
+                       },  function(data){                         
+                           //empty the videos:                     
+                           $j('#dc_'+ _this.id + ' .related_vids ul').html(' ');
+                                                                  
+                                       for(var j in data.query.pages){         
+                                               //setup poster default:                                         
+                                               var local_poster ="http://upload.wikimedia.org/wikipedia/commons/7/79/Wiki-commons.png";
+                                               //make sure it exists: 
+                                               var page = data.query.pages[j];
+                                               if( j > 0 && page && page['imageinfo'] ){
+                                                       if(     page['imageinfo'][0].thumburl ){
+                                                               local_poster = page['imageinfo'][0].thumburl;
+                                                       }                                                       
+                                                       var descriptionurl = page['imageinfo'][0].descriptionurl;                                                               
+                                                       var title_str = page.title.replace( /File:|.ogv$|.oga$|.ogg$/gi, "" ); 
+                                                       //only link to other videos:                                                            
+                                                       if ( descriptionurl.match( /\.ogg$|\.ogv$|\.oga$/gi ) != null) {                
+                                                               var liout = '<li>' +
+                                                                               '<a href="' + descriptionurl + '" >' +
+                                                                                       '<img src="' + local_poster + '">' +
+                                                                               '</a>' +                                                                                
+                                                                                       ' <a title="' + title_str + '" target="_blank" ' +
+                                                                                               'href="'+ descriptionurl +'">' + title_str + '</a>' +                                                   
+                                                                       '</li>';                                                
+                                                               $j('#dc_'+ _this.id + ' .related_vids ul').append(liout) ;                                                              
+                                                       }
+                                                }
+                                       };                                      
+                               }); //end do_api_req
+               };
+       },
        onClipDone:function(){
                js_log('base:onClipDone');
-               //stop the clip (load the thumbnail etc)
+               //stop the clip (load the thumbnail etc) 
                this.stop();
                this.seek_time_sec = 0;
                this.setSliderValue(0);
                var _this = this;
-
-               //if the clip resolution is < 320 don't do fancy onClipDone stuff
+               
                if(this.width < 300){
                        return ;
                }
                this.onClipDone_disp=true;
                this.thumbnail_disp=true;
-               //make sure we are not in preview mode( no end clip actions in preview mode)
+               
+               //make sure we are not in preview mode( no end clip actions in preview mode) 
                if( this.preview_mode )
                        return ;
-
+                       
                $j('#img_thumb_'+this.id).css('zindex',1);
-               $j('#big_play_link_'+this.id).hide();
-               //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;'+
-                                       'height:'+ parseInt(parseInt(this.height)) +'px;'+
-                                       'position:absolute;top:10px;overflow:auto'+
-                                       'width: '+parseInt( ((parseInt(this.width)/2)-15) ) + 'px;'+
-                                       'left:'+ parseInt( ((parseInt(this.width)/2)+15) ) +'px;">'+
-                               '</div>' +
-                               '<div id="black_back_'+this.id+'" ' +
-                                       'style="z-index:-2;position:absolute;background:#000;' +
-                                       'top:0px;left:0px;width:'+parseInt(this.width)+'px;' +
-                                       'height:'+parseInt(this.height)+'px;">' +
-                               '</div>'
-                  );
+               $j('#'+ this.id + ' .play-btn-large').hide();
 
-               //start animation (make thumb small in upper left add in div for "loading"
-               $j('#img_thumb_'+this.id).animate({
+               //add black background
+               $j('#dc_'+this.id).append( '<div id="black_back_' + this.id + '" ' +
+                                       'style="z-index:-2;position:absolute;background:#000;' +
+                                       'top:0px;left:0px;width:' + parseInt( this.width ) + 'px;' +
+                                       'height:' + parseInt( this.height ) + 'px;">' +
+                               '</div>');      
+
+               if( this.wikiTitleKey){
+                       $j('#dc_'+this.id).append(
+                       '<div class="related_vids" >' +
+                          '<h1>' + gM('mwe-related_videos') + '</h1>'+
+                               '<ul>' +
+                               '</ul>' +
+                       '</div>');      
+                       $j('#img_thumb_' + this.id).fadeOut("fast");
+                       $j('#dc_'+ _this.id + ' .related_vids ul').html( gM('mwe-loading_txt') );
+                       this.mvVideoAudioSearch();
+               }else{          
+                       this.onClipDoneDisp();
+               }                                       
+       },
+       onClipDoneDisp:function(){
+               //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;'+                
+                               'height:'+ parseInt(parseInt(this.height)) +'px;'+
+                               'position:absolute;top:10px;overflow:auto'+                             
+                               'width: '+parseInt( ((parseInt(this.width)/2)-15) ) + 'px;'+
+                               'left:'+ parseInt( ((parseInt(this.width)/2)+15) ) +'px;">'+                                    
+                       '</div>'                                                                        
+          );
+          //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),
                                top:20,
                                left:10
                        },
-                       1000,
+                       1000, 
                        function(){
-                               //animation done.. add "loading" to div if empty
+                               //animation done.. add "loading" to div if empty                
                                if($j('#liks_info_'+_this.id).html()==''){
-                                       $j('#liks_info_'+_this.id).html(gM('loading_txt'));
-                               }
+                                       $j('#liks_info_'+_this.id).html(gM('mwe-loading_txt'));
+                               }               
                        }
-               )
+               )                                  
                //now load roe if run the showNextPrevLinks
                if(this.roe && this.media_element.addedROEData==false){
                        do_request(this.roe, function(data)
-                       {
+                       {                                                                                                                          
                                _this.media_element.addROE(data);
                                _this.getNextPrevLinks();
-                       });
+                       });     
                }else{
                        this.getNextPrevLinks();
-               }
+               }               
        },
-       //@@todo we should merge getNextPrevLinks with textInterface .. there is repeated code between them.
+       //@@todo we should merge getNextPrevLinks with textInterface .. there is repeated code between them. 
        getNextPrevLinks:function(){
                js_log('f:getNextPrevLinks');
                var anno_track_url = null;
-               var _this = this;
+               var _this = this; 
                //check for annoative track
-               $j.each(this.media_element.sources, function(inx, n){
+               $j.each(this.media_element.sources, function(inx, n){                   
                        if(n.mime_type=='text/cmml'){
                                if( n.id == 'Anno_en'){
                                        anno_track_url = n.src;
@@ -1575,28 +1284,28 @@ embedVideo.prototype = {
                        //zero out seconds (should improve cache hit rate and generally expands metadata search)
                        //@@todo this could be repalced with a regExp
                        var annoURL = parseUri(anno_track_url);
-                       var times = annoURL.queryKey['t'].split('/');
-                       var stime_parts = times[0].split(':');
-                       var etime_parts = times[1].split(':');
+                       var times = annoURL.queryKey['t'].split('/');                     
+                       var stime_parts = times[0].split(':');   
+                       var etime_parts = times[1].split(':');                                           
                        //zero out the hour:
                        var new_start = stime_parts[0]+':'+'0:0';
                        //zero out the end sec
                        var new_end   = (etime_parts[0]== stime_parts[0])? (etime_parts[0]+1)+':0:0' :etime_parts[0]+':0:0';
-
+                                        
                        var etime_parts = times[1].split(':');
-
+                       
                        var new_anno_track_url = annoURL.protocol +'://'+ annoURL.host + annoURL.path +'?';
                        $j.each(annoURL.queryKey, function(i, val){
                                new_anno_track_url +=(i=='t')?'t='+new_start+'/'+new_end +'&' :
                                                                                 i+'='+ val+'&';
                        });
                        var request_key = new_start+'/'+new_end;
-                       //check the anno_data cache:
-                       //@@todo search cache see if current is in range.
+                       //check the anno_data cache: 
+                       //@@todo search cache see if current is in range.  
                        if(this.anno_data_cache){
                                js_log('anno data found in cache: '+request_key);
                                this.showNextPrevLinks();
-                       }else{
+                       }else{                                                          
                                do_request(new_anno_track_url, function(cmml_data){
                                        js_log('raw response: '+ cmml_data);
                                        if(typeof cmml_data == 'string')
@@ -1607,8 +1316,8 @@ embedVideo.prototype = {
                                        }
                                        //init anno_data_cache
                                        if(!_this.anno_data_cache)
-                                               _this.anno_data_cache={};
-                                       //grab all metadata and put it into the anno_data_cache:
+                                               _this.anno_data_cache={};                                       
+                                       //grab all metadata and put it into the anno_data_cache:                                         
                                        $j.each(cmml_data.getElementsByTagName('clip'), function(inx, clip){
                                                _this.anno_data_cache[ $j(clip).attr("id") ]={
                                                                'start_time_sec':npt2seconds($j(clip).attr("start").replace('npt:','')),
@@ -1617,32 +1326,33 @@ embedVideo.prototype = {
                                                        };
                                                //grab all its meta
                                                _this.anno_data_cache[ $j(clip).attr("id") ]['meta']={};
-                                               $j.each(clip.getElementsByTagName('meta'),function(imx, meta){
+                                               $j.each(clip.getElementsByTagName('meta'),function(imx, meta){                                                  
                                                        //js_log('adding meta: '+ $j(meta).attr("name")+ ' = '+ $j(meta).attr("content"));
                                                        _this.anno_data_cache[$j(clip).attr("id")]['meta'][$j(meta).attr("name")]=$j(meta).attr("content");
                                                });
                                        });
-                                       _this.showNextPrevLinks();
+                                       _this.showNextPrevLinks();                                      
                                });
                        }
                }else{
                        js_log('no annotative track found');
-                       $j('#liks_info_'+this.id).html('no metadata found for related links');
+                       //$j('#liks_info_'+this.id).html('no metadata found for related links');
+                       _this.doThumbnailHTML();
                }
-               //query current request time +|- 60s to get prev next speech links.
+               //query current request time +|- 60s to get prev next speech links. 
        },
        showNextPrevLinks:function(){
                //js_log('f:showNextPrevLinks');
-               //int requested links:
+               //int requested links: 
                var link = {
                        'prev':'',
                        'current':'',
                        'next':''
-               }
+               }               
                var curTime = this.getTimeReq().split('/');
-
+               
                var s_sec = npt2seconds(curTime[0]);
-               var e_sec = npt2seconds(curTime[1]);
+               var e_sec = npt2seconds(curTime[1]); 
                js_log('showNextPrevLinks: req time: '+ s_sec + ' to ' + e_sec);
                //now we have all the data in anno_data_cache
                var current_done=false;
@@ -1654,52 +1364,52 @@ embedVideo.prototype = {
                                link.prev = clip_id;
                                js_log('showNextPrevLinks: ' + s_sec + ' < ' + clip.end_time_sec + ' set prev');
                        }
-
+                               
                        if(e_sec==clip.end_time_sec && s_sec== clip.start_time_sec)
                                current_done = true;
                        //current clip is not done:
                        if(  e_sec < clip.end_time_sec  && link.current=='' && !current_done){
                                link.current = clip_id;
-                               js_log('showNextPrevLinks: ' + e_sec + ' < ' + clip.end_time_sec + ' set current');
+                               js_log('showNextPrevLinks: ' + e_sec + ' < ' + clip.end_time_sec + ' set current'); 
                        }
-
+                       
                        //set end clip (first clip where start time is > end_time of req
                        if( e_sec <  clip.start_time_sec && link.next==''){
                                link.next = clip_id;
                                js_log('showNextPrevLinks: '+  e_sec + ' < '+ clip.start_time_sec + ' && ' + link.next );
                        }
-               }
-               var html='';
+               }   
+               var html='';   
                if(link.prev=='' && link.current=='' && link.next==''){
                        html='<p><a href="'+this.media_element.linkbackgetMsg+'">clip page</a>';
-               }else{
+               }else{          
                        for(var link_type in link){
-                               var link_id = link[link_type];
+                               var link_id = link[link_type];                  
                                if(link_id!=''){
-                                       var clip = this.anno_data_cache[link_id];
+                                       var clip = this.anno_data_cache[link_id];                               
                                        var title_msg='';
                                        for(var j in clip['meta']){
                                                title_msg+=j.replace(/_/g,' ') +': ' +clip['meta'][j].replace(/_/g,' ') +" <br>";
-                                       }
+                                       }               
                                        var time_req =   clip.time_req;
-                                       if(link_type=='current') //if current start from end of current clip play to end of current meta:
+                                       if(link_type=='current') //if current start from end of current clip play to end of current meta:                                
                                                time_req = curTime[1]+ '/' + seconds2npt( clip.end_time_sec );
-
-                                       //do special linkbacks for metavid content:
-                                       var regTimeCheck = new RegExp(/[0-9]+:[0-9]+:[0-9]+\/[0-9]+:[0-9]+:[0-9]+/);
+                                       
+                                       //do special linkbacks for metavid content: 
+                                       var regTimeCheck = new RegExp(/[0-9]+:[0-9]+:[0-9]+\/[0-9]+:[0-9]+:[0-9]+/);                            
                                        html+='<p><a  ';
                                        if( regTimeCheck.test( this.media_element.linkback ) ){
-                                               html+=' href="'+ this.media_element.linkback.replace(regTimeCheck,time_req) +'" ';
+                                               html+=' href="'+ this.media_element.linkback.replace(regTimeCheck,time_req) +'" '; 
                                        }else{
-                                               html+=' href="#" onClick="$j(\'#'+this.id+'\').get(0).playByTimeReq(\''+
-                                                               time_req + '\'); return false; "';
+                                               html+=' href="#" onClick="$j(\'#'+this.id+'\').get(0).playByTimeReq(\''+ 
+                                                               time_req + '\'); return false; "';                              
                                        }
-                                       html+=' title="' + title_msg + '">' +
-                                                gM(link_type+'_clip_msg') +
+                                       html+=' title="' + title_msg + '">' + 
+                                                gM('mwe-' + link_type+'_clip_msg') +                             
                                        '</a><br><span style="font-size:small">'+ title_msg +'<span></p>';
-                               }
+                               }                                                       
                        }
-               }
+               }       
                //js_og("should set html:"+ html);
                $j('#liks_info_'+this.id).html(html);
        },
@@ -1707,56 +1417,66 @@ embedVideo.prototype = {
                js_log('f:playByTimeReq: '+time_req );
                this.stop();
                this.updateVideoTimeReq(time_req);
-               this.play();
+               this.play();            
        },
        doThumbnailHTML:function()
-       {
+       {         
                var _this = this;
-               js_log('f:doThumbnailHTML'+ this.thumbnail_disp);
-               this.closeDisplayedHTML();
-               $j( '#dc_' + this.id ).html( this.getThumbnailHTML() );
-               this.paused = true;
+               js_log('f:doThumbnailHTML'+ this.thumbnail_disp);               
+               this.closeDisplayedHTML();         
+               $j( '#mv_embedded_player_' + this.id ).html( this.getThumbnailHTML() );
+               this.paused = true;             
                this.thumbnail_disp = true;
+               //make sure the ctrlBuilder remain active: 
+               this.ctrlBuilder.addControlHooks();     
        },
        refreshControlsHTML:function(){
-               js_log('refreshing controls HTML');
-               if($j('#mv_embedded_controls_'+this.id).length==0)
+               js_log('refreshControlsHTML::');
+               if($j('#' + this.id + ' .control-bar').length == 0)
                {
-                       js_log('#mv_embedded_controls_'+this.id + ' not present, returning');
-                       return;
+                       js_log('control-bar not present, returning');
+                       return ;
                }else{
-                       $j('#mv_embedded_controls_'+this.id).html( this.getControlsHTML() );
-                       ctrlBuilder.addControlHooks(this);
-               }
-       },
+                       $j('#' + this.id + ' .control-bar').html( this.getControlsHTML() );
+                       this.ctrlBuilder.addControlHooks();                                             
+               }               
+       },   
        getControlsHTML:function()
-       {
-               return ctrlBuilder.getControls( this );
-       },
-       getHTML : function (){
-               js_log('f:getHTML : ' + this.id );
-               var _this = this;
-               var html_code = '';
-
-               //get the thumbnail:
-               html_code = this.getThumbnailHTML();
-
-               if(this.controls){
+       {                       
+               return this.ctrlBuilder.getControls( this );
+       },      
+       getHTML : function (){          
+               //@@todo check if we have sources available     
+               js_log('embedVideo:getHTML : ' + this.id  + ' resource type: ' + this.type);
+               
+               //set-up the local ctrlBuilder instance: 
+               this.ctrlBuilder = new ctrlBuilder( this );
+                                               
+               var _this = this;                                
+               var html_code = '';             
+               html_code = '<div id="videoPlayer_' + this.id + '" style="width:' + this.width + 'px;position:relative;"'+ 
+                                               'class="' + this.ctrlBuilder.pClass + '">';             
+               html_code += '<div style="width:'+parseInt(this.width)+'px;height:'+parseInt(this.height)+'px;"  id="mv_embedded_player_'+this.id+'">' +
+                                               this.getThumbnailHTML() + 
+                                       '</div>';                                                                       
+               //js_log("mvEmbed:controls "+ typeof this.controls);                                                                    
+               if( this.controls )
+               {               
                        js_log("f:getHTML:AddControls");
-                       html_code +='<div class="k-control-bar ui-widget-header ui-helper-clearfix">';
-                       html_code += this.getControlsHTML();
-                       html_code +='</div>';
-                       //block out some space by encapulating the top level div
+                       html_code +='<div class="ui-state-default ui-widget-header ui-helper-clearfix control-bar" >';
+                       html_code += this.getControlsHTML();       
+                       html_code +='</div>';                           
+                       //block out some space by encapulating the top level div 
                        $j(this).wrap('<div style="width:'+parseInt(this.width)+'px;height:'
-                                       + (parseInt(this.height) + ctrlBuilder.height )+'px" id="k-player_' + this.id + '" class="k-player"></div>');
+                                       +( parseInt(this.height) + this.ctrlBuilder.height )+'px"></div>');                                                             
                }
-
+               html_code += '</div>'; //videoPlayer div close          
                //js_log('should set: '+this.id);
-               $j(this).html( html_code );
+               $j(this).html( html_code );                                     
                //add hooks once Controls are in DOM
-               ctrlBuilder.addControlHooks(this);
-
-               //js_log('set this to: ' + $j(this).html() );
+               this.ctrlBuilder.addControlHooks();             
+                                                 
+               //js_log('set this to: ' + $j(this).html() );   
                //alert('stop');
                //if auto play==true directly embed the plugin
                if(this.autoplay)
@@ -1776,7 +1496,7 @@ embedVideo.prototype = {
                }else{
                  if(!missing_type)
                        missing_type='';
-                 out+= gM('mv_generic_missing_plugin', missing_type) + ' or <a title="'+gM('download_clip')+'" href="'+this.src +'">'+gM('download_clip')+'</a>';
+                 out+= gM('mwe-generic_missing_plugin', missing_type) + ' or <a title="'+gM('mwe-download_clip')+'" href="'+this.src +'">'+gM('mwe-download_clip')+'</a>';
                }
                return out + '</div>';
        },
@@ -1786,7 +1506,7 @@ embedVideo.prototype = {
                this.updateVideoTime(time_parts[0], time_parts[1]);
        },
        //update video time
-       updateVideoTime:function(start_ntp, end_ntp){
+       updateVideoTime:function(start_ntp, end_ntp){                                   
                //update media
                this.media_element.updateSourceTimes( start_ntp, end_ntp );
                //update mv_time
@@ -1798,11 +1518,11 @@ embedVideo.prototype = {
                        this.seek_time_sec=0;
                else
                        this.seek_time_sec=npt2seconds(start_ntp);
-       },
-       //@@todo overwite by embed library if we can render frames natavily
+       },              
+       //@@todo overwite by embed library if we can render frames natavily 
        renderTimelineThumbnail:function( options ){
                var my_thumb_src = this.media_element.getThumbnailURL();
-               //check if our thumbnail has a time attribute:
+               //check if our thumbnail has a time attribute: 
                if( my_thumb_src.indexOf('t=') !== -1){
                        var time_ntp =  seconds2npt ( options.time + parseInt(this.start_offset) );
                        my_thumb_src = getURLParamReplace( my_thumb_src, { 't':time_ntp, 'size': options.size } );
@@ -1810,7 +1530,7 @@ embedVideo.prototype = {
                var thumb_class = (typeof options['thumb_class'] != 'undefined' ) ? options['thumb_class'] : '';
                return '<div class="ui-corner-all ' + thumb_class + '" src="' + my_thumb_src + '" '+
                                'style="height:' + options.height + 'px;' +
-                               'width:' + options.width + 'px" >' +
+                               'width:' + options.width + 'px" >' + 
                                         '<img src="' + my_thumb_src +'" '+
                                                'style="height:' + options.height + 'px;' +
                                                'width:' + options.width + 'px">' +
@@ -1821,58 +1541,58 @@ embedVideo.prototype = {
        },
        updateThumbTime:function( float_sec ){
                //js_log('updateThumbTime:'+float_sec);
-               var _this = this;
-               if( typeof this.org_thum_src=='undefined' ){
+               var _this = this;                                                                                                          
+               if( typeof this.org_thum_src=='undefined' ){            
                        this.org_thum_src = this.media_element.getThumbnailURL();
-               }
+               }                                                       
                if( this.org_thum_src.indexOf('t=') !== -1){
-                       this.last_thumb_url = getURLParamReplace(this.org_thum_src,
-                               { 't' : seconds2npt( float_sec + parseInt(this.start_offset)) } );
-                       if(!this.thumbnail_updating){
+                       this.last_thumb_url = getURLParamReplace(this.org_thum_src, 
+                               { 't' : seconds2npt( float_sec + parseInt(this.start_offset)) } );                                                                      
+                       if(!this.thumbnail_updating){                           
                                this.updateThumbnail(this.last_thumb_url ,false);
                                this.last_thumb_url =null;
                        }
                }
        },
        //for now provide a src url .. but need to figure out how to copy frames from video for plug-in based thumbs
-       updateThumbPerc:function( perc ){
+       updateThumbPerc:function( perc ){       
                return this.updateThumbTime( (this.getDuration() * perc) );
        },
        //updates the thumbnail if the thumbnail is being displayed
-       updateThumbnail : function(src, quick_switch){
-               //make sure we don't go to the same url if we are not already updating:
+       updateThumbnail : function(src, quick_switch){                          
+               //make sure we don't go to the same url if we are not already updating: 
                if( !this.thumbnail_updating && $j('#img_thumb_'+this.id).attr('src')== src )
                        return false;
-               //if we are already updating don't issue a new update:
+               //if we are already updating don't issue a new update: 
                if( this.thumbnail_updating && $j('#new_img_thumb_'+this.id).attr('src')== src )
                        return false;
-
+               
                js_log('update thumb: ' + src);
-
+               
                if(quick_switch){
                        $j('#img_thumb_'+this.id).attr('src', src);
                }else{
-                       var _this = this;
+                       var _this = this;                       
                        //if still animating remove new_img_thumb_
                        if(this.thumbnail_updating==true)
-                               $j('#new_img_thumb_'+this.id).stop().remove();
-
+                               $j('#new_img_thumb_'+this.id).stop().remove();          
+                                       
                        if(this.thumbnail_disp){
                                js_log('set to thumb:'+ src);
                                this.thumbnail_updating=true;
                                $j('#dc_'+this.id).append('<img src="'+src+'" ' +
                                        'style="display:none;position:absolute;zindex:2;top:0px;left:0px;" ' +
                                        'width="'+this.width+'" height="'+this.height+'" '+
-                                       'id = "new_img_thumb_'+this.id+'" />');
-                               //js_log('appended: new_img_thumb_');
-                               $j('#new_img_thumb_'+this.id).fadeIn("slow", function(){
+                                       'id = "new_img_thumb_'+this.id+'" />');                                         
+                               //js_log('appended: new_img_thumb_');           
+                               $j('#new_img_thumb_'+this.id).fadeIn("slow", function(){                                                
                                                //once faded in remove org and rename new:
                                                $j('#img_thumb_'+_this.id).remove();
                                                $j('#new_img_thumb_'+_this.id).attr('id', 'img_thumb_'+_this.id);
                                                $j('#img_thumb_'+_this.id).css('zindex','1');
-                                               _this.thumbnail_updating=false;
+                                               _this.thumbnail_updating=false;                                         
                                                //js_log("done fadding in "+ $j('#img_thumb_'+_this.id).attr("src"));
-
+                                               
                                                //if we have a thumb queued update to that
                                                if(_this.last_thumb_url){
                                                        var src_url =_this.last_thumb_url;
@@ -1889,7 +1609,7 @@ embedVideo.prototype = {
                download, and embed code.
        */
        getThumbnailHTML : function ()
-       {
+       {               
                js_log('embedVideo:getThumbnailHTML::' + this.id);
                var thumb_html = '';
                var class_atr='';
@@ -1900,16 +1620,15 @@ embedVideo.prototype = {
                this.thumbnail = this.media_element.getThumbnailURL();
 
                //put it all in the div container dc_id
-               thumb_html+= '<div id="dc_'+this.id+'" rel="emdded_play" style="position:relative;'+
+               thumb_html+= '<div id="dc_'+this.id+'" style="position:absolute;'+
                        ' overflow:hidden; top:0px; left:0px; width:'+this.playerPixelWidth()+'px; height:'+this.playerPixelHeight()+'px; z-index:0;">'+
-                       '<img width="' + this.playerPixelWidth() + '" height="' + this.playerPixelHeight() +
-                       '" style="position:relative;width:'+this.playerPixelWidth()+';height:'+this.playerPixelHeight()+'"' +
-                       ' id="img_thumb_' + this.id+'" src="' + this.thumbnail + '">';
-
-               if( this.play_button == true && this.controls == true )
-                         thumb_html+=this.getPlayButton();
-
-               thumb_html+='</div>';
+                       '<img width="'+this.playerPixelWidth()+'" height="'+this.playerPixelHeight()+'" style="position:relative;width:'+this.playerPixelWidth()+';height:'+this.playerPixelHeight()+'"' +
+                       ' id="img_thumb_'+this.id+'" src="' + this.thumbnail + '">';
+               
+               if(this.play_button == true && this.controls == true)
+                         thumb_html+= this.ctrlBuilder.getComponent( 'play-btn-large' );
+                         
+                  thumb_html+='</div>';
                return thumb_html;
        },
        getEmbeddingHTML:function()
@@ -1941,98 +1660,94 @@ embedVideo.prototype = {
        doOptionsHTML:function()
        {
                var sel_id = (this.pc!=null)?this.pc.pp.id:this.id;
-               var pos = $j('#options_button_'+sel_id).offset();
+               var pos = $j('#'+sel_id + ' .options-btn').offset();
                pos['top']=pos['top']+24;
                pos['left']=pos['left']-124;
                //js_log('pos of options button: t:'+pos['top']+' l:'+ pos['left']);
                $j('#mv_vid_options_'+sel_id).css(pos).toggle();
                return;
-       },
-       getPlayButton:function(id){
-               if(!id)id=this.id;
-               return '<div title="' + gM('play_clip') + '" class="ui-state-default play-btn-large" '+
-                       'style="left:'+((this.playerPixelWidth()-130)/2)+'px;'+
-                       'top:' + ((this.playerPixelHeight()-96)/2) + 'px;">'+
-                       '</div>';
-       },
+       },      
        doLinkBack:function(){
                if(this.roe && this.media_element.addedROEData==false){
                        var _this = this;
-                       this.displayHTML(gM('loading_txt'));
+                       this.displayHTML( gM('mwe-loading_txt') );
                        do_request(this.roe, function(data)
                           {
-                                 _this.media_element.addROE(data);
+                                 _this.media_element.addROE(data);                                                      
                                  _this.doLinkBack();
-                          });
+                          });                     
                }else{
-                       if(this.media_element.linkback){
+                       if( this.linkback){
+                               window.location = this.linkback;
+                       }else if(this.media_element.linkback){                  
                                window.location = this.media_element.linkback;
                        }else{
-                               this.displayHTML(gM('could_not_find_linkback'));
+                               this.displayHTML( gM('mwe-could_not_find_linkback') );
                        }
-               }
+               }          
        },
-       showCredits: function($target){
-               $target.html('credits page goes here'); 
-       },
-       //display the code to remotely embed this video:
        showShare:function($target){    
                var     embed_code = this.getEmbeddingHTML();
                var o = '';
-               if(this.linkback){
-                       o+='<a class="email" href="'+this.linkback+'">Share Clip via Link</a> '+
-                       '<p>or</p> ';
-               }
-               o+='<span style="color:#FFF;font-size:14px;">Embed Clip in Blog or Site</span><br>'+
-                               '<span style="color:#FFF;font-size:12px;"><a style="color:red" href="http://metavid.org/wiki/Security_Notes_on_Remote_Embedding">'+
-                                       'Read This</a> before embeding.</span>'+
-                               '<div class="embed_code"> '+
-                                       '<textarea onClick="this.select();" id="embedding_user_html_' + this.id + '" name="embed">' +
-                                               embed_code+
-                                       '</textarea> '+
-                                       '<button onClick="$j(\'#' + this.id + '\').get(0).copyText(); return false;" class="copy_to_clipboard">Copy to Clipboard</button> '+
-                               '</div>';                       
-               js_log("should set share: " + o);
-               $target.html(o);                
-       },
-       copyText:function(){
-         $j('#embedding_user_html_'+this.id).focus().select();
-         if(document.selection){
-                 CopiedTxt = document.selection.createRange();
-                 CopiedTxt.execCommand("Copy");
-         }
-       },
-       showTextInterface:function(){
                var _this = this;
-               //display the text container with loading text:
+        //@todo: hook events to two a's for swapping in and out code for link vs. embed;
+        //       hook events for changing active class of li based on a.
+               o+= '<h2>' + gM('mwe-share_this_video') + '</h2>\n' +
+                       ' <ul>\n' +
+                       '  <li><a href="#" class="active">'+gM('mwe-embed_site_or_blog')+'</a></li>\n';
+               if(this.linkback) {
+                       o+=   '  <li><a href="#" id="k-share-link">' + this.linkback + '</a></li>\n';
+        }
+               o+=     '</ul>' +
+                       '<div class="source_wrap"><textarea>' + embed_code + '</textarea></div>' +
+                               '<button class="ui-state-default ui-corner-all copycode">' + gM('mwe-copy-code') + '</button>' +
+                               '<div class="ui-state-highlight ui-corner-all">' + gM('mwe-read_before_embed') + '</div>' +
+                       '</div>'
+               $target.html(o); 
+               $cpBtn = $j( '#' + this.id + ' .copycode');
+               $cpTxt = $j( '#' + this.id + ' .source_wrap textarea');
+               
+               $cpTxt.click(function(){
+                       $j(this).get(0).select();
+               });
+               
+               //add copy binding: 
+               $cpBtn.click(function(){                                                
+                       $cpTxt.focus().get(0).select();                 
+                       if(document.selection){   
+                               CopiedTxt = document.selection.createRange();   
+                               CopiedTxt.execCommand("Copy");
+                       }
+               });
+       },
+       showTextInterface:function(){   
+               var _this = this;
+               //display the text container with loading text: 
                //@@todo support position config
-               var loc = $j(this).position();
+               var loc = $j(this).position();                  
                if($j('#metaBox_'+this.id).length==0){
+                       var theight =  (parseInt( this.height ) < 200) ? 200 : parseInt( this.height );
                        $j(this).after('<div class="ui-widget ui-widget-content ui-corner-all" style="position:absolute;z-index:10;'+
                                                'top:' + (loc.top) + 'px;' +
-                                               'left:' + (parseInt( loc.left ) + parseInt(this.width) + 10 )+'px;' +
-                                               'height:'+ parseInt( this.height )+'px;width:400px;' +
+                                               'left:' + (parseInt( loc.left ) + parseInt(this.width) + 10 ) + 'px;' +
+                                               'height:' + theight + 'px;width:400px;' +                                               
                                                'display:none;" ' +
                                                'id="metaBox_' + this.id + '">'+
-                                                       gM('loading_txt') +
-                                               '</div>');
+                                                       mv_get_loading_img() +
+                                               '</div>');                                      
                }
                //fade in the text display
-               $j('#metaBox_'+this.id).fadeIn("fast");
+               $j('#metaBox_'+this.id).fadeIn("fast"); 
                //check if textObj present:
                if(typeof this.textInterface == 'undefined' ){
                        //load the default text interface:
                        mvJsLoader.doLoad([
-                                       'mvTextInterface',
+                                       'mvTextInterface', 
                                        '$j.fn.hoverIntent'
-                               ], function(){
-                                       _this.textInterface = new mvTextInterface( _this );
+                               ], function(){                                  
+                                       _this.textInterface = new mvTextInterface( _this );                                                     
                                        //show interface
-                                       _this.textInterface.show();
-                                       js_log("NEW TEXT INTERFACE");
-                                       for(var i in _this.textInterface.availableTracks){
-                                               js_log("tracks in new interface: "+_this.id+ ' tid:' + i);
-                                       }
+                                       _this.textInterface.show();                                     
                                }
                        );
                }else{
@@ -2048,26 +1763,26 @@ embedVideo.prototype = {
        },
        /** Generic function to display custom HTML inside the mv_embed element.
                The code should call the closeDisplayedHTML function to close the
-               display of the custom HTML and restore the regular mv_embed display.
+               display of the custom HTML and restore the regular mv_embed display.            
                @param {String} HTML code for the selection list.
        */
        displayHTML:function(html_code)
        {
                var sel_id = (this.pc!=null)?this.pc.pp.id:this.id;
-
+               
                if(!this.supports['overlays'])
                        this.stop();
-
+               
                //put select list on-top
                //make sure the parent is relatively positioned:
                $j('#'+sel_id).css('position', 'relative');
                //set height width (check for playlist container)
                var width = (this.pc)?this.pc.pp.width:this.playerPixelWidth();
                var height = (this.pc)?this.pc.pp.height:this.playerPixelHeight();
-
+               
                if(this.pc)
                        height+=(this.pc.pp.pl_layout.title_bar_height + this.pc.pp.pl_layout.control_height);
-
+         
                var fade_in = true;
                if($j('#blackbg_'+sel_id).length!=0)
                {
@@ -2079,11 +1794,11 @@ embedVideo.prototype = {
                         'style="height:'+parseInt(height)+'px;width:'+parseInt(width)+'px;">'+
                          '<div class="videoOptionsComplete">'+
                        //@@TODO: this style should go to .css
-                       '<span style="float:right;margin-right:10px">' +
+                       '<span style="float:right;margin-right:10px">' +                        
                                        '<a href="#" style="color:white;" onClick="$j(\'#'+sel_id+'\').get(0).closeDisplayedHTML();return false;">close</a>' +
                        '</span>'+
                        '<div id="mv_disp_inner_'+sel_id+'" style="padding-top:10px;">'+
-                                html_code
+                                html_code 
                           +'</div>'+
                           '</div></div>';
                $j('#'+sel_id).prepend(div_code);
@@ -2103,14 +1818,12 @@ embedVideo.prototype = {
                 });
                 return false; //onclick action return false
        },
-       showPlayerselect:function( target ){
+       showPlayerselect:function( $target ){
                //get id (in case where we have a parent container)
                var this_id = (this.pc!=null)?this.pc.pp.id:this.id;
-
                var _this=this;
-//             var out= '<span style="color:#FFF;background-color:black;"><blockquote style="background-color:black;">';
-               var out= '';
-               out+='<h2>' + gM('chose_player') + '</h2>';
+               var o= '';
+               o+='<h2>' + gM('mwe-chose_player') + '</h2>';
                var _this=this;
                //js_log('selected src'+ _this.media_element.selected_source.url);
                $j.each( this.media_element.getPlayableSources(), function(source_id, source){
@@ -2119,48 +1832,33 @@ embedVideo.prototype = {
                        var is_selected = (source == _this.media_element.selected_source);
                        var image_src =  mv_skin_img_path ;
 
-                       //set the Playable source type:
-                       if( source.mime_type == 'video/x-flv' ){
-                               image_src += 'flash_icon_';
-                       }else if( source.mime_type == 'video/h264'){
-                               //for now all mp4 content is pulled from archive.org (so use archive.org icon)
-                               image_src += 'archive_org_';
-                       }else{
-                               image_src += 'fish_xiph_org_';
-                       }
-                       image_src += is_selected ? 'color':'bw';
-                       image_src += '.png';
-
-                       if (default_player)
-                       {
-                               out+=' <ul>';
+                       if (default_player){
+                               o+='<ul>';
                                //output the player select code:
                                var supporting_players = embedTypes.players.getMIMETypePlayers( source.getMIMEType() );
 
                                for(var i=0; i < supporting_players.length ; i++){
                                        if( _this.selected_player.id == supporting_players[i].id && is_selected ){
-                                               out+='<li>' + supporting_players[i].getName() +'</li>';
-                                       }else{
-                                               //else gray plugin and the plugin with link to select
-//                                             out+='<li style="margin-left:20px;">'+
-//                                                             '<a href="#" class="sel_source" id="sc_' + source_id + '_' + supporting_players[i].id +'">'+
-//                                                                     '<img border="0" width="16" height="16" src="' + mv_skin_img_path + 'plugin_disabled.png">'+
-//                                                                     supporting_players[i].getName() +
-//                                                             '</a>'+
-                        out+='<li>' +
-                             '<a href="#" id="dc_' + source_id + '_' + supporting_players[i].id +'">' +
-                             supporting_players[i].getName() + '</a><li>';
+                                               o+='<li>' +
+                                                       '<a href="#" class="active" rel="sel_source" id="sc_' + source_id + '_' + supporting_players[i].id +'">' +
+                                                               supporting_players[i].getName() +
+                                                       '</li>';
+                                       }else{                                  
+                                       o+='<li>' +
+                                                '<a href="#" rel="sel_source" id="sc_' + source_id + '_' + supporting_players[i].id +'">' +
+                                               supporting_players[i].getName() + '</a>' +
+                                               '</li>';
                                        }
                                 }
-                                out+='</ul></div>';
-                       }else
-                               out+= source.getTitle() + ' - no player available';
+                                o+='</ul>';
+                       }else{
+                               o+= source.getTitle() + ' - no player available';
+                       }
                });
-//             out+='</blockquote></span>';
-               $j(target).html(out);
+               $target.html(o);
 
                //set up the click bindings:
-               $j('.sel_source').each(function(){
+               $target.find("[rel='sel_source']").each(function(){
                        $j(this).click(function(){
                                var iparts = $j(this).attr( 'id' ).replace(/sc_/,'').split('_');
                                var source_id = iparts[0];
@@ -2180,9 +1878,33 @@ embedVideo.prototype = {
                                return false;
                        });
                });
-       },
+       },      
        showDownload:function( $target ){
+               var _this = this;
                //load the roe if available (to populate out download options:
+               function getShowVideoDownload(){
+                               var out='<div style="color:white">';                                    
+                       var dl_list='';
+                       var dl_txt_list='';             
+                       $j.each(_this.media_element.getSources(), function(index, source){
+                               var dl_line = '<li>' + '<a style="color:white" href="' + source.getURI() +'"> '
+                                       + source.getTitle()+'</a> '+ '</li>'+"\n";                      
+                               if(      source.getURI().indexOf('?t=')!==-1){
+                                       out+=dl_line;
+                               }else if( this.getMIMEType()=="text/cmml" || this.getMIMEType()=="text/x-srt" ){
+                                       dl_txt_list+=dl_line;
+                               }else{
+                                       dl_list+=dl_line;
+                               }
+                       });             
+                       
+                       if(dl_list!='')
+                               out+=gM('mwe-download_full') + '<blockquote style="background:#000">' + dl_list + '</blockquote>';
+                       if(dl_txt_list!='')
+                               out+=gM('mwe-download_text') + '<blockquote style="background:#000">' + dl_txt_list +'</blockquote>';
+                       out+='</div>';
+                       return out;
+               }
                //js_log('f:showDownload '+ this.roe + ' ' + this.media_element.addedROEData);
                if(this.roe && this.media_element.addedROEData == false){
                        var _this = this;
@@ -2190,48 +1912,26 @@ embedVideo.prototype = {
                        do_request(this.roe, function(data)
                        {
                           _this.media_element.addROE(data);
-                          $target.html( _this.getShowVideoDownload() );
+                          $target.html( getShowVideoDownload() );
                        });
                }else{
-                       $target.html( this.getShowVideoDownload() );
+                       $target.html( getShowVideoDownload() );
                }
-       },
-       getShowVideoDownload:function(){        
-               var dl_txt_list = dl_list = '';
-               $j.each(this.media_element.getSources(), function(index, source){
-                       var dl_line = '<li>' + '<a href="' + source.getURI() +'"> ' + source.getTitle() + '</a></li>\n';                        
-                       if(this.getMIMEType()=="text/cmml" || this.getMIMEType()=="text/x-srt") {
-                   dl_txt_list += dl_line;
-                       }else {
-                               dl_list += dl_line;
-                       }
-               });
-               var o='<h2>' + gM('download_clip') + '</h2>'+
-                '<ul>' +
-                       dl_list +                 
-                               '</ul>';
-                               
-               //add text links:               
-               if(dl_txt_list != '')
-                       o+='<h2>' + gM('download_text') + '</h2>' + 
-                               '<ul>' +
-                       dl_txt_list +                 
-                               '</ul>';
-                                       
-               o+='</div>';
-               return o;
+       },      
+       showCredits:function( $target ){
+               $target.html('<h2>' + gM('mwe-credits') + '</h2>');
        },
        /*
        *  base embed controls
        *       the play button calls
        */
        play:function(){
-               var this_id = (this.pc!=null)?this.pc.pp.id:this.id;
-
-               //js_log( "mv_embed play:" + this.id);
+               var eid = (this.pc!=null)?this.pc.pp.id:this.id;
+                               
+               //js_log( "mv_embed play:" + this.id);          
                //js_log('thum disp:'+this.thumbnail_disp);
                //check if thumbnail is being displayed and embed html
-               if( this.thumbnail_disp ){
+               if( this.thumbnail_disp ){                      
                        if( !this.selected_player ){
                                js_log('no selected_player');
                                //this.innerHTML = this.getPluginMissingHTML();
@@ -2239,63 +1939,63 @@ embedVideo.prototype = {
                                $j('#'+this.id).html( this.getPluginMissingHTML() );
                        }else{
                                this.doEmbedHTML();
-                               this.onClipDone_disp=false;
-                               this.paused=false;
-                               this.thumbnail_disp=false;
+                               this.onClipDone_disp=false;                        
+                               this.paused=false;         
+                               this.thumbnail_disp=false;               
                        }
                }else{
-                       //the plugin is already being displayed
+                       //the plugin is already being displayed                 
                        this.paused=false; //make sure we are not "paused"
                        this.seeking=false;
-               }
-
-               $j('#'+ this_id + ' .play-btn .ui-icon').removeClass('ui-icon-play').addClass('ui-icon-pause');
-               $j('#'+ this_id + ' .play-btn').unbind().btnBind().click(function(){
-                       $j('#' + this_id ).get(0).pause();
-               }).attr('title', gM('pause_clip'));
-
+               }                               
+               
+                $j('#' + eid + ' .play-btn span').removeClass('ui-icon-play').addClass('ui-icon-pause');                          
+                $j('#' + eid + ' .play-btn').unbind().btnBind().click(function(){                                      
+                       $j('#' + eid ).get(0).pause();
+                }).attr('title', gM('mwe-pause_clip'));
+                  
        },
        load:function(){
-               //should be done by child (no base way to load assets)
+               //should be done by child (no base way to pre-buffer video)
                js_log('baseEmbed:load call');
        },
        getSrc:function(){
           return this.media_element.selected_source.getURI( this.seek_time_sec );
-       },
+       }, 
        /*
         * base embed pause
-        *  there is no general way to pause the video
+        *      there is no general way to pause the video
         *  must be overwritten by embed object to support this functionality.
         */
        pause: function(){
-               var this_id = (this.pc!=null)?this.pc.pp.id:this.id;
-               //js_log('mv_embed:do pause');
-               //(playing) do pause
-               this.paused = true;
-               //update the ctrl "paused state"
-               $j('#'+ this_id + ' .play-btn .ui-icon').removeClass('ui-icon-pause').addClass('ui-icon-play');
-               $j('#'+ this_id + ' .play-btn').unbind().btnBind().click(function(){
-                               $j('#'+this_id).get(0).play();
-               }).attr('title', gM('play_clip'));
-       },
+               var eid = (this.pc!=null)?this.pc.pp.id:this.id;                                                          
+               //js_log('mv_embed:do pause');          
+               //(playing) do pause            
+               this.paused = true; 
+               //update the ctrl "paused state"                                
+               $j('#' + eid + ' .play-btn span').removeClass('ui-icon-pause').addClass('ui-icon-play');
+                $j('#' + eid + ' .play-btn').unbind().btnBind().click(function(){                                                       
+                               $j('#'+eid).get(0).play();
+               }).attr('title', gM('mwe-play_clip'));
+       },      
        /*
         * base embed stop (can be overwritten by the plugin)
         */
        stop: function(){
                var _this = this;
                js_log('mvEmbed:stop:'+this.id);
-
+               
                //no longer seeking:
                this.didSeekJump=false;
-
-               //first issue pause to update interface (only call the parent)
+               
+               //first issue pause to update interface (only call the parent) 
                if(this['parent_pause']){
                        this.parent_pause();
                }else{
                        this.pause();
-               }
-
-               //reset the currentTime:
+               }       
+               
+               //reset the currentTime: 
                this.currentTime=0;
                //check if thumbnail is being displayed in which case do nothing
                if( this.thumbnail_disp ){
@@ -2308,32 +2008,30 @@ embedVideo.prototype = {
                        this.setSliderValue(0);
                        this.setStatus( this.getTimeReq() );
                }
-
-               //make sure the big playbutton is has click action:
-               $j('#'+ _this.id +' .play-btn-large').unbind('click').btnBind().click(function(){
+               
+               //make sure the big playbutton is has click action: 
+               $j('#' + _this.id + ' .play-btn-large').unbind('click').click(function(){
                        $j('#' +_this.id).get(0).play();
                });
-
+               
                if(this.update_interval)
                {
                        clearInterval(this.update_interval);
                        this.update_interval = null;
                }
        },
-       toggleMute:function(){
-               var this_id = (this.pc!=null)?this.pc.pp.id:this.id;
-               if(this.muted){
-                       this.muted=false;
-                       $j( '#volume_control_' + this_id + ' span').removeClass('ui-icon-volume-off').addClass('ui-icon-volume-on');
-                       $j( '#volume_bar_' + this_id).slider('value', 100);
+       toggleMute:function(){  
+               var eid = (this.pc!=null)?this.pc.pp.id:this.id;        
+               if( this.muted ){
+                       this.muted=false;                       
+                       $j('#' + eid + ' .volume-slider').slider('value', 100);
                        this.updateVolumen(1);
                }else{
-                       this.muted=true;
-                       $j('#volume_control_'+this_id + ' span').removeClass('ui-icon-volume-on').addClass('ui-icon-volume-off');
-                       $j('#volume_bar_'+this_id).slider('value', 0);
-                       this.updateVolumen(0);
+                       this.muted=true;                        
+                       $j('#' + eid + ' .volume-slider').slider('value', 0);
+                       this.updateVolumen(0); 
                }
-               js_log('f:toggleMute::' + this.muted);
+               js_log('f:toggleMute::' + this.muted);          
        },
        updateVolumen:function(perc){
                js_log('update volume not supported with current playback type');
@@ -2341,7 +2039,7 @@ embedVideo.prototype = {
        fullscreen:function(){
                js_log('fullscreen not supported with current playback type');
        },
-       /* returns bool true if playing or paused, false if stopped
+       /* returns bool true if playing or paused, false if stooped
         */
        isPlaying : function(){
                if(this.thumbnail_disp){
@@ -2367,46 +2065,61 @@ embedVideo.prototype = {
        postEmbedJS:function(){
                return '';
        },
-       //do common monitor code like update the playhead and play status
+       //do common monitor code like update the playhead and play status 
        //plugin objects are responsible for updating currentTime
-       monitor:function(){
+       monitor:function(){              
+               //js_log(' ct: ' + this.currentTime + ' dur: ' + ( parseInt( this.duration ) + 1 )  + ' is seek: ' + this.seeking );
                if( this.currentTime && this.currentTime > 0 && this.duration){
-                       if( !this.userSlide ){
-                               if( this.start_offset  ){
-                                       //if start offset include that calculation
+                       if( !this.userSlide && !this.seeking ){
+                               if( this.start_offset  ){ 
+                                       //if start offset include that calculation 
                                        this.setSliderValue( ( this.currentTime - this.start_offset ) / this.duration );
-                                       this.setStatus( seconds2npt(this.currentTime) + '/'+ seconds2npt(parseFloat(this.start_offset)+parseFloat(this.duration) ));
+                                       var et = (this.ctrlBuilder.long_time_disp)? '/'+ seconds2npt(parseFloat(this.start_offset)+parseFloat(this.duration) ) : '';                    
+                                       this.setStatus( seconds2npt(this.currentTime) + et);
                                }else{
                                        this.setSliderValue( this.currentTime / this.duration );
-                                       this.setStatus( seconds2npt(this.currentTime) + '/' + seconds2npt(this.duration ));
-                               }
+                                       var et = (this.ctrlBuilder.long_time_disp)? '/' + seconds2npt( this.duration ):'';
+                                       this.setStatus( seconds2npt( this.currentTime ) + et);                                  
+                               }                               
                        }
+                       //check if we are "done"
+                       if( this.currentTime > ( parseInt(this.duration) + 1 ) ){
+                               js_log("should run clip done");
+                               this.onClipDone();
+                       }                               
                }else{
+                       //media lacks duration just show end time
                        //js_log(' ct:' + this.currentTime + ' dur: ' + this.duration);
                        if( this.isStoped() ){
                                this.setStatus( this.getTimeReq() );
                        }else if( this.isPaused() ){
-                               this.setStatus( "paused" );
+                               this.setStatus( gM('mwe-paused') );                     
                        }else if( this.isPlaying() ){
-                               if( this.currentTime && ! this.duration )
+                               if( this.currentTime && ! this.duration ) 
                                        this.setStatus( seconds2npt( this.currentTime ) + ' /' );
-                               else
+                               else   
                                        this.setStatus(" - - - ");
                        }else{
                                this.setStatus( this.getTimeReq() );
-                       }
+                       }                       
                }
-               //update buffer information
+               //could check if time > duration here and stop playback
+               
+               //update buffer information 
                this.updateBufferStatus();
-
+               var _this = this;
                //update monitorTimerId to call child monitor
                if( ! this.monitorTimerId ){
-                       //make sure an instance of this.id exists:
+                       //make sure an instance of this.id exists: 
                        if( document.getElementById(this.id) ){
-                               this.monitorTimerId = setInterval('$j(\'#'+this.id+'\').get(0).monitor()', 250);
+                               this.monitorTimerId = setInterval(function(){
+                                       if(_this.id && $j( '#'+_this.id ).length != 0){
+                                               $j( '#'+_this.id ).get(0).monitor();
+                                       }
+                               }, 250);
                        }
                }
-       },
+       },              
        stopMonitor:function(){
                if( this.monitorTimerId != 0 )
                {
@@ -2415,17 +2128,18 @@ embedVideo.prototype = {
                }
        },
        updateBufferStatus: function(){
-               //build the buffer targeet based for playlist vs clip
-               var buffer_select = (this.pc) ?
-                       '#cl_status_' + this.id + ' .ui-slider-buffer':
-                       '#' + this.id + ' .ui-slider-buffer';
-
+                       
+               //build the buffer targeet based for playlist vs clip 
+               var buffer_select = (this.pc) ? 
+                       '#cl_status_' + this.id + ' .mv_buffer': 
+                       '#' + this.id + ' .play_head .mv_buffer';
+                       
                //update the buffer progress bar (if available )
                if( this.bufferedPercent != 0 ){
-                       //js_log('bufferedPercent: ' + this.bufferedPercent);
+                       //js_log('bufferedPercent: ' + this.bufferedPercent);                   
                        if(this.bufferedPercent > 1)
-                               this.bufferedPercent=1;
-
+                               this.bufferedPercent=1;                                                 
+                       
                        $j(buffer_select).css("width", (this.bufferedPercent*100) +'%' );
                }else{
                        $j(buffer_select).css("width", '0px' );
@@ -2435,7 +2149,7 @@ embedVideo.prototype = {
                if(!this.start_offset)
                        this.start_offset =0;
                var rt = this.currentTime - this.start_offset;
-               if( rt < 0 ) //should not happen but does.
+               if( rt < 0 ) //should not happen but does. 
                        return 0;
                return rt;
        },
@@ -2451,7 +2165,7 @@ embedVideo.prototype = {
                }
                return null;
        },
-       //HELPER Functions for selected source
+       //HELPER Functions for selected source  
        /*
        * returns the selected source url for players to play
        */
@@ -2462,70 +2176,70 @@ embedVideo.prototype = {
                //do head request if on the same domain
                return this.media_element.selected_source.URLTimeEncoding;
        },
-       setSliderValue: function(perc, hide_progress){
-               if(this.controls){
-                       var this_id = (this.pc)?this.pc.pp.id:this.id;
-                       var val = parseInt( perc*1000 );
-                       $j('#'+this.id + ' .j-scrubber').slider('value', val);
+       setSliderValue: function(perc, hide_progress){  
+               var eid = (this.pc)?this.pc.pp.id:this.id;
+               if(this.controls && $j('#' + eid + ' .play_head').length != 0){                                 
+                       var val = parseInt( perc*1000 ); 
+                       $j('#' + eid + ' .play_head').slider('value', val);                             
                }
-               //js_log('set#mv_seeker_slider_'+this_id + ' perc in: ' + perc + ' * ' + $j('#mv_seeker_'+this_id).width() + ' = set to: '+ val + ' - '+ Math.round(this.mv_seeker_width*perc) );
+               //js_log('set#mv_seeker_slider_'+eid + ' perc in: ' + perc + ' * ' + $j('#mv_seeker_'+eid).width() + ' = set to: '+ val + ' - '+ Math.round(this.mv_seeker_width*perc) );
                //js_log('op:' + offset_perc + ' *('+perc+' * ' + $j('#slider_'+id).width() + ')');
        },
        highlightPlaySection:function(options){
                js_log('highlightPlaySection');
-               var this_id = (this.pc)?this.pc.pp.id:this.id;
+               var eid = (this.pc)?this.pc.pp.id:this.id;
                var dur = this.getDuration();
-               var hide_progress = true;
-               //set the left percet and update the slider:
+               var hide_progress = true;               
+               //set the left percet and update the slider: 
                rel_start_sec = npt2seconds( options['start']);
-               //remove the start_offset if relevent:
+               //remove the start_offset if relevent: 
                if(this.start_offset)
                        rel_start_sec = rel_start_sec - this.start_offset
-
+               
                var slider_perc=0;
                if( rel_start_sec <= 0 ){
-                       left_perc =0;
+                       left_perc =0;                    
                        options['start'] = seconds2npt( this.start_offset );
-                       rel_start_sec=0;
+                       rel_start_sec=0;                        
                        this.setSliderValue( 0 , hide_progress);
                }else{
-                       left_perc = parseInt( (rel_start_sec / dur)*100 ) ;
+                       left_perc = parseInt( (rel_start_sec / dur)*100 ) ;             
                        slider_perc = (left_perc / 100);
-               }
-               js_log("slider perc:" + slider_perc);
+               }               
+               
+               js_log("slider perc:" + slider_perc);   
                if( ! this.isPlaying() ){
-                       this.setSliderValue( slider_perc , hide_progress);
+                       this.setSliderValue( slider_perc , hide_progress);              
                }
-
-               width_perc = parseInt( (( npt2seconds( options['end'] ) - npt2seconds( options['start'] ) ) / dur)*100 ) ;
+               
+               width_perc = parseInt( (( npt2seconds( options['end'] ) - npt2seconds( options['start'] ) ) / dur)*100 ) ;                                                       
                if( (width_perc + left_perc) > 100 ){
-                       width_perc = 100 - left_perc;
-               }
-               //js_log('should hl: '+rel_start_sec+ '/' + dur + ' re:' + rel_end_sec+' lp:'  + left_perc + ' width: ' + width_perc);
-               $j('#mv_seeker_' + this_id + ' .mv_highlight').css({
-                       'left':left_perc+'%',
-                       'width':width_perc+'%'
+                       width_perc = 100 - left_perc; 
+               }               
+               //js_log('should hl: '+rel_start_sec+ '/' + dur + ' re:' + rel_end_sec+' lp:'  + left_perc + ' width: ' + width_perc);  
+               $j('#mv_seeker_' + eid + ' .mv_highlight').css({
+                       'left' : left_perc+'%',
+                       'width' : width_perc+'%'                        
                }).show();
-
+               
                this.jump_time =  options['start'];
                this.seek_time_sec = npt2seconds( options['start']);
-               //trim output to
-               this.setStatus( gM('seek_to')+' '+ seconds2npt( this.seek_time_sec ) );
+               //trim output to 
+               this.setStatus( gM('mwe-seek_to', seconds2npt( this.seek_time_sec ) ) );
                js_log('DO update: ' +  this.jump_time);
-               this.updateThumbTime( rel_start_sec );
+               this.updateThumbTime( rel_start_sec );  
        },
        hideHighlight:function(){
-               var this_id = (this.pc)?this.pc.pp.id:this.id;
-               $j('#mv_seeker_' + this_id + ' .mv_highlight').hide();
+               var eid = (this.pc)?this.pc.pp.id:this.id;
+               $j('#mv_seeker_' + eid + ' .mv_highlight').hide();
                this.setStatus( this.getTimeReq() );
                this.setSliderValue( 0 );
        },
        setStatus:function(value){
-               var id = (this.pc)?this.pc.pp.id:this.id;
+               var eid = (this.pc)?this.pc.pp.id:this.id;
                //update status:
-               //$j('#mv_time_'+id).html(value);
-               $j('#'+this.id + ' .k-timer').html(value);
-       }
+               $j('#' + eid + ' .time-disp').html(value);
+       }       
 }
 
 
@@ -2552,9 +2266,9 @@ mediaPlayer.prototype =
        supported_types:null,
        library:null,
        loaded:false,
-       loading_callbacks:null,
+       loading_callbacks:null, 
        supportsMIMEType : function(type)
-       {
+       {               
                for (var i=0; i < this.supported_types.length; i++)
                        if(this.supported_types[i] == type)
                                return true;
@@ -2562,25 +2276,17 @@ mediaPlayer.prototype =
        },
        getName : function()
        {
-               return gM('mv_ogg-player-' + this.id);
+               return gM('mwe-ogg-player-' + this.id);
        },
-       load : function(callback){
-               var libName = this.library+'Embed';
-               if( mvJsLoader.checkObjPath( libName ) ){
-                       js_log('plugin loaded, do callback:');
-                       callback();
-               }else{
-                       var _this = this;
-                       //jQuery based get script does not work so well.
-                       mvJsLoader.doLoad([
-                               libName
-                       ],function(){
-                               callback();
-                       });
-               }
-       }
+       load : function(callback){              
+               mvJsLoader.doLoad([ 
+                       this.library + 'Embed'  
+               ],function(){
+                       callback();                                                     
+               });
+       }       
 }
-/* players and supported mime types
+/* 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');
@@ -2597,7 +2303,7 @@ var vlcActiveXPlayer = new mediaPlayer('vlc-activex',vlcMineList,'vlc');
 //add generic
 var oggPluginPlayer = new mediaPlayer('oggPlugin',['video/ogg'],'generic');
 
-//depricate quicktime in favor of safari native
+//depricate quicktime in favor of safari native 
 //var quicktimeMozillaPlayer = new mediaPlayer('quicktime-mozilla',['video/ogg'],'quicktime');
 //var quicktimeActiveXPlayer = new mediaPlayer('quicktime-activex',['video/ogg'],'quicktime');
 
@@ -2622,77 +2328,75 @@ mediaPlayers.prototype =
        {
                this.players = new Array();
                this.loadPreferences();
-
-               //set up default players order for each library type
+               
+               //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/ogg'] = ['native','vlc','java', 'generic'];
-               this.default_players['application/ogg'] = ['native','vlc','java', 'generic'];
-               this.default_players['audio/ogg'] = ['native','vlc', 'java', 'omtk' ];
+               
+               this.default_players['video/ogg'] = ['native','vlc','java', 'generic'];         
+               this.default_players['application/ogg'] = ['native','vlc','java', 'generic'];           
+               this.default_players['audio/ogg'] = ['native','vlc', 'java', 'omtk' ];          
                this.default_players['video/mp4'] = ['vlc'];
-
+               
                this.default_players['text/html'] = ['html'];
                this.default_players['image/jpeg'] = ['html'];
                this.default_players['image/png'] = ['html'];
                this.default_players['image/svg'] = ['html'];
-
+               
        },
        addPlayer : function(player, mime_type)
-       {
-               //js_log('Adding ' + player.id + ' with mime_type ' + mime_type);
+       {               
                for (var i =0; i < this.players.length; i++){
-                       if (this.players[i].id == player.id)
-                       {
-                               if(mime_type!=null)
-                               {
+                       if (this.players[i].id == player.id){
+                               if(mime_type!=null){
                                        //make sure the mime_type is not already there:
-                                       var add_mime = true;
+                                       var add_mime = true; 
                                        for(var j=0; j < this.players[i].supported_types.length; j++ ){
                                                if( this.players[i].supported_types[j]== mime_type)
                                                        add_mime=false;
-                                       }
+                                       }                                       
                                        if(add_mime)
-                                               this.players[i].supported_types.push(mime_type);
+                                               this.players[i].supported_types.push( mime_type );
                                }
-                               return;
+                               return ;
                        }
                }
-               //player not found:
-               if(mime_type!=null)
+               //player not found: 
+               if( mime_type != null )
                        player.supported_types.push(mime_type);
-
+                                 
+               js_log('Adding ' + player.id + ' with mime_type ' + mime_type);  
                this.players.push( player );
        },
        getMIMETypePlayers : function(mime_type)
-       {
+       {                               
                var mime_players = new Array();
                var _this = this;
                var inx = 0;
-               if( this.default_players[mime_type] ){
-                       $j.each( this.default_players[mime_type], function(d, lib){
-                               var library = _this.default_players[mime_type][d];
-                               for ( var i=0; i < _this.players.length; i++ ){
+               if( this.default_players[mime_type] ){                                          
+                       $j.each( this.default_players[mime_type], function(d, lib){                             
+                               var library = _this.default_players[mime_type][d];                              
+                               for ( var i=0; i < _this.players.length; i++ ){                                 
                                        if ( _this.players[i].library == library && _this.players[i].supportsMIMEType(mime_type) ){
-                                               mime_players[ inx ] = _this.players[i];
+                                               mime_players[ inx ] = _this.players[i];                                         
                                                inx++;
                                        }
                                }
                        });
-               }
+               }               
                return mime_players;
        },
        defaultPlayer : function(mime_type)
-       {
-               js_log("get defaultPlayer for " + mime_type);
-               var mime_players = this.getMIMETypePlayers(mime_type);
+       {                               
+               js_log("get defaultPlayer for " + mime_type);           
+               var mime_players = this.getMIMETypePlayers(mime_type);                          
                if( mime_players.length > 0)
                {
                        // check for prior preference for this mime type
                        for( var i=0; i < mime_players.length; i++ ){
                                if( mime_players[i].id==this.preference[mime_type] )
                                        return mime_players[i];
-                       }
+                       }                                       
                        // otherwise just return the first compatible player
                        // (it will be chosen according to the default_players list
                        return mime_players[0];
@@ -2719,9 +2423,9 @@ mediaPlayers.prototype =
                }
                if( selected_player )
                {
-                       for(var i=0; i < global_player_list.length; i++)
+                       for(var i=0; i < $mw.player_list.length; i++)
                        {
-                               var embed = $j('#'+global_player_list[i]).get(0);
+                               var embed = $j('#'+$mw.player_list[i]).get(0);
                                if(embed.media_element.selected_source && (embed.media_element.selected_source.mime_type == mime_type))
                                {
                                        embed.selectPlayer(selected_player);
@@ -2732,7 +2436,7 @@ mediaPlayers.prototype =
        },
        loadPreferences : function()
        {
-               this.preference = new Object();
+               this.preference = new Object();                         
                // see if we have a cookie set to a clientSupported type:
                var cookieVal = $j.cookie( 'ogg_player_exp' );
                if (cookieVal)
@@ -2748,11 +2452,11 @@ mediaPlayers.prototype =
        },
        savePreferences : function()
        {
-               var cookieVal = '';
+               var cookieVal = '';             
                for(var i in this.preference)
                        cookieVal+= i + '='+ this.preference[i] + '&';
-
-               cookieVal=cookieVal.substr(0, cookieVal.length-1);
+                       
+               cookieVal=cookieVal.substr(0, cookieVal.length-1);              
                var week = 7*86400*1000;
                $j.cookie( 'ogg_player_exp', cookieVal, { 'expires':week } );
        }
@@ -2766,7 +2470,7 @@ mediaPlayers.prototype =
 var embedTypes = {
         // List of players
         players: null,
-        detect_done:false,
+        detect_done:false,      
         init: function(){
                //detect supported types
                this.detect();
@@ -2786,57 +2490,56 @@ var embedTypes = {
                 js_log("running detect");
                this.players = new mediaPlayers();
                //every browser supports html rendering:
-               this.players.addPlayer( htmlPlayer );
+               this.players.addPlayer( htmlPlayer );                   
                 // In Mozilla, navigator.javaEnabled() only tells us about preferences, we need to
                 // search navigator.mimeTypes to see if it's installed
-                var javaEnabled = navigator.javaEnabled();
-                // In Opera, navigator.javaEnabled() is all there is
-                var invisibleJava = $j.browser.opera;
+                var javaEnabled = navigator.javaEnabled();                              
                 // Some browsers filter out duplicate mime types, hiding some plugins
-                var uniqueMimesOnly = $j.browser.opera || $j.browser.safari;
+                var uniqueMimesOnly = $j.browser.opera || $j.browser.safari;            
                 // Opera will switch off javaEnabled in preferences if java can't be found.
                 // And it doesn't register an application/x-java-applet mime type like Mozilla does.
-                if ( invisibleJava && javaEnabled )
-                        this.players.addPlayer( cortadoPlayer );
-
+                if ( javaEnabled )
+                        this.players.addPlayer( cortadoPlayer );                               
+               
                 // ActiveX plugins
                 if($j.browser.msie){
-                         // check for flash
-                          if ( this.testActiveX( 'ShockwaveFlash.ShockwaveFlash')){
-                                  //try to get the flash version for omtk include:
-                                  try {
+                       // check for flash               
+                       if ( this.testActiveX( 'ShockwaveFlash.ShockwaveFlash')){                                  
+                               //try to get the flash version for omtk include: 
+                               try {
                                        a = new ActiveXObject(SHOCKWAVE_FLASH_AX + ".7");
                                        d = a.GetVariable("$version");  // Will crash fp6.0.21/23/29
                                        if (d) {
-                                               d = d.split(" ")[1].split(",");
+                                               d = d.split(" ")[1].split(",");                                         
                                                //we need flash version 10 or greater:
                                                if(parseInt( d[0]) >=10){
                                                        this.players.addPlayer( omtkPlayer );
-                                               }
-
-                                       }
-                               }catch(e) {}
-
-                                  //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( flowPlayer );
-                          }
+                                               }                                       
+                                       }                                       
+                               }catch(e) {
+                                       //failed to check for flash
+                               }                               
+                               //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( flowPlayer );                              
+                       }
                         // VLC
                         if ( this.testActiveX( 'VideoLAN.VLCPlugin.2' ) )
                                 this.players.addPlayer(vlcActiveXPlayer);
-                        // Java
-                        if ( javaEnabled && this.testActiveX( 'JavaWebStart.isInstalled' ) )
-                                this.players.addPlayer(cortadoPlayer);
-                        // quicktime
+                                
+                        // Java ActiveX
+                        if ( this.testActiveX( 'JavaWebStart.isInstalled' ) )
+                                this.players.addPlayer( cortadoPlayer );
+                        // quicktime (currently off) 
                         //if ( this.testActiveX( 'QuickTimeCheckObject.QuickTimeCheck.1' ) )
-                        //     this.players.addPlayer(quicktimeActiveXPlayer);
-                }
+                        //     this.players.addPlayer(quicktimeActiveXPlayer);                  
+                }                               
                // <video> element
                if ( typeof HTMLVideoElement == 'object' // Firefox, Safari
                                || typeof HTMLVideoElement == 'function' ) // Opera
                {
-                       //do another test for safari:
-                       if( $j.browser.safari ){
+                       //do another test for safari: 
+                       if( $j.browser.safari ){                                
                                try{
                                        var dummyvid = document.createElement("video");
                                        if (dummyvid.canPlayType && dummyvid.canPlayType("video/ogg;codecs=\"theora,vorbis\"") == "probably")
@@ -2847,7 +2550,7 @@ var embedTypes = {
                                                   but xiph qt registers mimetype via quicktime plugin */
                                                this.players.addPlayer( videoElementPlayer );
                                        } else {
-                                               //@@todo add some user nagging to install the xiph qt
+                                               //@@todo add some user nagging to install the xiph qt 
                                        }
                                }catch(e){
                                        js_log('could not run canPlayType in safari');
@@ -2855,9 +2558,9 @@ var embedTypes = {
                        }else{
                                this.players.addPlayer( videoElementPlayer );
                        }
-               }
-
-                // Mozilla plugins
+               }                
+               
+                // "navigator" plugins
                if( navigator.mimeTypes && navigator.mimeTypes.length > 0) {
                        for ( var i = 0; i < navigator.mimeTypes.length; i++ ) {
                                var type = navigator.mimeTypes[i].type;
@@ -2870,17 +2573,17 @@ var embedTypes = {
                                if ( !pluginName ) {
                                        // In case it is null or undefined
                                        pluginName = '';
-                               }
+                               }                               
                                if ( pluginName.toLowerCase() == 'vlc multimedia plugin' || pluginName.toLowerCase() == 'vlc multimedia plug-in' ) {
                                        this.players.addPlayer(vlcMozillaPlayer, type);
                                        continue;
                                }
-
-                               if ( javaEnabled && type == 'application/x-java-applet' ) {
-                                       this.players.addPlayer(cortadoPlayer);
+               
+                               if ( type == 'application/x-java-applet' ) {
+                                       this.players.addPlayer( cortadoPlayer );
                                        continue;
-                               }
-
+                               }                               
+               
                                if ( type == 'application/ogg' ) {
                                        if ( pluginName.toLowerCase() == 'vlc multimedia plugin' ){
                                                this.players.addPlayer(vlcMozillaPlayer, type);
@@ -2899,14 +2602,14 @@ var embedTypes = {
                                                continue;
                                        }
                                }
-
+               
                                /*if ( type == 'video/quicktime' ) {
                                        this.players.addPlayer(vlcMozillaPlayer, type);
                                        continue;
                                }*/
                                if(type=='application/x-shockwave-flash'){
                                        this.players.addPlayer( flowPlayer );
-
+                                       
                                        //check version to add omtk:
                                        var flashDescription = navigator.plugins["Shockwave Flash"].description;
                                        var descArray = flashDescription.split(" ");
@@ -2915,7 +2618,7 @@ var embedTypes = {
                                        //js_log("version of flash: " + versionMajor);
                                        if(versionMajor >= 10){
                                                this.players.addPlayer( omtkPlayer );
-                                       }
+                                       }                                       
                                        continue;
                                }
                        }
@@ -2934,5 +2637,5 @@ var embedTypes = {
                         hasObj = false;
                 }
                 return hasObj;
-       }
+       }        
 };