
// Last updated:  11.16.05

// 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_title = 'Investors United :: Audio Clip';
//var no_desc = 'Investors United :: Audio Clip';
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;

// var pop_bgcolor = '#ffffff'; // doesn't seem to work as a var

//var winContent = '';

function PlayerOpen(page_title,soundfiledesc,soundfilepath) {

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

		if (navigator.platform == "MacPPC") {
		
			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 background='images/sm_bkgd_04.gif' bgcolor='#ffffff'>";
			
			winContent += "<FORM><DIV align='center'><INPUT type='image' src='images/close_win02.gif' value='Close this window' onclick='javascript:window.close();'></DIV></FORM>"; 
			
			winContent += "<div align='center' style='color:#999999;font-size:12px;font-family:Verdana, Arial, Helvetica, sans-serif;'>" + soundfiledesc + "<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 += "<style type='text/css'>";
			winContent += ".changestyle {color: #009933;}";
			winContent += ".changestyle a:link{color: #009933;}";
			winContent += ".changestyle a:hover{color: #004E1A;}</style>";
			
//			winContent += "<p class='changestyle' style='color:#999999;font-size:11px;font-family:Verdana, Arial, Helvetica, sans-serif;text-align:center'><a class='changestyle' href='" + soundfilepath +"'>Download this file</a> <span style='font-size:10px'>(right-click or Option-click)</SPAN></p>";

			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 background='images/sm_bkgd_04a.gif' bgcolor='#ffffff'>"; 
			
			winContent += "<DIV align='center' style='margin-bottom:6px;'><img src='images/close_win02.gif' alt='Close this window' onclick='javascript:window.close();'></DIV>"; 
			
			winContent += "<div align='center' style='color:#999999;font-size:12px;font-family:Verdana, Arial, Helvetica, sans-serif;'>" + soundfiledesc + "<br /><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 += "<style type='text/css'>";
			winContent += ".changestyle {color: #009933;}";
			winContent += ".changestyle a:link{color: #009933;}";
			winContent += ".changestyle a:hover{color: #004E1A;}</style>";
			
//			winContent += "<p class='changestyle' style='color:#999999;font-size:11px;font-family:Verdana, Arial, Helvetica, sans-serif;text-align:center'><a class='changestyle' href='" + soundfilepath +"'>Download this file</a> <span style='font-size:10px'>(right-click or Option-click)</SPAN></p>";

			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
				
		}
	}
}