
// Pharaoh Studios embedded player script based on:
// Pop-Up Embedder Script by David Battino, www.batmosphere.com
// Version 2006-05-31  
// OK to use if this notice is included
   
function BWPopupPlayer(songTitle,songCopyright,songPath,songImg,winNum) 
{

// 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 fType = songPath.substr(songPath.lastIndexOf('.')+1, 3); // truncates .aiff to aif
if (fType.toLowerCase() == "wav") { mimeType = "audio/x-wav"};
if (fType.toLowerCase() == "aif") { mimeType = "audio/x-aiff"}; 
if (fType.toLowerCase() == "wma") { mimeType = "audio/x-ms-wma"};
if (fType.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.
};

    pWin = window.open('',winNum,'width=350,height=217,top=0,left=0,screenX=0,screenY=0,resizable=0,scrollbars=0,titlebar=0,toolbar=0,menubar=0,status=0,directories=0');

    pWin.focus();
    pWin.document.writeln("<html><head><title>" + songTitle + "</title>");
    pWin.document.writeln("<style type='text/css'>");
    pWin.document.writeln("<!--");
    pWin.document.writeln(".tiny { font-family: Arial, Helvetica, sans-serif; font-size: xx-small; font-style: normal; font-weight: normal; color: #CC9966;}");
    pWin.document.writeln("--> </style></head>");

    pWin.document.writeln("<body bgcolor='#000000'>"); // specify background img if desired

    pWin.document.writeln("<table width='328' height='178' border='0' align='left' cellpadding='0' cellspacing='0'>");
    pWin.document.writeln("<tr>");
    pWin.document.writeln("<td width='44%' height='112' align='left' valign='top'><img src='../images/pharaoh%20sudios.gif' width='140' height='68'></td>");
    pWin.document.writeln("<td width='40%' align='center' valign='top'><img src='../" + songImg + "' width='100' height='100'></td>");
    pWin.document.writeln("<td width='16%' align='right' valign='top'>");
    pWin.document.writeln("<a href='javascript:window.close();' title='Close This Window'>");
    pWin.document.writeln("<img src='../images/close-win.gif' width='14' height='14' border='0'></a></td></tr>");

    pWin.document.writeln("<td height='47' colspan='3' align='center' valign='top'>");

    pWin.document.writeln("<object width='280' height='69'>");
    pWin.document.writeln("<param name='src' value='" +  songPath + "'>");
    pWin.document.writeln("<param name='type' value='" + objTypeTag + "'>");
    pWin.document.writeln("<param name='autostart' value='1'>");
    pWin.document.writeln("<param name='showcontrols' value='1'>"); 
    pWin.document.writeln("<param name='showstatusbar' value='1'>");
    pWin.document.writeln("<embed src ='" + songPath + "' type='" + objTypeTag + "' autoplay='true' width='280' height='69' controller='1' showstatusbar='1' bgcolor='#9999ff' kioskmode='true'>");
    pWin.document.writeln("</embed></object>");

    pWin.document.writeln("</td></tr><tr><td height='19' colspan='3' align='center' valign='top'><span class='tiny'>" +
    songTitle + songCopyright + " </span></td></tr>");

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

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

