//Copyright 2006 Mooter, Inc.　http://www.mooter.co.jp
//当スクリプトを複製または改変して利用するにはムーター株式会社の許可が必要です。
//詳細はお問い合わせください。http://contact.mooter.co.jp/inquiry/

var mooterIsSelect = false;

if (document.selection != null) {
	document.body.onselectstart = mooterSelectStart;
} else {
	document.body.onmousedown = mooterSelectStart;
}

document.body.onmouseup = mooterMouseUp;

function mooterSelectStart() {
	mooterIsSelect = true;
}

function mooterMouseUp() {
	if (mooterIsSelect) {
		if (document.selection != null) {
			var textRange = document.selection.createRange();

			if (textRange != null) {
				if (textRange.text != "") {
					mooterTarget.value = textRange.text;
				}
			}
		} else {
			var textRange = window.getSelection();
			
			if ((textRange != null)&&(textRange != "")) {
				mooterTarget.value = textRange;
			}
		}
		
		mooterIsSelct = false;
	}
}

