﻿var player = null;
var newITM = null;

      function playerReady(obj) 
      {
        player = document.getElementsByName(obj.id)[0];
      };

      function loadNplay(url, itm)
      {
        newITM = (itm) ? itm : 0;
        player.sendEvent('LOAD', url);
        setTimeout("player.sendEvent('ITEM', newITM)", 100);
      };


function changeVmode(channel) {

if (document.theForm.vscale1[0].checked) {scaleparams = "exactfit";  }
else if (document.theForm.vscale1[1].checked) { scaleparams = "uniform"; }
else if (scaleparams == "") { scaleparams = "exactfit"; }

if (channel == "") { channel = "3"; }

var vmodew = document.getElementById('vmodew').value;

if (vmodew == "160") { vmodeh = "120"; }
  else if (vmodew == "240") { vmodeh = "180"; }
  else if (vmodew == "320") { vmodeh = "240"; }
  else if (vmodew == "480") { vmodeh = "360"; }
  else if (vmodew == "640") { vmodeh = "480"; }
  else if (vmodew == "800") { vmodeh = "600"; }

var s2 = new SWFObject("inc/mediaplayer.swf","mpl",vmodew,vmodeh,"9,0,124");
	s2.addParam("allowscriptaccess","always");
	s2.addParam("allowfullscreen","true");
	s2.addParam("wmode", "opaque");
	s2.addVariable("stretching", scaleparams);
	s2.addVariable("streamer", "rtmp://91.121.8.4/oflaDemo");
	s2.addVariable("displayclick", "fullscreen");
	s2.addVariable("quality", "true");
  s2.addVariable("id","mpl");
	s2.addVariable("logo","img/logo.png");
	s2.addVariable("file","inc/playlist-live.php?channel="+channel);
  s2.addVariable("height",vmodeh);
  s2.addVariable("width",vmodew);
	s2.addVariable("backcolor","0x000000");
	s2.addVariable("frontcolor","0xCCCCCC");
	s2.addVariable("lightcolor","0x996600");
	s2.addVariable("screencolor","0x000000");
	s2.addVariable("controlbar","over");
	s2.addVariable("autostart","true");
	s2.addVariable("repeat","list");
	s2.addVariable("shuffle","false");
	s2.addVariable("bufferlength","6");
	s2.addVariable("volume","50");
  s2.addVariable("linktarget","_self");
	s2.write("player1");
}
