$.fn.notify=function(){return this.stop(!0,!0).show("slow").delay(5e3).hide("fast")},$.fn.startLoading=function(){return this.delay(1e3).queue(function(e){$(this).addClass("loading"),e()})},$.fn.stopLoading=function(){return this.removeClass("loading").clearQueue()};var Partial={},main_wardrobe,View=Wardrobe.getStandardView({Preview:{swf_url:"/swfs/preview.swf?v=0.12",wrapper:$("#preview-swf"),placeholder:$("#preview-swf-container"),image_container:"#preview-image-container"}});Partial.ItemSet=function(t,n){function h(e){return function(t){var n,r,i;for(var o=0;o500;e!=t&&(t=e,$(document.body).toggleClass("fullscreen",t),t||(s.removeAttr("style").css("visibility","visible"),r.removeAttr("style"),u.removeAttr("style")))}if(t){s=$("#preview-swf");var n={height:i.offset().top-r.offset().top,width:r.innerWidth()-o.outerWidth()-12},f={},h={},p={old:{height:s.height(),width:s.width()},next:{}},d;n.height>n.width?(f.larger="height",f.smaller="width",h.active="marginTop",h.inactive="marginLeft"):(f.larger="width",f.smaller="height",h.active="marginLeft",h.inactive="marginTop"),p.next[f.smaller]=n[f.smaller],p.next[f.larger]=n[f.smaller],p.next[h.active]=(n[f.larger]-p.next[f.larger])/2,p.next[h.inactive]=0,s.css(p.next),r.height(n.height);var v=n.height-a.outerHeight()-1;u.height(v)}}function p(){setTimeout(h,0)}var t=$(document.body).hasClass("fullscreen"),n=$(window),r=$("#preview"),i=$("#preview-search-form"),s=$("#preview-swf"),o=$("#preview-sidebar"),u=$("#preview-sidebar-content"),a=$("#preview-sidebar-navbar"),f=$("#footer"),l=$(window),c=!1;$("#preview").data("fit",h),n.resize(h).load(h),e.item_zone_sets.bind("update",p),e.pet_attributes.bind("update",p),h()},View.Hash=function(e){function a(){var e=(document.location.hash||document.location.search).substr(1);e!=r&&(f(e),r=e)}function f(n){var r={},u=n.split("&");i=!0;for(var a=0;a").parent().html();return r}function h(){e.image_subscriptions.unsubscribe(c),c=null}function d(t){c=e.image_subscriptions.subscribe(t)}function v(e){e&&p.hasClass("sharing")&&d(e)}function g(){b("small_image"),b("medium_image"),b("large_image"),y("permalink")}function y(e){w(e,f.text(l[e]))}function b(e){w(e,f.image(l[e],l.permalink))}function w(e,t){r[e].val(t)}var n=$("#preview-sharing"),r={permalink:$("#preview-sharing-permalink-url"),large_image:$("#preview-sharing-large-image-url"),medium_image:$("#preview-sharing-medium-image-url"),small_image:$("#preview-sharing-small-image-url")},i=$("#preview-sharing-url-formats li"),s=$("#preview-sharing-thumbnail"),o={html:{image:$("#sharing-html-image-template"),text:$("#sharing-html-text-template")},bbcode:{image:$("#sharing-bbcode-image-template"),text:$("#sharing-bbcode-text-template")}},a={plain:{image:function(e){return e},text:function(e){return e}},html:{image:function(e,t){return u(o.html.image,{image_url:e,permalink:t})},text:function(e){return u(o.html.text,{permalink:e})}},bbcode:{image:function(e,t){return u(o.bbcode.image,{image_url:e,permalink:t})},text:function(e){return u(o.bbcode.text,{permalink:e})}}},f=a.plain,l={permalink:null,small_image:null,medium_image:null,large_image:null};i.click(function(){var e=$(this);i.removeClass("active"),e.addClass("active"),log("Setting sharing URL format:",e.attr("data-format")),f=a[e.attr("data-format")],g()});var c=null,m={id:null};this.setOutfit=function(t){if(!t.id)return P.startLoading(),e.outfits.share(t),!1;t.id!=m.id&&(m=t.clone(),l.permalink=L(t),l.small_image=k(t.image_versions.small),l.medium_image=k(t.image_versions.medium),l.large_image=k(t.image_versions.large),g(),n.removeClass("thumbnail-available"),v(m)),n.addClass("urls-loaded")},this.startLoading=function(){n.removeClass("urls-loaded")},this.onHide=function(){h()},this.onShow=function(){v(e.outfits.getOutfit())},e.image_subscriptions.bind("imageEnqueued",function(e){e.id==m.id&&(log("Sharing thumbnail enqueued for outfit",e),n.removeClass("thumbnail-loaded"))}),e.image_subscriptions.bind("imageReady",function(e){if(e.id==m.id){log("Sharing thumbnail ready for outfit",e);var t=e.image_versions.small+"?"+e.image_layers_hash;s.attr("src",t),n.addClass("thumbnail-loaded"),n.addClass("thumbnail-available"),h(e)}}),e.outfits.bind("updateSuccess",function(e){p.hasClass("sharing")&&d(e)}),e.outfits.bind("setOutfit",function(e){log("Sharing sees the setOutfit signal, and will set",e),P.setOutfit(e)})};u.click(function(){e.outfits.update()}),n.submit(function(t){t.preventDefault(),n.startLoading(),e.outfits.create({starred:n.hasClass("starred"),name:r.val()})}),n.find("div.outfit-star").click(function(){n.toggleClass("starred")}),e.outfits.bind("saveSuccess",function(e){l.notify()}),e.outfits.bind("createSuccess",function(e){b(),S()}),e.outfits.bind("shareSuccess",B),e.outfits.bind("shareSkipped",B),e.outfits.bind("updateClosetItems",j),e.outfits.bind("updateWornItems",j),e.outfits.bind("updatePetState",j),e.outfits.bind("saveFailure",F),e.outfits.bind("saveFailure",F),e.outfits.bind("shareFailure",function(e,t){f.stopLoading(),F(e,t)}),e.outfits.bind("outfitNotFound",function(){o.notify()})},View.PetStateForm=function(e){function s(e){e&&i.val(e.id)}var t="pet_state_id",n="#pet-state-form",r=$(n),i=r.children("select");i.change(function(t){var n=parseInt(i.children(":selected").val(),10);e.outfits.setPetStateById(n)}),e.outfits.bind("petTypeLoaded",function(t){var n=t.pet_states,o,u,a;i.children().remove();if(n.length==1)r.addClass("hidden");else{r.removeClass("hidden");for(var o=0;o",{value:n[o].id,text:n[o].gender_mood_description}),a.appendTo(i);s(e.outfits.getPetState())}}),e.outfits.bind("updatePetState",s)},View.PetTypeForm=function(e){function i(e){r&&e&&$.each(n,function(t){n[t].val(e[t+"_id"])})}var t=$("#pet-type-form"),n={},r=!1;t.submit(function(t){t.preventDefault(),e.outfits.setPetTypeByColorAndSpecies(+n.color.val(),+n.species.val())}).children("select").each(function(){n[this.name]=$(this)}),this.initialize=function(){e.pet_attributes.load()},e.pet_attributes.bind("update",function(t){$.each(t,function(e){var t=n[e];$.each(this,function(){var e=$("