function isInternal() {
	var re = new RegExp("http://" + window.location.host + "/\\w+/?\\w+\\.html", "i");
	return re.test(document.referrer);
}
function load() {
	if (isInternal()) { main.location.href = document.referrer; }
	else { main.location.href = "main.html"; }
}
function dir() {
	if (isInternal() && (self == top)) top.location.href = "../index.html";
}