function showHelp4(titleStr, str0, str1, str2, str3)
{
  var nmax = 4;
  var helpStr = new Array(nmax);
  helpStr[0] = str0;
  helpStr[1] = str1;
  helpStr[2] = str2;
  helpStr[3] = str3;

  showHelpN(titleStr, nmax, helpStr);
}

function showHelp3(titleStr, str0, str1, str2)
{
  var nmax = 3;
  var helpStr = new Array(nmax);
  helpStr[0] = str0;
  helpStr[1] = str1;
  helpStr[2] = str2;

  showHelpN(titleStr, nmax, helpStr);
}

function showHelp1(titleStr, str)
{
  var nmax = 1;
  var helpStr = new Array(nmax);
  helpStr[0] = str;

  showHelpN(titleStr, nmax, helpStr);
}

function showHelpN(titleStr, nmax, helpStr)
{
  var chkB = chkBrowser();
  var DTAG = 'DIV';
  if (chkB == B_NN4)
	DTAG = 'LAYER';

  var preHtml =
	'<HTML>\n' +
	'<HEAD>\n' +
	'<LINK rel="stylesheet" href="MathControl.css">\n' +
    '<TITLE> ' + titleStr + ' </TITLE>\n';

  var scriptHtml =
	'var nmax = ' + nmax + ';\n' +
	'var helpStr = new Array(nmax);\n';
    
  var i;
  for (i=0; i<nmax; i++)
  {
     scriptHtml +=
	   'helpStr[' + i + '] = "' + helpStr[i] + '";\n';
  }

  scriptHtml +=
	'function showHelp(ix)\n' +
	'{\n';


		if (chkB == B_NN4)
		{
			scriptHtml += 
			'	showHelp2(helpStr, nmax, ix, document.helpDesc, document.prevHelp, document.nextHelp);\n';
		}
		else if (chkB == B_IE4)
		{
			scriptHtml += 
			'	showHelp2(helpStr, nmax, ix, document.all.helpDesc, document.all.prevHelp, document.all.nextHelp);\n';
		}
		else
		{
			scriptHtml += 
			'	showHelp2(helpStr, nmax, ix, document.getElementById("helpDesc"),\n' +
			'			  document.getElementById("prevHelp"), document.getElementById("nextHelp"));\n';
		}

	scriptHtml += 
	'}\n';

	if (document.layers)
	{
	  scriptHtml += 
		'function initLayerPos(layerObj, markerObj)\n' +
		'{\n' +
		'  layerObj.left  = markerObj.x;\n' +
		'  layerObj.top   = markerObj.y - 14;\n' +
		'}\n' +

		'function writeNN4Div(dObj, str)\n' +
		'{\n' +
		'  with (dObj) {\n' +
		'	document.open();\n' +
		'	document.write(str);\n' +
		'	document.close();\n' +
		'  }\n' +
		'}\n';
	}

	scriptHtml += 
	'function showHelp2(hStr, nmax, ix, hdObj, phObj, nhObj)\n' +
	'{\n' +
	'  var nextLink = "";\n' +
	'  var prevLink = "";\n';
    if (nmax > 1)
    {
	  scriptHtml += 
	    '  if ((ix+1) < nmax)\n' +
	    '  {\n' +
	    '	var ixN = ix + 1;\n' +
	    '	nextLink = \'<a href="#" OnClick="showHelp(\' + ixN + \');return false;"> Next Step </a>\';\n' +
	    '  }\n' +
	    '  if (ix > 0)\n' +
	    '  {\n' +
	    '	var ixP = ix - 1;\n' +
	    '	prevLink = \'<a href="#" OnClick="showHelp(\' + ixP + \');return false;"> Previous Step </a>\';\n' +
	    '  }\n';
    }

	if (document.layers)
	{
	  scriptHtml += 
		'writeNN4Div(hdObj, hStr[ix]);\n' +
		'writeNN4Div(phObj, prevLink);\n' +
		'writeNN4Div(nhObj, nextLink);\n';
	}
	else
	{
	  scriptHtml += 
		'hdObj.innerHTML = hStr[ix];\n' +
		'phObj.innerHTML = prevLink;\n' +
		'nhObj.innerHTML = nextLink;\n';
	}

	scriptHtml += 
	'}\n';

	scriptHtml += 
	'function initLayers()\n' +
	'{\n';

	if (document.layers)
	{
	  scriptHtml += 
		'	initLayerPos(document.closeWin, document.clMarker);\n' +
		'	initLayerPos(document.prevHelp, document.phMarker);\n' +
		'	initLayerPos(document.nextHelp, document.nhMarker);\n' +
		'	initLayerPos(document.helpDesc, document.hdMarker);\n';
	}

	scriptHtml += 
	'}\n';

  var postHtml =
	'<\/HEAD>\n' +
	'<BODY onLoad="initLayers();showHelp(0)">\n' +
	'  <TABLE BORDER=0  CELLSPACING=4 ALIGN=LEFT>\n' +
	'	<tr>\n' +
	'	  <td>\n' +
	'		<img NAME="clMarker" SRC="images/1x1.gif" WIDTH="130" HEIGHT="1">\n' +
	'		<' + DTAG + ' ID="closeWin"> <a href="#" OnClick="window.close();return false;">Close this window<\/a><\/' + DTAG + '>\n' +
	'	  </td>\n' +
	'	  <td>\n' +
	'		<img NAME="phMarker" SRC="images/1x1.gif" WIDTH="100" HEIGHT="1">\n' +
	'		<' + DTAG + ' ID="prevHelp"> Previous Step <\/' + DTAG + '>\n' +
	'	  </td>\n' +
	'	  <td>\n' +
	'		<img NAME="nhMarker" SRC="images/1x1.gif" WIDTH="1" HEIGHT="1">\n' +
	'		<' + DTAG + ' ID="nextHelp"> Next Step <\/' + DTAG + '>\n' +
	'	  </td>\n' +
	'	</tr>\n' +
	'  </TABLE>\n' +

	'<BR><BR><BR>\n';

    if (chkB == B_NN4)
    {
        postHtml +=
	    '  <img NAME="hdMarker" SRC="images/1x1.gif" WIDTH="1" HEIGHT="800">\n';
    }
    else
    {
        postHtml +=
	    '  <img NAME="hdMarker" SRC="images/1x1.gif" WIDTH="1" HEIGHT="1">\n';
    }

    postHtml +=
	' <' + DTAG + ' ID="helpDesc"> HD &nbsp;&nbsp;&nbsp; <\/' + DTAG + '>\n' +

	'<\/BODY>\n' +
	'<\/HTML>';

  // var winprops = "toolbar=no,innerHeight=500,innerWidth=400,resizable,alwaysRaised";
  // var winprops = "scrollbars=yes,toolbar=no,height=500,width=400,resizable,alwaysRaised";
  var hwin = window.open('','showHelp', 'scrollbars=yes,toolbar=no,height=500,width=400,resizable,alwaysRaised');
  with (hwin.document) {
	writeln(preHtml); 
	writeln('<SCRIPT LANGUAGE="JavaScript">'); 
	writeln(scriptHtml); 
	writeln('<\/SCRIPT>');
	writeln(postHtml); 
	close(); 
  }
}
