﻿EWS.Order={};EWS.Order.layerIndex=100;EWS.Order.GetCatalogProductList=function(config){this.type='GetCatalogProductList';this.config=config;this.initLoad=true;var anchor=EWS.Anchor.get("Order_"+this.config.id);if(anchor!=null){this.config._catalogID=this.config.catalogID;this.config.catalogID=anchor.split(",")[0];};var parent=$("#"+this.config.id);parent.html('');this.config.styleId=this.config.styleId?this.config.styleId:(config.itemStyle==1?1:(config.itemStyle==2?5:6));var lang=EWS.Language['E01003'];var eshop_category=lang['E010034'];var eshop_product=lang['E010035'];if(this.config.styleId==1||this.config.styleId==2||this.config.styleId==5||this.config.styleId==6){var page=this.config.styleId==2?'ord_mop_page':'ord_page';$('<h3 id="'+this.config.id+'_CatalogTitle"></h3>').html(eshop_category+'：').addClass("ord_title").appendTo(parent);$('<ul id="'+this.config.id+'_Catalog" class="ord_sort">'+lang['E0100312']+'</ul>').appendTo(parent);$('<h3 id="'+this.config.id+'_ProductTitle" class="ord_title"></h3>').html(eshop_product+'：').addClass("ord_title").appendTo(parent);$("<div id='"+this.config.id+"_Product'>"+lang['E0100312']+"</div>").appendTo(parent);$("<div class='"+page+"'></div>").appendTo(parent);}else{if(this.config.styleId==3){var html='<div class="waresort_left" ><div class="waresort_top"><span>'+eshop_category+'</span></div><ul class="waresort_first" id="'+this.config.id+'_Catalog"></ul></div>'+'<div class="waresort_right"><div class="waresort_title" ><span>'+eshop_product+'</span></div><div id="'+this.config.id+'_Product">'+lang['E0100312']+'</div><div class="ord_mop_page"></div></div>';}else{var html='<div class="waresort_left" ><h3>'+eshop_category+'</h3><ul class="waresort_first" id="'+this.config.id+'_Catalog"></ul></div>'+'<div class="waresort_right"><h3>'+eshop_product+'</h3><div id="'+this.config.id+'_Product">'+lang['E0100312']+'</div><div class="ord_mop_page"></div></div>';}parent.append(html);}if(config.picSize&&(config.picSize==2||config.picSize=='2')){var size=[Number(config.picsizeW),Number(config.picsizeH)];}else{var size=this.returnWidthHeight(config.styleId);}this.config.size=size;};EWS.Order.GetCatalogProductList.prototype.getCatalog=function(parentID){var eshop_category=EWS.Language['E01003']['E010034'];if(parentID==undefined){parentID=this.config.catalogID;}else{this.config.catalogID=parentID;};if(this.config.styleId==1||this.config.styleId==2||this.config.styleId==5||this.config.styleId==6){this.getCatalogByA(parentID,eshop_category);}else{this.getCatalogByB(parentID,eshop_category);}};EWS.Order.GetCatalogProductList.prototype.getCatalogByA=function(parentID,tName){var lang=EWS.Language['E01003'];var _this=this;var _get_success=function(result){var title=$("#"+this.config.id+'_CatalogTitle');var ul=$('#'+this.config.id+'_Catalog');var TopCatalog=lang['E010031'];if(result.Path.length==0){title.html(tName+'：<a href="javascript:Order_'+_this.config.id+'.setCatalog(\'0\',"1");">'+TopCatalog+'</a>');ul.html(lang['E010036']);var product=$('#'+this.config.id+'_Product');product.html(lang['E010036']);return;};var titlePath=[];$.each(result.Path,function(i,v){if(v.ID!=0){var name=v.Name;}else{var name=lang['E010031'];};titlePath.push("<a hidefocus='true' href='javascript:Order_"+_this.config.id+".setCatalog(\""+v.ID+"\",1);'>"+name+"</a>");});title.html(tName+'：'+titlePath.join("&nbsp;&nbsp;>&nbsp;&nbsp;"));ul.html("");$.each(result.Catalog,function(i,v){ul.append("<li><a hidefocus='true' key='"+v.ID+"'  href='javascript:Order_"+_this.config.id+".setCatalog(\""+v.ID+"\",\""+v.CategoryCount+"\");'>"+v.Name+"</a></li>");});if(result.Catalog.length==0){ul.html(lang['E010036']);}var anchor=EWS.Anchor.get("Order_"+this.config.id);if(anchor==null){var pageNum=1;}else{var pageNum=parseInt(anchor.split(",")[1]);};this.getProduct(pageNum);};$.ajax({url:"/EWS_Interface/Order_ListCatalog.aspx",type:'get',data:{CID:this.config.cid,ParentID:parentID},cache:false,dataType:'json',success:function(result){_get_success.call(_this,result);}});};EWS.Order.GetCatalogProductList.prototype.getCatalogByB=function(parentID,tName){var _this=this;var _get_success=function(result){var ul=$('#'+this.config.id+'_Catalog');var len=result.length;if(len==0){ul.html(EWS.Language['E01003']['E010031']);return;};$.each(result,function(i,v){if(v.ID!=0){var name=v.Name;}else{var name=EWS.Language['E01003']['E010036'];};if(_this.config.styleId==3){if((i+1)==len){ul.append('<li class="waresort_last2" key="waresort_last2" id="c_'+v.id+'"><a hidefocus="true" href="javascript:Order_'+_this.config.id+'.setCatalogB(\''+v.id+'\');" title="'+v.name+'">'+v.name+'</a></li>');}else{ul.append('<li id="c_'+v.id+'"><a hidefocus="true" href="javascript:Order_'+_this.config.id+'.setCatalogB(\''+v.id+'\');" title="'+v.name+'">'+v.name+'</a></li>');}}else{ul.append('<li id="c_'+v.id+'"><a hidefocus="true" href="javascript:Order_'+_this.config.id+'.setCatalogB(\''+v.id+'\');" title="'+v.name+'">'+v.name+'</a></li>');};if(v.children.length){createTreeCell(v.id,v.children,((i+1)==len));}});var anchor=EWS.Anchor.get("Order_"+this.config.id);if(anchor==null){var pageNum=1;}else{var pageNum=parseInt(anchor.split(",")[1]);if((this.config.styleId==4||this.config.styleId==3)&&this.config.catalogID!='0'){$('#c_'+this.config.catalogID).find('a')[0].className='active';var obj=$('#c_'+this.config.catalogID).parent();obj.css('display','block');var pr=obj.parent().parent();if(pr[0].tagName=='UL'&&pr[0].className!='waresort_first'){pr.css('display','block');}}};this.getProduct(pageNum);};var createTreeCell=function(pId,data,flag){var len=data.length;var obj=$('#'+_this.config.id+'_Catalog').find('#c_'+pId);var ul=obj.find('ul');if(ul.length==0){ul=$('<ul style="display:none"></ul>');obj.append(ul);}for(var i=0;i<len;i++){var v=data[i];var li='';if(_this.config.styleId==3){if((i+1)==len){var cls=flag?'class="dashed4"':'';li='<li id="c_'+v.id+'" '+cls+'><a hidefocus="true" href="javascript:Order_'+_this.config.id+'.setCatalogB(\''+v.id+'\');" title="'+v.name+'">'+v.name+'</a></li>';}else{li='<li id="c_'+v.id+'"><a hidefocus="true" href="javascript:Order_'+_this.config.id+'.setCatalogB(\''+v.id+'\');" title="'+v.name+'">'+v.name+'</a></li>';}}else{li='<li id="c_'+v.id+'"><a hidefocus="true" href="javascript:Order_'+_this.config.id+'.setCatalogB(\''+v.id+'\');" title="'+v.name+'">'+v.name+'</a></li>';};ul.append(li);if(v.children.length){createTreeCell(v.id,v.children);}};};$.ajax({url:"/EWS_Interface/Order_ListAllCatalog.aspx",type:'get',data:{CID:this.config.cid,ParentID:this.config._catalogID},cache:false,dataType:'json',success:function(result){_get_success.call(_this,result.tree);}});};EWS.Order.GetCatalogProductList.prototype.setCatalog=function(parentID,number){if(number!='0'||number!=0){$('#'+this.config.id+'_Catalog').html(EWS.Language['E01003']['E0100312']);EWS.Anchor.set("Order_"+this.config.id,parentID+",1");this.getCatalog(parentID);}else{var obj=$('#'+this.config.id+'_Catalog');obj.find('.active').removeClass('active');$('#'+this.config.id+'_Catalog').find('a[key = '+parentID+']').addClass('active');this.config.catalogID=parentID;this.getProduct(1);}};EWS.Order.GetCatalogProductList.prototype.setCatalogB=function(parentID){var obj=$('#'+this.config.id+'_Catalog');obj.find('.active').removeClass();obj.find('#c_'+parentID+'>a').addClass('active');var ul=obj.find('#c_'+parentID+'>ul');EWS.Anchor.set("Order_"+this.config.id,parentID+",1");if(ul.length){if(this.config.styleId==3){var parent=$('#c_'+parentID);if(ul[0].style.display=='none'){var flag=(parent.attr('key')=='waresort_last2');if(flag){parent.removeClass();}ul.css('display','block');}else{var flag=(parent.attr('key')=='waresort_last2');if(flag){parent.addClass('waresort_last2');}ul.css('display','none');}}else{if(ul[0].style.display=='none'){ul.css('display','block');}else{ul.css('display','none');}}}this.config.catalogID=parentID;this.getProduct(1);};EWS.Order.GetCatalogProductList.prototype.getProduct=function(pageNum){var _get_success=function(result){var lang=EWS.Language['E01003'];var parent=$('#'+this.config.id+'_Product');if(parseInt(result.pageTotal)==0){parent.html(lang['E010038']);return;};var pageTotal=Math.ceil(parseInt(result.totalCount)/this.config.pageItem)||0;if(parseInt(pageTotal)<pageNum){this.jumpPage(pageTotal,pageNum,pageTotal);return;};var imgList=[];var _this=this;var appId='Order_'+_this.config.id;parent.html("");var ul=[];var pLen=result.Product.length;var p=result.MoneyType;p=p=='0'?'￥':(p=='1'?'＄':(p=='2'?'￡':'€'));var setImg='javascript:'+appId+'.imgLoadComplete(this)';$.each(result.Product,function(i,v){var newId=_this.config.id+"_"+i;var imgUrl='http://'+_this.config.htmlUrl+'/theme/order/img/noImg.png';if(v.Img){imgUrl=_this.getSmallPicPath(v.Img);}imgList.push({src:imgUrl,id:newId});if(_this.config.rowItem==1){ul=[];}else{if((i+1)%_this.config.rowItem==1){ul=[];};};var action='javascript:'+appId+'.showDetial(\''+v.ID+'\',\''+v.Name+'\');';var style="margin-right:"+_this.config.sBetween+"px";if((i+1)%_this.config.rowItem==0||(i+1)==pLen){style='';};var ulCls='';switch(_this.config.styleId){case 5:case 6:case 1:var li='<li class="ord_part'+_this.config.styleId+'" style='+style+'>'+'<ul>'+'<li>'+'<a class="size" href="'+action+'">'+'<img onload="'+setImg+'" title="'+v.Name+'" src="'+imgUrl+'" id="'+newId+'"/>'+'</a>'+'</li>'+'<li>'+'<span>'+p+'&nbsp;'+v.UnitPrice+'</span>'+'<button class="buy" title="'+lang['E0100310']+'" onclick="'+appId+'.setShoppingCar(\''+v.ID+'\');'+appId+'.showShoppingCar();">'+lang['E0100310']+'</button>'+'<a href="'+action+'" class="detail" title="'+lang['E0100311']+'">'+lang['E0100311']+'</a>'+'</li>'+'<li>'+'<strong><a hidefocus="true" href="'+action+'" title='+v.Name+'>'+v.Name+'</a></strong>'+'</li>'+'</ul>'+'</li>';break;case 2:var li='<li style='+style+'><a class="size" href="'+action+'"><img onload="'+setImg+'" id="'+newId+'" title="'+v.Name+'" src="'+imgUrl+'" /></a></li>';ulCls='ord_show2';break;case 3:var li='<li style='+style+'>'+'<div class="waresort_content"><a href="'+action+'"><img onload="'+setImg+'" id="'+newId+'" title="'+v.Name+'" src="'+imgUrl+'" /></a></div>'+'<div class="waresort_content2"><a hidefocus="true" href="'+action+'" title='+v.Name+'>'+v.Name+'</a><p>'+p+'&nbsp;'+v.UnitPrice+'</p></div>'+'</li>';break;case 4:var li='<li class="waresort_r_bg" style='+style+'>'+'<ul>'+'<li class="waresort_r_a"><a href="'+action+'"><img onload="'+setImg+'" title="'+v.Name+'"  id="'+newId+'"  src="'+imgUrl+'" /></a></li>'+'<li><a hidefocus="true" href="'+action+'">'+v.Name+'</a></li>'+'<li class="waresort_r_num"><span>'+lang['E0100314']+'：'+v.Sn+'</span><a title="'+lang['E0100311']+'"  href="'+action+'">'+lang['E0100311']+'</a></li>'+'<li class="waresort_r_pre" id="ext-gen681"><span>'+lang['E010033']+'：'+p+'&nbsp;'+v.UnitPrice+'</span><a title="'+lang['E0100310']+'" href="javascript:'+appId+'.setShoppingCar(\''+v.ID+'\');'+appId+'.showShoppingCar();">'+lang['E0100310']+'</a></li>'+'</ul>'+'</li>';break;};ul.push(li);if((i+1)%_this.config.rowItem==0||(i+1)==pLen){$('<ul class="'+ulCls+'">'+ul.join("")+'</ul>').appendTo(parent);};});if(pLen==0){parent.append('<div class="noData">'+lang['E010038']+'</div>');}if(this.config.styleId==2||this.config.styleId==3||this.config.styleId==4){this.setNavigation(pageNum,pageTotal,this.config.id,true);}else{this.setNavigation(pageNum,pageTotal);}};var _this=this;$.ajax({url:"/EWS_Interface/Order_ListProduct.aspx",type:'get',data:{CID:this.config.cid,ParentID:this.config.catalogID,PageItem:this.config.pageItem,PageNum:pageNum},cache:false,dataType:'json',success:function(result){_get_success.call(_this,result);}});};EWS.Order.GetCatalogProductList.prototype.showDetial=function(id,name){this.hideImgLayer();var appId='Order_'+this.config.id;this.config.pId=id;var _this=this;var scrollSize=EWS.GetPageScroll();var pageSize=EWS.GetPageSize();var target=$('#Product_'+this.config.id);var top=scrollSize.Y+20;var left=(pageSize.WinW-830)/2;var isExists=false;var lang=EWS.Language['E01005'];var _get_success=function(result){var arr=this.createProductDetailHtml2(this.config,result);var target=$('#Product_'+this.config.id);var target_detial=$("#Product_"+_this.config.id+" div.ord_detail");if(isExists){target_detial.html(arr[0]);new EWS.PreLoadImage({path:"",arrSrc:arr[1],maxWidth:55,maxHeight:56,scope:_this,success:_this.setDetialImage});return;};target.animate({top:top+'px',left:left+'px'},"normal").animate({width:'+830px'},"fast",function(){target_detial.html(arr[0]);new EWS.PreLoadImage({path:"",arrSrc:arr[1],maxWidth:55,maxHeight:56,scope:_this,success:_this.setDetialImage});});};var html='<div id="Product_'+this.config.id+'" class="ord_mdl ord_box">'+'<div class="ord_mdl_t">'+'<div class="ord_mdl_t_l"></div>'+'<div class="ord_mdl_t_r"></div>'+'<div class="ord_mdl_t_c"><h2>'+lang['E0100510']+'</h2></div>'+'<div class="ord_mdl_t_m"><a href="javascript:'+appId+'.hideDetial();" title="'+lang['E0100511']+'">'+lang['E0100511']+'</a></div>'+'</div>'+'<div class="ord_mdl_c ord_g_p_hide">'+'<div class="ord_mdl_c_l ord_g_p_fill"></div>'+'<div class="ord_mdl_c_r ord_g_p_fill"></div>'+'<div class="ord_mdl_c_c">'+'<div class="ord_detail">'+'<div class="ord_loading"><strong>'+name+'</strong> '+lang['E0100512']+'</div>'+'</div>'+'</div>'+'</div>'+'<div class="ord_mdl_b">'+'<div class="ord_mdl_b_l"></div>'+'<div class="ord_mdl_b_r"></div>'+'<div class="ord_mdl_b_c"></div>'+'</div>'+'</div>';EWS.Order.layerIndex++;if(target.length==0){$(html).css({position:'absolute',width:350,'z-index':EWS.Order.layerIndex,top:((pageSize.WinH-100)/2)+scrollSize.Y,left:(pageSize.WinW-350)/2}).appendTo("body");}else{$('#Product_'+this.config.id+' div.ord_detail').html('<div class="ord_loading"><strong>'+name+'</strong> '+lang['E0100512']+'</div>');isExists=true;};$.ajax({url:"/EWS_Interface/Order_ProductShow.aspx",type:'get',data:{ProductID:id},cache:false,dataType:'json',success:function(result){_get_success.call(_this,result);}});};EWS.Order.GetCatalogProductList.prototype.showDetialImage=function(id){var Sid=this.config.styleId;var size=this.returnWidthHeight('bigImg');var ProductImage=$("#Product_"+this.config.id+"_Img");var img=$("#"+id)[0];if($.browser.msie){var originalImg=new Image();originalImg.src=img.src;var originalWidth=originalImg.width;var originalHeight=originalImg.height;}else{var originalWidth=img.naturalWidth;var originalHeight=img.naturalHeight;};if(!size)size=[354,216];var scaleProduct=this.getImageScale(originalWidth,originalHeight,size[0],size[1]);ProductImage.attr({src:img.src});ProductImage.css({width:scaleProduct[0],height:scaleProduct[1],position:'relative',top:(size[1]-scaleProduct[1])/2});};EWS.Order.GetCatalogProductList.prototype.showProductImage=function(){window.open($("#Product_"+this.config.id+"_Img")[0].src);};EWS.Order.GetCatalogProductList.prototype.hideDetial=function(id){id?$("#"+id).remove():$("#Product_"+this.config.id).remove();};EWS.Order.GetCatalogProductList.prototype.setDetialImage=function(img){if(img.index==0){this.showDetialImage(img.id);};var originalImg=new Image();originalImg.src=img.src;var originalWidth=originalImg.width;var originalHeight=originalImg.height;var size=this.returnWidthHeight(true);var width=size[0];var height=size[1];var scale=this.getImageScale(originalWidth,originalHeight,width,height);$("#"+img.id).css({position:'relative',top:(height-scale[1])/2});};EWS.Order.GetCatalogProductList.prototype.setNavigation=function(pageNum,pageTotal,id,type){if(type){var parent=$("#"+id+" div.ord_mop_page");}else{var parent=id?$("#"+id+" div.ord_pages"):$("#"+this.config.id+" div.ord_page");}var pageGroup=5;var groupNum=parseInt((pageNum-1)/pageGroup)+1;var start=(groupNum-1)*pageGroup+1;var end=groupNum*pageGroup>pageTotal?pageTotal:groupNum*pageGroup;var nextGroupNum=start+pageGroup;nextGroupNum=nextGroupNum>pageTotal?pageTotal:nextGroupNum;var prevGroupNum=pageGroup*(groupNum-1);prevGroupNum=prevGroupNum<1?1:prevGroupNum;var nextNum=pageNum+1;nextNum=nextNum>pageTotal?pageTotal:nextNum;var prevNum=pageNum-1;prevNum=prevNum<1?1:prevNum;var nextGroup="javascript:Order_"+this.config.id+".jumpPage("+nextGroupNum+","+pageNum+","+pageTotal+");";var nextPage="javascript:Order_"+this.config.id+".jumpPage("+nextNum+","+pageNum+","+pageTotal+");";var nextText="第 "+nextGroupNum+" 页";var prevPage="javascript:Order_"+this.config.id+".jumpPage("+prevNum+","+pageNum+","+pageTotal+");";var prevGroup="javascript:Order_"+this.config.id+".jumpPage("+prevGroupNum+","+pageNum+","+pageTotal+");";var prevText="第 "+prevGroupNum+" 页";var html="<a href='"+prevGroup+"' class='first' title='"+prevText+"'>"+prevText+"</a>"+"<a href='"+prevPage+"' class='previous' title='上一页'>上一页</a>"+"{span}"+"<a href='"+nextPage+"' class='next' title='下一页'>下一页</a>"+"<a href='"+nextGroup+"' class='last' title='"+nextText+"'>"+nextText+"</a>";var span="<span>";for(var i=start;i<=end;i++){if(i<=9){var num="0"+i;}else{var num=i;};var href="javascript:Order_"+this.config.id+".jumpPage("+i+","+pageNum+","+pageTotal+");";if(i==pageNum){span+="<a href='"+href+"' class='status'><strong>"+num+"</strong></a>";}else{span+="<a href='"+href+"'>"+num+"</a>";};};span+="</span>";parent.html("");$(html.replace(/{span}/,span)).appendTo(parent);if(this.initLoad){this.initLoad=false;};};EWS.Order.GetCatalogProductList.prototype.jumpPage=function(jumpPage,pageNum,pageTotal){jumpPage=jumpPage>pageTotal?pageTotal:jumpPage;if(jumpPage==pageNum){return;};if(this.type){if(this.type=='orders_showCatalogProduct'){EWS.Anchor.set("Order_"+this.config.id,this.config.catalogID+","+jumpPage);this.getProductByPage(jumpPage);}else if(this.type=='orders_showMoreProduct'){EWS.Anchor.set("Order_"+this.config.id,"0,"+jumpPage);this.moreProductGetData(jumpPage);}else if(this.type=='GetCatalogProductList'){EWS.Anchor.set("Order_"+this.config.id,this.config.catalogID+","+jumpPage);this.getProduct(jumpPage);}else if(this.type=='orders_productSearch'||this.type=='orders_fullearch'){EWS.Anchor.set("Order_"+this.config.id,this.config.catalogID+","+jumpPage);this.getLists(jumpPage);};}else{};};EWS.Order.GetCatalogProductList.prototype.setImageLayer=function(img){var src=img.src.split('/');if(src[src.length-1]!='noImg.png'){var _this=this;var target=$("#"+img.id);target.mouseover(function(event){img.x=event.pageX==null?event.clientX:event.pageX;img.y=event.pageY==null?event.clientY:event.pageY;_this.showImgLayer(img);});target.mouseout(function(event){_this.hideImgLayer(img);});};};EWS.Order.GetCatalogProductList.prototype.hideImgLayer=function(){$("#"+this.config.id+"_zoomPic").remove();};EWS.Order.GetCatalogProductList.prototype.getImageScale=function(originalWidth,originalHeight,maxWidth,maxHeight){var _CalculateScale=function(num1,num2){var Temp=num2/num1;if(Temp.length>1){return num2;}else{return parseFloat(Temp.toString().substring(0,4));};};if(maxWidth==maxHeight){if(originalWidth>originalHeight){var wScale=_CalculateScale(originalWidth,maxWidth);if(wScale<=1){newWidth=maxWidth;newHeight=wScale*originalHeight;}else{newHeight=originalWidth;newWidth=originalHeight;}}else if(originalWidth<originalHeight){var hScale=_CalculateScale(originalHeight,maxHeight);if(hScale<=1){newHeight=maxHeight;newWidth=hScale*originalWidth;}else{newHeight=originalHeight;newWidth=originalWidth;}}else{var wScale=_CalculateScale(originalWidth,maxWidth);if(wScale<=1){newHeight=originalWidth*wScale;newWidth=newHeight;}else{newHeight=originalWidth;newWidth=newHeight;}}}else if(maxWidth>maxHeight){if(originalWidth>originalHeight){var wScale=_CalculateScale(originalWidth,maxWidth);if(wScale<=1){if(originalHeight*wScale>maxHeight){newHeight=maxHeight;newWidth=_CalculateScale(originalHeight,maxHeight)*originalWidth;}else{newWidth=maxWidth;newHeight=originalHeight*wScale;}}else{newWidth=originalWidth;newHeight=originalHeight;}}else if(originalWidth==originalHeight){var wScale=_CalculateScale(originalWidth,maxWidth);if(wScale<=1){newHeight=maxHeight;newWidth=_CalculateScale(originalHeight,maxHeight)*originalWidth;}else{if(originalHeight>maxHeight){newWidth=_CalculateScale(originalHeight,maxHeight)*originalWidth;newHeight=_CalculateScale(originalHeight,maxHeight)*originalHeight;}else{newWidth=originalWidth;newHeight=originalHeight;}}}else{var hScale=_CalculateScale(originalHeight,maxHeight);if(hScale<=1){if(hScale*originalWidth>maxWidth){newWidth=maxWidth;newHeight=_CalculateScale(originalWidth,maxWidth)*originalHeight;}else{newWidth=hScale*originalWidth;newHeight=maxHeight;}}else{newWidth=originalWidth;newHeight=originalHeight;}}}else{if(originalWidth>=originalHeight){var wScale=_CalculateScale(originalWidth,maxWidth);if(wScale<=1){newWidth=wScale*originalWidth;newHeight=wScale*originalHeight;}else{newWidth=originalWidth;newHeight=originalHeight;}}else if(originalWidth<originalHeight){var hScale=_CalculateScale(originalHeight,maxHeight);if(hScale*originalWidth>maxWidth){newWidth=maxWidth;newHeight=_CalculateScale(originalWidth,maxWidth)*originalHeight;}else{newWidth=originalWidth*hScale;newHeight=originalHeight*hScale;}}}return[newWidth,newHeight];};EWS.Order.GetCatalogProductList.prototype.showImgLayer=function(img){var id=this.config.id+"_zoomPic";var div=$.find("#"+id);var maxWidth=200;var maxHeight=100;var pageSize=EWS.GetPageSize();var scrollSize=EWS.GetPageScroll();var scale=this.getImageScale(img.width,img.height,maxWidth,maxHeight);var x=img.x+50;var y=img.y+50;var maxX=pageSize.WinW+scrollSize.X;var originalX=scale[0]+x;var maxY=pageSize.WinH+scrollSize.Y;var originalY=scale[1]+y;y=maxY>=originalY?y:y-(originalY-maxY)-50;x=(img.x+531)>pageSize.WinW?(img.x-((img.x+531)-pageSize.WinW)):img.x;if(div.length==0){var target=$('<div id="'+id+'" class="ord_zoomPic">'+'<img src="http://www1.khews.com/theme/order/img/indicator.gif" width="20px" height="20px"/>'+'</div>').css({width:maxWidth,height:maxHeight,"z-index":1,top:y,left:x,display:'none'}).appendTo("body");target.fadeIn("fast");}else{$("#"+id).css({width:maxWidth,height:maxHeight,"z-index":1,top:y,left:x});};if(this.IsInterResource(img.src)){img.src=img.src.replace('_s.','.');}this.getOriginalPicSize(img);};EWS.Order.GetCatalogProductList.prototype.showShoppingCar=function(){var _this=this;var isExists=false;var scrollSize=EWS.GetPageScroll();var pageSize=EWS.GetPageSize();var target=$('#ShoppingCar_'+this.config.id);var top=scrollSize.Y+100;var left=(pageSize.WinW-830)/2;var appId='Order_'+this.config.id;var ProductID=$.cookie("EWS_ShopCar_"+this.config.cid);var idList=[];var lang=EWS.Language['E01009'];var loadHtml='<div class="ord_detail">'+'<div class="ord_loading"><strong>'+name+'</strong> '+lang['E0100937']+'</div>'+'</div>';var html='<div id="ShoppingCar_'+this.config.id+'" class="ord_mdl ord_box">'+'<div class="ord_mdl_t">'+'<div class="ord_mdl_t_l"></div>'+'<div class="ord_mdl_t_r"></div>'+'<div class="ord_mdl_t_c"><h2>'+lang['E0100938']+'</h2></div>'+'<div class="ord_mdl_t_m"><a href="javascript:'+appId+'.hideShoppingCar();" title="'+lang['E0100939']+'">'+lang['E0100939']+'</a></div>'+'</div>'+'<div class="ord_mdl_c ord_g_p_hide">'+'<div class="ord_mdl_c_l ord_g_p_fill"></div>'+'<div class="ord_mdl_c_r ord_g_p_fill"></div>'+'<div class="ord_mdl_c_c">'+loadHtml+'</div>'+'</div>'+'<div class="ord_mdl_b">'+'<div class="ord_mdl_b_l"></div>'+'<div class="ord_mdl_b_r"></div>'+'<div class="ord_mdl_b_c"></div>'+'</div>'+'</div>';var _get_success=function(result){var dateTime=result.addtime;var p=result.moneytype;p=p=='0'?'￥':(p=='1'?'＄':(p=='2'?'￡':'€'));var info_id="EWS_ShopInfo_"+this.config.cid;var info=$.cookie(info_id);var input={'OrderInfo_Name':{name:lang['E010092'],cls:'ord_info_input ord_info_error',tag:'input',type:'text',value:lang['E010093']},'OrderInfo_Tel':{name:lang['E010094'],cls:'ord_info_input ord_info_error',tag:'input',type:'text',value:lang['E010095']},'OrderInfo_Email':{name:lang['E010096'],cls:'ord_info_input ord_info_error',tag:'input',type:'text',value:lang['E010097']},'OrderInfo_Addr':{name:lang['E010098'],cls:'ord_info_input ord_info_error',tag:'input',type:'text',value:lang['E010099']},'OrderInfo_Remarks':{name:lang['E0100910'],cls:'ord_info_textarea',tag:'textarea',type:'text',value:''}};if(info!=null){var infoArr=$.evalJSON(info);$.each(infoArr,function(i,v){input[i].value=v;input[i].cls=input[i].cls.replace(/ ord_info_error/,"");});};var infoHTML=[];$.each(input,function(i,v){if(v.tag=='input'){infoHTML.push('<label for="'+i+'"><strong>'+v.name+'</strong>'+'<'+v.tag+' id="'+i+'" class="'+v.cls+'" type="'+v.type+'" value="'+v.value+'" onblur="'+appId+'.changeShoppingInfo(this);" onfocus="'+appId+'.focusShoppingInfo(this);" />'+'</label>');}else{infoHTML.push('<label for="'+i+'"><strong>'+v.name+'</strong>'+'<'+v.tag+' id="'+i+'" class="'+v.cls+'" type="'+v.type+'" onblur="'+appId+'.changeShoppingInfo(this);" onfocus="'+appId+'.focusShoppingInfo(this);">'+v.value+'</'+v.tag+'>'+'</label>');};});var html='<div class="ord_neworder">'+'<h3 class="ord_title">'+lang['E0100911']+'</h3>'+'<table width="100%" border="0" cellspacing="0" cellpadding="0">'+'<tr>'+'<th class="order_time">'+lang['E0100912']+'</th>'+'<td class="order_no">'+result.addtime+'</td>'+'<th class="order_time">'+lang['E0100913']+'</th>'+'<td class="order_no">'+'<label for="pay">'+'<select id="Payment">'+'<option value="1">'+lang['E0100914']+'</option>'+'<option value="2">'+lang['E0100915']+'</option>'+'<option value="3">'+lang['E0100916']+'</option>'+'</select>'+'</label>'+'</td>'+'<th class="order_time"></th>'+'<td class="order_no"></td>'+'<th class="order_time"></th>'+'<td class="order_no"></td>'+'</tr>'+'</table>'+'<div class="order_bor">'+'<table id="Product_'+_this.config.id+'_Table" width="100%" border="0" cellspacing="0" cellpadding="0">{data}</table>'+'</div>'+'{total}'+'<div class="ord_info">{info}</div>'+'<div class="ord_pht">'+'<div class="ord_video"><div id="Order_'+_this.config.id+'_Video"></div></div>'+'<div class="ord_noVideo" style="display:none;">'+'<div class="ord_tips"><strong></strong></div>'+'</div>'+'<div class="ord_checkbox">'+'<label for="'+_this.config.id+'_ShowCapture"><input type="checkbox" id="'+_this.config.id+'_ShowCapture" checked="checked" />'+lang['E0100940']+'</label>'+'</div>'+'<input type="hidden" id="'+_this.config.id+'_Capture" value="" />'+'<button class="ord_video_btn" title="'+lang['E0100917']+'" onclick="Order_'+_this.config.id+'.camCapture(this)">'+lang['E0100917']+'</button>'+'</div>'+'<div class="ord_line"></div>'+'<div class="ord_newOrd_loading" style="display:none"><img src="http://'+_this.config.htmlUrl+'/theme/order/img/indicator.gif" />'+lang['E0100937']+'</div>'+'<button class="ord_order_btn" title="'+lang['E0100918']+'" onclick="'+appId+'.submitShopping();">'+lang['E0100918']+'</button>'+'</div>';var line='<tr>'+'<td height="1" colspan="12"><div class="ord_dashed1"></div></td>'+'</tr>';var infoLine='<div class="ord_dashed"></div>';var car_id="EWS_ShopCar_"+this.config.cid;var car=$.cookie(car_id);var amount={};if(car!=null){var valArr=$.evalJSON(car);$.each(valArr,function(i,v){amount[v.id]=parseInt(v.amount);});};var rLen=result.product.length;var totalPrice=0;var data=[];if(rLen>0){for(var i=0;i<rLen;i++){data.push('<tr id="Product_'+result.product[i].ID+'_Row" class="order_sta">'+'<th class="digi">'+(i+1)+'.</th>'+'<th>'+lang['E0100919']+'</th>'+'<td class="name"><a href="javascript:'+appId+'.showDetial(\''+result.product[i].ID+'\',\''+result.product[i].Name+'\');" title="'+result.product[i].Name+' '+lang['E0100941']+'">'+result.product[i].Name+'</a></td>'+'<th>'+lang['E0100920']+'</th>'+'<td class="no">'+result.product[i].Sn+'</td>'+'<th>'+lang['E0100921']+'</th>'+'<td class="price" id="'+result.product[i].ID+'_UnitPrice">'+result.product[i].UnitPrice+'</td>'+'<th>'+lang['E0100922']+'</th>'+'<td class="amount">'+'<label for="amount"><input value="'+amount[result.product[i].ID]+'" onkeyup="'+appId+'.changeShoppingCar(this,\''+result.product[i].ID+'\');" /></label>'+'</td>'+'<th>'+lang["E0100923"]+'</th>'+'<td class="total" id="'+result.product[i].ID+'_TotalPrice">'+parseFloat(result.product[i].UnitPrice)*parseInt(amount[result.product[i].ID])+'</td>'+'<td><a href="javascript:'+appId+'.delShoppingCar(\''+result.product[i].ID+'\');" title="'+lang['E0100924']+result.product[i].Name+lang['E0100942']+'" class="ord_del">'+lang['E0100924']+'</a></td>'+'</tr>');totalPrice+=parseFloat(result.product[i].UnitPrice)*parseInt(amount[result.product[i].ID]);};html=html.replace(/{data}/,data.join(line));html=html.replace(/{total}/,'<div class="order_sum">'+lang['E0100925']+':'+p+'<span id="Order_'+_this.config.id+'_TotalPrice">'+totalPrice+'</span></div>');}else{html=html.replace(/{data}/,'<tr class="order_nodata">'+lang['E0100926']+'</tr>');html=html.replace(/{total}/,'');};html=html.replace(/{info}/,infoHTML.join(infoLine));var target=$('#ShoppingCar_'+this.config.id);var target_detial=$("#ShoppingCar_"+_this.config.id+" div.ord_mdl_c_c");if(isExists){target_detial.html(html);return;};target.animate({top:top+'px',left:left+'px'},"normal").animate({width:'+830px'},"fast",function(){target_detial.html(html);var flashvars={};flashvars.debug="false";flashvars.eventLinstener="Order_"+_this.config.id+".camEvent";var params={};params.wmode="opaque";params.allowscriptaccess="always";params.bgcolor="#989797";var attributes={};attributes.id="Order_"+_this.config.id+"_Cam";swfobject.embedSWF("http://"+_this.config.htmlUrl+"/theme/CameraCapture.swf",'Order_'+_this.config.id+'_Video',"320","240","9.0.0",false,flashvars,params,attributes);});};EWS.Order.layerIndex++;if(target.length==0){$(html).css({position:'absolute',width:350,'z-index':EWS.Order.layerIndex,top:((pageSize.WinH-100)/2)+scrollSize.Y,left:(pageSize.WinW-350)/2}).appendTo("body");}else{$('#ShoppingCar_'+this.config.id+' div.ord_mdl_c_c').html(loadHtml);isExists=true;};if(ProductID!=null){var data=$.evalJSON(ProductID);$.each(data,function(i,v){idList.push(v.id);});var id_value=idList.join(",");}else{var id_value='';};$.ajax({url:"/EWS_Interface/Order_ListShopCar.aspx",type:'get',data:{ProductID:id_value,CID:this.config.cid},cache:false,dataType:'json',success:function(result){_get_success.call(_this,result);}});};EWS.Order.GetCatalogProductList.prototype.hideShoppingCar=function(){$('#ShoppingCar_'+this.config.id).remove();};EWS.Order.GetCatalogProductList.prototype.setShoppingCar=function(productID,amount,override){var car_id="EWS_ShopCar_"+this.config.cid;var car=$.cookie(car_id);if(amount==undefined){amount=1;};if(override==undefined){override=false;};if(car==null){var data=[{'id':productID,'amount':amount}];var val=$.toJSON(data);}else{var result=true;var valArr=$.evalJSON(car);$.each(valArr,function(i,v){if(v.id==productID){if(override){valArr[i]={'id':productID,'amount':amount};};result=false;return false;};});if(result){valArr.push({'id':productID,'amount':amount});};var val=$.toJSON(valArr);};$.cookie(car_id,val);};EWS.Order.GetCatalogProductList.prototype.delShoppingCar=function(productID){var car_id="EWS_ShopCar_"+this.config.cid;var car=$.cookie(car_id);var _this=this;if(car!=null){var valArr=$.evalJSON(car);$.each(valArr,function(i,v){if(v.id==productID){valArr.splice(i,1);return false;};});if(valArr.length==0){$.cookie(car_id,null);}else{$.cookie(car_id,$.toJSON(valArr));};}else{return;};var target=$('#Product_'+productID+'_Row');target.fadeOut('normal',function(){var tr=target.next();if(tr.length>0){if(tr[0].nodeName=="TR"){tr.remove();};};target.remove();_this.setTotalPrice();if(valArr.length==0){$('#Product_'+_this.config.id+'_Table').append('<tr class="order_nodata"><td>'+EWS.Language['E01009']['E0100943']+'</td></tr>');};});};EWS.Order.GetCatalogProductList.prototype.changeShoppingCar=function(input,productID){var formatfloat=function(f,size){var tf=f*Math.pow(10,size);tf=Math.round(tf+0.000000001);tf=tf/Math.pow(10,size);return tf;};var amount=1;var unitPriceObj=$("#"+productID+'_UnitPrice');var unitPrice=parseFloat(unitPriceObj.html());var singlePriceObj=$("#"+productID+'_TotalPrice');if(input.value.length==0){input.value=amount;singlePriceObj.html(formatfloat(unitPrice*amount,2));this.setShoppingCar(productID,amount,true);return;};var regular=/^\d+$/;if(regular.test(input.value)==false){var car_id="EWS_ShopCar_"+this.config.cid;var car=$.cookie(car_id);var valArr=$.evalJSON(car);$.each(valArr,function(i,v){if(v.id==productID){amount=parseInt(v.amount);return false;};});input.value=amount;singlePriceObj.html(formatfloat(unitPrice*amount,2));return;};amount=parseInt(input.value);singlePriceObj.html(formatfloat(unitPrice*amount,2));this.setTotalPrice();this.setShoppingCar(productID,amount,true);};EWS.Order.GetCatalogProductList.prototype.setTotalPrice=function(){var totalPrice=0;var obj=$("#Product_"+this.config.id+"_Table td.total");if(obj.length>0){$.each(obj,function(i,v){totalPrice+=parseFloat(v.innerHTML);});$("#Order_"+this.config.id+"_TotalPrice").html(totalPrice);}else{$("#ShoppingCar_"+this.config.id+" div.order_sum").remove();};};EWS.Order.GetCatalogProductList.prototype.changeShoppingInfo=function(input){var lang=EWS.Language['E01009'];var errorInfo={'OrderInfo_Name':[lang['E010093'],100],"OrderInfo_Tel":[lang['E010095'],100],"OrderInfo_Email":[lang['E010097'],100],"OrderInfo_Addr":[lang['E010099'],200],"OrderInfo_Remarks":['',500]};var input=$("#"+input.id)[0];var input_value=$.trim(input.value);if(input_value.length==0&&input.id!='OrderInfo_Remarks'){input.value=errorInfo[input.id][0];input.className='ord_info_input ord_info_error';return;};if(EWS.LenB(input_value)>errorInfo[input.id][1]){input_value=EWS.MidB(input_value,0,errorInfo[input.id][1]);};input.value=input_value;if(input.id=='OrderInfo_Remarks'){input.className='ord_info_textarea';}else{input.className='ord_info_input';};var info_id="EWS_ShopInfo_"+this.config.cid;var info=$.cookie(info_id);if(info!=null){var valArr=$.evalJSON(info);}else{var valArr={};};valArr[input.id]=input_value;$.cookie(info_id,$.toJSON(valArr));};EWS.Order.GetCatalogProductList.prototype.focusShoppingInfo=function(input){if(input.id=='OrderInfo_Remarks'){input.className='ord_info_textarea';}else{if(input.className=='ord_info_input ord_info_error'){input.value='';input.className='ord_info_input';};};};EWS.Order.GetCatalogProductList.prototype.submitShopping=function(){var checkOk=true;var inputList=['OrderInfo_Name',"OrderInfo_Tel","OrderInfo_Email","OrderInfo_Addr","OrderInfo_Remarks"];$.each(inputList,function(i,v){var input=$("#"+v)[0];if(input.className=='ord_info_input ord_info_error'){checkOk=false;return false;};});var car_id="EWS_ShopCar_"+this.config.cid;var car=$.cookie(car_id);if(car==null){checkOk=false;};var IsCapture=$("#"+this.config.id+"_Capture").val();var ShowCaputre=$("#"+this.config.id+"_ShowCapture")[0].checked;if(IsCapture==''&&ShowCaputre){alert(EWS.Language['E01009']['E0100944']);checkOk=false;};if(checkOk){if(ShowCaputre){var cam=swfobject.getObjectById("Order_"+this.config.id+"_Cam");cam.captureCamra("cid="+this.config.cid,"http://"+this.config.fileUrl+"/Order_uploadImg.aspx");}else{this.submitFormData('');};$("#ShoppingCar_"+this.config.id+" button.ord_order_btn").attr({"disabled":"disabled"});$("#ShoppingCar_"+this.config.id+" div.ord_newOrd_loading").css({'display':'inline'});};};EWS.Order.GetCatalogProductList.prototype.submitFormData=function(picURL){var lang=EWS.Language['E01009'];var Payment_val=1;$.each($("#Payment").find("option"),function(i,v){if(v.selected){Payment_val=v.value;return false;};});var ProductData=[];var car_id="EWS_ShopCar_"+this.config.cid;var car=$.cookie(car_id);var valArr=$.evalJSON(car);$.each(valArr,function(i,v){ProductData.push([v.id,v.amount]);});var data={CID:this.config.cid,Payment:Payment_val,OwnerName:$.trim($("#OrderInfo_Name").val()),Phone:$.trim($("#OrderInfo_Tel").val()),Email:$.trim($("#OrderInfo_Email").val()),Address:$.trim($("#OrderInfo_Addr").val()),Memo:$("#OrderInfo_Remarks").val(),Pic:picURL,Product:ProductData};var _this=this;$.post('/EWS_Interface/Order_ShopCarSave.aspx',{'data':$.toJSON(data)},function(result){var scrollSize=EWS.GetPageScroll();var pageSize=EWS.GetPageSize();var target=$('#ShoppingCar_'+_this.config.id);var top=scrollSize.Y+100;var left=(pageSize.WinW-830)/2;var targetContent=$("#ShoppingCar_"+_this.config.id+" div.ord_mdl_c_c");targetContent.html('');left=left>300?100:left;$("#ShoppingCar_"+_this.config.id+" div.ord_mdl_c_c").html('<div class="ord_detail">'+'<div class="order_inputsc" style="text-align:center;padding:28px;">'+'<img src="http://'+_this.config.htmlUrl+'/theme/order/img/inputsc.png" style="width:38px;height:27px;margin-left:-96px;*margin-left:-66px;" />'+'<h3 style="margin-top:-20px;color:#74823D;font-size:17px;margin-left:30px;">'+lang['E0100945']+'</h3>'+'<p style="font-size:14px;font-family:宋体;">'+lang['E0100946']+':<span style="color:#f00;font-size:16px;padding-left:8px;">'+result+'</span></p>'+'<p style="padding-left:25px;font-size:14px;">'+lang['E0100947']+'</p>'+'</div>'+'</div>');var car_id="EWS_ShopCar_"+_this.config.cid;$.cookie(car_id,null);});};EWS.Order.GetCatalogProductList.prototype.camEvent=function(event){var lang=EWS.Language['E01009'];switch(event.type){case"camera_init":break;case"camera_not_found":$("#ShoppingCar_"+this.config.id+" div.ord_noVideo").css({"display":'inline'});$("#ShoppingCar_"+this.config.id+" div.ord_noVideo strong").html(lang['E0100931']);$("#"+this.config.id+"_ShowCapture")[0].checked=false;break;case"camera_muted":alert(lang['E0100932']);$("#"+this.config.id+"_ShowCapture")[0].checked=false;break;case"upload_complete":this.submitFormData("http://"+this.config.fileUrl+'/'+this.config.cid+'/'+event.data);break;case"upload_io_error":alert(lang['E0100933']+'：'+event.data+','+lang['E0100934']);break;};};EWS.Order.GetCatalogProductList.prototype.camCapture=function(btn){if($("#"+this.config.id+"_ShowCapture")[0].checked==false){return;};var cam=swfobject.getObjectById("Order_"+this.config.id+"_Cam");cam.pauseCamra();var _this=this;btn.innerHTML=EWS.Language['E01009']['E0100935'];btn.title=EWS.Language['E01009']['E0100935'];btn.onclick=function(){_this.camReset(btn);};$("#"+this.config.id+"_Capture").val("1");};EWS.Order.GetCatalogProductList.prototype.camReset=function(btn){if($("#"+this.config.id+"_ShowCapture")[0].checked==false){return;};var cam=swfobject.getObjectById("Order_"+this.config.id+"_Cam");cam.playCamra();var _this=this;btn.innerHTML=EWS.Language['E01009']['E0100936'];btn.title=EWS.Language['E01009']['E0100936'];btn.onclick=function(){_this.camCapture(btn);};$("#"+this.config.id+"_Capture").val("");};function createInheritance(parent,child){var property;for(property in parent){if(!child[property]){child[property]=parent[property];};};};EWS.Order.GetProductDetail=function(obj){this.type='GetProductDetail';var _this=this;this.config=obj;var _get_success=function(result){var arr="";var size=this.returnWidthHeight(true);var width=size[0];var height=size[1];if(!obj.styleId||obj.styleId==1){arr=this.createProductDetailHtml(obj,result);}else if(obj.styleId==2){arr=this.createProductDetailHtml2(obj,result);}else{arr=this.createProductDetailHtml3(obj,result);};$("#"+obj.id).html(arr[0]);new EWS.PreLoadImage({path:"",arrSrc:arr[1],maxWidth:width,maxHeight:height,scope:_this,success:_this.setDetialImage});};$.ajax({url:"/EWS_Interface/Order_ProductShow.aspx",type:'get',data:{ProductID:obj.pId},cache:false,dataType:'json',success:function(result){_get_success.call(_this,result);}});};EWS.Order.GetCatalogProductList.prototype.setThisStyle=function(obj){if(this.type=='GetProductDetail'){var cls=this.config.styleId==2?'li_active':'li_active2';}else{var cls='li_active';}$(obj).parent().parent().find('.'+cls).removeClass();$(obj).parent().addClass(cls);};EWS.Order.GetProductDetail.prototype=EWS.Order.GetCatalogProductList.prototype;EWS.Order.GetCatalogProductList.prototype.createProductDetailHtml=function(obj,result){var lang=EWS.Language['E01005'];var p=result.MoneyType;if(p!='')p=p=='0'?'￥':(p=='1'?'＄':(p=='2'?'￡':'€'));var appId='Order_'+obj.id;var imgList=[];var pic='';var PicLen=result.Pic.length;for(var i=0;i<6;i++){if(i<PicLen){var newId=obj.id+'_Detial_'+i;imgList.push({src:result.Pic[i].Img||'http://'+this.config.htmlUrl+'/theme/order/img/noImg.png',id:newId});pic+='<li><a href="javascript:'+appId+'.showDetialImage(\''+newId+'\');" title="'+result.Pic[i].Name+'">'+'<img id="'+newId+'" '+'src="http://'+this.config.htmlUrl+'/theme/order/img/noImg.png" '+'alt="'+result.Pic[i].Name+'" width="80" height="80" />'+'</a><span>'+result.Pic[i].Name+'</span></li>';}else{pic+='<li><img  src="http://'+this.config.htmlUrl+'/theme/order/img/noImg.png"  width="84" height="84" title="'+lang['E010058']+'"/></li>';};};var style="style=display:"+(result.Name?"block":"none");var html='<div id=Pro_'+obj.pId+'  class="ord_picshow">'+'<div class="ord_big">'+'<a href="javascript:'+appId+'.showProductImage();">'+'<img id="Product_'+obj.id+'_Img"'+' src="http://'+this.config.htmlUrl+'/theme/order/img/noImg.png"'+' style="position:relative; top:36px;" alt="'+result.Name+'" />'+'</a>'+'</div>'+'<ul class="ord_small">'+pic+'</ul>'+'</div>'+'<div class="ord_dashed"></div>'+'<div class="ord_prd_info">'+'<span class="title" title="'+lang['E010051']+'"><strong>'+lang['E010051']+'：'+result.Name+'</strong></span>'+'<button '+style+' class="ord_buy" onclick="'+appId+'.setShoppingCar(\''+obj.pId+'\');'+appId+'.showShoppingCar();">'+lang['E010057']+'</button>'+'<span class="ord_price" title="'+lang['E010052']+'">'+lang['E010052']+'：<strong>'+p+result.UnitPrice+'</strong></span>'+'<div class="ord_dashed"></div>'+'<div class="ord_msg">'+'<div class="ord_msg_title">'+lang['E010056']+'</div>'+'<div>'+result.Intro+'</div>'+'</div>'+'</div>';return[html,imgList];};EWS.Order.GetCatalogProductList.prototype.createProductDetailHtml2=function(obj,result){var lang=EWS.Language['E01005'];var p=result.MoneyType;if(p!='')p=p=='0'?'￥':(p=='1'?'＄':(p=='2'?'￡':'€'));var appId='Order_'+obj.id;var imgList=[];var pic='';var PicLen=result.Pic.length;for(var i=0;i<6;i++){var cls="";if(i<PicLen){cls=i==0?"class = 'li_active'":"";var newId=obj.id+'_Detial_'+i;imgList.push({src:result.Pic[i].Img||'http://'+this.config.htmlUrl+'/theme/order/img/noImg.png',id:newId});pic+='<li '+cls+'>'+'<img id="'+newId+'" '+'src="http://'+this.config.htmlUrl+'/theme/order/img/noImg.png" '+'alt="'+result.Pic[i].Name+'" width="62" height="56"  onclick="'+appId+'.showDetialImage(\''+newId+'\');'+appId+'.setThisStyle(this)" title="'+result.Pic[i].Name+'" class="hasImg"/>'+'</li>';}else{pic+='<li '+cls+'><img src="http://'+this.config.htmlUrl+'/theme/order/img/noImg.png"  width="62" height="56" title="'+lang['E010058']+'"/></li>';};};var style="style=display:"+(result.Name?"block":"none");var html='<div class="ord_picshow_title"><strong>'+result.Name+'</strong></div>'+'<div class="ord_picshow">'+'<div class="ord_big2">'+'<a href="javascript:'+appId+'.showProductImage();">'+'<img id="Product_'+obj.id+'_Img"'+' src="http://'+this.config.htmlUrl+'/theme/order/img/noImg.png"'+' style="position:relative; top:36px;" alt="'+result.Name+'" />'+'</a>'+'</div>'+'<div class="ord_prd_info2">'+'<span title="'+lang['E010052']+'" class="ord_price">'+''+lang['E010052']+'：<strong>'+p+result.UnitPrice+'</strong>'+'</span>'+'<div class="ord_line2"><div class="icon"/><div class="line"/></div>'+'<p title="'+result.Name+'" class="title"><strong>'+result.Name+'</strong></p>'+'<p>'+lang['E010053']+':'+result.Sn+'</p>';if(this.IsShowCategory()){html+='<p>'+lang['E010054']+':'+result.Category+'</p>';}if(this.IsShowTag()){html+='<p>'+lang['E010055']+':'+result.Tag+'</p>';}html+='</div>'+'<ul class="ord_small2">'+pic+'</ul>'+'<button  '+style+' class="ord_add" onclick="'+appId+'.setShoppingCar(\''+obj.pId+'\');'+appId+'.showShoppingCar();" >'+lang['E010057']+'</button>'+'</div>'+'<div class="ord_line2"><div class="icon"/><div class="line"/></div>'+'<div class="ord_msg">'+'<div class="ord_msg_title">'+lang['E010056']+'</div>'+'<div>'+result.Intro+'</div>'+'</div>';return[html,imgList];};EWS.Order.GetCatalogProductList.prototype.createProductDetailHtml3=function(obj,result){var lang=EWS.Language['E01005'];var p=result.MoneyType;if(p!=''){p=p=='0'?'￥':(p=='1'?'＄':(p=='2'?'￡':'€'));}var appId='Order_'+obj.id;var imgList=[];var pic='';var PicLen=result.Pic.length;for(var i=0;i<6;i++){var cls="";if(i<PicLen){cls=i==0?"class = 'li_active2'":"";var newId=obj.id+'_Detial_'+i;imgList.push({src:result.Pic[i].Img||'http://'+this.config.htmlUrl+'/theme/order/img/noImg.png',id:newId});pic+='<li '+cls+'>'+'<img id="'+newId+'" '+'src="http://'+this.config.htmlUrl+'/theme/order/img/noImg.png" '+'alt="'+result.Pic[i].Name+'" width="49" height="40" onclick="'+appId+'.showDetialImage(\''+newId+'\');'+appId+'.setThisStyle(this)"  class="hasImg"/>'+'</li>';}else{pic+='<li '+cls+'><img src="http://'+this.config.htmlUrl+'/theme/order/img/noImg.png"  width="49" height="40" title="'+lang['E010058']+'"/></li>';};};var style="style=display:"+(result.Name?"block":"none");var html='<div class="ord_picshow_title"><strong>'+result.Name+'</strong></div>'+'<div class="ord_picshow">'+'<div class="ord_big2">'+'<a href="javascript:'+appId+'.showProductImage();">'+'<img id="Product_'+obj.id+'_Img"'+' src="http://'+this.config.htmlUrl+'/theme/order/img/noImg.png"'+' style="position:relative; top:36px;"  alt="'+result.Name+'" />'+'</a>'+'</div>'+'<ul class="ord_small3">'+pic+'</ul>'+'<div class="ord_prd_info2 ord_prd_info3">'+'<p title="'+result.Name+'" class="title"><strong>'+lang['E010051']+'：'+result.Name+'</strong></p>'+'<span title="'+lang['E010052']+'" class="ord_price">'+'<strong>'+p+result.UnitPrice+'</strong>'+'</span>'+'<div class="ord_line3"/>'+'<p>'+lang['E010053']+':'+result.Sn+'</p>';if(this.IsShowCategory()){html+='<p>'+lang['E010054']+':'+result.Category+'</p>';}if(this.IsShowTag()){html+='<p>'+lang['E010055']+':'+result.Tag+'</p>';}html+='</div>'+'<button '+style+' class="ord_add" onclick="'+appId+'.setShoppingCar(\''+obj.pId+'\');'+appId+'.showShoppingCar();" >'+lang['E010057']+'</button>'+'</div>'+'<div class="ord_msg">'+'<div class="ord_msg_title">'+lang['E010056']+'</div>'+'<div class="ord_msg_con">'+result.Intro+'</div>'+'</div>';return[html,imgList];};EWS.Order.GetCatalogProductList.prototype.IsShowCategory=function(){var result=true;if(EWS.Order.Category){if(typeof EWS.Order.Category=='object'){var len=EWS.Order.Category.length;for(var i=0;i<len;i++){if(EWS.Order.Category[i]==this.config.id){result=false;break;}}}else if(typeof EWS.Order.Category=='boolean'){result=false;}}return result;};EWS.Order.GetCatalogProductList.prototype.IsShowTag=function(){var result=true;if(EWS.Order.Tag){if(typeof EWS.Order.Tag=='object'){var len=EWS.Order.Tag.length;for(var i=0;i<len;i++){if(EWS.Order.Tag[i]==this.config.id){result=false;break;}}}else if(typeof EWS.Order.Tag=='boolean'){result=false;}}return result;};EWS.Order.SearchOrder=function(obj){this.type='SearchOrder';this.config=obj;var ord=$("#"+this.config.id).find('input[name="order"]');this.inputValidate(ord,EWS.Language['E01008']['E010082']);};EWS.Order.SearchOrder.prototype=EWS.Order.GetCatalogProductList.prototype;EWS.Order.SearchOrder.prototype.searchOrderByName=function(cmpId){var input=$.trim($("#"+cmpId).find('input[name="order"]').val());if(input&&input!=EWS.Language['E01008']['E010082']){this.config.searchValue=input;this.createOrderListBody();};};EWS.Order.SearchOrder.prototype.createOrderListBody=function(){if(this.config.searchValue==''||this.config.searchValue==EWS.Language['E01008']['E010082']){return;}var _this=this;var lang1=EWS.Language['E01008'];var lang=EWS.Language['E01009'];var isExists=false;var scrollSize=EWS.GetPageScroll();var pageSize=EWS.GetPageSize();var target=$('#ShoppingCar_'+this.config.id);var top=scrollSize.Y+150;var left=(pageSize.WinW-830)/2;var appId='Order_'+this.config.id;var idList=[];var formatfloat=function(f,size){var tf=f*Math.pow(10,size);tf=Math.round(tf+0.000000001);tf=tf/Math.pow(10,size);return tf;};var loadHtml='<div class="ord_detail">'+'<div class="ord_loading"><strong>'+name+'</strong> '+lang1['E010081']+'</div>'+'</div>';var html='<div id="ShoppingCar_'+this.config.id+'" class="ord_mdl ord_box">'+'<div class="ord_mdl_t">'+'<div class="ord_mdl_t_l"></div>'+'<div class="ord_mdl_t_r"></div>'+'<div class="ord_mdl_t_c"><h2>'+lang1['E010084']+'</h2></div>'+'<div class="ord_mdl_t_m"><a href="javascript:'+appId+'.hideShoppingCar();" title="'+lang1['E010085']+'">'+lang1['E010085']+'</a></div>'+'</div>'+'<div class="ord_mdl_c ord_g_p_hide">'+'<div class="ord_mdl_c_l ord_g_p_fill"></div>'+'<div class="ord_mdl_c_r ord_g_p_fill"></div>'+'<div class="ord_mdl_c_c">'+loadHtml+'</div>'+'</div>'+'<div class="ord_mdl_b">'+'<div class="ord_mdl_b_l"></div>'+'<div class="ord_mdl_b_r"></div>'+'<div class="ord_mdl_b_c"></div>'+'</div>'+'</div>';var _get_success=function(result){var orderDetail=result.Order[0];var orderProductList=result.OrderDetial;var input={'OrderInfo_Member':{name:lang1['E010086'],cls:'ord_info_p',tag:'p',type:'text',value:orderDetail.Account?orderDetail.Account:''},'OrderInfo_Name':{name:lang['E010092'],cls:'ord_info_p',tag:'p',type:'text',value:orderDetail.OwnerName},'OrderInfo_Tel':{name:lang['E010094'],cls:'ord_info_p',tag:'p',type:'text',value:orderDetail.Phone},'OrderInfo_Email':{name:lang['E010096'],cls:'ord_info_p',tag:'p',type:'text',value:orderDetail.Email},'OrderInfo_Addr':{name:lang['E010098'],cls:'ord_info_p',tag:'p',type:'text',value:orderDetail.Address},'OrderInfo_Remarks':{name:lang['E0100910'],cls:'ord_info_p',tag:'p',type:'text',value:orderDetail.Memo.replace(/\s/g,"&nbsp;")}};var infoHTML=[];$.each(input,function(i,v){if(v.tag=='input'){infoHTML.push('<label for="'+i+'"><strong>'+v.name+'</strong>'+'<'+v.tag+' id="'+i+'" class="'+v.cls+'" type="'+v.type+'" value="'+v.value+'" onblur="'+appId+'.changeShoppingInfo(this);" onfocus="'+appId+'.focusShoppingInfo(this);" />'+'</label>');}else{infoHTML.push('<label for="'+i+'"><strong>'+v.name+'</strong>'+'<'+v.tag+' id="'+i+'" class="'+v.cls+'" type="'+v.type+'" onblur="'+appId+'.changeShoppingInfo(this);" onfocus="'+appId+'.focusShoppingInfo(this);">'+v.value+'</'+v.tag+'>'+'</label>');};});var Payment=orderDetail.Payment==1?lang['E0100914']:(orderDetail.Payment==2?lang['E0100915']:lang['E0100916']);var cls=orderDetail.Pic?'ord_video':'ord_noVideo';var html='<div class="ord_neworder">'+'<table width="100%" border="0" cellspacing="0" cellpadding="0">'+'<tr>'+'<th class="order_time">'+lang['E0100912']+'</th>'+'<td class="order_no">'+orderDetail.CreatedDate+'</td>'+'<th class="order_time">'+lang['E0100913']+'</th>'+'<td class="order_no" id="Payment">'+Payment+'</td>'+'<th class="order_time"></th>'+'<td class="order_no"></td>'+'<th class="order_time"></th>'+'<td class="order_no"></td>'+'</tr>'+'</table>'+'<div class="order_bor">'+'<table id="Product_'+_this.config.id+'_Table" width="100%" border="0" cellspacing="0" cellpadding="0">{data}</table>'+'</div>'+'{total}'+'<div class="ord_info">{info}</div>'+'<div class="ord_pht">'+'<div class="'+cls+'"><img src="'+orderDetail.Pic+'" title="'+EWS.Language['E01008']['E0100821']+'" /></div>'+'</div>'+'<div class="ord_line"></div>'+'<div class="ord_newOrd_loading" style="display:none"><img src="http://'+_this.config.htmlUrl+'/theme/order/img/indicator.gif" />'+lang['E010083']+'</div>'+'</div>';var line='<tr>'+'<td height="1" colspan="12"><div class="ord_dashed1"></div></td>'+'</tr>';var infoLine='<div class="ord_dashed"></div>';var car_id="EWS_ShopCar_"+this.config.cid;var car=$.cookie(car_id);var amount={};if(car!=null){var valArr=$.evalJSON(car);$.each(valArr,function(i,v){amount[v.id]=parseInt(v.amount);});};var rLen=orderProductList.length;var totalPrice=0;var data=[];if(rLen>0){for(var i=0;i<rLen;i++){data.push('<tr id="Product_'+orderProductList[i].ProductId+'_Row" class="order_sta">'+'<th class="digi">1.</th>'+'<th>'+lang['E0100919']+'</th>'+'<td class="name"><a href="javascript:'+appId+'.showDetial(\''+orderProductList[i].ProductId+'\',\''+orderProductList[i].ProductName+'\');" title="'+orderProductList[i].ProductName+' 商品详细信息">'+orderProductList[i].ProductName+'</a></td>'+'<th>'+lang['E0100920']+'</th>'+'<td class="no">'+orderProductList[i].ProductSN+'</td>'+'<th>'+lang['E0100921']+'</th>'+'<td class="price" id="'+orderProductList[i].ProductId+'_UnitPrice">'+orderProductList[i].UnitPrice+'</td>'+'<th>'+lang['E0100922']+'</th>'+'<td class="amount">'+'<label for="amount">'+orderProductList[i].Amount+'</label>'+'</td>'+'<th>'+lang['E0100923']+'</th>'+'<td class="total" id="'+orderProductList[i].ProductId+'_TotalPrice">'+formatfloat(parseFloat(orderProductList[i].UnitPrice)*parseInt(orderProductList[i].Amount),2)+'</td>'+'</tr>');totalPrice+=formatfloat(parseFloat(orderProductList[i].UnitPrice)*parseInt(orderProductList[i].Amount),2);};html=html.replace(/{data}/,data.join(line));html=html.replace(/{total}/,'<div class="order_sum">'+lang['E0100925']+':￥<span id="Order_'+_this.config.id+'_TotalPrice">'+totalPrice+'</span></div>');}else{html=html.replace(/{data}/,'<tr class="order_nodata">'+lang['E0100926']+'</tr>');html=html.replace(/{total}/,'');};html=html.replace(/{info}/,infoHTML.join(infoLine));var target=$('#ShoppingCar_'+this.config.id);var target_detial=$("#ShoppingCar_"+_this.config.id+" div.ord_mdl_c_c");if(isExists){target_detial.html(html);return;};target.animate({top:top+'px',left:left+'px'},"normal").animate({width:'+830px'},"fast",function(){target_detial.html(html);var flashvars={};flashvars.debug="false";flashvars.eventLinstener="Order_"+_this.config.id+".camEvent";var params={};params.wmode="opaque";params.allowscriptaccess="always";params.bgcolor="#989797";var attributes={};attributes.id="Order_"+_this.config.id+"_Cam";swfobject.embedSWF("http://"+_this.config.htmlUrl+"/theme/CameraCapture.swf",'Order_'+_this.config.id+'_Video',"320","240","9.0.0",false,flashvars,params,attributes);});};EWS.Order.layerIndex++;if(target.length==0){$(html).css({position:'absolute',width:350,'z-index':EWS.Order.layerIndex,top:((pageSize.WinH-100)/2)+scrollSize.Y,left:(pageSize.WinW-350)/2}).appendTo("body");}else{$('#ShoppingCar_'+this.config.id+' div.ord_mdl_c_c').html(loadHtml);isExists=true;};$.ajax({url:"/EWS_Interface/Order_GetOrder.aspx",type:'get',data:{CID:this.config.cid,OrderID:this.config.searchValue},cache:false,dataType:'json',success:function(result){if(result.Order.length){_get_success.call(_this,result);}else{var obj=$('#ShoppingCar_'+_this.config.id);obj.css({'width':'850px','left':left});obj.find('.ord_loading').html(lang['E0100829']);};}});};EWS.Order.GetCatalogProductList.prototype.inputValidate=function(obj,tips){obj.bind('click',function(){if(this.value==tips){this.className="";this.value="";};}).bind('blur',function(){if($.trim(this.value)==""){this.className="ord_info_error";this.value=tips;};}).val(tips);};EWS.Order.orders_productSearch=function(json){this.type='orders_productSearch';this.config=json;var pro=$("#"+this.config.id).find('input[name="product"]');this.inputValidate(pro,EWS.Language['E01007']['E010071']);};EWS.Order.orders_productSearch.prototype=EWS.Order.GetCatalogProductList.prototype;EWS.Order.orders_productSearch.prototype.searchPro=function(cmpId){var input=$.trim($("#"+cmpId).find('input[name="product"]').val());if(input&&input!=EWS.Language['E01007']['E010071']){this.config.searchValue=input;this.createProductListBody(1);};};EWS.Order.orders_productSearch.prototype.createProductListBody=function(pageNum,Category){var lang=EWS.Language['E01007'];var _this=this;var _get_success=function(result){this.hideImgLayer();var appId='Order_'+this.config.id;var _this=this;var scrollSize=EWS.GetPageScroll();var pageSize=EWS.GetPageSize();var top=scrollSize.Y+20;var left=(pageSize.WinW-830)/2;var isExists=false;var id='ProductSearch_'+this.config.id;var html='<div id="ProductSearch_'+this.config.id+'" class="ord_mdl ord_box">'+'<div class="ord_mdl_t">'+'<div class="ord_mdl_t_l"></div>'+'<div class="ord_mdl_t_r"></div>'+'<div class="ord_mdl_t_c"><h2>'+lang['E010073']+'</h2></div>'+'<div class="ord_mdl_t_m"><a href="javascript:'+appId+'.hideDetial(\''+id+'\');" title="'+lang['E010074']+'">'+lang['E010074']+'</a></div>'+'</div>'+'<div class="ord_mdl_c ord_g_p_hide">'+'<div class="ord_mdl_c_l ord_g_p_fill"></div>'+'<div class="ord_mdl_c_r ord_g_p_fill"></div>'+'<div class="ord_mdl_c_c">'+'<div class="ord_product padding">'+'</div>'+'</div>'+'</div>'+'<div class="ord_mdl_b">'+'<div class="ord_mdl_b_l"></div>'+'<div class="ord_mdl_b_r"></div>'+'<div class="ord_mdl_b_c"></div>'+'</div>'+'</div>';EWS.Order.layerIndex++;if($("#"+id).length==0){$('body').append(html);$(html).animate({top:top+'px',left:left+'px'},"normal").animate({width:'+830px'},"fast",function(){});$('#ProductSearch_'+this.config.id).attr({'style':"position:absolute;left:"+left+"px;top:"+top+"px;z-index:"+EWS.Order.layerIndex});};var target=$('#ProductSearch_'+this.config.id);var parent=target.find('.ord_product');parent.html("");this.searchProductHtml(result,parent);parent.prepend('<h3 class="ord_title">'+lang['E010075']+''+this.config.searchValue+' '+lang['E010076']+'<strong class="amount">'+(result.totalCount)+'</strong>'+lang['E010077']+'：</h3>');$("<div class='ord_mop_page'></div>").appendTo(parent);this.setNavigation(pageNum,Math.ceil(parseInt(result.totalCount)/6)||0,'ProductSearch_'+this.config.id,true);};var param={CID:this.config.cid,q:this.config.searchValue,Total:true,PageNum:1,PageItem:6};if(Category&&Category!="0"){param.Category=Category;};$.ajax({url:"/EWS_Interface/Order_ListProduct.aspx",type:'get',data:param,cache:false,dataType:'json',success:function(result){_get_success.call(_this,result);}});};EWS.Order.GetCatalogProductList.prototype.getLists=function(page){var param={CID:this.config.cid,q:this.config.searchValue,Total:true,PageNum:page,PageItem:6};var lang=EWS.Language['E01007'];var self=this;$.ajax({url:"/EWS_Interface/Order_ListProduct.aspx",type:'get',data:param,cache:false,dataType:'json',success:function(result){var target=$('#ProductSearch_'+self.config.id);var parent=target.find('.ord_product');parent.html("");parent.prepend('<h3 class="ord_title">'+lang['E010075']+' '+self.config.searchValue+' '+lang['E010076']+'<strong class="amount">'+(result.totalCount)+'</strong>'+lang['E010077']+'：</h3>');self.searchProductHtml(result,parent);$("<div class='ord_mop_page'></div>").appendTo(parent);self.setNavigation(page,Math.ceil(parseInt(result.totalCount)/2)||0,'ProductSearch_'+self.config.id,true);}});};EWS.Order.GetCatalogProductList.prototype.searchProductHtml=function(result,parent){var lang=EWS.Language['E01002'];imgList=[];var ul=[];var pLen=result.Product.length;if(pLen){var p=result.MoneyType;var mType=p=='0'?'￥':(p=='1'?'＄':(p=='2'?'￡':'€'));}var _this=this;var appId='Order_'+this.config.id;$.each(result.Product,function(i,v){var newId=parseInt(_this.config.id).toString(36)+"_"+i;imgList.push({src:v.Img?v.Img:'http://'+_this.config.htmlUrl+'/theme/order/img/noImg.png',id:newId});var action='javascript:'+appId+'.showDetial(\''+v.ID+'\',\''+v.Name+'\');';ul.push('<li>'+'<div class="size">'+'<a href="'+action+'"><img  style="position: relative; top: 0.25px;" width="128" height="127"  title="'+v.Name+'"  src="http://'+_this.config.htmlUrl+'/theme/order/img/noImg.png" id="'+newId+'"/></a>'+'</div>'+'<div class="content">'+'<span>'+mType+v.UnitPrice+'</span>'+'<button class="buy" title="'+lang['E010028']+'"  onclick="'+appId+'.setShoppingCar(\''+v.ID+'\');'+appId+'.showShoppingCar();">'+lang['E010028']+'</button>'+'<a class="detail" title="'+lang['E010029']+'" href="'+action+'">'+lang['E010029']+'</a>'+'</div>'+'<div class="title">'+'<strong><a href="'+action+'">'+v.Name+'</a></strong>'+'</div>'+'</li>');});$('<div class="ord_mop_eight"><ul>'+ul.join("")+'</ul></div>').appendTo(parent);new EWS.PreLoadImage({path:"",arrSrc:imgList,maxWidth:177,maxHeight:128,scope:_this,success:''});};EWS.Order.orders_productOrdersSearch=function(obj){this.type='orders_productOrdersSearch';this.config=obj;var pro=$("#"+this.config.id).find('input[name="product"]');var ord=$("#"+this.config.id).find('input[name="order"]');this.inputValidate(pro,EWS.Language['E01010']['E010102']);this.inputValidate(ord,EWS.Language['E01010']['E010105']);};EWS.Order.orders_productOrdersSearch.prototype=EWS.Order.GetCatalogProductList.prototype;EWS.Order.orders_productOrdersSearch.prototype.searchOrderOrproByName=function(cmp){if(cmp=="1"||cmp==1){var input=$.trim($("#"+this.config.id).find('input[name="product"]').val());if(input&&input!=EWS.Language['E01010']['E010102']){this.config.searchValue=input;this.createProductListBody();};}else{var input=$.trim($("#"+this.config.id).find('input[name="order"]').val());if(input&&input!=EWS.Language['E01010']['E010105']){this.config.searchValue=input;this.createOrderListBody();};};};EWS.Order.orders_shoppingCar=function(obj){this.type='orders_shoppingCar';this.config=obj;};EWS.Order.orders_shoppingCar.prototype=EWS.Order.GetCatalogProductList.prototype;EWS.Order.orders_shoppingCar.prototype.shoppingCar=function(cmp){this.showShoppingCar();};EWS.Order.orders_fullearch=function(obj){this.type='orders_fullearch';this.config=obj;var JsTree=new EWS.Order.JsTree("showNode","hideNode",obj.htmlUrl,obj.id);JsTree.newtree2("/EWS_Interface/Order_ListAllCatalog.aspx?cid="+this.config.cid,JsTree,obj.id);this.JsTree=JsTree;var pro=$("#"+this.config.id).find('input[name="product"]');var ord=$("#"+this.config.id).find('input[name="order"]');this.inputValidate(pro,EWS.Language['E01006']['E010062']);this.inputValidate(ord,EWS.Language['E01006']['E010065']);};EWS.Order.orders_fullearch.prototype=EWS.Order.GetCatalogProductList.prototype;EWS.Order.orders_fullearch.prototype=EWS.Order.orders_productSearch.prototype;EWS.Order.orders_fullearch.prototype.searchProductByName=function(){var input=$.trim($("#"+this.config.id).find('input[name="product"]').val());if(input&&input!=EWS.Language['E01006']['E010062']){this.config.searchValue=input;this.createProductListBody(1,this.JsTree.curId);};};EWS.Order.orders_fullearch.prototype.searchOrderByName=function(){var input=$.trim($("#"+this.config.id).find('input[name="order"]').val());if(input&&input!=EWS.Language['E01006']['E010065']){this.config.searchValue=input;this.createOrderListBody();};};EWS.Order.orders_fullearch.prototype.showCar=function(){this.showShoppingCar();};EWS.Order.orders_showMoreProduct=function(obj){this.config=obj;this.type='orders_showMoreProduct';var _this=this;var appId='Order_'+this.config.id;var anchor=EWS.Anchor.get("Order_"+this.config.id);if(anchor==null){var pageNum=1;}else{var pageNum=parseInt(anchor.split(",")[1]);};var imgHW=this.returnWidthHeight();if(obj.picSize&&(obj.picSize==2||obj.picSize=='2')){var imgHW=[Number(obj.picsizeW),Number(obj.picsizeH)];}if(obj.styleId!=2&&imgHW.length){}else{if(!imgHW.length){imgHW=[73,75];}};this.config.size=imgHW;var _this=this;$.ajax({url:"/EWS_Interface/Order_getMoreProduct.aspx",type:'get',data:{CID:this.config.cid,proIDs:this.config.proListId},cache:false,dataType:'json',success:function(result){var len=result.length;for(var i=0;i<len;i++){if(result[i].url!=''){result[i].pic=_this.getSmallPicPath(result[i].url);}else{result[i].pic='http://'+_this.config.htmlUrl+'/theme/order/img/noImg.png';}}_this.proMoreListData=result;_this.moreProductGetData(pageNum);}});};EWS.Order.orders_showMoreProduct.prototype=EWS.Order.GetCatalogProductList.prototype;EWS.Order.orders_showMoreProduct.prototype.moreProductGetData=function(page){var len=this.proMoreListData.length;if(this.config.styleId!='2'&&this.config.hasPage=='true'){var pageSize=Number(this.config.pageItem);if(len>=pageSize){var startId=(page-1)*pageSize;if(len>startId){var data=this.proMoreListData.slice(startId,(startId+pageSize));this.getHtmlSrc(data,page);}else{return;}}else{this.getHtmlSrc(this.proMoreListData,page);}}else{this.getHtmlSrc(this.proMoreListData,page);}};EWS.Order.orders_showMoreProduct.prototype.getHtmlSrc=function(data,page){var html='';var imgList=[];var obj=this.config;var _this=this;var len=data.length;var parent=$('#'+obj.id);if(len){var p=data[0].moneytype;this.config.mType=p=='0'?'￥':(p=='1'?'＄':(p=='2'?'￡':'€'));}else{parent.append('<div style="text-align:center;">'+EWS.Language['E01004']['E010043']+'</div>');return;}var ul=$('<ul></ul>');if(obj.styleId==2){var rdata=this.productNode();parent.append('<ul>'+rdata[0]+'</ul>');}else{parent.html('');if(obj.hasPage=='true'){if(obj.rowItem==0||obj.rowItem=='0'||obj.rowItem==""){for(var i=0;i<len;i++){ul.append(this.returnHtmlSrc(data[i],i,len));};parent.append(ul);}else{for(var i=0;i<len;i++){if(obj.rowItem==1){ul=$('<ul></ul>');}else{if((i+1)%obj.rowItem==1){ul=$('<ul></ul>');};};ul.append(this.returnHtmlSrc(data[i],i,len));if((i+1)%obj.rowItem==0||(i+1)==len){parent.append(ul);};};}parent.append('<div class="ord_mop_page"></div>');this.setNavigation(page,Math.ceil(parseInt(obj.proListId.split(',').length)/obj.pageItem)||0,obj.id,'last');}else{ul=$('<ul></ul>');if(obj.rowItem!=""&&obj.rowItem!=0){if(obj.pageItem<len){len=obj.pageItem;}}if(obj.rowItem==0||obj.rowItem=='0'||obj.rowItem==""){for(var i=0;i<len;i++){ul.append(this.returnHtmlSrc(data[i],i,len));};parent.append(ul);}else{for(var i=0;i<len;i++){if(obj.rowItem==1){ul=$('<ul></ul>');}else{if((i+1)%obj.rowItem==1){ul=$('<ul></ul>');};};ul.append(this.returnHtmlSrc(data[i],i,len));if((i+1)%obj.rowItem==0||(i+1)==len){parent.append(ul);};};}}}};EWS.Order.orders_showMoreProduct.prototype.returnHtmlSrc=function(data,i,pLen){var obj=this.config;var style="style=margin-right:"+obj.sBetween+"px";if((i+1)%obj.rowItem==0||(i+1)==pLen){style='';};var newId=obj.id+"_img_"+i;var appId='Order_'+obj.id;var action='javascript:'+appId+'.showDetial(\''+data.id+'\',\''+data.name+'\');';var setImg='javascript:'+appId+'.imgLoadComplete(this)';switch(obj.styleId){case'8':return'<li '+style+'>'+'<div class="title"><a href="'+action+'" title="">'+data.name+'</a></div>'+'<div class="one_img"><a href="'+action+'"><img onload="'+setImg+'" src="'+data.pic+'" title="'+data.name+'" id="'+newId+'"/></a></div>'+'<div class="content">'+'<div class="number1"><div class="number2"><strong>'+data.sn+'</strong></div></div>'+'<div class="price1"><div class="price2"><strong>'+obj.mType+' '+data.unitprice+'</strong></div></div>'+'</div>'+'</li>';break;case'1':return'<li '+style+'>'+'<div class="content">'+'<div class="price"><strong>'+obj.mType+data.unitprice+'</strong></div>'+'<a  href="'+action+'" title=""><img  onload="'+setImg+'"  src="'+data.pic+'"  title="'+data.name+'" id="'+newId+'"/></a>'+'</div>'+'<div class="title">'+'<a href="'+action+'" title="">'+data.name+'</a>'+'<span>'+data.sn+'</span>'+'</div>'+'</li>';break;case'3':return'<li '+style+'>'+'<div class="content"><a  href="'+action+'" title=""><img  onload="'+setImg+'"  src="'+data.pic+'" title="'+data.name+'" id="'+newId+'"/></a></div>'+'</li>';break;case'4':return'<li '+style+'>'+'<div class="content">'+'<div class="title">'+'<a href="'+action+'" title="">'+data.name+'</a>'+'<div class="price"><span>'+obj.mType+data.unitprice+'</span></div>'+'<div class="buy"><a href="javascript:void(0)" title="'+EWS.Language['E01004']['E010047']+'" onclick="'+appId+'.setShoppingCar(\''+data.id+'\');'+appId+'.showShoppingCar();"><img src="http://'+this.config.htmlUrl+'/theme/order/img/buy.png" >'+EWS.Language['E01004']['E010047']+'</a></div>'+'</div>'+'<div class="photo"><a  href="'+action+'" title=""><img  onload="'+setImg+'"  src="'+data.pic+'" title="'+data.name+'" style="position: relative; top: 0.5px;" id="'+newId+'"/></a><div>'+'</div>'+'</li>';break;case'5':return'<li '+style+'>'+'<div class="content">'+'<div class="photo">'+'<a  href="'+action+'" title=""><img  onload="'+setImg+'"  src="'+data.pic+'" title="'+data.name+'" style="position: relative; top: 1px;" id="'+newId+'"/></a>'+'<a class="price"  href="'+action+'"><strong>'+obj.mType+data.unitprice+'</strong></a>'+'</div>'+'<div class="title">'+'<a href="'+action+'" title="">'+data.name+'</a>'+'<span>'+data.sn+'</span>'+'</div>'+'</div>'+'</li>';break;case'6':return'<li '+style+'>'+'<div class="content">'+'<div class="price"><strong>'+obj.mType+data.unitprice+'</strong>'+'<div class="title">'+'<a href="'+action+'" title="">'+data.name+'</a>'+'<span>'+data.sn+'</span>'+'</div>'+'</div>'+'<div class="photo"><a  href="'+action+'" title=""><img  onload="'+setImg+'"   src="'+data.pic+'" title="'+data.name+'" style="position: relative; top: 5px;" id="'+newId+'"/></a></div>'+'</div>	'+'</li>';break;case'7':return'<li '+style+'>'+'<div class="price">'+'<div class="title">'+'<a href="'+action+'" title="">'+data.name+'</a>'+'<span>'+EWS.Language['E01004']['E010048']+'：'+data.sn+'</span><strong>'+obj.mType+data.unitprice+'</strong>'+'</div>'+'</div>'+'</li>';break;};};EWS.Order.orders_showMoreProduct.prototype.showPic=function(id){window.open($('#'+id).attr('src'));};EWS.Order.orders_showMoreProduct.prototype.productNode=function(data,type){var appId='Order_'+this.config.id;var len=this.proMoreListData.length;var html='';var imgList=[];var appId='Order_'+this.config.id;var setImg='javascript:'+appId+'.imgLoadComplete(this)';for(var i=(len-1);i>=0;i--){var data=this.proMoreListData[i];var dis="display:block";var disb="display:none";if(i==(len-1)){dis="display:none";disb="display:block";}var action='javascript:'+appId+'.showDetial(\''+data.id+'\',\''+data.name+'\');';html+='<li id="p1_'+data.id+'" onmouseover="'+appId+'.overShowProduct(this,\''+data.id+'\');" style="'+dis+'">'+data.name+'</li>';var id=this.config.id+'_morePro_'+i;html+='<li id="p1_'+data.id+'_b" class="current"  style="'+disb+'">'+'<div class="blending">'+'<div class="blend_photo"><a href="'+action+'" ><img id=\''+id+'\' src="'+data.pic+'" width="75" height="75"  onload="'+setImg+'" /></a></div>'+'<div class="blend_name"><span title="'+data.name+'">'+data.name+'</span><p>'+this.config.mType+'</p><strong>'+data.unitprice+'</strong>'+'<a href="javascript:void(0)" ><img src="http://'+this.config.htmlUrl+'/theme/order/img/p2_10_8_1.png" onclick="'+appId+'.setShoppingCar(\''+data.id+'\');'+appId+'.showShoppingCar();" title="'+EWS.Language["E01004"]["E010046"]+'"/></a>'+'</div>'+'</div>'+'</li>';};if(len){this.config.current=this.proMoreListData[len-1].id;}return[html,imgList];};EWS.Order.orders_showMoreProduct.prototype.overShowProduct=function(obj,id){$('#p1_'+this.config.current+'_b').hide();$('#p1_'+this.config.current).show();$(obj).hide();$('#p1_'+id+'_b').show();this.config.current=id;};EWS.Order.orders_showMoreProduct.prototype.setImgState=function(obj){var dom=$('#'+obj.id);if(obj.picSize&&(obj.picSize==2||obj.picSize=='2')){var imgHW=[Number(obj.picsizeW),Number(obj.picsizeH)];}else{var imgHW=[73,75];}var w=(imgHW[0]-dom.attr('width'))/2+'px';var h=(imgHW[0]-dom.attr('height'))/2+'px';var style='left:'+w+';top:'+h+';position:absolute;';dom.attr('style',style);};EWS.Order.orders_showMoreProduct.prototype.setImage=function(img){var originalImg=new Image();originalImg.src=img.src;var originalWidth=originalImg.width;var originalHeight=originalImg.height;var width=73;var height=75;if(this.config.styleId){if(this.config.picSize&&(this.config.picSize==2||this.config.picSize=='2')){var size=[Number(this.config.picsizeW),Number(this.config.picsizeH)];}else{var size=this.returnWidthHeight();}width=size[0];height=size[1];};var scale=this.getImageScale(originalWidth,originalHeight,width,height);$("#"+img.id).css({position:'relative',top:(height-scale[1])/2,width:scale[0],height:scale[1]});};EWS.Order.orders_showCatalogProduct=function(obj){this.type='orders_showCatalogProduct';this.config=obj;var _this=this;var appId='Order_'+this.config.id;var chunnel=EWS.getCataLog();if(chunnel){var v=chunnel[1].split('#');if(decodeURI(v[0])==this.config.chunnelName){this.config.catalogID=chunnel[0];}}var imgHW=this.returnWidthHeight();if(obj.picSize&&(obj.picSize==2||obj.picSize=='2')){var imgHW=[Number(obj.picsizeW),Number(obj.picsizeH)];}this.config.size=imgHW;var anchor=EWS.Anchor.get("Order_"+this.config.id);if(anchor==null){var pageNum=1;}else{var pageNum=parseInt(anchor.split(",")[1]);};this.getProductByPage(pageNum);};EWS.Order.orders_showCatalogProduct.prototype=EWS.Order.GetCatalogProductList.prototype;EWS.Order.orders_showCatalogProduct.prototype.getImgObj=function(){switch(this.config.styleId){case'1':var img=$('#'+this.config.id+' .one_img img');return img;break;}};EWS.Order.orders_showCatalogProduct.prototype.getProductByPage=function(page){$("#"+this.config.id).html(EWS.Language['E01002']['E010024']);var _this=this;$.ajax({url:"/EWS_Interface/Order_ListProduct.aspx",type:'get',data:{CID:this.config.cid,ParentID:this.config.catalogID,PageItem:this.config.pageItem,PageNum:page},cache:false,dataType:'json',success:function(result){_this.createProductHtml(result,page);}});};EWS.Order.GetCatalogProductList.prototype.createProductHtml=function(result,page){var lang=EWS.Language['E01002'];var _this=this;var p=result.MoneyType;var mType=p=='0'?'￥':(p=='1'?'＄':(p=='2'?'￡':'€'));var product=result.Product;var obj=this.config;var pLen=product.length;var ul=$('<ul></ul>');var imgList=[];var parent=$("#"+obj.id);parent.html('');for(var i=0;i<pLen;i++){if(obj.styleId!=7){var newId=obj.id+"_img_"+i;var imgUrl='http://'+_this.config.htmlUrl+'/theme/order/img/noImg.png';if(product[i].Img){imgUrl=_this.getSmallPicPath(product[i].Img);}imgList.push({src:imgUrl,id:newId});};if(obj.rowItem==1){ul=$('<ul></ul>');}else{if((i+1)%obj.rowItem==1){ul=$('<ul></ul>');};};ul.append(returnHtml(product[i],i));if((i+1)%obj.rowItem==0||(i+1)==pLen){parent.append(ul);};};if(pLen==0){parent.append('<div class="noData">'+lang['E010022']+'</div>');}if(!obj.hasPage||obj.hasPage=='true'){parent.append('<div class="ord_mop_page"></div>');}function returnHtml(data,i){var style="style=margin-right:"+obj.sBetween+"px";if((i+1)%obj.rowItem==0||(i+1)==pLen){style='';};var newId=obj.id+"_img_"+i;var appId='Order_'+obj.id;var action='javascript:'+appId+'.showDetial(\''+data.ID+'\',\''+data.Name+'\');';var setImg='javascript:'+appId+'.imgLoadComplete(this)';switch(obj.styleId){case'1':return'<li '+style+'>'+'<div class="title"><a href="'+action+'" title="">'+data.Name+'</a></div>'+'<div class="one_img"><a href="'+action+'" title=""><img  onload="'+setImg+'" title="'+data.Name+'" src="'+imgUrl+'"  style="position: relative;top: 8px;"  id="'+newId+'"/></a></div>'+'<div class="content">'+'<div class="number1"><div class="number2"><strong>'+data.Sn+'</strong></div></div>'+'<div class="price1"><div class="price2"><strong>'+mType+' '+data.UnitPrice+'</strong></div></div>'+'</div>'+'</li>';break;case'2':return'<li '+style+'>'+'<div class="content">'+'<div class="price"><strong>'+mType+data.UnitPrice+'</strong></div>'+'<a  href="'+action+'" title=""><img  onload="'+setImg+'" title="'+data.Name+'"  src="'+imgUrl+'"  id="'+newId+'"/></a>'+'</div>'+'<div class="title">'+'<a href="'+action+'" title="">'+data.Name+'</a>'+'<span>'+data.Sn+'</span>'+'</div>'+'</li '+style+'>';break;case'3':return'<li '+style+'>'+'<div class="content"><a  href="'+action+'" title=""><img  onload="'+setImg+'" title="'+data.Name+'" src="'+imgUrl+'"   id="'+newId+'"/></a></div>'+'</li>';break;case'4':return'<li '+style+'>'+'<div class="content">'+'<div class="title">'+'<a href="'+action+'" title="">'+data.Name+'</a>'+'<div class="price"><span>'+mType+data.UnitPrice+'</span></div>'+'<div class="buy"><a href="javascript:void(0)" title="'+lang['E010025']+'" onclick="'+appId+'.setShoppingCar(\''+data.ID+'\');'+appId+'.showShoppingCar();"><img src="http://'+_this.config.htmlUrl+'/theme/order/img/buy.png" >'+lang['E010026']+'</a></div>'+'</div>'+'<div class="photo">'+'<a href="'+action+'" title="">'+'<img title="'+data.Name+'" src="'+imgUrl+'"  onload="'+setImg+'"  style="position: relative; top: 0.5px;" id="'+newId+'"/>'+'</a>'+'</div>'+'</div>'+'</li>';break;case'5':return'<li '+style+'>'+'<div class="content">'+'<div class="photo">'+'<a  href="'+action+'" title=""><img  onload="'+setImg+'"  src="'+imgUrl+'"  title="'+data.Name+'" style="position: relative; top: 1px;" id="'+newId+'"/></a>'+'<a class="price" href="'+action+'"><strong>'+mType+data.UnitPrice+'</strong></a>'+'</div>'+'<div class="title">'+'<a href="'+action+'" title="">'+data.Name+'</a>'+'<span>'+data.Sn+'</span>'+'</div>'+'</div>'+'</li>';break;case'6':return'<li '+style+'>'+'<div class="content">'+'<div class="price"><strong>'+mType+data.UnitPrice+'</strong>'+'<div class="title">'+'<a href="'+action+'" title="">'+data.Name+'</a>'+'<span>'+data.Sn+'</span>'+'</div>'+'</div>'+'<div class="photo"><a  href="'+action+'" title=""><img title="'+data.Name+'"  onload="'+setImg+'"  src="'+imgUrl+'"  style="position: relative; top: 5px;" id="'+newId+'"/></a></div>'+'</div>	'+'</li>';break;case'7':return'<li '+style+'>'+'<div class="price">'+'<div class="title">'+'<a href="'+action+'" title="">'+data.Name+'</a>'+'<span>'+lang['E010023']+'：'+data.Sn+'</span><strong>'+mType+data.UnitPrice+'</strong>'+'</div>'+'</div>'+'</li>';break;case'8':return'<li '+style+'>'+'<div class="size">'+'<a href="'+action+'"><img title="'+data.Name+'"  onload="'+setImg+'"  src="'+imgUrl+'"  style="position: relative; top: 0.25px;" title="'+data.Name+'"  id="'+newId+'"/></a>'+'</div>'+'<div class="content">'+'<span>'+mType+data.UnitPrice+'</span>'+'<button class="buy" title="'+lang['E010026']+'"  onclick="'+appId+'.setShoppingCar(\''+data.ID+'\');'+appId+'.showShoppingCar();">'+lang['E010026']+'</button>'+'<a class="detail" title="'+lang['E010029']+'" href="'+action+'">'+lang['E010029']+'</a>'+'</div>'+'<div class="title">'+'<strong><a href="'+action+'">'+data.Name+'</a></strong>'+'</div>'+'</li>';break;};};if(!obj.hasPage||obj.hasPage=='true'){this.setNavigation(page,Math.ceil(parseInt(result.totalCount)/obj.pageItem)||0,obj.id,'last');}};EWS.Order.orders_showCatalogProduct.prototype.setImage1=function(img){var originalImg=new Image();originalImg.src=img.src;var originalWidth=originalImg.width;var originalHeight=originalImg.height;var width=185;var height=162;if(this.config.styleId){var size=this.returnWidthHeight();width=size[0];height=size[1];};var scale=this.getImageScale(originalWidth,originalHeight,width,height);$("#"+img.id).css({position:'relative',top:(height-scale[1])/2});};EWS.Order.orders_showCatalogs=function(obj){this.type='orders_showCatalogs';this.config=obj;var _this=this;var appId='Order_'+this.config.id;$.ajax({url:"/EWS_Interface/Order_ListCatalog.aspx",type:'get',data:{CID:this.config.cid,ParentID:this.config.catalogID},cache:false,dataType:'json',success:function(result){_this.createCatalogListHtml(result)}});};EWS.Order.orders_showCatalogs.prototype=EWS.Order.GetCatalogProductList.prototype;EWS.Order.orders_showCatalogs.prototype.createCatalogListHtml=function(result){var data=result.Catalog;var appId='Order_'+this.config.id;var len=data.length;var dom=$('#'+this.config.id);dom.html(EWS.Language['E01001']['E010012']);if(this.config.cataNum=='2'){len=this.config.cataNumValue?(this.config.cataNumValue>len?len:this.config.cataNumValue):len;}var action='javascript:'+appId+'.showProductLists();';var html='';switch(this.config.styleId){case'1':var cls=len==0?'li_title li_first':'li_title';if(result.Path[0].Number==''){var nL='';}else{var nL='( '+result.Path[0].Number+' )';}html='<ul><li class="'+cls+'"><a href="javascript:void(0)" onclick="'+appId+'.setState(this,1);"><strong>'+(this.config.catalogID=="0"?EWS.Language['E01001']['E010011']:this.config.catalogName)+nL+'</strong></a><ul>';for(var i=0;i<len;i++){if(i==len-1)html+='<li class="li_last"><a href="javascript:'+appId+'.showProductLists(\''+data[i].ID+'\')">'+data[i].Name+'( '+data[i].Number+' )</a></li>';else html+='<li><a href="javascript:'+appId+'.showProductLists(\''+data[i].ID+'\')">'+data[i].Name+'( '+data[i].Number+' )</a></li>';};html+='</ul></li></ul>';break;case'2':html='<ul><li class="li_title"><a href="javascript:'+appId+'.showProductLists(\''+this.config.catalogID+'\')"><strong>'+(this.config.catalogID=="0"?EWS.Language['E01001']['E010011']:this.config.catalogName)+'</strong></a><a href="javascript:void(0)" onclick="'+appId+'.setState(this,2);" class="iconUl" title="'+EWS.Language['E01001']['E010013']+'">'+EWS.Language['E01001']['E010013']+'</a><ul>';for(var i=0;i<len;i++){if(i==len-1)html+='<li class="li_last"><a href="javascript:'+appId+'.showProductLists(\''+data[i].ID+'\')">'+data[i].Name+'</a></li>';else html+='<li><a href="javascript:'+appId+'.showProductLists(\''+data[i].ID+'\')">'+data[i].Name+'</a></li>';};html+='</ul></li></ul>';break;case'3':if(this.config.hasTitle&&this.config.hasTitle=='true'){html='<div class="ord_sortList3_title"><a href="javascript:'+appId+'.showProductLists(\''+this.config.catalogID+'\')">'+this.config.catalogName+'</a></div>';}for(var i=0;i<len;i++){html+='|<a href="javascript:'+appId+'.showProductLists(\''+data[i].ID+'\')">'+data[i].Name+'</a>';};break;case'4':if(this.config.hasTitle&&this.config.hasTitle=='true'){html='<div class="ord_sortList4_title"><a href="javascript:'+appId+'.showProductLists(\''+this.config.catalogID+'\')">'+this.config.catalogName+'</a></div>';}for(var i=0;i<len;i++){html+='<a href="javascript:'+appId+'.showProductLists(\''+data[i].ID+'\')">'+data[i].Name+'</a>';};break;}$('#'+this.config.id).html(html);};EWS.Order.orders_showCatalogs.prototype.setState=function(obj,p){var cls=obj.parentNode.className;if(cls.split(' ').length>1){obj.parentNode.className='li_title';}else{obj.parentNode.className='li_title hide';};};EWS.Order.orders_showCatalogs.prototype.showProductLists=function(id){if(this.config.chunnel=='1'){if(this.config.proComId){var obj=eval('Order_'+this.config.proComId);if(obj.config){obj.config.catalogID=id;obj.getProductByPage(1);}}}else{if(this.config.linkId){window.open(this.config.linkId+'.shtml?catName='+id+','+this.config.chunnelName);}};};EWS.Order.GetCatalogProductList.prototype.returnWidthHeight=function(p){var width='';var height='';var sId=this.config.styleId;sId=sId?Number(sId):1;switch(this.type){case'GetCatalogProductList':if(typeof(p)=='string'){return[406,269];}else if(typeof(p)=='boolean'){return[55,56];}else{switch(sId){case 1:return[177,128];case 2:return[111,111];case 3:return[130,113];case 4:return[177,168];case 5:return[117,93];case 6:return[85,68];};}break;case'GetProductDetail':if(p=='bigImg'){switch(sId){case 1:return[354,216];case 2:return[406,269];case 3:return[370,269];};};switch(sId){case 1:return p?[89,84]:[354,216];case 2:return p?[55,56]:[406,269];case 3:return p?[49,40]:[370,269];};break;case'orders_showCatalogProduct':if(p=='bigImg'){return[406,269];}else if(p==true){return[55,56];};switch(sId){case 1:return[185,166];case 2:return[130,122];case 3:return[114,114];case 4:return[157,130];case 5:return[173,152];case 6:return[120,130];case 8:return[177,128];};break;case'orders_showMoreProduct':if(p=='bigImg'){return[406,269];}else if(p==true){return[55,56];};switch(sId){case 1:return[130,122];case 3:return[114,114];case 4:return[157,130];case 5:return[173,152];case 6:return[120,130];case 8:return[185,166];case 2:return[73,75];default:return[354,216];};break;case'SearchOrder':case'orders_productSearch':case'orders_productOrdersSearch':case'orders_fullearch':if(p=='bigImg'){return[406,269];}else if(p==true){return[55,56];};break;};};EWS.Order.GetCatalogProductList.prototype.IsInterResource=function(url){if(url){if(url.indexOf('khews.local')>0||url.indexOf('khews.com')>0){return true;}}return false;};EWS.Order.GetCatalogProductList.prototype.getSmallPicPath=function(url){if(!this.IsInterResource(url)){return url;}else{var arr=url.split('/');var name=arr[arr.length-1];var _url=arr[arr.length-1].split('.');return url.replace(name,(_url[0]+'_s.'+_url[1]));}};EWS.Order.GetCatalogProductList.prototype.setSmallPicSize=function(img,size,overPic){var oimg=new Image();oimg.src=img.src;if(oimg.width){var scale=this.getImageScale(oimg.width,oimg.height,size[0],size[1]);$('#'+img.id).css({position:'relative',top:(size[1]-scale[1])/2,width:scale[0],height:scale[1]});if(overPic){img.width=oimg.width;img.height=oimg.height;this.setImageLayer(img);}}else{var self=this;setTimeout(function(){self.setSmallPicSize(img,size);},20);}};EWS.Order.GetCatalogProductList.prototype.getOriginalPicSize=function(img){var oimg=new Image();oimg.src=img.src;if(oimg.width){var maxWidth=531;var maxHeight=384;var scale=this.getImageScale(oimg.width,oimg.height,maxWidth,maxHeight);var id=this.config.id+"_zoomPic";var imgObj=$('#'+id).find('img');imgObj.attr('src','');imgObj.attr('src',img.src);imgObj.css({width:scale[0],height:scale[1]});$('#'+id).css({width:scale[0],height:scale[1]});}else{var self=this;setTimeout(function(){self.getOriginalPicSize(img);},20);}};EWS.Order.GetCatalogProductList.prototype.imgLoadComplete=function(obj){var config=this.config;var w=obj.width;var h=obj.height;if(w==0){var oimg=new Image();oimg.src=obj.src;w=oimg.width;h=oimg.height;}var scale=this.getImageScale(w,h,config.size[0],config.size[1]);$(obj).css({position:'relative',top:(config.size[1]-scale[1])/2,width:scale[0],height:scale[1]});var img={id:obj.id,src:obj.src,width:w,height:h};this.setImageLayer(img);};
