var rndno;
var poststate=false;



function doCancel(){
	rndno="";
	$("rcode").value="";
	$('msg_cont').style.display='none';

}


function checkStr(fid,nid,s){
	var tmp=trim($(fid).value);
	if (tmp=="")
	{
		$(nid).innerHTML=s;
		return false;
	}
}

function clearStr(nid){
	$(nid).innerHTML="";
}


function chisEmail(){
	if (trim($("email").value)!="")
	{	
		if (!isEmail($("email").value))
		{
			$("enn").innerHTML="×Email填写不正确";
		}else if (checkUseEmail()!="False")
		{
			$("enn").innerHTML="×Email已被使用";
		}
	}
}


function doPost(){
	if (poststate)
	{
		alert("正在提交，请稍等！");
		return false;
	}

	if ($("rcode").value.toUpperCase()!=rndno)
	{
		alert("安全码输入有误，请重新输入！");
		rndno=getRandCode();
		$('rnd').innerHTML=rndno;
		$("rcode").value="";
		$("rcode").focus();
		return false;
	}
	poststate=true;	
	
	$("btnsubmitPic").src="/passport/images/postting.gif";
	$("btnSubmit").disabled=true;
	$("rbtnCancel").disabled=true;
	suggestform.action="/passport/help/ActionSuggest.asp?rnd="+$("rcode").value.toUpperCase()
	suggestform.target="hidden_frame";//hidden_frame
	suggestform.submit();
}



function postThinking(){
	if (poststate)
	{
		alert("正在提交，请稍等！");
		return false;
	}

	if (trim($("content").value)=="")
	{
		alert("请填写心声内容！");
		$("content").focus();
		return false;
	}
	
	if(trim($("content").value).length>150)
	{
		alert("心声内容超过150个字，请适当减少点！");
		$("content").focus();
		return false;
	}
	$("thinkingform").submit();

}



	function callbackPost(nType,Msg){
		
		if(nType=="10001"){
			alert(Msg);
			poststate=false;
			return false;
		
		}else if(nType=="60001"){
			alert(Msg);
			window.location.href="/index.asp";
			return false;
		
		}else if (nType!="50100")
		{
			poststate=false;
			$("btnsubmitPic").src="/passport/images/submitSuggest.gif";
			$("btnSubmit").disabled=false;
			$("rbtnCancel").disabled=false;
		}
		if(nType=="10000"){
			//登录安全码
			alert(Msg);				
			$("rcode").value="";
			rndno=getRandCode();
			$('rnd').innerHTML=rndno;
			regForm.action="/passport/help/ActionSuggest.asp?srnd="+rndno;
			regForm.target="hidden_frame";//hidden_frame
			regForm.submit();
			$('msg_cont').style.display='block';	
			$('rcode').focus();
			return false;			
			
		}else if(nType=="50100"){
			//提交成功
			$('msg_cont').style.display='none';
			$('msg_suggestinfo').style.display='block';
			return false;			
			
		}
	}

	function doPostSuggest(){
			if (poststate)
			{
				alert("正在提交，请稍等！");
				return false;
			}
		
		if (trim($("name").value)=="")
		{
			alert("您的姓名没有填写！");
			$("name").focus();
			return false;
		}
		if (trim($("tel").value)=="")
		{
			alert("联系电话没有填写！");
			$("tel").focus();
			return false;
		}
		
		//Email
		if (trim($("email").value)=="")
		{	
			alert("Email没有填写");
			$("email").focus();
			return false;
			
		}
		if (!isEmail($("email").value))
		{
			alert("Email填写不正确");
			$("email").focus();
			return false;
		}
		if (trim($("msgType").value)=="")
		{
			alert("请选择问题类型！");
			$("msgType").focus();
			return false;
		}
		
		getContent();
		
			
			
		
		$("btnSubmit").disabled=false;
		$("rbtnCancel").disabled=false;
		

		$('msg_cont').style.display='block';
		rndno=getRandCode();
		$('rnd').innerHTML=rndno;
		window.location.href="#";
		suggestform.action="/passport/help/ActionSuggest.asp?srnd="+rndno;
		suggestform.target="hidden_frame";//hidden_frame
		suggestform.submit();
		$("rcode").value="";
		$("rcode").focus();
	}


