function $(obj)
{
    return document.getElementById(obj);
}
function search_onkeypress()
{
    if(event.keyCode==13){
        gourl();
        return false;
    }
}
function gourl()
{
    var _keywords = $("searchkeywords").value.replace(/[^0-9a-zA-Z]+/g,"+").replace(/(^\+*)|(\+*$)/g,"");
	if(_keywords.length<2){return false;}
	var _by = $("by").value;
	var _class = $("dsearch1_withInCheck").value;
    window.location.href= "/"+_by+".aspx?keywords="+_keywords+"&tp="+_class;
    if(_class==='0') {
        switch (_by){
            case "productsearch": window.location.href="/product-s/"+_keywords+".html";break;
            case "offersearch":window.location.href="/offer-s/"+_keywords+".html";break;
            case "companysearch":window.location.href="/manufacturers-s/"+_keywords+".html";break;
        }
    }
    else {
        switch (_by){
            case "productsearch": window.location.href="/product-s/"+_keywords+"/"+ _class +".html";break;
            case "offersearch":window.location.href="/offer-s/"+_keywords+"/"+ _class +".html";break;
            case "companysearch":window.location.href="/manufacturers-s/"+_keywords+"/"+ _class +".html";break;
        }
    }
}


//Ê×Ò³ËÑË÷
function gourll()
{
    var _keywords = $("searchkeywords").value.replace(/[^0-9a-zA-Z]+/g,"+").replace(/(^\+*)|(\+*$)/g,"");
	if(_keywords.length<2){return false;}
	var _by = $("by").value;
	
	var _class = $("_serchtypeid").value;
	if(_class=="")
	{
	    _class = "0";
	}
	else
	{
	    _class = $("_serchtypeid").value;
	}	
    
    window.location.href= "/"+_by+".aspx?keywords="+_keywords+"&tp="+_class;
    
    if(_class=='0') 
    {
        switch (_by)
        {
            case "productsearch": window.location.href="/product-s/"+_keywords+".html";break;
            case "offersearch":window.location.href="/offer-s/"+_keywords+".html";break;
            case "companysearch":window.location.href="/manufacturers-s/"+_keywords+".html";break;
        }
    }
    else 
    {
        switch (_by)
        {
            case "productsearch": window.location.href="/product-s/"+_keywords+"/"+ _class +".html";break;
            case "offersearch":window.location.href="/offer-s/"+_keywords+"/"+ _class +".html";break;
            case "companysearch":window.location.href="/manufacturers-s/"+_keywords+"/"+ _class +".html";break;
        }
    }
}