

function getQuesCount()
{
    $.getJSON("/Ajax/CountInfo.aspx", {mode:"1",stamp:Math.round(Math.random()*100000000)},function(json){loadCounyHandler(json);});
}


function getQuesCount2() {
    $.getJSON("/Ajax/CountInfo.aspx", { mode: "111", stamp: Math.round(Math.random() * 100000000) }, function(json) { loadCounyHandler(json); });
}

function loadCounyHandler(json)
{
    $("#resCount").html(json.res);
    $("#newCount").html(json.new1);
}

function getGuideCount()
{
    $.getJSON("/Ajax/CountInfo.aspx", {mode:"13",stamp:Math.round(Math.random()*100000000)},function(json){loadguiHandler(json);});
}

function loadguiHandler(json)
{
    $("#guide_coun").html(json.gui);
}


//积分周排行
function getWeekP()
{
    $.getJSON("/Ajax/CountInfo.aspx", {mode:"2",stamp:Math.round(Math.random()*100000000)},function(json){weekPointsHandler(json);});
}

function weekPointsHandler(json)
{
    var viewStr = "<div id=\"bon2\"><div id=\"bon2_2\" class=\"font218\"><a href=\"javascript:nextSale('up');\">总积分排行</a></div></div><div id=\"bon1\" class=\"font218\">周积分排行</div><div id=\"con\">";    
    
    for(var i=0 ;i< json.length;i++)
    {
        if(i == 0)
            viewStr += "<div id=\"ul\" class=\"font565\"><div id=\"li_l\">";
        else
            viewStr += "<div id=\"ul\"><div id=\"li_l\">";
            
        viewStr += (i+1)+".&nbsp;&nbsp;"+ json[i].username+"</div><div id=\"li_r\">"+json[i].weekpoints+"</div></div>";
    }
    
    viewStr += "</div>";
    
    $("#saleList1").html(viewStr);
    document.getElementById("saleList0").style.display="none";
	document.getElementById("saleList1").style.display="block";
}

//登陆
function uLogin() {
    var _email = $("#txtEmail").val();
    var _pwd = $("#txtPwd").val();
    var _check = $("#cb_isAnm").val();
    if (_email == "" || _pwd == "") {
        alert('用户名密码不能为空！');
        return;
    }
    $.getJSON("/Ajax/CountInfo.aspx", { mode: "123",email:_email,pwd:_pwd,chck:_check, stamp: Math.round(Math.random() * 100000000) }, function(json) { setLoginInfo(json); });
}

function setLoginInfo(json) {
    if (json.stat == "2") {
        alert('用户名或密码错误，登陆失败！');
    }  
    $("#login_f_div").html(json.content);
}

//new point rank 
function getWeekPoint() {
    $.getJSON("/Ajax/CountInfo.aspx", { mode: "222", stamp: Math.round(Math.random() * 100000000) }, function(json) { viewPointsHandler1(json); });
}

function getAllPoint() {
    $.getJSON("/Ajax/CountInfo.aspx", { mode: "333", stamp: Math.round(Math.random() * 100000000) }, function(json) { viewPointsHandler2(json); });
}
function viewPointsHandler1(json) {
    $("#pr_1").attr("class", "on");
    $("#pr_2").attr("class", "");
    fullInRank(json);
}
function viewPointsHandler2(json) {
    $("#pr_2").attr("class", "on");
    $("#pr_1").attr("class", "");
    fullInRank(json);
}
function fullInRank(json) {
    var _html = "";
    
    for (var i = 0; i < json.length; i++) {
        _html += "<li><a href=\"/iask/user/" + json[i].userid + "/\">" + json[i].username + "</a><b>" + parseInt(json[i].point) + "</b></li>";
    }
    if (_html != "")
        $("#point_rank").html("<ul>"+_html+"</ul><div class=\"clear\"></div>");
}



//分类下的问题统计
function getCategoryCount(pCateId)
{

    $.getJSON("/Ajax/CountInfo.aspx", {mode:"3",cate_id:pCateId,stamp:Math.round(Math.random()*100000000)},function(json){categoryCountHandler(json);});
}
// new 
function getCategoryCount1(pCateId) {

    $.getJSON("/Ajax/CountInfo.aspx", { mode: "23", cate_id: pCateId, stamp: Math.round(Math.random() * 100000000) }, function(json) { categoryCountHandler(json); });
}
function categoryCountHandler(json)
{
     for(var i=0 ;i< json.length;i++)
     {
        $("#cfont_"+json[i].cateid).html("("+json[i].catecount+")");
     }
}

//发送回答的Mail
function sendMailByAns(quesId)
{

    $.getJSON("/Ajax/CountInfo.aspx", {mode:"5",ques_id:quesId,stamp:Math.round(Math.random()*100000000)},function(json){});
}



//蒙板操作
function showManagerDiv(_divID)
{
      createMaskDiv();
      var msg = document.getElementById(_divID.toString());
      msg.style.position = "absolute";
      msg.style.zIndex = "9999";
      msg.style.top = "176px";
      msg.style.left = (parseInt(document.body.scrollWidth) - 184) / 2 + "px"; 
      msg.style.display = "block";
      
 }
 
function closeManagerDiv(_divID)
{      
   document.getElementById(_divID.toString()).style.display = "none";
   var _div = parent.document.getElementById("divMask");
   document.body.removeChild(_div);
}
 
