function WilsonPlayer(filedesc,filepath,WindowNumber,QTInstalled) 
{

// 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";
}

(PluginDetect.isMinVersion('QuickTime', '0') >= 0 ? 'true' : 'false')

// 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 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"};
if (theExtension.toLowerCase() == "mp4") { mimeType = "video/mp4"};
if (theExtension.toLowerCase() == "wmv") { mimeType = "video/x-ms-wmv"};
// Add additional MIME types as desired
objTypeTag = mimeType;
if (visitorOS != "Windows") { 
objTypeTag = mimeType; // audio/mpeg, audio/x-wav, audio/x-ms-wma, etc.
};

    PlayerWin = window.open('',2,'width=500,height=600,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("<html><head><title>SBC Video Player</title></head>");
    PlayerWin.document.writeln("<body background='http://www.saintfieldbaptist.org.uk/images/videoBG.jpg'>"); // specify background img if desired
    PlayerWin.document.writeln("<div align='center'>");
	if (QTInstalled == 'false'){
	PlayerWin.document.writeln("<p style='font-size:12px;font-family:Arial, Helvetica, sans-serif;text-align:center'><a href='http://www.apple.com/quicktime/download/' target='_blank'>Quicktime is needed to watch our sermons, click here to download</a> <span style='font-size:10px'></span></p>");} else {
    PlayerWin.document.writeln("<center><b style ='font-size:18px;font-family:Arial, Helvetica, sans-serif;line-height:1.6'>" + filedesc + "</b><br />");
	PlayerWin.document.writeln("<p style='font-size:12px;font-family:Arial, Helvetica, sans-serif;text-align:center'>If you see the 'Q' logo, please be patient.</br> If you are having problems ensure that you have the latest version of Quicktime installed.</br> If you have a slow internet connection please pause the video and let it buffer.<span style='font-size:10px'></span></p>");
    PlayerWin.document.writeln("<object width='330' height='270'>");
    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='330' height='270' controller='1' showstatusbar='1' bgcolor='#9999ff' kioskmode='true'>");
    PlayerWin.document.writeln("</embed></object></div>");
    PlayerWin.document.writeln("<p style='font-size:12px;font-family:Arial, Helvetica, sans-serif;text-align:center'><a href='" + filepath +"'>Download this file</a> <span style='font-size:10px'></span></p>");}
    PlayerWin.document.writeln("<form><div align='center'><input type='button' value='Close this window' onclick='javascript:window.close();'></center></div></form>");

    PlayerWin.document.writeln("</body></html>");

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

