Uize.module({name:'Zazzle.ProductAttributes.Shirt',required:['Uize.Node','Uize.Url','Zazzle.ApparelStyleSelector','Zazzle.ControlPoptions.Popup','Zazzle.ControlPoptions.Scrollied','Zazzle.SizeInfo','Zazzle.Page'],builder:function(d_a){var d_b=true,d_c=false;var d_d=d_a.subclass(null,function(){var d_e=this,d_f=d_e.Class.initialSelectedAttributes;var d_g=d_e.makeProductAttribute({name:'style',widgetMaker:Zazzle.ApparelStyleSelector});d_e.makeProductAttribute({name:'color',widgetMaker:function(){var d_h=new Zazzle.ControlPoptions.Scrollied({templateOption:{GENERATED_itemNo:'ITEMNO',name:d_f.color,displayName:'DISPLAYNAME',selectedStyle:d_f.style}});d_h.children.scrolly.set({showButtonsWhenNotScrollable:false});d_h.wire('Changed.values',function(){d_e.displayNode('darkApparelNotice',d_d.findRecord(d_h.get('values'),{shade:'dark'}));});return d_h;}});var d_i=d_e.addChild('sizeInfo',Zazzle.SizeInfo);d_e.makePoptionsProductAttribute({name:'size',widgetMaker:function(){var d_h=new Zazzle.ControlPoptions.Popup({
templateOption:{GENERATED_itemNo:'999',sizeLabel:'displayName'},emptyLabel:d_e.localize('selectSize')});d_h.population.set({itemPhantomProperties:{sizeLabel:function(){var d_j=this.displayName;return this.price?d_e.localize('labelWithPrice',{label:d_j,price:this.displayPrice}):d_j}}});function d_k(d_l){d_i.set({value:d_d.findRecord(d_h.get('values'),{name:d_h.get(d_l)})})}d_h.wire('Changed.tentativeValue',function(){d_k('tentativeValue')});d_h.wire('Changed.values',function(){d_k('value')});return d_h;}});d_e.makeProductAttribute({name:'context',widgetMaker:function(){var d_h=new Zazzle.ControlPoptions.Scrollied({templateOption:{GENERATED_itemNo:'ITEMNO',name:d_f.context,selectedStyle:d_f.style,selectedColor:d_f.color,selectedSize:'a_l',displayName:'DISPLAYNAME',view:d_f.view}});d_h.children.scrolly.set({showButtonsWhenNotScrollable:false});return d_h;}});d_e.addViewAttribute();}),d_m=d_d.prototype;d_m.wireUi=function(){var d_e=this;if(!d_e.isWired){function d_n(d_o){
d_e.fire({name:'Track Event',bubble:d_b,extra:d_o})}var d_p=d_e.children.style,d_q=d_p.get('attributeInfo').values,d_r;function d_s(){function d_t(d_u){return d_u=='mens'||d_u=='womens'?'adult':d_u}d_r=d_p.getValueObject();var d_v=d_t(d_r.groups[0]);for(var d_w=0;d_w<d_q.length;d_w++){var d_g=d_q[d_w];if(d_g.priceFull<d_r.priceFull&&d_t(d_g.groups[0])==d_v)d_r=d_g;}d_e.setNodeInnerHtml('lowestSkuAmount',d_r.displayPriceFull);d_e.setNodeInnerHtml('lowestSkuName',d_r.displayName);d_e.displayNode('lowestSkuShell',(d_p+'')!=d_r.name)}d_e.wireNodeEvent('lowestSkuName','onclick',function(){d_p.set({value:d_r.name});d_n('lowestSku');});d_p.wire('Changed.value',d_s);d_s();d_e.wireNodeEvent(['viewSizeChart','viewSizeChart2'],'onclick',function(){if(!d_e.children.sizeInfo.get('value').sizeNA){var d_g=d_e.children.style,d_x=d_g.get('attributeInfo').values[d_g.get('index')];d_e.callInherited('useDialog')({component:{name:'product/shirt/sizeChartDialog',params:d_d.copyInto({op:'size',pt:d_e.getInherited('productType'),
pd:d_e.getInherited('productId')||null,sf:d_e.getInherited('skuFilter'),contentOwner:d_e.get('contentOwner'),styleDisplayName:d_x.displayName,styleGroup:d_x.groups[0]},d_e.getValues())},widgetClassName:'Zazzle.DialogSizeChart',widgetProperties:{name:'sizeChartDialog'}});}else Zazzle.Page.launchPopup({url:'http://zazzle.custhelp.com/cgi-bin/zazzle.cfg/php/enduser/std_adp.php?p_faqid=92'});});d_e.wire({'Request Implicit Attributes':function(d_y){var d_z=d_y.implicitAttributes||{},d_g=d_e.children.style,d_x=d_g.get('attributeInfo').values[d_g.get('index')];if(d_x){d_z.group=d_x.groups[0];d_z.lifeStyle=d_x.lifestyles[0];d_y.implicitAttributes=d_d.copyInto(d_y.implicitAttributes||{},d_z);}},'Before Add To Cart':function(d_y){if(!d_e.get('allAttributesChosen')){d_e.inform({message:d_e.localize('sizeWarning'),state:'warning'});d_y.async=d_b;d_n('sizeWarning');}}});d_a.prototype.wireUi.call(d_e);}};d_m.updateUiInStock=function(){var d_e=this;if(d_e.isWired){var d_A=d_e.get('outOfStockAttribute');
d_a.prototype.updateUiInStock.call(d_e);d_e.setNodeInnerHtml('outOfStockAttribute2',d_e.localize('oosChooseDifferent',{option:d_A=='style'?d_A:d_A=='color'?'style or color':'style, color or size'}));}};d_d.initialSelectedAttributes={style:'basic_tshirt',color:'white',context:'mfong',view:'front'};d_d.set({attributesToNotDefer:{size:1,sizeInfo:1}});return d_d;}});