<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../Include/conn.asp" -->
<!--#include file="../Include/ConnDatabase.asp" -->
<!--#include file="../Include/NoHackSql.Asp" -->
<%
'=====================================
'天天企业网站管理系统  TianTianCMS
'天天网络科技工作室版权所有
'官方网站http://www.ip126.com
'QQ:530051328 mail:bbfhq@163.com
'=====================================
%>
<%call SiteInfo
headid=10
Seotitle="签写留言"
%>
<!--#include file="Head.Asp" -->
<%
dim mMemID,mMemName,mGroupIdName,mRealName,mSex,mQuestion,mCompany,mAddress,mZipCode,mTelephone,mFax,mMobile,mUserqq,mEmail,mHomepage,mAddTime,mLoginTimes,mLastLoginTime,mLastLoginIP,mLinkman
dim MesName,Content,SecretFlag
if session("MemName")<>"" and session("MemLogin")="Succeed" then
  call MemInfo()
else
  mSex="先生"
  mMemID=0
  SecretFlag="<font color=""red"">会员功能，请先注册会员。</font>"
end if
%>

<TABLE width="960" border=0 align="center" cellPadding=0 cellSpacing=0 bgcolor="#FFFFFF">
  <TR>
    <TD height="5"></TD>
  </TR>
  <TR> 
    <TD height="172" ><table width="960" height="100%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr> 
          <td class="tdbg_left"  width="190" height="179" valign="top" > <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td height="34" class="title_left">&nbsp;&nbsp;&nbsp;<img src="../images/smallbook.jpg" width="10" height="10">&nbsp;&nbsp;用户登陆 
                </td>
              </tr>
              <tr> 
                <td height="5"></td>
              </tr>
              <tr> 
                <td height="10"><table width="88%" border="0" align="center" cellpadding="0" cellspacing="0">
                    <tr> 
                      <td> 
                       
	<iframe src="login.asp"  frameborder="0" border="0px" scrolling="no" class="frame" height="120px" width="160px"></iframe>
                      </td>
                    </tr>
                  </table></td>
              </tr>
              <tr> 
                <td height="5"></td>
              </tr>
            </table>
            <table width="100%" border="0" cellpadding="0" cellspacing="0">
              <tr> 
                <td height="34" class="title_left">&nbsp;&nbsp;&nbsp;<img src="../images/smallbook.jpg" width="10" height="10">&nbsp;&nbsp;留言中心</td>
              </tr>
     
 	<%=WebMenu()%>

            </table></td>
          <td width="6"></td>
          <td valign="top"><table Class=border width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
              <tr> 
                <td height="206" valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td class="
title_right" height="32">&nbsp;&nbsp;&nbsp;<img src="../images/smallbook.jpg" width="10" height="10">&nbsp;留言中心</td>
                    </tr>
			<TR> 
              <TD    
                  height=1> 
 <table width="100%" height="19" border="0" align="center" cellpadding="0" cellspacing="0">
                  <tr> 
                            <td width="80%" height="18" bgcolor="#eeeeee"><%=WebLocation()%>签写留言</td>
                        <td width="79%" bgcolor="#eeeeee">&nbsp; </td>
                  </tr>
                  <tr> 
                    <td height="1" colspan="2" bgcolor="#999999"></td>
                  </tr>
                </table>
                <table width="100%" border="0" align="center" cellpadding="0" cellspacing="3" bgcolor="#FBFEFF">
                  <tr> 
                    <td height="8"></td>
                  </tr>
                 
                  <tr> 
                        <td>
			   <table border="0" cellpadding="0" cellspacing="0" width="100%">
        <tr>
          <td height="20"><table width="100%" border="0" align="center" cellpadding="3" cellspacing="5">
		  <%If message=false Then
		  response.write "抱歉，未开放留言功能！"
		  response.End
		  End if%>
<script language="javascript">
<!--
//＝＝＝＝＝＝＝＝＝＝＝＝＝验证码正确性检测＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝
//＝＝＝＝＝＝＝＝＝＝＝＝按钮有效性＝＝＝＝＝＝＝＝＝＝＝＝＝＝
		var flag=[0,0,0];//这里设置按钮要判断的个数
		var $=function(tagName){
			return document.getElementsByTagName(tagName);
		}
