<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn/conn.asp"-->
<!--#include file="inc/Commoncode.asp"-->
<!--#include file="inc/CommonFunction.asp"-->
<!--#include file="inc/sendmail.asp" -->
<%Call SQLin()
if trim(request("Action"))="MailToFriend" then
toname=CheckStr(trim(request("toname")))
toemail=CheckStr(trim(request("toemail")))
names=CheckStr(trim(request("name")))
email=CheckStr(trim(request("email")))
content=CheckStrbox(trim(request("content")))
content=trim(request("content"))
mail_tit=CreateHTMLReplace(LoadMailTemp("to_friend",0))
mail_con=CreateHTMLReplace(LoadMailTemp("to_friend",1))
mail_tit=replace(mail_tit,"{$FR_收件人名称}",toname)
mail_tit=replace(mail_tit,"{$FR_发件人名称}",names)
mail_con=replace(mail_con,"{$FR_收件人名称}",toname)
mail_con=replace(mail_con,"{$FR_发件人名称}",names)
mail_con=replace(mail_con,"{$FR_邮件正文}",content)
mail_con=replace(mail_con,"{$FR_发件人邮箱}",email)
Call SendMail(toemail,mail_tit,mail_con)
CloseConn
response.write("<script language=javascript>alert('推荐信已成功发送！');location.href='javascript:window.close()';</script>")
response.end
else
hireid=request("hireid")
if hireid="" or Not IsNumeric(hireid) then
CloseConn
Response.Write "参数不足或参数错误！"
Response.End
end if
set rst=server.createobject("ADODB.Recordset")
sql="select * from job_c_hire where hire_id="&hireid
rst.open sql,conn,1,1
if rst.eof then
  rst.close
  set rst=nothing
  CloseConn
  response.write "此职位不存在，或已被管理员删除！"
  response.end
else
	hireid=rst("hire_id")
	hire_announcedate=rst("hire_announcedate")
	hire_comname=rst("hire_comname")
	rst.close
	set rst=nothing
end if
hire=CheckStr(trim(request("hire")))
if Request.Cookies(FRHRCMS)("user_login")<>"" then
member_login=Request.Cookies(FRHRCMS)("user_login")
set rs=server.createobject("ADODB.Recordset")
sql="select * from job_Member where Member_login='"&member_login&"' and Member_typeid=1"
rs.open sql,conn,1,3
if not rs.eof then
member_email=rs("member_email")
member_name=rs("member_name")
end if
rs.close
set rs=nothing
end if
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>发送职位-<%=hire%>给好友-<%=SiteTitle%></title>
<link href="member/css.css" rel="stylesheet" type="text/css" />
<script language="JavaScript">
<!--
 //功能：去掉字符串前后空格
//返回值：去掉空格后的字符串
function fnRemoveBrank(strSource)
{
 return strSource.replace(/^\s*/,'').replace(/\s*$/,'');
}
function Juge(theForm)
{
 if (fnRemoveBrank(theForm.toname.value) == "")
  {
    alert("请输入收信人姓名!");
	theForm.toname.focus();
    return (false);
  }
  if (fnRemoveBrank(theForm.toemail.value) == "")
  {
    alert("请输入收信人Email地址!");
	theForm.toemail.focus();
    return (false);
  }
  var objv = fnRemoveBrank(theForm.toemail.value);
  var pattern = /^([a-zA-Z0-9_-])+(\.([a-zA-Z0-9_-])+)*@([a-zA-Z0-9_-])+(\.([a-zA-Z0-9_-])+)+$/;
  flag = pattern.test(objv);
  if(!flag)
  {
    alert("电子邮件：格式不正确！请重新输入。");
	theForm.toemail.focus();
	return (false); 
  } 
 if (fnRemoveBrank(theForm.name.value) == "")
  {
    alert("请输入发信人姓名!");
	theForm.name.focus();
    return (false);
  }
  if (fnRemoveBrank(theForm.email.value) == "")
  {
    alert("请输入发信人Email地址!");
	theForm.email.focus();
    return (false);
  }
  var objv = fnRemoveBrank(theForm.email.value);
  var pattern = /^([a-zA-Z0-9_-])+(\.([a-zA-Z0-9_-])+)*@([a-zA-Z0-9_-])+(\.([a-zA-Z0-9_-])+)+$/;
  flag = pattern.test(objv);
  if(!flag)
  {
    alert("电子邮件：格式不正确！请重新输入。");
	theForm.email.focus();
	return (false); 
  } 
  if (fnRemoveBrank(theForm.content.value) == "")
  {
    alert("请输入邮件内容!");
	theForm.content.focus();
    return (false);
  }
 }
