// for the popup player code
var popupWin = null;

function pausecomp(millis)
{
	var date = new Date();
	var curDate = null;
	
	do { curDate = new Date(); }
	while(curDate-date < millis);
} 

function openPopup() {
	var url = "playa.jsp";
	if( !popupWin || popupWin.closed ) {
		popupWin = window.open( url, "popupWin", "width=420,height=170,directories=no,resizable=no,status=no,scrollbars=no,toolbar=no" );
	} else popupWin.focus();	    
}

	
function addSong(file, song) {
	var f = file;
	var s = song;
	var temp = null;
	if( popupWin && !popupWin.closed ) {
		// The popup is open so call it
		popupWin.addItem(f, s);
		popupWin.focus();
	} else {
		// The popup is closed so open it
		temp = openPopup();
		
		// The popup is open so call it
		pausecomp(200);
		popupWin.addItem(f, s);
		popupWin.focus();		
	}	 
}
