function buy(a,b,c,d){var e="/server/buy.asp?productID="+a;if(b!=undefined){e+="&eventID="+b+"&ruleID="+c+"&ruleList="+d}e=e+"&"+(new Date()).getTime();showCar(e)}function showCar(a){if(a==undefined)a="";var b=630;var c=400;var l=(document.body.clientWidth-b)/2;var t=100;if(document.documentElement&&document.documentElement.scrollTop){t+=document.documentElement.scrollTop}else{t+=document.body.scrollTop}sAlert(b,c,l,t);getBodyLocal("/style/default/frame/car.html","get",null,"if(err==''){parent.execShowCar(result,"+(b)+","+(c-2)+",'"+a+"')}else{parent.showMsg('出现错误，错误代码:'+err+'<br />请将此错误报告给我们，非常感谢！',5000)}",0,true);window.onscroll=moveStart}function execShowCar(a,b,c,d){$("alertFram").style.border="1px solid #AAAAAA";$("alertFram").innerHTML=a;$("functionBar").onmousedown=StartDrag;$("functionBar").onmousemove=Drag;$("functionBar").onmouseup=StopDrag;hiden="";selectHiden="";$("functionMain").style.cssText="margin:auto;width:"+b+"px;height:"+c+"px";$("functionLeft").style.width=(b-20)+"px";$("functionContent").style.width=(b-10)+"px";$("functionContent").style.height=(c-100)+"px";if(d!=""){getBody(d,"get",null,"$('functionContent').innerHTML=result;top.account();top.execJava();",0,true)}else{getBody("/server/carView.asp?"+(new Date()).getTime(),"get",null,"$('functionContent').innerHTML=result;top.account();top.execJava();",0,true)}}function execJava(){var a=$("functionContent").getElementsByTagName("select");for(var i=0;i<a.length;i++){a[i].style.color=a[i].value}a=null}function account(){try{var a=0;b=0;var c=$("shopCarsMain");var d,node,num;for(var i=0;i<c.childNodes.length;i++){node=c.childNodes[i];try{d=node.getAttribute("id").replace("shopCars_product_head","");num=parseInt($("productNum"+d).value);a+=parseFloat($("productMarketPrice"+d).innerHTML.replace("￥",""))*num;b+=parseFloat($("productCocoPrice"+d).innerHTML.replace("￥",""))*num}catch(err){};node=null}$("allAccount").innerHTML=a.toString();$("allCocoAccount").innerHTML=b.toString();$("allLessAccount").innerHTML=(a-b).toString();c=null}catch(err){}}function showEvent(a){var b=$("productEvent"+a);var c=$("productEvent"+hiden);if(hiden!=""){c.style.display="none"}if(hiden!=a){b.style.display="";if($("select"+a)!=null)selectHiden=$("select"+a).value;hiden=a}else{hiden=""}}function selectEvent(b){var a=b.split("-");if(a.constructor==window.Array){var c=a[0];var d=a[1];var e=$("showEvent"+b);var f=$("showEvent"+selectHiden);var g=$("productType"+c);var h=$("productName"+c);var i=$("productMarketPrice"+c);var j=$("productCocoPrice"+c);if(selectHiden!=""){f.setAttribute("class","shopCars_showEvent eventfalse");f.className="shopCars_showEvent eventfalse"}if(selectHiden!=b){if($("select"+c)!=null)$("select"+c).value=b;$("eventid"+c).value=$("eventid"+b).value;$("ruleid"+c).value=$("ruleid"+b).value;$("rulelist"+c).value=$("rulelist"+b).value;e.setAttribute("class","shopCars_showEvent eventtrue");e.className="shopCars_showEvent eventtrue";selectHiden=b;g.innerHTML=$("eventTag"+b).innerHTML;h.innerHTML=$("eventProductName"+b).innerHTML;j.innerHTML='￥'+$("eventCocoPrice"+b).innerHTML;i.innerHTML='￥'+$("eventMarketPrice"+b).innerHTML;shopCarChg(c)}else{if($("select"+c)!=null)$("select"+c).value="";selectHiden="";$("event"+b).checked=false;$("eventid"+c).value="0";$("ruleid"+c).value="";$("rulelist"+c).value="";g.innerHTML="<a href=\"javascript:;\" title=\"活动类型\" onfocus=\"this.blur()\" onclick=\"showEvent('"+c+"')\">活动</a>";h.innerHTML=$("productName1"+c).value;j.innerHTML='￥'+$("price"+c).value;i.innerHTML='￥'+$("marketPrice"+c).value;shopCarChg(c)}}else{account()}}function shopCarChg(a){var b=$("productid"+a).value;var c=$("eventid"+a).value;var d=$("ruleid"+a).value;var e=$("rulelist"+a).value;var f=$("productNum"+a).value;if(isNaN(f)||parseInt(f)<1)f=1;f=parseInt(f);$("productNum"+a).value=f;account();var g="/server/orderEdit.asp?id="+a+"&productID="+b+"&num="+f+"&eventID="+c+"&ruleList="+e+"&ruleID="+d+"&"+(new Date()).getTime();getBody(g,"get",null,"",0,true)}function orderDel(a){if(hiden==a){hiden="";selectHiden=""};$("shopCarsMain").removeChild($("shopCars_product_head"+a));if($("shopCarsMain").innerHTML==""){$("shopCarsMain").innerHTML="<div align='center'>您还未购买任何商品。</div>";$("allAccount").innerHTML="0";$("allCocoAccount").innerHTML="0";$("allLessAccount").innerHTML="0"}else{account()};getBody("/server/orderDel.asp?id="+a+"&"+(new Date()).getTime(),"get",null,"",0,true)}function clearCars(){$("shopCarsMain").innerHTML="<div align='center'>您还未购买任何商品。</div>";$("allAccount").innerHTML="0";$("allCocoAccount").innerHTML="0";$("allLessAccount").innerHTML="0";getBody("/server/orderDel.asp?"+(new Date()).getTime(),"get",null,"",0,true)}function toFav(a){var b=$("productid"+a).value;getBody("/server/productAddFav.asp?productID="+b+"&"+(new Date()).getTime(),"get",null,"parent.showMsg1(result,'shopCarMsg',5000);parent.orderDel("+a+");",0,true)}function addFav(a){var b="添加到收藏夹";showMsg("正在连接服务器……",0,b);getBody("/server/productAddFav.asp?productID="+a+"&"+(new Date()).getTime(),"get",null,"parent.showMsg(result,5000,'"+b+"')",0,true)}function showMsg1(a,b,c){$(b).style.display="";$(b).innerHTML=a;if(c>0)setTimeout("if($('"+b+"')!=null){$('"+b+"').innerHTML='';}//$('"+b+"').style.display='none'}",c)}
