<?php
/*********************************************************
程序名称：站长助手 WEBMASTER HELPER
作者：feixin
email:kusite@etang.com
版权：feixin (http://www.zc18.com)
//////////////////////////////////////////////////////////

最后编辑日期：2003-6-12
*********************************************************/

if (!defined('IN_WH')) {
  die("不要黑我啊");
}


?>

<script language="JavaScript1.2">
<!--

clckcnt = 0;
var postmaxchars = 4000;

ie = (document.all)? true:false
if (ie){
	function ctlent(obj) {
		if((event.ctrlKey && window.event.keyCode == 13) || (event.altKey && window.event.keyCode == 83)) {
			if(validate(this.document.FORM)) {
				this.document.FORM.submit();
			}
		}
	}
}

function clckcntr() {
	clckcnt++;
	if(clckcnt > 1) {
		if(clckcnt > 2) { return false; }
		alert('邮件已经发出了......\n\n' + '请等待片刻......\n\n' + '不要重复按提交键，谢谢！');
		return false;
	}
	return true;
}

function isMail(address)
{
if (address=="") return false
if (address.indexOf("@")==-1||address.indexOf("@")==0||address.indexOf("@")==address.length-1) return false
if (address.indexOf("@")!=address.lastIndexOf("@")) return false
return true
}
//------------------------
function VerifyInput(){
	if (document.form["email_fa[name]"].value == ""){
		alert("请输入你的名字");
		document.form["email_fa[name]"].focus();
		return false;
	}

	if (document.form["email_fa[email]"].value == "" || !(isMail(document.form["email_fa[email]"].value))){
		alert("请填写合法的email地址！");
		document.form["email_fa[email]"].focus();
		return false;
	}

	
	if (document.form["email_fa[email]"].value == ""){
		alert("请输入您的email地址");
		document.form["email_fa[email]"].focus();
		return false;
	}

	if (document.form["email_re[name]"].value == ""){
		alert("请输入收信人名称");
		document.form["email_re[name]"].focus();
		return false;
	}


	if (document.form["email_re[email]"].value == "" || !(isMail(document.form["email_re[email]"].value))){
		alert("请填写合法的email地址！");
		document.form["email_re[email]"].focus();
		return false;
	}

	
	if (document.form["email_re[email]"].value == ""){
		alert("请输入收信人的email地址");
		document.form["email_re[email]"].focus();
		return false;
	}
	

	if (postmaxchars != 0) {
		if (document.form["email_re[message]"].value.length <4) {
			alert("你的邮件内容太短了.\n\n请大于4字节.\n当前已有 "+document.form["email_re[message]"].value.length+" 字节.");
			clckcnt=0;
			return false; 
		}else if (document.form["email_re[message]"].value.length >4000) {
			alert("你的邮件内容太长了.\n\n请限制在4000字节以内.\n当前已有 "+document.form["email_re[message]"].value.length+" 字节.");
			clckcnt=0;
			return false; 
		}else {
		return true; 
		}
	}else{ 
		return true; 
	}

return true;
}
//-->
</script>

<form method="post" action="index.php?op=email_send" name="form" onsubmit="return VerifyInput();">
  <table width="620" border="0" cellpadding="0" cellspacing="0">
    <tr bgcolor="#F8F8F8" bordercolor="#000000"> 
      <td width="50%"><b>发送给 :</b>&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="email_re[name]"> </td>
	  <td width="50%"><b>他的Email：</b>&nbsp;<input type="text" name="email_re[email]"> </td>
    </tr>
    <tr bgcolor="#FFFFFF" bordercolor="#000000"> 
      <td width="50%">你的名字 :</b>&nbsp;<input type="text" name="email_fa[name]"> </td>
	  <td width="50%">你的Email&nbsp;：<input type="text" name="email_fa[email]"> </td>
    </tr>
    <tr bgcolor="#F8F8F8" bordercolor="#000000">
      <td colspan=2>邮件标题：<input name="email_re[subject]" type="text" id="email_re[subject]" size=40></td>
    </tr>
    <tr bgcolor="#FFFFFF" bordercolor="#000000"> 
      <td colspan=2>内容 :&nbsp;发送格式:&nbsp;<input type="radio" name="email_re[txtorhtml]" value="0" checked>文本格式&nbsp;<input type="radio" name="email_re[txtorhtml]" value="1">HTML格式<br />
	  <textarea onKeyDown=ctlent() onkeyup=checkcomments() rows="18" name="email_re[message]" cols="90" wrap="VIRTUAL" value=""></textarea> 
      </td>
    </tr>
    <tr>
      <td colspan="2"> <div align="center">
	  <input type="hidden" name="submitmail" value="yes">
          <input type="submit" name="sumbit" value="提交">
          <input type="reset" name="reset" value="重置">
        </div></td>
    </tr>
  </table>
</form>