﻿// JScript 文件
$(document).ready(function(){
   $("#message").html("下载用户登录");
});
function downLoad(id){
  var tid=id;
  var path=$("#T"+id).val();
  $("#showLogin").slideDown("slow");
  $("#tj").click(function(){
      var u=$("#username").val();
      var p=$("#password").val();
      if(u=="")
      {
        $("#message").html("用户名不能为空");
      } 
      else
      {
        if(p=="")
          {
            $("#message").html("密码不能为空");
          }
        else
          {
         
            $.ajax({
                type: "GET",
                url: "ajax/checkuser_d.ashx",
                dataType: "html",
                data: "u=" + u +"&p=" + p + "&f=" + tid + "&z=127",
                
                beforeSend:function(XMLHttpRequest)
                {
                    $("#message").html("正在验证用户...");
                },
                success: function(data) {
                  //成功后
                 
                  switch(data){
                    case "1":
                      $("#message").html("用户名或密码错误！");
                      break;
                    case "2":
                      $("#message").html("用户名或密码错误！");
                      break;
                    case "3":
                      $("#message").html("下载中...");
                      window.location.href=path; 
                      break;
                    case "4":
                      $("#message").html("您无权下载此文件！");   
                      break;
                    default:
                      $("#message").html("");
                  };
                },
                complete:function(XMLHttpRequest,textStatus)
                {
                    //隐藏正在查询图片或文字
                  
                },
                error:function()
               {
               
                    //错误处理
               }
            });
          }
      }
   });
}
function closeLogin(){
  $("#showLogin").slideUp(1000);
  $("#message").html("下载用户登录");
  $("#username").val("");
  $("#password").val("");
}

