
var w = "";

try {
	var s = document.selection;
	var r = s.createRange();
	w = r.text;
	w.replace(/^\s*([\s\S]*\S+)\s*$|^\s*$/,'$1');
} catch(e) {}

if (!w.length)
{
	var x = <XPOS>;
	var y = <YPOS>;
	var e = document.elementFromPoint(x, y);
	if (!e.isTextEdit)
		e = e.parentTextEdit;
	var r = e.createTextRange();
	r.moveToPoint(x, y);
	r.collapse();
	r.expand('word');
	w = r.text;
	w.replace(/^\s*([\s\S]*\S+)\s*$|^\s*$/,'$1');
}

if (w.length > 1 && w.length < 64)
{
	var u = 'http://endic.naver.com/small.naver?query='+escape(w);
	document.location.href = 'javascript:';
	var nw = window.open(u, 'DirectSearch_Dic', 'width=405 height=500 resizable=yes scrollbars=yes');
	nw.focus();
}
