function splitLocation (locationObject)
{	var x = locationObject.toString()
	var i = x.indexOf("#"); if (i < 0) i = x.length
	var j = x.indexOf("?"); if (j < 0) j = x.length
	var k = Math.min (i, j)
	var y = x.slice(0,k)
	var a = y.split("/")
	var f = a.pop()
	var d = a.join("/") + "/"
	return [d,f,x.slice(k)]
}
expectedTopFileName = "index.htm"
defaultFirstPage    = "intro.htm"
navigationFrame     = "navig.htm"
titleFrame          = "title.htm"
separatorFrame      = "separ.htm"
standardFiles = [expectedTopFileName,defaultFirstPage,navigationFrame,titleFrame,separatorFrame]
topLocation  = splitLocation (top.location)
selfLocation = splitLocation (self.location)
actualTop    = topLocation.slice(0,2).join("")
expectedTop  = selfLocation[0] + expectedTopFileName
if (actualTop != expectedTop)
{	selfFileName = selfLocation[1]
	for (i = 0, k = -1; k < 0 && i < standardFiles.length; i++) if (selfFileName == standardFiles[i]) k = i;
	selfFileName += selfLocation[2] 
	top.location = expectedTop + (k < 0 ? "?page=" + escape(selfFileName) : "")
}
var pagelist =
	["intro.htm"
	,"romjulgregkal.htm"
	,"nicaea-nl.htm"
	,"liberdepaschate-nl.htm"
	,"beda.htm"
	,"compmagjac.htm"
	,"compendium-nl.htm"
	,"ratcorfast-nl.htm"
	,"intergravissimas-nl.htm"
	,"canon1-nl.htm"
	,"canon2-nl.htm"
	,"canon3-nl.htm"
	,"canon4-nl.htm"
	,"canon5-nl.htm"
	,"canon6-nl.htm"
	,"kalender.htm"
	,"canon7-nl.htm"
	,"motuproprio.htm"
	,"opmat.htm"
	,"explicatio.htm"
	,"links.htm"
	]
function showPageTitle(pageTitle)
{	PAGETITLE = pageTitle
	var e
	var pagefile = splitLocation(parent.hoofd.location)[1], originalfile = pagefile
	if (pagefile == "opmatlarge.htm" ) pagefile = "opmat.htm"
	if (pagefile == "nicaea-bron.htm") pagefile = "nicaea-nl.htm"
	for (var i = 0, k = -1, L = pagelist.length; i < L; i++)
	{	if (pagelist[i] == pagefile)
		{	k = i
			i = L
	}	}
	try
	{	parent.title.titlefield.innerText = PAGETITLE
		if (k < 0)
		{	parent.title.prevfield.innerHTML = ""
			parent.title.nextfield.innerHTML = ""
		} else
		{	var p = (L + k - 1) % L
			var n =     (k + 1) % L
			if (originalfile == "nicaea-bron.htm") p = n = k
			if (pagefile.search(/^canon[1-6]/) == 0)
			{	var x = 0+pagefile.charAt(5)
				p -= x - 1
				n += 6 - x
			}
			parent.title.prevfield.innerHTML = '<a target=hoofd href="'+pagelist[p]+'"><img src=prev.gif border=0 alt="vorige = '  +pagelist[p]
				+String.fromCharCode(13,10)+'(shift + pijl-naar-links-toets werkt ook)"></a>'
			parent.title.nextfield.innerHTML = '<a target=hoofd href="'+pagelist[n]+'"><img src=next.gif border=0 alt="volgende = '+pagelist[n]
				+String.fromCharCode(13,10)+'(shift + pijl-naar-rechts-toets werkt ook)"></a>'
		}
	} catch (e)
	{	setTimeout ("showPageTitle (PAGETITLE)", 100)
	}
}
function shiftKeyDownHandler(evt)
{	if (evt.altKey || evt.ctrlKey) return true;
	if (evt.shiftKey && (evt.keyCode == 37 || evt.keyCode == 39) )
	{	var pagefile = splitLocation(parent.hoofd.location)[1]
		if (pagefile == "opmatlarge.htm" ) pagefile = "opmat.htm"
		if (pagefile == "nicaea-bron.htm") pagefile = "nicaea-nl.htm"
		for (var i = 0, k = -1, L = pagelist.length; i < L; i++)
		{	if (pagelist[i] == pagefile)
			{	k = i
				i = L
		}	}
		if (k < 0) return true
		var p = (L + k - 1) % L
		var n =     (k + 1) % L
		if (pagefile.search(/^canon[1-6]/) == 0)
		{	var x = 0+pagefile.charAt(5)
			p -= x - 1
			n += 6 - x
		}
		if (evt.keyCode == 37) location = pagelist[p]
		if (evt.keyCode == 39) location = pagelist[n]
		event.cancelBubble = true
		return false
	}
	return true
}

