<!--#include file="../../conn/conn.asp"-->
<!--#include file="../../inc/safe.asp"-->
<%
  Response.Buffer = true
  Response.ExpiresAbsolute=now()-1
  Response.Expires=0
  Response.CacheControl="no-cache"

if Not ChkPost then 
response.redirect ("../../login/chklogin.asp?login=4")
response.end
end if

if session("id")="" then 
session("geturl")=geturl
response.Redirect("../../login/login1.asp")
response.end
end if
%>


<script Language="JavaScript">
function check()
{
  if (trim(form1.messageTitle.value)=="") {
		alert("主题不能为空！");
		form1.messageTitle.focus();		
		    return (false);
  }
  if (trim(form1.messageContent.value)=="") {
		alert("主要内容不能为空！");
		form1.messageContent.focus();		
		    return (false);
  }
else
	document.form1.submit();
}
//-->
function trim(inputString) {
	   
              if (typeof inputString != "string") { return inputString; }
              var retValue = inputString;
              var ch = retValue.substring(0, 1);
              while (ch == " ") { 
	          //检查字符串开始部分的空格
                  retValue = retValue.substring(1, retValue.length);
                  ch = retValue.substring(0, 1);
              }
              ch = retValue.substring(retValue.length-1, retValue.length);
              while (ch == " ") {
                 //检查字符串结束部分的空格
                 retValue = retValue.substring(0, retValue.length-1);
                 ch = retValue.substring(retValue.length-1, retValue.length);
              }
              while (retValue.indexOf("  ") != -1) { 
	         //将文字中间多个相连的空格变为一个空格
                 retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); 
              }
              return retValue;
           } 

//--> 
</script>
<%
year_now = year(date())
month_now = month(date())
day_now = day(date()) 
%>
<%
dim sql
dim rs
dim id
if Chkrequest(request("id")) then
id=request("id")
else
Response.Redirect ("../../login/chklogin.asp?login=4")
end if

sql="select productshow.*,corporation.* from productshow,corporation where productshow.id="&id&" and corporation.id=productshow.gsid"
Set rs= Server.CreateObject("ADODB.Recordset") 
rs.open sql,conn,1,1
if rs.eof then
response.write "<p align='center'>对不起，没有您要查询的信息</p>"
else
gsid=rs("gsid")

if gsid=session("id") then
  response.write"<SCRIPT language=JavaScript>alert('请不要向自己询价！');"
  response.write"javascript:window.close();</script>"
  response.end
end if

set rsblak=conn.execute("select id from MemberRelation where [user]='"&rs("user")&"' and secuser='"&session("user")&"' and relation=-1")
if not (rsblak.eof and rsblak.bof) then
  response.write"<SCRIPT language=JavaScript>alert('对方已把您列入黑名单中，\n\n不能向对方询价。');"
  response.write"javascript:window.close();</script>"
  response.end
end if
%>
<!--#include file="head.asp"-->
<%
if Cint(request("Verifycode"))<>Session("Verifycode") then 
if request.form("Verifycode")="" and request.form("messageContent")="" then 
response.write""
else
response.write"<TABLE width=750 border=0 align='center' cellPadding=0 cellSpacing=0>"
response.write"<TR><td>"
response.write"<ul>"
response.write"<li><FONT color='ff0000'> 亲爱的会员，您的验证码输入错误，请再试一下</font><br>"
response.write"</li>"
response.write"</ul>"
response.write"</TR></td></table>"
end if
else

title=Replace_Text(request.form("messageTitle"))
content=Replace_Text(request.form("messageContent"))
needtrust=Replace_Text(request.form("needtrust"))
sendemail=Replace_Text(request.form("sendemail"))
saveSendMessage=Replace_Text(request.form("saveSendMessage"))
sendContact=Replace_Text(request.form("sendContact"))
checkdate=Replace_Text(request.form("checkdate"))
start_year=Replace_Text(request.form("start_year"))
start_month=Replace_Text(request.form("start_month"))
start_day=Replace_Text(request.form("start_day"))
requestinfo=Replace_Text(request.form("requestinfo"))
mycid=Replace_Text(request.form("mycid"))

if saveSendMessage<>"" then
set rs1=server.createobject("adodb.recordset")
sql1="select * from getprice1 where (id is null)" 
rs1.open sql1,conn,1,3
rs1.addnew
rs1("title")=title
rs1("content")=content

if sendemail<>"" then rs1("sendemail")=1

if needtrust<>"" then rs1("needtrust")=1

if sendContact<>"" then rs1("sendcontact")=1

if checkdate<>"" then 
rs1("checkdate")=1
rs1("limitedtime")=start_year&"年"&start_month&"月"&start_day
end if
rs1("requestinfo")=requestinfo
rs1("mycid")=mycid
rs1("sendcid")=session("id")
rs1("datetime")=now()
rs1.update
end if

set rs=server.createobject("adodb.recordset")
sql="select * from getprice where (id is null)" 
rs.open sql,conn,1,3
rs.addnew
rs("title")=title
rs("content")=content

if sendemail<>"" then rs("sendemail")=1

