﻿function ANP_checkInput(bid,mv,eurl){var el=document.getElementById(bid);var r=new RegExp("^\\s*(\\d+)\\s*$");
if(r.test(el.value)){if(RegExp.$1<1||RegExp.$1>mv){alert("页索引超出范围！");el.focus();el.select();return false;}
location.href=eurl.replace("{0}",document.getElementById(bid).value);return true;}alert("页索引不是有效的数值！");el.focus();el.select();return false;}
function ANP_keydown(e,btnId){
var kcode;
if(window.event){kcode=e.keyCode;}
else if(e.which){kcode=e.which;}
var validKey=(kcode==8||kcode==46||kcode==37||kcode==39||(kcode>=48&&kcode<=57)||(kcode>=96&&kcode<=105));
if(!validKey){
if(kcode==13) document.getElementById(btnId).click();
if(e.preventDefault) e.preventDefault();else{event.returnValue=false};
}
}

  function GetRad()
  {
    now = new Date();
    hours = now.getHours();
    minutes = now.getMinutes();
    seconds = now.getSeconds();
    milli = now.getMilliseconds();
    return hours+""+minutes+""+seconds+milli;
  }
  
 function GetList(pid,pname,bimg)
    {
      $("#divList").html("正在加载...");
      var ListPage = "MyList.aspx";      
      var urlParam = "act=add&PID="+pid+"&Pname="+pname+"&Bimg="+bimg+"&t="+GetRad();  
    $.ajax({
        type: "GET",
        url: ListPage,
        data: urlParam,
        dataType: "html",
        success: function(xml){
            $("#divList").html(xml);
        }
        });
    }
  function deletelist(str){
    
          $("#divList").html("正在加载...");
      var ListPage = "MyList.aspx";      
      var urlParam = "act=delete&PID="+str+"&t="+GetRad();  
    $.ajax({
        type: "GET",
        url: ListPage,
        data: urlParam,
        dataType: "html",
        success: function(xml){
            $("#divList").html(xml);
        }
        });
  }
  
  function GetRad()
  {
    now = new Date();
    hours = now.getHours();
    minutes = now.getMinutes();
    seconds = now.getSeconds();
    milli = now.getMilliseconds();
    return hours+""+minutes+""+seconds+milli;
  }
  
  function Compare(eE,ePID)
  {
        if(eE.checked)
        {
           urlParam = "PID="+ePID+"&t="+GetRad();  
        }else
        {
             urlParam = "DID="+ePID+"&t="+GetRad(); 
        }
   
         $("#divCompare").html("正在加载...");
          var ListPage = "/doCompare.aspx";      
           $.ajax({
            type: "GET",
            url: ListPage,
            data: urlParam,
            dataType: "html",
            success: function(xml){
                $("#divCompare").html(xml);
            }
            });
  }
  
  function OnitCompare()
  {
    if(IsJQuery='undefined')return;
     urlParam = "PID=&t="+GetRad();
     var ListPage = "/doCompare.aspx"; 
     $("#divCompare").html("正在加载...");

       $.ajax({
        type: "GET",
        url: ListPage,
        data: urlParam,
        dataType: "html",
        success: function(xml){
            $("#divCompare").html(xml);
        }
        });
   
  }
  function AddCompare(ePID)
  {
     urlParam = "PID="+ePID+"&t="+GetRad();
     var ListPage = "/doCompare.aspx"; 
     $("#divCompare").html("正在加载...");

       $.ajax({
        type: "GET",
        url: ListPage,
        data: urlParam,
        dataType: "html",
        success: function(xml){
            $("#divCompare").html(xml);
        }
        });
  }
  //历史浏览
  function ViewList(ePID)
  {
     urlParam = "TN=1&PID="+ePID+"&t="+GetRad();
     var ListPage = "/doCompare.aspx"; 
     $("#divCompare").html("正在加载...");

       $.ajax({
        type: "GET",
        url: ListPage,
        data: urlParam,
        dataType: "html",
        success: function(xml){
            $("#divCompare").html(xml);
        }
        });
  }
  function DelCompare(ePID)
  {
     urlParam = "DID="+ePID+"&t="+GetRad();
     var ListPage = "/doCompare.aspx"; 
     $("#divCompare").html("正在加载...");

       $.ajax({
        type: "GET",
        url: ListPage,
        data: urlParam,
        dataType: "html",
        success: function(xml){
            $("#divCompare").html(xml);
        }
        });
  }
  
  function onAjax(eDIV,eUrl,eUrlParam)
  {
        $("#"+eDIV).html("正在加载...");
      var ListPage = eUrl;      
      var urlParam = eUrlParam+"&t="+GetRad();  

    $.ajax({
        type: "GET",
        url: ListPage,
        data: urlParam,
        dataType: "html",
        error: function(){
        location.href=ListPage+"?"+urlParam;
    },
        success: function(xml){
  
            $("#"+eDIV).html(xml);
        }

        });
  }
  
  function onAddAjax(eUrl,eUrlParam)
  {
        $("#"+eDIV).html("正在加载...");
      var ListPage = eUrl;      
      var urlParam = eUrlParam+"&t="+GetRad();  

    $.ajax({
        type: "GET",
        url: ListPage,
        data: urlParam,
        dataType: "html",
        error: function(){
        location.href=ListPage+"?"+urlParam;
    },
        success: function(xml){
  
          alert(xml);
        }

        });
  }
  
  
   function setJson(eJsonName,eID,eParam)
  {
       
      var urlParam = "id="+eID+"&p="+eParam+"&t="+GetRad();  

       var html = $.ajax({
        type: "GET",
        url: "Json.aspx",
        data: urlParam,
//        dataType: "html",
        async:false
//        error: function(){
//            //location.href="Json.aspx"+"?"+urlParam;
//            return "";
//            },
//        success: function(xml){
//        var json = "var user="+xml;
//         return json;
//         //eval(json);
//         //alert(xml);
//         //alert(user.UserID);
//             }
        }).responseText;
        if(html == "")
        return "var "+ eJsonName + "={}";
        var mJson = "var "+ eJsonName + "=" + html;
        return mJson;
  }