﻿// JScript 文件

 //搜索按钮事件
        function Search()
        {
			var rad   =   document.getElementsByName("head$radiobutton");
			if(rad.length==0)
			{
			    rad   =   document.getElementsByName("Head960_1$radiobutton");  
			}
              for(var   i=0;   i<rad.length;   i++)   
              {   
                  if(rad[i].checked)   
                  {
                      type=rad[i].value; 
                      break;
                  }
              }
            var keyword=document.getElementById("Txt1").value;        
           
           
            if (type=="-1")
            {
                alert("请选择搜索类别！");
                document.getElementById("radiobutton").focus();
                return false;
            }
            
            if (Trim(keyword)=="" || Trim(keyword)=="请输入搜索关键词")
            {
                alert("请输入查询关键字！");
                document.getElementById("Txt1").focus();
                return false;
            }
           
           
            switch(type)
            {
                case "1":                    
                    window.location.href("/business/search.aspx?keyword="+keyword+"&businessType=1");
                    break;
                case "2":                    
                    window.location.href("/business/search.aspx?keyword="+keyword+"&businessType=2");
                    break;
                case "3":                    
                    window.location.href("/video/SearchList.aspx?keyword="+keyword+"&parent_id=6");
                    break;
                case "4":
                    window.location.href("/video/SearchList.aspx?keyword="+keyword+"&parent_id=7");
                    break;
                case "5":
                    window.location.href("/video/SearchList.aspx?keyword="+keyword+"&parent_id=39");
                    break;
                case "6":
                    window.location.href("/CompanyList.aspx?keyword="+keyword);
                    break;
                default:
                    
                    break;
            
            }
            return false;
            
        }        
        //搜索效果结束
        
        //去掉左右空格
	        function Trim(value)
	        {

		        var res = String(value).replace(/^[\s]+|[\s]+$/g,'');
		        return res;

            }
            
             //回车对应焦点
        function Keydown(element)
        {

           
            if(event.keyCode==13)
            {
                document.getElementById(element).click();
                return false;
            }
        }


