var ie=document.all?1:0
var ns6=document.getElementById&&!document.all?1:0
var opera=window.opera?1:0


function refresh_items(){
}

function switchdisp(subobj) {
	var folder=''
	if (ie||ns6||opera) {
		folder=ns6?document.getElementById(subobj).style:document.all(subobj).style;
		if(folder.display == "none"){
			folder.display="";
      document.getElementById("switch_disp").innerHTML ="<div class=\"btn_close\">閉じる</div>";
		}else{
			folder.display = "none";
      document.getElementById("switch_disp").innerHTML ="<div class=\"btn_open\">すべてを表示</div>";
		}
	}
}

function switchToggle(subobj) {
	var folder=''
	if (ie||ns6||opera) {
		folder = ns6?document.getElementById(subobj).style:document.all(subobj).style;
		if(folder.display == "none"){
			folder.display="";
			document.getElementById("toggle_search").style.backgroundPosition="left bottom";
		}else{
			folder.display = "none";
			document.getElementById("toggle_search").style.backgroundPosition="left top";
		}
	}
}


function switchphrase_jp() {
	var parent=''
	if (ie||ns6||opera) {
		parent=ns6?document.getElementById("p_jp").style:document.all("p_jp").style;
		if(parent.display == "none"){
			parent.display="inline";
			parent.height = "0px";
		      document.getElementById("toggle_jp").innerHTML ="<a href=\"javascript:void(0);\" onclick=\"switchphrase_jp();\" class=\"toggle_close\"><img src=\"/img/common/detail/btn_hide.gif\" alt=\"日本語をかくす\" width=\"115\" height=\"20\" /></a>";
		}else{
			parent.display="none";
			parent.height = "";
		      document.getElementById("toggle_jp").innerHTML ="<a href=\"javascript:void(0);\" onclick=\"switchphrase_jp();\" class=\"toggle_open\"><img src=\"/img/common/detail/btn_open.gif\" alt=\"日本語を表示する\" width=\"115\" height=\"20\" /></a>";
		}
	}
}

var __resource_switchphrase_en = {
	en: {
		img_show: '/img/en/detail/btn_open.gif',
		img_hide: '/img/en/detail/btn_hide.gif',
		alt_show: '英語を表示する',
		alt_hide: '英語をかくす'
	},
	ch: {
		img_show: '/img/ch/detail/btn_open.gif',
		img_hide: '/img/ch/detail/btn_hide.gif',
		alt_show: '中国語を表示する',
		alt_hide: '中国語をかくす'
	},
	ha: {
		img_show: '/img/ha/detail/btn_open.gif',
		img_hide: '/img/ha/detail/btn_hide.gif',
		alt_show: 'ハングルを表示する',
		alt_hide: 'ハングルをかくす'
	}
};

function __get_resource_switchphrase_en(context) {
    var resource = __resource_switchphrase_en[context];
    if (resource) {
        return {c: context, r: resource};
    }
    return __get_resource_switchphrase_en('en'); // fallback-mode
}

function switchphrase_en(context) {
	var resource_set = __get_resource_switchphrase_en(context);
	var resource = resource_set['r']
	context = resource_set['c'];

	var parent=''
	if (ie||ns6||opera) {
		parent=ns6?document.getElementById("p_en").style:document.all("p_en").style;
		if(parent.display == "none"){
			parent.display="inline";
			parent.height = "0px";
			document.getElementById("toggle_en").innerHTML =
				'<a href="javascript:void(0);" onclick="switchphrase_en(\'' + context + '\');" class="toggle_close">' +
				'<img src="' + resource.img_hide + '" alt="' + resource.alt_hide + '" width="115" height="20" /></a>';
		}else{
			parent.display="none";
			parent.height = "";
			document.getElementById("toggle_en").innerHTML =
				'<a href="javascript:void(0);" onclick="switchphrase_en(\'' + context + '\');" class="toggle_open">' +
				'<img src="' + resource.img_show + '" alt="' + resource.alt_show + '" width="115" height="20" /></a>';
		}
	}
}

