player_visible = false;
player_path = '/Video/player.swf'
skin_path = '/Video/SteelExternalPlaySeekMute.swf'

function toggle(filename, p_width, p_height)
{
  var indicator = document.getElementById('player');

  var l_ActualWidth = 320;
  var l_ActualHeight = 216;

  if (p_width){
      l_ActualWidth = p_width;
  }

  if (p_height){
      l_ActualHeight = p_height;
  }

  var e = document.getElementById('player');
  if (e) e.style.visibility = player_visible ? 'hidden' : 'visible';
  player_visible = !player_visible;
  if (filename == 0){
    indicator.setAttribute('player_width', 0);
    WritePlayer("player_window","");
    return;
  } else if (filename != ""){
    WritePlayer("player_window","<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='" + l_ActualWidth + "' height='"+l_ActualHeight+"' id='player'><param name='allowScriptAccess' value='sameDomain' /><param name='allowFullScreen' value='false' /><param name='wmode' value='transparent' /><param name='movie' value='"+player_path +"?videoPath="+filename+"&skin_path="+skin_path+"' /><param name='quality' value='high' /><param name='bgcolor' value='#000000' /><embed src='"+player_path +"?videoPath="+filename+"&skin_path="+skin_path+"' quality='high' wmode='transparent' bgcolor='#000000' width='" + l_ActualWidth + "' height='"+l_ActualHeight+"' name='player' align='middle' allowScriptAccess='sameDomain' allowFullScreen='false' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /></object> ");
  }  
 

      indicator.style.width = l_ActualWidth + "px";
      indicator.style.height = l_ActualHeight + "px";
      indicator.setAttribute('player_width', l_ActualWidth);
      indicator.setAttribute('player_height', l_ActualHeight);

      LocatePlayerPosition();
 
  return false;
}
function WritePlayer(ID, sText) {
  if (document.layers) {
    var oLayer;
    oLayer = document.layers[ID].document;
    oLayer.open();
    oLayer.write(sText);
    oLayer.close();
  }
  else if (parseInt(navigator.appVersion)>=5&&navigator.appName=="Netscape") {
    document.getElementById(ID).innerHTML = sText;
  }
  else if (document.all) document.all[ID].innerHTML = sText
}
    
    
 
  var oldresize = window.onresize;
  if (typeof window.onresize!= 'function') {
      window.onresize= LocatePlayerPosition;
  } else {
      window.onresize= function() {
          if (oldresize) {
              oldresize();
          }
          LocatePlayerPosition();
      }
  }
        
  var oldscroll = window.onscroll;
  if (typeof window.onscroll!= 'function') {
      window.onscroll= LocatePlayerPosition;
  } else {
      window.onscroll= function() {
          if (oldscroll) {
              oldscroll();
          }
          LocatePlayerPosition();
      }
  } 
              
  function LocatePlayerPosition()
  {
      var indicator = document.getElementById('player');
    
      var indicatorWidth = indicator.getAttribute('player_width');
      var indicatorHeight = indicator.getAttribute('player_height');

      if (!indicatorWidth || indicatorWidth==0) return;
    
      var y = self.pageYOffset ? self.pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body ? document.body.scrollTop : null;
      var availWidth;
      var availHeight;
 
      if(typeof(window.innerWidth) == 'number'){
          availHeight = window.innerHeight;
          availWidth = window.innerWidth;
      }else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)){
          availHeight = document.documentElement.clientHeight;
          availWidth = document.documentElement.clientWidth;
      }else if(document.body && (document.body.clientWidth || document.body.clientHeight)){
          availHeight = document.body.clientHeight;
          availWidth = document.body.clientWidth;
      }    
 
     
      var left = (availWidth/2) - (indicatorWidth/2);
      var top = ((availHeight/2)+y) - (indicatorHeight/2);
        
      indicator.style.top=top+"px";
      indicator.style.left=left+"px";
  }

