var currentPlayer=null;
var currentFile;
var currentImage;

function removeOldPlayer() {busy=false;
	document.getElementById(currentPlayer).innerHTML = '';
}

function createSlide(thePlace, theFile) {
	if (currentPlayer!=null) { removeOldPlayer(); }

	currentPlayer=thePlace;
	currentFile=theFile;

	var so = new SWFObject(theFile,"playerID","580","200","9","#f58220");
	so.addParam("quality","best");
	so.addParam("menu","false");
	so.addParam("wmode","transparent");
	so.write(thePlace);
}

function createPlayer(thePlace, theFile, theImage, version) {
	if (currentPlayer!=null) { removeOldPlayer(); }

	currentPlayer=thePlace;
	currentFile=theFile;
	currentImage=theImage;
	
	if (version=="l" || version=="") {w=580; h=326; h2=346;}
	if (version=="m") {w=450; h=253; h2=273;}
	if (version=="s") {w=320; h=180; h2=200;}

	var so = new SWFObject("mediaplayer.swf","playerID",w,h2,"9");
	so.addParam("quality","best");
	so.addParam("menu","false");
	so.addParam("wmode","transparent");
	so.addVariable("usefullscreen","false");
	so.addVariable("width",w);
	so.addVariable("height",h2);
	so.addVariable("displaywidth",w);
	so.addVariable("displayheight",h);
	so.addVariable('backcolor','0xf58220');
	so.addVariable('frontcolor','0x1d3360');
	so.addVariable('lightcolor','0xffffff');
	so.addVariable("screencolor","0xf58220");
	so.addVariable("file",theFile);
	so.addVariable("image",theImage);
	so.write(thePlace);
}

function createVersions(thePlace, theFile, theImage, thePlaceVersions) {
	theFileL = theFile + '_l.flv';
	theFileM = theFile + '_m.flv';
	theFileS = theFile + '_s.flv';
	theImageL = theImage + '_l.jpg';
	theImageM = theImage + '_m.jpg';
	theImageS = theImage + '_s.jpg';

	document.getElementById(thePlaceVersions).innerHTML = "<a href=javascript:createPlayer('"+thePlace+"','"+theFileS+"','"+theImageS+"','s');>small</a> | <a href=javascript:createPlayer('"+thePlace+"','"+theFileM+"','"+theImageM+"','m');>medium</a> | <a href=javascript:createPlayer('"+thePlace+"','"+theFileL+"','"+theImageL+"','l');>large</a>";
}

function openWindow(url,w,h,win_name) {
  LeftPosition = 0;
  TopPosition = 0;
  win = window.open(url,win_name,'menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,screenX='+LeftPosition+',screenY='+TopPosition+',left='+LeftPosition+',top='+TopPosition+',width='+w+',height='+h+'');

  if(win.focus){win.focus();}
}
