<!-----------------------------此页代码参照user_csAdd.asp页面--------------------------->
<!--#include file="userCheck.asp"-->
<!--#include file="conn.asp"-->
<!--#include file="inc/exportPinPai.asp"-->
<%
dim action, carId, info(23)
action = request.QueryString("action")
carId  = request.QueryString("carId")

if action = "xiugai" then
	set rs_xiugai = server.CreateObject("adodb.recordset")
	rs_xiugai.open "select * from product where id = "& carId &"",conn,1,1
	if not rs_xiugai.eof then
		info(0)  = rs_xiugai("sell_name")
		info(1)  = rs_xiugai("tel")
		info(2)  = rs_xiugai("addr")
		info(3)  = rs_xiugai("email")
		info(4)  = rs_xiugai("qgyongtu")
		info(5)  = rs_xiugai("qgprice")
		info(6)  = rs_xiugai("smallImg")
		info(7)  = rs_xiugai("introduce")
		info(8)  = rs_xiugai("yanglufei")
		info(9)  = rs_xiugai("baoxian")
		info(10) = rs_xiugai("nianjian")
		info(11) = toText(rs_xiugai("explain"))
		info(12) = rs_xiugai("leibie")			'车型
		info(13) = rs_xiugai("carColor")		'颜色
		info(14) = rs_xiugai("smallImg2")
		info(15) = rs_xiugai("smallImg3")
		info(16) = rs_xiugai("smallImg4")
		info(17) = rs_xiugai("smallImg5")
		info(18) = rs_xiugai("productSort")		'产品品牌路径
		info(19) = rs_xiugai("provice")			'省份
		info(20) = rs_xiugai("provice_shi")		'城市
	end if
	rs_xiugai.close
	set rs_xiugai = nothing
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" />
<style type="text/css">
body{font-size:12px; margin:0px;}
td{font-size:12px;}
</style>
<script src="js/comm.js" type="text/javascript"></script>
<script type="text/javascript" src="js/city.js"></script>
<script language="javascript">
/*显示品牌和型号选择框*/
function showxiugai()
{
try{
	if(getId("ifXiuGai").checked == true)
	{
		showOb("pinpaiDiv");
	}
	else
	{
		hiddenOb("pinpaiDiv");
	}
	
	/*省份菜单显隐情况*/
	if(getId("ifXiuGaiShengShi").checked == true)
	{
		showOb("shengfenDiv");
	}
	else
	{
		hiddenOb("shengfenDiv");
	}
}
catch(e){}
}

</script>

</head>

