//ページロード時に実行window.onload = function (){	this.help('mailnum','off','メールアドレス');	this.help('telnum','off','お電話番号');	this.help('add','off','ご住所');}// ------------------------------------------------------------------------------// 【目次】//		-- 標準機能 --// 		unspacer(str_id)										空白文字しか入力がない場合にエラー表示。// 		eng_spelling_check(str_id)					禁則文字しか入力がない場合にエラー表示。// 		normal_width_input(str_id)					半角数字でない時にエラー表示。// 		normal_width_input_tel(str_id)			電話番号でない時にエラー表示。// 		tel_check(str_id)									電話番号正規化。// 		email_check(str_id)									メールアドレス正規化。// 		url_check(str_id)									URL正規化。// 		move_next(str_id, next_str_id, num)	次の枠へ移動。//		-- カスタマイズ機能 --// 		disabled_area(str_id)								入力枠　可能・不可能モード。// 		disabled_block(str_id)							ブロック表示・非表示モード。//		kakunin(str_id)											上長確認// ------------------------------------------------------------------------------// ------------------------------------------------------------------------------// HTML側// <input type="text" name="お名前" value="" id="onamae" onchange="unspacer('onamae')" />// 	ポイント・・・idで指定。onchange="unspacer('id名')とする。// ------------------------------------------------------------------------------// ---------------------------------------------------------------// 空白だけなら強制的にNULLにする// ---------------------------------------------------------------function del_space(str_id) {	// 初期設置	var flag_space = 0;	var flag_text = 0;		var num = document.getElementById(str_id).value.length;	var str = document.getElementById(str_id).value;	for(var i = 0; i < num; i ++){		if(str.charAt(i) == ' ' || str.charAt(i) == '　'){			flag_space = 1;		}else{			// 空白以外が存在する場合			flag_text = 1;		}	}	// 空白だけしか記載されていない場合は抹消	if(flag_space == 1 && flag_text == 0){		document.getElementById(str_id).value = '';	}}// ---------------------------------------------------------------// 空白文字しか入力がない場合にエラー表示。// ---------------------------------------------------------------function unspacer(str_id) {	// 初期設置	var flag_space = 0;	var flag_text = 0;		var num = document.getElementById(str_id).value.length;	var str = document.getElementById(str_id).value;	for(var i = 0; i < num; i ++){		if(str.charAt(i) == ' ' || str.charAt(i) == '　'){			flag_space = 1;		}else{			// 空白以外が存在する場合			flag_text = 1;		}	}	// 空白だけしか記載されていない場合は抹消	if(flag_space == 1 && flag_text == 0){		alert("スペースしか記入されておりません。再度ご確認ください。");		document.getElementById(str_id).value = '';	}}// ---------------------------------------------------------------// 禁則文字しか入力がない場合にエラー表示。// 全角文字（スペース除く）・半角カタカナ以外がNG// ---------------------------------------------------------------function eng_spelling_check(str_id){	// 初期設置	var flag_ngword = 0;	var flag_text = 0;		var num = document.getElementById(str_id).value.length;	var str = document.getElementById(str_id).value;	var str_v;	for(var i = 0; i < num; i ++){		str_v = str.charAt(i);		if(str_v.match(/[ -~|　]/g)){			flag_ngword = 1;		}else{			// 半角英語以外が存在する場合			flag_text = 1;		}	}	// 半角英語だけしか記載されていない場合は抹消	if(flag_ngword == 1 && flag_text == 0){		alert("不正な文字列です。再度ご確認ください。");		document.getElementById(str_id).value = '';	}}// ---------------------------------------------------------------// 半角数字でない時にエラー表示。// ---------------------------------------------------------------function normal_width_input(str_id) {	c = document.getElementById(str_id).value;	if(c.match(/[^0-9]/g)){		document.getElementById(str_id).value = '';		alert("半角数字で入力してください。");	}	c = document.getElementById(str_id).value;	if(!c){		document.getElementById(str_id).value = '';	}}// ---------------------------------------------------------------// 電話FAX番号でない時にエラー表示。// ---------------------------------------------------------------function normal_width_input_tel(str_id) {	c = document.getElementById(str_id).value;	if(c.match(/[^0-9|\-|R]/g)){		document.getElementById(str_id).value = '';		alert("半角数字と-を組み合わせて入力してください。");	}	c = document.getElementById(str_id).value;	if(!c){		document.getElementById(str_id).value = '';	}}// ---------------------------------------------------------------// サイト番号正規化。// ---------------------------------------------------------------function sitenum_check(str_id) {	c = document.getElementById(str_id).value;	var str_num = c.split('-');	if(str_num[0].length != 12 || str_num[1].length != 2){		if(str_num[1].length != 3){			alert("桁数に誤りがあります。訂正してください。");			document.getElementById(str_id).value = '';			document.getElementById(str_id).focus();		}	}}// ---------------------------------------------------------------// 電話FAX番号正規化。// ---------------------------------------------------------------function tel_check(str_id) {	c = document.getElementById(str_id).value;	check = /0+.+\-+.+\-+.+/;	if(!c.match(check)){		document.getElementById(str_id).value = '';		alert("番号が正しくありません。");		document.getElementById(str_id).focus();	}}// ---------------------------------------------------------------// メールアドレス正規化。// ---------------------------------------------------------------function email_check(str_id) {	c = document.getElementById(str_id).value;	check = /.+@.+\..+/;	if(!c.match(check)){		document.getElementById(str_id).value = '';		alert("メールアドレスが正しくありません。");		document.getElementById(str_id).focus();	}}// ---------------------------------------------------------------// URL正規化。// ---------------------------------------------------------------function url_check(str_id) {	c = document.getElementById(str_id).value;	check = /http\:\/\/.+\..+/;	if(!c.match(check)){		document.getElementById(str_id).value = '';		alert("URLが正しくありません。");		document.getElementById(str_id).focus();	}}// ---------------------------------------------------------------// 納品チェックシート未確認時// ---------------------------------------------------------------function nouhin_check(){	if(document.getElementById('nouhin_mikakunin').checked){		document.getElementById('nouhin_mikakunin_text').style.display = "inline";		document.getElementById('nouhin_mikakunin_text').disabled = false;	}else{		document.getElementById('nouhin_mikakunin_text').style.display = "none";		document.getElementById('nouhin_mikakunin_text').disabled = true;	}}// ---------------------------------------------------------------// 次の枠へ移動。// ---------------------------------------------------------------function move_next(str_id, next_str_id, num) {  if (str_id.value.length >= num) {    document.getElementById(next_str_id).focus();  }}// ------------------------------------------------------------------------------// disabled = true　の場合、入力POSTデータとしてすら飛びません。// // HTML側// 個人の場合はチェックを入れる// <input type="checkbox" name="お客様分類" value="yes" id="kind" onclick="disabled_check('kind')" />// 個人<input type="text" name="お名前" value="" id="person_name" />// 法人<input type="text" name="お名前" value="" id="cliant_name" />// // と記述しておくと、チェックが入った時とのみ、個人の方のテキストボックスが// 記入可能になる。逆に不可視状態であれば、POSTデータすら飛ばない為、データ重複もなくなる。// 注意：このケースの場合、初めから読み込ます必要がある為、<body onload="disabled_check('kind');">//       と記述しておく必要がある。// ------------------------------------------------------------------------------// ---------------------------------------------------------------// 入力　可能・不可能モード。// ---------------------------------------------------------------function disabled_area(str_id){	var str_num = str_id.split('-');	for(var i = 1; i <= str_num[1]; i ++){		if( document.getElementById(str_num[0]).checked ){			// チェックが入っている場合			document.getElementById(str_num[0] + '_area-' + i ).disabled = false; // 可視			document.getElementById(str_num[0] + '_area-' + i ).style.visibility = "visible"; // 可視		}else{			// チェックが入っていない場合			document.getElementById(str_num[0] + '_area-' + i ).disabled = true; // 不可視			document.getElementById(str_num[0] + '_area-' + i ).style.visibility = "hidden"; // 不可視		}	}}// ------------------------------------------------------------------------------// // fmailカスタマイズ仕様用// 画面切り替え処理　ブロックごと表示・非表示を切り替える// // ------------------------------------------------------------------------------function disabled_block(str_id){	var str_num = str_id.split('-');	if( document.getElementById(str_num[0]).checked ){		// 初めに表示させる方		for(var i = 1; i <= str_num[1]; i ++){			// データ部分			document.getElementById(str_num[0] + '-' + i).disabled = false; // 可視			// 表示部分			document.getElementById(str_num[0] + '-' + i).style.display = 'inline'; // 可視		}				//  後から表示させる方		for(i = 1; i <= str_num[2]; i ++){						// データ部分			document.getElementById(str_num[0] + '_reverse-' + i).disabled = true; // 不可視			// 表示部分			document.getElementById(str_num[0] + '_reverse-' + i).style.display = 'none'; // 不可視		}	}else{		// 初めに表示させる方		for(var i = 1; i <= str_num[1]; i ++){			// データ部分			document.getElementById(str_num[0] + '-' + i).disabled = true; // 不可視			// 表示部分			document.getElementById(str_num[0] + '-' + i).style.display = 'none'; // 不可視		}				//  後から表示させる方		for(i = 1; i <= str_num[2]; i ++){			// データ部分			document.getElementById(str_num[0] + '_reverse-' + i).disabled = false; // 可視			// 表示部分			document.getElementById(str_num[0] + '_reverse-' + i).style.display = 'inline'; // 可視		}	}}function disabled_block1(str_id){	var str_num = str_id.split('-');	if( document.getElementById(str_num[0]).checked ){		// 初めに表示させる方		for(var i = 1; i <= str_num[1]; i ++){			// データ部分			document.getElementById(str_num[0] + '-' + i).disabled = false; // 可視			// 表示部分			document.getElementById(str_num[0] + '-' + i).style.display = 'inline'; // 可視		}			}else{		// 初めに表示させる方		for(var i = 1; i <= str_num[1]; i ++){			// データ部分			document.getElementById(str_num[0] + '-' + i).disabled = true; // 不可視			// 表示部分			document.getElementById(str_num[0] + '-' + i).style.display = 'none'; // 不可視		}			}}// ------------------------------------------------------------------------------// // fmailカスタマイズ仕様用// 画面切り替え処理　ブロックごと表示・非表示を切り替える// // ------------------------------------------------------------------------------function disabled_block2(str_id){	var str_num = str_id.split('-');	if( document.getElementById(str_num[0]).selected ){		// 初めに表示させる方		for(var i = 0; i <= str_num[1]; i ++){			// データ部分			document.getElementById(str_num[0] + '-' + i).disabled = false; // 可視			// 表示部分			document.getElementById(str_num[0] + '-' + i).style.display = 'inline'; // 可視		}			}else{		// 初めに表示させる方		for(var i = 0; i <= str_num[1]; i ++){			// データ部分			document.getElementById(str_num[0] + '-' + i).disabled = true; // 不可視			// 表示部分			document.getElementById(str_num[0] + '-' + i).style.display = 'none'; // 不可視		}			}}// ------------------------------------------------------------------------------// // fmailカスタマイズ仕様用// NLS関連の部分// // ------------------------------------------------------------------------------function nls_set_check(){	if(document.getElementById('nls_set').checked){		//あり		document.getElementById('nls_back_conf').style.display = 'block';		document.getElementById('nls_text_conf').style.display = 'block';		document.getElementById('nls_back').style.display = 'inline';		document.getElementById('nls_text').style.display = 'inline';		document.getElementById('nls_back').disabled = false;		document.getElementById('nls_text').disabled = false;		document.getElementById('nls_color_info').style.display = 'block';		document.getElementById('nls_color_info2').style.display = 'block';	}else{		//なし		document.getElementById('nls_back_conf').style.display = 'none';		document.getElementById('nls_text_conf').style.display = 'none';		document.getElementById('nls_back').style.display = 'none';		document.getElementById('nls_text').style.display = 'none';		document.getElementById('nls_back').disabled = true;		document.getElementById('nls_text').disabled = true;		document.getElementById('nls_color_info').style.display = 'none';		document.getElementById('nls_color_info2').style.display = 'none';	}}function nls_check(str_id) {	c = document.getElementById(str_id).value;	a = c.substr(0,1);	if(a != '#'){		document.getElementById(str_id).value = '#' + document.getElementById(str_id).value;	}	if(c.match(/[^0-9|a-f|#]/g)){		l_str = c.length;		l_str = eval(l_str) - 1;		document.getElementById(str_id).value = document.getElementById(str_id).value.substr(0,l_str);	}	if(document.getElementById('nls_back').value == document.getElementById('nls_text').value){		alert("背景とテキストが同色になっています。判定を受ける可能性があります。");		document.getElementById(str_id).value = document.getElementById(str_id).value.substr(0,6);	}}function nls_back_color() {	document.getElementById('nls_back_conf').style.background = document.getElementById('nls_back').value;	document.getElementById('nls_text_conf').style.background = document.getElementById('nls_back').value;}function nls_text_color() {	document.getElementById('nls_back_conf').style.color = document.getElementById('nls_text').value;	document.getElementById('nls_text_conf').style.color = document.getElementById('nls_text').value;}// ---------------------------------------------------------------// 項目値ヘルプ// HTML側で//	ページロード時			onload="help_load('id名=表示文字,id名=表示文字,id名=表示文字・・・');"//	フォーカス時				onfocus="help('id名','on','comment');"//	フォーカスはずれ時	onblur="help('id名','off','comment');"//	連絡方法						onchang="renrakusaki_shitei('チェックid','メールid','TELid','FAXid');"//	システム有り無し		onchange="sys_ari('チェック対象id','必須マーク','システム内容id');"//	送信時							onclick="help_submit('id名=表示文字,id名=表示文字,id名=表示文字・・・');"// ---------------------------------------------------------------//フォーカス時function help(str_id,flag,comment){	var a = document.getElementById(str_id).value;	//フォーカスが外れた時	if(flag == 'off'){		if(a == ''){			document.getElementById(str_id).value = comment;			document.getElementById(str_id).style.color = "#aaaaaa";		}else if(a != comment){			document.getElementById(str_id).style.color = "black";		}else{			document.getElementById(str_id).style.color = "#aaaaaa";		}	//フォーカスされた時	}else if(flag == 'on'){		//値がヘルプと同じ時はクリア		if(a == comment){			document.getElementById(str_id).value = '';			document.getElementById(str_id).style.color = "black";		}else{			document.getElementById(str_id).style.color = "black";		}	}}//送信時function help_submit(str_id_str){	//システム有無でジャッジ	var flag_sys = 0;	var a = str_id_str.split(',');	var a_str;	var first = '';	var first_flag = 0;	var work = '';		//未入力チェック	for(var i = 0;i < a.length; i ++){		a_str = a[i].split('=');		//値が規定値の時		if(a_str[1] == document.getElementById(a_str[0]).value){			if(first_flag == 0){				document.getElementById(a_str[0]).focus();				first_flag = 1;			}			work += "　・" + document.getElementById(a_str[0]).name + "\n";		//値が無い時		}else if(document.getElementById(a_str[0]).value == ''){			if(first_flag == 0){				document.getElementById(a_str[0]).focus();				first_flag = 1;			}						//システムの有無			if(a_str[0] == 'system_naiyo_comment' && flag_sys == 1){				work += "　・" + document.getElementById(a_str[0]).name + "\n";			}else if(a_str[0] != 'system_naiyo_comment'){				work += "　・" + document.getElementById(a_str[0]).name + "\n";			}		}	}	if(work != ''){		alert("下記が未記入です。\n\n" + work + "\n再度、ご確認ください。");			this.read_function();	}}