var xmlHttp;function createXMLHttpRequest(){if(window.ActiveXObject){xmlHttp=new ActiveXObject("Microsoft.XMLHTTP")}else{if(window.XMLHttpRequest){xmlHttp=new XMLHttpRequest()}}}function showCartChange(){var b=document.getElementById("cart_home");var a=document.getElementById("relMessage");if(xmlHttp.readyState==4&&xmlHttp.status==200){b.innerHTML=xmlHttp.responseText;a.innerHTML=""}}function delItem1(c){createXMLHttpRequest();var b=";jsessionid="+document.getElementById("jsessionid").value;var a="/mycart_.jsp"+b;xmlHttp.open("POST",a);xmlHttp.onreadystatechange=showCartChange;xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");xmlHttp.send("action=del1&SKU="+c)}function clearCart(){createXMLHttpRequest();var b=";jsessionid="+document.getElementById("jsessionid").value;var a="/mycart_.jsp"+b;xmlHttp.open("POST",a);xmlHttp.onreadystatechange=showCartChange;xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");xmlHttp.send("action=clear")}function addFavItem(c){createXMLHttpRequest();var b=";jsessionid="+document.getElementById("jsessionid").value;var a="/mycart_.jsp"+b;xmlHttp.open("POST",a);xmlHttp.onreadystatechange=showRelChange;xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");xmlHttp.send("action=fav&SKU="+c)}function showRelChange(){var a=document.getElementById("relMessage");if(xmlHttp.readyState==4&&xmlHttp.status==200){a.innerHTML=xmlHttp.responseText}}function showCartUpdate(){var c=document.getElementsByName("book");var e=document.getElementById("relMessage");var h="",f="";for(var d=0;d<c.length;d++){var g=document.getElementById(c[d].title);if(g.value==null||g.value==""){e.innerHTML="<br />\u60a8\u8f93\u5165\u7684\u6570\u91cf\u503c\u4e0d\u80fd\u4e3a\u7a7a\uff0c\u8bf7\u586b\u5199\uff01<br />";return}else{if(!/^\d+$/.test(g.value)){e.innerHTML="<br />\u60a8\u8f93\u5165\u7684\u6570\u91cf\u503c\u5fc5\u987b\u4e3a\u6570\u5b57\uff0c\u8bf7\u786e\u5b9a\u91cd\u65b0\u8f93\u5165\uff01<br />";return}}c[d].value=g.value;h=h+c[d].title+"|";f=f+c[d].value+"|"}e.innerHTML="";createXMLHttpRequest();var b=";jsessionid="+document.getElementById("jsessionid").value;var a="/mycart_.jsp"+b;xmlHttp.open("POST",a);xmlHttp.onreadystatechange=showCartChange;xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");xmlHttp.send("action=update2&SKUS="+h+"&q="+f)};

