<!--#include file="pysjzx_conn.asp"-->
<!--#include file="webconfig.asp"-->
<script language=JavaScript>
<%dim i_1,j_1
	set rs_s=server.createobject("adodb.recordset")
	sql="select * from province order by shengorder"
	rs_s.open sql,conn,1,1
%>
	var selects=[];
	selects['0']=new Array(new Option('--不限县--','0'));
<%
	for i=1 to rs_s.recordcount
%>
	selects['<%=rs_s("ShengNo")%>']=new Array(

new Option('--不限县--','0'),
<%
	set rs_s1=server.createobject("adodb.recordset")
	sql="select * from city where shengid="&rs_s("id")&" order by shiorder"
	rs_s1.open sql,conn,1,1
	if rs_s1.recordcount>0 then 
	%>


	<%		for j=1 to rs_s1.recordcount
		if j=rs_s1.recordcount then 
%>
		new Option('<%=trim(rs_s1("shiname"))%>','<%=trim(rs_s1("shiNo"))%>'));
<%		else
%>
		new Option('<%=trim(rs_s1("shiname"))%>','<%=trim(rs_s1("shiNo"))%>'),
<%
		end if
		rs_s1.movenext
		next
	else 
%>
		new Option('','0'));
<%
	end if
	rs_s1.close
	set rs_s1=nothing
	rs_s.movenext
	next
rs_s.close
set rs_s=nothing
%>
	function chsel(){
		with (document.formpub){
			if(province.value) {
				city.options.length=0;
				for(var i=0;i<selects[province.value].length;i++){
					city.add(selects[province.value][i]);
				}
			}
		}
	}
</script>
<html>
<head>
<title><%=webname%>-定购</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta content="<%=keyword%>" name="keywords">
<meta content="<%=description%>" name="description">
<LINK href="css/style.css" rel=stylesheet type=text/css>
</head>
<%function HTMLEncode2(fString)
	fString = Replace(fString, CHR(13), "")
	fString = Replace(fString, CHR(10) & CHR(10), "</P><P>")
	fString = Replace(fString, CHR(10), "<BR>")
	HTMLEncode2 = fString
end function%>
<%dim action
priceid=request.QueryString("priceid")
username=replace(request("username"),"'","")
action=request.QueryString("action")
if action="save" then
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from booking ",conn,1,3
rs.addnew
rs("priceid")=int(request("priceid"))'报价编号
rs("name")=HTMLEncode2(request("name"))'姓名
rs("sex")=HTMLEncode2(request("sex"))'性别
rs("tel")=HTMLEncode2(request("tel"))'电话
rs("province")=int(request("province"))'省
rs("city")=int(request("city"))'市
rs("color")=HTMLEncode2(request("color"))'颜色
rs("email")=HTMLEncode2(request("email"))'email
rs("buydate")=request("buydate")'购买意向
rs("Contract")=HTMLEncode2(request("Contract"))
rs("Contract2")=HTMLEncode2(request("Contract2"))
rs("content")=HTMLEncode2(request("content"))
rs("adddate")=now()
rs("username")=username
rs.update
rs.close
set rs=nothing
response.write "<br><br><table width=96% border=0 align=center cellpadding=0 cellspacing=0><tr><td height=86 bgcolor=#F5F5F5><div align=center>"
response.write "您的预约提交成功！<br><br><a href=javascript:window.close()>关闭窗口</a></div></td></tr></table>"
response.End
end if
%>
<%
		id=trim(request("id"))
		if IsNumeric(request.QueryString("id"))=False or request.QueryString("id")="" then
		response.write"<SCRIPT language=JavaScript>alert('参数错误');"
		response.write"javascript:history.go(-1)</SCRIPT>"
		response.end	
		end if
		sql="select * from price where estate=1 and  id=" &id & ""
		Set rs= Server.CreateObject("ADODB.Recordset")
		rs.open sql,conn,1,1
		if rs.bof and rs.eof then
			response.write"<SCRIPT language=JavaScript>alert('参数错误');"
		response.write"javascript:history.go(-1)</SCRIPT>"
				response.end
		end if
		%>
					

	<table cellSpacing="1" cellPadding="3" width="570" bgColor="#a8d7f6" border="0">
				<form name="formpub" onsubmit="return checkform(formpub)" method="post" action="order.asp?action=save">
				<tr>
					<td height=20  bgColor="#e9f2f7" colspan="2">
					<p align="center">订购</td>
				</tr>
				<tr>
					<td  bgColor="#FFFFFF" colspan="2">　</td>
				</tr>
				<tr>
					<td  bgColor="#FFFFFF" width="17%">订购车型：</td>
					<td  bgColor="#FFFFFF" bgColor="#ffffff">
					<font color="#ff0000"><%set rs2=server.createobject("adodb.recordset")
									rs2.open "select * from anclass where anclassid="&rs("anclass"),conn,1,1
									if rs2.recordcount>0 then
									response.write rs2("anclass")
									end if
									rs2.close%>-<%set rs2=server.createobject("adodb.recordset")
									rs2.open "select * from nclass where nclassid="&rs("nclass"),conn,1,1
									if rs2.recordcount>0 then
									response.write rs2("nclass")
									end if
									rs2.close%>-<%=rs("model")%></font>
									<input type=hidden name=priceid value="<%=id%>">
									<input type=hidden name=username value="<%=username%>">
									</td>
				</tr>
				<tr>
					<td  bgColor="#FFFFFF" width="17%">姓名：</td>
					<td  bgColor="#FFFFFF" bgColor="#ffffff">
					<input maxLength="20" name="name"> <font color="#ff0000">*</font></td>
				</tr>
				<tr>
					<td  bgColor="#FFFFFF" width="17%">性别：</td>
					<td  bgColor="#FFFFFF" bgColor="#ffffff">
					<select name="sex">
					<option value="男" selected>男</option>
					<option value="女">女</option>
					</select> <font color="#ff0000">*</font></td>
				</tr>
				<tr>
					<td  bgColor="#FFFFFF" width="17%">您的电话：</td>
					<td  bgColor="#FFFFFF" bgColor="#ffffff">
					<font color="#ff0000"><b>
					<input maxLength="50" size="40" name="tel"> </b>* 电话或手机</font></td>
				</tr>
				<tr>
					<td  bgColor="#FFFFFF" width="17%">您的地区：</td>
					<td  bgColor="#FFFFFF" bgColor="#ffffff"><select size="1" name="province" onChange=chsel()  class="wenbenkuang"  >
          <option value="0" selected>--不限市--</option>
          <%dim tmpShengid
