// FLV PLAYER OBJECT 
function VideoViewer(elid,player,file,mid,vid,w,h,capture){
  var self    = this;
  self.elid   = elid;
  self.player = player;
  self.file   = file.replace('.flv','');
  self.mid    = mid;
  self.vid    = vid;
  self.w      = w;
  self.h      = h;
  self.capt   = capture;
  
  dbug.log('self.elid:'+self.elid);
  dbug.log('self.player:'+self.player);
  dbug.log('self.file:'+self.file);
  dbug.log('self.mid:'+self.mid);
  dbug.log('self.vid:'+self.vid);
  dbug.log('self.w:'+self.w);
  dbug.log('self.h:'+self.h);
  dbug.log('self.capt:'+self.capt);
  
  self.init();
}

VideoViewer.prototype = {
  init: function(){
    var self = this;
    var str = '';
    str += '<div class="flash-alt">';
    str += '<p>You must install the Flash Player in order<br/> to view the videos on this site.</p>';
    str += '<a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" target="_blank">';
    str += '<img src="images/get_flash.gif" />';
    str += '</a></div>';
    $j('#'+self.elid).html(str);
    self.play();
  },
  
  
  play: function(){
    var self = this;
    var flashvars = {
      file: self.file
    };
    var params = {
      menu: "false",
      allowFullScreen : "true"
    };
    var attributes = {
      
    };
    swfobject.embedSWF(self.player, self.elid, self.w, self.h, "9.0.115", "expressInstall.swf", flashvars, params, attributes);
  },
  
  
  next: function(){
    // do nothing
    return;
  },
  
  
  runtime: function(dur){
    // assumes we're updating an element in the DOM with an id of 'runtime'
    var self = this;
    var mins = parseFloat(dur)/60;
    var secs = Math.floor(mins - Math.floor(mins)/60);
    if(secs < 10) secs = '0'+(secs.toString());
    $j('#runtime').html(Math.floor(mins)+':'+secs);
  },
  
  
  replay: function(){
    var self = this;
    $j('#options').hide();
    self.$elem.show();
  }
  
}
