//
// JScript 文件:划词框内的二次划选跳转
var delta=1;
var statusObj=[0];
var updateloc_timer=0;
var _dict_old_word="";
var _quickSkip=true;  

function _dictInit(){
    var agt = navigator.userAgent.toLowerCase();
    _dict_is_ie = (agt.indexOf("msie")!=-1 && document.all);  
    
  if (_dict_is_ie) { 
    document.attachEvent("onmouseup", _dictQuery); 
    document.attachEvent("onselectstart", _dictSelect); 
  }else { 
    document.addEventListener("mouseup", _dictQuery, true); 
    document.addEventListener("selectstart", _dictSelect, true); 
  } 
}
function _dictStartSel(){
    
}
function _dictSelect(e){ 
    return true;
}

function _dictGetSel()
{
	if (window.getSelection) return window.getSelection();
	else if (document.getSelection) return document.getSelection();
	else if (document.selection) return document.selection.createRange().text;
	else return '';
}  

function _getFFinputSelect(e){ 
    try{
	    var myArea = e.target; 
	    if (myArea.selectionStart!= undefined) {
		    return  myArea.value.substr(myArea.selectionStart, myArea.selectionEnd - myArea.selectionStart);
	    }else{
	        return "";
	    }
    }catch(e){
	    return "";
    }
}
function CurrentWord(){
	try{
		return document.getElementById("w").value ;
	}catch(e){
		try{
			return _pwords ;
		}catch(e){
			return "-";
		}
	}
}
function _dictQuery(e)  {
    if(_quickSkip==true){ 
        var word = _dictGetSel(e); 
        if (! _dict_is_ie) {
            if(word.toString().length==0){
                word =_getFFinputSelect(e);
            }
        }
    
        if(_dict_is_ie) word=word.replace(/^\s*|\s*$/g,"");
        word=""+word;		 
		if(word.length>0){
			//try{window.external.ShowBrowserMenu('client');}catch(e){};
		}
    }
}
_dictInit();
//
//