/* each page js */

/* inquiry */

function toggleButton() {
	// agreement = document.getElementById("agreement").checked;
	agreement = true; // プライバシーポリシーに同意
	if (agreement) {
		document.getElementById("confirmation-button").src = "../shared/images/inquiry/confirmation_active.gif";
		document.getElementById("confirmation-button").style.cursor = "pointer";
	} else {
		document.getElementById("confirmation-button").src = "../shared/images/inquiry/confirmation_noactive.gif";
		document.getElementById("confirmation-button").style.cursor = "auto";
	}
}

function overConfirmationButton() {
	if (agreement) { document.getElementById("confirmation-button").src = "../shared/images/inquiry/confirmation_on.gif"; }
}

function outConfirmationButton() {
	if (agreement) { document.getElementById("confirmation-button").src = "../shared/images/inquiry/confirmation_active.gif"; }
}

function checkAgreement() {
	if (agreement) { checkImportant(); }
}

function checkImportant() {
	aboutValue = "";
	if ( document.forms["inquiry-form"].about[0].checked ) {
		aboutValue = 1;
	} else if (document.forms["inquiry-form"].about[1].checked) {
		aboutValue = 2;
	} else if (document.forms["inquiry-form"].about[2].checked) {
		aboutValue = 3;
	} else if (document.forms["inquiry-form"].about[3].checked) {
		aboutValue = 4;
	}
	bodytextValue = document.forms["inquiry-form"].bodytext.value;;
	nameValue = document.forms["inquiry-form"].name.value;
	mailValue = document.forms["inquiry-form"].mail.value;
	if (aboutValue != "" && bodytextValue != "" && nameValue != "" && mailValue != "") {
		document.forms["inquiry-form"].submit();
	} else {
		str = "";
		document.getElementById("name-value").style.background = "#ffffff";
		document.getElementById("mail-value").style.background = "#ffffff";
		if (aboutValue == "") {
			str += "■何についてのお問い合わせかご回答ください。";
		}
		if (bodytextValue == "") {
			if (str != "") {
				str += "\n\n";
			}
			str += "■お問い合わせ内容をご入力ください。";
		}
		if (nameValue == "" || mailValue == "") {
			if (str != "") {
				str += "\n\n";
			}
			str += "■以下の必須項目をご入力ください。\n";
		}
		if (nameValue == "") {
			document.getElementById("name-value").style.background = "#ffcccc";
			str += "・お名前\n";
		}
		if (mailValue == "") {
			document.getElementById("mail-value").style.background = "#ffcccc";
			str += "・メールアドレス";
		}
		alert(str);
	}
}

/* confirmation */

function overButton(buttonType) {
	document.getElementById(buttonType + "-button").src = "../shared/images/inquiry/" + buttonType + "_on.gif";
}

function outButton(buttonType) {
	document.getElementById(buttonType + "-button").src = "../shared/images/inquiry/" + buttonType + ".gif";
}

function formBack() {
	history.back();
}

function formSubmit() {
	document.forms["inquiry-form"].submit();
}





