﻿// Pop-Up Embedder Script by David Battino, www.batmosphere.com
// Version 2006-05-31  
// OK to use if this notice is included
// BJ adapted for Proyor Center 4/08
// Mainly colors and appearance
// PC logo changed 10/08
   
function BatmoPCAudioPop(filedesc,filepath,WindowNumber) 
{

// 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 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
// changed page title and removed variable + filedesc + because no metadata exists. BJ 4/08
if (visitorOS != "Windows") { 
objTypeTag = mimeType; // audio/mpeg, audio/x-wav, audio/x-ms-wma, etc.
};

    PlayerWin = window.open('',WindowNumber,'width=350,height=300,top=0,left=0,screenX=0,screenY=0,resizable=0,scrollbars=0,titlebar=0,toolbar=0,menubar=0,status=0,directories=0,top=200,left=200');

    PlayerWin.focus();
    PlayerWin.document.writeln("<html><head><title>Pryor Center Interview (Audio)</title></head>");
    PlayerWin.document.writeln("<body bgcolor='#000000' link='#FFFFFF' vlink='#FFFFFF' hover='#DDDDDD' alink='FFFFFF'>"); // specify background img if desired
	PlayerWin.document.writeln("<p><img src='/specialcollections/pryorcenter/images/PCLogo50px.png' title='Pryor Center Logo' alt='Pryor Center Logo' align='right' height='50' width='69'></p><p>&nbsp;</p>");
	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;align:center;'><img src='/specialcollections/pryorcenter/images/headphoneicon.gif' title='Download' alt='Download' border='none'><a href='" + filepath +"'>Download Entire Interview</a></p>");
    PlayerWin.document.writeln("<form><div align='center'><input type='image' value='Close this window' onclick='javascript:window.close();' src='../../images/closewindow.gif' alt='Close this Window'></div></form>");
    PlayerWin.document.writeln("</body></html>");

    PlayerWin.document.close(); // "Finalizes" new window
}
