﻿//输入为空时。。。
function GetNullStr(showstr)
{
        var windowstr="<div class='win_box'><h6><a href='javascript:closeWindow();'><img src='/images/login/off.jpg' border=0 alt='关闭' /></a>提示</h6><dl><dt><img src='/images/login/tip.jpg' alt='出错了！' width='39' height='39' /></dt><dd>"+showstr+"</dd></dl><p><a href='javascript:closeWindow();'><img src='/images/login/an.jpg' alt='确定' border=0 /></a></p></div>";
	 	document.getElementById("infoDiv").innerHTML=windowstr;
	 	document.getElementById("infoDiv").style.left=((document.body.clientWidth-302)>0?(document.body.clientWidth-302):0)/2+"px";
	 	var scrollTop = document.documentElement.scrollTop;
	 	if(scrollTop==0)
	 	{scrollTop=document.body.scrollTop;}
	 	document.getElementById("infoDiv").style.top=(scrollTop+260)+"px";
	 	document.getElementById("infoDiv").style.width=302;
	 	document.getElementById("tranDiv").style.height=document.body.clientHeight+ "px";
	 	document.getElementById("tranDiv").style.width=document.body.clientWidth+ "px";
		document.getElementById("tranDiv").style.display="";
		document.getElementById("tranDivBack").style.display="";
		document.getElementById("infoDiv").style.display="";
}
function GetParentNullStr(showstr)
{
        var windowstr="<div class='win_box'><h6><a href='javascript:closeWindow();'><img src='/images/login/off.jpg' border=0 alt='关闭' /></a>提示</h6><dl><dt><img src='/images/login/tip.jpg' alt='出错了！' width='39' height='39' /></dt><dd>"+showstr+"</dd></dl><p><a href='javascript:closeWindow();'><img src='/images/login/an.jpg' alt='确定' border=0 /></a></p></div>";
	 	parent.document.getElementById("infoDiv").innerHTML=windowstr;
	 	var scrollTop = parent.document.documentElement.scrollTop;
	 	if(scrollTop==0)
	 	{scrollTop=parent.document.body.scrollTop;}
	 	parent.document.getElementById("infoDiv").style.left=((parent.document.body.clientWidth-302)>0?(parent.document.body.clientWidth-302):0)/2+"px";
	 	parent.document.getElementById("infoDiv").style.top=(scrollTop+260)+"px";
	 	parent.document.getElementById("infoDiv").style.width=302;
	 	parent.document.getElementById("tranDiv").style.height=parent.document.body.clientHeight+ "px";
	 	parent.document.getElementById("tranDiv").style.width=parent.document.body.clientWidth+ "px";
		parent.document.getElementById("tranDiv").style.display="";
		parent.document.getElementById("tranDivBack").style.display="";
		parent.document.getElementById("infoDiv").style.display="";
}
function GetProcessStr(showstr)
{
        var windowstr="<div class='win_box'><h6><a href='javascript:closeWindow();'><img src='/images/login/off.jpg' border=0 alt='关闭' /></a>提示</h6><dl><dt><img src='/images/login/loading.gif' alt='正在提交答案...' width='39' height='39' /></dt><dd>"+showstr+"</dd></dl><p><a href='javascript:closeWindow();'><img src='/images/login/an.jpg' alt='确定' border=0 /></a></p></div>";
	 	document.getElementById("infoDiv").innerHTML=windowstr;
	 	document.getElementById("infoDiv").style.left=((document.body.clientWidth-302)>0?(document.body.clientWidth-302):0)/2+"px";
	 	document.getElementById("infoDiv").style.top=(document.documentElement.scrollTop+260)+"px";
	 	document.getElementById("infoDiv").style.width=302;
	 	document.getElementById("tranDiv").style.height=document.body.clientHeight+ "px";
	 	document.getElementById("tranDiv").style.width=document.body.clientWidth+ "px";
		document.getElementById("tranDiv").style.display="";
		document.getElementById("tranDivBack").style.display="";
		document.getElementById("infoDiv").style.display="";
}