//－－－－－－－－－检查数据,使提交按钮是否生效－－－－－－－－－－－－－
			function check_data(){
				if(flag[1]==1 && flag[2]==1 && flag[3]==1){
					$("input")[id="input"].disabled=false;
				}
				else{
					$("input")[id="input"].disabled=true;
				}
			}
			function check_MesName(id_name){			
                var reId=/^.{2,100}$/;//限2－100个字符
				var b_id=reId.test(id_name);
				if(!b_id){
					$("span")[id="MesName"].innerHTML="<img src='../images/yesno.gif'/>主题要求2－100个字符";
					flag[1]=0;
					check_data();
				}
				else{
					$("span")[id="MesName"].innerHTML="<img src='../images/yesok.gif'/>主题符合要求";
					flag[1]=1;
				}
			}
			function check_Content(id_name){				
                var reId=/^.{2,500}$/;//限2－500个字符
				var b_id=reId.test(id_name);
				if(!b_id){
					$("span")[id="num"].innerHTML="<img src='../images/yesno.gif'/>内容要求2－500个字符";
					flag[2]=0;
					check_data();
				}
				else{
					$("span")[id="num"].innerHTML="<img src='../images/yesok.gif'/>内容符合要求";
					flag[2]=1;
				}
			}
			function check_Linkman(id_name){				
                var reId=/^.{1,50}$/;//限1－50个字符
				var b_id=reId.test(id_name);
				if(!b_id){
					$("span")[id="Linkman"].innerHTML="<img src='../images/yesno.gif'/>名字要求1－50个字符";
					flag[3]=0;
					check_data();
				}
				else{
					$("span")[id="Linkman"].innerHTML="<img src='../images/yesok.gif'/>符合要求";
					flag[3]=1;
				}
			}

