function onEnterClick(event)
{
    if(event.keyCode==13)
    {
       event.keyCode=9;
       if(location.href.indexOf("msn.")>0)
            Search_Click('http://msn.brand.yoka.com');
        else
            Search_Click('http://brand.yoka.com');
    }
}
function ValateValue()
    {
        var tbPriceMin=document.getElementById('txtPriceMin');
        var tbPriceMax=document.getElementById('txtPriceMax');
        var numReg = new RegExp("^\\d*$");
        if(tbPriceMin !=null && tbPriceMin.value != "")
        {   
            if(!tbPriceMin.value.match(numReg))
            {
                alert("价格必须为数字");
                tbPriceMin.focus();
                return false;
            }
        }
        if(tbPriceMax != null && tbPriceMax.value != "")
        {
            if(!tbPriceMax.value.match(numReg))
            {
                alert("价格必须为数字");
                tbPriceMax.focus();
                return false;
            }
        }
        return true;
    }
    function Search_Click()
    {
        return Search_Click('');
    }
    function Search_Click(host)
    {
        if(ValateValue() == false)
            return false;
            
        var catalog= document.getElementById('SearchCatalog') !=null ? document.getElementById('SearchCatalog').value : 0;
        var character = document.getElementById('SearchCharacter') !=null ? document.getElementById('SearchCharacter').value : 0;
        var season = document.getElementById('SearchSeason') !=null ? document.getElementById('SearchSeason').value : 0;
        var key= document.getElementById('txtKey') !=null ? document.getElementById('txtKey').value : "";
        var domain=document.getElementById('SearchBrand') != null ? document.getElementById('SearchBrand').value : 'all';
        var pricemin=document.getElementById('txtPriceMin') !=null ? document.getElementById('txtPriceMin').value : 0;
        var pricemax=document.getElementById('txtPriceMax') !=null ?document.getElementById('txtPriceMax').value : 0;
    
        catalog=catalog<1?0:catalog;
        if (key=='请输入关键字') key='';
        key=key==''?'all':key;
        key=key.replace(/[\s]/g,"~28");
        key=key.replace("'","~27");
        key=key.replace("‘","~27");
        key=key.replace("’","~27");
        key=key.replace("+","~29");

	    pricemin=pricemin==''?0:pricemin;
	    pricemax=pricemax==''?0:pricemax;
	    pricemin = parseInt(pricemin);
	    pricemax = parseInt(pricemax);
	    if(pricemin > pricemax & (document.getElementById('txtPriceMax') !=null && document.getElementById('txtPriceMax').value.length > 0))     //判断大小   转化位置
	    {
	        var tmpPrice = pricemin;
	        pricemin = pricemax;
	        pricemax = tmpPrice;
	    }
        
        if(domain != "all" & domain != "" & catalog == 0 & key == "all" & pricemin == 0 & pricemax == 0 & character == 0 & season == 0)
        {
            if(host == null)
                window.open("/bag/"+domain+"/");
            else
                window.open( host+ "/bag/"+domain +"/");
        }
        else
        {
            var mylocation='/bag/'+domain+'/bagproduct_'+key+'_'+catalog+'_'+character+'_'+season+'_-1_0_'+pricemin+'_'+pricemax+'_10_1.htm';
    	    if(host == null)
                window.open( encodeURI(mylocation));
            else
    	        window.open(encodeURI(host+ mylocation));
    	}
    	return false;
    }