//输入用户名或密码不对。。。
function GetNullStrs(showstr,typeID)
{
 var windowstr="<div  style=\"width:308px;padding-bottom:10px;border:1px solid #ccc;background-color:#FFFFFF;\">";
 windowstr+="    <div style=\"float:left;margin-bottom:10px;padding:5px 0 0 5px;width:303px;background-image:url(/images/skin/zxbg.jpg);font-size:12px;font-weight:bold;color:#5B5B5B;text-align:left;\"><span style=\"float:right;width:30px;height:20px;\"><a href='javascript:closeWindow();'><img src=\"/images/skin/close.jpg\" border=\"0\" /></a></span>提示</div>";
 windowstr+="    <div style=\"width:303px;margin:20px 0;padding:5px 0 0 5px;overflow:hidden;clear:both;\">";
 windowstr+="	 <div style=\"float:left;width:70px;text-align:right;padding-right:10px;\">";
 windowstr+="<img src=\"/images/skin/";
 if(typeID==1)
 {
    windowstr+="ts2.jpg\"/></div>";
 }
 if(typeID==2)
 {
    windowstr+="ts1.jpg\"/></div>";
 }
 if(typeID==3)
 {
    windowstr+="ts3.jpg\"/></div>";
 }
 if(typeID==4)
 {
     windowstr+="zc-icon.gif\"/></div>";
 }
 
 windowstr+="	 <div style=\"float:left;width:200px;font-size:14px;font-weight:bold;color:#F00;line-height:20px;\">";
 windowstr+=showstr;
 windowstr+="</div>";
 windowstr+="	 </div>";
 windowstr+="	 <div style=\"width:303px;margin-top:10px;text-align:center;\"><a href='javascript:closeWindow();'><img src=\"/images/skin/qd.gif\" border=\"0\" /></a></div>";
 windowstr+="</div>";
	 	document.getElementById("infoDiv").innerHTML=windowstr;
	 	document.getElementById("infoDiv").style.left=((document.body.clientWidth-302)>0?(document.body.clientWidth-302):0)/2+"px";
	 	var scrollTop = parent.document.documentElement.scrollTop;
	 	if(scrollTop==0)
	 	{scrollTop=parent.document.body.scrollTop;}
	 	document.getElementById("infoDiv").style.top=(scrollTop+260)+"px";
	 	document.getElementById("infoDiv").style.width=302;
	 	document.getElementById("tranDiv").style.height=document.body.clientHeight+ "px";
	 	document.getElementById("tranDiv").style.width=document.body.clientWidth+ "px";
		document.getElementById("tranDiv").style.display="";
		document.getElementById("tranDivBack").style.display="";
		document.getElementById("infoDiv").style.display="";
}
function GetParentNullStrs(showstr,typeID)
{
 var windowstr="<div  style=\"width:308px;padding-bottom:10px;border:1px solid #ccc;background-color:#FFFFFF;\">";
 windowstr+="    <div style=\"float:left;margin-bottom:10px;padding:5px 0 0 5px;width:303px;background-image:url(/images/skin/zxbg.jpg);font-size:12px;font-weight:bold;color:#5B5B5B;text-align:left;\"><span style=\"float:right;width:30px;height:20px;\"><a href='javascript:closeWindow();'><img src=\"/images/skin/close.jpg\" border=\"0\" /></a></span>提示</div>";
 windowstr+="    <div style=\"width:303px;margin:20px 0;padding:5px 0 0 5px;overflow:hidden;clear:both;\">";
 windowstr+="	 <div style=\"float:left;width:70px;text-align:right;padding-right:10px;\">";
 windowstr+="<img src=\"/images/skin/";
 if(typeID==1)
 {
    windowstr+="ts2.jpg\"/></div>";
 }
 if(typeID==2)
 {
    windowstr+="ts1.jpg\"/></div>";
 }
 if(typeID==3)
 {
    windowstr+="ts3.jpg\"/></div>";
 }
 if(typeID==4)
 {
     windowstr+="zc-icon.gif\"/></div>";
 }
 
 windowstr+="	 <div style=\"float:left;width:200px;font-size:14px;font-weight:bold;color:#F00;line-height:20px;\">";
 windowstr+=showstr;
 windowstr+="</div>";
 windowstr+="	 </div>";
 windowstr+="	 <div style=\"width:303px;margin-top:10px;text-align:center;\"><a href='javascript:closeWindow();'><img src=\"/images/skin/qd.gif\" border=\"0\" /></a></div>";
 windowstr+="</div>";
	 	parent.document.getElementById("infoDiv").innerHTML=windowstr;
	 	parent.document.getElementById("infoDiv").style.left=((parent.document.body.clientWidth-302)>0?(parent.document.body.clientWidth-302):0)/2+"px";
	 	var scrollTop = parent.document.documentElement.scrollTop;
	 	if(scrollTop==0)
	 	{scrollTop=parent.document.body.scrollTop;}
	 	parent.document.getElementById("infoDiv").style.top=(scrollTop+260)+"px";
	 	parent.document.getElementById("infoDiv").style.width=302;
	 	parent.document.getElementById("tranDiv").style.height=parent.document.body.clientHeight+ "px";
	 	parent.document.getElementById("tranDiv").style.width=parent.document.body.clientWidth+ "px";
		parent.document.getElementById("tranDiv").style.display="";
		parent.document.getElementById("tranDivBack").style.display="";
		parent.document.getElementById("infoDiv").style.display="";
}