function switchphrase_en_info(context) {
	var resource_set = __get_resource_switchphrase_en(context);
	var resource = resource_set['r']
	context = resource_set['c'];

	var parent=''
	var voice=''
	if (ie||ns6||opera) {
		parent=ns6?document.getElementById("p_en").style:document.all("p_en").style;
		var voice_element = ns6?document.getElementById("voice"):document.all("voice");
		if (voice_element) voice = voice_element.style;
		if(parent.display == "none"){
			parent.display="inline";
			parent.height = "0px";
			if (voice_element) voice.display = "inline";
			if (voice_element) voice.height = "0px";
			document.getElementById("toggle_en").innerHTML =
				'<a href="javascript:void(0);" onclick="switchphrase_en_info(\'' + context + '\');" class="toggle_close">' +
				'<img src="' + resource.img_hide + '" alt="' + resource.alt_hide + '" width="115" height="20" /></a>';
		}else{
			parent.display="none";
			parent.height = "";
			if (voice_element) voice.display = "none";
			if (voice_element) voice.height = "";
			document.getElementById("toggle_en").innerHTML =
				'<a href="javascript:void(0);" onclick="switchphrase_en_info(\'' + context + '\');" class="toggle_open">' +
				'<img src="' + resource.img_show + '" alt="' + resource.alt_show + '" width="115" height="20" /></a>';
		}
	}
	switchphrase_info();
}

function switchphrase_jp_info() {
	var parent=''
	if (ie||ns6||opera) {
		parent=ns6?document.getElementById("p_jp").style:document.all("p_jp").style;
		if(parent.display == "none"){
			parent.display="inline";
			parent.height = "0px";
		      document.getElementById("toggle_jp").innerHTML ="<a href=\"javascript:void(0);\" onclick=\"switchphrase_jp_info();\" class=\"toggle_close\"><img src=\"/img/common/detail/btn_hide.gif\" alt=\"日本語をかくす\" width=\"115\" height=\"20\" /></a>";
		}else{
			parent.display="none";
			parent.height = "";
		      document.getElementById("toggle_jp").innerHTML ="<a href=\"javascript:void(0);\" onclick=\"switchphrase_jp_info();\" class=\"toggle_open\"><img src=\"/img/common/detail/btn_open.gif\" alt=\"日本語を表示する\" width=\"115\" height=\"20\" /></a>";
		}
	}
	switchphrase_info();
}

function switchphrase_info() {
	var parent=''
	if (ie||ns6||opera) {
		parent=ns6?document.getElementById("p_info").style:document.all("p_info").style;
		if(parent.display == "none"){
			parent.display="inline";
			parent.height = "0px";
			var toggle_info = document.getElementById("toggle_info");
			if (toggle_info) toggle_info.innerHTML ="<a href=\"javascript:void(0);\" onclick=\"switchphrase_info();\" class=\"toggle_close\"><img src=\"/img/en/detail/btn_info_close.gif\" alt=\"解説をかくす\" width=\"115\" height=\"20\" /></a>";
		}else{
			parent.display="none";
			parent.height = "";
			var toggle_info = document.getElementById("toggle_info");
			if (toggle_info) toggle_info.innerHTML ="<a href=\"javascript:void(0);\" onclick=\"switchphrase_info();\" class=\"toggle_open\"><img src=\"/img/en/detail/btn_info_open.gif\" alt=\"解説を表示する\" width=\"115\" height=\"20\" /></a>";
		}
	}
}


function linkpages(){
  obj = document.slctlang.linkselect;
  index = obj.selectedIndex;
  if (index != 0){
    href = obj.options[index].value;
    location.href = href;
  }
}


function phrasePlayer(movie){
document.write("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\"55\" height=\"21\" id=\"phrase_player\" align=\"middle\">");
document.write("<param name=\"allowScriptAccess\" value=\"sameDomain\">");
document.write("<param name=\"movie\" value=\"/swf/phrase_player.swf\">");
document.write("<param name=\"quality\" value=\"high\">");
document.write("<param name=\"wmode\" value=\"transparent\">");
document.write("<param name=\"bgcolor\" value=\"#ffffff\">");

if(movie){
	document.write("<PARAM NAME=\"FlashVars\" VALUE=\"movie="+movie+"\">");
}
document.write("<embed src=\"/swf/phrase_player.swf\" wmode=\"transparent\"");

if(movie){
	document.write("FlashVars=\"movie="+movie+"\"");
}

document.write(" quality=\"high\" bgcolor=\"#ffffff\" width=\"55\" height=\"21\" name=\"phrase_player\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\">");

document.write("</object>");

}


