/*
JS function for getting variables passed to the current document from
the previous document via an anchor link using the syntax
<a href="viewjs.htm?v1=filename.js&v2=what+ever">filename.js</a>

This mechanism is simpler and less flexible/powerful than the cookie
method (see cookie.js).
*/

function getprev(n)
{
	var allprev = window.location.search;
	if (n == 1)
		return prevar("v1", allprev);
	if (n == 2)
		return prevar("v2", allprev);
}
function prevar(toget, allvars)
{
	var s0 = allvars.indexOf(toget + "=");
	if (s0 == -1)
		return ("ERROR: " + toget + " NOT DEFINED.");
	var s1 = allvars.indexOf("&", s0 + 3);
	if (s1 == -1)
		var result = allvars.substring(s0 + 3);
	else
		var result = allvars.substring(s0 + 3, s1);
	return result;
}