function checkcode(regcode){	
	var xmlhttp;
	try{
		xmlhttp=new XMLHttpRequest();
		}
	catch(e){
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	xmlhttp.onreadystatechange=function(){
	if (xmlhttp.readyState==4){
		if (xmlhttp.status==200){
			var data=xmlhttp.responseText;
			code_result(data);
			}
		else{
			$("span")[id="GetCode"].innerHTML="验证码校验失败,请联系管理员";
			}
		}
	else{
		$("span")[id="GetCode"].innerHTML="正在进行验证码校验...";
		}
	}
	xmlhttp.open("post", "../Include/check_code.asp", true);
	xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
	xmlhttp.send("regcode="+escape(regcode));
}
function code_result(data){
	var resultbox=$("span")[id="GetCode"];
	if(data==1){
		resultbox.innerHTML='<img src="../images/yesok.gif"/> 验证码正确';
		flag[2]=1;
		check_data();
		}
	else{
		resultbox.innerHTML='<img src="../images/yesno.gif"/> 验证码错误';
		flag[2]=0;
		check_data();
		}
}
	
			
	//--------------------------------------------------------------------

//验证邮箱正确性
function checkemail(email){
var str=email;
//在JavaScript中，正则表达式只能使用"/"开头和结束，不能使用双引号
var Expression=/\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/; 
var objExp=new RegExp(Expression);
if(objExp.test(str)==true){
return true;
}else{
return false;
}
} 

//说明字节数限制，与下面配合=========
String.prototype.Length=function(){
temp=this.replace(/([^\x00-\xff])/g,"$1$1");
return temp.length
}
//显示输入字符数

function kn()
  {
   var ln=myform.Content.value.Length();
     num.innerText='您还可以输入:'+(500-ln)+'个字符，'+(<%=500/2%>-ln/2)+'汉字';
      //if (ln>=8) form.memo.readOnly=true;  //这行是如果满足条件表单无法输入和修改
}

function myform_onsubmit() {
if (document.myform.MesName.value==0)
	{
	  alert("请填写留言主题！")
	  document.myform.MesName.focus()
	  return false
	 }
if (document.myform.Content.value==0)
	{
	  alert("请填写留言内容！")
	  document.myform.Content.focus()
	  return false
	 }
if (document.myform.Content.value.length>500)
	{
	  alert("留言内容不能超过500个字符")
	  document.myform.Content.focus()
	  return false
	 }
if (document.myform.Linkman.value=="" )
	{
	  alert("请填姓名！")
	  document.myform.Linkman.focus()
	  return false
	 }
if(document.myform.Mobile.value=="" && document.myform.Telephone.value=="") 
	{
	    alert("固定电话和移动电话不能同时为空!");
		document.myform.Mobile.focus()
	    return false;
	}
var sMobile = document.myform.Mobile.value
if((document.myform.Mobile.value!="") && (!(/^((\(\d{3}\))|(\d{3}\-))?13[0-9]\d{8}|15[0-9]\d{8}|17[0-9]\d{8}|18[0-9]\d{8}/.test(sMobile)))) //(检验13，15，17,18号段)
	{
		alert("不是完整的11位手机号或者正确的手机号前七位！");
		document.myform.Mobile.focus();
		return false;
	}
var sTelephone = document.myform.Telephone.value
if((document.myform.Telephone.value!="") && (!(/^([0\+]\d{2,3}-)?(0[0-9]{2,3}\-)?([2-9][0-9]{6,7})+(\-[0-9]{1,4})?$/.test(sTelephone)))) //(国家代号-区号-电话-分机格式(可选)：+086-010-85858585-2538)
	{
		alert("不规范的电话号码！");
		document.myform.Telephone.focus();
		return false;
	}
    if((!checkemail(myform.Email.value))&&(document.myform.Email.value.length>1))
	{
    alert("您输入Email地址不正确，请重新输入!");
    document.myform.Email.focus();
    return false;
    }
   if(document.myform.Email.value.length>50 )
	{
	    alert("信箱不能超过50个字符!");
	    document.myform.Email.focus();
	    return false;
	}
    if (document.myform.GetCode.value==0)
	{
	  alert("请填写验证码！")
	  document.myform.GetCode.focus()
	  return false
	 }

}
// --></script>
  <body onload="check_data();">
              <form action="MessageSave.asp?MemberID=<%=mMemID%>" method="post" name="myform" id="myform" onSubmit="return myform_onsubmit()">
                <tr>
                  <td width="200" align="right">留言主题：</td>
                  <td><input name="MesName" type="text" id="MesName" size="40" maxlength="100" onblur="check_MesName(this.value);"/>
                    <font color="red">*</font> <span id="MesName">限2-100字符</span></td>
                </tr>
                <tr>
                  <td align="right">留言内容：</td>
                  <td><textarea name="Content" cols="40" rows="8" style="border:#ececec 1px solid" onpropertychange="kn()" onblur="check_Content(this.value);"></textarea>
                    <font color="red">*</font><br> <span id=num>限500字符,你还可以输入500个字符</span></td>
                </tr>
                <tr>
                  <td align="right">您的姓名：</td>
                  <td><input name="Linkman" type="text" id="Linkman" value="<%=mLinkman%>" size="20" maxlength="50"  onblur="check_Linkman(this.value);"/>
                    <font color="red">*</font> <span id=Linkman>限1-50个字符</span></td>
                </tr>
                <tr>
                  <td align="right">性别：</td>
                  <td><input name="Sex" type="radio" value="先生" class="inputnoborder" <%if mSex="先生" then response.write ("checked")%> />
                    先生
                    <input type="radio" name="Sex" value="女士" class="inputnoborder" <%if mSex="女士" then response.write ("checked")%> />
                    女士 <font color="red">*</font></td>
                </tr>
                <tr>
                  <td align="right">手机号码：</td>
                  <td><input name="Mobile" type="text" id="Mobile" value="<%=mMobile%>" size="20" maxlength="50"/> <font color="#0000ff">*</font> <span id="dhsj">手机固话必填其一</span></td>
                </tr>
                <tr>
                  <td align="right">固定电话：</td>
                  <td><input name="Telephone" type="text" id="Telephone" value="<%=mTelephone%>" size="20" maxlength="50" /> <font color="#0000ff">*</font> <span id="dnsj">手机固话必填其一</span></td>
                </tr>
                <tr>
                  <td align="right">传真号码：</td>
                  <td><input name="Fax" type="text" id="Fax" value="<%=mFax%>" size="20" maxlength="50" /></td>
                </tr>

                <tr>
                  <td align="right">电子信箱：</td>
                  <td><input name="Email" type="text" id="Email" value="<%=mEmail%>" size="30" maxlength="50" />
                    </td>
                </tr>
                <tr>
                  <td align="right">公司名称：</td>
                  <td><input name="Company" type="text" value="<%=mCompany%>" size="40" maxlength="80" /></td>
                </tr>
                <tr>
                  <td align="right">联系地址：</td>
                  <td><input name="Address" type="text" value="<%=mAddress%>" size="40" maxlength="80" /></td>
                </tr>
                <tr>
                  <td align="right">邮政编码：</td>
                  <td><input name="ZipCode" type="text" value="<%=mZipCode%>" size="20" maxlength="20" /></td>
                </tr>

                <tr>
                  <td align="right">悄悄话：</td>
                  <td><%=SecretFlag%> (留言仅管理员可见)</td>
                </tr>
              <tr>
                <td align="right">验 证 码：</td>
                <td><input type="text" size="6" name="GetCode" id="GetCode" maxlength="4"  onblur="checkcode(this.value);"/> <font color="red">*</font> 
				<img src="../Include/getcode.asp" id="src" height="18" alt="看不清楚?请点击刷新" onclick="this.src=this.src+'?'+Math.random();"/>
				 <span id="GetCode">看不清楚?请点击验证码刷新</span></td>
              </tr>

                <tr>
                  <td align="right">&nbsp;</td>
                  <td><input name="Submit" type="submit" id="input" value="发表留言" /></td>
                </tr>
              </form>
            </table></td>
        </tr>
      </table>
              </TD>
           </TR>
           </table>
			</td>
                  </tr>             
                  <tr> 
                    <td height="8"><div align="right"></div></td>
                  </tr>
                </table> 
                      </TD>
            </TR>
                  </table>
                  
                </td>
              </tr>
			  
            </table></td>
        </tr>
      </table></td>
  </tr>
</table>
<!--#include file="Foot.Asp"-->

