	function setYMD(pName) {
		var wYMD = document.getElementById(pName).value;
		if (wYMD.length == 8){
			document.getElementById(pName).value = wYMD.substr(0, 4) + "/" + wYMD.substr(4, 2) + "/" + wYMD.substr(6);
		}
	}

	function showtable(target,type) {
		if(document.all){
			window[target].style.display = type;
   		}
	}

	function sys_selsel(obj, val, opt) {
		var sel = 0;
		with (obj) {
			for(i = 0; i < options.length; i++){
				if (options[i].text == val){
					if (opt == "") options[i].defaultselected = true;
					options[i].selected = true;
					sel = 1;
				} else {
					if (opt == "") options[i].defaultselected = false;
					options[i].selected = false;
				}
			}
			if (!sel) {
				options[0].value = val;
				options[0].text = val;
				options[0].selected = true;
			}
		}
	}

	function sys_onCombo(tx, sl, ct, cs)
	{
		if (document.all) {
			if (document.forms[0].elements[sl].selectedIndex == 1) {
				document.all.item(cs).style.display = "none";
				document.all.item(ct).style.display = "block";
				document.forms[0].elements[tx].focus();
			} else {
				document.forms[0].elements[tx].value = document.forms[0].elements[sl].options[document.forms[0].elements[sl].selectedIndex].value;
			}
		}
	}

	function sys_offCombo(tx, sl, ct, cs, opt)
	{
		if (document.all.item(ct).style.display == "block") {
			sys_selsel(document.forms[0].elements[sl], document.forms[0].elements[tx].value);
			if (opt) {
				document.all.item(ct).style.display = "none";
				document.all.item(cs).style.display = "block";
				document.forms[0].elements[sl].focus();
			}
		}
	}

	function setSyokusyu() {
		document.entry.keiken1.value=window.top.INS.syokusyu1.value
		document.entry.keiken2.value=window.top.INS.syokusyu2.value
		document.entry.keiken3.value=window.top.INS.syokusyu3.value
	}

	function jumpBasic() {
		location.href = "basic.html";
	}

	function jumpOrderList() {
		location.href = "orderlist.html";
	}

	function jumpOrderBackList() {
		location.href = "orderbacklist.html";
	}

	function changeDateFormat(name) {
//呼び出し引数例：on_Blur='changeDateFormat(document.INS.abc)'
		in_str = name.value;
		str_len = in_str.length;
		out_str = in_str;
		tmp = "";
		dd = "";
		mm = "";
		yy = "";

		// 5桁以上ある場合のみ編集
		if (str_len > 4) {
			for (i = 0; i < str_len; i++) {

				// 一文字ずつ数字かチェック
				chk_str = in_str.charAt(str_len - i - 1);
				tmp = Number(chk_str);

				if (!isNaN(tmp)) {
					if (i < 2) {
						// 日
						dd = chk_str + dd;
					} else if (i >= 2 && i < 4) {
						// 月
						mm = chk_str + mm;
					} else {
						// 年
						yy = chk_str + yy;
					}
				} else {
					// 文字が入っている場合は編集しない
					out_str = "";
					break;
				}
			}

			if (out_str != "") {
				str_len = yy.length;
				if (str_len > 0 && str_len < 4) {
					// 年の桁数が足りない場合2000付け足し
					num = 2000 + Number(yy);
					yy = num.toString();
				}

				// yyyy/mm/dd形式に編集
				out_str = yy + "/" + mm + "/" + dd;

				// 呼び出し元を書き換え
				name.value = out_str;
			}
		}
	}

	function changeTimeFormat(name) {
//呼び出し引数例：on_Blur='changeDateFormat(document.INS.abc)'
		in_str = name.value;
		str_len = in_str.length;
		out_str = in_str;
		tmp = "";
		hh = "";
		mm = "";

		// 1桁以上ある場合のみ編集
		if (str_len > 0) {
			for (i = 0; i < str_len; i++) {

				// 一文字ずつ数字かチェック
				chk_str = in_str.charAt(str_len - i - 1);
				tmp = Number(chk_str);

				if (!isNaN(tmp)) {
					if (i < 2) {
						// 分
						mm = chk_str + mm;
					} else {
						// 時
						hh = chk_str + hh;
					}
				} else {
					// 文字が入っている場合は編集しない
					out_str = "";
					break;
				}
			}

			if (out_str != "") {
				str_len = hh.length;
				if (str_len == 0) {
					hh = "00";
				} else if (str_len == 1) {
					hh = "0" + hh;
				}

				str_len = mm.length;
				if (str_len == 0) {
					mm = "00";
				} else if (str_len == 1) {
					mm = "0" + mm;
				}

				// hh:mm形式に編集
				out_str = hh + ":" + mm;

				// 呼び出し元を書き換え
				name.value = out_str;
			}
		}
	}

	function setFROMData(){
		var i;
		for (i=0; i<document.fmcvtjoken.rdoFROM_KBN.length; i++){
			if (document.fmcvtjoken.rdoFROM_KBN[i].checked == true){
				if (i == 0){
					document.fmcvtjoken.txtFROM_Office.value = "新宿CC";
					document.fmcvtjoken.txtFROM_Name.value = "道明寺 亜矢子";
				}else{
					document.fmcvtjoken.txtFROM_Office.value = "新宿CRM1課";
					document.fmcvtjoken.txtFROM_Name.value = "綾小路 次郎丸";
				}
			}
		}
	}

	function setTOData_CO(){
		if (document.fmcvtjoken.txtTO_CO_Code.value == "10000"){
			document.fmcvtjoken.txtTO_CO_Office.value = "銀座CC";
			document.fmcvtjoken.txtTO_CO_Name.value = "銀座 花子";
		}else{
			document.fmcvtjoken.txtTO_CO_Office.value = "池袋CC";
			document.fmcvtjoken.txtTO_CO_Name.value = "池袋 太郎";
		}
	}

	function setTOData_BU(){
		if (document.fmcvtjoken.txtTO_BU_Code.value == "20000"){
			document.fmcvtjoken.txtTO_BU_Office.value = "バイオ新宿";
			document.fmcvtjoken.txtTO_BU_Name.value = "新宿 花子";
		}else{
			document.fmcvtjoken.txtTO_BU_Office.value = "バイオ品川";
			document.fmcvtjoken.txtTO_BU_Name.value = "品川 次郎";
		}
	}

	function dispIchiran(){
		parent.frames.down.location = "cvtichiran.html";
	}

	function clear_From(){
		document.fmcvtjoken.txtFROM_Office.value = "";
		document.fmcvtjoken.txtFROM_Code.value = "";
		document.fmcvtjoken.txtFROM_Name.value = "";
	}

	function SubmitChange(){
		if (confirm("担当者を変更します。\nよろしいですか？") == true){
			parent.frames.up.location = "cvtjoken.html";
			parent.frames.down.location = "cvtichiran2.html";
		}else{
			return;
		}
	}

	function changeStatus(val){
		var btnValue;
		var i;

		btnValue = document.fmconvert.btnAllChange.value;
		if (btnValue == "全選択"){
			document.fmconvert.btnAllChange.value = "全解除";
			if (document.fmconvert.check1.checked == false){
				document.fmconvert.check1.checked = true;
			}
			if (document.fmconvert.check2.checked == false){
				document.fmconvert.check2.checked = true;
			}
			if (document.fmconvert.check3.checked == false){
				document.fmconvert.check3.checked = true;
			}
			if (val == "0"){
				if (document.fmconvert.check4.checked == false){
					document.fmconvert.check4.checked = true;
				}
			}
		}else{
			document.fmconvert.btnAllChange.value = "全選択";
			if (document.fmconvert.check1.checked == true){
				document.fmconvert.check1.checked = false;
			}
			if (document.fmconvert.check2.checked == true){
				document.fmconvert.check2.checked = false;
			}
			if (document.fmconvert.check3.checked == true){
				document.fmconvert.check3.checked = false;
			}
			if (val == "0"){
				if (document.fmconvert.check4.checked == true){
					document.fmconvert.check4.checked = false;
				}
			}
		}
	}

	function dispJOB(){
		top.frames.location = "basic.html";
	}

	function sel_exp(value) {
		if (value == 0) {
			document.ENT.chk_inexp.checked = false;
		} else {
			document.ENT.chk_inexp.checked = true;
		}
	}

		
	function jumpBasic_chk_icon() {
		location.href = "bacis_chk_icon.html";
	}

	function open_check_icon() {
		w = window.open("tint010112.do", "icon", "width=380,height=220");
	}

	function change_language(value) {
		if (document.getElementById("id_lang" + value).checked) {
			document.getElementById("id_talk" + value).disabled = false;
			document.getElementById("id_read" + value).disabled = false;
		} else {
			document.getElementById("id_talk" + value).disabled = true;
			document.getElementById("id_read" + value).disabled = true;
		}
	}

	function win_kinmuti() {
		w = window.open("kinmuti.html", "Test", "width=720,height=420");
	}
	
	function checkImgFormat(imgPath,imgName){
		
		if ( imgPath.indexOf(".PNG") != -1 ||
			 imgPath.indexOf(".JPG") != -1 ||
			 imgPath.indexOf(".GIF") != -1 ||
			 imgPath.indexOf(".png") != -1 ||
			 imgPath.indexOf(".gif") != -1 ||
			 imgPath.indexOf(".jpg") != -1 ){
				stateFlag = 1;
				if(imgName == "office_photo1"){
					document.previewImg1.src = imgPath;
					document.all.office_photo1.value=imgPath;
				}else if(imgName == "office_photo2"){
					document.previewImg2.src = imgPath;
					document.all.office_photo2.value=imgPath;
				}
				
				
		}else{
				stateFlag = 0;
				if ( imgPath != "" )
						alert("ファイルがありません。");
		}
	}

	function updateChar(id)
	{
			var comment=id;
			var location = comment.name;	
			var length = calculate_msglen(comment.value);
			document.getElementById(location+"_cnt").innerHTML = length;

	}	 
	function updateChar2(id,no)
	{
			var comment=id;
			var location = comment.name;	
			var length = calculate_msglen(comment.value);
			document.getElementById(location+"_cnt"+no).innerHTML = length;

	}
	function calculate_msglen(message)
	{
	   var nbytes = 0;
	 
	   for (i=0; i<message.length; i++) {
		 var ch = message.charAt(i);
		 if(escape(ch).length > 4) {
		   nbytes += 2;
		 } else if (ch == '\n') {
		   if (message.charAt(i-1) != '\r') {
			 nbytes += 1;
		   }
		 } else {
		   nbytes += 1;
		 }
	   }
	
			return nbytes;
	}
	function assert_msglen(message, maximum)
	{
			var inc = 0;
			var nbytes = 0;
			var msg = "";
			var msglen = message.length;
	
			for (i=0; i<msglen; i++) {
					var ch = message.charAt(i);
					if (escape(ch).length > 4) {
							inc = 2;
					} else if (ch == '\n') {
							if (message.charAt(i-1) != '\r') {
									inc = 1;
							}
					} else {
							inc = 1;
					}
					if ((nbytes + inc) > maximum) {
							break;
					}
					nbytes += inc;
					msg += ch;
			}
			document.getElementById("li_byte").innerHTML = nbytes;
			return msg;
	}

	function submitForm(actionName){
			with(document.forms[0]){
					action = actionName;
					submit();
			}
			return false;
	}	
	function OpenWindow(theURL,winName,features) {
		win = window.open(theURL,winName,features);
		win.focus();
	}
	 
		//二重処理チェック（ブラウザ戻る、二重押し対応）
	function isNotSubmitted(form){
	       if (form.submittedFlg.value == "") {
	   	      	//フラグの値をチェック済みにセット
	   	      	form.submittedFlg.value = "ture";
	          	return true;
	       } else {
	       		form.submittedFlg.value = "false";
	            return false;
	       }
	}

	// 半角文字 -> 全角文字変換
	var SINGLE_BYTE_CHAR = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZｱｲｳｴｵｶｷｸｹｺｻｼｽｾｿﾀﾁﾂﾃﾄﾅﾆﾇﾈﾉﾊﾋﾌﾍﾎﾏﾐﾑﾒﾓﾔﾕﾖﾗﾘﾙﾚﾛﾜｦﾝｧｨｩｪｫｯｬｭｮｰ";
	var DOUBLE_BYTE_CHAR = "ａｂｃｄｅｆｇｈｉｊｋｌｍｎｏｐｑｒｓｔｕｖｗｘｙｚＡＢＣＤＥＦＧＨＩＪＫＬＭＮＯＰＱＲＳＴＵＶＷＸＹＺアイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲンァィゥェォッャュョー";
	var SONANT_SIN_CHAR  = "ｳｶｷｸｹｺｻｼｽｾｿﾀﾁﾂﾃﾄﾊﾋﾌﾍﾎ";
	var SONANT_DUB_CHAR  = "ヴガギグゲゴザジズゼゾダヂヅデドバビブベボ";
	var PLOSIVE_SIN_CHAR = "ﾊﾋﾌﾍﾎ";
	var PLOSIVE_DUB_CHAR = "パピプペポ";
	function toDoubleByteCharacter(str) {
		var ret = "";
		for (i=0; i<str.length; i++) {
			var c = str.charAt(i);
			if (c == "ﾞ") {
				// 半角カナ濁音
				c = str.charAt(i-1);
				var n = SONANT_SIN_CHAR.indexOf(c, 0);
				if (n >= 0) {
					ret = ret.substring(0, ret.length-1) + SONANT_DUB_CHAR.charAt(n);
				}
			} else if (c == "ﾟ") {
				// 半角カナ破裂音
				c = str.charAt(i-1);
				var n = PLOSIVE_SIN_CHAR.indexOf(c, 0);
				if (n >= 0) {
					ret = ret.substring(0, ret.length-1) + PLOSIVE_DUB_CHAR.charAt(n);
				}
			} else {
				// 半角カナ濁音・破裂音以外
				var n = SINGLE_BYTE_CHAR.indexOf(c, 0);
				if (n >= 0) {
					ret += DOUBLE_BYTE_CHAR.charAt(n);
				} else {
					ret += c;
				}
			}
		}
		return ret;
	}

