sent = false; // 二重送信防止のフラグ

function send(f) {
	setcookie(f);
	return sent ? false : sent = true;
}

function reply(f, m) {
	var ua = navigator.userAgent;
	var br = (ua.indexOf("Win") != -1) ? "\r\n" : ((ua.indexOf("Mac") != -1) ? "\r" : "\n");
	document.forms['frm' + f].MESSAGE.value = ">>" + m + br;
	if (document.all) {
		document.forms['frm' + f].MESSAGE.value += "＞" + document.all("msg" + f + "." + m).innerText.split(br).join(br + "＞") + br;
	}
	document.forms['frm' + f].MESSAGE.focus();
}

function setcookie(f) {
	if (document.images) {
		cookiepath = "";
		p = location.pathname.split('/');
		for (i = 0; i < p.length - 2; i++) {
			cookiepath += p[i] + '/';
		}
		d = new Date();
		d.setTime(d.getTime() + (1000 * 60 * 60 * 24 * 30)); // 名前クッキーの有効期限は1ヶ月
		if (f.FROM.value != from || f.mail.value != mail) {
			document.cookie = "cookie=" + escape(f.FROM.value) + ":" + escape(f.mail.value) + "; path=" + cookiepath + "; expires=" + d.toGMTString();
		}
	}
}

from = ""; mail = "";
// クッキー読み出し
if (document.images) {
	cookies = document.cookie.split("; ");
	for (i = 0; i < cookies.length; i++) {
		expr = cookies[i].split("=");
		if (expr[0] == "cookie") {
			data = expr[1].split(":");
			from = unescape(data[0] ? data[0] : "");
			mail = unescape(data[1] ? data[1] : "");
		}
	}
}
