<!--
function AdvSearch(){
	var f=document.aSch;
	var sH="?";
	//sH+="ty="+f.Type1.options[f.Type1.selectedIndex].value;
	//sH+="&sz="+f.Size1.options[f.Size1.selectedIndex].value;
	sH+="&mk="+f.Make1.options[f.Make1.selectedIndex].value;
	sH+="&md="+f.Model1.options[f.Model1.selectedIndex].value;
	//sH+="&ta="+f.Trim1.options[f.Trim1.selectedIndex].value;
	if(f.Year1.selectedIndex < f.Year2.selectedIndex && f.Year2.selectedIndex != 0 && f.Year1.selectedIndex != 0){
		sH+="&y1="+f.Year2.options[f.Year2.selectedIndex].value;
		sH+="&y2="+f.Year1.options[f.Year1.selectedIndex].value;
	}
	else{
		sH+="&y1="+f.Year1.options[f.Year1.selectedIndex].value;
		sH+="&y2="+f.Year2.options[f.Year2.selectedIndex].value;
	}
	if(parseInt(f.Price1.options[f.Price1.selectedIndex].value) > parseInt(f.Price2.options[f.Price2.selectedIndex].value) && f.Price2.selectedIndex != 0  && f.Price1.selectedIndex != 0){
		sH+="&p1="+f.Price2.options[f.Price2.selectedIndex].value;
		sH+="&p2="+f.Price1.options[f.Price1.selectedIndex].value;
	}
	else{
		sH+="&p1="+f.Price1.options[f.Price1.selectedIndex].value;
		sH+="&p2="+f.Price2.options[f.Price2.selectedIndex].value;
	}
	sH+="&gr="+f.Gear.options[f.Gear.selectedIndex].value;
	sH+="&cl="+f.Color1.options[f.Color1.selectedIndex].value;
	//sH+="&pv="+f.Prov1.options[f.Prov1.selectedIndex].value;
	//sH+="&dp="+f.Dpmt1.options[f.Dpmt1.selectedIndex].value;
	//sH+="&mp="+f.Mpmt1.options[f.Mpmt1.selectedIndex].value;
	//if(f.isRB.checked) sH+="&rb=y";
	//sH+="&ck=y";
	document.location.href=Fnm+sH;
}	

function setMake(frm,sM) {
	var c=frm.Make1;
	var aM = eval("MK.split(',')");
	var j = 0;
	c.options[0]= new Option('---- ทั้งหมด ----','0');
	if(sM=='0' || sM=='') c.options[0].selected=true;

	for (i=0; i < (aM.length/2); i++) {
		c.options[i+1]= new Option(aM[j+1],aM[j]);
		if(aM[j]==sM) c.options[i+1].selected=true;
		j += 2;
	}	
}
function setModel(frm,MkID,sM) {
	var c=frm.Model1;
	while (c.options.length > 0) {
			c.options[(c.options.length - 1)] = null;	
	}
	c.options[0]= new Option('---- ทั้งหมด ----','0');
	if(sM=='0' || sM=='') c.options[0].selected=true;

	if(MkID != "0" && (MkID.substring(0,1)!="z") && MkID !="") {
	var aM = eval("MD['"+ MkID +"'].split(',')");
	var j = 0;
		if(aM != null){
		for (var i=0; i < aM.length/2; i++) {
				c.options[i+1]= new Option(aM[j+1],aM[j]);
				if(aM[j]==sM) c.options[i+1].selected=true;
				j += 2;				
		}
		c.disabled = false;	
	}
}
else 
{
	c.options[0].selected = true;
	c.disabled = true;
}
setTrim(frm,'0','0');
}

function setTrim(frm,MdID,sTrim) {
	var c=frm.Trim1;
	while (c.options.length > 0){
			c.options[(c.options.length - 1)] = null;	
	}
	c.options[0]= new Option('---- ทั้งหมด ----                    ','0');
	if(sTrim=='0' || sTrim=='') c.options[0].selected=true;

	if(MdID != "0" && MdID != "") {
	var aT = eval("TM['"+ MdID +"'].split(',')");
	var j = 0;
	if(aT !=null){
		for (var i=0; i < aT.length/2; i++) {
				c.options[i+1]= new Option(aT[j+1],aT[j]);
				if(aT[j]==sTrim) c.options[i+1].selected=true;
				j += 2;
			}
		}
		c.disabled = false;	
}
else 
	{
		c.options[0].selected = true;
		c.disabled = true;
	}
}

function setYear(frm,xid,fY,tY,sY){
	var c=frm.elements['Year'+xid];
	var dt=new Date();
	var opt;
	c.options[0]= new Option('----- ทุกปี -----','0');
	if(sY == '0' || sY == '') c.options[0].selected = true;
	for (var i=0; i <= (tY-fY); i++) {
		if((tY-i)==dt.getFullYear())
			opt="ปีแรก,"+(tY-i);
		else
			opt=(dt.getFullYear()-(tY-i))+" ปี,"+(tY-i);
			
		c.options[i+1]= new Option(opt,(tY-i));
		if((tY-i)==sY) c.options[i+1].selected=true;
	}
}
function setPrice(frm,xid,sP,tP){
	var c=frm.elements['Price'+xid];
	aP = new Array("100,000","100000","150,000","150000","200,000","200000","250,000","250000","300,000","300000","350,000","350000","400,000","400000","450,000","450000","500,000","500000","600,000","600000","700,000","700000","800,000","800000","900,000","900000","1,000,000","1000000","1,500,000","1500000","2,000,000","2000000");
	var ins=0;
	for(var i=0;i<aP.length;i++)	if(aP[i]==sP) ins=1;
	if(ins==0 && sP!=0)
		aP = new Array(tP,sP,"100,000","100000","150,000","150000","200,000","200000","250,000","250000","300,000","300000","350,000","350000","400,000","400000","450,000","450000","500,000","500000","600,000","600000","700,000","700000","800,000","800000","900,000","900000","1,000,000","1000000","1,500,000","1500000","2,000,000","2000000");	
	var j = 0;
	c.options[0]= new Option('--- ทุกราคา ---','0');
	if(sP=='0' || sP=='') c.options[0].selected = true;
	for (var i=0; i < aP.length / 2; i++) {
	c.options[i+1]= new Option(aP[j], aP[j+1]);
	if(aP[j+1]==sP) c.options[i+1].selected=true;
	j+=2;
	}
}
function setUpdate(frm,sU){
	if(sU=='0') frm.Upd0.checked=true;
	else if(sU=='7') frm.Upd1.checked=true;
	else if(sU=='30') frm.Upd2.checked=true;
}

function setTsg(ty,sz,gr){
	for(i=0;i<7;i++){
		if(f.Type1.options[i].value==ty) 
			f.Type1.options[i].selected=true;
	}
	for(i=0;i<4;i++){
		if(f.Size1.options[i].value==sz) 
			f.Size1.options[i].selected=true;
	}
	setGr(gr);
}
function setGr(gr)
{	
	if(gr=='A') f.Gear.options[1].selected=true;
	else if(gr=='M') f.Gear.options[2].selected=true;
	else f.Gear.options[0].selected=true;
}

function setDpmt(frm,sD){
	var c=frm.Dpmt1;
	for(i=0;i<c.length;i++){
		if(c.options[i].value==sD) c.options[i].selected=true;
	}
}
function setMpmt(frm,sD){
	var c=frm.Mpmt1;
	for(i=0;i<c.length;i++){
		if(c.options[i].value==sD) c.options[i].selected=true;
	}
}
//-->
