function addToCart(c,h){var b=new Object();var a=new Array();var f=new Array();var d=1;var g=document.forms.ECS_FORMBUY;if(g){a=getSelectedAttributes(g);if(g.elements.number){d=g.elements.number.value}}b.spec=a;b.goods_id=c;b.number=d;b.parent=(typeof(h)=="undefined")?0:parseInt(h);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].type=="checkbox")&&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(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 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 f="";if(c!=-1){var d=document.forms.formBid;b=d.elements.price.value;id=d.elements.snatch_id.value;if(b.length==0){f+=price_not_null+"\n"}else{var a=/^[\.0-9]+/;if(!a.test(b)){f+=price_not_number+"\n"}}}else{b=c}if(f.length>0){alert(f);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(j,g){var f=formatNumber(j,g);var b=parseFloat(f);if(j.toString().length>f.length){var c=j.toString().substring(f.length,f.length+1);var a=parseFloat(c);if(a<5){return f}else{var k,h;if(g==0){h=1}else{k="0.";for(var d=1;d<g;d++){k+="0"}k+="1";h=parseFloat(k)}f=formatNumber(b+h,g)}}return f}function formatNumber(j,g){var f,d,k,h;f=j.toString();d=f.indexOf(".");k=f.length;if(g==0){if(d!=-1){f=f.substring(0,d)}}else{if(d==-1){f=f+".";for(h=1;h<=g;h++){f=f+"0"}}else{f=f.substring(0,d+g+1);for(h=k;h<=d+g;h++){f=f+"0"}}}return f}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 g=navigator.appVersion.split("MSIE");var h=parseFloat(g[1]);if((h>=5.5)&&(document.body.filters)){for(var c=0;c<document.images.length;c++){var d=document.images[c];var k=d.src.toUpperCase();if(k.substring(k.length-3,k.length)=="PNG"){var f=(d.id)?"id='"+d.id+"' ":"";var l=(d.className)?"class='"+d.className+"' ":"";var b=(d.title)?"title='"+d.title+"' ":"title='"+d.alt+"' ";var j="display:inline-block;"+d.style.cssText;if(d.align=="left"){j="float:left;"+j}if(d.align=="right"){j="float:right;"+j}if(d.parentElement.href){j="cursor:hand;"+j}var a="<span "+f+l+b+' style="width:'+d.width+"px; height:"+d.height+"px;"+j+";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 f=0;var c=0;var a="";filllen=d-b.length%d;for(c=0;c<filllen;c++){b+="0"}while(f<b.length){a=stringxor(a,b.substr(f,d));f+=d}return a}function stringxor(f,c){var g="";var h="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";var a=Math.max(f.length,c.length);for(var d=0;d<a;d++){var b=f.charCodeAt(d)^c.charCodeAt(d);g+=h.charAt(b%52)}return g}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(f,d,b,h){var g=hash(f+d);if(!b&&in_array(g,evalscripts)){return}if(b&&$$(g)){$$(g).parentNode.removeChild($$(g))}evalscripts.push(g);var a=document.createElement("script");a.type="text/javascript";a.id=g;try{if(f){a.src=f}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,j){var h=document.getElementsByTagName("OBJECT");if(d=="open"){for(i=0;i<h.length;i++){if(h[i].style.visibility!="hidden"){h[i].setAttribute("oldvisibility",h[i].style.visibility);h[i].style.visibility="hidden"}}var g=document.body.clientWidth;var b=document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight;var f=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=((g-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="关闭" /></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+f)+"px";if(!j){pmframe.location="pm.php"}else{pmframe.location="pm.php?"+j}}else{if(d=="close"){for(i=0;i<h.length;i++){if(h[i].attributes.oldvisibility){h[i].style.visibility=h[i].attributes.oldvisibility.nodeValue;h[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()}}};