﻿function setTab(name,cursel,n)
{ 
	for(i=1;i<=n;i++)
	{ 
		var menu=document.getElementById(name+i); 
		var con=document.getElementById("con_"+name+"_"+i); 
		if(menu !=null){
		    menu.className=i==cursel?"hover":""; 
		}
		//alert(con);
		if(con!=null){
		    con.style.display=i==cursel?"block":"none"; 
		}
	} 
	if('tig'== name && cursel==4 && n == 4)
	{
		var leaveWordFrame = document.getElementById("con_tig_4");
		leaveWordFrame.style.display = "none";
	}
	else
	{
		var leaveWordFrame = document.getElementById("con_tig_4");
		//alert(leaveWordFrame);
		if(leaveWordFrame!=null){
		leaveWordFrame.style.display = "none";
	   }
	}
} 

//去字符串左右空格函数

function Trim(stringVar)
{
	var returnString="";
	returnString=stringVar.replace(/(^ *)/g, "");
	returnString=returnString.replace(/( *$)/g, "");
	return returnString;
}
function doClick(buttonName,e)
{
	//the purpose of this function is to allow the enter key to 
	//point to the correct button to click.
		var key;
		 if(window.event)
			  key = window.event.keyCode;     //IE
		 else
			  key = e.which;     //firefox
	
		if (key == 13)
		{
			//Get the button the user wants to have clicked
			var btn = document.getElementById(buttonName);
			if (btn != null)
			{ //If we find the button click it
				btn.click();
				event.keyCode = 0
			}
		}
}
function CheckSearchForm()
{
	   var searchKey = document.getElementById("txtSearchKey");
	   if(Trim(searchKey.value)==''){
	      alert("请输入搜索关键字");
	      searchKey.focus()
	      return false;
	   }
	   return true;
		
}
