<!--#include file="conn.asp"-->
<!--#include file="inc/exportProvice.asp"-->
<%
dim page, page_size, action
page = request.QueryString("page")
page_size = 10		'每页数据量
if page="" or isnumeric(page)=false then page=1
action = request.QueryString("action")
action2 = request.QueryString("action2")
userid = request.QueryString("userid")

if action = "qiugou" then
	sql = "select * from product where fabu=1 and fa_chuqiu='求购' order by id desc"
elseif action = "chushou" then
	sql = "select * from product where fabu=1 and fa_chuqiu='出售' order by id desc"
elseif action = "tuijian" then
	sql = "select * from product where fabu=1 and fa_chuqiu='出售' and recommend=1 order by id desc"
else
	sql = "select * from product where fabu=1 and fa_chuqiu='出售' order by id desc"
end if

if action2 = "geren" then
	sql = "select * from product where fabu=1 and fa_chuqiu='出售' and userid=" & userid & " order by id desc"
end if


'=============================================
dim prm				'需要保留的参数
prm = "action="& action & "&action2=" & action2 & "&userid="  & userid & "&" 

'=============================================
dim sql, have 

rs.open sql,conn,1,1

if not rs.eof then
	have = 1
	rs.pagesize     = page_size
	rs.absolutePage = page
	recordCountNum  = rs.recordcount
else
	have = 0
end if
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>出售车辆信息</title>
<link href="css/comm.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="inc/showo_page.js"></script>
<script type="text/javascript" src="js/city.js"></script>
</head>

<body>
<div class="bodyDiv">
<!--#include file="model_top.asp"-->
<!--#include file="model_daohang.asp"-->
 <table width="100%" height="21" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center"><div style="padding-bottom:3px; border-bottom:solid 3px #FF6600;"><!--#include file="model_searchH.asp"--></div></td>
  </tr>
</table>

 
 <table width="100%" height="176" border="0" cellpadding="0" cellspacing="0" background="images/viewmorecar/bg.jpg">
      <tr>
	  <td width="29%" valign="top">
	  <div style="border:solid 1px #D1CFCF; margin:8px 0 0 20px; padding:5px; background-color:#FFFFFF;">
      
	    <table width="100" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
          <tr>
            <td><img src="images/2008-1-151724.jpg" width="232" height="60"  /></td>
          </tr>
          <tr>
            <td><a href="user_buy.asp"><img src="images/viewmorecar/008.JPG" width="211" height="25" border="0" style="margin-top:5px;" /></a></td>
          </tr>
          <tr>
            <td><a href="user_mybuy.asp"><img src="images/viewmorecar/007.JPG" width="211" height="25" border="0" /></a></td>
          </tr>
          <tr>
            <td><a href="user_csAdd.asp"><img src="images/viewmorecar/006.JPG" width="211" height="25" border="0" /></a></td>
          </tr>
		  <tr>
            <td><a href="viewMorePgs.asp"><img src="images/viewmorecar/005.JPG" width="211" height="25" border="0" /></a></td>
          </tr>
		  <tr>
            <td><a href="viewMoreCar.asp?action=tuijian"><img src="images/viewmorecar/004.JPG" width="211" height="25" border="0" /></a></td>
          </tr>
		  <tr>
            <td><img src="images/viewmorecar/003.JPG" width="211" height="25" /></td>
          </tr>
		  <tr>
            <td><img src="images/viewmorecar/002.JPG" width="211" height="25" /></td>
          </tr>
		  <tr>
            <td><a href="reg1.asp"><img src="images/viewmorecar/001.JPG" width="211" height="25" border="0" /></a></td>
          </tr>
        </table>
	  </div></td>
        <td width="71%" valign="top">
		<div style="padding-left:12px;">
		<%
		if action = "chushou" or action2="geren" then response.write "<img src='images/viewmorecar/chushou.jpg' />"
		if action = "tuijian" then response.write "<img src='images/viewmorecar/tuijian.jpg' />"
		if action = "qiugou" then response.write "<img src='images/viewmorecar/qiugou.jpg' />"
		%>
		</div>
		<br />
        <%
		dim i
		i = 1
		do while not rs.eof and i <= page_size
		%>
        <table width="603" height="125" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td width="600" valign="top">
            <div style="line-height:30px;">
              <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td><img align="absmiddle" src="images/search1.jpg" width="13" height="13" />&nbsp;
                  <%response.write exportpinp(rs("productSort"),"pinpaiandxinghao")%>&nbsp;
				  <%="["&rs("fa_chuqiu")&"]"%>&nbsp;
				  <%
				  'if action = "tuijian" then response.write "<span style='color:#FF0000'>[本站推荐]</span>"
				  if rs("recommend") = 1 and rs("fa_chuqiu")="出售" then response.write "<span style='color:#FF0000'>[本站推荐]</span>"
				  %>
				  </td>
                  </tr>
              </table>
            </div>
            
            <table width="100%" border="0" cellspacing="1" cellpadding="0" style="color:#696969;">
              <tr>
                <td width="25%" rowspan="4">
				<%
				if rs("smallImg")="nothing" then
					imgtmp = "img/car1.gif"
				else
					imgtmp = rs("smallImg")
				end if
				%>
				<a href="view2Car.asp?id=<%=rs("id")%>" target="_blank"><img src="<%=imgtmp%>" width="134" height="70" style="border:solid 3px #F0F0F0;" /></a></td>
                <td width="29%" height="20" bgcolor="#F9F9F9">
				<%
				if action = "qiugou" then
					response.write "买主姓名："& rs("sell_name")
				elseif action = "chushou" or action = "tuijian" then
					response.write "年份："& rs("caryear") &"年"& rs("carmonth") &"月"
				end if
				%>				</td>
                <td colspan="2" bgcolor="#F9F9F9">发布类型：
				 <%
				  if ifchehanghuiyuan(rs("id"))="yes" then
						response.Write "车行"
				  else				  
				  		response.Write "个人"
				  end if
				%>		</td>
                </tr>
              <tr>
                <td height="20" bgcolor="#F9F9F9">
				<%
				if action = "qiugou" then
					response.write "预购价格："& rs("qgprice")
				elseif action = "chushou" or action = "tuijian" then
					response.write "价格："
					if rs("memberprice")=0 then response.write "价格面议" else response.write rs("memberPrice")
				end if
				%>				</td>
                <td colspan="2" bgcolor="#F9F9F9">&nbsp;</td>
                </tr>
              <tr>
                <td height="20" bgcolor="#F9F9F9">
				<%
				if action = "qiugou" then
					response.write "联系方式："& rs("tel")
				elseif action = "chushou" or action = "tuijian" then
					response.write "地点："& rs("provice_shi")
				end if
				%>				</td>
                <td colspan="2" bgcolor="#F9F9F9">&nbsp;</td>
                </tr>
              <tr>
                <td height="20" bgcolor="#F9F9F9">登记时间：<%=FormatTime(rs("fa_time"),4)%></td>
                <td width="23%" bgcolor="#F9F9F9">点击数量：<%=rs("hitnum")%></td>
                <td width="23%" bgcolor="#F9F9F9" class="moren"><a href="view2Car.asp?id=<%=rs("id")%>" target="_blank"><strong>【查看详情】</strong></a></td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td height="15"><img src="images/search2.jpg" width="600" height="3" /></td>
          </tr>
        </table>
        <%
		i = i + 1
		rs.movenext
		loop
		rs.close
		
		if have = 1 then
		%>
          <table width="597" height="12" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td><Script Language="JavaScript">