<body>
<table width="910" border="0" align="center" cellpadding="0" cellspacing="0">
  
  <tr>
    <td height="2" colspan="2"><!--#include file="user_top.asp"--></td>
  </tr>
  <tr>
    <td width="178" style="border-right:dotted 1px #CCCCCC; background-color:#F8F8F6;" height="200" valign="top">
    <!--#include file="user_left.asp"-->
    </td>
    <td width="732" valign="top">
	  <div style=" margin-top:2px;">
	  <table width="100%" border=0 align="center" cellPadding=3 cellSpacing=1 borderColorLight=#626D78 borderColorDark=#ffffff bgcolor="#CCCCCC" style="text-align:left;" class="tableList">
        <form method="post" action="user_buy_fun.asp" name="frmAnnounce" onSubmit="return  validate()">
          <tr bgcolor="#FFFFFF"> 
            <td height="25" colspan="3" align="right"> 
              <div align="center"><strong>汽车求购信息发布</strong></div></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td width="80" align="right">买主姓名：</td>
            <td height="22" colspan="2"> 
              <%if action = "xiugai" then%>
			  <input name="sell_name" type="text" id="sell_name" value="<%=info(0)%>" size="20">
			  <%else%>
			  <input name="sell_name" type="text" id="sell_name" value="<%=session("username")%>" size="20">
			  <%end if%>
              <font color="#FF0000"> * </font></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td height="22" align="right">联系电话：</td>
            <td height="22" colspan="2"> 
			  <%if action = "xiugai" then%>
              <input name="tel" type="text" id="tel2" value="<%=info(1)%>" size="20">
			  <%else%>
              <input name="tel" type="text" id="tel2" value="<%=getinfo(session("userId23"),"phone")%>" size="20">
			  <%end if%>
              <font color="#FF0000"> * </font></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td align="right">联系地址：</td>
            <td height="22" colspan="2"> 
			<%if action = "xiugai" then%>
              <input name="addr" type="text" id="addr" value="<%=info(2)%>" size="40">
			<%else%>
              <input name="addr" type="text" id="addr" value="<%=getinfo(session("userId23"),"address")%>" size="40">
			<%end if%>
              <font color="#FF0000"> * </font></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td align="right">E-mail&nbsp;：</td>
            <td height="22" colspan="2"> 
			<%if action = "xiugai" then%>
              <input name="email" type="text" id="email" value="<%=info(3)%>" size="20">
			<%else%>
              <input name="email" type="text" id="email" value="<%=getinfo(session("userId23"),"email")%>" size="20">
			<%end if%>
              <font color="#FF0000"> * </font> </td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td align="right">发布类型：</td>
            <td height="22" colspan="2"> 
              <input name="fa_class" type="radio" value="私人" checked>
              私人 
			  <%
			  if session("ifchehang") <> "yes" then
			  	response.write "<input name='fa_class' type='radio' value='车行' disabled='disabled'  />车行"
				response.write "&nbsp;&nbsp;&nbsp;&nbsp;<a href='user_chehang.asp'>申请车行会员</a>"
			else
				response.write "<input name='fa_class' type='radio' value='车行' />车行"
			end if
			  %></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td align="right">车&nbsp;型：</td>
            <td height="22" colspan="2"> 
              <select name="chexing">
                <%
				set rschexing = server.CreateObject("adodb.recordset")
				rschexing.open "select * from carfenlei",conn,1,1
				do while not rschexing.eof
				
				if info(12) = rschexing("fenlei") then
					tmp = "selected='selected'"
				else
					tmp = ""
				end if
				
				response.write "<option value='"& rschexing("fenlei") &"' "& tmp &">"& rschexing("fenlei") &"</option>"
				rschexing.movenext
				loop
				rschexing.close
				set rschexing =nothing
				%>
              </select>
              <font color="#FF0000">*</font> </td>
          </tr>
		  <tr bgcolor="#FFFFFF"> 
            <td align="right">品 牌：</td>
            <td height="22" colspan="2">
            <div style="float:left; color:#FF0000;">
			<%
			if action = "xiugai" then
				response.write getcpx(info(18))
				response.write "<input type='hidden' name='oldSortPath' id='oldSortPath' value='"& info(18) &"' />"
				response.write "&nbsp;&nbsp;<input type='checkBox' name='ifXiuGai' id='ifXiuGai' value='1' onclick='showxiugai()' /><strong>我要修改</strong>"
			end if
			%>
			 <div <%if action="xiugai" then response.write "style='display:none;'"%> id="pinpaiDiv"><%call exportPinPai()%></div>
			 </div>
			<div style="float:left; padding:5px 0; margin-left:3px;"><font color="#FF0000">*</font></div></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td align="right">交易地区：</td>
            <td height="22" colspan="2">
			<%
			if action="xiugai" then
				response.write info(19)&"&nbsp;-&nbsp;"&info(20)
				response.write "<input type='hidden' name='oldSheng' id='oldSheng' value='"& info(19) &"' />"
				response.write "<input type='hidden' name='oldShi' id='oldShi' value='"& info(20) &"' />"
				response.write "&nbsp;&nbsp;<input type='checkBox' name='ifXiuGaiShengShi' id='ifXiuGaiShengShi' value='1' onclick='showxiugai()' /><strong style='color:#FF0000;'>我要修改</strong>"
			else
			
			end if
			%>
			<div <%if action="xiugai" then response.write "style='display:none;'"%> id="shengfenDiv"><script language="javascript">showprovince('province', 'city', '');showcity('city', '');</script><font color="#FF0000"> * </font></div></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td align="right" valign="middle">使用年限：</td>
            <td colspan="2"> 
         <select name="qgnianxian" id="qgnianxian" size="1">
		 <%for kj = 1 to 20
		 response.write  "<option value='"& kj &"'>"& kj &"</option>"
		 next
		 %>
        </select></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td align="right" valign="middle">购车用途：</td>
            <td colspan="2"> 
              <input name="qgyongtu" type="text" id="qgyongtu" value="<%=info(4)%>"></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td align="right" valign="middle"><font color="#FF0000">*</font> 欲购买价：</td>
            <td colspan="2" valign="top"> 
              <input name="qgprice" type="text" id="qgprice" value="<%=info(5)%>" size="12">
              元左右</td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td align="right" valign="middle">汽车图片：</td>
            <td width="170" valign="middle"> 
              <input name="smallimg" type="text" id="img1" value="<%=info(6)%>" size="20" maxlength="200"></td>
            <td width="459" valign="top"><iframe name="Upload" frameborder="0" width="100%" height="30" scrolling="no" src="smallimg/upload1.asp"></iframe></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td align="right" valign="middle">前方视图：</td>
            <td valign="middle"> 
              <input name="smallimg2" type="text" id="img2" size="20" maxlength="200" value="<%=info(14)%>" /></td>
            <td valign="top"><iframe name="Upload" frameborder="0" width="100%" height="30" scrolling="no" src="smallimg/upload2.asp"></iframe></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td align="right" valign="middle">汽车横图：</td>
            <td valign="middle"> 
              <input name="smallimg3" type="text" id="img3" size="20" maxlength="200" value="<%=info(15)%>" /></td>
            <td valign="top"><iframe name="Upload" frameborder="0" width="100%" height="30" scrolling="no" src="smallimg/upload3.asp"></iframe></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td align="right" valign="middle">车内视图：</td>
            <td valign="middle"> 
              <input name="smallimg4" type="text" id="img4" size="20" maxlength="200" value="<%=info(16)%>" /></td>
            <td valign="top"><iframe name="Upload" frameborder="0" width="100%" height="30" scrolling="no" src="smallimg/upload4.asp"></iframe></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td align="right" valign="middle">车箱视图：</td>
            <td valign="middle"> 
              <input name="smallimg5" type="text" id="img5" size="20" maxlength="200" value="<%=info(17)%>" /></td>
            <td valign="top"><iframe name="Upload" frameborder="0" width="100%" height="30" scrolling="no" src="smallimg/upload5.asp"></iframe></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td align="right" valign="middle"><font color="#FF0000">*</font> 汽车颜色：</td>
            <td colspan="2" valign="top">
              <select name="carcolor" id="carcolor">
                <option value="黑色" selected="selected">黑色</option>
                <option value="白色">白色</option>
                <option value="蓝色">蓝色</option>
                <option value="红色">红色</option>
                <option value="绿色">绿色</option>
                <option value="黄色">黄色</option>
                <option value="紫色">紫色</option>
                <option value="银色">银色</option>
                <option value="珍珠白">珍珠白</option>
                <option value="炭灰色">炭灰色</option>
                <option value="墨绿色">墨绿色</option>
				<option value="其他">其他</option>
              </select>              </td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td align="right" valign="top"><font color="#FF0000"> * </font>配置要求：</td>
            <td colspan="2" valign="top"> 
              <p><%call peizhi("peizhichk","130px")	'函数在conn.asp文件中%>
                <br>
                附加配置: 
                <input name="introduce" type="text" id="introduce" value="<%=info(7)%>" size="55">
              </p></td>
          </tr>
		  <tr bgcolor="#FFFFFF"> 
            <td align="right" valign="top"><font color="#FF0000"> * </font>费用要求：</td>
            <td colspan="2" valign="top"> 
              <div style="margin-bottom:5px;">养路费：&nbsp;&nbsp;&nbsp;&nbsp;至<input name="yl2" type="text" id="yl2" value="<%=replace(info(8)&"","至","")%>" />
              <span style="color:#999999;">如：至1990-8-27</span> </div>
			  <div style="margin-bottom:5px;">保&nbsp;&nbsp;险：&nbsp;&nbsp;&nbsp;&nbsp;至<input name="bx2" type="text" id="bx2" value="<%=replace(info(9)&"","至","")%>" />
			  <span style="color:#999999;">如：至1990-8-27</span>			  </div>
		    <div style="margin-bottom:5px;">年&nbsp;&nbsp;检：&nbsp;&nbsp;&nbsp;&nbsp;至<input name="nj2" type="text" id="nj2" value="<%=replace(info(10)&"","至","")%>" />
		      <span style="color:#999999;">如：至1990-8-27</span></div></td>
          </tr>
		  <tr bgcolor="#FFFFFF">
		  	<td align="right" valign="top">其他要求：</td>
		    <td colspan="2"><textarea name="explain" cols="55" rows="8" id="explain"><%=info(11)%></textarea></td>
	      </tr>
          <tr bgcolor="#FFFFFF"> 
            <td colspan="3" align="right" valign="top"> 
              <div align="center"><input type="submit" name="Submit2" value="确定添加" class="an">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" name="Submit" value="重新填写" class="an">
                <font color="#FF0000"> *红星号的必须填写！</font>
                <input name="carId" type="hidden" id="carId" value="<%=carId%>" />
              </div></td>
          </tr>
        </form>
      </table>
	  </div></td>
  </tr>
