// JS

var UniqueID = 932 // Make each link open in a new window
var newWinOffset = 20 // Position of first pop-up

function AudioPlayer(soundfiletitle,soundfiledesc,performer,soundfilepath,kioskmode)
{
	PlayerOpen(soundfiletitle,soundfiledesc,performer,soundfilepath,kioskmode,460,130+80,380,16);
}

function VideoPlayer(soundfiletitle,soundfiledesc,performer,soundfilepath,kioskmode)
{
	PlayerOpen(soundfiletitle,soundfiledesc,performer,soundfilepath,kioskmode,320+20+10,120+240+80,320,240+16);
}

function PlayerOpen(soundfiletitle,soundfiledesc,performer,soundfilepath,kioskmode,window_width,window_height,player_width,player_height)
{
	PlayWin = window.open('',UniqueID,'width=' + window_width + ',height=' + window_height + ',top=' + newWinOffset +',left=20,resizable=1,scrollbars=0,titlebar=0,toolbar=0,menubar=0,status=0,directories=0,personalbar=0');
	PlayWin.resizeTo(window_width,window_height);
	PlayWin.focus();
	
	var winContent = "";
	
	winContent += "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\n";
    winContent += "\t\"http://www.w3.org/TR/html4/loose.dtd\">\n";
        
    winContent += "<html>\n";
	winContent += "<head>\n";
	winContent += "\t<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">\n";
	winContent += "\t<title>" + soundfiletitle + "</title>\n"
	winContent += "\t<link href=\"audiopopstyle.css\" rel=\"stylesheet\" type=\"text/css\">\n";
	winContent += "</head>\n<body>\n";
	
	var kmode;
	if (kioskmode)
		kmode = "true";
	else
		kmode = "false";

	winContent += "<p>\n\t<b><em>" + soundfiletitle + "</em></b>\n\t<br>\n\t" + soundfiledesc + "\n</p>\n";
	winContent += "<p>\n\t" + performer + "\n</p>\n";
	
	winContent += "<object classid=\"clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B\" codebase=\"http://www.apple.com/qtactivex/qtplugin.cab\" height=\"" + player_height + "\" width=\"" + player_width +"\">";
	winContent += "\t<param name=\"src\" value=\"" + soundfilepath + "\">\n";
	winContent += "\t<param name=\"autoplay\" value=\"true\">\n";
	winContent += "\t<param name=\"controller\" value=\"true\">\n";
	winContent += "\t<param name=\"kioskmode\" value=\"" + kmode + "\">\n";
	winContent += "\t<embed src=\"" + soundfilepath + "\" pluginspage=\"http://www.apple.com/quicktime/download/\" type=\"video/quicktime\" controller=\"true\" autoplay=\"true\" kioskmode=\"" + kmode + "\" height=\"" + player_height + "\" width=\"" + player_width + "\">\n";
	winContent += "</object>\n";
	
	winContent += "</body>\n</html>\n";
	
	PlayWin.document.write(winContent);
	PlayWin.document.close(); // "Finalizes" new window
	//UniqueID = UniqueID + 1;
	//newWinOffset = newWinOffset + 20; // subsequent pop-ups will be this many pixels lower
}
