
		//**********************************************************************
		//  HTML划词搜索 
		//  Mr.Bear 
		//  2006-08-11
		//**********************************************************************

		//需要images/htmlsearch.gif，如需引用，请在images/下放置该图片
		//当在HTML网页中选择的字数在1~MaxSize之间，允许

		//搜索引擎
		var SearchUrl = "http://search.cnki.net/cnkisearch.asp?QueryString=";
		//允许传递最大字数
		var MaxSize   = 20;								
		
		var Flag = false;
		var SelText = "";
		
		//划词开始
		function SelStart()
		{
			Flag = true;
		}
		
		//划词结束
		function SelEnd()
		{
			Flag = false;
			var sText = document.selection.createRange().duplicate().text;
			sText = sText.replace(/(^[\s]*)|([\s]*$)/g, "");
			if(sText!=""&&sText.length<MaxSize )
			{
				SelText = sText ;
				ShowTools();
			}else
			{
				HideTools();
			}
		}
				
		//搜索检索词
		function DoSearch()
		{
			HideTools();
			window.open( SearchUrl + escape(SelText) );
		}
		
		//显示划词工具栏，并定位
		function ShowTools()
		{
			document.getElementById("SearchTool").style.display = '';
			document.getElementById("SearchTool").style.top = document.body.scrollTop + event.y-20;
			document.getElementById("SearchTool").style.left= document.body.scrollLeft + event.x + 1;
		}

		//隐藏划词工具栏
		function HideTools()
		{
			document.getElementById("SearchTool").style.display = 'none';
		}
						
		//触发事件
		document.onselectstart = SelStart;
		document.onmouseup = SelEnd;
		
		//划词工具栏
		document.write('<div style="position: absolute; display:none;width: 21px; height: 21px; z-index: 1; left: 1px; top: 1px;" id="SearchTool">');
		document.write('<img  style="cursor:hand;" border="0" src="images/htmlsearch.gif" width="21" height="21" alt="CNKI Search" onclick="DoSearch();" onmouseout="HideTools();">');
		document.write('</div>');		

		//**********************************************************************