function createMaskDiv() {
      // mask图层
      var newMask = document.createElement("div");
      newMask.id = "divMask";
      newMask.style.position = "absolute";
      newMask.style.zIndex = "1";
      newMask.style.width = document.body.scrollWidth + "px";
      newMask.style.height = document.body.scrollHeight-80-80 + "px";
      //newMask.style.height = window.screen.height + "px";
      newMask.style.top = "80px";
      newMask.style.left = "0px";
      newMask.style.background = "#000";
      newMask.style.filter = "alpha(opacity=40)";
      newMask.style.opacity = "0.40";
      document.body.appendChild(newMask);
  }


  function adIndexOutput() {
//      document.writeln('<div style="width:728px;margin-left:auto;margin-right:auto">');
//      document.writeln('<script type="text/javascript"><!--');
//      document.writeln('google_ad_client = "pub-3388570396365381";');
//      document.writeln('//728x90, 创建于 08-1-7');
//      document.writeln('google_ad_width = 728;');
//      document.writeln('google_ad_height = 90;');
//      document.writeln('//--></script>');
//      document.writeln('<script type="text/javascript" ');
//      document.writeln('src="http://pagead2.googlesyndication.com/pagead/show_ads.js">');
//      document.writeln('</script>');
//      document.writeln('</div>');
  }

  function googleAdLeft() {
      document.writeln('<script type="text/javascript"><!--');
      document.writeln('google_ad_client = "pub-3388570396365381";');
      document.writeln('//200x200, 创建于 08-1-7');
      document.writeln('google_ad_slot = "9513060022";');
      document.writeln('google_ad_width = 200;');
      document.writeln('google_ad_height = 200;');
      document.writeln('//--></script>');
      document.writeln(' <script type="text/javascript"');
      document.writeln(' src="http://pagead2.googlesyndication.com/pagead/show_ads.js">');
      document.writeln('</script>');
  }

  function adBaiduLeft() {
      document.writeln("<script type='text/javascript'> ");
      document.writeln("cpro_client='eaglealan_cpr';");
      document.writeln("cpro_at='text_image'; ");
      document.writeln("cpro_161=4; ");
      document.writeln("cpro_flush=4; ");
      document.writeln("cpro_w=160; ");
      document.writeln("cpro_h=600; ");
      document.writeln("cpro_template='text_default_160_600'; ");
      document.writeln("cpro_cbd='#FFFFFF'; ");
      document.writeln("cpro_cbg='#FFFFFF'; ");
      document.writeln("cpro_ctitle='#0077CC'; ");
      document.writeln("cpro_cdesc='#BBBBBB'; ");
      document.writeln("cpro_curl='#008000'; ");
      document.writeln("cpro_cflush='#e10900'; ");
      document.writeln("cpro_uap=1;");
      document.writeln("cpro_cad=1;");
      document.writeln("cpro_channel=4;");
      document.writeln("</script>");
      document.writeln("<script language='JavaScript' type='text/javascript' src='http://cpro.baidu.com/cpro/ui/cp.js'></script>");
  }

  function adBaidu336_280() {
      document.writeln("<script type='text/javascript'>");
      document.writeln("cpro_client='eaglealan_cpr';");
      document.writeln("cpro_at='text_image';");
      document.writeln("cpro_161=4;");
      document.writeln("cpro_flush=4;");
      document.writeln("cpro_w=336;");
      document.writeln("cpro_h=280;");
      document.writeln("cpro_template='text_default_336_280';");
      document.writeln("cpro_cbd='#FFFFFF';");
      document.writeln("cpro_cbg='#FFFFFF';");
      document.writeln("cpro_ctitle='#0000ff';");
      document.writeln("cpro_cdesc='#444444';");
      document.writeln("cpro_curl='#008000';");
      document.writeln("cpro_cflush='#e10900';");
      document.writeln("cpro_uap=1;");
      document.writeln("cpro_cad=1;");
      document.writeln("cpro_channel=4;");
      document.writeln("</script>");
      document.writeln("<script language='JavaScript' type='text/javascript' src='http://cpro.baidu.com/cpro/ui/cp.js'></script>");

  }

  function buttomYeedou() {
      document.writeln('<script type="text/javascript">');
      document.writeln(' yeedou_ad_client = "zhidao_zhigou";');
      document.writeln('yeedou_ad_width = 760;');
      document.writeln('yeedou_ad_height = 90;');
      document.writeln(' yeedou_ad_format = "760x90_product";');
      document.writeln('yeedou_ad_type = "cps";');
      document.writeln('yeedou_ad_channel = "77";');
      document.writeln('yeedou_color_border = "fff";');
      document.writeln('yeedou_color_bg = "FFFFFF";');
      document.writeln('yeedou_color_link = "0000FF";');
      document.writeln('yeedou_color_text = "000000";');

      document.writeln('</script>');

      document.writeln('<script type="text/javascript" src="http://union.yeedou.com/pagead/show_ads.aspx">');
      document.writeln('</script>');
  }

  function adGoogleMiddle() {
      document.writeln('<script type="text/javascript"><!--');
      document.writeln('google_ad_client = "pub-3388570396365381";');
      document.writeln('//728x90, 创建于 08-1-7');
      document.writeln('google_ad_slot = "2266925604";');
      document.writeln('google_ad_width = 680;');
      document.writeln('google_ad_height = 90;');
      document.writeln('//--></script>');

      document.writeln('<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">');
      document.writeln('</script>');
  }