
var currentItem; var showFlag=false;

function sendEvent(typ,prm) { thisMovie("thePlayerId").sendEvent(typ,prm); };


function getUpdate(typ,pr1,pr2,pid) {
	if(typ == "item") { currentItem = pr1; }
};


// This is a javascript handler for the player and is always needed.
function thisMovie(movieName) {
    if(navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName];
	} else {
		return document[movieName];
	}
};

function createPlayer(theFile) {
	var s = new SWFObject("otoplayer.swf","thePlayerId","220","115","7");
	s.addParam("allowfullscreen","true");
	s.addVariable("file",theFile);
	s.addVariable("width","220");
	s.addVariable("height","115");
	s.addVariable("displayheight","0");
	s.addVariable("overstretch","none");
	s.addVariable("showicons","false");
	s.addVariable("volume","65");	
	s.addVariable("autostart","false");
	s.addVariable('frontcolor','0x7799aa'); 
	s.addVariable('lightcolor','0xbbbbbb');
	s.addVariable('backcolor','0x051122');
	s.addVariable("enablejs","true");
	s.addVariable("javascriptid","thePlayerId"); 

	s.write("placeholder");
}


function createWindow(adr) { 
  showFlag=true;
  sendEvent("stop");
  document.getElementById("placeholder").style.visibility="hidden";
  var pWin=window.open(adr, "otoWin", "width=220,height=115,left=100,top=200,resizable=no");
  pWin.focus();
}

function showhide() { 
  if (showFlag) { 
    document.getElementById("placeholder").style.visibility="visible";
  } else { 
    document.getElementById("placeholder").style.visibility="hidden";
  }
  showFlag=!(showFlag);
}

function hideplayer() {
document.getElementById("placeholder").style.visibility="hidden";
}

function initWin(thePlaylist) {
  createPlayer(thePlaylist);
  setTimeout("sendEvent('playitem', location.search.substring(1))", 500);  
}