if needtrust<>"" then rs("needtrust")=1

if sendContact<>"" then rs("sendcontact")=1

if checkdate<>"" then 
rs("checkdate")=1
rs("limitedtime")=start_year&"年"&start_month&"月"&start_day
end if
rs("requestinfo")=requestinfo
rs("mycid")=mycid
rs("sendcid")=session("id")
rs("datetime")=now()
if saveSendMessage<>"" then
rs("getprice1id")=rs1("id")
rs1.close
set rs1=noting
end if
rs.update

rs.close
set rs=noting

conn.close
set conn=nothing
%>
<%
if sendemail<>"" then
email="webmaster@shangji.cn"
topic="你好！"
mailbody="测试！"
sendjmail email,topic,mailbody
end if
'If SendJmail(email,Topic,MailBody) = 1 Then
'	Response.Write "<br/><br/>资料成功发送到您的注册邮箱！"
'Else
'	Response.Write "<br/><br/>未正确设置邮件发送或您填写的邮件地址有误，资料发送失败！"
'End If
%>
<%
response.write"<SCRIPT language=JavaScript>alert('恭喜！询价成功！');"
response.write"javascript:window.close();</script>"
response.end
end if
%>

<FORM name=form1 action="" method=post>
<input type=hidden value=<%=rs("gsid")%> name=mycid>

<TABLE width=750 border=0 align="center" cellPadding=0 cellSpacing=0>
  <TBODY>
  <TR>
    <TD width=250>&nbsp;</TD>
    <TD><STRONG></STRONG></TD>
  </TR></TBODY></TABLE>
<TABLE width=750 border=0 align="center" cellPadding=0 cellSpacing=0>
  <TBODY>
  <TR>
    <TD vAlign=top>
      <TABLE width="100%" 
        border=0 cellPadding=0 cellSpacing=0 bgColor=#9ec4e5>
          <TBODY>
        <TR>
          <TD bgColor=#d9d9d9>
            <TABLE cellSpacing=1 cellPadding=5 width="100%" bgColor=F3F3F3 
            border=0>
              <TBODY>
              <TR bgColor=#ffffff>
                <TD class=C align=right width=100 
                bgColor=F3F3F3><B>发送给：</B></TD>
                <TD class=C>
                  <DIV id=nav><%=rs("qymc")%></DIV></TD></TR>
              <TR bgColor=#ffffff>
                <TD class=C align=right bgColor=F3F3F3><B>附加码： </B></TD>
                <TD class=C><INPUT tabIndex=3 size=12 name="Verifycode"> 请在附加码框中输入：<IMG src="../../inc/verifycode.asp?<%=timer()%>" height="15"></TD></TR>
              <TR bgColor=#ffffff>
                <TD class=C align=right bgColor=F3F3F3><B>主题：</B></TD>
                <TD><INPUT maxLength=50 size=50 value=我对您在发布的“<%=rs("cpmc")%>”很感兴趣 
            name=messageTitle> </TD></TR>
              <TR bgColor=#ffffff>
                <TD class=C vAlign=top noWrap align=right 
                  bgColor=F3F3F3><B>主要内容：</B></TD>
                <TD><TEXTAREA name=messageContent rows=10 cols=50></TEXTAREA> 
                </TD></TR>
              <TR bgColor=#ffffff>
                <TD vAlign=top align=right bgColor=F3F3F3>&nbsp; </TD>
                <TD class=C><FONT color=#003399><INPUT type=checkbox CHECKED 
                  name=needtrust>
                        请对方向我提供<FONT color=#003399><a href="/staric/index.asp">商贸通会员</a></FONT>档案<FONT color=#003399><IMG height=23 
                  src="../../images/staric.gif" 
                  width=22 align=absMiddle border=0></FONT> </FONT></TD>
          </TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD>
    <TD width=20>&nbsp;</TD>
    <TD 
    style="BORDER-RIGHT: #BBBBBB 1px solid; BORDER-TOP: #BBBBBB 1px solid; BORDER-LEFT: #BBBBBB 1px solid; BORDER-BOTTOM: #BBBBBB 1px solid" 
    vAlign=top width=200 bgColor=F3F3F3>
      <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TBODY>
        <TR>
          <TD style="BORDER-BOTTOM: #9ec4e5 1px solid" colSpan=2>
            <TABLE cellSpacing=1 cellPadding=5 width="100%" border=0>
              <TBODY>
              <TR>
                <TD class=M>请选择发送方式</TD></TR></TBODY></TABLE></TD></TR>
        <TR>
          <TD>
            <DIV align=center><INPUT type=checkbox CHECKED value=true
            name=sendEmail> </DIV></TD>
          <TD><SPAN class="lh15 C">发到对方电子邮箱</SPAN></TD></TR>
        <TR>
          <TD>
            <DIV align=center><INPUT type=checkbox disabled CHECKED value=1 
            name=sendMessage> </DIV></TD>
          <TD><SPAN class="lh15 C">网上留言 （限1500字）</SPAN></TD></TR>
        <TR>
          <TD>
            <DIV align=center><INPUT type=checkbox 
            CHECKED value=true name=saveSendMessage> </DIV></TD>
          <TD><SPAN class="lh15 C">保存到“我发出的留言”</SPAN></TD></TR>
        <TR>
          <TD>
            <DIV align=center><INPUT type=checkbox CHECKED value=true name=sendContact> </DIV></TD>
        <TD><SPAN 
  class="lh15 C">发送我的联系方式</SPAN></TD></TR></TBODY></TABLE></TD>
  </TR></TBODY></TABLE><BR>
