/*______________
|       ______  |   B U I L T     O N     U I Z E     F R A M E W O R K
|     /      /  |   ---------------------------------------------------
|    /    O /   |   This JavaScript application is developed using the object
|   /    / /    |   oriented UIZE JavaScript framework as its foundation.
|  /    / /  /| |
| /____/ /__/_| |    ONLINE : http://www.uize.com
|          /___ |   LICENSE : UIZE is distributed under the GNU General Public License
|_______________|             http://www.gnu.org/licenses/gpl.txt
*/

Uize.module({name:'Uize.Widget.ThumbZoom',required:['Uize.Widget.ImagePort','Uize.Widget.Drag','Uize.Node','Uize.Fade'],builder:function(c_a){var c_b=true,c_c=false,c_d=Uize.Node,c_e=Uize.Widget,c_f=document.documentElement;var c_g;var c_h=c_a.subclass(function(){var c_i=this;c_i.showFade=new Uize.Fade({duration:350,acceleration:1,deceleration:0,quantization:1});c_i.hideFade=new Uize.Fade({duration:250,acceleration:0,deceleration:1,startValue:1,endValue:0});c_i.shieldFade=new Uize.Fade({duration:3000,acceleration:1,deceleration:0,startValue:0,endValue:1});},function(){var c_i=this;if(c_i.c_j)c_i.c_k=c_i.addChild('loadingProgress',c_e.Bar.Progress);}),c_l=c_h.prototype;c_l.wireUi=function(){var c_i=this;if(!c_i.isWired){if(c_i.c_j&& !c_i.c_k.getNode()){c_i.c_k.insertUi();c_i.c_k.setNodeStyle('',{position:'absolute'});}var c_m,c_n,c_o=c_i.showFade,c_p=c_i.hideFade,c_q=c_i.shieldFade;function c_r(){if(!c_n){c_n=document.createElement('img');c_d.setStyle(c_n,{display:'none',position:'absolute',zIndex:50001});
c_i.wireNodeEvent(c_n,'onload',function(c_s){if(c_i.c_j)c_i.c_k.set({inProgress:c_c});c_d.display(c_n);c_d.setOpacity(c_n,1);var c_t=c_d.getCoords(c_m),c_u=c_d.getDimensions(window),c_v=c_e.ImagePort.getScaledRect({portWidth:c_u.width,portHeight:c_u.height,rectWidth:c_n.width,rectHeight:c_n.height,alignX:.5,alignY:.5,sizingLowerBound:0,sizingUpperBound:'fit',sizingValue:.95,maxScaling:1});c_v.left+=c_f.scrollLeft;c_v.top+=c_f.scrollTop;var c_w=document.onkeydown,c_x=document.onmousemove,c_y=document.onmousedown,c_z=c_s.clientX,c_A=c_s.clientY;function c_B(){c_o.stop();document.onmousemove=c_x;document.onmousedown=c_y;document.onkeydown=c_w;c_q.stop();c_d.display(c_g,c_c);c_p.start();return c_c;}document.onkeydown=document.onmousedown=c_B;document.onmousemove=function(c_s){c_s=c_s||event;return(c_s.clientX!=c_z||c_s.clientY!=c_A?c_B():c_c);};function c_C(c_t){return{left:c_t.left,top:c_t.top,width:c_t.width,height:c_t.height};}c_o.start({startValue:c_C(c_t),endValue:c_C(c_v)});});
document.body.appendChild(c_n);if(!c_g)c_g=c_e.Drag.insertShield({zIndex:50000,backgroundColor:'#000'});c_o.wire({'Changed.value':function(){c_d.setStyle(c_n,c_o.valueOf());},Done:function(){c_d.setOpacity(c_g,0);c_d.display(c_g);c_q.start();}});c_p.wire({'Changed.value':function(){c_d.setOpacity(c_n,c_p);},Done:function(){c_d.display(c_n,c_c);}});c_q.wire({'Changed.value':function(){c_d.setOpacity(c_g,c_q);}});}}function c_D(){c_m=this;var c_E=c_c,c_F=c_m;while(c_F&&c_F.tagName!='A')c_F=c_F.parentNode;if(c_F){var c_G=c_F.getAttribute('href');if((c_i.c_H||/./).test(c_G)){c_r();if(c_i.c_j){var c_t=c_d.getCoords(c_m);c_i.c_k.setNodeStyle('',{left:c_t.x+3,top:c_t.y+c_t.height-1-c_i.c_k.getNode().offsetHeight-3});c_i.c_k.set({inProgress:c_b});}c_d.setStyle(c_n,{width:'',height:'',left:-10000,top:-10000});c_n.src=c_F.href;c_E=c_b;}}return!c_E;}c_d.doForAll(c_d.find(c_i.c_I),function(c_J){c_J.onclick=c_d.returnFalse;c_i.wireNodeEvent(c_J,'onclick',c_D);});}};c_h.registerProperties({c_H:{name:'imageValidator',
value:/\.(jpg|jpeg|gif|png)/},c_j:{name:'showLoadingProgress',value:c_c},c_I:{name:'thumbNodes',value:[]}});return c_h;}});

