
function Head(y)
    {
        this.st = y;
        this.SearchURL = "/Search/PResult.aspx?q={0}&y={1}&d=p2k";
        this.tempSearchURL = this.SearchURL;
    }
    Head.prototype.ground = function(i)
    {
       document.getElementById("CPJG").style.background = "url("+(i==1?"/images/search_over.jpg":"/images/search_default.jpg")+")";
       document.getElementById("CPJG").className = (i==1?"padtom sarover":"padtom sardefa");
       document.getElementById("CLCS").style.background = "url("+(i==2?"/images/search_over.jpg":"/images/search_default.jpg")+")";
       document.getElementById("CLCS").className = (i==2?"padtom sarover":"padtom sardefa");
       //document.getElementById("JZQY").style.background = "url("+(i==3?"/images/search_over.jpg":"/images/search_default.jpg")+")";
       //document.getElementById("JZQY").className = (i==3?"padtom sarover":"padtom sardefa");
//     document.getElementById("XWZX").style.background = "url("+(i==4?"/images/search_over.jpg":"/images/search_default.jpg")+")";
//     document.getElementById("XWZX").className = (i==4?"padtom sarover":"padtom sardefa");
       switch(i)
       {
           case 1:
           this.tempSearchURL = "/Search/PResult.aspx?q={0}&y={1}&d=p2k";
           break;
           case 2:
           this.tempSearchURL = "/search/FResult.aspx?q={0}&y={1}&d=f2p";
           break;
           //case 3:
           //   this.tempSearchURL = "/search/company.aspx?q={0}";
           //   return;
           //case 4:
           //tempSearchURL = "http://search.soucaicn.com/search/web/NResult.aspx?q={0}";
           //break;
           default:
          this.tempSearchURL = "/Search/PResult.aspx?q={0}&y={1}&d=p2k"; 
       }
    }
    Head.prototype.Search = function()
    {  
          if(document.getElementById("ctl00_cphPage_RadioButtonList2_0").checked) //注意checked不能写成Checked，要不然不成功
             this.tempSearchURL = "/Search/PResult.aspx?q={0}&y={1}&d=p2k";
          else
            this.tempSearchURL = "/search/FResult.aspx?q={0}&y={1}&d=f2p";
//        if(document.getElementById('RadioButtonList1_0')=="p2k")
//        {
           
//        }
//        else 
//        {
//             this.tempSearchURL = "/search/FResult.aspx?q={0}&y={1}&d=f2p";
//        }
        var txtquare = document.getElementById("txtNote");
	    if((txtquare.value.replace(/(^\s*)|(\s*$)/g,""))!="")
	    {
		    this.tempSearchURL = this.tempSearchURL.replace("{0}",escape(txtquare.value));
		    this.tempSearchURL = this.tempSearchURL.replace("{1}",this.st);
            window.location.href = this.tempSearchURL; 
	    }
	    else
	    {
		    window.alert("关键字不能为空！");
		    window.document.getElementById("txtNote").focus();
		    return;
	    }
    }
    Head.prototype.HotKeySearch=function()
    {
        hk = ['镀锌钢管','地砖' ,'陶瓷' ,'水泥' ,'铝型材' ,'铝塑复合板' ,'减振器']
        for(i = 0,j = hk.length;i<j;i++)
        {
            document.write("<a href='"+ this.SearchURL.replace("{1}",this.st).replace("{0}",escape(hk[i])) +"' target='_blank'>"+ hk[i] +"</a>&nbsp;&nbsp;");
//            if(i==4)
//             document.write("<br />");
        }
    }
    Head.prototype.HotAD = function()
    {
        document.write('<a href="http://www.soucaicn.com/Factory/Index.aspx?factorycode=100723" class="blue1" target="_blank">广州市南粤钢管有限公司</a>\
        <br />\
        <a href="http://www.soucaicn.com/Factory/Index.aspx?factorycode=100927" class="blue1" target="_blank">广州市羊城风机厂有限公司 </a>');
    }
    Head.prototype.SearchPress = function()
    {
        if(event.keyCode==13)
        {   
            event.keyCode=0;
            document.getElementById("imgsearch").click();
        }
    }
