// SimpleSoundPlayer

// Provenance:
// Pop-Up Embedder Script by David Battino, www.batmosphere.com; 
// Object tag implementation by Mark Levitt, http://digitalmedia.oreilly.com
// (see http://digitalmedia.oreilly.com/2005/02/23/mp3_embed.html)
// Tweaked by jtb (http://www.jtbullitt.com)

var pathToCSS = "/css/SimpleSoundPlayer.css";
var UniqueID = 31415; // Make each link open in a new window.
var newWinOffsetTop = this.window.screenY + 25; // Position of first pop-up
var newWinOffsetLeft = this.window.screenX + 25;; // Position of first pop-up
var offsetDelta = 20;	// offset of subsequent windows
var winWidth = 320;
var winHeight = 200;
function SimpleSoundPlayer(soundfiledesc,soundfilepath) {
	PlayWin = window.open('',UniqueID,'width='+winWidth+',height='+winHeight+',top=' + newWinOffsetTop +',left=' + newWinOffsetLeft + ',resizable=0,scrollbars=0,titlebar=0,toolbar=0,menubar=0,status=0,directories=0,personalbar=0');
	PlayWin.focus(); 
	var winContent = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>\n";
	winContent += "<html>\n<head>\n"
		+ "<title>" + soundfiledesc + "</title>\n"
		+ "<link rel='stylesheet' href='"+pathToCSS+"' type='text/css' media='screen' />\n"
		+ "</head>\n<body>\n"
		+ "<div id='soundWindow'>\n";
	winContent += "<h1>" + soundfiledesc + "</h1>\n";
	winContent += "<object type='audio/x-mpeg' data='" + soundfilepath + "' autoplay='true'>\n";
	winContent += "<param name='src' value='" +  soundfilepath + "' />\n";
	winContent += "<param name='autoplay' value='false' />\n";
	winContent += "<param name='controller' value='true' />\n";
	winContent += "<embed src='" + soundfilepath + "' autostart='true' loop='false' controller='true'></embed>\n";
	winContent += "</object>\n";
	winContent += "<form><input type='button' value='Close this window' onclick='javascript:window.close();' /></form>\n";
	winContent += "<div id='license'><a rel='license' target='_blank' href='http://creativecommons.org/licenses/by-nc-sa/3.0/us/'>"
		+ "<img align='bottom' alt='Creative Commons License' style='border-width:0' src='/icon/cc-by-nc-sa-3.0-us-80x15.png' />"
		+ "</a></div>\n";
	winContent += "</div><!-- end #soundWindow -->\n";
	winContent += "</body>\n</html>";
	PlayWin.document.write(winContent);
	PlayWin.document.close(); // "Finalizes" new window
	UniqueID += 1;
	newWinOffsetTop += offsetDelta; // y-offset for subsequent pop-ups
	newWinOffsetLeft += offsetDelta;// x-offset for subsequent pop-ups
}
