<%@ Language=VBScript%>
<%
Response.Buffer=false
Response.Expires=0
%>
<!-- #include file="./dsnroot.asp" -->
<!-- #include file="./links.asp" -->
<%
set cn=Server.CreateObject("ADODB.Connection")
set rs=Server.CreateObject("ADODB.Recordset")
set rs1=Server.CreateObject("ADODB.Recordset")
cn.Open mycnstr
sendok=0
sendok=cint(Request.QueryString("sendok"))
bus=Request.QueryString("bus")
id=Request.QueryString("id")
menu="000001"
if id="" then
		id=0
	else
		id=cint(id)
end if
if bus="" then
		bus=0
	else
		bus=cint(bus)
end if
if bus<>0 then
	sqltext="select id,title from danwei where id="&bus&" and ppid=13 and enable=1"
	rs.Open sqltext,cn,1,1
	if not rs.EOF then
		subject="About "&trim(rs("title"))
	end if
	rs.Close 	
end if


if id=0 then
		sqltext="select * from count where enable=1 order by pl"
		rs.Open sqltext,cn,1,1
		if not rs.EOF then
			id=rs("id")
		end if
		rs.Close 
end if

if id<>0 then
		sqltext="select * from count where enable=1 and id="&id
		rs.Open sqltext,cn,1,1
		if not rs.EOF then
				toname=rs("title")
				toemail=rs("email")
				totel=rs("tel")
				tofax=rs("fax")
				toadd=rs("add")
				topostyb=rs("postyb")
		end if
rs.Close 
end if
if sendok=0 then
if Request.ServerVariables("REQUEST_METHOD") = "POST" and toemail<>"" then
		sender = Request.Form("from")
		subject = Request.Form("subject")
		content=Request.Form("body")
		name = Request.Form("name")
		company = Request.Form("company")
		address = Request.Form("address")
		telphone = Request.Form("telphone")
		fax = Request.Form("fax")
		content=Request.Form("body")
				sqltext="select * from contact"
				rs.Open sqltext,cn,1,2
				rs.AddNew 
				rs("title")=subject
				rs("email")=sender
				rs("name")=name
				rs("toname")=toname
				rs("compa")=company
				rs("add")=address
				rs("tel")=telphone
				rs("fax")=fax
				rs("body")=content
				rs("toid")=checkrad
				rs("creatdate")=now()
				rs.Update 
				rs.Close
				s_string="姓名：" & name & chr(13) & chr(10) & "时间：" & now() & chr(13) & chr(10) & "公司：" & company & chr(13) & chr(10) & "地址：" & address & chr(13) & chr(10) & "电话：" & telphone & chr(13) & chr(10) & "传真：" & fax & chr(13) & chr(10) & "信箱：" & sender

				Set msg = Server.CreateObject("JMail.Message")
				msg.silent = true
				msg.Logging = true
				msg.Charset = "gb2312"
				msg.MailServerUserName = "public@9919.com.cn"   '输入smtp服务器验证登陆名 
				msg.MailServerPassword = "wangxin108"           '输入smtp服务器验证密码   （用户Email帐号对应的密码）
				msg.From = "public@9919.com.cn" '发件人Email
				msg.FromName = name				  '发件人姓名
				msg.AddRecipientBCC "xhaiy@hotmail.com"		 '密件传送'
				msg.Subject = "皖宝床垫网站留言:"+subject			 '信件主题
				msg.Body = "主题："&subject&chr(13)&chr(10)&s_string&chr(13)&chr(10)&content  '正文
				msg.AddRecipient toemail			 '收件人Email
				msg.Send ("smtp.sina.net")               'smtp服务器地址（企业邮局地址）
				set msg = nothing
				'set myobj=Server.CreateObject("cdonts.newmail")
				'myobj.From=sender
				'myobj.To="   "
				'myobj.BodyFormat=0
				'myobj.Subject="公众留言："+subject
				'myobj.Body= "----------------来自"+sender+"的邮件--------------"+chr(10)+chr(13)+s_string+chr(10)+chr(13)+content
				'myobj.Send()
				Response.Redirect(linkcontact&"?sendok=1&id="&id)	

end if
end if
%>

