/* 入力時のチェック1 ▽*/

/* 正しいURLかどうか */
function urlCheck_input (str) {
	if ( str.value.match(/^(https?|ftp)(:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)$/)) {

	} else {
		alert("正しいURLか確認して下さい。");
		//str.value = "";
		str.focus();
		return 0;
	}
}

/* 全角カナチェック　*/
function em_sizeKana_input (str) {
	if ( str.value.match(/[^ヴァ-ンー]+/)) {
		var sText = str.value;	//置換前
		var repText = "";		//置換後
		repText = sText.replace(/[^ァ-ンヴー]+/g, "");
		alert("全角カナのみで入力して下さい。");
		str.value = repText;
		str.focus();
		return 0;
	}
}

/* 半角数値チェック　*/
function singleNum_input(str) {
	if ( str.value.match( /[^0-9]+/)) {
		var sText = str.value;	//置換前
		var repText = "";		//置換後
		repText = sText.replace(/[^0-9]/g, "");
		alert("半角数字のみで入力して下さい。");
		str.value = repText;
		str.focus();
		return 0;
	}
}

/* 半角英文字チェック */
function singlebyte_input(str) {
	if (str.value.match( /[^A-Za-z0-9]+/)) {
		var sText = str.value;	//置換前
		var repText = "";		//置換後
		repText = sText.replace(/[^A-Za-z0-9]/g, "");
		alert("半角英数字のみで入力して下さい。");
		str.value = repText;
		str.focus();
		return 0;
	}
}

/* TEL、FAX番号チェック */
function telFax_input(str) {
	//alert (str.value);
	if (str.value.match( /[^0-9.-]+/)) {
		var sText = str.value;	//置換前
		var repText = "";		//置換後
		repText = sText.replace(/[^0-9.-]/g, "");
		alert("半角英数字のみで入力して下さい。");
		str.value = repText;
		str.focus();
		return 0;
	}
}

/* 正確なEMAILであるかを判定するチェック */
function checkMail_input(e) {
	fOBJ = e.value;
	if (fOBJ!=""){
		check = /.+@.+\..+/;
		if (!fOBJ.match(check)) {
			alert("メールアドレスが正しくありません");
		}
	}
}


/* sumit();　直前のチェック ▽*/


/* 全角カナチェック　*/
function em_sizeKana(str, name) {
	var text = str.value;
	if ( str.value.match( /[^ァ-ンヴー]+/)) {
		message = name + "は全角カナのみで入力して下さい。";
	} else {
		message = "";
	}
	return message;
}

/* 入力値の有無をチェック */
function ifNull(str, name) {
	var text = str.value;
	if (text == ""){
		message = name + "が確認できません。";
	} else {
		message = "";
	}
	return message;
}

/* メールチェック　*/
function checkMail(e, name) {
	fOBJ = e.value;
	if (fOBJ!=""){
		check = /.+@.+\..+/;
		if (!fOBJ.match(check)) {
			message = name + "が正しくありません。";
		} else {
			message = "";
		}
	}
	return message;
}

/* 半角数値チェック　*/
function singleNum(str, name) {
	if ( str.value.match( /[^0-9]+/)) {
		message = name + "は半角数字のみで入力して下さい。";
	} else {
		message = "";
	}
	return message;
}

/* TEL、FAX番号チェック */
function telFax(str, name) {
	//alert (str.value);
	if (str.value.match( /[^0-9.-]+/)) {
		message = name + "は半角英数字、半角ハイフンのみで入力して下さい。";
	} else {
		message = "";
	}
	return message;
}

/* チェック済みかをチェック */
function checkedCheck(str, name) {
	var i;
	flg = 0;	//チェック済みがあれば、1 になる
	for (i = 0;i < str.length;i++) {
		if (str[i].checked == true) {
			message = "";	
			flg = 1;
			break;
		}
	}
	if (flg == 0) {
		message = name + "が確認できません。";
	}
	return message;
}

/* 正しいURLかどうか */
function urlCheck(str, name) {
	if ( str.value.match(/^(https?|ftp)(:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)$/)) {
		message = "";
	} else {
		message = name + "が正しいか確認して下さい。";
	}
	return message;
}
