/************************************************
Click 'n' See 3.0 (C) 2002-2004
On-the-fly looking up with multiple dictionaries
All scripts are coded by hainam4u@

You have the right to change this script to meet
your need, but please keep this comment

Any suggestion, contact me hainam@jcisio.com
Visit my web at http://www.jcisio.com

v3.0: accept both Internet Explorer & Mozilla
v2.0: POST method is replaced by GET, so IE6 or Windows2000+ is required
************************************************/
function detect_mouse(e)
{
	if (document.all)
	{
		if (!event.ctrlKey) return true;
		var r=document.body.createTextRange();
		r.moveToPoint(event.x, event.y);
		r.expand("word");
		r.moveEnd("word", 0);
		if (r.text) cns_lookup('en_vi',r.text);
	}
	else
	{	return true;
		if (!e.ctrlKey) return true;
		var r=document.body.createTextRange();
		alert('ddd');
		r.moveToPoint(e.x, e.y);
		r.expand("word");
		r.moveEnd("word", 0);
		if (r.text) cns_lookup('en_vi',r.text);
	}
	return false;
}
function detect_key(e)
{
	if (document.all)
	{
		if((event.type=='keydown') && (event.keyCode==65))
		if (event.ctrlKey && event.shiftKey)
		{
			text = document.selection.createRange().text;
			cns_lookup('en_vi',text);
		}
	}
	else
	{
		if (e.keyCode==65 && e.ctrlKey && e.shiftKey)
		{
			text = window.getSelection();
			cns_lookup('en_vi',text);
		}
	}
}
function cns_lookup(dict_search,word_to_lookup)
{
	quickview = window.open('http://www.edusoft.vn/live/blocks/dictionary_mc/dic/search.php?dict='+dict_search+'&word='+word_to_lookup, 'quickview', 'status=0,toolbar=0,scrollbars=1,width=500,height=400,localtion=0');
	quickview.focus();
}
var cns = new Object;
cns.dic = 0;
cns.exa = 1;



function cns_dic(select_dic) {cns.dic=select_dic}
function cns_example(show) {cns.exa=show}

document.oncontextmenu = detect_mouse;
document.onkeydown = detect_key;