//フォーム用関数
// _dom : 0=other, 1=Mozilla, 2=NN4, 3=IE4/5
var _dom = (document.all ? 3 : (document.getElementById ? 1 : (document.layers ? 2 : 0)));
if (_dom == 2) document.captureEvents(Event.MOUSEUP);

//var overColor = "ivory";

if (document.postform) enableDragSelect();

function over(obj) {
//	outColor = obj.style.backgroundColor;
//	obj.style.backgroundColor = overColor;
//	obj.focus();
	disableDragSelect();
}

function out(obj) {
//	obj.style.backgroundColor = outColor;
	enableDragSelect();
}

function Validate(theForm) {
	if (theForm.name.value == "") {
		alert("お名前を記入してください。");
		theForm.name.focus();
		return (false);
	} else if (theForm.title.value == "") {
		alert("タイトルを記入してください。");
		theForm.title.focus();
		return (false);
	} else if (theForm.comment.value == "") {
		alert("メッセージを記入してください。");
		theForm.comment.focus();
		return (false);
	}
	return (true);
}

function enableDragSelect() {
	document.onmouseup = dragSelect;
}
function disableDragSelect() {
	document.onmouseup = null;
}
function dragSelect() {

	if (document.getSelection) {
		var str = document.getSelection();
	} else if (document.selection && document.selection.createRange) {
		var range = document.selection.createRange();
		var str = range.text;
	} else {
		return;
	}
	if (str.length == 0) { return; }
	var str2 = "＞";
	var nLen = 0;
	for (i = 0; i < str.length; i++) {
		str2 += str.charAt(i);
		if (str.charCodeAt(i) == 10) { nLen = 0; str2 += '＞'; }
		if (++nLen >= 38) { nLen = 0; str2 += '\r\n＞'; }
	}
	str = document.postform.comment.value;
	str += str2;
	document.postform.comment.value = str + '\r\n';
}
// ステータス領域表示に問題があるかどうかのチェック関数
function isWindowStatusBug() {
	if (navigator.appName!='Netscape') return false;
	var apv=navigator.appVersion;
	var mnv=parseFloat(apv);
	if (mnv > 4.05 && mnv < 4.08) return true;
	if (mnv == 4.5 && (apv.charAt(3) == 'b' || apv.indexOf('ja') == -1)) return true;
	return false;
}
// ステータス領域に文字列を設定する関数
function setWindowStatus(s) {
	var msg = ''; // 設定する文字列
	if (isWindowStatusBug()) {
		var sps = escape(s).split('%');
		for (var i = 0; i < sps.length; i++) {
			// status には %HH ではなく \u00HH を設定する
			if (i != 0) msg += '\\u00';
			msg += sps[i];
		}
		msg=eval('"'+msg+'"');
	} else msg = s;
	window.status = msg;
  return (_dom != 1); // 仮 for Mozilla
}
//NEWイメージ用関数
function ni(nTime) {
  var nMsec = (nTime + 24*60*60) * 1000; //24時間後(msec単位)
  var now = new Date();
  if (nMsec > now.getTime()) {
    document.write('<img src="' + URL + 'images/new.png" alt="new" border="0" width="29" height="15">');
  }
}