function GetErrStr()
{
        var windowstr="<div class='win_box'><h6><a href='javascript:closeWindow();'><img src='/images/login/off.jpg' border=0 alt='关闭' /></a>提示</h6><dl><dt><img src='/images/login/wrong.jpg' alt='出错了！' width='39' height='39' /></dt><dd>对不起你的输入有误！</dd></dl><p><a href='javascript:closeWindow();'><img src='/images/login/an.jpg' alt='确定' border=0 /></a></p></div>";
	 	document.getElementById("infoDiv").innerHTML=windowstr;
	 	document.getElementById("infoDiv").style.left=((document.body.clientWidth-302)>0?(document.body.clientWidth-302):0)/2+"px";
	 	var scrollTop = parent.document.documentElement.scrollTop;
	 	if(scrollTop==0)
	 	{scrollTop=parent.document.body.scrollTop;}
	 	document.getElementById("infoDiv").style.top=(scrollTop+260)+"px";
	 	document.getElementById("infoDiv").style.width=302;
	 	document.getElementById("tranDiv").style.height=document.body.clientHeight+ "px";
	 	document.getElementById("tranDiv").style.width=document.body.clientWidth+ "px";
		document.getElementById("tranDiv").style.display="";
		document.getElementById("tranDivBack").style.display="";
		document.getElementById("infoDiv").style.display="";
}

//加载中。。。



function Loading()
{
        var windowstr="<div class='win_box'><h6><a href='javascript:closeWindow();'><img src='/images/login/off.jpg' border=0 alt='关闭' /></a>提示</h6><dl><dt><img src='/images/login/loading.gif' alt='加载中！' width='39' height='39' /></dt><dd>系统正在加载中...</dd></dl><p><a href='javascript:closeWindow();'><img src='/images/login/an.jpg' alt='确定' border=0 /></a></p></div>";
	 	document.getElementById("infoDiv").innerHTML=windowstr;
	 	document.getElementById("infoDiv").style.left=((document.body.clientWidth-302)>0?(document.body.clientWidth-302):0)/2+"px";
	 	var scrollTop = parent.document.documentElement.scrollTop;
	 	if(scrollTop==0)
	 	{scrollTop=parent.document.body.scrollTop;}
	 	document.getElementById("infoDiv").style.top=(scrollTop+260)+"px";
	 	document.getElementById("infoDiv").style.width=302;
	 	document.getElementById("tranDiv").style.height=document.body.clientHeight+ "px";
	 	document.getElementById("tranDiv").style.width=document.body.clientWidth+ "px";
		document.getElementById("tranDiv").style.display="";
		document.getElementById("tranDivBack").style.display="";
		document.getElementById("infoDiv").style.display="";
}

//关闭层

function ReloadWindow(){window.location.reload();}

function closeWindow(){
	document.getElementById("tranDiv").style.display="none";
}


// JavaScript Document
function ASKNetAjax(OnError,OnState,OnDownloadEnd)
{
	// 错误字符串



	this.ErrorStr 		= null;
	// 错误事件驱动,当发生错误时触发
	this.OnError 		= OnError;
	// 状态事件驱动,当状态改变时触发
	this.OnState 		= OnState;
	// 完成事件驱动,当类操作完成时触发



	this.OnDownloadEnd 	= OnDownloadEnd;

	// XMLHTTP 发送数据类型 GET 或 POST
	this.method		= "GET";
	
	//地址有些需要参数



	this.Param = null;
	this.Questtype="0";
	// 将要获取的URL地址
	//this.URL		= null;
	this.URL		= "/ajax/index.aspx";
	// 指定同步或异步读取方式(true 为异步,false 为同步)
	this.sync		= true;
	// 当method 为 POST 时 所要发送的数据
	this.PostData		= null
	// 返回读取完成后的数据
	this.RetData 		= null;

   // 创建XMLHTTP对像
	this.HttpObj 		= this.createXMLHttpRequest();
	if(this.HttpObj == null)
	{
		// 对像创建失败时中止运行



		return;
	}

	var Obj = this;
	// 调用事件检测



	this.HttpObj.onreadystatechange = function()
	{
		ASKNetAjax.handleStateChange(Obj);
	}
}