<TABLE width=750 border=0 align="center" cellPadding=0 cellSpacing=0 bgColor=#ffffff>
  <TBODY>
  <TR>
    <TD class=C align=middle>
      <P align=left><INPUT type=checkbox value=yes name=checkDate>对方在 <select name="start_year">
              <%for i=2004 to 2008 %>
              <%if clng(i) = clng(year_now) then%>
               
					<option selected value="<%Response.Write i%>">
              <%Response.Write i%>
              </option>
				
              <%else%>
              
					<option value="<%Response.Write i%>">
              <%Response.Write i%>
              </option>
				
              <%end if%>
              <%next%>
              
	       	  </select> 年
            <select name="start_month">
                    
              <%for i=1 to 12%>
              <%if clng(i) = clng(month_now) then%>
              <option selected value="<%Response.Write i%>">
              <%Response.Write i%>
              </option>
              <%else%>
              <option  value="<%Response.Write i%>">
              <%Response.Write i%>
              </option>
              <%end if%>
              <%next%>
              
       	    </select> 月
	       	  <select name="start_day">
                    
              <% for i=1 to 31%>
              <%if clng(i) = clng(day_now) then%>
              <option selected value="<%Response.Write i%>">
              <%Response.Write i%>
              </option>
              <%else%>
              <option  value="<%Response.Write i%>">
              <%Response.Write i%>
              </option>
              <%end if%>
              <%next%>
              
	       	  </select> 日前答复！ 
      （如您希望对方在此前答复，请将方框点选为 <INPUT type=checkbox CHECKED value=yes 
      name=checkDate3> ）</P></TD></TR></TBODY></TABLE><BR>
<TABLE width=750 border=0 align="center" cellPadding=0 cellSpacing=0 bgColor=F3F3F3>
  <TBODY>
  <TR>
    <TD bgColor=#ff9933>
      <TABLE cellSpacing=1 cellPadding=5 width=750 bgColor=#9ec4e5 border=0>
        <TBODY>
        <TR bgColor=#e6f7ff>
          <TD class=M noWrap colSpan=3>我需要进一步了解的信息：</TD></TR>
        <TR bgColor=#ffffff>
          <TD class=C noWrap><INPUT type=checkbox value=产品规格、型号 name=requestInfo>产品规格、型号 </TD>
          <TD class=C noWrap><INPUT type=checkbox value=单价 name=requestInfo>单价 </TD>
          <TD class=C noWrap><INPUT type=checkbox value=价格条款 name=requestInfo>价格条款 </TD></TR>
        <TR bgColor=#ffffff>
          <TD class=C noWrap><INPUT type=checkbox value=原产地 name=requestInfo>原产地 </TD>
          <TD class=C noWrap><INPUT type=checkbox value=供货能力 name=requestInfo>供货能力 </TD>
          <TD class=C noWrap><INPUT type=checkbox value=销售条款及附加条件 
      name=requestInfo>销售条款及附加条件 </TD></TR>
        <TR bgColor=#ffffff>
          <TD class=C noWrap><INPUT type=checkbox value=最小订货量 name=requestInfo>最小订货量 </TD>
          <TD class=C noWrap><INPUT type=checkbox value=交货期 name=requestInfo>交货期 </TD>
          <TD class=C noWrap><INPUT type=checkbox value=能否提供样品 name=requestInfo>能否提供样品 </TD></TR>
        <TR bgColor=#ffffff>
          <TD class=C noWrap><INPUT type=checkbox value=产品担保 name=requestInfo>产品担保 </TD>
          <TD class=C noWrap><INPUT type=checkbox value=包装方式 name=requestInfo>包装方式 </TD>
          <TD class=C noWrap><INPUT type=checkbox value=质量/安全认证 name=requestInfo>质量/安全认证 
</TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE><BR>

<TABLE width=750 border=0 align="center" cellPadding=0 cellSpacing=0 bgColor=#ffffff>
  <TBODY>
  <TR>
      <TD align=left><A class=C 
      href="../modify/modify_info.asp" 
      target=_blank>检查我的联系信息是否有误</A></TD>
    </TR></TBODY></TABLE><BR>
<TABLE width=500 border=0 align="center" cellPadding=4 cellSpacing=0>
  <TBODY>
  <TR align=middle>
    <TD noWrap><INPUT type=button value="  发送  " name=sendButton onClick="check()"> 
    </TD>
    <TD noWrap><INPUT type=reset value="  重填  " name=resetButton> 
  </TD></TR></TBODY></TABLE></FORM><BR>
<BR>
<BR>
<%end if%>

<!--#include file="../../inc/end.asp"-->
<%
rsblak.close
set rsblak=nothing
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
