function open_window ( s_url, s_name, i_width, i_height, s_param )
{
	if ( i_width <= " " )
	{
		i_width = screen.availWidth;
	}

	if ( i_height <= " " )
	{
		i_height = screen.availHeight;
	}

	s_options =
		"directories=no,location=no,menubar=no,status=no,toolbar=no," +
		"resizable=yes,scrollbars=yes," +
		"width=" + i_width + ",height=" + i_height;

	if ( s_param > " " )
	{
		s_options += "," + s_param;
	}

	w = window.open ( s_url, s_name, s_options );
	w.focus();
}

function open_form ( s_url, s_name, s_params )
{
	s_options = "directories=no,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no";
	if ( s_params > " " )
		s_options += "," + s_params;
	w = window.open ( s_url, s_name, s_options );
	w.focus();
}

function open_content ( s_submenu_item )
{
//	Called from roundtable and research_forum
//	Resolve link to historic report

//	debug_form ();
	s_url	= s_submenu_item + "/";
	f	= document.forms[0];
	e	= f.elements;
	s_dir	= e["select_report"][e["select_report"].selectedIndex].value;
	s_title	= s_submenu_item + ' ' + e["select_report"][e["select_report"].selectedIndex].text;
	s_title	= s_title.replace( / /gi, "+" );

	if ( s_dir == "-1" )
	{
		alert ( "Please choose a report!" );
		return;
	}

	s_radio = e["radio_method"];
	j = s_radio.length;

	for ( i=0; i<j; i++ )
	{
		if ( s_radio[i].checked )
			var s_choice = s_radio[i].value;
	}

	switch ( s_choice )
	{
		case "1":	//	indexed table of contents, frameless
			open_window ( "/angoa/?&action=show_toc&page=" + s_url + s_dir,
				"", screen.availWidth, screen.availHeight,
				"menubar=yes,toolbar=yes,status=yes" );
			break;

		case "2":	//	printer and screen reader-friendly, frameless
			open_window ( "/angoa/?&action=show_doc&page=" + s_url + s_dir,
				"", screen.availWidth, screen.availHeight,
				"menubar=yes,toolbar=yes,status=yes" );
			break;

		default:
			alert ( "Please choose a viewing method!" );
	}

	//	reset select_report
	e["select_report"].selectedIndex = 0;
}

function debug_form ()
{
	f = document.forms[0];
	e = f.elements;
	s_form = "";
	for ( i = 0; i < e.length; i++ )
	{
		fld = e[i];
		s_form += fld.id + "=" + fld.value + "\n";
	}
	alert ( "Action:\n" + f.action + "\n\nFields:\n" + s_form );
}

