﻿// JScript 文件

var xmlHttp;
 
function GetXMLHttp()
{
    try
    {
       // Firefox, Opera 8.0+, Safari
        xmlHttp=new XMLHttpRequest();
    }
    catch(e)
    {
      // Internet Explorer
      try
      {
        xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
      catch(e)
      {
          try
             {
             xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
             }
          catch(e)
             {
                alert("不支持ajax");
             }
        }
    }
}

//获得该新闻/消息的评论总数
function GetReplayCounts(type)
 {
    GetXMLHttp();
    var nid;
    if(type=="news")
    {
        nid=document.NewsForm.NewsId.value;
    }
    else
    {
        nid=document.StoryForm.StoryId.value;
    }
    
    var chat="评论";
    var url="../view.aspx?chat="+escape(chat)+"&type="+type+"&docId="+nid;
    document.getElementById("lookallBox").innerHTML="<a class='LookAll' href='"+url+"' target='_blank' id='LookAll' name='LookAll'>查看所有评论</a>";
    
    xmlHttp.onreadystatechange=function()
    {
      if(xmlHttp.readyState==4)
        {
            if(xmlHttp.status==200)
            {
                document.getElementById("plcounts").innerText=xmlHttp.responseText;
                GetContent(type);//绑定该消息/新闻内容
            }
        }
     }
     turl="../Important/Rcounts.aspx";
     var sendtext="type="+escape(type)+"&nid="+escape(nid)+"&now="+new Date();
     xmlHttp.open("Post",turl,true);
     //当方法为post时需要如下设置http头   
     xmlHttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');   
     //发送数据
     xmlHttp.send(sendtext);
 }
 
 
 //提交评论
 function AddReplay(type)
 {
    GetXMLHttp();
    var nid,name,content;
    if(type=="news")
    {
        nid=document.NewsForm.NewsId.value;
        name=document.NewsForm.plname.value;
        content=document.NewsForm.pltext.value;
    }
    else
    {
        nid=document.StoryForm.StoryId.value;
        name=document.StoryForm.plname.value;
        content=document.StoryForm.pltext.value;
    }
    if(name==""){name="游客";}
    if(content.replace(/[ ]/g,"")=="")
    {
        alert("评论内容不能为空");
        return;
    }
    
    xmlHttp.onreadystatechange=function()
    {
      if(xmlHttp.readyState==4)
        {
             var ok=xmlHttp.responseText;
             if(ok=="true")
             {
                if(type=="news")
                {
                    document.NewsForm.pltext.value="";
                 }
                 else
                 {
                    document.StoryForm.pltext.value="";
                 }
                var chat="评论";
                var url="../view.aspx?chat=www696pl&type="+type+"&docId="+nid;
                alert("感谢您的评论!");
                parent.document.location.href=url;
             }
             else
             {
                alert("评论提交失败!");
             }
        }
     }
     var turl="../Important/AddReplay.aspx";
     var sendtext="type="+escape(type)+"&id="+escape(nid)+"&n="+escape(name)+"&c="+escape(content);
     xmlHttp.open("post",turl,true);
     //当方法为post时需要如下设置http头   
     xmlHttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');   
     //发送数据 
     xmlHttp.send(sendtext);
 }
 
  //显示评论页面的提交评论
 function PLpageAddReplay(type,nid)
 {
    GetXMLHttp();
    var name=document.viewForm.plname.value;
    var content=document.viewForm.pltext.value;
    if(name==""){name="游客";}
    if(content.replace(/[ ]/g,"")=="")
    {
        alert("评论内容不能为空");
        return;
    }
    
    xmlHttp.onreadystatechange=function()
    {
      if(xmlHttp.readyState==4)
        {
             var ok=xmlHttp.responseText;
             if(ok=="true")
             {
                alert("感谢您的评论!");
                document.viewForm.pltext.value="";
                var chat="雅歌威斯品牌策划维护机构--新闻中心";
                window.location.reload();
             }
             else
             {
                alert("评论提交失败!");
             }
        }
     }
     var turl="Important/AddReplay.aspx";
     var sendtext="type="+escape(type)+"&id="+escape(nid)+"&n="+escape(name)+"&c="+escape(content);
     xmlHttp.open("post",turl,true);
     //当方法为post时需要如下设置http头   
     xmlHttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');   
     //发送数据
     xmlHttp.send(sendtext);
 }
 
 //显示最新新闻
 function GetTopNewsList(type)
 {
    GetXMLHttp();
    xmlHttp.onreadystatechange=function()
    {
      if(xmlHttp.readyState==4)
        {
            if(xmlHttp.status==200)
            {
                document.getElementById("NewsList").innerHTML=xmlHttp.responseText;
                GetReplayCounts(type);//评论数
            }
        }
     }
     var turl="../Important/TopNews.aspx";
     var sendtext="t="+escape(type)+"&now="+new Date();
     xmlHttp.open("Post",turl,true);
     //当方法为post时需要如下设置http头   
     xmlHttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');   
     //发送数据
     xmlHttp.send(sendtext);
 }
 
 //公司简介
 function GetCompanyInfo()
 {
    GetXMLHttp();
    xmlHttp.onreadystatechange=function()
    {
        if(xmlHttp.readyState==4)
        {
            if(xmlHttp.status==200)
            {
                document.getElementById("CompanyInfo").innerHTML=xmlHttp.responseText;
            }
        }
    }
    var turl="Important/ComInfo.aspx";
    var sendtext="now="+new Date();
    xmlHttp.open("post",turl,true);
    //当方法为post时需要如下设置http头   
     xmlHttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');   
     //发送数据
     xmlHttp.send(sendtext);
 }
 
  //联系我们
 function GetContact()
 {
    GetXMLHttp();
    xmlHttp.onreadystatechange=function()
    {
        if(xmlHttp.readyState==4)
        {
            if(xmlHttp.status==200)
            {
                document.getElementById("ContactText").innerHTML=xmlHttp.responseText;
            }
        }
    }
    var turl="Important/Contact.aspx";
    var sendtext="now="+new Date();
    xmlHttp.open("post",turl,true);
    //当方法为post时需要如下设置http头   
     xmlHttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');   
     //发送数据
     xmlHttp.send(sendtext);
 }
 
 //取新闻news或品牌业务消息pingpai
 function GetContent(type)
 {
     GetXMLHttp();
     var nid;
     if(type=="news")
    {
        nid=document.NewsForm.NewsId.value;
    }
    else
    {
        nid=document.StoryForm.StoryId.value;
    }
    
    xmlHttp.onreadystatechange=function()
    {
        if(xmlHttp.readyState==4)
        {
            if(xmlHttp.status==200)
            {
                document.getElementById("ContextTextBox").innerHTML=xmlHttp.responseText;
            }
        }
    }
    var turl="../Important/newsContent.aspx";
    var sendtext="type="+escape(type)+"&id="+escape(nid)+"&now="+new Date();
    xmlHttp.open("post",turl,true);
    //当方法为post时需要如下设置http头   
     xmlHttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');   
     //发送数据
     xmlHttp.send(sendtext);
 }
 
  //首页删除负面信息列表
 function GetDelFMXX()
 {
     GetXMLHttp();
    xmlHttp.onreadystatechange=function()
    {
        if(xmlHttp.readyState==4)
        {
            if(xmlHttp.status==200)
            {
                document.getElementById("DeleteFMXX").innerHTML=xmlHttp.responseText;
               //GetDelBDKZ();//删除百度快照
                //GetDelGSGG();//公司公告
            }
        }
    }
    var turl="Important/IndexListmsg_1.aspx";
    var sendtext="now="+new Date();
    xmlHttp.open("post",turl,true);
    //当方法为post时需要如下设置http头   
     xmlHttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');   
     //发送数据
     xmlHttp.send(sendtext);
 }
 
   //首页公司公告列表
 function GetDelGSGG()
 {
     GetXMLHttp();
    xmlHttp.onreadystatechange=function()
    {
        if(xmlHttp.readyState==4)
        {
            if(xmlHttp.status==200)
            {
                document.getElementById("DeleteGSGG").innerHTML=xmlHttp.responseText;
             // GetDelZxxx();//删除最新信息列表
            }
        }
    }
    var turl="Important/IndexListmsg_gsgg.aspx";
    var sendtext="now="+new Date();
    xmlHttp.open("post",turl,true);
    //当方法为post时需要如下设置http头   
     xmlHttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');   
     //发送数据
     xmlHttp.send(sendtext);
 }
 
    //首页最新信息列表
 function GetDelZxxx()
 {
     GetXMLHttp();
    xmlHttp.onreadystatechange=function()
    {
        if(xmlHttp.readyState==4)
        {
            if(xmlHttp.status==200)
            {
                document.getElementById("Zxxx").innerHTML=xmlHttp.responseText;
               //GetDelBDKZ();//删除百度快照
               GetWjgg();
           
            }
        }
    }
    var turl="Important/IndexListmsg_zxxx.aspx";
    var sendtext="now="+new Date();
    xmlHttp.open("post",turl,true);
    //当方法为post时需要如下设置http头   
     xmlHttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');   
     //发送数据
     xmlHttp.send(sendtext);
 }
 
    //首页下载专区
 function GetDivXzzx()
 {
     GetXMLHttp();
    xmlHttp.onreadystatechange=function()
    {
        if(xmlHttp.readyState==4)
        {
            if(xmlHttp.status==200)
            {
                document.getElementById("Xzzx").innerHTML=xmlHttp.responseText;
                //Getwlgg();
                GetWlcz();
            }
        }
    }
    var turl="Important/IndexListmsg_xzzx.aspx";
    var sendtext="now="+new Date();
    xmlHttp.open("post",turl,true);
    //当方法为post时需要如下设置http头   
     xmlHttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');   
     //发送数据
     xmlHttp.send(sendtext);
 }
    //首页屏蔽信息
 function GetPbxx()
 {
     GetXMLHttp();
    xmlHttp.onreadystatechange=function()
    {
        if(xmlHttp.readyState==4)
        {
            if(xmlHttp.status==200)
            {
                document.getElementById("Pbxx").innerHTML=xmlHttp.responseText;
              //GetWlcz();
              GetWltg();
            }
        }
    }
    var turl="Important/IndexListmsg_Pbxx.aspx";
    var sendtext="now="+new Date();
    xmlHttp.open("post",turl,true);
    //当方法为post时需要如下设置http头   
     xmlHttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');   
     //发送数据
     xmlHttp.send(sendtext);
 }
     //首页网络炒作
 function GetWlcz()
 {
     GetXMLHttp();
    xmlHttp.onreadystatechange=function()
    {
        if(xmlHttp.readyState==4)
        {
            if(xmlHttp.status==200)
            {
                document.getElementById("Wlcz").innerHTML=xmlHttp.responseText;
               //GetPbwh();
              GetDelZxxx();
            }
        }
    }
    var turl="Important/IndexListmsg_Wlcz.aspx";
    var sendtext="now="+new Date();
    xmlHttp.open("post",turl,true);
    //当方法为post时需要如下设置http头   
     xmlHttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');   
     //发送数据
     xmlHttp.send(sendtext);
 }
 
 
    //首页品牌维护
 function GetPbwh()
 {
     GetXMLHttp();
    xmlHttp.onreadystatechange=function()
    {
        if(xmlHttp.readyState==4)
        {
            if(xmlHttp.status==200)
            {
                document.getElementById("Ppwh").innerHTML=xmlHttp.responseText;
              //GetWltg();
              Getwlgg();
            }
        }
    }
    var turl="Important/IndexListmsg_Ppwh.aspx";
    var sendtext="now="+new Date();
    xmlHttp.open("post",turl,true);
    //当方法为post时需要如下设置http头   
     xmlHttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');   
     //发送数据
     xmlHttp.send(sendtext);
 }
 
   //首页网络公关
 function Getwlgg()
 {
     GetXMLHttp();
    xmlHttp.onreadystatechange=function()
    {
        if(xmlHttp.readyState==4)
        {
            if(xmlHttp.status==200)
            {
                document.getElementById("Wlgg").innerHTML=xmlHttp.responseText;
              //  GetPbxx();
              GetDivXzzx();
            }
        }
    }
    var turl="Important/IndexListmsg_wlgg.aspx";
    var sendtext="now="+new Date();
    xmlHttp.open("post",turl,true);
    //当方法为post时需要如下设置http头   
     xmlHttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');   
     //发送数据
     xmlHttp.send(sendtext);
 }
 
  //首页网络推广
 function GetWltg()
 {
     GetXMLHttp();
    xmlHttp.onreadystatechange=function()
    {
        if(xmlHttp.readyState==4)
        {
            if(xmlHttp.status==200)
            {
                document.getElementById("Wltg").innerHTML=xmlHttp.responseText;
               GetSeo();
            }
        }
    }
    var turl="Important/IndexListmsg_Wltg.aspx";
    var sendtext="now="+new Date();
    xmlHttp.open("post",turl,true);
    //当方法为post时需要如下设置http头   
     xmlHttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');   
    //发送数据
     xmlHttp.send(sendtext);
 }
 
 //首页Seo优化
 function GetSeo()
 {
     GetXMLHttp();
    xmlHttp.onreadystatechange=function()
    {
        if(xmlHttp.readyState==4)
        {
            if(xmlHttp.status==200)
            {
                document.getElementById("Seo").innerHTML=xmlHttp.responseText;
               GetPbwh();//品牌维护
            }
        }
    }
    var turl="Important/IndexListmsg_Seo.aspx";
    var sendtext="now="+new Date();
    xmlHttp.open("post",turl,true);
    //当方法为post时需要如下设置http头   
     xmlHttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');   
    //发送数据
     xmlHttp.send(sendtext);
 }
 
  //首页 危机公关
   function GetWjgg()
 {
     GetXMLHttp();
    xmlHttp.onreadystatechange=function()
    {
        if(xmlHttp.readyState==4)
        {
            if(xmlHttp.status==200)
            {
                document.getElementById("wjgg").innerHTML=xmlHttp.responseText;
               GetPbwh();//品牌维护
            }
        }
    }
    var turl="Important/IndexListmsg_Wjgg.aspx";
    var sendtext="now="+new Date();
    xmlHttp.open("post",turl,true);
    //当方法为post时需要如下设置http头   
     xmlHttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');   
    //发送数据
     xmlHttp.send(sendtext);
 }
 
 
   //首页删除百度快照
 function GetDelBDKZ()
 {
     GetXMLHttp();
    xmlHttp.onreadystatechange=function()
    {
        if(xmlHttp.readyState==4)
        {
            if(xmlHttp.status==200)
            {
                document.getElementById("DeleteBDKZ").innerHTML=xmlHttp.responseText;
                //GetDivXzzx();//下载中心
            }
        }
    }
    var turl="Important/IndexListmsg_2.aspx";
    var sendtext="now="+new Date();
    xmlHttp.open("post",turl,true);
    //当方法为post时需要如下设置http头   
     xmlHttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');   
     //发送数据
     xmlHttp.send(sendtext);
 }
 
 
 

 //首面公司简介(部分)
 function GetCompanyJS()
 {
     GetXMLHttp();
    xmlHttp.onreadystatechange=function()
    {
        if(xmlHttp.readyState==4)
        {
            if(xmlHttp.status==200)
            {
                document.getElementById("JSBox").innerHTML=xmlHttp.responseText;
               // GetDelFMXX();//删除负面信息
               GetPbxx();//屏蔽信息
            }
        }
    }
    var turl="Important/IndexComInfo.aspx";
    var sendtext="now="+new Date();
    xmlHttp.open("post",turl,true);
    //当方法为post时需要如下设置http头   
     xmlHttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');   
     //发送数据
     xmlHttp.send(sendtext);
 }
 
  //控制输入长度(按键松开时)
 function TextareaFunction(obj)
 {
    if(obj.value.length>obj.maxlength){obj.value=obj.value.substring(0,obj.maxlength);}
 }
 