tmpShengid=0
set rs_s=server.createobject("adodb.recordset")
sql="select * from province  order by shengorder"
rs_s.open sql,conn,1,1
while not rs_s.eof%>
    
          <option value="<%=rs_s("ShengNo")%>" ><%=trim(rs_s("ShengName"))%></option>
          <%
 
    rs_s.movenext
wend
rs_s.close
set rs_s=nothing
%></select><select size="1" size="18" name="city"  class="wenbenkuang"   >
                        <option value="0" >--不限县--</option>

            

 <%
set rs_s=server.createobject("adodb.recordset")
sql="select * from city where shengid="&tmpShengid&" order by shiorder"
rs_s.open sql,conn,1,1
while not rs_s.eof
%>
          <option value="<%=rs_s("ShiNo")%>" selected><%=trim(rs_s("ShiName"))%></option>
          <%
    rs_s.movenext
wend
rs_s.close
set rs_s=nothing
%>
</select>
&nbsp;
 					<font color="#ff0000">*</font></td>
				</tr>
				<tr>
					<td  bgColor="#FFFFFF" width="17%">车辆颜色：</td>
					<td  bgColor="#FFFFFF" bgColor="#ffffff">
					<input maxLength="20" size="15" name="color">
					<font color="#ff0000">*</font></td>
				</tr>
				<tr>
					<td  bgColor="#FFFFFF" width="17%">Email：</td>
					<td  bgColor="#FFFFFF" bgColor="#ffffff">
					<input maxLength="100" size="30" name="email"> </td>
				</tr>
				<tr>
					<td  bgColor="#FFFFFF" vAlign="top" width="17%">购买意向：</td>
					<td  bgColor="#FFFFFF" bgColor="#ffffff">
					<select name="buydate">
					<option value="随时准备购买" selected>随时准备购买</option>
					<option value="最近一周购买">最近一周购买</option>
					<option value="最近1个月购买">最近1个月购买</option>
					<option value="最近2个月购买">最近2个月购买</option>
					</select> </td>
				</tr>
				<tr>
					<td  bgColor="#FFFFFF" vAlign="top" width="17%">即时通讯：</td>
					<td  bgColor="#FFFFFF" bgColor="#ffffff">

					<input id="Contract_QQ" type="radio" CHECKED value="qq" name="Contract" class="input1"><label for="Contract_QQ">QQ</label>
	<input id="Contract_MSN" type="radio" value="msn" name="Contract" class="input1"><label for="Contract_MSN" >MSN</label> 
					<input class="wenbenkuang" maxLength="15" name="Contract2" ></td>
				</tr>
				<tr>
					<td  bgColor="#FFFFFF" vAlign="top" width="17%">其他：</td>
					<td  bgColor="#FFFFFF" bgColor="#ffffff">
					<textarea name="content" rows="3" cols="40"></textarea>
					<font color="#ff0000"><br>
					可以在这里告诉经销商您需要咨询的其他事项</font> </td>
				</tr>
				<tr>
					<td  bgColor="#FFFFFF" vAlign="top" colspan="2">
					<p align="center"> <input type="submit"   value=" 提交订单 "  name="saveorder" style="color: #FF0000"> 
      <input type="button" name="Button" value=" 关闭窗口 " onClick="window.close()"></td>
				</tr>
			</form>
		</table>
<script language="JavaScript">
<!--
function checkform(form) {
  if (form.name.value == ""){
    alert("请输入您的姓名!");
	form.name.focus();
	return false;
  }else if(form.tel.value == ""){
    alert("请输入您的联系电话!"); 
	form.tel.focus();
	return false;
  }else if(form.province.value == "0"){
    alert("请选择您所在的省!"); 
	form.province.focus();
	return false;
  }else if(form.city.value == "0"){
    alert("请选择您所在的市!"); 
	form.city.focus();
	return false;
  }else if(form.color.value == ""){
    alert("请输入订购车辆的颜色!"); 
	form.color.focus();	
	return false;
  }else if(form.content.value.length > 400){
  	alert("其他信息最多200个中文字!")
	form.content.focus();
	return false;						
  }else{
  	return true;
  }
} 
// -->
</script>