// FIXME: pick a consistent javascript style! underscores for vars or camelCase?
function impressUrl(e){return"http://"+IMPRESS_HOST+e}function PetType(){function r(){n?e.onUpdate():$.getJSON("/pet_types/"+e.id+"/swf_assets.json",function(t){e.assets=t,n=!0,e.onUpdate()})}function i(){Preview.disable(e.deactivation_msg)}var e=this,t=!1,n=!1;this.activated=!0,this.assets=[],this.deactivate=function(){var e;this.activated=!1,this.deactivation_msg=$("#swf-assets-not-found-template").tmpl({color_name:this.color_name.capitalize(),species_name:this.species_name.capitalize()}),this==PetType.current&&i();var t=this.link.children("img").get(0);this.link.addClass("deactivated"),t.src=t.src.replace("/1/","/2/")},this.load=function(){Item.current.load(this),r()},this.setAsCurrent=function(){PetType.current=this,speciesList.filter(".current").removeClass("current"),this.link.addClass("current"),customize_more_el.attr("href","http://impress.openneo.net/wardrobe?species="+this.species_id+"&color="+this.color_id+"&objects[]="+Item.current.id),this.activated?(Preview.enable(),this.load()):i()},this.onUpdate=function(){e==PetType.current&&Preview.update()}}function Item(e){this.assets_by_body_id={},this.id=e,this.load=function(t){var n="/items/"+e+"/bodies/"+t.body_id+"/swf_assets.json",r=this;this.getAssetsForPetType(t).length?t.onUpdate():$.getJSON(n,function(e){r.setAssetsForPetType(e,t)})},this.loadAllStandard=function(){var t=this;$.getJSON("/items/"+e+"/swf_assets.json",function(e){$.each(e,function(e){t.assets_by_body_id[parseInt(e)]=this}),$.each(PetType.all,function(){t.getAssetsForPetType(this).length==0&&this.deactivate()})})},this.getAssetsForPetType=function(e){return this.assets_by_body_id[e.body_id]||this.assets_by_body_id[0]||[]},this.setAsCurrent=function(){Item.current=this},this.setAssetsForPetType=function(e,t){e.length?(this.assets_by_body_id[t.body_id]=e,t.onUpdate()):t.deactivate()}}var PREVIEW_SWF_ID="item-preview-swf",PREVIEW_SWF=document.getElementById(PREVIEW_SWF_ID),speciesList=$("#item-preview a"),customize_more_el=$("#customize-more"),MainWardrobe;if(typeof console=="undefined"||typeof console.log=="undefined")function log(){}else log=$.proxy(console,"log");String.prototype.capitalize=function(){return this.charAt(0).toUpperCase()+this.substr(1)},PetType.all={},PetType.DASH_REGEX=/-/g,PetType.createFromLink=function(e){var t=new PetType;return $.each(e.get(0).attributes,function(){this.name.substr(0,5)=="data-"&&(t[this.name.substr(5).replace(PetType.DASH_REGEX,"_")]=this.value)}),t.link=e,PetType.all[t.id]=t,t},Item.createFromLocation=function(){var e=new Item(parseInt(document.location.pathname.substr(7),10)),t=CURRENT_ITEM_ZONES_RESTRICT,n=t.length;e.restricted_zones=[];for(i=0;i").each(function(){var e=$(this);e.height()