// Set a few variables

var otherWin = null;
var otherWinP = null;
var tvWin = null;
var popupWidth=425;
var popupHeight=400;
var popupScroll='no';
var popupResize='yes';
var popupLeft='1';

// ----------------------------------------------------------------------------
// Open other popups

function openPopUp() {
	var theParameters = new Array(
		'theURL',
		'popupWidth',
		'popupHeight',
		'popupScroll',
		'popupResize',
		'popupLeft');
		
	for (i=0; i < (openPopUp.arguments.length); i++) {
		theVar = theParameters[i];
		theValue = openPopUp.arguments[i];
		eval(theVar + "= theValue");
	}

	if (otherWin) {
		if(otherWin.closed==false) {
			otherWin.close();
		}
	otherWin=opendetails(theURL,popupWidth,popupHeight,popupScroll,popupResize,popupLeft,'1','popInfo');
	}
	else	{
	otherWin=opendetails(theURL,popupWidth,popupHeight,popupScroll,popupResize,popupLeft,'1','popInfo')
	}
}

// ----------------------------------------------------------------------------
// Open TV Popup; takes arguments bw (bandwidth) and video filename

var tvFlag;

function openTV(bw,videoFN) {
	
	if (tvWin != null)	{
		
		if (tvWin.closed == false)	{
			tvWin.close();
			tvFlag="closed";
		}
	}

	if(bw=='low')	{
		theWidth=430;
		theHeight=300;
	}
	else	{
		theWidth=580;
		theHeight=390;
	}
	theURL = "video/tv_" + bw + ".html?" + videoFN;
	
	if (tvWin) {

		if(tvWin.closed==false && tvFlag!="closed") {
			
			tvWin.focus();
		}
		else	{
			tvFlag="";
			tvWin = opendetails(theURL,theWidth,theHeight,'no','no','150','1','theTV');
		}
	}
	else	{
	
		tvWin = opendetails(theURL,theWidth,theHeight,'no','no','150','1','theTV');
	}
	//openedRadio = true;
}

// ----------------------------------------------------------------------------
// Open detail window

function opendetails(theURL,popupWidth,popupHeight,scrollBars,resizable,left,top,windowName)	{
	detailswin = null;
	detailsDetails = 'scrollbars=' + scrollBars + ',resizable=' + resizable + ',width=' + popupWidth + ',height=' + popupHeight +  ',left=' + left + ',top=' + top;
	detailswin=window.open(theURL,windowName,detailsDetails);
	detailswin.focus();
	return (detailswin);
}

function closePopUp(theWin)	{
	if (theWin) {
		if(theWin.closed==false) {
			theWin.close()
		}
	}
}

