function addToCart(C,G){var B=new Object();var A=new Array();var E=new Array();var D=1;var F=document.forms.ECS_FORMBUY;if(F){A=getSelectedAttributes(F);if(F.elements.number){D=F.elements.number.value}}B.spec=A;B.goods_id=C;B.number=D;B.parent=(typeof(G)=="undefined")?0:parseInt(G);Ajax.call("flow.php?step=add_to_cart","goods="+B.toJSONString(),addToCartResponse,"POST","JSON")}function getSelectedAttributes(D){var A=new Array();var B=0;for(i=0;i<D.elements.length;i++){var C=D.elements[i].name.substr(0,5);if(C=="spec_"&&((D.elements[i].type=="radio"&&D.elements[i].checked)||D.elements[i].tagName=="SELECT")){A[B]=D.elements[i].value;B++}}return A}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 B=document.getElementById("ECS_CARTINFO");if(B){B.innerHTML=A.content}if(A.one_step_buy=="1"){location.href="flow.php"}else{switch(A.confirm_type){case"1":if(confirm(A.message)){location.href="flow.php"}break;case 2:if(!confirm(A.message)){location.href="flow.php"}break;case"3":location.href="flow.php";break;default:break}}}}function collect(A){Ajax.call("user.php?act=collect","id="+A,collectResponse,"GET","JSON")}function collectResponse(A){alert(A.message)}function signInResponse(A){toggleLoader(false);var B=A.substr(0,1);var C=A.substr(2);if(B==1){document.getElementById("member-zone").innerHTML=C}else{alert(C)}}function gotoPage(B,C,A){Ajax.call("comment.php?act=gotopage","page="+B+"&id="+C+"&type="+A,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(C){var B="";var E="";if(C!=-1){var D=document.forms.formBid;B=D.elements.price.value;id=D.elements.snatch_id.value;if(B.length==0){E+=price_not_null+"\n"}else{var A=/^[\.0-9]+/;if(!A.test(B)){E+=price_not_number+"\n"}}}else{B=C}if(E.length>0){alert(E);return}Ajax.call("snatch.php?act=bid&id="+id,"price="+B,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(H,F){var E=formatNumber(H,F);var B=parseFloat(E);if(H.toString().length>E.length){var C=H.toString().substring(E.length,E.length+1);var A=parseFloat(C);if(A<5){return E}else{var I,G;if(F==0){G=1}else{I="0.";for(var D=1;D<F;D++){I+="0"}I+="1";G=parseFloat(I)}E=formatNumber(B+G,F)}}return E}function formatNumber(E,C){var B,A,F,D;B=E.toString();A=B.indexOf(".");F=B.length;if(C==0){if(A!=-1){B=B.substring(0,A)}}else{if(A==-1){B=B+".";for(D=1;D<=C;D++){B=B+"0"}}else{B=B.substring(0,A+C+1);for(D=F;D<=A+C;D++){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(A){var B={x:0,y:0};B.x=document.body.offsetLeft;B.y=document.body.offsetTop;do{B.x+=A.offsetLeft;B.y+=A.offsetTop;A=A.offsetParent}while(A.tagName.toUpperCase()!="BODY");return B}function showCatalog(A){var C=getCoordinate(A);var B=document.getElementById("ECS_CATALOG");if(B&&B.style.display!="block"){B.style.display="block";B.style.left=C.x+"px";B.style.top=(C.y+A.offsetHeight-1)+"px"}}function hideCatalog(A){var B=document.getElementById("ECS_CATALOG");if(B&&B.style.display!="none"){B.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 B=document.forms.ecsOrderQuery["order_sn"].value;var A=/^[\.0-9]+/;if(B.length<10||!A.test(B)){alert(invalid_order_sn);return}Ajax.call("user.php?act=order_query&order_sn=s"+B,"",orderQueryResponse,"GET","JSON")}function orderQueryResponse(A){if(A.message.length>0){alert(A.message)}if(A.error==0){var B=document.getElementById("ECS_ORDER_QUERY");B.innerHTML=A.content}}function display_mode(B){document.getElementById("display").value=B;setTimeout(A,0);function A(){document.forms.listform.submit()}}function fixpng(){var F=navigator.appVersion.split("MSIE");var G=parseFloat(F[1]);if((G>=5.5)&&(document.body.filters)){for(var C=0;C<document.images.length;C++){var D=document.images[C];var I=D.src.toUpperCase();if(I.substring(I.length-3,I.length)=="PNG"){var E=(D.id)?"id='"+D.id+"' ":"";var J=(D.className)?"class='"+D.className+"' ":"";var B=(D.title)?"title='"+D.title+"' ":"title='"+D.alt+"' ";var H="display:inline-block;"+D.style.cssText;if(D.align=="left"){H="float:left;"+H}if(D.align=="right"){H="float:right;"+H}if(D.parentElement.href){H="cursor:hand;"+H}var A="<span "+E+J+B+' style="width:'+D.width+"px; height:"+D.height+"px;"+H+";filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+D.src+"', sizingMethod='scale');\"></span>";D.outerHTML=A;C=C-1}}}}function hash(B,D){var D=D?D:32;var E=0;var C=0;var A="";filllen=D-B.length%D;for(C=0;C<filllen;C++){B+="0"}while(E<B.length){A=stringxor(A,B.substr(E,D));E+=D}return A}function stringxor(E,C){var F="";var G="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";var A=Math.max(E.length,C.length);for(var D=0;D<A;D++){var B=E.charCodeAt(D)^C.charCodeAt(D);F+=G.charAt(B%52)}return F}var evalscripts=new Array();function evalscript(B){if(B.indexOf("<script")==-1){return B}var C=/<script[^\>]*?src=\"([^\>]*?)\"[^\>]*?(reload=\"1\")?(?:charset=\"([\w\-]+?)\")?><\/script>/ig;var A=new Array();while(A=C.exec(B)){appendscript(A[1],"",A[2],A[3])}return B}function $$(A){return document.getElementById(A)}function appendscript(E,D,B,G){var F=hash(E+D);if(!B&&in_array(F,evalscripts)){return}if(B&&$$(F)){$$(F).parentNode.removeChild($$(F))}evalscripts.push(F);var A=document.createElement("script");A.type="text/javascript";A.id=F;try{if(E){A.src=E}else{if(D){A.text=D}}$$("append_parent").appendChild(A)}catch(C){}}function in_array(C,B){if(typeof C=="string"||typeof C=="number"){for(var A in B){if(B[A]==C){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(D,H){var G=document.getElementsByTagName("OBJECT");if(D=="open"){for(i=0;i<G.length;i++){if(G[i].style.visibility!="hidden"){G[i].setAttribute("oldvisibility",G[i].style.visibility);G[i].style.visibility="hidden"}}var F=document.body.clientWidth;var B=document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight;var E=document.body.scrollTop?document.body.scrollTop:document.documentElement.scrollTop;var C=800;var A=B*0.9;if(!$$("pmlayer")){div=document.createElement("div");div.id="pmlayer";div.style.width=C+"px";div.style.height=A+"px";div.style.left=((F-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: '+A+'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="\u934f\u62bd\u68f4" /></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=((B-A)/2+E)+"px";if(!H){pmframe.location="pm.php"}else{pmframe.location="pm.php?"+H}}else{if(D=="close"){for(i=0;i<G.length;i++){if(G[i].attributes.oldvisibility){G[i].style.visibility=G[i].attributes.oldvisibility.nodeValue;G[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()}}};
