function PrintsBasketOrderItem(b,a){this.parent=null;this.pbFile=b;this.count=a;this.detailImgId="";
this.qualityWarning=true;this.aspectRatioWarning=true;this.price=0;this.selected=false;
this.detailThumbSize=null;this.editImageSessionId=null}PrintsBasketOrderItem.prototype.setIconPosition=function(b,c,a,e){var d;
d=(this.parent.parent.detailDepotOrderItemIconsPos!==undefined)?this.parent.parent.detailDepotOrderItemIconsPos:{qty:"rb",warning:"lt",remove:"rt",aspectRatioWarning:"rt"};
switch(d[b]){case"lt":c.style.left=a+"px";c.style.top=e+"px";break;case"rt":c.style.right=a+"px";
c.style.top=e+"px";break;case"lb":c.style.left=a+"px";c.style.bottom=e+"px";break;
case"rb":c.style.right=a+"px";c.style.bottom=e+"px";break}};PrintsBasketOrderItem.prototype.detailDepotUpdate=function(b){var e,j,a,g,d,k,h,f,c;
k=PictureBar.getPictureWidth(this.pbFile);h=PictureBar.getPictureHeight(this.pbFile);
if(b===undefined){b=document.getElementById(this.detailImgId)}b.style.width=this.detailThumbSize.width+10+"px";
b.style.height=this.detailThumbSize.height+10+"px";if(this.parent.parent.detailDepotAutoCropItemsEnabled){wapWidth=this.parent.formatPrintWidth;
f=this.parent.formatPrintHeight;if(this.parent.formatPrintWidth<this.parent.formatPrintHeight){c=this.parent.formatPrintHeight;
f=this.parent.formatPrintWidth}if(k>=h){g=jade.ThumbnailUtils.getThumbnailData(c,f,this.detailThumbSize.width,this.detailThumbSize.height)
}else{g=jade.ThumbnailUtils.getThumbnailData(f,c,this.detailThumbSize.height,this.detailThumbSize.width)
}filledInThumbData=this.getFilledInThumbnailData(k,h,g.width,g.height)}else{g=jade.ThumbnailUtils.getThumbnailData(k,h,this.detailThumbSize.width,this.detailThumbSize.height)
}a=b.childNodes;for(e=0,j=a.length;e<j;e++){switch(a[e].className){case"autoCropArea":case"autoCropArea-selected":a[e].style.width=g.width+"px";
a[e].style.height=g.height+"px";a[e].style.margin=g.y+"px "+g.x+"px";a[e].className=this.selected?"autoCropArea-selected":"autoCropArea";
d=a[e].getElementsByTagName("img")[0];if(d&&(d.className=="image"||d.className=="image-selected")){d.width=filledInThumbData.width;
d.height=filledInThumbData.height;d.style.margin=filledInThumbData.y+"px "+filledInThumbData.x+"px";
d.className=this.selected?"image-selected":"image";d.src=PictureBar.getPictureSrc(this.pbFile,this.detailThumbSize.width,this.detailThumbSize.height)
}break;case"image":case"image-selected":a[e].width=g.width;a[e].height=g.height;a[e].style.margin=g.y+"px "+g.x+"px";
a[e].className=this.selected?"image-selected":"image";a[e].src=PictureBar.getPictureSrc(this.pbFile,this.detailThumbSize.width,this.detailThumbSize.height);
break;case"qty1":case"qty2":case"qty3":a[e].firstChild.data=this.count;a[e].className=(this.count>=10?(this.count>=100?"qty3":"qty2"):"qty1");
a[e].style.visibility=this.parent.parent.detailDepotShowQty1Always||this.count>1?"visible":"hidden";
this.setIconPosition("qty",a[e],g.x,g.y);break;case"warning":this.setIconPosition("warning",a[e],g.x,g.y);
a[e].style.visibility=this.qualityWarning?"visible":"hidden";break;case"aspectRatioWarning":this.setIconPosition("aspectRatioWarning",a[e],g.x,g.y);
a[e].style.visibility=this.aspectRatioWarning?"visible":"hidden";break;case"remove":this.setIconPosition("remove",a[e],g.x,g.y);
break}}};PrintsBasketOrderItem.prototype.getFilledInThumbnailData=function(e,d,b,c){var a;
a={};if(e===0||d===0){a.x=0;a.y=0;a.width=b;a.height=c}else{if((e/b)>(d/c)){a.height=c;
a.width=parseInt(c*e/d);a.y=0;a.x=parseInt((b-a.width)/2)}else{a.width=b;a.height=parseInt(b*d/e);
a.x=0;a.y=parseInt((c-a.height)/2)}}a.left=a.x;a.top=a.y;a.right=b-a.width-a.left;
a.bottom=c-a.height-a.top;return a};
