function event_info_link(f_act, t_ctl) {
	var h_ctl = "head_info_link" + t_ctl;
	var c_ctl = "info_link" + t_ctl;
		
	if (f_act == "over") {
		with (document.all(h_ctl).style) {
			fontsize = "12px";
			color = "#915700";
			backgroundColor = "#FFFFCC";
			padding = "1px";
		}
		with (document.all(c_ctl).style) {
			fontsize = "12px";
			color = "#915700";
			backgroundColor = "#FFFFCC";
			padding = "1px";
		}
	}
	else if (f_act == "out") {
		with (document.all(h_ctl).style) {
			fontsize = "12px";
			color = "#FFFFFF";
			backgroundColor = "#E38800";
			padding = "1px";
		}
		with (document.all(c_ctl).style) {
			fontsize = "12px";
			color = "#FFFFFF";
			backgroundColor = "#E38800";
			padding = "1px";
		}
	}
}

function url_redirect(t_url) {
	location.href = t_url;
}

function set_focus(s_frm, s_ctl) {
	if (s_frm != null && s_ctl != null) {
		document.forms[s_frm].elements[s_ctl].focus();
	}
}

function chk_mail(t_mail) {
	if (t_mail.search(/^[^@]+@[^.]+\..+/) != -1) {
		return true;
	}
	else {
		return false;
	}
}

function chk_mailaddress_entry() {
	with (document.frmEdit) {
		if (txtMail1.value == "" || txtMail2.value == "") {
			cmdOK.disabled = true;
		}
		else if (txtMail1.value != txtMail2.value) {
			cmdOK.disabled = true;
		}
		else if (chk_mail(txtMail1.value) == false) {
			cmdOK.disabled = true;
		}
		else {
			cmdOK.disabled = false;
		}
	}
}

function change_category() {
	with (document.frmMail) {
		if (cmbCategory.value == 1 || cmbCategory.value == 2 || cmbCategory.value == 3 || cmbCategory.value == 4) {
			txtGoods.disabled = false;
			txtGoods.style.backgroundColor = 'WHITE';
		}
		else {
			txtGoods.disabled = true;
			txtGoods.style.backgroundColor = 'SILVER';
		}
	}
}

function submit_form(s_frm, t_url) {
	if (s_frm != null && t_url != null) {
		with (document.forms[s_frm]) {
			action = t_url;
			submit();
		}
	}
}

function chk_Quantity(a_flg) {
	var i;
	var ctr_name;
	var result = true;
	with (document.frmCart) {
		for (i = 0; i < txtRowCount.value; i++) {
			 ctr_name = "txtQuantity" + i;
			if (isNaN(elements[ctr_name].value)) {
				result = false;
				break;
			}
			else if (elements[ctr_name].value < 0) {
				result = false;
				break;
			}
		}

		if (result) {
			switch (a_flg) {
			case "resum":
				submit();
				break;
			case "order":
				location.href = 'order.cgi';
			}
		}
		else {
			alert("不正な数量が入力されています。");
			elements[ctr_name].focus();
		}
	}
}

function submit_mailform() {
	var Err_MSG = new Array();
	var MSG;

	with (document.frmMail) {
		if (txtName.value == "" || txtMail.value == "" || ((cmbCategory.value == 1 || cmbCategory.value == 2 || cmbCategory.value == 3 || cmbCategory.value == 4) && txtGoods.value == "") || txtComment.value == "") {
			Err_MSG[0] = "全ての項目を入力してください。\n\n";
		}
		if (txtMail.value != "" && txtMail.value.search(/^[^@]+@[^.]+\..+/) == -1) {
			Err_MSG[1] = "メールアドレスが不正です。正しいメールアドレスを入力して下さい。\n\n";
		}
		if ((cmbCategory.value == 1 || cmbCategory.value == 2) && txtGoods.value == "") {
			Err_MSG[2] = "対象商品を入力してください。";
		}
		if ((cmbCategory.value == 3 || cmbCategory.value == 4) && txtGoods.value == "") {
			Err_MSG[2] = "イベント名を入力してください。";
		}
		MSG = Err_MSG.join("");

		if (MSG == "") {
			if (txtGoods.disabled) { txtGoods.disabled = false; }
			submit();
		}
		else {
			alert(MSG);
		}
	}
}

function frmMail_reset() {
	with (document.frmMail) {
		reset();
		txtComment.value = "";
		txtGoods.disabled = false;
		txtGoods.style.backgroundColor = 'WHITE';
	}
}