//-->
</script>
</head>
<body>
<div class="memmenul">
<div class="leftmenutit"><span>将<%=hire%>职位推荐给您的好友</span></div>
      <br class="br">
        <table width="98%"  border="0" align="center" cellpadding="4" cellspacing="0">
          <tr>
            <td class="prmtopborder2"><span class="font-title">友情提示：请填写下面表单里的每一项，以确保邮件能够正确投送到收件人邮箱！</span></td>
          </tr>
          <tr>
            <td height="117" valign="top" class="table2"><TABLE cellSpacing=2 cellPadding=5 width=100% align=center border=0>
              <form name="form1" action="sendmail.asp?Action=MailToFriend" method="post" onSubmit="return Juge(this)">
                <tr bgcolor="#efefef">
                  <td height="24" bgcolor="#efefef"><strong>收信人姓名：</strong></td>
                  <td bgcolor="#efefef"><input name="toname" type="text" id="toname" size="50" maxlength="100" />
                  <font color="#ff7800">*</font></td>
                </tr>
                <tr bgcolor="#efefef">
                  <td height="24" bgcolor="#efefef"><strong>收信人Email地址：</strong></td>
                  <td bgcolor="#efefef"><input name="toemail" type="text" id="toemail" size="50" maxlength="100" />
                  <font color="#ff7800">*</font></td>
                </tr>
                <tr bgcolor="#efefef">
                  <td height="24" bgcolor="#efefef"><strong>你的姓名：</strong></td>
                  <td bgcolor="#efefef"><input name="name" type="text" id="name" value="<%=member_name%>" size="50" maxlength="50" />
                  <font color="#ff7800">*</font></td>
                </tr>
                <tr bgcolor="#f9f9f9">
                  <td width="22%" height="24" bgcolor="#f9f9f9"><strong>你的Email地址：</strong></td>
                  <td width="78%" bgcolor="#f9f9f9"><input name="email" type="text" id="email" value="<%=member_email%>" size="50" maxlength="50">
                  <font color="#ff7800">*</font> </td>
                </tr>
                <tr bgcolor="#efefef">
                  <td bgcolor="#efefef"><strong>邮件内容：</strong></td>
                  <td bgcolor="#efefef"><textarea name="content" cols="50" rows="10" id="content">我在"<%=SiteName%>"（<%=SiteUrl%>）上看到<%=hire_comname%>正在招聘<%=hire%>，这个职位可能很适合你，建议你去看看，希望对你有所帮助。
<br />
这个职位的具体地址是：
<br />
<a href="<%=SiteUrl&FormatLink(hire_announcedate,2,3,hireid,0)%>" target="_blank">
<%=SiteUrl&FormatLink(hire_announcedate,2,3,hireid,0)%></a></textarea></td>
                </tr>
                <tr align="center" bgcolor="#f9f9f9">
                  <td colspan="2" valign="top"><input name="submit" type="submit" class="inputa3" value="  发 送  ">
                    &nbsp;</td>
                </tr>
              </form>
            </TABLE></td>
          </tr>
        </table>
</div>
<%CloseConn%>