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" || self.name == "main") {
		menu = parent.frames[0].location.href;
		index = parent.frames[1].location.href;

		menu = switchLang(lang, menu);

		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;
	}
}