//安全码
document.writeln("<div id=\"msg_cont\" style=\"position:absolute; top:100px;z-index:1000;width:90%;display:none\">");
document.writeln("	<table width=\"550\" height=\"200\" border=\"0\" align=\"center\" cellpadding=\"40\" cellspacing=\"0\" class=\"tx_box\" style=\"background:#ffffff;border:10px solid #CCE0F5 \">");
document.writeln("		<tr><td>");
document.writeln("		<span style=\"font-size:28px;font-weight:bold;color:#CC0000\">");
document.writeln("			企发通行证信息安全验证:<\/span><br \/><br \/>");
document.writeln("		<span style=\"font-size:14px;color:#333;line-height:25px;\" id=\"msg_hint_info\">请填写登录安全码：<INPUT TYPE=\"text\" NAME=\"rcode\" id=\"rcode\" onkeypress=\"keypress();\"><\/span>&nbsp;安全码：<span id=\"rnd\" style=\"cursor: hand;\" title=\"用鼠标点击这里，即可自动完成填写！\" onclick=\"javascript:doCopyRnd();\"> <\/span><br \/>");
document.writeln("		<span style=\"font-size:12px;color:red;\"><b>提示：<\/b>用鼠标点击安全码，即可自动完成填写！<\/span>");
document.writeln("		<br\/>");
document.writeln("		<hr\/>");
document.writeln("		");
document.writeln("		<div align=\"center\">");
document.writeln("		  <input type=\"button\" name=\"btnSubmit\" id=\"btnSubmit\" value=\" 立即提交 \" class=\"m\" style=\"height:30px;font-size:16px\" onclick=\"doPost()\"\/> ");
document.writeln("		  <input type=\"button\" name=\"btncancel\" id=\"rbtnCancel\" value=\" 取 消 \" class=\"m\" style=\"height:30px;font-size:16px\" onclick=\"javascript:doCancel();\"\/>		  ");
document.writeln("		<\/div><\/td>");
document.writeln("		  <\/tr>");
document.writeln("    <\/table>");
document.writeln("<\/div>");
document.writeln("<FORM METHOD=POST name=\"passportreg\" style=\"display:none;\">");
document.writeln("	<input type=\"hidden\" id=\"username\" NAME=\"user\">");
document.writeln("<INPUT TYPE=\"hidden\" id=\"pwd\" NAME=\"pwd\">");
document.writeln("<\/FORM>");


//问题提交提示
document.writeln("<div id=\"msg_suggestinfo\" style=\"position:absolute; top:100px;z-index:1000;width:90%;display:none\">");
document.writeln("	<table width=\"550\" height=\"200\" border=\"0\" align=\"center\" cellpadding=\"40\" cellspacing=\"0\" class=\"tx_box\" style=\"background:#ffffff;border:10px solid #CCE0F5 \">");
document.writeln("		<tr><td>");
document.writeln("		<span style=\"font-size:28px;font-weight:bold;color:#CC0000\">");
document.writeln("			问题提交成功：<\/span><br \/><br \/>");
document.writeln("		<TABLE cellSpacing=0 cellPadding=0 width=\"94%\" border=0 align=\"center\" style=\"font-size:14px;\">");
document.writeln("		<TBODY>");
document.writeln("		<TR>");
document.writeln("		<TD vAlign=top width=\"95%\"><span style=\"font-size:14px;\">如果认定您提交内容为有效意见或建议，我们将邮件或电话通知。 ");
document.writeln("		<BR><\/TD><\/TR><\/TBODY><\/TABLE>");
document.writeln("		<br\/>");
document.writeln("		<hr\/>");
document.writeln("		");
document.writeln("		<div align=\"center\">");
document.writeln("		  <input type=\"button\" name=\"btnlogin\" id=\"btnclose\" value=\" 关闭本页 \" class=\"m\" style=\"height:30px;font-size:16px\" onclick=\"javascript:window.close();\"\/>		  ");
document.writeln("		<\/div><\/td>");
document.writeln("		  <\/tr>");
document.writeln("    <\/table>");
document.writeln("<\/div>");
document.writeln("");
