function batchAddToCart(){var F=document.forms["theForm"];var C=F.elements["goodslist[]"];var E=[];for(var B=0;B<C.length;B++){if(C[B].checked==true){E.push(C[B].value)}}var A=new Object();var G=new Array();var D=new Array();A.spec=G;A.goods_ids=E;A.number=1;A.parent=0;Ajax.call("flow.php?step=addto_cart_batch","goods="+A.toJSONString(),batchAddToCartResponse,"POST","JSON")}function addToCart(F,B){var E=new Object();var G=new Array();var C=new Array();var D=1;var A=document.forms["ECS_FORMBUY"];if(A){G=getSelectedAttributes(A);if(A.elements["number"]){D=A.elements["number"].value}}E.spec=G;E.goods_id=F;E.number=D;E.parent=(typeof(B)=="undefined")?0:parseInt(B);Ajax.call("flow.php?step=add_to_cart","goods="+E.toJSONString(),addToCartResponse,"POST","JSON")}function getSelectedAttributes(B){var D=new Array();var C=0;for(i=0;i<B.elements.length;i++){var A=B.elements[i].name.substr(0,5);if(A=="spec_"&&(((B.elements[i].type=="radio"||B.elements[i].type=="checkbox")&&B.elements[i].checked)||B.elements[i].tagName=="SELECT")){D[C]=B.elements[i].value;C++}}return D}function batchAddToCartResponse(A){if(A.error>0){if(A.error==2){if(confirm(A.message)){location.href="flow.php?act=cart"}}else{if(A.error==6){if(confirm(A.message)){location.href="goods.php?id="+A.goods_id}}else{alert(A.message)}}}else{var C=document.getElementById("ECS_CARTINFO");var B="flow.php?step=cart";if(C){C.innerHTML=A.content}if(A.one_step_buy=="1"){location.href=B}else{switch(A.confirm_type){case"1":if(confirm(A.message)){location.href=B}break;case"2":if(!confirm(A.message)){location.href=B}break;case"3":location.href=B;break;default:break}}}}function addToCartResponse(A){if(A.error>0){if(A.error==2){if(confirm(A.message)){location.href="user.php?act=add_booking&id="+A.goods_id}}else{if(A.error==6){if(confirm(A.message)){location.href="goods.php?id="+A.goods_id}}else{alert(A.message)}}}else{var C=document.getElementById("ECS_CARTINFO");var B="flow.php?step=cart";if(C){C.innerHTML=A.content}var E=document.getElementById("cart_goods");if(E){E.innerHTML=A.goods_count}if(A.one_step_buy=="1"){location.href=B}else{var D=document.getElementById("position-box");if(D){D.style.display="block"}else{switch(A.confirm_type){case"1":if(confirm(A.message)){location.href=B}break;case"2":if(!confirm(A.message)){location.href=B}break;case"3":location.href=B;break;default:break}}}}}function collect(C,B){if(!B){var A="id="+C}else{if(B=="cache"){B=2}var A="id="+C+"&type="+B}Ajax.call("user.php?act=collect",A,collectResponse,"GET","JSON")}function collectResponse(A){alert(A.message)}function signInResponse(B){toggleLoader(false);var A=B.substr(0,1);var C=B.substr(2);if(A==1){document.getElementById("member-zone").innerHTML=C}else{alert(C)}}function gotoPage(A,C,B){Ajax.call("comment.php?act=gotopage","page="+A+"&id="+C+"&type="+B,gotoPageResponse,"GET","JSON")}function gotoPageResponse(A){document.getElementById("ECS_COMMENT").innerHTML=A.content}function getFormatedPrice(A){if(currencyFormat.indexOf("%s")>-1){return currencyFormat.replace("%s",advFormatNumber(A,2))}else{if(currencyFormat.indexOf("%d")>-1){return currencyFormat.replace("%d",advFormatNumber(A,0))}else{return A}}}function bid(B){var D="";var E="";if(B!=-1){var A=document.forms["formBid"];D=A.elements["price"].value;id=A.elements["snatch_id"].value;if(D.length==0){E+=price_not_null+"\n"}else{var C=/^[\.0-9]+/;if(!C.test(D)){E+=price_not_number+"\n"}}}else{D=B}if(E.length>0){alert(E);return}Ajax.call("snatch.php?act=bid&id="+id,"price="+D,bidResponse,"POST","JSON")}function bidResponse(A){if(A.error==0){document.getElementById("ECS_SNATCH").innerHTML=A.content;if(document.forms["formBid"]){document.forms["formBid"].elements["price"].focus()}newPrice()}else{alert(A.content)}}function newPrice(A){Ajax.call("snatch.php?act=new_price_list&id="+A,"",newPriceResponse,"GET","TEXT")}function newPriceResponse(A){document.getElementById("ECS_PRICE_LIST").innerHTML=A}function getAttr(D){var A=document.getElementsByTagName("tbody");for(i=0;i<A.length;i++){if(A[i].id.substr(0,10)=="goods_type"){A[i].style.display="none"}}var B="goods_type_"+D;try{document.getElementById(B).style.display=""}catch(C){}}function advFormatNumber(C,F){var A=formatNumber(C,F);var B=parseFloat(A);if(C.toString().length>A.length){var H=C.toString().substring(A.length,A.length+1);var D=parseFloat(H);if(D<5){return A}else{var G,I;if(F==0){I=1}else{G="0.";for(var E=1;E<F;E++){G+="0"}G+="1";I=parseFloat(G)}A=formatNumber(B+I,F)}}return A}function formatNumber(A,F){var B,C,D,E;B=A.toString();C=B.indexOf(".");D=B.length;if(F==0){if(C!=-1){B=B.substring(0,C)}}else{if(C==-1){B=B+".";for(E=1;E<=F;E++){B=B+"0"}}else{B=B.substring(0,C+F+1);for(E=D;E<=C+F;E++){B=B+"0"}}}return B}function set_insure_status(){var A=getRadioValue("shipping");var B=0;if(A>0){if(document.forms["theForm"].elements["insure_"+A]){B=document.forms["theForm"].elements["insure_"+A].value}if(document.forms["theForm"].elements["need_insure"]){document.forms["theForm"].elements["need_insure"].checked=false}if(document.getElementById("ecs_insure_cell")){if(B>0){document.getElementById("ecs_insure_cell").style.display="";setValue(document.getElementById("ecs_insure_fee_cell"),getFormatedPrice(B))}else{document.getElementById("ecs_insure_cell").style.display="none";setValue(document.getElementById("ecs_insure_fee_cell"),"")}}}}function changePayment(A){calculateOrderFee()}function getCoordinate(B){var A={"x":0,"y":0};A.x=document.body.offsetLeft;A.y=document.body.offsetTop;do{A.x+=B.offsetLeft;A.y+=B.offsetTop;B=B.offsetParent}while(B.tagName.toUpperCase()!="BODY");return A}function showCatalog(C){var B=getCoordinate(C);var A=document.getElementById("ECS_CATALOG");if(A&&A.style.display!="block"){A.style.display="block";A.style.left=B.x+"px";A.style.top=(B.y+C.offsetHeight-1)+"px"}}function hideCatalog(B){var A=document.getElementById("ECS_CATALOG");if(A&&A.style.display!="none"){A.style.display="none"}}function sendHashMail(){Ajax.call("user.php?act=send_hash_mail","",sendHashMailResponse,"GET","JSON")}function sendHashMailResponse(A){alert(A.message)}function orderQuery(){var A=document.forms["ecsOrderQuery"]["order_sn"].value;var B=/^[\.0-9]+/;if(A.length<10||!B.test(A)){alert(invalid_order_sn);return}Ajax.call("user.php?act=order_query&order_sn=s"+A,"",orderQueryResponse,"GET","JSON")}function orderQueryResponse(B){if(B.message.length>0){alert(B.message)}if(B.error==0){var A=document.getElementById("ECS_ORDER_QUERY");A.innerHTML=B.content}}function display_mode(A){document.getElementById("display").value=A;setTimeout(B,0);function B(){document.forms["listform"].submit()}}function fixpng(){var I=navigator.appVersion.split("MSIE");var G=parseFloat(I[1]);if((G>=5.5)&&(document.body.filters)){for(var A=0;A<document.images.length;A++){var B=document.images[A];var E=B.src.toUpperCase();if(E.substring(E.length-3,E.length)=="PNG"){var J=(B.id)?"id='"+B.id+"' ":"";var H=(B.className)?"class='"+B.className+"' ":"";var C=(B.title)?"title='"+B.title+"' ":"title='"+B.alt+"' ";var F="display:inline-block;"+B.style.cssText;if(B.align=="left"){F="float:left;"+F}if(B.align=="right"){F="float:right;"+F}if(B.parentElement.href){F="cursor:hand;"+F}var D="<span "+J+H+C+' style="width:'+B.width+"px; height:"+B.height+"px;"+F+";filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+B.src+"', sizingMethod='scale');\"></span>";B.outerHTML=D;A=A-1}}}}function hash(B,E){var E=E?E:32;var C=0;var D=0;var A="";filllen=E-B.length%E;for(D=0;D<filllen;D++){B+="0"}while(C<B.length){A=stringxor(A,B.substr(C,E));C+=E}return A}function stringxor(A,G){var B="";var D="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";var F=Math.max(A.length,G.length);for(var E=0;E<F;E++){var C=A.charCodeAt(E)^G.charCodeAt(E);B+=D.charAt(C%52)}return B}var evalscripts=new Array();function evalscript(A){if(A.indexOf("<script")==-1){return A}var C=/<script[^\>]*?src=\"([^\>]*?)\"[^\>]*?(reload=\"1\")?(?:charset=\"([\w\-]+?)\")?><\/script>/ig;var B=new Array();while(B=C.exec(A)){appendscript(B[1],"",B[2],B[3])}return A}function $$(A){return document.getElementById(A)}function appendscript(G,B,A,D){var F=hash(G+B);if(!A&&in_array(F,evalscripts)){return}if(A&&$$(F)){$$(F).parentNode.removeChild($$(F))}evalscripts.push(F);var E=document.createElement("script");E.type="text/javascript";E.id=F;try{if(G){E.src=G}else{if(B){E.text=B}}$$("append_parent").appendChild(E)}catch(C){}}function in_array(B,A){if(typeof B=="string"||typeof B=="number"){for(var C in A){if(A[C]==B){return true}}}return false}var pmwinposition=new Array();var userAgent=navigator.userAgent.toLowerCase();var is_opera=userAgent.indexOf("opera")!=-1&&opera.version();var is_moz=(navigator.product=="Gecko")&&userAgent.substr(userAgent.indexOf("firefox")+8,3);var is_ie=(userAgent.indexOf("msie")!=-1&&!is_opera)&&userAgent.substr(userAgent.indexOf("msie")+5,3);function pmwin(G,H){var D=document.getElementsByTagName("OBJECT");if(G=="open"){for(i=0;i<D.length;i++){if(D[i].style.visibility!="hidden"){D[i].setAttribute("oldvisibility",D[i].style.visibility);D[i].style.visibility="hidden"}}var A=document.body.clientWidth;var F=document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight;var B=document.body.scrollTop?document.body.scrollTop:document.documentElement.scrollTop;var C=800;var E=F*0.9;if(!$$("pmlayer")){div=document.createElement("div");div.id="pmlayer";div.style.width=C+"px";div.style.height=E+"px";div.style.left=((A-C)/2)+"px";div.style.position="absolute";div.style.zIndex="999";$$("append_parent").appendChild(div);$$("pmlayer").innerHTML='<div style="width: 800px; background: #666666; margin: 5px auto; text-align: left"><div style="width: 800px; height: '+E+'px; padding: 1px; background: #FFFFFF; border: 1px solid #7597B8; position: relative; left: -6px; top: -3px"><div onmousedown="pmwindrag(event, 1)" onmousemove="pmwindrag(event, 2)" onmouseup="pmwindrag(event, 3)" style="cursor: move; position: relative; left: 0px; top: 0px; width: 800px; height: 30px; margin-bottom: -30px;"></div><a href="###" onclick="pmwin(\'close\')"><img style="position: absolute; right: 20px; top: 15px" src="images/close.gif" title="关闭" /></a><iframe id="pmframe" name="pmframe" style="width:'+C+'px;height:100%" allowTransparency="true" frameborder="0"></iframe></div></div>'}$$("pmlayer").style.display="";$$("pmlayer").style.top=((F-E)/2+B)+"px";if(!H){pmframe.location="pm.php"}else{pmframe.location="pm.php?"+H}}else{if(G=="close"){for(i=0;i<D.length;i++){if(D[i].attributes["oldvisibility"]){D[i].style.visibility=D[i].attributes["oldvisibility"].nodeValue;D[i].removeAttribute("oldvisibility")}}hiddenobj=new Array();$$("pmlayer").style.display="none"}}}var pmwindragstart=new Array();function pmwindrag(B,C){if(C==1){pmwindragstart=is_ie?[event.clientX,event.clientY]:[B.clientX,B.clientY];pmwindragstart[2]=parseInt($$("pmlayer").style.left);pmwindragstart[3]=parseInt($$("pmlayer").style.top);doane(B)}else{if(C==2&&pmwindragstart[0]){var A=is_ie?[event.clientX,event.clientY]:[B.clientX,B.clientY];$$("pmlayer").style.left=(pmwindragstart[2]+A[0]-pmwindragstart[0])+"px";$$("pmlayer").style.top=(pmwindragstart[3]+A[1]-pmwindragstart[1])+"px";doane(B)}else{if(C==3){pmwindragstart=[];doane(B)}}}}function doane(A){e=A?A:window.event;if(is_ie){e.returnValue=false;e.cancelBubble=true}else{if(e){e.stopPropagation();e.preventDefault()}}}function linkToQQ(C){var A="http://sighttp.qq.com/wpa.js?rantime="+Math.random()+"&sigkey="+C;var D=document.getElementById("testJs");var B=document.createElement("script");B.setAttribute("type","text/javascript");B.setAttribute("id","testJs");B.setAttribute("src",A);if(D==null){document.body.appendChild(B)}else{D.parentNode.replaceChild(B,D)}return false}function checkSearchForm(){if(document.getElementById("keyword").value){return true}else{alert("请输入搜索关键词！");return false}}function showRemind(C,B){if(document.getElementById("remind")){var D=document.getElementById("remind");D.innerHTML=B;switch(C){case"success":var A="message_green";break;case"warn":var A="message_yellow";break;case"error":var A="message_red";break;default:break}D.className=A;D.style.display="block"}};