<!-- #include file="./func.inc" -->
<!-- #include file="./begin.asp" -->
      <table width="778" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td colspan="2" bgcolor="#FFFFFF" align="center" valign="top"> 
            <table width="100%" border="0" cellspacing="0" cellpadding="0" height="36">
              <tr> 
                <td width="20" background="images/nav2_bg2.gif">&nbsp;</td>
                <td width="188" background="images/nav2_bg2.gif"><a href="default.asp" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image8','','images/bt2_home2.gif',1)"><img name="Image8" border="0" src="images/bt2_home.gif" width="55" height="18"></a></td>
                <td background="images/nav2_bg2.gif" align="center">&nbsp; </td>
              </tr>
            </table>
            <table width="95%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td height="26">&nbsp;</td>
              </tr>
            </table>
            <table width="95%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td width="20" height="36"><img src="images/company/title_sign.gif" width="14" height="18"></td>
                <td class="font2"><font color="#996600"><b>CONTACT US</b></font></td>
                <td align=right><font color="#996600">Mail to <%=toname%></font></td>
              </tr>
            </table>
            <table width="95%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td background="images/company/point_line.gif" height="1"></td>
              </tr>
              <tr> 
                <td align="center"> 
                  <table width="95%" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td class="font1" height="10"></td>
                    </tr>
                    <tr> 
                      <td class="font1">
                        <%if toadd<>"" then%>
								ADD:<%=toadd%><br>
						<%end if%>		
						<%if totel<>"" then%>
								TEL:<%=totel%>&nbsp;&nbsp;
						<%end if%>
						<%if tofax<>"" then%>		
								FAX:<%=tofax%>&nbsp;&nbsp;
						<%end if%><br>
						<%if toemail<>"" then%>		
								EMAIL:<a href="mailto:<%=toemail%>" class="a12"><%=toemail%></a>
						<%end if%>		
					  </td>
                    </tr>
                    <tr>
                      <td class="font1" height="10"></td>
                    </tr>
                  </table>
                </td>
              </tr>
              <tr> 
                <td background="images/company/point_line.gif" height="1"></td>
              </tr>
              <tr>
                <td>&nbsp;</td>
              </tr>
            </table>
            <%if sendok=0 then%>  
            <table width="90%" border="0" cellspacing="0" cellpadding="0" valign=top style="line-height:200%">
               <form name="ccform" method="post" action="<%=linkcontact%>?id=<%=id%>" onsubmit="return checkinput(ccform)" autocomplete = "off">
                 <tr> 
                   <td height="30" align="right"><font color="#996600">TITLE：</font></td>
                   <td> <input name="subject" type="text" class="input1" size="50" value="<%=subject%>">&nbsp;<font color=red>*</font></td>
                 </tr>
                 <tr> 
                   <td height="30" align="right"><font color="#996600">YOUR EMAIL：</font></td>
                   <td><input name="from" type="text" class="input1" size="20"></td>
                 </tr>
                 <tr> 
                    <td height="30" align="right"><font color="#996600">YOUR NAME：</font></td>
                    <td><input name="name" type="text" class="input1" size="20">&nbsp;<font color=red>*</font></td>
                 </tr>
                 <tr> 
                     <td height="30" align="right"><font color="#996600">YOUR CORP：</font></td>
                     <td><input name="company" type="text" class="input1" size="50"></td>
                  </tr>
                  <tr> 
                      <td height="30" align="right"><font color="#996600">YOUR ADD：</font></td>
                      <td><input name="address" type="text" class="input1" size="50"></td>
                   </tr>
                   <tr> 
                      <td height="30" align="right"><font color="#996600">YOUR TEL：</font></td>
                      <td><input name="telphone" type="text" class="input1" size="30"></td>
                   </tr>
                   <tr> 
                      <td height="30" align="right"><font color="#996600">YOUR FAX：</font></td>
                      <td><input name="fax" type="text" class="input1" size="30"></td>
                    </tr>
                    <tr> 
                      <td height="26" align="right"><font color="#996600">CONTENT：</font></td>
                      <td><textarea name="body" cols="48" rows="5" class="input1"></textarea></td>
                     </tr>
                     <tr> 
                       <td>&nbsp;</td>
                       <td height="40"><input name="Submit3" type="submit" class="submit" value="Submit" style="font-size: 12px; color: white; border: 1px; width: 43px; background-color: #996600">
                          <input name="Submit4" type="reset" class="submit" value="Reset" style="font-size: 12px; color: white; border: 1px; width: 43px; background-color: #996600"> 
                       </td>
                  </tr>
               </form>
            </table>
            <%else%>
            <table width="80%" border="0" cellspacing="0" cellpadding="0" align="center" valign=top>       
			  <tr height=200>
				<td VALIGN="TOP" align=left  class="font1"><br>
				        <font color=cc6600 style="font-size=12px">Your messages have already reached <%=toname%>！</b><br>
						We will contact you as soon as possible.
				</td>
			  </tr>
			</table>
		    <%end if%>
          </td>
          <td bgcolor="#cc9933" valign="top" align="center" width="170"> 
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td> 
                  <div id="Layer3" style="position:absolute; width:10px; height:10; z-index:2"> 
                    <div id="Layer4" style="position:absolute; width:200px; height:115px; z-index:1; left: -15px; top: 80px"> 
                      <table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr> 
                          <td><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"   codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="307" height="60" id=ShockwaveFlash1>
                              <param name=movie value="images/f_wanbao.swf">
                              <param name=quality value=high>
                              <param name="wmode" value="transparent">
                              <embed src="images/f_wanbao.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="307" height="60">
                              </embed> 
                            </object></td>
                        </tr>
                      </table>
                    </div>
                  </div>
                </td>
              </tr>
            </table>
            <table width="170" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td height="145">&nbsp;</td>
              </tr>
            </table>
            <%sqltext="select * from count where enable=1 order by pl"
              rs.Open sqltext,cn,1,1
              do while not rs.EOF 
            %>
            <%if rs("id")<>id then%>
            <table width="170" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td background="images/news/nav_out_brown.gif"><a href="contact.asp?id=<%=rs("id")%>&bus=<%=bus%>" class="link2"><%=trim(rs("title"))%></a></td>
              </tr>
              <tr> 
                <td height="1"></td>
              </tr>
            </table>
            <%else%>
            <table width="170" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td background="images/news/nav_over_brown.gif"><a href="contact.asp?id=<%=rs("id")%>&bus=<%=bus%>" class="link2"><font color="#996600"><%=trim(rs("title"))%></font></a></td>
              </tr>
              <tr> 
                <td height="1"></td>
              </tr>
            </table>
            <%end if%>
            <%rs.MoveNext 
              loop
              rs.Close 
            %>
          </td>
          <td bgcolor="#FFF9E1" valign="top" align="center" width="137"> 
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td height="250">&nbsp;</td>
              </tr>
            </table>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td align="center" height="70"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"             codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="65" height="65" id=ShockwaveFlash2>
                    <param name=movie value="images/banner_service2.swf">
                    <param name=quality value=high>
                    <embed src="images/banner_service2.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="65" height="65">
                    </embed> 
                  </object></td>
              </tr>
              <tr> 
                <td align="center" height="70"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"             codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="65" height="65" id=ShockwaveFlash3>
                    <param name=movie value="images/banner_business2.swf">
                    <param name=quality value=high>
                    <embed src="images/banner_business2.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="65" height="65">
                    </embed> 
                  </object></td>
              </tr>
            </table>
          </td>
        </tr>
        <tr> 
          <td colspan="2" bgcolor="#FFFFFF" align="center" valign="top">
            <table width="95%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td colspan="2">&nbsp;</td>
              </tr>
              <tr> 
                <td background="images/company/point_line.gif" height="1" colspan="2"></td>
              </tr>
              <tr> 
                <td height="36" align="right"><img src="images/company/icon_top.gif" width="14" height="14"></td>
                <td height="36" width="30" align="center"><a href="#" class="a02">TOP</a></td>
              </tr>
            </table>
          </td>
          <td bgcolor="#CC9933" valign="top" align="center" width="170">&nbsp;</td>
          <td bgcolor="#FFF9E1" valign="top" align="center" width="137">&nbsp;</td>
        </tr>
        <tr>
          <td colspan="2" bgcolor="#FFFFFF" align="center" valign="top" height="36">&nbsp;</td>
          <td bgcolor="#CC9933" valign="top" align="center" width="170">&nbsp;</td>
          <td bgcolor="#FFF9E1" valign="top" align="center" width="137">&nbsp;</td>
        </tr>
      </table>
