﻿function fnCartAdd(Mode,intcounter,proID,catId)
{
if(Mode!="")
  { 
    //alert("proId="+ proID +"&catId="+ catId +"&mode="+Mode+"&randN="+Math.random()); 
    var spnbuy=document.getElementById("spnBuyBtn_"+intcounter);
    var spnload=document.getElementById("spnload_"+intcounter);
    //alert("btn: " + spnbuy + " ajax img: " + spnload);
    var xmlHttpReq_findfile = false;
    var self_findfile = this;
    if (window.XMLHttpRequest) 
    {
        self_findfile.xmlHttpReq_findfile = new XMLHttpRequest();
    }
    else if (window.ActiveXObject) 
    {
        self_findfile.xmlHttpReq_findfile = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self_findfile.xmlHttpReq_findfile.open("POST", "frmAjaxCart.aspx", true);
    self_findfile.xmlHttpReq_findfile.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    self_findfile.xmlHttpReq_findfile.onreadystatechange = function() 
    {
        if (self_findfile.xmlHttpReq_findfile.readyState == 4) 
        {    
            var ret= self_findfile.xmlHttpReq_findfile.responseText;
            if(ret=="t")
            {
//            spnbuy.style.display="block";
//            spnload.style.display="none";
                window.location="cart.aspx";
            }
            else
            {
                alert("Some problem in adding cart!!plz try again.....");
            }
        }
        if (self_findfile.xmlHttpReq_findfile.readyState < 4) 
        {     
             spnbuy.style.display="none";
             spnload.style.display="block";
        }
    }
    
    self_findfile.xmlHttpReq_findfile.send("proId="+ proID +"&catId="+ catId +"&mode="+Mode+"&randN="+Math.random()); 
    flag=true;
  }

}