ShowoPage("<table style='BORDER-COLLAPSE: collapse' borderColor='#111111' height='10' cellSpacing='0' cellPadding='0' width='95%' border='0'><tr><td vAlign='bottom'  style='font-family: Verdana,宋体; font-size: 11.5px; line-height: 15px'>","</td></tr></table>","页次:<font color='red'>","</font>/","","&nbsp;","&nbsp;每页<font color='red'>","</font>&nbsp;","&nbsp;共计:<font color='red'>","</font></td><td vAlign='bottom' align='right'  style='font-family: Verdana,宋体; font-size: 11.5px; line-height: 15px'>","<font face=webdings>9</font>","<font face=webdings>7</font>","<font face=webdings>8</font>","<font face=webdings>:</font>","&nbsp;&nbsp;跳转:","<font color='orange'>[","]</font>","","","<font color='red'>","</font>","","",<%=recordCountNum%>,<%=page_size%>,4,"?p=parm1&<%=prm%>")
</Script></td>
            </tr>
          </table>
          <%
		  else
		  	response.write "<center>暂无任何信息！</center>"
		  end if%>
	    </td>
    </tr>
  </table>
<!--#include file="model_bottom.asp"-->
</div>
</body>
</html>

<%
'================================================
'功能：通过车辆id获得该车主是否车行会员
function ifchehanghuiyuan(carid)
	dim userid
	
	set rs_num = server.CreateObject("adodb.recordset")
	sql_num = "select top 1 userid from product where id =" & cint(carid)
	rs_num.open sql_num,conn,1,1

	if rs_num.eof then
		userid=-1
	else
		userid=rs_num("userid")
	end if
	rs_num.close
	
	if userid<>-1 then
		rs_num.open "select top 1 * from member where id="& cint(userid) &" order by id desc",conn,1,1
		ifchehanghuiyuan=rs_num("ifchehang")
		rs_num.close
	end if	
	
	if userid=-1 then
		ifchehanghuiyuan = "no"
	end if
	
end function

'找到车主id
function finduser(carid)
	dim userid
	
	set rs_num = server.CreateObject("adodb.recordset")
	sql_num = "select userid from product where id =" & cint(carid)
	rs_num.open sql_num,conn,1,1
	
	if rs_num.eof then
		userid=-1
	else
		userid=rs_num("userid")
	end if
	
	finduser=userid
end function
%>