<!-- #include file="./end.asp" -->
 <script language=Javascript>
	var flag=true;
	function checkinput(form)
	{

		if(form("subject").value=="")
			{alert("Please input title!");form("subject").focus();flag=false;return flag;}else{flag=true;}	
		if(form("name").value=="")
			{alert("Please input your name!");form("name").focus();flag=false;return flag;}else{flag=true;}	

		if (flag==true) {flag=checkchar(form("subject").value)} 
		if (flag==true) {flag=checkchar(form("from").value)} 
		if (flag==true) {flag=checkchar(form("name").value)} 
		if (flag==true) {flag=checkchar(form("address").value)} 
		if (flag==true) {flag=checkchar(form("company").value)} 
		if (flag==true) {flag=checkchar(form("telphone").value)} 
		if (flag==true) {flag=checkchar(form("fax").value)} 
		if (flag==true) {flag=checkcharbody(form("body").value)} 
		
		return flag;
	}

	function checkchar(str)
	{
		str=str.toLowerCase()
		oldstr=str
		str="2"+str
		if (str.search("<"+"%")>0)  
		{
			window.alert("("+oldstr+")中有非法字符,请检查!");
			return false;
		}
		if (str.search("<scrip"+"t")>0)
		{
			window.alert("("+oldstr+")中有非法字符,请检查!");
			return false;
		}
		if (str.search("'")>0)
		{
			window.alert("("+oldstr+")中有非法字符,请检查!");
			return false;
		}
		if (str.search('"')>0)
		{
			window.alert("("+oldstr+")中有非法字符,请检查!");
			return false;
		}
		return true;
	}
	
	function checkcharbody(str)
	{
		str=str.toLowerCase()
		oldstr=str
		str="2"+str
		if (str.search("<"+"%")>0)  
		{
			window.alert("("+oldstr+")中有非法字符,请检查!");
			return false;
		}
		if (str.search("<scrip"+"t")>0)
		{
			window.alert("("+oldstr+")中有非法字符,请检查!");
			return false;
		}

		return true;
	}
	
</script>