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

function openTV(bw,videoFN) {
	
	if (tvWin != null)	{
		if (tvWin.closed == false)	{
			tvWin.close();
		}
	}

	if(bw=='low')	{
		theWidth=430;
		theHeight=260;
	}
	else	{
		theWidth=580;
		theHeight=347;
	}
	theURL = "../video/tv_" + bw + ".html?" + videoFN;
	
	if (tvWin) {
		if(tvWin.closed==false) {
			tvWin.focus();
		}
		else	{
			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()
		}
	}
}

// Open Link Window

function openLinkPopUp() {
	var theParameters = new Array(
		'theURL',
		'popupWidth',
		'popupHeight',
		'popupScroll',
		'popupResize',
		'popupLeft');
		
	for (i=0; i < (openLinkPopUp.arguments.length); i++) {
		theVar = theParameters[i];
		theValue = openLinkPopUp.arguments[i];
		eval(theVar + "= theValue");
	}

	if (otherWinP) {
		if(otherWinP.closed==false) {
			otherWinP.close();
		}
	otherWinP=opendetails(theURL,popupWidth,popupHeight,popupScroll,popupResize,popupLeft,'1','popInfoP');
	}
	else	{
	otherWinP=opendetails(theURL,popupWidth,popupHeight,popupScroll,popupResize,popupLeft,'1','popInfoP')
	}
}