﻿function autoBuyCheck()
{  
  var storeCounts = document.getElementById("storeCounts").innerHTML; 
  var buyCount = document.getElementById("txtBuyCount").value; 
  
  if(isNaN(buyCount) || buyCount<=0)
  {
  window.alert("请填写正确的购买数量！");
  return false;
  }  
    
  if(buyCount*-1*-1 > storeCounts*-1*-1)
  {
  window.alert("对不起，最多只能购买"+storeCounts+"本！");
  return false;
  }
    
  (document.getElementById('divSubmitShow')).style.display='block'
  return true;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function checkAllGood(e)
{
  var aa = document.getElementsByName("goodId"); 
  for (var i=0; i<aa.length; i++)
   aa[i].checked = e.checked;
} 
function handBuyCheck()
{
    var goodId=document.getElementsByName("goodId"); 
    
    var choseSign=false;
    
    for(var i=0;i<goodId.length;i++)
    {
        if(goodId[i].checked==true)
        {
            choseSign=true;
        }
    }
    
    if(choseSign==false)
    {
        window.alert('对不起，您至少需要选择一本图书！')
        return false;
    }
    return true;    
} 



function $(element){ 
return element = document.getElementById(element); 
} 

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function showHidden(divId)
{  
var d=$(divId); 
if(d.style.display=='none' || d.style.display=='')
{
d.style.display='block';  
}
else
{
d.style.display='none';  
}
} 


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

var xmlHttpXZ;
function createXMLHttpRequestXZ()
{
    if(window.ActiveXObject)
    {
    xmlHttpXZ=new ActiveXObject("Microsoft.XMLHTTP");
    }
    else if(window.XMLHttpRequest)
    {
    xmlHttpXZ=new XMLHttpRequest();
    }
}
function startRequestXZ(bookId,rowCount,pageIndex)
{ 
var t=new Date();
var y = t.getYear();
var m = t.getMonth();
var d = t.getDay();
var h = t.getHours();
var x = t.getMinutes();
var s = t.getSeconds();
var ms=t.getMilliseconds(); 

createXMLHttpRequestXZ();
xmlHttpXZ.onreadystatechange=headleStateChangeXZ;            
//var url="/info2/xz.aspx?rowCount="+rowCount+"&pageIndex="+pageIndex+"&bookId="+bookId+"&time="+y+m+d;                 
  var url="/info2/xz.aspx?rowCount="+rowCount+"&pageIndex="+pageIndex+"&bookId="+bookId;
xmlHttpXZ.open("GET",url,true);
xmlHttpXZ.send(null);                  
}
function headleStateChangeXZ()
{                
    if(xmlHttpXZ.readyState==4)
    {       
        if(xmlHttpXZ.status==200)
        {              
            document.getElementById("divXZ").innerHTML=xmlHttpXZ.responseText;
        }
    } 
                           
}   

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


function showHiddenXS(isbn,mallId,divId)
{  
    var d=$(divId); 
    if(d.style.display=='none' || d.style.display=='')
    { 
        startRequestJG(isbn,mallId,divId);
        d.style.display='block';  
    }
    else
    {
        d.style.display='none';  
    }
   
} 

//每个网店销售的图书以及价格列表
var xmlHttpJG;
function createXMLHttpRequestJG()
{
    if(window.ActiveXObject)
    {
    xmlHttpJG=new ActiveXObject("Microsoft.XMLHTTP");
    }
    else if(window.XMLHttpRequest)
    {
    xmlHttpJG=new XMLHttpRequest();
    }
}
var divListId;
function startRequestJG(isbn,mallId,xsListId)
{ 
var t=new Date();
var y = t.getYear();
var m = t.getMonth();
var d = t.getDay();
var h = t.getHours();
var x = t.getMinutes();
var s = t.getSeconds();
var ms=t.getMilliseconds(); 

divListId=xsListId;
createXMLHttpRequestJG();
xmlHttpJG.onreadystatechange=headleStateChangeJG;            
//var url="/info2/mallBookList.aspx?mallId="+mallId+"&isbn="+isbn+"&time="+y+m+d;                 
  var url="/info2/mallBookList.aspx?mallId="+mallId+"&isbn="+isbn;
xmlHttpJG.open("GET",url,true);
xmlHttpJG.send(null);                  
}
function headleStateChangeJG()
{                
    if(xmlHttpJG.readyState==4)
    {       
        if(xmlHttpJG.status==200)
        {              
            document.getElementById(divListId).innerHTML=xmlHttpJG.responseText;
        }
    } 
                           
}   


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

var xmlHttpXS;
function createXMLHttpRequestXS()
{
    if(window.ActiveXObject)
    {
    xmlHttpXS=new ActiveXObject("Microsoft.XMLHTTP");
    }
    else if(window.XMLHttpRequest)
    {
    xmlHttpXS=new XMLHttpRequest();
    }
}
function startRequestXS(isbn)
{ 
var t=new Date();
var y = t.getYear();
var m = t.getMonth();
var d = t.getDay();
var h = t.getHours();
var x = t.getMinutes();
var s = t.getSeconds();
var ms=t.getMilliseconds(); 

createXMLHttpRequestXS();
xmlHttpXS.onreadystatechange=headleStateChangeXS;            
//var url="/info2/mallList.aspx?isbn="+isbn+"&time="+y+m+d;                 
  var url="/info2/mallList.aspx?isbn="+isbn;
xmlHttpXS.open("GET",url,true);
xmlHttpXS.send(null);                  
}
function headleStateChangeXS()
{                
    if(xmlHttpXS.readyState==4)
    {       
        if(xmlHttpXS.status==200)
        {              
            document.getElementById("divXS").innerHTML=xmlHttpXS.responseText;
        }
    }                            
}   

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

var xmlHttpTB;
function createXMLHttpRequestTB()
{
    if(window.ActiveXObject)
    {
    xmlHttpTB=new ActiveXObject("Microsoft.XMLHTTP");
    }
    else if(window.XMLHttpRequest)
    {
    xmlHttpTB=new XMLHttpRequest();
    }
}
function startRequestTB(isbn,bookId)
{ 
var t=new Date();
var y = t.getYear();
var m = t.getMonth();
var d = t.getDay();
var h = t.getHours();
var x = t.getMinutes();
var s = t.getSeconds();
var ms=t.getMilliseconds(); 

createXMLHttpRequestTB();
xmlHttpTB.onreadystatechange=headleStateChangeTB;            
//var url="/info2/taobaoList.aspx?bookId="+bookId+"&isbn="+isbn+"&time="+y+m+d;                 
  var url="/info2/taobaoList.aspx?bookId="+bookId+"&isbn="+isbn;
xmlHttpTB.open("GET",url,true);
xmlHttpTB.send(null);                  
}
function headleStateChangeTB()
{                
    if(xmlHttpTB.readyState==4)
    {       
        if(xmlHttpTB.status==200)
        {              
            document.getElementById("divTB").innerHTML=xmlHttpTB.responseText;
        }
    } 
                           
}   



//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

var xmlHttpPurchased;
function createXMLHttpRequestPurchased()
{
    if(window.ActiveXObject)
    {
    xmlHttpPurchased=new ActiveXObject("Microsoft.XMLHTTP");
    }
    else if(window.XMLHttpRequest)
    {
    xmlHttpPurchased=new XMLHttpRequest();
    }
}
function startRequestPurchased(bookId,weight)
{ 
var t=new Date();
var y = t.getYear();
var m = t.getMonth();
var d = t.getDay();
var h = t.getHours();
var x = t.getMinutes();
var s = t.getSeconds();
var ms=t.getMilliseconds(); 

createXMLHttpRequestPurchased();
xmlHttpPurchased.onreadystatechange=headleStateChangePurchased;            
var url="/info2/purchased.aspx?bookId="+bookId+"&weight="+weight+"&time="+y+m+d+h+x+s+ms;                 
xmlHttpPurchased.open("GET",url,true);
xmlHttpPurchased.send(null);                  
}
function headleStateChangePurchased()
{                
    if(xmlHttpPurchased.readyState==4)
    {       
        if(xmlHttpPurchased.status==200)
        {              
            document.getElementById("divPurchased").innerHTML=xmlHttpPurchased.responseText;
        }
    }                            
} 


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

var xmlHttpShop;
function createXMLHttpRequestShop()
{
    if(window.ActiveXObject)
    {
    xmlHttpShop=new ActiveXObject("Microsoft.XMLHTTP");
    }
    else if(window.XMLHttpRequest)
    {
    xmlHttpShop=new XMLHttpRequest();
    }
}
function startRequestShop(bookId,rowCount,pageIndex)
{ 
var t=new Date();
var y = t.getYear();
var m = t.getMonth();
var d = t.getDay();
var h = t.getHours();
var x = t.getMinutes();
var s = t.getSeconds();
var ms=t.getMilliseconds(); 

createXMLHttpRequestShop();
xmlHttpShop.onreadystatechange=headleStateChangeShop;            
//var url="/info2/Shop.aspx?rowCount="+rowCount+"&pageIndex="+pageIndex+"&bookId="+bookId+"&time="+y+m+d;                 
  var url="/info2/Shop.aspx?rowCount="+rowCount+"&pageIndex="+pageIndex+"&bookId="+bookId;
xmlHttpShop.open("GET",url,true);
xmlHttpShop.send(null);                  
}
function headleStateChangeShop()
{                
    if(xmlHttpShop.readyState==4)
    {       
        if(xmlHttpShop.status==200)
        {              
            document.getElementById("divShop").innerHTML=xmlHttpShop.responseText;
        }
    } 
                           
}  
