function MediaPop(filedesc,filepath,WindowNumber,med_type,win_width,win_height,med_width,med_height,html_text) 
{

// Get Operating System 
var isWin = navigator.userAgent.toLowerCase().indexOf("windows") != -1
if (isWin) {
    // Use MIME type = "application/x-mplayer2";
	visitorOS="Windows";
} else {
    // Use MIME type = "audio/mpeg"; // or audio/x-wav or audio/x-ms-wma, etc.
	visitorOS="Other";
}

// Get the MIME type of the audio file from its extension (for non-Windows browsers)
var mimeType = "audio/mpeg"; // assume MP3/M3U
var objTypeTag = "application/x-mplayer2"; // The Windows MIME type to load the WMP plug-in in Firefox, etc.
var myarray = html_text.split(",");

if (med_type=='video') {
	if (!win_width)
		win_width = 800;
	if (!win_height)
		win_height = 720;
	if (!med_width)
		med_width = 720;
	if (!med_height)
		med_height = 530;

	PlayerWin = window.open('',WindowNumber,'width='+win_width+',height='+win_height+',top=0,left=0,screenX=0,screenY=0,resizable=0,scrollbars=0,titlebar=0,toolbar=0,menubar=0,status=0,directories=0');

	PlayerWin.focus();
	PlayerWin.document.writeln("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">");
	PlayerWin.document.writeln("<html><head><title>" + filedesc + "</title><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'></head>");
	PlayerWin.document.writeln("<body bgcolor='#FFFFEC'>"); // specify background img if desired
	PlayerWin.document.writeln("<table><tr><td><div align='center'>");
	PlayerWin.document.writeln("<b style ='font-size:18px;font-family:Lucida,sans-serif;line-height:1.6'>" + filedesc + "</b><br />");
	
	PlayerWin.document.writeln("<object NAME='Player' WIDTH='"+med_width+"' HEIGHT='"+med_height+"' align='left' hspace='10' type='application/x-oleobject' CLASSID='CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6'>");
	PlayerWin.document.writeln("<param NAME='URL' VALUE='"+filepath+"'><param>");
	PlayerWin.document.writeln("<param NAME='AUTOSTART' VALUE='true'></param>");
	PlayerWin.document.writeln("<param name='showControls' value='true'></param>");
	PlayerWin.document.writeln("<embed WIDTH='"+med_width+"' HEIGHT='"+med_height+"' align='left' hspace='10' SRC='"+filepath+"' TYPE='application/x-oleobject' AUTOSTART='true'>");
	PlayerWin.document.writeln("</embed></object></div></td></tr>");
	PlayerWin.document.writeln("<tr><td>&nbsp;</td></tr><tr><td><p style='font-size:12px;font-family:Lucida,sans-serif;text-align:center'><a href='" + filepath +"'>" + myarray[0] + "</a> <span style='font-size:10px'>(" + myarray[1] + ")</span></p></td></tr>");
	PlayerWin.document.writeln("<tr><td><form><div align='center'><input type='button' value='" + myarray[2] +"' onclick='javascript:window.close();'></div></form></td></tr></table>");
	PlayerWin.document.writeln("</body></html>");

	PlayerWin.document.close(); // "Finalizes" new window
}
else {

	var theExtension = filepath.substr(filepath.lastIndexOf('.')+1, 3); // truncates .aiff to aif
	if (theExtension.toLowerCase() == "wav") { mimeType = "audio/x-wav"};
	if (theExtension.toLowerCase() == "aif") { mimeType = "audio/x-aiff"}; 
	if (theExtension.toLowerCase() == "wma") { mimeType = "audio/x-ms-wma"};
	if (theExtension.toLowerCase() == "mid") { mimeType = "audio/mid"};
	// Add additional MIME types as desired

	if (visitorOS != "Windows") { 
	objTypeTag = mimeType; // audio/mpeg, audio/x-wav, audio/x-ms-wma, etc.
	};

	    PlayerWin = window.open('',WindowNumber,'width=320,height=237,top=0,left=0,screenX=0,screenY=0,resizable=0,scrollbars=0,titlebar=0,toolbar=0,menubar=0,status=0,directories=0');

	    PlayerWin.focus();
	    PlayerWin.document.writeln("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">");
	    PlayerWin.document.writeln("<html><head><title>" + filedesc + "</title><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'></head>");
	    PlayerWin.document.writeln("<body bgcolor='#FFFFEC'>"); // specify background img if desired
	    PlayerWin.document.writeln("<div align='center'>");
	    PlayerWin.document.writeln("<b style ='font-size:18px;font-family:Lucida,sans-serif;line-height:1.6'>" + filedesc + "</b><br />");
	    PlayerWin.document.writeln("<object width='280' height='69'>");
	    PlayerWin.document.writeln("<param name='src' value='" +  filepath + "'>");
	    PlayerWin.document.writeln("<param name='type' value='" + objTypeTag + "'>");
	    PlayerWin.document.writeln("<param name='autostart' value='1'>");
	    PlayerWin.document.writeln("<param name='showcontrols' value='1'>"); 
	    PlayerWin.document.writeln("<param name='showstatusbar' value='1'>");
	    PlayerWin.document.writeln("<embed src ='" + filepath + "' type='" + objTypeTag + "' autoplay='true' width='280' height='69' controller='1' showstatusbar='1' bgcolor='#9999ff' kioskmode='true'>");
	    PlayerWin.document.writeln("</embed></object></div>");
	    PlayerWin.document.writeln("<p style='font-size:12px;font-family:Lucida,sans-serif;text-align:center'><a href='" + filepath +"'>" + myarray[0] + "</a> <span style='font-size:10px'>(" + myarray[1] + ")</span></p>");
	    PlayerWin.document.writeln("<form><div align='center'><input type='button' value='" + myarray[2] + "' onclick='javascript:window.close();'></div></form>");
	    PlayerWin.document.writeln("</body></html>");

	    PlayerWin.document.close(); // "Finalizes" new window
	}

}
