﻿// JScript 文件

$(document).ready(function() {

    var ssn = $.cookie('sessionuser');
    if (ssn != "okuser" || ssn == null) {
        $.cookie('nimingflag', "nm", { expires: 100 });
    }
    //加载当前进行的热点调查
    $.ajax({ type: "get",
        url: "ajax/GethotdcFortop.aspx?timeStamp=" + new Date().getTime(),
        beforeSend: function(XMLHttpRequest) { 
             
        },
        success: function(data, textStatus) {
            $("#hotdcct").show();
            $("#hotdcct").html("<img src='images/hot3.gif' />当前热点调查:" + data.split("######")[0])
             
             
        },
        complete: function(XMLHttpRequest, textStatus) {
            //HideLoading();
        },
        error: function() {//请求出错处理
        }
    });
    //end
    var msg = "游客，您好，你还没有登陆，请<a id='denglu' href='#'>登陆</a> 或者<a id='zhuce' href='register.aspx'>注册</a>";
    var user = $.cookie('currentuser');
    //netuser=$.cookie(user);

    if (user == null) {
        $("#hdmsg").html(msg);
    }
    else {
        $("#hdmsg").html(user + " 您好，欢迎光临epoll网");
        $("#tuichumsg").show("slow");
        $("#currdc").show("slow");

        //检查用户的资料是否完整
        $.ajax({ type: "get",
            url: "ajax/CheckUserinfo.aspx?u=" + escape(user) + "&timeStamp=" + new Date().getTime(),
            beforeSend: function(XMLHttpRequest) {//ShowLoading();
                $("#hduserinfo").html("   正在检查您的资料完整性......");
            },
            success: function(data, textStatus) {
                //              $(".ajax.ajaxResult").html("");
                //              $("item",data).each(function(i, domEle)
                //              {$(".ajax.ajaxResult").append("<li>"+$(domEle).children("title").text()+"</li>");});
                $("#userjf").html(",您的积分是 :【" + data.split("######")[0] + "】分 ")
                var f = data.split("######")[1];
                var zl = user + '-ziliaoflag';
                if (f == "ok") {
                    $("#hduserinfo").html("");  //您的资料是完整的，恭喜您获得50积分！
                    $("#zlshow").hide();
                    //$.cookie(zl,"wanshan",{expires: 100});
                }
                else {
                    $("#hduserinfo").html("<a style='color:#0f73c7;' href=EditUserInfo.aspx?u=" + escape(user) + ">   您的用户信息还不完善，完善后我们会有相应的积分给您</a>")
                    $("#zlshow").show();
                    // $.cookie(zl,"buwanshan",{expires: 100});
                }
            },
            complete: function(XMLHttpRequest, textStatus) {
                //HideLoading();
            },
            error: function() {//请求出错处理
            }
        });
    }



    $("#exit1")
          .mouseover(function() { $(this).css("background-color", "#ffff90") }) //鼠标移上

          .mouseout(function() { $(this).css("background-color", "#F5F5DC") }) //鼠标移离

          .click(function() {
              $.cookie('currentuser', null);
              $.cookie('nimingflag', null);
              $.cookie('sessionuser', null);
              $.cookie(user, null);
              $.cookie('epoll', null);
              window.location.href = ('default.aspx');

          }
         );


    $("#exit")
          .mouseover(function() { $(this).css("background-color", "#ffff90") }) //鼠标移上

          .mouseout(function() { $(this).css("background-color", "#F5F5DC") }) //鼠标移离

          .click(function() {
              $.cookie('currentuser', null);
              $.cookie('nimingflag', null);
              $.cookie('sessionuser', null);
              $.cookie(user, null);
              $.cookie('epoll', null);
              window.location.href = ('default.aspx');

          }
         );


    $("#headertabs1")
     .click(function() {


         window.location.href.target = "_blank";

         window.location.href = ('default.aspx');


     });
    $("#headertabs3")
     .click(function() {



         var apppath = location.pathname;
         window.location.href = ('HuiyuanGX.aspx');


     });
    $("#headertabs5")
     .click(function() {


         // window.location.href.target="_blank";

         window.location.href = ('./SelfHelpSurvey.aspx');


     });
    $("#headertabs6")
     .click(function() {


         window.location.href.target = "_blank";

         window.location.href = ('hotDC.aspx');


     });
    $("#headertabs7")
     .click(function() {


         window.location.href.target = "_blank";

         window.location.href = ('epollxx.aspx');


     });
    $("#headertabs8")
     .click(function() {


         window.location.href.target = "_blank";

         window.location.href = ('epolljh.aspx');


     });
    $("#headertabs9")
     .click(function() {


         window.location.href.target = "_blank";

         window.location.href = ('help.aspx');


     });
    $("#headertabs2")
     .click(function() {

         //      var user=$.cookie('currentuser');
         //     if(user==null)
         //     {
         //     alert("您需要登录网站才能查看这个栏目！");
         //     } 
         // var flag =$.cookie("nimingflag");

         if (user == null) {
             alert("您需要登录网站才能查看这个栏目！");

         }
         else {
             window.location.href = ('RegisterAfter.aspx');
         }

     });

    //积分 start
    //       $("#loading").bind("ajaxSend", function(){ //使用bind 
    //        $(this).show(); 
    //        }).ajaxComplete(function(date){ //直接使用ajaxComplete 
    //       $(this).hide(); 
    //         
    //       
    //       }).ajaxError(function(event,request, settings){
    //          alert(" 出错页面:" + settings.url);
    //}); 
    $.ajax({ type: "get",
        url: "ajax/hyjf.aspx?timeStamp=" + new Date().getTime(),
        beforeSend: function(XMLHttpRequest) {//ShowLoading();
        },
        success: function(data, textStatus) {
            //              $(".ajax.ajaxResult").html("");
            //              $("item",data).each(function(i, domEle)
            //              {$(".ajax.ajaxResult").append("<li>"+$(domEle).children("title").text()+"</li>");});
            $(".playerright1>.content").html(data.split("######")[0]);
            $("#right_text").html(data.split("######")[0]);
        },
        complete: function(XMLHttpRequest, textStatus) {
            //HideLoading();
        },
        error: function() {//请求出错处理
        }
    });


    //积分 end

    //自助调查 start
    //var user=$.cookie('currentuser');
    if (user == null) {
        user = "niming";
    }
    $.ajax({ type: "get",
        url: "ajax/zizhudcindex.aspx?user=" + user + "&timeStamp=" + new Date().getTime(),
        beforeSend: function(XMLHttpRequest) {//ShowLoading();
        },
        success: function(data, textStatus) {
            //              $(".ajax.ajaxResult").html("");
            //              $("item",data).each(function(i, domEle)
            //              {$(".ajax.ajaxResult").append("<li>"+$(domEle).children("title").text()+"</li>");});
            $("#conct").html(data.split("######")[0]);
        },
        complete: function(XMLHttpRequest, textStatus) {
            //HideLoading();
        },
        error: function() {
        }
    });

    //自助调查 end

    //热点调查 start
    $.ajax({ type: "get",
        url: "ajax/hotdcindex.aspx?timeStamp=" + new Date().getTime(),
        beforeSend: function(XMLHttpRequest) {//ShowLoading();
        },
        success: function(data, textStatus) {
            //              $(".ajax.ajaxResult").html("");
            //              $("item",data).each(function(i, domEle)
            //              {$(".ajax.ajaxResult").append("<li>"+$(domEle).children("title").text()+"</li>");});
            $(".playerright2>.content").html(data.split("######")[0]);
        },
        complete: function(XMLHttpRequest, textStatus) {
            //HideLoading();
        },
        error: function() {//请求出错处理
        }
    });

    //热点调查 end
    $("#zzdc")
             .mouseover(function() { $(this).css("background-color", "#ffff90") }) //鼠标移上

             .mouseout(function() { $(this).css("background-color", "#F5F5DC") }) //鼠标移离

             .click(function() {
                 var user = $.cookie('currentuser');
                 if (user == null) {
                     alert("请先登陆,再到“用户控制中心”发布自助调查！");
                     return;
                 }
                 else {
                     window.location.href = ('RegisterAfter.aspx');

                 }


             });
});
