function Asset(d,e,f){var g=this;this.CONCEALED=1;this.REVEALING=2;this.REVEALED=3;this.CONCEALING=4;this.reveal=function(){if(this.state==this.CONCEALED){this.$popup.show().animate({opacity:1,bottom:this.bottom},250,'swing',this.revealed_handler)}};this.conceal=function(){if(this.state==this.REVEALED){this.$popup.animate({opacity:0,bottom:0},125,'linear',this.concealed_handler)}};this.revealed_handler=function(a){g.state=g.REVEALED;if(!g.hovering){g.conceal()}};this.concealed_handler=function(a){g.$popup.hide();g.state=g.CONCEALED;if(g.hovering){g.reveal()}};this.enter_handler=function(a){g.hovering=true;g.assets.enter_handler(g.id);g.reveal()};this.leave_handler=function(a){g.hovering=false;g.conceal()};this.add_listeners=function(){this.$button.hover(this.enter_handler,this.leave_handler)};this.initialise=function(a,b,c){this.id=a;this.assets=c;this.$asset=$(b);this.$popup=this.$asset.find('.popup');this.$button=this.$asset.find('a');this.bottom=(this.$button.height()/2)+2;this.state=this.CONCEALED;this.hovering=false;this.set_depth(a+100);this.add_listeners()};this.set_depth=function(a){this.$asset.css('z-index',a)};this.get_depth=function(){return this.$asset.css('z-index')};this.swap_depth=function(a){var b=a.get_depth();a.set_depth(this.get_depth());this.set_depth(b)};this.initialise(d,e,f)}var Assets={assets:[],current_id:null,count:null,initialise:function(){$('.asset').each(this.add_asset)},add_asset:function(a,b){Assets.assets[a]=new Asset(a,b,Assets);Assets.current_id=a},enter_handler:function(a){if(a!=this.current_id){this.assets[a].swap_depth(this.assets[this.current_id]);this.current_id=a}}};$(document).ready(function(){Assets.initialise()});
