function jp(s, a) {
	if (a == 1) {
		i = s.indexOf("index.html");
		if (i >= 0) {s = s.replace("index","index_jp");}

		i = s.indexOf("top.html");
		if (i >= 0) {s = s.replace("top","top_jp");}
	}
	else {
		i = s.indexOf("index_jp.html");
		if (i >= 0) {s = s.replace("index_jp","index");}

		i = s.indexOf("top_jp.html");
		if (i >= 0) {s = s.replace("top_jp","top");}
	}
	return(s);
}

function switchLang(l, i) {
	i = i.split(".html");
	i = i[0].substr(0, i[0].length - 2);
	i = i + l + ".html";
	return(i);
}

function selectLang(lang) {
	if (self.name == "menu") {
		menu = parent.frames[0].location.href;
		menu = switchLang(lang, menu);
		if (lang == "jp") {
			index = "http://members.aol.com/hisakyu/top.html";
		}
		else {
			index = "http://members.aol.com/hisakyu/top_" + lang + ".html";
		}
		parent.frames[0].location.href = menu;
		parent.frames[1].location.href = index;
	}
	else if (self.name == "main") {
		menu = "http://members.aol.com/hisakyu/menu_" + lang + ".html";
		index = parent.frames[1].location.href;

		index = jp(index,1);
		index = switchLang(lang, index);
		index = jp(index,2);

		parent.frames[0].location.href = menu;
		parent.frames[1].location.href = index;
	}
	else {
		index = self.location.href;
		index = jp(index,1);
		index = switchLang(lang, index);
		index = jp(index,2);
		self.location.href = index;
	}
}