function phrasePlayerList(movie){
document.write("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\"29\" height=\"21\" id=\"phrase_player\" align=\"middle\">");
document.write("<param name=\"allowScriptAccess\" value=\"sameDomain\">");
document.write("<param name=\"movie\" value=\"/swf/phrase_player_list.swf\">");
document.write("<param name=\"quality\" value=\"high\">");
document.write("<param name=\"wmode\" value=\"transparent\">");
document.write("<param name=\"bgcolor\" value=\"#ffffff\">");

if(movie){
	document.write("<PARAM NAME=\"FlashVars\" VALUE=\"movie="+movie+"\">");
}
document.write("<embed src=\"/swf/phrase_player_list.swf\" wmode=\"transparent\"");

if(movie){
	document.write("FlashVars=\"movie="+movie+"\"");
}

document.write(" quality=\"high\" bgcolor=\"#ffffff\" width=\"29\" height=\"21\" name=\"phrase_player\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\">");

document.write("</object>");

}


function phrasePlayerListening(movie){
document.write("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\"157\" height=\"40\" id=\"phrase_player\" align=\"middle\">");
document.write("<param name=\"allowScriptAccess\" value=\"sameDomain\">");
document.write("<param name=\"movie\" value=\"/swf/phrase_player_listening.swf\">");
document.write("<param name=\"quality\" value=\"high\">");
document.write("<param name=\"wmode\" value=\"transparent\">");
document.write("<param name=\"bgcolor\" value=\"#ffffff\">");

if(movie){
	document.write("<PARAM NAME=\"FlashVars\" VALUE=\"movie="+movie+"\">");
}
document.write("<embed src=\"/swf/phrase_player_listening.swf\" wmode=\"transparent\"");

if(movie){
	document.write("FlashVars=\"movie="+movie+"\"");
}

document.write(" quality=\"high\" bgcolor=\"#ffffff\" width=\"157\" height=\"40\" name=\"phrase_player\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\">");

document.write("</object>");

}

function phrasePlayerPronounce(movie){
document.write("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\"160\" height=\"39\" id=\"phrase_player\" align=\"middle\">");
document.write("<param name=\"allowScriptAccess\" value=\"sameDomain\">");
document.write("<param name=\"movie\" value=\"/swf/phrase_player_pronounce.swf\">");
document.write("<param name=\"quality\" value=\"high\">");
document.write("<param name=\"wmode\" value=\"transparent\">");
document.write("<param name=\"bgcolor\" value=\"#ffffff\">");

if(movie){
	document.write("<PARAM NAME=\"FlashVars\" VALUE=\"movie="+movie+"\">");
}
document.write("<embed src=\"/swf/phrase_player_pronounce.swf\" wmode=\"transparent\"");

if(movie){
	document.write("FlashVars=\"movie="+movie+"\"");
}

document.write(" quality=\"high\" bgcolor=\"#ffffff\" width=\"160\" height=\"39\" name=\"phrase_player\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\">");

document.write("</object>");

}


function subwindowOpen(page){
  window.open(page, 'faq', 'width=660,height=630,toolbar=0,status=0,menubars=0,resizable=0,scrollbars=1');
}

function blurTagsTextBox()
{
	document.formTagging.elements["tags"].blur();
	document.formTagging.elements["tags"].style.backgroundColor = "#cccccc";
	document.formTagging.submit();
}

function blurCondKeywordTextBox()
{
	document.frm_keyword.elements["condKeyword"].blur();
	document.frm_keyword.elements["condKeyword"].style.backgroundColor = "#cccccc";
	document.frm_keyword.submit();
}

function disabledSubmitButton(object)
{
	object.disabled = true;
	document.formTagging.submit();
}

function disabledMyphraseSubmitButton(object)
{
	object.disabled = true;
	document.frm_keyword.submit();
}