</table>
<table width="910" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><!--#include file="model_bottom.asp"--></td>
  </tr>
</table>

</body>
</html>

<%
'找到车主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

'找到车主id
function getinfo(userid,lb)

	set rs_num = server.CreateObject("adodb.recordset")
	sql_num = "select top 1 * from member where id =" & cint(userid)
	rs_num.open sql_num,conn,1,1
	
	if not rs_num.eof then
		if lb="phone" then
			getinfo=rs_num("phone")
		elseif lb="address" then
			getinfo=rs_num("address")
		elseif lb="email" then
			getinfo=rs_num("email")
		end if
	end if
	rs_num.close
end function
%>

<%
'======================================
'功能：根据类别路径获得厂家品牌和型号名称
function getcpx(inf)
	dim tmp_arr, tmp_i, tmp_rs
	dim tmp_1
	
	set tmp_rs = server.CreateObject("adodb.recordset")
	
	if instr(inf,",")=0 then
		getcpx = "未知品牌型号"
	else
		tmp_arr = split(inf,",")
		for tmp_i = 0 to ubound(tmp_arr)
			tmp_rs.open "select * from carSort where id="& tmp_arr(tmp_i) &"",conn,1,1
			if not tmp_rs.eof then tmp_1 = tmp_1 &"-"&tmp_rs("sortName")
			tmp_rs.close()
		next
		tmp_1 = mid(tmp_1,2,len(tmp_1))
		
		getcpx = tmp_1
	end if
end function
%>