var strReturn = "";
var tmp1 = "";
var tmp2 = "";
var tmp3 ="";    

function CheckForm()
{  
	if(document.getElementById("ProClass").selectedIndex < 1)
	{    
		if(document.getElementById("KeyWord").value == "")
		{      

			alert("请填写关键字！");
			document.getElementById("KeyWord").focus();  
			return false;
		}  
	}
	if (document.getElementById("ProClass").selectedIndex > 0 )
	{
		for( i =0 ; i< document.Form1.ProClass.length; i++)
		{
			if(document.Form1.ProClass.options[i].selected == true)
			{
				tmp1 = document.Form1.ProClass.options[i].value;
				break;
			}
		}
		strReturn="aType=" + tmp1.substr(0,2);//document.getElementById("ProClass").options[document.getElementById("ProClass").selectedIndex].Value ;//.Substring(0,2);
	}
	else
	{			
		strReturn="aType=%";			
	}
	
	if (document.getElementById("temp1").value.length > 0)
    {
        strReturn = strReturn + "&&iType="+ document.getElementById("temp1").value.substr(2,2);
    }
    else
    {
        strReturn=strReturn + "&&iType=%";
    }
    
    if (document.getElementById("temp2").value.length > 0)
    {
        strReturn=strReturn+"&&pType="+ document.getElementById("temp2").value.substr(4,2);
    }
    else
    {
        strReturn=strReturn+"&&pType=%";
	}
	
	if(document.getElementById("KeyWord").value.length > 0)	
	{
		strReturn = strReturn + "&&n="  + document.Form1.KeyWord.value;
	}
	else
	{
		strReturn= strReturn + "&&n=%";
	}  
	
	
	if(document.getElementById("MinPrice").value.length > 0)
    {	
		if(isNaN(parseFloat(document.getElementById("MinPrice").value)))
		{
		
			alert('价格输入错误，请重新输入');
			document.getElementById("MinPrice").focus();
			return false;
		}
		else
		{
		strReturn  = strReturn + "&&im=" + parseFloat(document.getElementById("MinPrice").value);
        }
    }
    else 
    {
		strReturn+="&&im=0";
    }
    
	if(document.getElementById("MaxPrice").value.length > 0)
    {
        if(isNaN(parseFloat(document.getElementById("MaxPrice").value)))
		{
		
			alert('价格输入错误，请重新输入');	
			document.getElementById("MaxPrice").focus();
			return false;
		
		}
		else
		{
        strReturn = strReturn + "&&am=" + parseFloat(document.getElementById("MaxPrice").value);
        }
    }
    else 
    {
		strReturn+="&&am=100000";				
    }
    
	for( i =0 ; i< document.Form1.SearchOrder.length; i++)
	{
		if(document.Form1.SearchOrder[i].checked == true)
		{
			tmp3 = document.Form1.SearchOrder[i].value;
			break;
		}
	}
	return true;		
}

function SetButtonIsExecuteSearch()
{
	if(!CheckForm())
	{
		//alert("False");
		Form1.action = "#";
		return false;
	}
	else
	{	
		//alert("true");
		strReturn = strReturn + "&orderby=" + tmp3;
		window.open("/store/pr_list.aspx?" + strReturn,"_self","","");
		return true;	
	}
}

function selectcas()
{
	var t = 1;
	ClassId=document.Form1.ProClass.selectedIndex;
	if(ClassId != 0)
	{
		ClassCode=document.Form1.ProClass.options[ClassId].value.substring(0,2);	
		if   (document.Form1.SubClass.length>1)
		{
			document.Form1.SubClass.length =1;
			document.Form1.SubClass.options[0].text="==小类==";
			document.Form1.SubClass.options[0].selected=true;
		}
	
		for(i=0;i<CatIndex.length;i++)
		{ 
			if (CatIndex[i].indexOf(ClassCode)!=-1 && CatIndex[i].indexOf(ClassCode)< 1)
			{       document.Form1.SubClass.length++;
				document.Form1.SubClass.options[t].text=CatName[i];
				document.Form1.SubClass.options[t].value= CatIndex[i];
				t++
			}
		}
	}
	else
	{
		document.Form1.SubClass.length =1;
		document.Form1.SubClass.options[0].text="==小类==";
		document.Form1.SubClass.options[0].selected=true;
	
	}
}


function selectmrk()
{
	var t = 1;
	MarkId=document.Form1.SubClass.selectedIndex;
	if(MarkId != 0)
	{
		MarkCode=document.Form1.SubClass.options[MarkId].value.substring(0,4);
		document.Form1.temp1.value=document.Form1.SubClass.options[MarkId].value;
		
		

	}
	
}



CatIndex = new Array();
CatName=new Array();

CatIndex[0]="010100";	CatName[0]="实木地板";
CatIndex[1]="010200";	CatName[1]="复合地板";
CatIndex[2]="010300";	CatName[2]="实木复合地板";
CatIndex[3]="010400";	CatName[3]="竹地板";


CatIndex[4]="020100";	CatName[4]="墙地砖";

CatIndex[5]="030100";	CatName[5]="洁具";
CatIndex[6]="030200";	CatName[6]="淋浴房/隔断";
CatIndex[7]="030300";	CatName[7]="卫浴五金";



CatIndex[8]="040100";  CatName[8]="内墙漆";

CatIndex[9]="040200";  CatName[9]="木器漆";
CatIndex[27]="040300";	CatName[27]="地板漆";


CatIndex[10]="050100";  CatName[10]="室内门";

CatIndex[11]="050200";  CatName[11]="无框阳台窗";
CatIndex[28]="050300";	CatName[28]="窗";



CatIndex[12]="060100";  CatName[12]="整体橱柜";

CatIndex[13]="060200";  CatName[13]="厨房电器";

CatIndex[14]="060300";  CatName[14]="大理石台面";



CatIndex[15]="070100";  CatName[15]="板式家具";

CatIndex[16]="070200";  CatName[16]="楼梯";
CatIndex[17]="070300";  CatName[17]="其他";

CatIndex[18]="080100";  CatName[18]="水电材料";

CatIndex[19]="080200";  CatName[19]="电器";





CatIndex[20]="090100";  CatName[20]="锅炉供暖";

CatIndex[21]="090200";  CatName[21]="电热地暖";


CatIndex[22]="100100";  CatName[22]="综合治理";

CatIndex[23]="100200";  CatName[23]="光触媒";
CatIndex[24]="100300";  CatName[24]="竹炭";

CatIndex[25]="110100";  CatName[25]="智能防盗";
CatIndex[26]="110200";  CatName[26]="智能布线";
CatIndex[29]="120100";	CatName[29]="其他";