
// Last updated:  7.21.10

// Known issues:
// MAC OS X - 10.3.9
// Safari (1.3) - 1) will not display page_title var, 2) allows popWin to resize
// Firefox (1.0.6) opens FULL SIZE window after "no clip" alert.

var no_path = '* There is no audio clip for this selection. *';


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


winWidth='380';
winHeight='200';

// for IE - PC dislay:
winTop='150';
winLeft=(winTop * 2);


var screenPosX,screenPosY;
    screenPosX = (screen.availWidth - winWidth) / 2;
    screenPosY = (screen.availHeight - winHeight) / 2;


function PlayerOpen(page_title,soundfiledesc,soundfilepath) {

	if ( (!page_title) && (!soundfiledesc) ) {
		winContent += alert(no_path);
		return false;
	}
	
	else {

		if (navigator.platform == "MacPPC" || navigator.platform == "MacIntel") {
		
			PlayWin = window.open('',UniqueID,'resizable=0,scrollbars=0,titlebar=0,toolbar=0,menubar=0,status=0,directories=0,personalbar=0,width='+winWidth+',height='+winHeight+',screenX='+screenPosX+',screenY='+screenPosY);
			PlayWin.focus();
			
			var winContent = "<HTML><HEAD><TITLE>" + page_title + "</TITLE></HEAD><BODY bgcolor='#ffffff'>";
			
			winContent += "<div align=\"center\" style=\"padding-bottom:18px;\"><a href=\"javascript:window.close();\" style=\"color:#8b302e;text-decoration:underline;font-size:18px;\" title=\"close\"><strong>close</strong></a></div>"; 
			
			winContent += "<div align='center' style='color:#000;font-size:14px;font-family:Arial, Helvetica, sans-serif;'><strong>" + soundfiledesc + "</strong><br />";
			
			winContent += "<OBJECT width='300' height='120'>"; 
			winContent += "<param  name='SRC' value='" + soundfilepath + "'>";
			winContent += "<param name='AUTOPLAY' VALUE='true'>"; 
			winContent += "<param name='CONTROLLER' VALUE='true'>";
			winContent += "<param  name='BGCOLOR' VALUE='#ffffff'>"; 
			winContent += "<EMBED  SRC='" + soundfilepath + "'  AUTOSTART='TRUE' LOOP='FALSE' WIDTH='300' HEIGHT='120' CONTROLLER='TRUE' BGCOLOR='#ffffff'></EMBED>";
			winContent += "</OBJECT>"; 
			
			winContent += "</div></BODY></HTML>"; 
			
			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
		}
			
		else {
				
			PlayWin = window.open('',UniqueID,'resizable=0,scrollbars=0,titlebar=0,toolbar=0,menubar=0,status=0,directories=0,personalbar=0,width='+winWidth+',height='+winHeight+',top='+winTop+',left='+winLeft);
			PlayWin.focus(); 
			
			var winContent = "<HTML><HEAD><TITLE>" + page_title + "</TITLE></HEAD><BODY bgcolor='#ffffff'>"; 
			
			winContent += "<div align=\"center\" style=\"padding-bottom:18px;\"><a href=\"javascript:window.close();\" style=\"color:#8b302e;text-decoration:underline;font-size:16px;\" title=\"close\"><strong>close</strong></a></div>"; 
			
			winContent += "<div align='center' style='color:#000;font-size:14px;font-family:Arial, Helvetica, sans-serif;'><strong>" + soundfiledesc + "</strong><br /><br />";
			
			winContent += "<OBJECT width='300' height='46'>"; 
			winContent += "<param  name='SRC' value='" + soundfilepath + "'>";
			winContent += "<param name='AUTOPLAY' VALUE='true'>"; 
			winContent += "<param name='CONTROLLER' VALUE='true'>";
			winContent += "<param  name='BGCOLOR' VALUE='#ffffff'>"; 
			winContent += "<EMBED  SRC='" + soundfilepath + "'  AUTOSTART='TRUE' LOOP='FALSE' WIDTH='300' HEIGHT='46' CONTROLLER='TRUE' BGCOLOR='#ffffff'></EMBED>";
			winContent += "</OBJECT>"; 
			
			winContent += "</div></BODY></HTML>"; 
			
			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
				
		}
	}
}