Uize.module({name:'Uize.Widget.MagView',required:['Uize.Node','Uize.Fade','Uize.Widget.ImagePort'],builder:function(c_a){var c_b=true,c_c=false,c_d,c_e=null,c_f=Uize.Node;var c_g={};var c_h=c_a.subclass(function(){var c_i=this;if(Uize.Fade)c_i.c_j=new Uize.Fade({duration:450,acceleration:0,deceleration:1});c_i.c_k=c_i.addChild('magImagePort',Uize.Widget.ImagePort,{sizingUpperBound:'fill',sizingLowerBound:0});if(c_i.c_l)c_i.c_m=c_i.addChild('beam',Uize.Widget.Beam);}),c_n=c_h.prototype;c_n.c_o=function(){return this.isWired&&this.c_p};c_n.c_q=function(){var c_r=this.c_s,c_t=c_r,c_u=c_r,c_v=this.c_v;if(c_v){var c_w=c_v.length;if(c_w){c_t=c_u=Infinity;for(var c_x= -1;++c_x<c_w;){var c_s=c_v[c_x];if(c_s<c_t)c_t=c_s;if(c_s>c_r&&c_s<c_u)c_u=c_s;}if(c_u==Infinity)c_u=c_t;}}return{c_t:c_t,c_u:c_u};};c_n.c_y=function(c_s){var c_z=this.c_z;return(typeof c_z=='function'?c_z.call(this,c_s):c_z);};c_n.c_A=function(){var c_i=this;if(c_i.c_o()){var c_z=c_i.c_y(c_i.c_s);if(c_z!==c_i.c_B){function c_C(c_D){
c_f.show(c_i.getNode('magImageHighRes'),c_D);c_i.displayNode('magImageLowRes',!c_D);}var c_E=c_g[c_z];if(!c_E){var c_F=c_i.c_G,c_v=c_i.c_v;if(c_v){for(var c_x= -1,c_w=c_v.length,c_r=c_i.c_s,c_H=0;++c_x<c_w;){var c_s=c_v[c_x];if(c_s<c_r&&c_s>c_H){var c_I=c_i.c_y(c_s);if(c_g[c_I]){c_F=c_I;c_H=c_s;}}}}c_i.setNodeProperties('magImageLowRes',{src:c_F});c_i.displayNode('highResLoading');c_C(c_c);function c_J(){c_i.unwireNodeEventsByMatch('magImageHighRes');c_g[c_z]=1;c_i.displayNode('highResLoading',c_c);c_C(c_b);}c_i.wireNodeEvents('magImageHighRes',{onload:c_J,onerror:c_J,onabort:c_J});}c_i.c_B=c_z;c_i.setNodeProperties('magImageHighRes',{src:c_z});}}};c_n.c_K=function(){var c_i=this,c_s=c_i.c_s,c_L=c_i.c_L,c_M=c_i.c_M,c_N=c_i.c_O/c_s,c_P=c_i.c_Q/c_s,c_R=c_i.c_R=c_N*c_L,c_S=c_i.c_S=c_P*c_M;c_i.c_T=c_R*c_i.c_U;c_i.c_V=c_S*c_i.c_W;c_i.c_X=c_L-c_R;c_i.c_Y=c_M-c_S;c_i.c_Z=Math.min(1/c_N,1/c_P);if(c_i.c_l)c_i.c_m.set({thinSize:c_i.c_S/c_M,height:c_M,top:c_i.c_0});};c_n.c_1=function(){var c_i=this;function c_2(){
c_i.c_3=c_i.c_s;c_i.c_A();}if(c_i.c_o()){function c_4(){c_i.c_K();c_i.c_5();}if(c_i.c_j){var c_j=c_i.c_j;c_j.set({startValue:c_i.c_3,endValue:c_i.c_s});var c_6={'Changed.value':function(){c_i.c_s= +c_j;c_4();},Done:function(){c_j.unwire(c_6);c_2();c_i.c_7=c_c;}};c_j.wire(c_6);c_i.c_7=c_b;c_i.c_j.start();}else{c_4();c_2();}}else{c_2();}};c_n.c_5=function(){var c_i=this,c_8=c_h.constrain((c_i.c_9.left-c_i.c_ba-c_i.c_T)/c_i.c_X,0,1),c_bb=c_h.constrain((c_i.c_9.top-c_i.c_0-c_i.c_V)/c_i.c_Y,0,1),c_bc=c_i.c_ba+c_i.c_X*c_8,c_bd=c_bc+c_i.c_R;if(c_i.c_l)c_i.c_m.set({thinAlign:c_bb,left:c_bd,width:c_i.c_ba+c_i.c_L-c_bd});c_i.c_k.set({alignX:c_8,alignY:c_bb,sizingValue:c_i.c_Z});c_i.setNodeStyle('highlight',{left:c_bc,top:c_i.c_0+c_i.c_Y*c_bb,width:c_i.c_R-2,height:c_i.c_S-2});};c_n.wireUi=function(){var c_i=this;if(!c_i.isWired){var c_be=c_f.getDimensions(c_i.getNode()),c_L=c_i.c_L=c_be.width,c_M=c_i.c_M=c_be.height;function c_bf(c_D){c_i.displayNode(['magImagePortShell','highlight',c_i.c_l?c_i.c_m.getNode():c_e],c_D);
c_i.c_p=c_D;}c_i.wireNodeEvent('','onmouseover',function(c_bg){c_bf(c_b);if(!c_i.c_bh){c_i.c_bh=c_b;var c_bi=document.body;function c_bj(c_bk){c_bi.insertBefore(c_bk,c_bi.childNodes[0]);c_f.setStyle(c_bk,{zIndex:100000,position:'absolute'});}c_bj(c_i.getNode('magImagePortShell'));c_bj(c_i.getNode('highlight'));if(c_i.c_l)c_bj(c_i.c_m.getNode());}var c_bl=c_f.getCoords(c_i.getNode()),c_bm=c_f.getDimensions(c_i.c_k.getNode());c_i.c_ba=c_bl.x;c_i.c_0=c_bl.y;c_i.c_bn=c_bm.width;c_i.c_bo=c_bm.height;c_i.c_O=c_i.c_bn/c_L;c_i.c_Q=c_i.c_bo/c_M;c_i.setNodeStyle('magImagePortShell',{left:c_i.c_ba+c_L,top:c_i.c_0});c_i.c_K();c_i.c_A();var c_bp=document.onmousemove,c_bq=document.onclick;function c_br(){c_i.c_9=c_f.getEventAbsPos();if(c_f.doRectanglesOverlap(c_i.c_9.left,c_i.c_9.top,1,1,c_i.c_ba,c_i.c_0,c_L,c_M)){c_i.c_5();}else{c_bf(c_c);document.onmousemove=c_bp;document.onclick=c_bq;if(c_i.c_bs)c_i.set({c_s:c_i.c_q().c_t});}}c_br();document.onmousemove=c_br;document.onclick=function(){if(!c_i.c_7)
c_i.set({c_s:c_i.c_q().c_u});};});c_a.prototype.wireUi.call(c_i);}};c_h.registerProperties({c_U:{name:'cursorAlignX',value:.5},c_W:{name:'cursorAlignY',value:.75},c_G:'magImageLowResUrl',c_z:{name:'magImageHighResUrl',onChange:c_n.c_A},c_s:{name:'magPower',value:1,onChange:c_n.c_1},c_v:{name:'magPowers',onChange:function(){this.set({c_s:this.c_v[0]})}},c_bs:{name:'resetMagPowerOnOut',value:c_b},c_l:{name:'showBeam',value:c_c}});return c_h;}});
Uize.module({name:'Zazzle.ProductView.ProductPage',required:['Uize.Widget.MagView','Uize.Node'],builder:function(d_a){var d_b=true,d_c=false,d_d=null;var d_e=d_a.subclass(d_d,function(){this.d_f=this.addChild('magView',Uize.Widget.MagView);}),d_g=d_e.prototype;d_g.d_h=function(){var d_i=this,d_j=[2.5,5],d_k=d_i.children.workspaceViewMode+'';if(d_k!='area'){var d_l=d_i.getInherited('productType');if(d_k=='product'&&d_l.indexOf('shirt')>=0){d_j=[1.5];}else{var d_m=d_l=='print'?3:2.5,d_n={mug:4,print:5,shirt:5,embroideredshirt:5,tie:3.75}[d_l];d_j=d_n?[d_m,d_n]:[d_m];}}d_i.d_f.set({magPower:d_j[0],magPowers:d_j});};d_g.wireUi=function(){var d_i=this;if(!d_i.isWired){d_i.d_f.set({nodeMap:{'':Uize.Node.getById('page_productView-workspaceViewport')}});d_i.d_h();d_i.wire('Submitting Realview Request',function(d_o){if(d_o.isWorkspace){d_i.d_f.set({magImageLowResUrl:d_o.url,magImageHighResUrl:function(d_p){return d_i.getLargeWorkspaceImageUrl(d_p*400)}});}});d_i.children.workspaceViewMode.wire(
'Changed.value',function(){d_i.d_h()});d_a.prototype.wireUi.call(d_i);}};return d_e;}});
Uize.module({name:'Zazzle.RatingStars',superclass:'Uize.Widget',required:['Uize.Node','Uize.Widget.Fleeting'],builder:function(c_a){var c_b=navigator,c_c=c_b.userAgent.toLowerCase(),c_d=Uize.Node.isIe,c_e=null;var c_f=c_a.subclass(c_e,function(){var c_g=this;c_g.c_h=[];c_g.set({currentRating:c_g.getInherited('avgRating'),ratingBeforeInteraction:c_g.getInherited('avgRating')});c_g.c_i=c_g.addChild('ratingSuccess',Uize.Widget.Fleeting,{lifeSpan:3000,maxOpacity:1});c_g.c_j=c_g.addChild('ratingFailure',Uize.Widget.Fleeting,{lifeSpan:3000,maxOpacity:1});}),c_k=c_f.prototype;c_k.c_l=function(){var c_g=this,c_h=c_g.getNode('stars');if(c_g.isWired){if(c_g.c_m==''||c_g.c_m==c_e){c_h.src=c_g.c_n;}else{c_h.src=c_g.c_h[Math.floor(c_g.c_m)].src;}}};c_k.wireUi=function(){var c_g=this,c_h=c_g.getNode('stars'),c_o=c_g.getInherited('commObject');if(!c_g.isWired&&c_h){c_g.set({originalStarsSrc:c_h.src});function c_p(c_q){
return c_g.getInherited('env').imageRealview+'?action=ratingstar&colora='+c_g.c_r+'&colorb='+c_g.c_s+'&bg_color='+c_g.c_t+'&starid='+c_q;}for(var c_q=0;c_q<11;c_q++){c_g.c_h[c_q]=new Image;c_g.c_h[c_q].src=c_p(c_q);}c_g.wireNodeEvent('starsLink','onclick',function(c_u){return false;});c_g.wireNodeEvent('stars','onmousemove',function(c_u){var c_v=c_d?c_u.offsetX:c_u.layerX,c_w=c_h.width/5,c_x=(Math.floor(c_v/c_w)+1)*2;if(c_x>10)c_x=10;if(c_g.c_y){if(c_x!=c_g.c_m){c_g.set({currentRating:c_x});}}});c_g.wireNodeEvent('stars','onmouseout',function(c_u){if(c_g.c_y){c_g.set({currentRating:c_g.c_z});c_h.src=c_g.c_n;}});c_g.wireNodeEvent('stars','onclick',function(c_u){var c_A=c_h.src,c_B=c_g.c_m;if(c_g.c_y){c_g.callInherited('ensureLoggedIn')({lluser:1,callback:function(){c_o.request({url:c_g.getInherited('env').service+'rateproduct?id='+c_g.getInherited('productId')+'&rating='+c_B,returnType:'json',requestMethod:'GET',callback:function(c_C){if(c_C.error==c_e){var c_D=c_C.numRatings,
c_E='('+c_D+' '+(c_D<=1?'vote':'votes')+')';c_g.setNodeInnerHtml('numRatings',c_E);c_g.set({enabled:false});c_g.c_i.set({shown:true});c_g.fire('Rating Success');}else{c_g.c_j.set({shown:true});c_g.set({currentRating:c_g.c_z,enabled:false});if(c_C.error=='Already rated'){c_g.fire('Already Rated');}else{c_g.fire('Rating Failure');}}}});}});}});c_a.prototype.wireUi.call(c_g);}};c_f.registerProperties({c_m:{name:'currentRating',value:'',onChange:c_k.c_l},c_z:{name:'ratingBeforeInteraction',value:0,onChange:function(){var c_g=this;if(c_g.isWired){c_g.c_n=c_g.c_n.replace(/starid=\d+/,'starid='+c_g.c_z);c_g.c_l();}}},c_n:{name:'originalStarsSrc',value:''},c_r:{name:'colorA',value:'0xFFFFFF'},c_s:{name:'colorB',value:'0xffb310'},c_t:{name:'bgColor',value:'0xFFFFFF'},c_y:{name:'enabled',value:true}});return c_f;}});

