// this is a very old hrlib that has nothing to do with the hrlib.js in the hrlib directory

function fullpath (loc) {
	return loc.href.substr (0, loc.href.length - loc.hash.length - loc.search.length)
}
function directory (loc) {
	var x = fullpath (loc), i = x.length - 1
	while (i >= 0 && x.charAt(i) != '/' && x.charAt(i) != '\\') {i--}
	return i >= 0 ? x.substr(0,i+1) : x
}
function setlocation (filename, frame) {
	var x = directory (location)
	var y = fullpath (top.location)
	var f = filename
	var g = (f == '' ? 'index.htm' : f)
	var p = fullpath (location)
	var q = (frame ? '?frame=' + p.substr(x.length) : '')
	if (y       == x+g) return
	if (y+f     == x+g) return
	if (y+'/'+f == x+g) return
	if (y       == x  ) return
	if (y+'/'   == x  ) return
	var h = location.hash
	var s = location.search
	if (s != '') q = s + '&' + q.slice(1)
	if (h != '') q = h + q
	top.location.replace (x + g + q)
	return
}
function totop    (filename) {setlocation ( (arguments.length == 0 ? '' : filename), 0) }
function toframes (filename) {setlocation ( (arguments.length == 0 ? '' : filename), 1) }

function parameters () {
	var x = location.search.substr(1).split('&')
	for (var i = 0; i < x.length; i++) {
		var z = ''
		for (var k = 0; k < x[i].length; k++) {
			var c = x[i].charAt(k)
			z += (c == '+' ? ' ' : c)
		}
		var y = z.split('=')
		for (var j = 0; j < y.length; j++) {y[j] = unescape (y[j]) }
		x[i] = y
	}
	return x
}
function paramValue (paramArray, paramName) {
	var i = 0
	while (i < paramArray.length && paramArray[i][0] != paramName) {i++}
	return (i == paramArray.length ? '' : paramArray[i][1])
}
