var topOffset = 60;
var leftOffset = (screen.width-380);

function PlayerOpen(soundfiledesc,soundfilepath,height,loop) {

var windowHeight;
var playerHeight;
var doLoop;

if(height)
{
	windowHeight = height;
	playerHeight = height - 140;
}
else
{
	windowHeight = 190;
	playerHeight = 42;
}

if(loop)
{
    doLoop = "true";
}
else
{
    doLoop = "false";
}

PlayWin = window.open('','player','width=320,height=' + windowHeight + ',top=' + topOffset +',left=' + leftOffset +',resizable=0,scrollbars=0,titlebar=0,toolbar=0,menubar=0,status=0,directories=0,personalbar=0');
PlayWin.focus(); 
var winContent = "<HTML><HEAD><TITLE>" + soundfiledesc + "</TITLE></HEAD><BODY bgcolor='#FFFFFF' style='background-image:url(player/background.jpg); background-repeat:repeat-x;' onBlur='self.focus()'><img src='player/blank.gif' border='0' height='45' width='300'>";
winContent += "<B style='font-size:13px;font-family:Verdana,sans-serif;line-height:1.2'>" + soundfiledesc + "</B>";

winContent += "<OBJECT width='300' height='" + playerHeight + "'>";
winContent += "<param name='SRC' value='" +  soundfilepath + "'>";
winContent += "<param name='AUTOPLAY' VALUE='true'>";
winContent += "<param name='CONTROLLER' VALUE='true'>";
winContent += "<EMBED SRC='" + soundfilepath + "' AUTOSTART='TRUE' LOOP='" + doLoop + "' WIDTH='300' HEIGHT='" + playerHeight + "' CONTROLLER='TRUE'></EMBED>";
winContent += "</OBJECT>";

winContent += "<p style='font-size:11px;font-family:Verdana,sans-serif;text-align:center'><a href='"+soundfilepath+"'>Download this file</a> <SPAN style='font-size:10px'>(right-click or Option-click)</SPAN></p>";

winContent += "<FORM><DIV align='center'><INPUT type='button' value='Close this window' onClick='javascript:window.close();'></DIV></FORM>";
winContent += "</BODY></HTML>";
PlayWin.document.write(winContent);
PlayWin.document.close(); // "Finalizes" new window
}