Uize.module({name:'Uize.Widget.CollectionItem',required:['Uize.Node','Uize.Widget.Button'],builder:function(c_a){var c_b=true,c_c=false,c_d;var c_e=c_a.subclass(function(){this.c_f={};},function(){var c_g=this;c_g.c_h('select',function(c_i){c_g.c_j(c_i.domEvent,c_b)}).set({clickToDeselect:c_b});c_g.c_k();c_g.c_h('remove',function(c_i){c_g.fire({name:'Remove',byUser:c_b})});}),c_l=c_e.prototype;c_l.c_h=c_l.addChildButton=Uize.Widget.Button.addChildButton;c_l.c_m=function(){if(this.isWired){var c_n=this.c_n;if(c_n!=c_d)this.setNodeInnerHtml('title',c_n);}};c_l.c_o=function(){var c_g=this;if(c_g.isWired){c_g.setNodeProperties('',{className:c_g.c_p+' '+((c_g.c_q?c_g.c_r:c_g.c_s&&c_g.c_t)||'')});var c_u=c_g.c_u,c_v=c_g.c_v;if(typeof c_u=='string'&&typeof c_v=='string')c_g.setNodeProperties('preview',{className:c_g.c_s?c_v:c_u});}};c_l.c_j=function(c_w,c_x){this.fire({name:'Click Selected',domEvent:c_w,forceToggle:c_x});};c_l.c_k=function(){this.children.select.set({selected:this.c_q});};
c_l.selectedConformerFunction=function(c_y){return c_y};c_l.updateUi=function(){this.c_o();this.c_m();};c_l.wireUi=function(){var c_g=this;if(!c_g.isWired){if(!c_g.c_p)c_g.set({c_p:c_g.getNode().className});var c_z=c_g.getNode('previewShell')||'imageLink';c_g.wireNodeEvents(c_z,{onmouseover:function(){c_g.set({c_s:c_b})},onmouseout:function(){c_g.set({c_s:c_c})},onmousedown:function(c_i){c_g.fire({name:'Item Mouse Down',domEvent:c_i,bubble:c_b})}});if(c_g.c_A)c_g.wireNodeEvent(c_z,'onclick',function(c_i){var c_x=c_g.c_A=='Toggle Selected';c_x||c_g.c_A=='Select'?c_g.c_j(c_i,c_x):c_g.fire({name:'Click Preview',bubble:c_b});});c_a.prototype.wireUi.call(c_g);}};c_e.registerProperties({c_r:'cssClassActive',c_p:'cssClassBase',c_u:'cssClassImage',c_v:'cssClassImageOver',c_t:'cssClassOver',c_B:{name:'locked',value:c_c},c_s:{name:'over',onChange:[function(){var c_g=this;if(c_g.isWired&&c_g.c_C&&Uize.Tooltip)Uize.Tooltip.showTooltip(c_g.c_C,c_g.c_s);},c_l.c_o],value:c_c},c_A:'previewClickAction',c_C:'previewTooltip',
c_f:{name:'properties',onChange:function(){this.set({c_n:this.c_f.title})}},c_q:{name:'selected',conformer:function(c_y){return this.selectedConformerFunction(c_y)},onChange:function(){if(this.children.select)this.c_k();this.c_o();},value:c_c},c_n:{name:'title',onChange:function(){var c_g=this,c_f=c_g.c_f;if(c_f){c_f.title=c_g.c_n;c_g.c_m();}}}});return c_e;}});

