<%
function GetOptioNums(tnum,cnum)
	dim ifselect,i
	for i=0 to tnum
		if(i=cnum) then
			ifselect=" selected"
		else
			ifselect=""
		end if
		GetOptioNums=GetOptioNums&"<option value="""&i&""" "&ifselect&">"&i&"</option>"&Chr(13)
	next
end function

function GetIntFormValue(fname)
	dim ret
	ret=request.Form(fname)
	if(ret<>"") then
		ret=Clng(ret)
	else
		ret=0
	end if
	GetIntFormValue=ret
end function

function GetDblFormValue(fname)
	dim ret
	ret=request.Form(fname)
	if(ret<>"") then
		ret=Cdbl(ret)
	else
		ret=0.00
	end if
	GetDblFormValue=ret
end function

function GetFloatFormValue(fname)
	dim ret
	ret=request.Form(fname)
	if(ret<>"") then
		ret=Cdbl(ret)
	else
		ret=0.00
	end if
	GetFloatFormValue=ret
end function

function GetSourceTitle(id)
	dim rs
	Set rs = conn.Execute("select title from t_source where id="&id)
	if not rs.eof then
		GetSourceTitle=rs(0)
	else
		GetSourceTitle="null"
	end if
	rs.close
	set rs=nothing
end function

function GetReSourceTitle(tbl,id)
	dim rs
	Set rs = conn.Execute("select title from "&tbl&" where id="&id)
	if not rs.eof then
		GetReSourceTitle=rs(0)
	else
		GetReSourceTitle="null"
	end if
	rs.close
	set rs=nothing
end function

function GetIndustryTitle(id)
	dim rs
	Set rs = conn.Execute("select title from t_industry where id="&id)
	if not rs.eof then
		GetIndustryTitle=rs(0)
	else
		GetIndustryTitle="null"
	end if
	rs.close
	set rs=nothing
end function

function GetSourceSelect(stype,id)
	dim ifselect,rs,sql,cid
	if(id<>"") then
		cid=id
	else
		cid=0
	end if
	sql="select id,f_title from t_source where f_type='"&stype&"' order by id asc"
	Set rs = conn.Execute(sql)
	if rs.eof or rs.bof then
		GetSourceSelect="<option value=""0"">...</option>"&Chr(13)
	else	
		while not rs.eof and not rs.bof
			if(Clng(rs(0))=Clng(cid)) then
				ifselect=" selected"
			else
				ifselect=""
			end if
			GetSourceSelect=GetSourceSelect&"<option value="""&rs(0)&""" "&ifselect&">"&rs(1)&"</option>"&Chr(13)
			rs.movenext
		wend
	end if
	rs.close
	set rs=nothing
end function

function GetSourceTextSelect(stype,txts)
	dim ifselect,rs,sql,cid
	if(id<>"") then
		cid=id
	else
		cid=0
	end if
	sql="select id,f_title from t_source where f_type='"&stype&"' order by id asc"
	Set rs = conn.Execute(sql)
	if rs.eof or rs.bof then
		GetSourceTextSelect="<option value=""0"">...</option>"&Chr(13)
	else	
		while not rs.eof
			if(txts<>"" and rs(1)=txts) then
				ifselect=" selected"
			else
				ifselect=""
			end if
			GetSourceTextSelect=GetSourceTextSelect&"<option value="""&rs(1)&""" "&ifselect&">"&rs(1)&"</option>"&Chr(13)
			rs.movenext
		wend
	end if
	rs.close
	set rs=nothing
end function

function GetSourceCheckBox(stype,formname,vals)
	dim ifselect,rs,sql,cid
	if(id<>"") then
		cid=id
	else
		cid=0
	end if
	sql="select id,f_title from t_source where f_type='"&stype&"' order by id asc"
	Set rs = conn.Execute(sql)
	while not rs.eof
		if(instr(vals,rs(1))>0) then
			ifselect=" checked="""&checked&""""
		else
			ifselect=""
		end if
		GetSourceCheckBox=GetSourceCheckBox&"<label><input type=""checkbox"" name="""&formname&""" value="""&rs(1)&""" "&ifselect&"  />"&rs(1)&"</label>"&Chr(13)
		rs.movenext
	wend
	rs.close
	set rs=nothing
end function

function GetAreaTitle(id)
	dim rs
	Set rs = conn.Execute("select title from t_area where id="&id)
	if not rs.eof then
		GetAreaTitle=rs(0)
	else
		GetAreaTitle="null"
	end if
	rs.close
	set rs=nothing
end function

function GetAreaSelect(pid,id)
	dim ifselect,rs,sql,cid
	if(id<>"") then
		cid=id
	else
		cid=0
	end if
	sql="select id,title from t_area where pid="&pid&" order by id asc"
	Set rs = conn.Execute(sql)
	if rs.eof or rs.bof then
		GetAreaSelect="<option value=""0"">...</option>"&Chr(13)
	else	
		while not rs.eof and not rs.bof
			if(Clng(rs(0))=Clng(cid)) then
				ifselect=" selected"
			else
				ifselect=""
			end if
			GetAreaSelect=GetAreaSelect&"<option value="""&rs(0)&""" "&ifselect&">"&rs(1)&"</option>"&Chr(13)
			rs.movenext
		wend
	end if
	rs.close
	set rs=nothing
end function

function GetResourceSelect(tbl,id)
dim ifselect,rs,sql,cid
if(id<>"") then
	cid=id
else
	cid=0
end if
sql="select id,title from "&tbl&" order by id asc"
Set rs = conn.Execute(sql)
while not rs.eof and not rs.bof
	if(Clng(rs(0))=Clng(cid)) then
		ifselect=" selected"
	else
		ifselect=""
	end if
	GetResourceSelect=GetResourceSelect&"<option value="""&rs(0)&""" "&ifselect&">"&rs(1)&"</option>"&Chr(13)
	rs.movenext
wend
rs.close
set rs=nothing
end function

function GetQiuZhuPrice(cval)
	dim ret
	select case(cval)
		case 0
			ret="面议"
		case 100
			ret="$200以下"
		case 200
			ret="$200-$400"
		case 400
			ret="$400-$600"
		case 600
			ret="$600-$800"
		case 800
			ret="$800-$1000"
		case 1000
			ret="$1000-$1500"
		case 1500
			ret="$1500-$2000"
		case 2000
			ret="$2000-$2500"
		case 2500
			ret="$2500-$3000"
		case 3000
			ret="$3000-$4000"
		case 4000
			ret="$4000以上"
	end select
	GetQiuZhuPrice=ret
end function

function GetBuyPrice(cval)
	dim ret
	select case(cval)
		case 0
			ret="面议"
		case 40000
			ret="5万以下"
		case 50000
			ret="5万-10万"
		case 100000
			ret="10万-20万"
		case 200000
			ret="20万-30万"
		case 300000
			ret="30万-40万"
		case 400000
			ret="40万-50万"
		case 500000
			ret="50万-60万"
		case 600000
			ret="60万-70万"
		case 700000
			ret="70万-80万"
		case 800000
			ret="80万-100万"
		case 1000000
			ret="100万-150万"
		case 1500000
			ret="150万-200万"
		case 2000000
			ret="200万以上"
	end select
	GetBuyPrice=ret
end function

function GetHouseTypeName(cval)
	dim ret
	select case(cval)
		case 1
			ret="住宅"
		case 2
			ret="写字楼"
		case 3
			ret="商铺"	
		case else
			ret="住宅"
	end select
	GetHouseTypeName=ret
end function
%>