// UTF 转入 GB (by:Rimifon)
ASKNetAjax.prototype.UTFTOGB = function(strBody)
{
	var Rec=new ActiveXObject("ADODB.RecordSet");
	Rec.Fields.Append("DDD",201,1);
	Rec.Open();
	Rec.AddNew();
	Rec(0).AppendChunk(strBody);
	Rec.Update();
	var HTML=Rec(0).Value;
	Rec.Close();
	delete Rec;
	return(HTML);
}

// 创建XMLHTTP对像
ASKNetAjax.prototype.createXMLHttpRequest = function()
{
	if (window.XMLHttpRequest) 
	{ 
		//Mozilla 浏览器



		return new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{
        	var msxmls = new Array('Msxml2.XMLHTTP.5.0','Msxml2.XMLHTTP.4.0','Msxml2.XMLHTTP.3.0','Msxml2.XMLHTTP','Microsoft.XMLHTTP');
        	for (var i = 0; i < msxmls.length; i++)
        	{
                	try 
                	{
                        	return new ActiveXObject(msxmls[i]);
                	}catch (e){}

		}
	}
	this.ErrorStr = "你的浏览器不支持XMLHttpRequest对象．"
	if(this.OnError)
	{
		this.OnError(this.ErrorStr);
	}
    	return null;
}

// 发送HTTP请求
ASKNetAjax.prototype.send = function()
{

	if (this.HttpObj !== null)
	{
		if(this.Param !== null)
		{
			this.URL = this.URL +"?Param="+this.Param+ "&type="+this.Questtype+"&t=" + new Date().getTime();
		}
		else
		{
			this.URL = this.URL + "?t=" + new Date().getTime();
		}
		this.HttpObj.open(this.method, this.URL, this.sync);
		if(this.method.toLocaleUpperCase() == "GET")
		{
			this.HttpObj.send(null);
		}
		else if(this.method.toLocaleUpperCase() == "POST")
		{
			this.HttpObj.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			this.HttpObj.send(this.PostData);
		}
		else
		{
			this.ErrorStr = "错误的[method]命令．"
			if(this.OnError)
			{
				this.OnError(this.ErrorStr);
			}
			return;
		}

		if (this.HttpObj.readyState == 4)
		{
			// 判断对象状态



            if (this.HttpObj.status == 200) 
            { 
				this.RetData =this.HttpObj.responseText;
				if(this.OnDownloadEnd)
				{
					this.OnDownloadEnd(this.RetData);
			    }
               return;
            } 
			else 
			{ 
				this.ErrorStr = "您所请求的页面有异常．"
				if(this.OnError)
				{
					this.OnError(this.ErrorStr);
				}
				return;
			}
		}

	}

}

// 事件检测



ASKNetAjax.handleStateChange = function(Obj)
{
	if(Obj.OnState)
	{
		Obj.OnState(Obj.HttpObj.readyState);
	}

	if (Obj.HttpObj.readyState == 4)
	{
		// 判断对象状态



        if (Obj.HttpObj.status == 200) 
        {       
		   Obj.RetData =Obj.HttpObj.responseText;
		   if(Obj.OnDownloadEnd)
			{
				Obj.OnDownloadEnd(Obj.RetData);
			}
           return;
        } 
		else 
		{ 
			Obj.ErrorStr = "您所请求的页面有异常．"
			if(Obj.OnError)
			{
				Obj.OnError(Obj.ErrorStr);
			}
			return;
		}
	}
}

// 错误回调事件函数
function EventError(strValue)
{ 
    GetNullStr(unescape(strValue));
}

// 状态回调事件函数



function EventState(strValue)
{
	var strState = null;
	if(strValue==0 ||strValue==1||strValue==2||strValue==3)
	{
	    Loading();
	}
}

//控件标签获取
function $() {
  var elements = new Array();

  for (var i = 0; i < arguments.length; i++) {
    var element = arguments[i];
    if (typeof element == 'string')
      element = document.getElementById(element);

    if (arguments.length == 1) 
      return element;

    elements.push(element);
  }

  return elements;
}

function favQuestion(tid,uid)
{
   var A1 = new ASKNetAjax(null,null,fvaok);
        A1.Questtype="5";
        A1.method = "GET";
        A1.Param =escape(tid)+","+escape(uid);
        A1.sync = true;
        A1.send();
}

function fvaok(strValue)
{
  var sTmp = strValue;
  if(sTmp=="1")
  {
    GetNullStr('收藏成功，已保存在您的收藏夹中！');
  }
  else
  {
    GetNullStr('收藏失败！');
  }
}

//登录设置
function boollogin(username,userpwd)
{
       var A1 = new ASKNetAjax(null,null,Setok);
        A1.Questtype="2";
        A1.method = "GET";
        A1.Param =escape(username)+","+escape(userpwd);
        A1.sync = true;
        A1.send();
}
//初始化



function Setok(strValue)
{
  var sTmp = strValue;
  if(sTmp=="1")
  {
    SetLogin();
  }
  else
  {
    GetErrStr();
  }
}

//登录on enter key
function entersearchkey()
{
    try
    {
        if(event.keyCode==13) 
        {                                                    
            SearchKeyWord();
            return;
        }
    }
    catch(e)
    {
        return;
    }
}

function SearchKeyWord()
{
  var keyWords=null;
  keyWords=document.getElementById("SearchAskWord").value;//搜索的关键词


  if(keyWords=='' ||keyWords==null)
  {
     GetNullStr('请输入搜索的关键词！');
  }

  else
  {
     //调转
      var  GoUrl="/search.aspx?words="+escape(keyWords);
     document.body.innerHTML=document.body.innerHTML+"<div></div>";
          window.location = GoUrl;
  }
}

function showHidden()
{
  document.getElementById("showUpload").style.display="block";
}


 function getChkCode()
    {
        document.getElementById("ChkCode").innerHTML="<img src='/Cade/SpaceCheckCode.aspx?"+Math.random()+"' alt='点击图片重新加载验证码' style='cursor: pointer;' width='62px' height='24px' onclick='javascript:dogetChkCode()' />";
    }

    function dogetChkCode()
    {
        document.getElementById("ChkCode").innerHTML="<img src='/images/loading1.gif' alt=''/>";
        setTimeout("getChkCode()",500);
    }
    
    
    
function GetPost()
{
   var UserPostHPs = document.getElementById("UserPostHP").value;
   if(UserPostHPs=="")
   {
      GetNullStr('输入的回复内容不能为空！');
      return false;
   }
   
    var IDCardCodes= document.getElementById("PostCode").value;
   if(IDCardCodes=="")
   {
      GetNullStr('验证码不能为空！');
      return false;
   }
 
   var GetLoginUsers= document.getElementById("GetLoginUser").value;
   if(GetLoginUsers=="")
   {
      GetNullStr('用户名不能为空！');
      return false;
   }
  
  var GetLoginPWds= document.getElementById("GetLoginPWd").value;
   if(GetLoginPWds=="")
   {
     GetNullStr('用户密码不能为空！');
      return false;
   }
   GetProcessStr('正在提交答案...');
  var topicid= document.getElementById("GetTopicID").value;
   var fidid= document.getElementById("GetFidID").value;
   var zixunid= document.getElementById("GetZiXunID").value;
      var A1 = new ASKNetAjax(null,null,YuYueOK);
      A1.method="POST";
      A1.URL ="/ajax/GetPost.aspx";
      tStr= "pwd="+escape(GetLoginPWds)+"&username="+escape(GetLoginUsers)+"&code="+escape(IDCardCodes)+"&postcon="+escape(UserPostHPs.replace(/\r?\n/g, '@@'))+"&tid="+escape(topicid)+"&fid="+escape(fidid)+"&zxid="+escape(zixunid);
      A1.PostData =tStr;
      A1.sync = true;
      A1.send();
}
var UserPostHPs,IDCardCodes,GetLoginUsers,GetLoginPWds;
function GetParentPost(t)
{
   UserPostHPs = document.getElementById("UserPostHP").value;
   if(UserPostHPs=="")
   {
      GetParentNullStr('输入的回复内容不能为空！');
      return false;
   }
   IDCardCodes= document.getElementById("PostCode").value;
   if(IDCardCodes=="")
   {
      GetParentNullStr('验证码不能为空！');
      return false;
   }
   GetLoginUsers= document.getElementById("GetLoginUser").value;
   if(GetLoginUsers=="")
   {
      GetParentNullStr('用户名不能为空！');
      return false;
   }
  
   GetLoginPWds= document.getElementById("GetLoginPWd").value;
   if(GetLoginPWds=="")
   {
     GetParentNullStr('用户密码不能为空！');
      return false;
   }
   var isTyUser= document.getElementById("isTyUser").value;
   if(isTyUser=="1")
   {
        var tyUserEmail;
        tyUserEmail=$("GetEmail").value;
        var pattern = /^([a-zA-Z0-9_-]){3,}@([a-zA-Z0-9_-]){2,}(\.([a-zA-Z0-9]){2,4}){1,2}$/;
        var flag = pattern.test(tyUserEmail);
        if (!flag)
        {
            GetTyUserEmail(1);
            if(t==1)
            {
                alert("请输入正确的邮箱地址.");
            }
            $("GetEmail").focus();
        }
        else
        {
          GetTyUserEmail(0);
          $("posthTml").style.display="none";
          $("procc").style.display="block";
          $("procc").innerHTML="<img src='/images/login/loading.gif' alt='正在提交......' width='39' height='39' /> 正在提交......";
          //注册用户
          JoinEWsos(GetLoginUsers,tyUserEmail); /*邮箱·引导*/
        }
   }
   else
   {
      $("posthTml").style.display="none";
      $("procc").style.display="block";
      $("procc").innerHTML="<img src='/images/login/loading.gif' alt='正在提交......' width='39' height='39' /> 正在提交......";
      JoinEWOk("1");
   }
}
function JoinEWsos(GetLoginUsers,UserEmail)
{
  var A1 = new ASKNetAjax(JoinEWOk,null,JoinOk);
  A1.method="POST";
  A1.URL ="/ajax/getCode.aspx";
  tStr= "user="+escape(GetLoginUsers)+"&email="+escape(UserEmail);
  A1.PostData =tStr;
  A1.sync = true;
  A1.send();
}
function JoinOk(strValue)
{
    setTimeout("JoinEWOk('')",300);
}
function JoinEWOk(strValue) // 注册成功返回
{
    var topicid= document.getElementById("GetTopicID").value;
    var fidid= document.getElementById("GetFidID").value;
    var zixunid= document.getElementById("GetZiXunID").value;
    document.getElementById("postfrms").innerHTML+="<form id=\"postfrm\" name=\"postfrm\" method=\"post\"><input type=\"hidden\" id=\"pwd\" name=\"pwd\" /><input type=\"hidden\" id=\"username\" name=\"username\" /><input type=\"hidden\" id=\"code\" name=\"code\" /><input type=\"hidden\" id=\"postcon\" name=\"postcon\" /><input type=\"hidden\" id=\"tid\" name=\"tid\" /><input type=\"hidden\" id=\"fid\" name=\"fid\" /><input type=\"hidden\" id=\"zxid\" name=\"zxid\" /></form>";
    document.postfrm.pwd.value=escape(GetLoginPWds);
    document.postfrm.username.value=escape(GetLoginUsers);
    document.postfrm.code.value=escape(IDCardCodes);
    document.postfrm.postcon.value=escape(UserPostHPs.replace(/\r?\n/g, '@@'));
    document.postfrm.tid.value=escape(topicid);
    document.postfrm.fid.value=escape(fidid);
    document.postfrm.zxid.value=escape(zixunid);
    document.postfrm.action="/ajax/GetPost.aspx?mthd=post";
    document.postfrm.submit();
    document.getElementById("posthTml").innerHTML="<img src='/images/login/loading.gif' alt='正在提交答案...' width='39' height='39' /> 正在提交答案......";
}
function GetTyUserEmail(t)
{
	var div=$("BOX_overlay");
	var bodywidth,bodyheight;
	if (t==1)
	{
	    $("GetEmailDiv").style.display="";
		div.style.top=0;
		div.style.left=0;
		div.style.width=document.documentElement.clientWidth+"px";
		div.style.height=document.documentElement.clientHeight+"px";
	}
	else
	{
	    $("GetEmailDiv").style.display="none";
		div.style.top=document.documentElement.clientHeight+"px";
		div.style.left=document.documentElement.clientWidth+"px";
		div.style.width=0;
		div.style.height=0;
	}
}
function YuYueOK(strValue)
{
var sTmp = strValue;
 
   if(sTmp=="0")
  {
    GetNullStrs("验证码输入有误！",'3');
  }
  if(sTmp=="1")
  {
    GetNullStrs("用户名不能为空！",'3');
  }
  if(sTmp=="2")
  {
    GetNullStrs("用户密码不能为空！",'3');
  }
  if(sTmp=="3")
  {
    GetNullStrs("用户登录失败！",'3');
  }
 if(sTmp=="4")
  {
    GetNullStrs("回复成功！",'3');
    window.setTimeout(" ReloadWindow()", 900);
  }
  if(sTmp=="5")
  {
    GetNullStrs("回复出错，无法操作！",'3');
  }
   if(sTmp=="6")
  {
    GetNullStrs("积分为0时无法操作！",'3');
  }
   if(sTmp=="7")
  {
    GetNullStrs("您已被放在黑名单，操作被禁止！",'3');
  }
   if(sTmp=="8")
  {
    GetNullStrs("你的资料还没有通过审核<br>请联系管理员进行审核。<br>客服QQ：133803008 <br>客服电话：020-39236571",'3');
  }
}

function YuYueParentOK(strValue)
{
var sTmp = strValue;
 
   if(sTmp=="0")
  {
    GetParentNullStrs("验证码输入有误！",'3');
  }
  if(sTmp=="1")
  {
    GetParentNullStrs("用户名不能为空！",'3');
  }
  if(sTmp=="2")
  {
    GetParentNullStrs("用户密码不能为空！",'3');
  }
  if(sTmp=="3")
  {
    GetParentNullStrs("用户登录失败！",'3');
  }
 if(sTmp=="4")
  {
    GetParentNullStrs("回复成功！",'3');
    window.setTimeout(" ReloadWindow()", 900);
  }
  if(sTmp=="5")
  {
    GetParentNullStrs("回复出错，无法操作！",'3');
  }
   if(sTmp=="6")
  {
    GetParentNullStrs("积分为0时无法操作！",'3');
  }
   if(sTmp=="7")
  {
    GetParentNullStrs("您已被放在黑名单，操作被禁止！",'3');
  }
   if(sTmp=="8")
  {
    GetParentNullStrs("你的资料还没有通过审核<br>请联系管理员进行审核。<br>客服QQ：133803008 <br>客服电话：020-39236571",'3');
  }
}

// 顶一下
function SetDing(tid,praise)
{
    $("div_ding").innerHTML="<div class=\"s1\"><img src=\"/images/loading1.gif\" width=\"16\" height=\"16\" /></div>";
    var A1 = new ASKNetAjax(null,null,DingOk);
    A1.method="POST";
    A1.URL ="/ajax/SetDing.aspx";
    tStr= "tid="+escape(tid);
    A1.PostData =tStr;
    A1.sync = true;
    A1.send();
}
function DingOk(strValue)
{
    $("div_ding").innerHTML=parseInt($("div_hding").innerHTML)+1;
    $("div_dingC").innerHTML="谢谢支持";
}

// 设为最佳

function SetBest(pid,tid)
{
    $("a_best"+pid).innerHTML="<img src=\"/images/loading1.gif\" width=\"16\" height=\"16\" />";
    var A1 = new ASKNetAjax(null,null,SetBestOk);
    A1.method="POST";
    A1.URL ="/ajax/SetBest.aspx";
    tStr= "pid="+escape(pid)+"&tid="+escape(tid);
    A1.PostData =tStr;
    A1.sync = true;
    A1.send();
}
function SetBestOk(strValue)
{
    GetNullStrs("设置成功！",'3');
    window.setTimeout(" ReloadWindow()", 900);
}

function ShowEditZiXun(obj,tj,Pid,TID)
{
  var uu =document.getElementById(obj);
  ReplayPanel=document.getElementById(tj);
  ReplayPanel.style.left="25px";
  ReplayPanel.style.top="0px";
  ReplayPanel.style.visibility ="visible";
  var InsertHtml ="<div class=\"ReplayText\">";
  InsertHtml+="<div class=\"divtitle\">修改此回复：</div>";
  var HStr = uu.innerHTML.replace(/<[^>]+>/g,"\r\n");
  InsertHtml+="<div><textarea name=\"oblogReplay"+Pid+"\" id=\"ZiXunReplay"+Pid+"\">"+HStr+"</textarea></div>";
  InsertHtml+="<div class=\"divbtn\"> <input type=\"button\" name=\"btn_Replay\" onclick=\"EditDocZiXunBBS('"+obj+"','"+Pid+"','"+TID+"')\" id=\"btn_Replay\" value=\"提交\" /></div>";
  InsertHtml+="</div>";
  uu.style.display="none";
  ReplayPanel.innerHTML=InsertHtml;
}

function EditDocZiXunBBS(obj,Pid,TID)
{
var GetUserReplay = document.getElementById('ZiXunReplay'+Pid).value;
if(GetUserReplay=="")
{
}
else
{
   EditReplayBBS(GetUserReplay,Pid,TID);
  }
}

function EditReplayBBS(GetUserReplay,Pid,TID)
{
   var A1 = new ASKNetAjax(null,null,EditBBSOK);
      A1.method="POST";
      A1.URL ="/ajax/EditPost.aspx";
      tStr= "postcon="+escape(GetUserReplay.replace(/\r?\n/g, '@@'))+"&tid="+escape(TID)+"&pid="+escape(Pid);
      A1.PostData =tStr;
      A1.sync = true;
      A1.send();
}


function EditBBSOK(strValue)
{
  var sTmp = strValue;
  if(sTmp=="4")
  {
     GetNullStr("操作成功！",'2');
     window.setTimeout(" ReloadWindow()", 900);
  }
  if(sTmp=="3")
  {
     GetNullStr("操作出错，请稍后操作！",'3');
  }
}

function checkSelect()
{
    var radioes=document.getElementsByName("showchex");
    if(radioes[0].checked==true)
    {
        var divobj=document.getElementById("div1");
        divobj.style.display="";
    }
    else
    {
       var divobj=document.getElementById("div1");
        divobj.style.display="none";
    }
}

function UpTopicInfo()
{
   var UserPostHPs = document.getElementById("GetInfo").value;
   
   if(UserPostHPs=="")
   {
      GetNullStr('输入的补充说明内容不能为空！');
      return false;
   }
   
  var tid= document.getElementById("InfoTopicID").value;
   var pid= document.getElementById("InfoPostPid").value;

    var A1 = new ASKNetAjax(null,null,EditBBSOK);
      A1.method="POST";
      A1.URL ="/ajax/InfoPost.aspx";
      tStr= "postcon="+escape(UserPostHPs.replace(/\r?\n/g, '@@'))+"&tid="+escape(tid)+"&pid="+escape(pid);
      A1.PostData =tStr;
      A1.sync = true;
      A1.send();
}

function LoadPic()
{
    document.getElementById("showTR1").innerHTML = "<div id=\"apDiv2\"><img src=\"/images/ask/best.gif\" height=\"72\" /></div>";
}


function SearchDis()
{
     var keyWords=null;
  keyWords=document.getElementById("diswords").value;//搜索的关键词



  if(keyWords=='' ||keyWords==null)
  {
     GetNullStr('请输入搜索的关键词！');
  }

  else
  {
     //调转
     var  GoUrl="http://disease.ewsos.com/program/disease.aspx?Condition=0&words="+escape(keyWords);
      window.location = GoUrl;
  }
}


function showAskLogin(){
		var windowstr="<div style='width:308px; height:280px; border:solid 1px #9DCCF6; background:#fff; margin:0 auto;'><div style='height:30px;'><span style='float:right; padding:1px 2px 0; font-size:12px; font-weight:bold; margin:4px 3px 0 0; border:solid 1px #B2D1DC; cursor:hand;' onclick='closeWindow();'>×</span><span style='float:left; line-height:30px; font-size:14px; font-weight:bold; padding:0 0 0 10px;'>登录</span></div><div style='clear:both; text-align:center; padding:0 0 5px; border-bottom:solid 1px #B2D1DC'><iframe src='/login/login.aspx' frameborder=0 scrolling=no  style=' width:285px; height:152px; clear:both; background-color: transparent;' allowtransparency='true'></iframe></div><div style=' padding:17px 0 0 8px; font-size:14px; font-weight:bold;'>新用户？ <span class='a_0f'><a href='http://member.ewsos.com/memberabout/regewsos/login.aspx'>快来注册</a></span></div></div>";
	 	//
	 	document.getElementById("infoDiv").innerHTML=windowstr;
	 	document.getElementById("infoDiv").style.left=((document.body.clientWidth-380)>0?(document.body.clientWidth-380):0)/2+"px";
	 	document.getElementById("infoDiv").style.top=(document.documentElement.scrollTop+260)+"px";
	 	document.getElementById("infoDiv").style.width=380;
	 	document.getElementById("tranDiv").style.height=document.body.clientHeight+ "px";
	 	document.getElementById("tranDiv").style.width=document.body.clientWidth+ "px";
		document.getElementById("tranDiv").style.display="";
		document.getElementById("tranDivBack").style.display="";
		document.getElementById("infoDiv").style.display="";
	}
	
function ClearBy()
{
   var A1 = new ASKNetAjax(null,null,SetLogin);
        A1.Questtype="4";
        A1.Param ="12";
        A1.method = "GET";
        A1.Param ="";
        A1.sync = true;
        A1.send();
}

function SetLogin()
{
      window.location.reload();
}

//登录on enter key
function enterloginkey()
{
    try
    {
        if(event.keyCode==13) 
        {                                                    
            ShowLogin();
        }
    }
    catch(e)
    {
        return;
    }
}

//登录设置
function ShowLogin()
{
  var username=null;
  var userpwd=null;
  username=document.getElementById("loginname").value;//用户名



  userpwd=document.getElementById("loginpwd").value;//用户密码
  if(username=='' ||username==null||username=='用户名:')
  {
     GetNullStr('请输入您的用户名！');
  }
  else if(userpwd=='' ||userpwd==null)
  {
     GetNullStr('请输入您的用户密码！');
  }
  else
  {
     boollogin(username,userpwd);
  }
}

function gologin()
{
   GetNullStr('您还没有登录，登录后才能操作！');
}
