﻿// JScript 文件
function CheckSubmit()
{
 if((document.getElementById("Title").value=="")||(document.getElementById("txtDetail").value==""))
 {
  alert("主题和内容均不能为空,请核查!");
  return false;
 }

if(document.getElementById("txtConsumingCoin").value!="")
{
    var s1=document.getElementById("txtConsumingCoin").value;
    var patrn=/^(\d)/;
    if (!patrn.test(s1)) 
    {
     window.alert("下载所需E币必须是阿拉伯数字!");
     return false;
    }
}
}

function CheckReply()
{
 if(document.getElementById("BottomDetail").value=="")
 {
  alert("回复内容不能为空!");
  return false;
 }
 
if(document.getElementById("txtReConsumingCoin").value!="")
{
    var s1=document.getElementById("txtReConsumingCoin").value;
    var patrn=/^(\d)/;
    if (!patrn.test(s1)) 
    {
     window.alert("下载所需E币必须是阿拉伯数字!");
     return false;
    }
}
}

function btnBottomReset_onclick() 
{
 document.getElementById("BottomDetail").value="";
 document.getElementById("txtBottomDescription").value="";
}

function btnReset_onclick() 
{
 document.getElementById("Title").value="";
 document.getElementById("txtDetail").value="";
}

function ShowNewTopic()
{
 if(document.getElementById("DivSubmit").style.display=="none") 
 {
    document.getElementById("DivSubmit").style.display="";
 }
  
 if(document.getElementById("DivReply").style.display=="")
 {  
    document.getElementById("DivReply").style.display="none";   
 }
}

function ShowReply()
{
 if(document.getElementById("DivReply").style.display=="none") 
 {
    document.getElementById("DivReply").style.display="";
 }
  
 if(document.getElementById("DivSubmit").style.display=="")
 {  
    document.getElementById("DivSubmit").style.display="none";   
 }
}

//暂时没用,但不能删
function GetContent(Detail,NickName,CreateTime)
{
var varNickName=document.getElementById(NickName).innerHTML;
var varDetail=document.getElementById(Detail).innerHTML;
var varCreateTime=document.getElementById(CreateTime).innerHTML;
if(document.getElementById("DivReply").style.display=="")
{
 if(document.getElementById("BottomDetail").value=="")
 {
 document.getElementById("BottomDetail").value=varNickName+varDetail+varCreateTime;
 }
 else
 {
  var OldContent=document.getElementById("BottomDetail").value;
  var NewContent=varNickName+varDetail+varCreateTime;
  document.getElementById("BottomDetail").value=OldContent+NewContent;
 }
}
else
{
 alert("只有回复时才可引用他人的观点哟!");
 return false;
}
}

function Isdown(nCoinNumber,strUrl,strDownloader,strUploader)
{
    if(confirm("下载该文件需要消耗  "+nCoinNumber+"  E币,您确实要下载吗?"))
    {
        var TimeStamp=new Date().getTime();
        var xmlhttp = createXMLHttps(); 
        xmlhttp.open("GET","/Community/TopicDetail.aspx?CoinNubmer="+ nCoinNumber +"&Downloader=" + strDownloader + "&Uploader="+ strUploader +"&TimeStamp="+TimeStamp,true); 
        xmlhttp.onreadystatechange = function()  
        { 
            if (xmlhttp.readyState == 4 && xmlhttp.status == 200)  
            { 
              if(xmlhttp.responseText!="")
              {
               alert("您积累的E币少于下载该资源所需E币!请刷新查看!");
              }
              else
              {
               window.location.href=strUrl;
              } 
            } 
        } 
        xmlhttp.send(null);
    }
}

function ReturnLogin()
{
	if (confirm("请先登录,然后才能下载!")) 
	{
		document.getElementById("PageTop1_txtEmail").focus();
		return false;
	}
}

function RemindCoinLess()
{
    alert("您的E币不够,赶快到论坛规则中去学习怎么赚取E币吧!");
    return false;
}

function Login()
{
 if(document.getElementById("PageTop1$txtEmail")!=null)
 {
 document.getElementById("PageTop1$txtEmail").focus();
 }
 else
 {
 alert("您已经登录！");
 }
}

function showEdit()
{
    if(document.getElementById("ContentW").style.display == "none")
    {
        document.getElementById("ContentW").style.display = "";
    }else
    {
        document.getElementById("ContentW").style.display = "none";
    }
}
function editContent(TopicId,TypeId)
{
    frmEbs.action = "/Community/TopicDetail.aspx?action=editContent&Id=" + TopicId+"&TypeId="+TypeId;
    frmEbs.submit();
}

function SubmitEdit(TopicId,TypeId)
{
    frmEbs.action = "/Manage/BBS/TopicDetail.aspx?action=editContent&Id=" + TopicId+"&TypeId="+TypeId;
    frmEbs.submit();
}