function AuctionDetail(auction){this.loopTimer=null;this.limitWidth=50;this.mainStep=0;this.timerSpeed=1;this.scrollStep=2;this.showWidth=200;this.step=0;this.stepright=0;this.mainWidth=this.limitWidth*parseInt(auction.picnum);this.nextPrice=parseFloat(auction.nextPrice);this.maxPrice=parseFloat(auction.maxPrice);this.buycharge=parseFloat(auction.acBuycharge);this.userid=parseInt(auction.userId);this.isauction=parseInt(auction.isauction);this.acNewId=parseInt(auction.acNewId);this.auctionName=auction.auctionName;this.description=auction.description}AuctionDetail.prototype.getAddRange=function(num){var rangeNum=0;if(num>=0&&num<=50){rangNum=1}else{if(num>50&&num<=100){rangNum=2}else{if(num>100&&num<=500){rangNum=5}else{if(num>500&&num<=1000){rangNum=10}else{if(num>1000&&num<=2000){rangNum=20}else{if(num>2000&&num<=5000){rangNum=50}else{if(num>5000&&num<=10000){rangNum=100}else{if(num>10000&&num<=20000){rangNum=200}else{if(num>20000&&num<=50000){rangNum=500}else{if(num>50000&&num<=200000){rangNum=1000}else{if(num>200000){rangNum=2000}}}}}}}}}}}return rangNum};AuctionDetail.prototype.isBidRange=function(bidprice,addRange){if(bidprice%addRange==0){return true}else{return false}};AuctionDetail.prototype.bidresult=function(bidresult){if('0'==bidresult){alert(m_auction_detail_ask_givePrice_success);return}else if('1'==bidresult){alert(m_auction_detail_ask_user_notExist);return}else if('2'==bidresult){alert(m_auction_detail_ask_user_lock);return}else if('3'==bidresult){alert(m_auction_detail_ask_user_quotaNotEnough);return}else if('4'==bidresult){alert(m_auction_detail_ask_auction_end);return}else if('5'==bidresult){alert(m_auction_detail_ask_addPrice_error);return}else if('6'==bidresult){alert(m_auction_detail_ask_givePrice_had);return}else if('7'==bidresult){alert(m_auction_detail_ask_systemLock_error);return}else if('8'==bidresult){alert(m_auction_detail_ask_unknowError);return}};AuctionDetail.prototype.bidsubmit=function(){if(0==this.userid||""==this.userid){window.location="/customer/login.jsp?reurl="+location.href;return false}var authCode=document.getElementById("validateNumber").value;if(authCode.length!=1||!authCode.match(/\d{1}/)){alert(m_auction_detail_ask_validateNumber_error);document.getElementById("validateNumber").focus();return false}if(!this.checkUserBid()){return false}return true};AuctionDetail.prototype.checkUserBid=function(){var userbid=0.00;if(document.getElementById("bid")!=null){userbid=document.getElementById("bid").value;if(!userbid.match(/\d+(\.\d{2})?/)){document.getElementById("bid").focus();alert(m_auction_detail_ask_number_error);return false}if(userbid<=0||userbid<this.nextPrice){document.getElementById("bid").focus();alert(m_auction_detail_ask_addPrice_error);return false}}else if(document.getElementById("proxy")!=null){userbid=document.getElementById("proxy").value;if(!userbid.match(/\d+(\.\d{2})?/)){document.getElementById("proxy").focus();alert(m_auction_detail_ask_number_error);return false}if(userbid<=0){document.getElementById("proxy").focus();alert(m_auction_detail_ask_proxyPrice_error);return false}}return true};AuctionDetail.prototype.caculateBidCharge=function(){var userBid=0.0;var bidcharge=0.0;var bidprice=0.0;if(document.getElementById("bid")!=null){var tmp1=document.getElementById("bid").value;if(null==tmp1||tmp1==""){tmp1=0.00}userbid=parseFloat(tmp1);bidcharge=(this.buycharge/100*userbid).toFixed(2);bidprice=((1+this.buycharge/100)*userbid).toFixed(2);document.getElementById('p_bidcharge').innerHTML=bidcharge;document.getElementById('p_bidprice').innerHTML=bidprice}};AuctionDetail.prototype.sendAsk=function(){if(""==this.userid||0==this.userid){window.location="/customer/login.jsp?reurl="+location.href;return false}var asktype=document.getElementById("askType").value;var askContent=document.getElementById("askContent").value;if(askContent.match(/^\s*$/)){alert(m_auction_detail_ask_content_null);return}if(askContent.length>500||askContent.length<10){alert(m_auction_detail_ask_content_moreOrLess);document.getElementById("askContent").focus();return}if(document.getElementById("save1").checked==false){issave=0}if(document.getElementById("save1").checked==true){issave=1}var authCode=document.getElementById("authCode1").value;if(authCode.length!=4||!authCode.match(/\d{4}/)){alert(m_auction_detail_ask_validateNumber_error);return}document.getElementById("showajax1").innerHTML="<img src='/images/ajax-loader.gif' border='0'/>";AuctionHelper.sendAsk(this.acNewId,asktype,askContent,issave,authCode,this.sendAskCall)};AuctionDetail.prototype.sendAskCall=function(msg){document.getElementById("showajax1").innerHTML="";if("1"==msg){alert(m_auction_detail_ask_leaveMessage_success);document.getElementById("askContent").disabled=true;document.getElementById("SubmitAsk").disabled=true;document.getElementById("authCode1").disabled=true;return}else if("2"==msg){alert(m_auction_detail_ask_validateNumber_wrong)}else if("3"==msg){alert(m_auction_detail_ask_user_notLogin)}else{alert(m_auction_detail_ask_unknowError)}};AuctionDetail.prototype.sendRecommend=function(){var email1=document.getElementById("address").value;if(!email1.match(/\w+([-+._]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/)){alert(m_auction_detail_ask_email_error);return}var authCode=document.getElementById("authCode2").value;if(authCode.length!=4||!authCode.match(/\d{4}/)){alert(m_auction_detail_ask_validateNumber_error);return}if(""==this.userid){window.location="/customer/login.jsp?reurl="+location.href;return false}var message=document.getElementById("message").value;document.getElementById("showajax").innerHTML="<img src='/images/ajax-loader.gif' border='0'/>";AuctionHelper.sendRecommend(authCode,email1,message,this.acNewId,this.description,this.acNewId,this.reSendRecommend)};AuctionDetail.prototype.reSendRecommend=function(msg){document.getElementById("showajax").innerHTML="";if("1"==msg){alert(m_auction_detail_ask_commend_success);document.getElementById("Submit2").disabled="disabled";document.getElementById("authCode2").disabled=true;document.getElementById("address").disabled=true;document.getElementById("message").disabled=true;return}else if("2"==msg){alert(m_auction_detail_ask_validateNumber_error);return}else if("3"==msg){alert(m_auction_detail_ask_user_notLogin);return}else{alert(m_auction_detail_ask_unknowError);return}};AuctionDetail.prototype.startMove=function(dir){if(dir=="left"){this.mainStep=this.mainStep-1;this.stepright=this.stepright+this.scrollStep;if(this.mainStep>0){if((this.mainStep%this.limitWidth)==0){document.getElementById("imgshowDiv").style.left=this.stepright+"px";clearInterval(this.loopTimer)}else{document.getElementById("imgshowDiv").style.left=this.stepright+"px"}if(document.getElementById("btnRight").disabled){document.getElementById("btnRight").disabled=false;document.getElementById("btnRight").className="inputPronLeftAn2"}}else{this.step=0;clearInterval(this.loopTimer);document.getElementById("btnLeft").disabled=true;document.getElementById("btnLeft").className="inputPronLeftAn1_1";document.getElementById("imgshowDiv").style.pixelLeft=0}}if(dir=="right"){this.mainStep=this.mainStep+1;this.step=this.step+this.scrollStep;if(this.mainStep<((this.mainWidth-this.showWidth)/this.scrollStep)){if((this.mainStep%this.limitWidth)==0){document.getElementById("imgshowDiv").style.left=-this.step+"px";this.stepright=this.stepright-this.scrollStep;clearInterval(this.loopTimer)}else{document.getElementById("imgshowDiv").style.left=-this.step+"px";this.stepright=this.stepright-this.scrollStep}if(document.getElementById("btnLeft").disabled){document.getElementById("btnLeft").disabled=false;document.getElementById("btnLeft").className="inputPronLeftAn1"}}else{this.step=0;clearInterval(this.loopTimer);document.getElementById("btnLeft").disabled=false;document.getElementById("btnLeft").className="inputPronLeftAn1";document.getElementById("btnRight").disabled=true;document.getElementById("btnRight").className="inputPronLeftAn2_1";document.getElementById("imgshowDiv").style.pixelLeft=0-(this.mainStep*this.scrollStep);this.stepright=this.stepright-this.scrollStep}}};AuctionDetail.prototype.initpic=function(sDir,instance){clearInterval(this.loopTimer);this.loopTimer=setInterval(instance+".startMove('"+sDir+"')",this.timerSpeed)};AuctionDetail.prototype.newValidateNumber=function(digits){var validatePIC=document.getElementById("validatePIC");if(!digits)validatePIC.src="/validatecode.jpg?n="+Math.random();else validatePIC.src="/validatecode.jpg?digits="+digits+"&n="+Math.random()};var AuctionPrice={};updateAuctionPrices=function(auctionId,page,userId){AuctionPrice.auctionId=auctionId;AuctionPrice.userId=userId;$("ajaxLoader").style.display="block";AuctionHelper.getAuctionPrices(auctionId,page,fillTable)};fillTable=function(pageList){dwr.util.removeAllRows("priceBody",{filter:function(tr){return(tr.id!="pattern")}});var highLightColor="#fbfed1";for(var i=0;i<pageList.list.length;i++){price=pageList.list[i];dwr.util.cloneNode("pattern",{idSuffix:""+i});if(price.isMax==1){state='<span class="org">'+m_auction_price_win+'</span>';if(price.isProxy==1)state+=m_auction_price_proxy}else state=m_auction_price_fail;dwr.util.setValue("priceBodyUserId"+i,price.userId);dwr.util.setValue("priceBodyPrice"+i,price.bid.toFixed(2));dwr.util.setValue("priceBodyDate"+i,formateDate(price.createdAt,"YYYY-MM-DD HH:MI:SS"));dwr.util.setValue("priceBodyState"+i,state,{escapeHtml:false});dwr.util.setValue("priceBodyAddress"+i,price.country+"|"+price.province+"|"+price.city);dwr.util.setValue("priceBodyIp"+i,price.ip.replace(/\d+\s*$/,"*"));if(window.navigator.appName.toLowerCase()=="netscape")document.getElementById("pattern"+i).style.display="table-row";else document.getElementById("pattern"+i).style.display="inline";if(AuctionPrice.userId==price.userId){cells=$("pattern"+i).cells;for(var j=0;j<cells.length;j++)cells[j].style.backgroundColor=highLightColor}}AuctionPrice.pageList=pageList;$('pricePageList').innerHTML=AuctionPrice.constructPageList();$('pageNum').value=pageList.currentPage;$("ajaxLoader").style.display="none"};AuctionPrice.getURL=function(text,currentPage,className){query="<a href=javascript:updateAuctionPrices('"+AuctionPrice.auctionId+"',"+"'<0>'"+",'"+AuctionPrice.userId+"')><1></a>";var str="";if(query!=null){str=query.replace("<0>",currentPage+"");str=str.replace("<1>",text);if(this.pageList.currentPage==currentPage){str=str.replace("<a ","<span class=\"ahov\" ");str=str.replace("</a>","</span>")}else if(className){str=str.replace("<a ","<a class=\""+className+"\" ")}}return str};AuctionPrice.constructPageList=function(){pageList=this.pageList;var privousImg=this.getPriviousImage("/images/leftindeximg-05_2.gif");var nextImg=this.getNextImage("/images/leftindeximg-05_1.gif");bfHref="";if(pageList!=null){if(pageList.up){bfHref+=(this.getURL(privousImg+m_auction_price_previous_page,pageList.currentPage-1,"text"))}if(pageList.down){bfHref+=(this.getURL(m_auction_price_next_page+nextImg,pageList.currentPage+1,"text"))}if(pageList.totalPage>0){bfHref+=(this.getURL("1",1));bfHref+=("&nbsp;")}if(pageList.totalPage>1){bfHref+=(this.getURL("2",2));bfHref+=("&nbsp;")}if(pageList.currentPage>1&&pageList.currentPage<pageList.totalPage){if(pageList.currentPage>4){bfHref+=("....");bfHref+=("&nbsp;")}if(pageList.currentPage>3){bfHref+=(this.getURL(pageList.currentPage-1,pageList.currentPage-1));bfHref+=("&nbsp;")}if(pageList.currentPage>2&&pageList.currentPage<pageList.totalPage-1){bfHref+=(this.getURL(pageList.currentPage,pageList.currentPage));bfHref+=("&nbsp;")}if(pageList.currentPage<pageList.totalPage-2){bfHref+=(this.getURL(pageList.currentPage+1,pageList.currentPage+1));bfHref+=("&nbsp;")}if(pageList.currentPage<pageList.totalPage-3){bfHref+=("....");bfHref+=("&nbsp;")}}else if(pageList.totalPage>5){bfHref+=("....");bfHref+=("&nbsp;")}if(pageList.totalPage>3){bfHref+=(this.getURL(pageList.totalPage-1,pageList.totalPage-1));bfHref+=("&nbsp;")}if(pageList.totalPage>2){bfHref+=(this.getURL(pageList.totalPage,pageList.totalPage));bfHref+=("&nbsp;")}}return bfHref};AuctionPrice.getPriviousImage=function(path){return"<img src=\""+path+"\"  style=\"border:none;padding:0 4px 2px 0;\">"};AuctionPrice.getNextImage=function(path){return"<img src=\""+path+"\"  style=\"border:none;padding:0 0 2px 3px;\">"};function RecentView(auctionId,auctionName,auctionImage){try{var size=5;var allcookies=document.cookie;var pos=allcookies.indexOf("recentView=");var start=pos+11;var end=allcookies.indexOf(";",start);if(end==-1)end=allcookies.length;var value=allcookies.substring(start,end);value=unescape(value);var auctionIds=[];var auctionNames=[];var auctionImages=[];if(value){var auctions=value.split(/`/);for(var i=0;i<auctions.length;i++){auction=auctions[i].split(/~/);if(auction.length==3&&auction[0]!=auctionId&&auctionIds.length<size){auctionIds.push(auction[0]);auctionNames.push(auction[1]);auctionImages.push(auction[2]);}}}var html='<div style="width: 830px; line-height:25px;">${tables}</div>';var tables='';for(var i=0;i<auctionIds.length;i++){tables=tables+'<table cellpadding="0" cellspacing="0" align="left" style="widht:165px;">'+'<tr>'+'<td style="widht:165px; text-align:left;">'+'<table style="width:165px" cellpadding="0" cellspacing="0" align="left">'+'<tr>'+'<td style="text-align:center;">'+'<table cellpadding="0" cellspacing="0" style="height: 90px; border:1px solid #E4D8CD;background-color:#FFFFFF;padding:3px; width:82px;" align="center">'+'<tr>'+'<td><a href="/detail/auction-'+auctionIds[i]+'-detail.shtml" target="_blank"><img src="'+auctionImages[i]+'" alt="" style="border:none;" /></a></td>'+'</tr>'+'</table>'+'</td>'+'</tr>'+'<tr>'+'<td style="text-align:center;"><a href="/detail/auction-'+auctionIds[i]+'-detail.shtml " target="_blank" title="'+auctionNames[i]+'">'+this.shortName(auctionNames[i],12)+'</a></td>'+'</tr>'+'</table>'+'</td>'+'</tr>'+'</table>'}html=html.replace('${tables}',tables);document.write(html);if(auctionId&&auctionName&&auctionImage){auctionIds.unshift(auctionId);auctionNames.unshift(auctionName);auctionImages.unshift(auctionImage)}value="";for(var i=0;i<size+1&&i<auctionIds.length;i++)value=value+auctionIds[i]+"~"+auctionNames[i]+"~"+auctionImages[i]+"`";var expires=new Date(new Date().getTime()+3600*24*7*1000);document.cookie="recentView="+escape(value)+";expires="+expires.toUTCString()+";path=/"}catch(e){}};RecentView.prototype.shortName=function(s,l){if(s.length>l){return s.substr(0,l-1)+'...'}else{return s}};