
function search_cate(param1, param2)
{
	var name = encodeRequestParameter(param1);
	var id = encodeRequestParameter(param2);
	document.location="search_cate.jsp?cateType=2&Name="+ name +"&id="+id;
}

function autoResize() 
{ 
	try 
	{ 
		document.all["liveSearchIframe"].style.height=liveSearchIframe.document.body.scrollHeight;
	} 
	catch(e){} 
} 
 
 function autoResizeindexAdvers()
 {
	    	try 
				{ 
					document.all["indexAdversIframe"].style.height=indexAdversIframe.document.body.scrollHeight;
				} 
		   catch(e){} 
}

function autoResizeindexAdvers2()
 {
	    	try 
				{ 
					document.all["indexAdversIframe2"].style.height=indexAdversIframe2.document.body.scrollHeight;
				} 
		   catch(e){} 
}


 function showDIV(obj)
   {
   		var spellpy = document.getElementsByTagName("span");
   		var testtd = document.getElementsByTagName("td");
    	for(var i=0;i<spellpy.length;i++)
    	{
    		if(spellpy[i].name == "spellpy")
    		{
    			spellpy[i].style.color = "#5b5853";
    		}
    	}
    	//for(var i=0;i<testtd.length;i++)
    	//{
    	//	if(testtd[i].name == "testtd")
    	//	{
    	//		testtd[i].style.background = "#996699";
    	//	}
    	//}
    	
    			var check_url = "spellIndex.jsp?spell="+obj.id;
	 			var con = new Ext.data.Connection();   
				con.request({
				url: check_url,
				method: 'GET',
				callback: function(opts, success, response)
				{	
						var opts=response.responseText;
						if(opts != "")
						{
							 var tempPosi = getPosi();
							 var mouseX = document.getElementById("mouse_x").value;
   	   						 var mouseY = document.getElementById("mouse_y").value;
							 if(tempPosi == true) //当前鼠标在指定的范围内
							 {
								var arrayJS = Ext.decode(opts);
								var temp = 0;
								var showHtml = "<div style='width:416;height:192;background:lightyellow' class='pinyingsuoying'><table width='100%'><tr>";
								if(arrayJS.length>0)
								{
									for(var i=0;i<arrayJS.length;i++)
									{
										showHtml += "<td><a class=\"newest_list\" href=\"javascript:tolink('"+arrayJS[i].name+"','"+arrayJS[i].category+"')\">"+arrayJS[i].name+"</a></td>";
										temp++;
										if(temp == 3)
										{	
											temp = 0;
											showHtml += "</tr><tr>";
										}
									}
								}
								else
								{
									showHtml += "<td>该拼音索引下没有分类</td>";
								}
								showHtml += "</tr></table></div>";
				   				document.getElementById("divContent_show").innerHTML = showHtml;
				   			}
				   			else //当前鼠标不在指定的范围内
				   			{
				   				document.getElementById("divContent_show").innerHTML = "";
				   			}
						}
				}
				});
				var pydiv = document.getElementById(obj.id);
				var tds = document.getElementById("mytd"+obj.id);
				//alert("tds="+tds.id);
				if(pydiv)
				{
					pydiv.style.color="red";
					//tds.style.background = "lightyellow";
				}
   }
   function clearDIV(obj)
   {	
    	var spellpy = document.getElementsByTagName("span");
    	var testtd = document.getElementsByTagName("td");
    	for(var i=0;i<spellpy.length;i++)
    	{
    		if(spellpy[i].name == "spellpy")
    		{
    			spellpy[i].style.color = "#5b5853";
    		}
    	}
    	//for(var i=0;i<testtd.length;i++)
    	//{
    	//	if(testtd[i].name == "testtd")
    	//	{
    	//		testtd[i].style.background = "#996699";
    	//	}
    	//}
   		document.getElementById(obj.id).innerHTML = "";
   		
   }
   
   
   function clearDIVforSpell()
   {	
   		var spellpy = document.getElementsByTagName("span");
   		var testtd = document.getElementsByTagName("td");
    	for(var i=0;i<spellpy.length;i++)
    	{
    		if(spellpy[i].name == "spellpy")
    		{
    			spellpy[i].style.color = "#5b5853";
    		}
    	}
    	//for(var i=0;i<testtd.length;i++)
    	//{
    	//	if(testtd[i].name == "testtd")
    	//	{
    	//		testtd[i].style.background = "#996699";
    	//	}
    	//}
    	document.getElementById("divContent_show").innerHTML = "";
   }
   
   
   function tolink(param1,param2)
   {
 	 	 var en_name = encodeRequestParameter(param1);
   
 		 document.location = "search_cate_1.jsp?name="+en_name+"&wd1=category:'"+param2+"'"+"&category="+param2+"&areacode=0";  
   }
   
   //判断鼠标当前是否在指定的范围之内
   function getPosi()
   { 
       var curleft = curtop = 0;
   	   var obj = document.getElementById("spellDiv");
   	   var tableWidth = obj.offsetWidth;
   	   var tableHeight = obj.offsetHeight;
   	   var mouseX = document.getElementById("mouse_x").value;
   	   var mouseY = document.getElementById("mouse_y").value;
	   if (obj.offsetParent) 
	   {
			curleft = obj.offsetLeft
			curtop = obj.offsetTop
			while (obj = obj.offsetParent) 
			{
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
			}
	   }
	   if(mouseX < curleft || mouseX > curleft + tableWidth || mouseY < curtop || mouseY > curtop + tableHeight)
	   		return false;
	   else
	        return true;
   } 
   
　　//得到鼠标当前的位置
 	function mouseMove(ev)
	{
	 ev= ev || window.event;
	  var mousePos = mouseCoords(ev);
	  if(document.getElementById("mouse_x")&&document.getElementById("mouse_y"))
	  {
	      document.getElementById("mouse_x").value = mousePos.x;
	      document.getElementById("mouse_y").value = mousePos.y;
	  }
	}
	function mouseCoords(ev)
	{
		 if(ev.pageX || ev.pageY){
		   return {x:ev.pageX, y:ev.pageY};
		 }
		 return {
		     x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,
		     y:ev.clientY + document.body.scrollTop  - document.body.clientTop
		 };
	}
	
	Ext.onReady(function(){document.onmousemove = function(){mouseMove();}});
	//document.onmousemove = function(){mouseMove();}
	
	
	
	