function productPreview(d){if(!d.pictureInfos.computed){d.pictureInfos=_PL_tasks_manager.compute(d.pictureInfos)}var c=d.productSize;var a=(d.productSize.width+d.productSize.bleeding.width)/d.pictureInfos.width;if(!d.adjust){if(d.pictureInfos.height*a<(d.productSize.height+d.productSize.bleeding.height)){a=(d.productSize.height+d.productSize.bleeding.height)/d.pictureInfos.height
}}else{var a=(d.productSize.width+d.productSize.bleeding.width)/d.pictureInfos.width;if(d.pictureInfos.height*a>(d.productSize.height+d.productSize.bleeding.height)){a=(d.productSize.height+d.productSize.bleeding.height)/d.pictureInfos.height}}var b={width:(d.pictureInfos.width*a).round(),height:(d.pictureInfos.height*a).round()};
d.sceneElements.each(function(h){h.empty();var f=new Element("div",{styles:{position:"absolute",zIndex:2}});f.setStyles({width:d.productSize.width,height:d.productSize.height,top:d.productSize.top,clip:"rect(0px,"+d.productSize.width+"px,"+d.productSize.height+"px,0px)",left:c.left}).inject(h);var k="M";
if(d.PictureSizeLabel){k=d.PictureSizeLabel}var g=d.pictureInfos.representations[k].src;var j=new Element("img",{src:g}).inject(f);j.setStyles({position:"absolute",zIndex:1,top:-(b.height-c.height-d.productSize.bleeding.top)/2,left:-(b.width-c.width-d.productSize.bleeding.left)/2,width:b.width,height:b.height});
var i=h.getSize();var e=new Element("div",{styles:{left:0,top:0,position:"absolute",width:i.x,height:i.y,zIndex:9}});e.inject(h);e.setPng(d.pathMask,false,"top left no-repeat")})};