Uize.module({name:'Uize.Widget.CollectionItem.Zooming',required:['Uize.Node','Uize.Fade'],builder:function(d_a){var d_b=true,d_c=false,d_d,d_e=Uize.Node;var d_f=d_a.subclass(),d_g=d_f.prototype;function d_h(d_i,d_j){return+d_e.getStyle(d_i,d_j).replace(/px/i,'')||0;}d_g.d_k=function(){if(this.isWired&&this.d_l)this.setNodeProperties(['preview','previewZoom'],{src:this.d_l});};d_g.d_m=function(){var d_n=this;if(d_n.isWired&&d_n.d_o){var d_p={};function d_q(d_r){var d_s=d_r=='x',d_t=d_s?'width':'height';d_p[d_s?'left':'top']=d_n.get(d_s?'alignX':'alignY')*(d_n.d_u[d_t]-(d_p[d_t]=d_n.d_v[d_t]*d_n.d_w));}d_q('x');d_q('y');d_n.setNodeStyle('previewZoom',d_p);}};d_g.d_x=function(d_y){this.displayNode('previewZoom',this.d_o=d_y);};d_g.updateUi=function(){this.d_k();d_a.prototype.updateUi.call(this);};d_g.wireUi=function(){var d_n=this;if(!d_n.isWired){var d_z=d_n.getNode('preview'),d_A=d_n.getNode('previewShell')||(d_z?d_z.parentNode:null);d_n.wireNodeEvent(d_A,'onmouserest(150)',function(){
if(!d_n.get('over'))return;if(d_n.d_B>1){d_n.set({inUse:d_b});function d_C(){var d_D=d_e.getEventAbsPos(),d_E=d_n.d_E;function d_F(d_s){return(d_f.constrain((d_D[d_s?'left':'top']-(d_n.d_u[d_s?'x':'y']+d_E))/(d_n.d_u[d_s?'width':'height']-d_E*2),0,1))}d_n.set({d_G:d_F(d_b),d_H:d_F()});}d_C();d_n.wireNodeEvent(document.documentElement,'onmousemove',d_C);}});d_n.wire('Changed.over',function(){if(!d_n.get('over')){d_n.unwireNodeEvent(document.documentElement,'onmousemove');d_n.set({inUse:d_c});}});d_a.prototype.wireUi.call(d_n);}};d_f.registerProperties({d_G:{name:'alignX',onChange:d_g.d_m,value:0},d_H:{name:'alignY',onChange:d_g.d_m,value:0},d_E:{name:'deadMargin',value:20},d_w:{name:'displayedZoomPower',onChange:d_g.d_m,value:1},d_I:{name:'inUse',onChange:function(){var d_n=this;if(d_n.isWired){if(d_n.d_I){var d_n=this,d_z=d_n.getNode('preview'),d_J=d_n.getNode('previewZoom'),d_A=d_n.getNode('previewShell')||(d_z?d_z.parentNode:null);d_n.d_u=d_e.getCoords(d_A);if(!d_n.d_l)d_n.set({d_l:d_z.src});
var d_K=d_n.get('previewZoomUrl');if(typeof d_K=='function')d_K=d_K.call(d_n);if(d_K){if(d_n.d_B>1){d_n.d_v=d_e.getDimensions(d_z);d_n.d_v.width-=d_h(d_z,'borderLeftWidth')+d_h(d_z,'borderRightWidth');d_n.d_v.height-=d_h(d_z,'borderTopWidth')+d_h(d_z,'borderBottomWidth');if(!d_J){var d_L=d_z.parentNode;d_e.setStyle(d_L,{overflow:'hidden',height:d_L.offsetHeight-d_h(d_L,'borderTopWidth')-d_h(d_L,'borderBottomWidth')});d_n.flushNodeCache('previewZoom');var d_B=d_n.get('zoomPower');d_J=d_z.cloneNode(d_b);d_e.setProperties(d_J,{id:d_n.get('idPrefix')+'-previewZoom',title:''});d_e.setStyle(d_J,{left:'0',top:'0',border:'none',width:d_n.d_v.width,height:d_n.d_v.height,position:'absolute',backgroundImage:''});d_z.parentNode.appendChild(d_J);}d_e.setProperties(d_J,{src:d_K,lowsrc:d_n.d_l});d_n.d_x(d_b);d_n.d_m();d_n.d_M||(d_n.d_M=new Uize.Fade).wire('Changed.value',function(){d_n.set({d_w:+d_n.d_M})});d_n.d_M.start(d_f.copyInto({startValue:1,endValue:d_n.d_B},d_n.d_N));}else{d_z.src=d_K;}d_n.set({d_O:d_b});}}else{
if(d_n.d_o){d_n.set({d_w:1});d_n.d_x(d_c);}else{d_n.d_k();}d_n.set({d_O:d_c});}}},value:d_c},d_l:{name:'previewUrl',onChange:d_g.d_k},d_K:{name:'previewZoomUrl'},d_O:{name:'showingPreview',value:d_c},d_B:{name:'zoomPower',value:1},d_N:{name:'zoomFadeProperties',value:{duration:600,acceleration:0,deceleration:1}}});return d_f;}});
Uize.module({name:'Zazzle.GridCell',superclass:'Uize.Widget.CollectionItem.Zooming',required:'Uize.Url',builder:function(e_a){var e_b=null,e_c=Uize.Url;var e_d=e_a.subclass(),e_e=e_d.prototype;e_d.set({cssClassActive:'selected',cssClassOver:'over',cssClassImage:'realviewImage',cssClassImageOver:'realviewImageHover',previewZoomUrl:function(){var e_f=this,e_g=e_b,e_h=e_f.get('previewUrl'),e_i=e_f.get('productType'),e_j=e_f.get('zoomPower');if(e_j>1){e_g=e_d.setUrlMaxDim(e_h,e_d.getUrlMaxDim(e_h)*e_j);}else{var e_k={rvtype:'pre'},e_l=e_c.fromParams(e_h);if(e_l.action!=='getimage'){if(!e_i)e_i=e_l.pdt;if(!e_i)e_i=e_h.replace(/.*-[a-z](\d{3,3})\d{15,}.*/,'$1');if(e_i=='print'||e_i=='128'){e_k.zfct=e_k.sh=e_b;}else if(e_i=='tie'||e_i=='151'){e_k.view_x=e_b;e_k.view_y=.9;e_k.view_width=.6;e_k.view_height=.1;}else if(e_i=='kedsshoe'||e_i=='167'){e_k={view_auto:'0.7'};}else if(e_i=='skateboard'||e_i=='186'){e_k={view_auto:'0.7',rvtype:'product'};}else{e_k.view_x=e_k.view_y=e_k.view_width=e_k.view_height=e_b;}
if(e_l.action){e_g=e_c.resolve([e_h,e_l,e_k]);}else{if(e_k.rvtype=='pre'){e_g=e_h.replace(/-[a-z](\d{18,}[a-z0-9]+_\d+\.[a-zA-Z]{3})/,'-d$1');if(e_g!==e_h)e_k.rvtype=e_b;}else{e_g=e_h;}for(var e_m in e_k){if(e_k[e_m]!==e_b){e_g=e_c.resolve(e_g,e_k);break;}}}}}return e_g;}});var e_n=/(max_dim=)(\d+)(.*)/,e_o=/(_)(\d+)(\.[^\.]*(\?|#|$))/;e_d.getUrlMaxDim=function(e_p){return(e_p.match(e_n)||e_p.match(e_o))[2];};e_d.setUrlMaxDim=function(e_p,e_q){var e_r;function e_s(e_t,e_u,e_v,e_w){e_r=true;return e_u+Math.round(e_q)+e_w;}var e_g=e_p.replace(e_n,e_s);if(!e_r)e_g=e_p.replace(e_o,e_s);return e_g;};e_d.set({zoomPower:2.5});return e_d;}});
Uize.module({name:'Zazzle.GridCell.Product',required:'Uize.Url',builder:function(e_a){var e_b=true,e_c=false;var e_d=e_a.subclass(null,function(){var e_e=this,e_f=e_e.get('properties');e_e.addChildButton('moveTo',function(e_g){e_e.fire({name:'Move To',bubble:e_b})});e_e.addChildButton('edit',function(e_g){e_e.fire({name:'Edit',bubble:e_b})});e_e.e_h=e_e.getNode('preview').src;e_e.e_i=e_f.pid;e_e.e_j=e_e.e_i.substring(0,3);e_e.e_k=e_f.un;var e_j=e_e.e_j,e_l=e_e.e_l=e_f.views;if(e_l){e_e.e_m=0;if(e_j=='158'){e_e.e_l=['cover'];for(var e_n=0;e_n<e_l;++e_n)e_e.e_l.push('page_'+e_n);e_e.e_l.push('back');}else{if(e_j=='137'){e_e.e_o=e_l[1];e_l=e_l[0];}if(typeof e_l=='string'){e_e.e_l=e_j=='235'?(e_l.indexOf('front')==0?[e_l,'back']:['front',e_l]):e_p[e_j];while(e_e.e_m<e_e.e_l.length&&e_e.e_l[e_e.e_m]!=e_l)++e_e.e_m;if(e_e.e_m==e_e.e_l.length)e_e.e_l.push(e_l);}}}}),e_q=e_d.prototype;var e_p={168:['0','270','90'],167:['top','outside','outsidefront','front','insidefront','inside','back'],
137:['front','inside2','inside1','back'],239:['front','back'],240:['front','back']},e_r={front:'viewFront',back:'viewBack',angle0:'viewFront',angle0_2:'viewFront',angle45:'viewFrontRight',angle90:'viewLeft',angle180:'viewBack',angle270:'viewRight',angle315:'viewFrontLeft',cover:'viewCover',calendar:'viewMonth',inside1horz:'viewInsideTop',inside2horz:'viewInsideBottom',inside1vert:'viewInsideLeft',inside2vert:'viewInsideRight',90:'viewBack',0:'viewCenter',270:'viewLeft',shoetop:'viewUpper',shoeoutside:'viewOutsideQuarter',shoeoutsidefront:'viewOutsideFront',shoefront:'viewTongue',shoeinsidefront:'viewInsideFront',shoeinside:'viewInsideQuarter',shoeback:'viewHeel'};e_q.e_s=function(e_t){return this.localize(e_r[e_t]);};e_q.wireUi=function(){var e_e=this;if(!e_e.isWired){var e_u=e_e.getNode('nextviewLink'),e_l=e_e.e_l,e_v=e_u&&e_l,e_j=e_e.e_j,e_w=e_e.getNode('productTypeIcon');e_e.wireNodeEvent('contributorLink','onclick',function(){location.href=e_e.getInherited('env').www+e_e.e_k});
if(e_j=='231'||e_j=='232'||e_j=='233'){if(e_w!=null){e_w.title=e_e.localize('seeStitch');e_e.wireNodeEvent(e_w,'onclick',function(){e_e.callInherited('animateStitch')({pd:e_e.e_i});});}}e_e.wire('Changed.showingPreview',function(){var e_x= !e_e.get('showingPreview');e_e.showNode(e_w,e_x);if(e_v)e_e.showNode(e_u,e_x);});if(e_v){function e_y(e_z){var e_h=e_e.e_h,e_n=(e_e.e_m+1)%e_l.length,e_A=e_l[e_n];var e_B=Uize.Url.resolve(e_h,e_j=='168'?{lon:e_A}:{view:e_A});e_z?(e_e.e_m=e_n):(e_B=e_d.setUrlMaxDim(e_B,e_d.getUrlMaxDim(e_h)/3));return e_B;}function e_C(){var e_n=(e_e.e_m+1)%e_l.length,e_t=e_l[e_n],e_D=e_e.localize('clickToView');if(e_j=='158'){e_D+=e_t.indexOf('page')!=0?e_e.e_s(e_t):e_e.e_s('calendar').replace('{0}',e_n).replace('{1}',e_l.length-2);}else{if(e_j=='235')e_t=e_n==0?'front':'back';else if(e_j=='167')e_t='shoe'+e_t;else if(e_t=='inside1'||e_t=='inside2')e_t+=e_e.e_o;e_D+=e_e.e_s(e_t);};e_u.style.backgroundImage='url("'+e_y()+'")';e_u.title=e_D;}e_C();e_e.displayNode(e_u,e_b);e_e.wireNodeEvent(
e_u,'onclick',function(){if(e_e.isWired){e_e.set({previewUrl:e_y(e_b)});e_C();e_u.blur();}});e_e.wire('Changed.previewUrl',function(){e_e.e_h=e_e.getNode('preview').src;e_C();});}e_a.prototype.wireUi.call(e_e);}};return e_d;}});

Uize.module({name:'Uize.Template',required:['Uize.Url','Uize.Json','Uize.String'],builder:function(){var _a=function(){},_b=true,_c=false,_d='string',_e={},_f=Uize.Url,_g=Uize.Json,_h=Uize.String,_i=_h.splitInTwo,_j=_h.trim;var _k=/^\s*=/,_l=/^\s*@/,_m=/^\s*\./,_n=/^!\s*/,_o=/(\r|\n|\r\n)[ \t]*$/,_p=/^[ \t]*(\r|\n|\r\n)[ \t]*/,_q='->';_a.compile=function(_r,_s){function _t(_d,_u){return(_u+_d.replace(/\\/g,'\\\\').replace(/\n/g,'\\n').replace(/\r/g,'\\r').replace(new RegExp(_u,'g'),'\\'+_u)+_u);}_s=_s||_e;var _v=[],_w={},_x=_s.openerToken||'<%',_y=_s.closerToken||'%>',_z=_s.gobbleWhitespace!==_c,_A=_r.length,_B='var output = [];',_C='return output.join (\'\');',_D=[_B],_E=[],_F=0,_G,_H=_b,_I,_J,_K,_L,_M;function _N(_J){if(_E.length){_D.push('output.push ('+_E.join(',')+');');_E=[];}_D.push(_J);}function required(_O){Array.prototype.push.apply(_v,Uize.isArray(_O)?_O:[_O]);}function input(_P){Uize.copyInto(_w,_P);}function startBlock(_Q,_R){_N('function '+_Q+' ('+(_R||'')+') {'+_B);}function endBlock(){
_N(_C+'}');}while(_H){_G=_r.indexOf(_x,_F);if(_G<0)_G=_A;_I=_r.slice(_F,_G);_H=_G<_A;if(_H){_G+=2;_F=_r.indexOf(_y,_G);_J=_r.slice(_G,_F);_L=_k.test(_J);_M=_L||_m.test(_J);_K= !_M&&_l.test(_J);_F+=2;}if(_I){if(_z&&_H&& !_M&&_o.test(_I)&&_p.test(_r.substr(_F)))_I=_I.replace(_o,'');if(_I)_E.push(_t(_I,'\''));;}if(_H){if(_M){_J=_L?_J.replace(_k,''):('input'+_J);var _S=_i(_J,_q),_T=_j(_S[0]),_U=_S[1];if(_U){_U=_U.split(_q);for(var _V=0,_W=_U.length;_V<_W;_V++){var _X=_i(_U[_V],'{'),_Y=_j(_X[0]);if(_Y){var _Z=_j(_X[1]),_0=_n.test(_Y),_1=(_0?'de':'en')+'coder';if(_0)_Y=_Y.replace(_n,'');_T='Uize.Template.'+_1+'s.'+_Y+'.'+_1+'('+_T+(_Z?(',{'+_Z):'')+')';}}}_E.push(_T);}else if(_K){eval(_J.replace(_l,''));}else{_N(_J);}}}_N(_C);var _2=_D.join('\n'),_3=new Function('input',_2);return(_s.result=='full'?{input:_w,required:_v,code:_2,templateFunction:_3}:_3);};function _4(_5,_6,_7){var _8=_5,_9=_a[_7?'encoders':'decoders'],_ba=_7?'encoder':'decoder';function _bb(_6){var _bc=typeof _6==_d;if(_bc&&_6.indexOf('|')> -1){
_bb(_6.split('|'));}else{if(!_bc&&Uize.isArray(_6)){for(var _V=0,_bd=_6.length;_V<_bd;_V++)_bb(_6[_7?_V:_bd-1-_V]);}else{var _be=_9[_bc?_6:_6.type][_ba];if(_be)_8=_be(_8,_bc?_e:_6);}}}_bb(_6);return _8;};_a.encode=function(_bf,_6){return _4(_bf,_6,_b)};_a.decode=function(_bg,_6){return _4(_bg,_6)};_a.encoders={json:{encoder:_g.to},miniJson:{encoder:function(_bf){return _g.to(_bf,'mini')}},url:{encoder:_f.resolve},urlParams:{encoder:_f.toParams},urlPiece:{encoder:_f.toPiece}};_a.decoders={json:{decoder:_g.from},miniJson:{decoder:_g.from},urlParams:{decoder:_f.fromParams},urlPiece:{decoder:_f.fromPiece}};return _a;}});
Uize.module({name:'Zazzle.SizeInfo',superclass:'Uize.Widget',required:'Uize.Template',builder:function(c_a){var c_b=c_a.subclass(),c_c=c_b.prototype;c_c.updateUi=function(){var c_d=this,c_e=c_d.c_e;if(c_d.isWired&&c_e&&c_d.getNode()){var c_f=c_e.sizeNA,c_g=c_e.fit||'classic';c_d.displayNode('',!c_f);c_d.displayNode('error',!!c_f);if(!c_f)c_d.setNodeInnerHtml('infoTableShell',c_d.c_h({value:c_e}));c_d.getNode('fit').className='sizeInfoFit '+c_g+'Fit';c_d.getNode('fitInfo').className='sizeInfoFitInfo '+c_g+'Fit';c_a.prototype.updateUi.call(c_d);}};c_c.wireUi=function(){var c_d=this;if(!c_d.isWired){c_d.c_h=Uize.Template.compile(c_d.getNodeValue('bodySizesTemplate')||'',{openerToken:'[%',closerToken:'%]'});c_a.prototype.wireUi.call(c_d);}};c_b.registerProperties({c_e:{name:'value',onChange:function(){this.updateUi()}}});return c_b;}});
Uize.module({name:'Zazzle.ProductsGrid',superclass:'Uize.Widget',required:'Zazzle.GridCell.Product',builder:function(c_a){var c_b=true,c_c=false,c_d=null,c_e=Zazzle;var c_f=c_a.subclass(c_d,function(){var c_g=this,c_h=c_g.c_h,c_i=c_h.length;if(c_e.JumpPagination)c_g.addChild('jumpPagination',c_e.JumpPagination);for(var c_j=0;c_j<c_i;c_j++){var c_k=c_h[c_j];c_g.addChild(c_k.id,c_g.c_l,{isPrivate:c_k.isPrivate,productId:c_k.pid,productType:c_k.pdt,title:c_k.tl,index:c_k.idx,properties:c_k,productTypeDisplayName:c_k.pdtname,avgRating:c_k.rating});}}),c_m=c_f.prototype;c_m.getCell=function(c_n){return this.children[c_n];};c_m.wireUi=function(){var c_g=this,c_o=c_g.children.timer;if(!c_g.isWired){c_a.prototype.wireUi.call(c_g);if(c_o)c_o.resume();}};c_f.registerProperties({c_l:{name:'itemWidgetClass',value:c_e.GridCell.Product},c_h:{name:'items',value:[]},c_p:'maxPages'});return c_f;}});
Uize.module({name:'Zazzle.Comments',superclass:'Uize.Widget',required:'Uize.Widget.ThumbZoom',builder:function(c_a){var c_b=c_a.subclass(null,function(){this.addChild('thumbZoom',Uize.Widget.ThumbZoom,{imageValidator:null})}),c_c=c_b.prototype;c_c.wireUi=function(){var c_d=this;if(!c_d.isWired){var c_e=c_d.c_e;if(c_e){function c_f(c_g){c_d.wireNodeEvent(c_g.commentId+'Remove','onclick',function(){c_d.confirm({message:c_d.localize('removeMessage'),yesHandler:function(){c_d.callInherited('ensureLoggedIn')({callback:function(){c_d.getInherited('commObject').request({url:[c_d.getInherited('env').service+'gallery/comments',{ax:'DeleteComment',commentId:c_g.commentId,cn:c_g.commenter.userId}],returnType:'json',callback:function(c_h){if(!c_h.success)c_d.inform({message:c_d.localize('removeError')});else c_d.fire('Comment Removed');}})}});}})});}for(var c_i=0;c_i<c_e.length;c_i++)c_f(c_e[c_i]);c_d.children.thumbZoom.set({thumbNodes:{tagName:'IMG',className:'commentImageThumb',root:c_d.getNode('')}});}
c_a.prototype.wireUi.call(c_d);}};c_b.registerProperties({c_e:{name:'comments',onChange:function(){var c_d=this,c_j;if(c_d.isWired){c_d.unwireUi();if(c_d.get('html')!=c_j)c_d.set({built:false});c_d.insertOrWireUi();}}}});return c_b;}});
Uize.module({name:'Zazzle.CommentWall',superclass:'Uize.Widget',required:['Uize.Url','Uize.Widget.Button','Uize.Widget.Options.Tabbed','Uize.Template','Zazzle.Comments'],builder:function(c_a){var c_b=false,c_c=true,c_d=null,c_e='onclick',c_f=Uize,c_g=c_f.Url,c_h=Zazzle.Comments;var c_i=c_a.subclass(c_d,function(){var c_j=this,c_k=c_j.get('comments'),c_l='comments';c_j.c_l=c_l;c_j.c_m={comments:{c_n:'GetComments',c_o:!!c_k,c_p:c_j.c_q,c_r:c_k?c_k.length:0,c_s:c_j.get('numTotalComments')},onProducts:{c_n:'GetCommentsOnGalleryProducts'},byMember:{c_n:'GetCommentsByMember'}};c_j.addChild(c_l,c_h,{comments:c_k});c_j.addChild('onProducts',c_h);c_j.addChild('byMember',c_h);var c_t=c_j.addChild('tabs',c_f.Widget.Options.Tabbed,{bodyClassActive:'box'+(!c_j.c_u?' podTabActive':''),bodyClassInactive:'podTabInactive',value:c_l,values:[c_l,'onProducts','byMember']});}),c_v=c_i.prototype;c_v.c_w=Uize.Widget.Button.addChildButton;c_v.c_x=function(c_y){location.hash=this.get('idPrefix')+'-'+c_y;location.hash=c_y;};
c_v.c_z=function(c_A){var c_j=this,c_B=c_j.getInherited('env'),c_C=c_j.getInherited('user'),c_D=c_A.c_D,c_p=c_A.c_p,c_E=c_A.c_E!==c_b,c_F=c_j.c_m[c_D],c_G=c_C.id==c_j.c_H;function c_I(c_r,c_s){c_j.setNodeInnerHtml('numCommentsShown',c_r);c_j.setNodeInnerHtml('numComments',c_s);c_j.setNodeStyle('seeAllComments',{display:c_r<c_s?'inline':'none'});if(c_A.c_J)c_A.c_J();}if(!c_E|| !c_F.c_o||(c_p&&c_F.c_p!=c_p)){c_j.getInherited('commObject').request({url:[c_j.getInherited('env').service+'gallery/comments',{ax:c_F.c_n,cn:c_j.c_H,pd:c_j.c_u||c_d,pg:1,ps:c_p||c_j.c_q,useCache:c_E}],returnType:'json',callback:function(c_K){var c_k=c_K.comments||[],c_L=c_k.length,c_M=c_K.numResults,c_N=c_j.children[c_D],c_O=c_N.get('idPrefix');for(var c_P=0;c_P<c_L;c_P++){var c_Q=c_k[c_P],c_R=c_Q.commenter.contributorIconFilename;c_Q.idPrefix=c_O+'-'+c_Q.commentId;c_Q.canDelete=c_G||c_C.handle.toUpperCase()==c_Q.commenter.handle.toUpperCase();c_Q.commenter.url=c_B.www+c_Q.commenter.handle;c_Q.commenter.iconUrl=c_R?c_g.resolve(
c_B.realview,{action:'getimage',id:c_R,max_dim:40,bg:c_j.c_S}):c_B.assets+'icons/contributor/genericUserIcon.gif';}c_N.set({comments:c_k});c_f.copyInto(c_F,{c_o:c_c,c_p:c_p,c_r:c_L,c_s:c_M});c_I(c_L,c_M);}});}else c_I(c_F.c_r,c_F.c_s);};c_v.wireUi=function(){var c_j=this;if(!c_j.isWired){var c_T=c_j.children,c_t=c_T.tabs,c_U=c_t.get('values'),c_V=c_j.getProvider('env'),c_W=c_j.getNode('commentTemplate'),c_X=c_W?c_f.Template.compile(c_j.getNodeValue(c_W).replace(/^\s*\<\!\[CDATA\[([\s\S]*?)\]\]\>\s*$/,'$1'),{openerToken:'[%',closerToken:'%]'}):c_d;c_T.comments.set({html:c_X});c_T.onProducts.set({html:c_X});c_T.byMember.set({html:c_X});function c_Y(c_D){c_T[c_D].wire('Comment Removed',function(){var c_Z=c_j.c_m[c_D];if(c_Z.c_r>1)c_j.c_z({c_D:c_D,c_p:c_Z.c_p,c_E:c_b});else location.reload(c_c);})}for(var c_0=0;c_0<c_U.length;c_0++)c_Y(c_U[c_0]);c_t.wire('Before Value Change',function(c_1){c_j.c_z({c_D:c_1.value})});c_j.wireNodeEvent(['seeAllComments','seeAllComments2'],c_e,
function(){c_j.c_z({c_D:c_t+'',c_p:200})});c_j.wireNodeEvent(['addone','addone2'],c_e,function(){c_j.callInherited('useDialog')({component:{name:'gallery/addCommentDialog',params:{cn:c_j.c_H,pd:c_j.c_u}},widgetClassName:'Zazzle.AddCommentDialog',widgetProperties:{name:'addCommentDialog',mode:'new',offsetX:386,offsetY:-42},submitHandler:function(){var c_l=c_j.c_l;c_j.c_z({c_D:c_l,c_p:c_j.c_m[c_l].c_p,c_E:c_b});c_j.children.tabs.set({value:c_l});c_j.c_x('commentAnchor');}});});c_V.wire('Changed.user',function(){var c_C=c_V.get('user'),c_m=c_j.c_m;if(c_C.isLoggedIn&&c_C.id==c_j.c_H){for(var c_Z in c_m)c_m[c_Z].c_o=c_b;c_j.c_z({c_D:c_t+''});}});if(!c_j.c_m.comments.c_o)c_j.c_z({c_D:'comments'});c_a.prototype.wireUi.call(c_j);}};c_i.registerProperties({c_H:'contributorId',c_q:{name:'defaultPageSize',value:20},c_S:{name:'imageBgColor',value:'0xffffff'},c_u:'productId'});return c_i;}});
Uize.module({name:'Zazzle.VolDiscChart',superclass:'Uize.Widget',required:['Uize.Template','Uize.Data'],builder:function(c_a){var c_b=c_a.subclass(),c_c=c_b.prototype;c_c.c_d=function(){var c_e=this;if(c_e.isWired){c_e.c_f.request({url:[c_e.getInherited('env').service+'product/getvolumedisc',{pt:c_e.c_g,contentOwner:c_e.c_h},c_e.c_i],returnType:'json',requestMethod:'POST',callback:function(c_j){if(!c_j||c_j.result=='invalid'){c_j=[];}c_e.set({c_k:c_j});},cache:'memory'});}};c_c.updateUi=function(){var c_e=this,c_k=c_e.c_k;if(c_e.getNode('')){if(!c_k|| !c_k.length)c_e.displayNode('',false);if(c_k&&c_k.length&&c_e.c_l){c_e.displayNode();c_e.setNodeInnerHtml('',c_e.c_l({discounts:c_k}));}}};c_c.wireUi=function(){var c_e=this;c_e.c_f=c_e.getInherited('commObject');if(!c_e.isWired){c_e.c_l=Uize.Template.compile(c_e.getNodeValue('template')||'',{openerToken:'[%',closerToken:'%]'});c_a.prototype.wireUi.call(c_e);c_e.c_d();}};c_b.registerProperties({c_k:{name:'discounts',onChange:function(){this.updateUi()},
conformer:function(c_k){return Uize.Data.identical(c_k,this.c_k)?this.c_k:c_k}},c_g:{name:'productType',onChange:c_c.c_d},c_h:{name:'contentOwner',onChange:c_c.c_d},c_i:{name:'attributes',onChange:c_c.c_d}});return c_b;}});

