var uniqueID = 314 // Make each link open in a new window 
var newWinOffset = 0 // Position of first pop-up 

function openPlayer(title, speaker, passage, soundfilepath) 
{ 
	playWin = window.open('','player','toolbar=no,location=no,status=no,directories=no,menubar=no,scrolling=auto,scrollbars=auto,width=480,height=262,resizable=no');
	playWin.focus(); 

	var winContent = new Array();
	winContent.push("<HTML><HEAD><TITLE>Grace Church of Greenwich</TITLE></HEAD><BODY bgcolor='#c7d7d7'><table><tr><td>");
	winContent.push("<B style='font-size:20px;font-family:Arial,sans-serif;line-height:1.5'>Grace Church of Greenwich</B>");
	winContent.push("</td></tr><tr><td>");
	winContent.push("<B><I style='font-size:13px;font-family:Arial,sans-serif;line-height:1.5'>" +title+ "</I></B>");
	winContent.push("</td></tr><tr><td>");
	winContent.push("<br><I style='font-size:13px;font-family:Arial,sans-serif;line-height:1.5'>Speaker: " +speaker+ "</I>");
	winContent.push("</td></tr><tr><td>");
	winContent.push("<I style='font-size:13px;font-family:Arial,sans-serif;line-height:1.5'>Passage: "+ passage +"</I>");
	winContent.push("</td></tr><tr align='center'><td>");
	winContent.push("<OBJECT width='430' height='42'>");
	winContent.push("<param name='SRC'  value='" + soundfilepath + "'>");
	winContent.push("<param name='AUTOPLAY' VALUE='true'>");
	winContent.push("<param name='CONTROLLER' VALUE='true'>");
	winContent.push("<param name='BGCOLOR' VALUE='#c7d7d7'>");
	winContent.push("<EMBED SRC='" + soundfilepath + "' AUTOSTART='TRUE' LOOP='FALSE' WIDTH='430' HEIGHT='42' CONTROLLER='TRUE' BGCOLOR='#c7d7d7'></EMBED>");
	winContent.push("</OBJECT>");
	winContent.push("</td></tr><tr><td>");
	winContent.push("<p style='font-size:12px;font-family:Verdana,sans-serif;text-align:center'>");
	winContent.push("<a href='" + soundfilepath +"'>Download this file</a>");
	winContent.push("<SPAN style='font-size:10px'><br>(right-click & choose Save Target As...)</SPAN>");
	winContent.push("</p><FORM><DIV align='center'><INPUT type='button' value='Close this window' onclick='javascript:window.close();'>");
	winContent.push("</DIV></FORM></td></tr></table></BODY></HTML>");	
	
	playWin.document.write(winContent.join("")); 
	playWin.document.close(); // "Finalizes" new window 
	uniqueID = uniqueID + 1 // newWinOffset = newWinOffset + 20 // subsequent pop-ups will be this many pixels lower 
} 

